1 line
22 KiB
JavaScript
1 line
22 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.websdk=t():e.websdk=t()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[653],{3246:function(e,t,n){n.d(t,{H7:function(){return u},XZ:function(){return i},_W:function(){return c}}),n(7941),n(9554),n(1539),n(4747),n(6699),n(2023);var r=n(5531),o=n(7252);function s(){var e=this.context.appName,t=this.context.orgName;return!(!e||!t)||(this.onError&&this.onError({type:r.E.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function a(){var e;if(!this.context.accessToken){var t=o.Z.create({type:r.E.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return this.onError&&this.onError(t),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",t),!1}return!0}function i(){return a.call(this)&&s.call(this)}function c(e){var t=e.data,n=e.type;return{data:{status:Object.keys(t.errorKeys).length>0?"fail":"success",errorKeys:t.errorKeys,successKeys:t.successKeys},type:n}}function u(e){var t=e.data,n=void 0;return Object.keys(t.errorKeys).length>0&&Object.keys(t.errorKeys).forEach((function(e){var s=t.errorKeys[e];n=s.includes("is not part of you")?o.Z.create({type:r.E.NO_PERMISSION,message:s}):s.includes("size of metadata for this single chatroom exceeds the user defined limit")||s.includes("total size of chatroom metadata for this app exceeds the user defined limit")||s.includes("is exceeding maximum limit")?o.Z.create({type:r.E.MAX_LIMIT,message:s}):s.includes("is not Legal")?o.Z.create({type:r.E.REQUEST_PARAMETER_ERROR,message:s}):s.includes("Failed to update userMetadata. Concurrent updates not allowed")?o.Z.create({type:r.E.OPERATION_NOT_ALLOWED,message:s}):o.Z.create({type:r.E.WEBIM_CONNCTION_AJAX_ERROR,message:s})})),n}},6007:function(e,t,n){n.r(t),n.d(t,{LocalCache:function(){return _},LocalCacheApi:function(){return r}});var r={};n.r(r),n.d(r,{clearConversationUnreadCount:function(){return K},getLocalConversation:function(){return F},getLocalConversations:function(){return P},removeLocalConversation:function(){return Z},setLocalConversationCustomField:function(){return j}}),n(1539),n(8674),n(2526),n(1817),n(2165),n(6992),n(8783),n(3948),n(1249),n(6699),n(3710),n(9601);const o=(e,t)=>t.some((t=>e instanceof t));let s,a;const i=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakMap,d=new WeakMap;let v={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return c.get(e);if("objectStoreNames"===t)return e.objectStoreNames||u.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return h(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function p(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(a||(a=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(f(this),e),h(i.get(this))}:function(...e){return h(t.apply(f(this),e))}:function(e,...n){const r=t.call(f(this),e,...n);return u.set(r,e.sort?e.sort():[e]),h(r)}:(e instanceof IDBTransaction&&function(e){if(c.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",s),e.removeEventListener("abort",s)},o=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",s),e.addEventListener("abort",s)}));c.set(e,t)}(e),o(e,s||(s=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,v):e);var t}function h(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",s)},o=()=>{t(h(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",s)}));return t.then((t=>{t instanceof
|