@trycourier/courier-react 8.0.8-beta → 8.0.9-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/renderer/legacy.d.ts +0 -4
- package/dist/renderer/modern.d.ts +0 -4
- package/dist/renderer/renderer.d.ts +0 -5
package/dist/index.js
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/function Se(){return Ce||(Ce=1,e=we,"production"!==process.env.NODE_ENV&&function(){var i=t,o=n,s=60103,r=60106;e.Fragment=60107;var a=60108,l=60114,d=60109,u=60110,c=60112,h=60113,p=60120,v=60115,g=60116,m=60121,b=60122,f=60117,_=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var x=Symbol.for;s=x("react.element"),r=x("react.portal"),e.Fragment=x("react.fragment"),a=x("react.strict_mode"),l=x("react.profiler"),d=x("react.provider"),u=x("react.context"),c=x("react.forward_ref"),h=x("react.suspense"),p=x("react.suspense_list"),v=x("react.memo"),g=x("react.lazy"),m=x("react.block"),b=x("react.server.block"),f=x("react.fundamental"),x("react.scope"),x("react.opaque.id"),_=x("react.debug_trace_mode"),x("react.offscreen"),y=x("react.legacy_hidden")}var C="function"==typeof Symbol&&Symbol.iterator,k=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];!function(e,t,n){var i=k.ReactDebugCurrentFrame.getStackAddendum();""!==i&&(t+="%s",n=n.concat([i]));var o=n.map((function(e){return""+e}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,n)}function S(e){return e.displayName||"Context"}function E(t){if(null==t)return null;if("number"==typeof t.tag&&w("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case e.Fragment:return"Fragment";case r:return"Portal";case l:return"Profiler";case a:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case u:return S(t)+".Consumer";case d:return S(t._context)+".Provider";case c:return s=t,b=t.render,f="ForwardRef",_=b.displayName||b.name||"",s.displayName||(""!==_?f+"("+_+")":f);case v:return E(t.type);case m:return E(t._render);case g:var n=t,i=n._payload,o=n._init;try{return E(o(i))}catch(y){return null}}var s,b,f,_;return null}var I,M,T,$,P,L,A,D=0;function R(){}R.__reactDisabledLog=!0;var B,O=k.ReactCurrentDispatcher;function F(e,t,n){if(void 0===B)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);B=i&&i[1]||""}return"\n"+B+e}var H,z=!1,U="function"==typeof WeakMap?WeakMap:Map;function N(e,t){if(!e||z)return"";var n,i=H.get(e);if(void 0!==i)return i;z=!0;var s,r=Error.prepareStackTrace;Error.prepareStackTrace=void 0,s=O.current,O.current=null,function(){if(0===D){I=console.log,M=console.info,T=console.warn,$=console.error,P=console.group,L=console.groupCollapsed,A=console.groupEnd;var e={configurable:!0,enumerable:!0,value:R,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}D++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(g){n=g}Reflect.construct(e,[],a)}else{try{a.call()}catch(g){n=g}e.call(a.prototype)}}else{try{throw Error()}catch(g){n=g}e()}}catch(m){if(m&&n&&"string"==typeof m.stack){for(var l=m.stack.split("\n"),d=n.stack.split("\n"),u=l.length-1,c=d.length-1;u>=1&&c>=0&&l[u]!==d[c];)c--;for(;u>=1&&c>=0;u--,c--)if(l[u]!==d[c]){if(1!==u||1!==c)do{if(u--,--c<0||l[u]!==d[c]){var h="\n"+l[u].replace(" at new "," at ");return"function"==typeof e&&H.set(e,h),h}}while(u>=1&&c>=0);break}}}finally{z=!1,O.current=s,function(){if(0==--D){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:o({},e,{value:I}),info:o({},e,{value:M}),warn:o({},e,{value:T}),error:o({},e,{value:$}),group:o({},e,{value:P}),groupCollapsed:o({},e,{value:L}),groupEnd:o({},e,{value:A})})}D<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=r}var p=e?e.displayName||e.name:"",v=p?F(p):"";return"function"==typeof e&&H.set(e,v),v}function j(e,t,n){return N(e,!1)}function q(e,t,n){if(null==e)return"";if("function"==typeof e)return N(e,!(!(i=e.prototype)||!i.isReactComponent));var i;if("string"==typeof e)return F(e);switch(e){case h:return F("Suspense");case p:return F("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return j(e.render);case v:return q(e.type,t,n);case m:return j(e._render);case g:var o=e,s=o._payload,r=o._init;try{return q(r(s),t,n)}catch(a){}}return""}H=new U;var V={},J=k.ReactDebugCurrentFrame;function W(e){if(e){var t=e._owner,n=q(e.type,e._source,t?t.type:null);J.setExtraStackFrame(n)}else J.setExtraStackFrame(null)}var Z,G,K=k.ReactCurrentOwner,X=Object.prototype.hasOwnProperty,Y={key:!0,ref:!0,__self:!0,__source:!0};function Q(e,t,n,i,o){var r,a={},l=null,d=null;for(r in void 0!==n&&(l=""+n),function(e){if(X.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(l=""+t.key),function(e){if(X.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(d=t.ref,function(e){"string"==typeof e.ref&&K.current}(t)),t)X.call(t,r)&&!Y.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps){var u=e.defaultProps;for(r in u)void 0===a[r]&&(a[r]=u[r])}if(l||d){var c="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var n=function(){Z||(Z=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(a,c),d&&function(e,t){var n=function(){G||(G=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(a,c)}return function(e,t,n,i,o,r,a){var l={$$typeof:s,type:e,key:t,ref:n,props:a,_owner:r,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,d,o,i,K.current,a)}var ee,te=k.ReactCurrentOwner,ne=k.ReactDebugCurrentFrame;function ie(e){if(e){var t=e._owner,n=q(e.type,e._source,t?t.type:null);ne.setExtraStackFrame(n)}else ne.setExtraStackFrame(null)}function oe(e){return"object"==typeof e&&null!==e&&e.$$typeof===s}function se(){if(te.current){var e=E(te.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ee=!1;var re={};function ae(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=se();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!re[n]){re[n]=!0;var i="";e&&e._owner&&e._owner!==te.current&&(i=" It was passed a child from "+E(e._owner.type)+"."),ie(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,i),ie(null)}}}function le(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var i=e[n];oe(i)&&ae(i,t)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=C&&e[C]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var s,r=o.call(e);!(s=r.next()).done;)oe(s.value)&&ae(s.value,t)}}function de(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==c&&n.$$typeof!==v)return;t=n.propTypes}if(t){var i=E(n);!function(e,t,n,i,o){var s=Function.call.bind(Object.prototype.hasOwnProperty);for(var r in e)if(s(e,r)){var a=void 0;try{if("function"!=typeof e[r]){var l=Error((i||"React class")+": "+n+" type `"+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[r]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}a=e[r](t,r,i,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}!a||a instanceof Error||(W(o),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",i||"React class",n,r,typeof a),W(null)),a instanceof Error&&!(a.message in V)&&(V[a.message]=!0,W(o),w("Failed %s type: %s",n,a.message),W(null))}}(t,e.props,"prop",i,e)}else void 0===n.PropTypes||ee||(ee=!0,w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ue(t,n,i,o,r,x){var C=function(t){return"string"==typeof t||"function"==typeof t||t===e.Fragment||t===l||t===_||t===a||t===h||t===p||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===g||t.$$typeof===v||t.$$typeof===d||t.$$typeof===u||t.$$typeof===c||t.$$typeof===f||t.$$typeof===m||t[0]===b)}(t);if(!C){var k,S="";(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),S+=se(),null===t?k="null":Array.isArray(t)?k="array":void 0!==t&&t.$$typeof===s?(k="<"+(E(t.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):k=typeof t,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,S)}var I=Q(t,n,i,r,x);if(null==I)return I;if(C){var M=n.children;if(void 0!==M)if(o)if(Array.isArray(M)){for(var T=0;T<M.length;T++)le(M[T],t);Object.freeze&&Object.freeze(M)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else le(M,t)}return t===e.Fragment?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var i=t[n];if("children"!==i&&"key"!==i){ie(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),ie(null);break}}null!==e.ref&&(ie(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),ie(null))}(I):de(I),I}var ce=function(e,t,n){return ue(e,t,n,!1)},he=function(e,t,n){return ue(e,t,n,!0)};e.jsx=ce,e.jsxs=he}()),we;var e}var Ee=(ke||(ke=1,"production"===process.env.NODE_ENV?ye.exports=function(){if(_e)return xe;_e=1;var e=t,n=60103;if(xe.Fragment=60107,"function"==typeof Symbol&&Symbol.for){var i=Symbol.for;n=i("react.element"),xe.Fragment=i("react.fragment")}var o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s=Object.prototype.hasOwnProperty,r={key:!0,ref:!0,__self:!0,__source:!0};function a(e,t,i){var a,l={},d=null,u=null;for(a in void 0!==i&&(d=""+i),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,a)&&!r.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:n,type:e,key:d,ref:u,props:l,_owner:o.current}}return xe.jsx=a,xe.jsxs=a,xe}():ye.exports=Se()),ye.exports);function Ie(e){const t=document.createElement("div");return i.flushSync((()=>{!function(e,t){const n=i.createRoot;if(n instanceof Function){return n(t).render(e)}(0,i.render)(e,t)}(e,t)})),t}e.CourierInbox=e=>{const n=t.useRef(null);return t.useEffect((()=>{const t=n.current;t&&t.onMessageClick(e.onMessageClick)}),[e.onMessageClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageActionClick(e.onMessageActionClick)}),[e.onMessageActionClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageLongPress(e.onMessageLongPress)}),[e.onMessageLongPress,n]),t.useEffect((()=>{const t=n.current;t&&e.renderHeader&&queueMicrotask((()=>{t.setHeader((t=>Ie(e.renderHeader(t))))}))}),[e.renderHeader,n]),t.useEffect((()=>{const t=n.current;t&&e.renderListItem&&queueMicrotask((()=>{t.setListItem((t=>Ie(e.renderListItem(t))))}))}),[e.renderListItem,n]),t.useEffect((()=>{const t=n.current;t&&e.renderEmptyState&&queueMicrotask((()=>{t.setEmptyState((t=>Ie(e.renderEmptyState(t))))}))}),[e.renderEmptyState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderLoadingState&&queueMicrotask((()=>{t.setLoadingState((t=>Ie(e.renderLoadingState(t))))}))}),[e.renderLoadingState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderErrorState&&queueMicrotask((()=>{t.setErrorState((t=>Ie(e.renderErrorState(t))))}))}),[e.renderErrorState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPaginationItem&&queueMicrotask((()=>{t.setPaginationItem((t=>Ie(e.renderPaginationItem(t))))}))}),[e.renderPaginationItem,n]),t.useEffect((()=>{const t=n.current;t&&queueMicrotask((()=>{t.setFeedType(e.feedType||"inbox")}))}),[e.feedType,n]),Ee.jsx("courier-inbox",{ref:n,height:e.height,"light-theme":e.lightTheme?JSON.stringify(e.lightTheme):void 0,"dark-theme":e.darkTheme?JSON.stringify(e.darkTheme):void 0,mode:e.mode})},e.CourierInboxMenu=e=>{const n=t.useRef(null);return t.useEffect((()=>{const t=n.current;t&&t.onMessageClick(e.onMessageClick)}),[e.onMessageClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageActionClick(e.onMessageActionClick)}),[e.onMessageActionClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageLongPress(e.onMessageLongPress)}),[e.onMessageLongPress,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupHeader&&queueMicrotask((()=>{t.setPopupHeader((t=>Ie(e.renderPopupHeader(t))))}))}),[e.renderPopupHeader,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupListItem&&queueMicrotask((()=>{t.setPopupListItem((t=>Ie(e.renderPopupListItem(t))))}))}),[e.renderPopupListItem,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupEmptyState&&queueMicrotask((()=>{t.setPopupEmptyState((t=>Ie(e.renderPopupEmptyState(t))))}))}),[e.renderPopupEmptyState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupLoadingState&&queueMicrotask((()=>{t.setPopupLoadingState((t=>Ie(e.renderPopupLoadingState(t))))}))}),[e.renderPopupLoadingState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupErrorState&&queueMicrotask((()=>{t.setPopupErrorState((t=>Ie(e.renderPopupErrorState(t))))}))}),[e.renderPopupErrorState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupPaginationItem&&queueMicrotask((()=>{t.setPopupPaginationItem((t=>Ie(e.renderPopupPaginationItem(t))))}))}),[e.renderPopupPaginationItem,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupMenuButton&&queueMicrotask((()=>{t.setPopupMenuButton((t=>Ie(e.renderPopupMenuButton(t))))}))}),[e.renderPopupMenuButton,n]),t.useEffect((()=>{const t=n.current;t&&queueMicrotask((()=>{t.setFeedType(e.feedType||"inbox")}))}),[e.feedType,n]),Ee.jsx("courier-inbox-menu",{ref:n,"popup-alignment":e.popupAlignment,"popup-width":e.popupWidth,"popup-height":e.popupHeight,left:e.left,top:e.top,right:e.right,bottom:e.bottom,"light-theme":e.lightTheme?JSON.stringify(e.lightTheme):void 0,"dark-theme":e.darkTheme?JSON.stringify(e.darkTheme):void 0,mode:e.mode})},e.useCourier=()=>{const e=e=>M.shared.signIn(e),n=()=>M.shared.signOut(),i=e=>ee.shared.load(e),o=e=>ee.shared.fetchNextPageOfMessages(e),s=e=>M.shared.paginationLimit=e,r=e=>ee.shared.readMessage({message:e}),a=e=>ee.shared.unreadMessage({message:e}),l=e=>ee.shared.clickMessage({message:e}),d=e=>ee.shared.archiveMessage({message:e}),u=e=>ee.shared.openMessage({message:e}),c=e=>ee.shared.unarchiveMessage({message:e}),h=()=>ee.shared.readAllMessages(),[p,v]=t.useState({userId:void 0,signIn:e,signOut:n}),[g,m]=t.useState({load:i,fetchNextPageOfMessages:o,setPaginationLimit:s,readMessage:r,unreadMessage:a,clickMessage:l,archiveMessage:d,openMessage:u,unarchiveMessage:c,readAllMessages:h});t.useEffect((()=>{const e=M.shared.addAuthenticationListener((()=>b())),t=new he({onError:e=>f(e),onDataSetChange:()=>f(),onPageAdded:()=>f(),onMessageAdd:()=>f(),onMessageRemove:()=>f(),onMessageUpdate:()=>f(),onUnreadCountChange:()=>f()});return ee.shared.addDataStoreListener(t),b(),f(),()=>{e.remove(),t.remove()}}),[]);const b=()=>{var t;const i=null==(t=M.shared.client)?void 0:t.options;v({userId:null==i?void 0:i.userId,signIn:e,signOut:n})},f=e=>{const t=ee.shared;m({load:i,fetchNextPageOfMessages:o,setPaginationLimit:s,readMessage:r,unreadMessage:a,clickMessage:l,archiveMessage:d,openMessage:u,unarchiveMessage:c,readAllMessages:h,inbox:t.inboxDataSet,archive:t.archiveDataSet,unreadCount:t.unreadCount,error:e})};return{shared:M.shared,auth:p,inbox:g}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
9
|
+
*/function Se(){return Ce||(Ce=1,e=we,"production"!==process.env.NODE_ENV&&function(){var i=t,o=n,s=60103,r=60106;e.Fragment=60107;var a=60108,l=60114,d=60109,u=60110,c=60112,h=60113,p=60120,v=60115,g=60116,m=60121,b=60122,f=60117,_=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var x=Symbol.for;s=x("react.element"),r=x("react.portal"),e.Fragment=x("react.fragment"),a=x("react.strict_mode"),l=x("react.profiler"),d=x("react.provider"),u=x("react.context"),c=x("react.forward_ref"),h=x("react.suspense"),p=x("react.suspense_list"),v=x("react.memo"),g=x("react.lazy"),m=x("react.block"),b=x("react.server.block"),f=x("react.fundamental"),x("react.scope"),x("react.opaque.id"),_=x("react.debug_trace_mode"),x("react.offscreen"),y=x("react.legacy_hidden")}var C="function"==typeof Symbol&&Symbol.iterator,k=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];!function(e,t,n){var i=k.ReactDebugCurrentFrame.getStackAddendum();""!==i&&(t+="%s",n=n.concat([i]));var o=n.map((function(e){return""+e}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}("error",e,n)}function S(e){return e.displayName||"Context"}function E(t){if(null==t)return null;if("number"==typeof t.tag&&w("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),"function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case e.Fragment:return"Fragment";case r:return"Portal";case l:return"Profiler";case a:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList"}if("object"==typeof t)switch(t.$$typeof){case u:return S(t)+".Consumer";case d:return S(t._context)+".Provider";case c:return s=t,b=t.render,f="ForwardRef",_=b.displayName||b.name||"",s.displayName||(""!==_?f+"("+_+")":f);case v:return E(t.type);case m:return E(t._render);case g:var n=t,i=n._payload,o=n._init;try{return E(o(i))}catch(y){return null}}var s,b,f,_;return null}var I,M,T,$,P,L,A,D=0;function R(){}R.__reactDisabledLog=!0;var B,O=k.ReactCurrentDispatcher;function F(e,t,n){if(void 0===B)try{throw Error()}catch(o){var i=o.stack.trim().match(/\n( *(at )?)/);B=i&&i[1]||""}return"\n"+B+e}var H,z=!1,U="function"==typeof WeakMap?WeakMap:Map;function N(e,t){if(!e||z)return"";var n,i=H.get(e);if(void 0!==i)return i;z=!0;var s,r=Error.prepareStackTrace;Error.prepareStackTrace=void 0,s=O.current,O.current=null,function(){if(0===D){I=console.log,M=console.info,T=console.warn,$=console.error,P=console.group,L=console.groupCollapsed,A=console.groupEnd;var e={configurable:!0,enumerable:!0,value:R,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}D++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(g){n=g}Reflect.construct(e,[],a)}else{try{a.call()}catch(g){n=g}e.call(a.prototype)}}else{try{throw Error()}catch(g){n=g}e()}}catch(m){if(m&&n&&"string"==typeof m.stack){for(var l=m.stack.split("\n"),d=n.stack.split("\n"),u=l.length-1,c=d.length-1;u>=1&&c>=0&&l[u]!==d[c];)c--;for(;u>=1&&c>=0;u--,c--)if(l[u]!==d[c]){if(1!==u||1!==c)do{if(u--,--c<0||l[u]!==d[c]){var h="\n"+l[u].replace(" at new "," at ");return"function"==typeof e&&H.set(e,h),h}}while(u>=1&&c>=0);break}}}finally{z=!1,O.current=s,function(){if(0==--D){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:o({},e,{value:I}),info:o({},e,{value:M}),warn:o({},e,{value:T}),error:o({},e,{value:$}),group:o({},e,{value:P}),groupCollapsed:o({},e,{value:L}),groupEnd:o({},e,{value:A})})}D<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=r}var p=e?e.displayName||e.name:"",v=p?F(p):"";return"function"==typeof e&&H.set(e,v),v}function j(e,t,n){return N(e,!1)}function q(e,t,n){if(null==e)return"";if("function"==typeof e)return N(e,!(!(i=e.prototype)||!i.isReactComponent));var i;if("string"==typeof e)return F(e);switch(e){case h:return F("Suspense");case p:return F("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return j(e.render);case v:return q(e.type,t,n);case m:return j(e._render);case g:var o=e,s=o._payload,r=o._init;try{return q(r(s),t,n)}catch(a){}}return""}H=new U;var V={},J=k.ReactDebugCurrentFrame;function W(e){if(e){var t=e._owner,n=q(e.type,e._source,t?t.type:null);J.setExtraStackFrame(n)}else J.setExtraStackFrame(null)}var Z,G,K=k.ReactCurrentOwner,X=Object.prototype.hasOwnProperty,Y={key:!0,ref:!0,__self:!0,__source:!0};function Q(e,t,n,i,o){var r,a={},l=null,d=null;for(r in void 0!==n&&(l=""+n),function(e){if(X.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(l=""+t.key),function(e){if(X.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(d=t.ref,function(e){"string"==typeof e.ref&&K.current}(t)),t)X.call(t,r)&&!Y.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps){var u=e.defaultProps;for(r in u)void 0===a[r]&&(a[r]=u[r])}if(l||d){var c="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var n=function(){Z||(Z=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(a,c),d&&function(e,t){var n=function(){G||(G=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(a,c)}return function(e,t,n,i,o,r,a){var l={$$typeof:s,type:e,key:t,ref:n,props:a,_owner:r,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,d,o,i,K.current,a)}var ee,te=k.ReactCurrentOwner,ne=k.ReactDebugCurrentFrame;function ie(e){if(e){var t=e._owner,n=q(e.type,e._source,t?t.type:null);ne.setExtraStackFrame(n)}else ne.setExtraStackFrame(null)}function oe(e){return"object"==typeof e&&null!==e&&e.$$typeof===s}function se(){if(te.current){var e=E(te.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}ee=!1;var re={};function ae(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=se();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!re[n]){re[n]=!0;var i="";e&&e._owner&&e._owner!==te.current&&(i=" It was passed a child from "+E(e._owner.type)+"."),ie(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,i),ie(null)}}}function le(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var i=e[n];oe(i)&&ae(i,t)}else if(oe(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=C&&e[C]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var s,r=o.call(e);!(s=r.next()).done;)oe(s.value)&&ae(s.value,t)}}function de(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==c&&n.$$typeof!==v)return;t=n.propTypes}if(t){var i=E(n);!function(e,t,n,i,o){var s=Function.call.bind(Object.prototype.hasOwnProperty);for(var r in e)if(s(e,r)){var a=void 0;try{if("function"!=typeof e[r]){var l=Error((i||"React class")+": "+n+" type `"+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[r]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}a=e[r](t,r,i,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}!a||a instanceof Error||(W(o),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",i||"React class",n,r,typeof a),W(null)),a instanceof Error&&!(a.message in V)&&(V[a.message]=!0,W(o),w("Failed %s type: %s",n,a.message),W(null))}}(t,e.props,"prop",i,e)}else void 0===n.PropTypes||ee||(ee=!0,w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ue(t,n,i,o,r,x){var C=function(t){return"string"==typeof t||"function"==typeof t||t===e.Fragment||t===l||t===_||t===a||t===h||t===p||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===g||t.$$typeof===v||t.$$typeof===d||t.$$typeof===u||t.$$typeof===c||t.$$typeof===f||t.$$typeof===m||t[0]===b)}(t);if(!C){var k,S="";(void 0===t||"object"==typeof t&&null!==t&&0===Object.keys(t).length)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),S+=se(),null===t?k="null":Array.isArray(t)?k="array":void 0!==t&&t.$$typeof===s?(k="<"+(E(t.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):k=typeof t,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,S)}var I=Q(t,n,i,r,x);if(null==I)return I;if(C){var M=n.children;if(void 0!==M)if(o)if(Array.isArray(M)){for(var T=0;T<M.length;T++)le(M[T],t);Object.freeze&&Object.freeze(M)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else le(M,t)}return t===e.Fragment?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var i=t[n];if("children"!==i&&"key"!==i){ie(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),ie(null);break}}null!==e.ref&&(ie(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),ie(null))}(I):de(I),I}var ce=function(e,t,n){return ue(e,t,n,!1)},he=function(e,t,n){return ue(e,t,n,!0)};e.jsx=ce,e.jsxs=he}()),we;var e}var Ee=(ke||(ke=1,"production"===process.env.NODE_ENV?ye.exports=function(){if(_e)return xe;_e=1;var e=t,n=60103;if(xe.Fragment=60107,"function"==typeof Symbol&&Symbol.for){var i=Symbol.for;n=i("react.element"),xe.Fragment=i("react.fragment")}var o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s=Object.prototype.hasOwnProperty,r={key:!0,ref:!0,__self:!0,__source:!0};function a(e,t,i){var a,l={},d=null,u=null;for(a in void 0!==i&&(d=""+i),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,a)&&!r.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:n,type:e,key:d,ref:u,props:l,_owner:o.current}}return xe.jsx=a,xe.jsxs=a,xe}():ye.exports=Se()),ye.exports);const Ie=parseInt(t.version.split(".")[0]);function Me(e){const t=document.createElement("div");return i.flushSync((()=>{!function(e,t){Ie>=18&&import("react-dom/client").then((({createRoot:n})=>{if(n instanceof Function){return n(t).render(e)}}));(0,i.render)(e,t)}(e,t)})),t}e.CourierInbox=e=>{const n=t.useRef(null);return t.useEffect((()=>{const t=n.current;t&&t.onMessageClick(e.onMessageClick)}),[e.onMessageClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageActionClick(e.onMessageActionClick)}),[e.onMessageActionClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageLongPress(e.onMessageLongPress)}),[e.onMessageLongPress,n]),t.useEffect((()=>{const t=n.current;t&&e.renderHeader&&queueMicrotask((()=>{t.setHeader((t=>Me(e.renderHeader(t))))}))}),[e.renderHeader,n]),t.useEffect((()=>{const t=n.current;t&&e.renderListItem&&queueMicrotask((()=>{t.setListItem((t=>Me(e.renderListItem(t))))}))}),[e.renderListItem,n]),t.useEffect((()=>{const t=n.current;t&&e.renderEmptyState&&queueMicrotask((()=>{t.setEmptyState((t=>Me(e.renderEmptyState(t))))}))}),[e.renderEmptyState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderLoadingState&&queueMicrotask((()=>{t.setLoadingState((t=>Me(e.renderLoadingState(t))))}))}),[e.renderLoadingState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderErrorState&&queueMicrotask((()=>{t.setErrorState((t=>Me(e.renderErrorState(t))))}))}),[e.renderErrorState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPaginationItem&&queueMicrotask((()=>{t.setPaginationItem((t=>Me(e.renderPaginationItem(t))))}))}),[e.renderPaginationItem,n]),t.useEffect((()=>{const t=n.current;t&&queueMicrotask((()=>{t.setFeedType(e.feedType||"inbox")}))}),[e.feedType,n]),Ee.jsx("courier-inbox",{ref:n,height:e.height,"light-theme":e.lightTheme?JSON.stringify(e.lightTheme):void 0,"dark-theme":e.darkTheme?JSON.stringify(e.darkTheme):void 0,mode:e.mode})},e.CourierInboxMenu=e=>{const n=t.useRef(null);return t.useEffect((()=>{const t=n.current;t&&t.onMessageClick(e.onMessageClick)}),[e.onMessageClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageActionClick(e.onMessageActionClick)}),[e.onMessageActionClick,n]),t.useEffect((()=>{const t=n.current;t&&t.onMessageLongPress(e.onMessageLongPress)}),[e.onMessageLongPress,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupHeader&&queueMicrotask((()=>{t.setPopupHeader((t=>Me(e.renderPopupHeader(t))))}))}),[e.renderPopupHeader,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupListItem&&queueMicrotask((()=>{t.setPopupListItem((t=>Me(e.renderPopupListItem(t))))}))}),[e.renderPopupListItem,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupEmptyState&&queueMicrotask((()=>{t.setPopupEmptyState((t=>Me(e.renderPopupEmptyState(t))))}))}),[e.renderPopupEmptyState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupLoadingState&&queueMicrotask((()=>{t.setPopupLoadingState((t=>Me(e.renderPopupLoadingState(t))))}))}),[e.renderPopupLoadingState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupErrorState&&queueMicrotask((()=>{t.setPopupErrorState((t=>Me(e.renderPopupErrorState(t))))}))}),[e.renderPopupErrorState,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupPaginationItem&&queueMicrotask((()=>{t.setPopupPaginationItem((t=>Me(e.renderPopupPaginationItem(t))))}))}),[e.renderPopupPaginationItem,n]),t.useEffect((()=>{const t=n.current;t&&e.renderPopupMenuButton&&queueMicrotask((()=>{t.setPopupMenuButton((t=>Me(e.renderPopupMenuButton(t))))}))}),[e.renderPopupMenuButton,n]),t.useEffect((()=>{const t=n.current;t&&queueMicrotask((()=>{t.setFeedType(e.feedType||"inbox")}))}),[e.feedType,n]),Ee.jsx("courier-inbox-menu",{ref:n,"popup-alignment":e.popupAlignment,"popup-width":e.popupWidth,"popup-height":e.popupHeight,left:e.left,top:e.top,right:e.right,bottom:e.bottom,"light-theme":e.lightTheme?JSON.stringify(e.lightTheme):void 0,"dark-theme":e.darkTheme?JSON.stringify(e.darkTheme):void 0,mode:e.mode})},e.useCourier=()=>{const e=e=>M.shared.signIn(e),n=()=>M.shared.signOut(),i=e=>ee.shared.load(e),o=e=>ee.shared.fetchNextPageOfMessages(e),s=e=>M.shared.paginationLimit=e,r=e=>ee.shared.readMessage({message:e}),a=e=>ee.shared.unreadMessage({message:e}),l=e=>ee.shared.clickMessage({message:e}),d=e=>ee.shared.archiveMessage({message:e}),u=e=>ee.shared.openMessage({message:e}),c=e=>ee.shared.unarchiveMessage({message:e}),h=()=>ee.shared.readAllMessages(),[p,v]=t.useState({userId:void 0,signIn:e,signOut:n}),[g,m]=t.useState({load:i,fetchNextPageOfMessages:o,setPaginationLimit:s,readMessage:r,unreadMessage:a,clickMessage:l,archiveMessage:d,openMessage:u,unarchiveMessage:c,readAllMessages:h});t.useEffect((()=>{const e=M.shared.addAuthenticationListener((()=>b())),t=new he({onError:e=>f(e),onDataSetChange:()=>f(),onPageAdded:()=>f(),onMessageAdd:()=>f(),onMessageRemove:()=>f(),onMessageUpdate:()=>f(),onUnreadCountChange:()=>f()});return ee.shared.addDataStoreListener(t),b(),f(),()=>{e.remove(),t.remove()}}),[]);const b=()=>{var t;const i=null==(t=M.shared.client)?void 0:t.options;v({userId:null==i?void 0:i.userId,signIn:e,signOut:n})},f=e=>{const t=ee.shared;m({load:i,fetchNextPageOfMessages:o,setPaginationLimit:s,readMessage:r,unreadMessage:a,clickMessage:l,archiveMessage:d,openMessage:u,unarchiveMessage:c,readAllMessages:h,inbox:t.inboxDataSet,archive:t.archiveDataSet,unreadCount:t.unreadCount,error:e})};return{shared:M.shared,auth:p,inbox:g}},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
|
10
10
|
//# sourceMappingURL=index.js.map
|