@frak-labs/components 1.0.2-beta.9b94b95c → 1.0.2-beta.bb30f110
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/cdn/Banner.BjcYEoH4.js +162 -0
- package/cdn/ButtonShare.DNdo_eQJ.js +1 -0
- package/cdn/{ButtonWallet.Cwz9qFhE.js → ButtonWallet.CN2iHSTB.js} +1 -1
- package/cdn/{OpenInAppButton.Hq9EjwJE.js → OpenInAppButton.C1Yipwka.js} +1 -1
- package/cdn/{PostPurchase.CencJT_C.js → PostPurchase.CTE-Q0eK.js} +2 -2
- package/cdn/components.js +1 -1
- package/cdn/formatReward.C7mU9_cV.js +1 -0
- package/cdn/loader.js +1 -1
- package/cdn/sharingPage.Do_xfrTN.js +1 -0
- package/cdn/{sprinkles.css.ts.vanilla.Ct795MMK.js → sprinkles.css.ts.vanilla.DCtQVHA4.js} +1 -1
- package/cdn/useGlobalComponents.UJmjUUxk.js +1 -0
- package/cdn/{useLightDomStyles.DqYouFn3.js → useLightDomStyles.Gt7YUMDl.js} +1 -1
- package/cdn/{usePlacement.Di6eZ4ty.js → usePlacement.BJ7qe-pw.js} +1 -1
- package/cdn/{useReward.DWyyva4u.js → useReward.QsQc2c1D.js} +1 -1
- package/dist/buttonShare.d.ts +9 -4
- package/dist/buttonShare.js +13 -218
- package/dist/postPurchase.js +26 -25
- package/dist/{sharingPage-BHH1xQ_w.js → sharingPage-DFvQbviS.js} +2 -2
- package/package.json +3 -3
- package/cdn/Banner.1iUbfe7Z.js +0 -162
- package/cdn/ButtonShare.DbUZUx82.js +0 -1
- package/cdn/formatReward.BaR9pE50.js +0 -1
- package/cdn/sharingPage.DX1H39Pz.js +0 -1
- package/cdn/useGlobalComponents.CLH7id-Y.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as e,i as t,n,r}from"./loader.js";var i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,t,n){var r,a,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?i.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return S(e,s,r,a,null)}function S(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++o,__i:-1,__u:0};return i==null&&a.vnode!=null&&a.vnode(s),s}function C(e){return e.children}function w(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?T(e):null}function E(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=y({},t);o.__v=t.__v+1,a.vnode&&a.vnode(o),F(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??T(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,re(r,o,i),t.__e=t.__=null,o.__e!=n&&D(o)}}function D(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),D(e)}function O(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!k.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(k)}function k(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,E(e)}finally{s.length=k.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y,b=r&&r.__k||g,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||h,p.__i=d,v=F(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&L(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),(y=!!(4&p.__u))||f.__k===p.__k?c=j(p,c,e,y):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=S(null,o,null,null,null):v(o)?o=e.__k[a]=S(C,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=S(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=T(s)),oe(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t){return t||=[],e==null||typeof e==`boolean`||(v(e)?e.some(function(e){M(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ne(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||_.test(t)?n:n+`px`}function N(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ne(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function P(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=f++;else if(t.t<n.u)return;return n(a.event?a.event(t):t)}}}function F(e,t,n,r,i,o,s,c,l,u){var d,f,p,m,h,_,x,S,T,E,D,O,k,A,j,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=a.__b)&&d(t);n:if(typeof M==`function`)try{if(S=t.props,T=M.prototype&&M.prototype.render,E=(d=M.contextType)&&r[d.__c],D=d?E?E.props.value:d.__:r,n.__c?x=(f=t.__c=n.__c).__=f.__E:(T?t.__c=f=new M(S,D):(t.__c=f=new w(S,D),f.constructor=M,f.render=se),E&&E.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,M.getDerivedStateFromProps(S,f.__s))),m=f.props,h=f.state,f.__v=t,p)T&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&M.getDerivedStateFromProps==null&&S!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,D),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(S,f.__s,D)){t.__v!=n.__v&&(f.props=S,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,_)})}if(f.context=D,f.props=S,f.__P=e,f.__e=!1,O=a.__r,k=0,T)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),g.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=y(y({},r),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===C&&d.key==null?ie(d.props.children):d,c=ee(e,v(A)?A:[A],t,n,r,i,o,s,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||o!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(j=o.length;j--;)b(o[j]);I(t)}else t.__e=n.__e,t.__k=n.__k,e.then||I(t);a.__e(e,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ae(n.__e,t,n,r,i,o,s,l,u);return(d=a.diffed)&&d(t),128&t.__u?void 0:c}function I(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(I))}function re(e,t,n){for(var r=0;r<n.length;r++)L(n[r],n[++r],n[++r]);a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function ie(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ie):y({},e)}function ae(e,t,n,r,o,s,c,l,u){var d,f,p,m,g,_,y,x=n.props||h,S=t.props,C=t.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(S);e=document.createElementNS(o,C,S.is&&S),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(C==null)x===S||l&&e.data==S||(e.data=S);else{if(s&&=i.call(e.childNodes),!l&&s!=null)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||N(e,d,null,g,o);for(d in S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||x[d]===g||N(e,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,v(m)?m:[m],t,n,r,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&T(n,0),l,u),s!=null)for(d=s.length;d--;)b(s[d]);l||(d=`value`,C==`progress`&&_==null?e.removeAttribute(`value`):_!=null&&(_!==e[d]||C==`progress`&&!_||C==`option`&&_!=x[d])&&N(e,d,_,x[d],o),d=`checked`,y!=null&&y!=e[d]&&N(e,d,y,x[d],o))}return e}function L(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){a.__e(e,n)}}function oe(e,t,n){var r,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||L(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&oe(r[i],t,n||typeof e.type!=`function`);n||b(e.__e),e.__c=e.__=e.__e=void 0}function se(e,t,n){return this.constructor(e,n)}function R(e,t,n){var r,o,s,c;t==document&&(t=document.documentElement),a.__&&a.__(e,t),o=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],F(t,e=(!r&&n||t).__k=x(C,null,[e]),o||h,h,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,s,!r&&n?n:o?o.__e:t.firstChild,r,c),re(s,e,c)}function ce(e,t){R(e,t,ce)}function z(e,t,n){var r,a,o,s,c=y({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?a=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?i.call(arguments,2):n),S(e.type,c,r||e.key,a||e.ref,null)}i=g.slice,a={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},o=0,w.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},w.prototype.render=C,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},k.__r=0,d=/(PointerCapture)$|Capture$/i,f=0,p=P(!1),m=P(!0);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}function V(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var le=[`context`,`children`],ue=[`useFragment`];function de(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){pe.call(this,r)},i.prototype.attributeChangedCallback=me,i.prototype.disconnectedCallback=he,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function fe(e){this.getChildContext=function(){return e.context};var t=e.children;return z(t,V(e,le))}function pe(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(fe,B({},this._props,{context:t.detail.context}),_e(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ce:R)(this._vdom,this._root)}function H(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function me(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[H(e)]=n,this._vdom=z(this._vdom,r),R(this._vdom,this._root)}}function he(){R(this._vdom=null,this._root)}function ge(e,t){var n=this,r=e.useFragment,i=V(e,ue);return x(r?C:`slot`,B({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function _e(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[H(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=_e(s[a],null,n),l=s[a].slot;l?i[l]=x(ge,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?x(ge,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),x(t||e.nodeName.toLowerCase(),i,d)}function ve(e,t,i=[],a={shadow:!0}){typeof window<`u`&&(n(r),customElements.get(t)||de(e,t,i,a))}var ye=0;Array.isArray;function be(e,t,n,r,i,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ye,__i:-1,__u:0,__source:i,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return a.vnode&&a.vnode(u),u}var U,W,G,xe,K=0,Se=[],q=a,Ce=q.__b,we=q.__r,Te=q.diffed,Ee=q.__c,De=q.unmount,Oe=q.__;function J(e,t){q.__h&&q.__h(W,e,K||t),K=0;var n=W.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return K=1,ke(Ie,e)}function ke(e,t,n){var r=J(U++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ie(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};W.__f=!0;var a=W.shouldComponentUpdate,o=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},W.shouldComponentUpdate=i}return r.__N||r.__}function X(e,t){var n=J(U++,3);!q.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,W.__H.__h.push(n))}function Ae(e){return K=5,Z(function(){return{current:e}},[])}function Z(e,t){var n=J(U++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function je(e,t){return K=8,Z(function(){return e},t)}function Me(){for(var e;e=Se.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Q),t.__h.some($),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}q.__b=function(e){W=null,Ce&&Ce(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Oe&&Oe(e,t)},q.__r=function(e){we&&we(e),U=0;var t=(W=e.__c).__H;t&&(G===W?(t.__h=[],W.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Q),t.__h.some($),t.__h=[],U=0)),G=W},q.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&xe===q.requestAnimationFrame||((xe=q.requestAnimationFrame)||Pe)(Me)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),G=W=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(Q),e.__h=e.__h.filter(function(e){return!e.__||$(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],q.__e(n,e.__v)}}),Ee&&Ee(e,t)},q.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Q(e)}catch(e){t=e}}),n.__H=void 0,t&&q.__e(t,n.__v))};var Ne=typeof requestAnimationFrame==`function`;function Pe(e){var t,n=function(){clearTimeout(r),Ne&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ne&&(t=requestAnimationFrame(n))}function Q(e){var t=W,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),W=t}function $(e){var t=W;e.__c=e.__(),W=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ie(e,t){return typeof t==`function`?t(e):t}function Le(){let[n,r]=Y(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:e.isResolved),[i,a]=Y(()=>e.getConfig().hidden??!1),[o,s]=Y(()=>!!window.FrakSetup?.client);return X(()=>{let n=e.getConfig();n.isResolved&&(r(!0),a(n.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&r(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return t(`add`,o),()=>{window.removeEventListener(`frak:config`,i),t(`remove`,o)}},[]),{shouldRender:n,isHidden:i,isClientReady:o}}const Re=`
|
|
1
|
+
import{b as e,i as t,n,r}from"./loader.js";var i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,t,n){var r,a,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?i.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return S(e,s,r,a,null)}function S(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++o,__i:-1,__u:0};return i==null&&a.vnode!=null&&a.vnode(s),s}function C(e){return e.children}function w(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?T(e):null}function E(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=y({},t);o.__v=t.__v+1,a.vnode&&a.vnode(o),F(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??T(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,re(r,o,i),t.__e=t.__=null,o.__e!=n&&D(o)}}function D(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),D(e)}function O(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!k.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(k)}function k(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,E(e)}finally{s.length=k.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y,b=r&&r.__k||g,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||h,p.__i=d,v=F(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&L(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),(y=!!(4&p.__u))||f.__k===p.__k?c=j(p,c,e,y):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=S(null,o,null,null,null):v(o)?o=e.__k[a]=S(C,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=S(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=T(s)),oe(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t){return t||=[],e==null||typeof e==`boolean`||(v(e)?e.some(function(e){M(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ne(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||_.test(t)?n:n+`px`}function N(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ne(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function P(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=f++;else if(t.t<n.u)return;return n(a.event?a.event(t):t)}}}function F(e,t,n,r,i,o,s,c,l,u){var d,f,p,m,h,_,x,S,T,E,D,O,k,A,j,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=a.__b)&&d(t);n:if(typeof M==`function`)try{if(S=t.props,T=M.prototype&&M.prototype.render,E=(d=M.contextType)&&r[d.__c],D=d?E?E.props.value:d.__:r,n.__c?x=(f=t.__c=n.__c).__=f.__E:(T?t.__c=f=new M(S,D):(t.__c=f=new w(S,D),f.constructor=M,f.render=se),E&&E.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,M.getDerivedStateFromProps(S,f.__s))),m=f.props,h=f.state,f.__v=t,p)T&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&M.getDerivedStateFromProps==null&&S!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,D),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(S,f.__s,D)){t.__v!=n.__v&&(f.props=S,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,_)})}if(f.context=D,f.props=S,f.__P=e,f.__e=!1,O=a.__r,k=0,T)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),g.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=y(y({},r),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===C&&d.key==null?ie(d.props.children):d,c=ee(e,v(A)?A:[A],t,n,r,i,o,s,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||o!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(j=o.length;j--;)b(o[j]);I(t)}else t.__e=n.__e,t.__k=n.__k,e.then||I(t);a.__e(e,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ae(n.__e,t,n,r,i,o,s,l,u);return(d=a.diffed)&&d(t),128&t.__u?void 0:c}function I(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(I))}function re(e,t,n){for(var r=0;r<n.length;r++)L(n[r],n[++r],n[++r]);a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function ie(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ie):y({},e)}function ae(e,t,n,r,o,s,c,l,u){var d,f,p,m,g,_,y,x=n.props||h,S=t.props,C=t.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(S);e=document.createElementNS(o,C,S.is&&S),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(C==null)x===S||l&&e.data==S||(e.data=S);else{if(s&&=i.call(e.childNodes),!l&&s!=null)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||N(e,d,null,g,o);for(d in S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||x[d]===g||N(e,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,v(m)?m:[m],t,n,r,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&T(n,0),l,u),s!=null)for(d=s.length;d--;)b(s[d]);l||(d=`value`,C==`progress`&&_==null?e.removeAttribute(`value`):_!=null&&(_!==e[d]||C==`progress`&&!_||C==`option`&&_!=x[d])&&N(e,d,_,x[d],o),d=`checked`,y!=null&&y!=e[d]&&N(e,d,y,x[d],o))}return e}function L(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){a.__e(e,n)}}function oe(e,t,n){var r,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||L(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&oe(r[i],t,n||typeof e.type!=`function`);n||b(e.__e),e.__c=e.__=e.__e=void 0}function se(e,t,n){return this.constructor(e,n)}function R(e,t,n){var r,o,s,c;t==document&&(t=document.documentElement),a.__&&a.__(e,t),o=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],F(t,e=(!r&&n||t).__k=x(C,null,[e]),o||h,h,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,s,!r&&n?n:o?o.__e:t.firstChild,r,c),re(s,e,c)}function ce(e,t){R(e,t,ce)}function z(e,t,n){var r,a,o,s,c=y({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?a=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?i.call(arguments,2):n),S(e.type,c,r||e.key,a||e.ref,null)}i=g.slice,a={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},o=0,w.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},w.prototype.render=C,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},k.__r=0,d=/(PointerCapture)$|Capture$/i,f=0,p=P(!1),m=P(!0);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}function V(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var le=[`context`,`children`],ue=[`useFragment`];function de(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){pe.call(this,r)},i.prototype.attributeChangedCallback=me,i.prototype.disconnectedCallback=he,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function fe(e){this.getChildContext=function(){return e.context};var t=e.children;return z(t,V(e,le))}function pe(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(fe,B({},this._props,{context:t.detail.context}),_e(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ce:R)(this._vdom,this._root)}function H(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function me(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[H(e)]=n,this._vdom=z(this._vdom,r),R(this._vdom,this._root)}}function he(){R(this._vdom=null,this._root)}function ge(e,t){var n=this,r=e.useFragment,i=V(e,ue);return x(r?C:`slot`,B({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function _e(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[H(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=_e(s[a],null,n),l=s[a].slot;l?i[l]=x(ge,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?x(ge,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),x(t||e.nodeName.toLowerCase(),i,d)}function ve(e,t,i=[],a={shadow:!0}){typeof window<`u`&&(n(r),customElements.get(t)||de(e,t,i,a))}var ye=0;Array.isArray;function be(e,t,n,r,i,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ye,__i:-1,__u:0,__source:i,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return a.vnode&&a.vnode(u),u}var U,W,G,xe,K=0,Se=[],q=a,Ce=q.__b,we=q.__r,Te=q.diffed,Ee=q.__c,De=q.unmount,Oe=q.__;function J(e,t){q.__h&&q.__h(W,e,K||t),K=0;var n=W.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return K=1,ke(Ie,e)}function ke(e,t,n){var r=J(U++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ie(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};W.__f=!0;var a=W.shouldComponentUpdate,o=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},W.shouldComponentUpdate=i}return r.__N||r.__}function X(e,t){var n=J(U++,3);!q.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,W.__H.__h.push(n))}function Ae(e){return K=5,Z(function(){return{current:e}},[])}function Z(e,t){var n=J(U++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function je(e,t){return K=8,Z(function(){return e},t)}function Me(){for(var e;e=Se.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Q),t.__h.some($),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}q.__b=function(e){W=null,Ce&&Ce(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Oe&&Oe(e,t)},q.__r=function(e){we&&we(e),U=0;var t=(W=e.__c).__H;t&&(G===W?(t.__h=[],W.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Q),t.__h.some($),t.__h=[],U=0)),G=W},q.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&xe===q.requestAnimationFrame||((xe=q.requestAnimationFrame)||Pe)(Me)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),G=W=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(Q),e.__h=e.__h.filter(function(e){return!e.__||$(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],q.__e(n,e.__v)}}),Ee&&Ee(e,t)},q.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Q(e)}catch(e){t=e}}),n.__H=void 0,t&&q.__e(t,n.__v))};var Ne=typeof requestAnimationFrame==`function`;function Pe(e){var t,n=function(){clearTimeout(r),Ne&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ne&&(t=requestAnimationFrame(n))}function Q(e){var t=W,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),W=t}function $(e){var t=W;e.__c=e.__(),W=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ie(e,t){return typeof t==`function`?t(e):t}function Le(){let[n,r]=Y(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:e.isResolved),[i,a]=Y(()=>e.getConfig().hidden??!1),[o,s]=Y(()=>!!window.FrakSetup?.client);return X(()=>{let n=e.getConfig();n.isResolved&&(r(!0),a(n.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&r(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return t(`add`,o),()=>{window.removeEventListener(`frak:config`,i),t(`remove`,o)}},[]),{shouldRender:n,isHidden:i,isClientReady:o}}const Re=`
|
|
2
2
|
:host {
|
|
3
3
|
display: contents;
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{d as e,m as t,y as n}from"./loader.js";import{l as r,s as i}from"./usePlacement.BJ7qe-pw.js";import{n as a}from"./formatReward.C7mU9_cV.js";function o(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`tiered`:return e.tiers.reduce((e,n)=>Math.max(e,n.amount[t]),0);case`percentage`:return 0}}function s({rewards:e},r,i){let s=(i?e.filter(e=>e.interactionTypeKey===i):e).map(e=>e.referrer).filter(e=>e!==void 0);if(s.length===0)return;let c=t(n(r)),l=s[0],u=o(l,c);for(let e=1;e<s.length;e++){let t=o(s[e],c);t>u&&(l=s[e],u=t)}if(u<=0){let e=s.find(e=>e.payoutType===`percentage`);if(!e)return;l=e}return a(l,r)}function c(t,n){let[a,o]=i(void 0);return r(()=>{if(!t)return;let r=window.FrakSetup?.client;r&&e(r).then(e=>{let t=r.config.metadata?.currency,i=s(e,t,n);i&&o(i)}).catch(()=>{})},[t,n]),{reward:a}}export{c as t};
|
package/dist/buttonShare.d.ts
CHANGED
|
@@ -32,10 +32,15 @@ type ButtonShareProps = {
|
|
|
32
32
|
*/
|
|
33
33
|
targetInteraction?: InteractionTypeKey;
|
|
34
34
|
/**
|
|
35
|
-
* Which UI to open on click
|
|
36
|
-
*
|
|
35
|
+
* Which UI to open on click.
|
|
36
|
+
*
|
|
37
|
+
* Legacy values (e.g. `"share-modal"`) are accepted at runtime and
|
|
38
|
+
* gracefully route to the full-page sharing UI — the modal-flow
|
|
39
|
+
* share path was retired in favour of `displaySharingPage`.
|
|
40
|
+
*
|
|
41
|
+
* @defaultValue `"sharing-page"`
|
|
37
42
|
*/
|
|
38
|
-
clickAction?: "embedded-wallet" | "
|
|
43
|
+
clickAction?: "embedded-wallet" | "sharing-page";
|
|
39
44
|
/**
|
|
40
45
|
* When set, renders the button in preview mode (e.g. Shopify/WP editor).
|
|
41
46
|
* Skips the client-ready gating so the button is always enabled visually,
|
|
@@ -84,7 +89,7 @@ type ButtonShareProps = {
|
|
|
84
89
|
* <frak-button-share use-reward text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!" target-interaction="custom.customerMeeting"></frak-button-share>
|
|
85
90
|
* ```
|
|
86
91
|
*
|
|
87
|
-
* @see {@link @frak-labs/core-sdk!actions.
|
|
92
|
+
* @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the sharing-page flow
|
|
88
93
|
* @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
|
|
89
94
|
*/
|
|
90
95
|
declare function ButtonShare({
|
package/dist/buttonShare.js
CHANGED
|
@@ -3,215 +3,10 @@ import { t as useGlobalComponents } from "./useGlobalComponents-Cmfszr7v.js";
|
|
|
3
3
|
import { t as useLightDomStyles } from "./useLightDomStyles-C3lcOwY2.js";
|
|
4
4
|
import { t as applyRewardPlaceholder } from "./formatReward-Bub6Z6eY.js";
|
|
5
5
|
import { t as useReward } from "./useReward-DU3_yP8Q.js";
|
|
6
|
-
import { t as openSharingPage } from "./sharingPage-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
11
|
-
import { FrakRpcError, RpcErrorCodes } from "@frak-labs/frame-connector";
|
|
12
|
-
//#region src/hooks/useCopyToClipboard.ts
|
|
13
|
-
function useCopyToClipboard(options = {}) {
|
|
14
|
-
const { successDuration = 2e3 } = options;
|
|
15
|
-
const [copied, setCopied] = useState(false);
|
|
16
|
-
return {
|
|
17
|
-
copy: useCallback(async (text) => {
|
|
18
|
-
try {
|
|
19
|
-
if (navigator.clipboard && window.isSecureContext) {
|
|
20
|
-
await navigator.clipboard.writeText(text);
|
|
21
|
-
setCopied(true);
|
|
22
|
-
} else {
|
|
23
|
-
const textArea = document.createElement("textarea");
|
|
24
|
-
textArea.value = text;
|
|
25
|
-
textArea.style.position = "fixed";
|
|
26
|
-
textArea.style.opacity = "0";
|
|
27
|
-
document.body.appendChild(textArea);
|
|
28
|
-
textArea.focus();
|
|
29
|
-
textArea.select();
|
|
30
|
-
try {
|
|
31
|
-
document.execCommand("copy");
|
|
32
|
-
setCopied(true);
|
|
33
|
-
} catch (err) {
|
|
34
|
-
console.error("Failed to copy text:", err);
|
|
35
|
-
return false;
|
|
36
|
-
} finally {
|
|
37
|
-
textArea.remove();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
setCopied(false);
|
|
42
|
-
}, successDuration);
|
|
43
|
-
return true;
|
|
44
|
-
} catch (err) {
|
|
45
|
-
console.error("Failed to copy text:", err);
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}, [successDuration]),
|
|
49
|
-
copied
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
//#region src/components/ButtonShare/components/ErrorMessage.tsx
|
|
54
|
-
const styles = {
|
|
55
|
-
errorContainer: {
|
|
56
|
-
marginTop: "16px",
|
|
57
|
-
padding: "16px",
|
|
58
|
-
backgroundColor: "#FEE2E2",
|
|
59
|
-
border: "1px solid #FCA5A5",
|
|
60
|
-
borderRadius: "4px",
|
|
61
|
-
color: "#991B1B"
|
|
62
|
-
},
|
|
63
|
-
header: {
|
|
64
|
-
display: "flex",
|
|
65
|
-
alignItems: "center",
|
|
66
|
-
gap: "8px",
|
|
67
|
-
marginBottom: "12px"
|
|
68
|
-
},
|
|
69
|
-
title: {
|
|
70
|
-
margin: 0,
|
|
71
|
-
fontSize: "16px",
|
|
72
|
-
fontWeight: 500
|
|
73
|
-
},
|
|
74
|
-
message: {
|
|
75
|
-
fontSize: "14px",
|
|
76
|
-
lineHeight: "1.5",
|
|
77
|
-
margin: "0 0 12px 0"
|
|
78
|
-
},
|
|
79
|
-
link: {
|
|
80
|
-
color: "#991B1B",
|
|
81
|
-
textDecoration: "underline",
|
|
82
|
-
textUnderlineOffset: "2px"
|
|
83
|
-
},
|
|
84
|
-
copyButton: {
|
|
85
|
-
display: "inline-flex",
|
|
86
|
-
alignItems: "center",
|
|
87
|
-
gap: "8px",
|
|
88
|
-
marginBottom: "10px",
|
|
89
|
-
padding: "8px 12px",
|
|
90
|
-
backgroundColor: "white",
|
|
91
|
-
border: "1px solid #D1D5DB",
|
|
92
|
-
borderRadius: "4px",
|
|
93
|
-
color: "black",
|
|
94
|
-
fontSize: "14px",
|
|
95
|
-
fontWeight: 500
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Renders a toggleable debug information section
|
|
100
|
-
* @param {Object} props - Component props
|
|
101
|
-
* @param {string} [props.debugInfo] - Debug information to display in textarea
|
|
102
|
-
*/
|
|
103
|
-
function ToggleMessage({ debugInfo }) {
|
|
104
|
-
const [showInfo, setShowInfo] = useState(false);
|
|
105
|
-
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("button", {
|
|
106
|
-
type: "button",
|
|
107
|
-
style: styles.copyButton,
|
|
108
|
-
onClick: () => setShowInfo(!showInfo),
|
|
109
|
-
children: "Ouvrir les informations"
|
|
110
|
-
}), showInfo && /* @__PURE__ */ jsx("textarea", {
|
|
111
|
-
style: {
|
|
112
|
-
display: "block",
|
|
113
|
-
width: "100%",
|
|
114
|
-
height: "200px",
|
|
115
|
-
fontSize: "12px"
|
|
116
|
-
},
|
|
117
|
-
children: debugInfo
|
|
118
|
-
})] });
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Displays an error message with debug information and copy functionality
|
|
122
|
-
* @param {Object} props - Component props
|
|
123
|
-
* @param {string} [props.debugInfo] - Debug information that can be copied or displayed
|
|
124
|
-
*/
|
|
125
|
-
function ErrorMessage({ debugInfo }) {
|
|
126
|
-
const { copied, copy } = useCopyToClipboard();
|
|
127
|
-
const handleCopy = () => {
|
|
128
|
-
copy(debugInfo ?? "");
|
|
129
|
-
};
|
|
130
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
131
|
-
style: styles.errorContainer,
|
|
132
|
-
children: [
|
|
133
|
-
/* @__PURE__ */ jsx("div", {
|
|
134
|
-
style: styles.header,
|
|
135
|
-
children: /* @__PURE__ */ jsx("h3", {
|
|
136
|
-
style: styles.title,
|
|
137
|
-
children: "Oups ! Nous avons rencontré un petit problème"
|
|
138
|
-
})
|
|
139
|
-
}),
|
|
140
|
-
/* @__PURE__ */ jsxs("p", {
|
|
141
|
-
style: styles.message,
|
|
142
|
-
children: [
|
|
143
|
-
"Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à",
|
|
144
|
-
" ",
|
|
145
|
-
/* @__PURE__ */ jsx("a", {
|
|
146
|
-
href: "mailto:help@frak-labs.com?subject=Debug",
|
|
147
|
-
style: styles.link,
|
|
148
|
-
children: "help@frak-labs.com"
|
|
149
|
-
}),
|
|
150
|
-
" ",
|
|
151
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
152
|
-
"Merci pour votre retour, nous traitons votre demande dans les plus brefs délais."
|
|
153
|
-
]
|
|
154
|
-
}),
|
|
155
|
-
/* @__PURE__ */ jsx("button", {
|
|
156
|
-
type: "button",
|
|
157
|
-
onClick: handleCopy,
|
|
158
|
-
style: styles.copyButton,
|
|
159
|
-
children: copied ? "Informations copiées !" : "Copier les informations de débogage"
|
|
160
|
-
}),
|
|
161
|
-
/* @__PURE__ */ jsx(ToggleMessage, { debugInfo })
|
|
162
|
-
]
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
//#endregion
|
|
166
|
-
//#region src/components/ButtonShare/hooks/useShareModal.ts
|
|
167
|
-
/**
|
|
168
|
-
* Open the share modal
|
|
169
|
-
*
|
|
170
|
-
* @description
|
|
171
|
-
* This function will open the share modal, lazily creating a modal builder on demand.
|
|
172
|
-
*/
|
|
173
|
-
function useShareModal(targetInteraction, placement, sharingLink) {
|
|
174
|
-
const [debugInfo, setDebugInfo] = useState(void 0);
|
|
175
|
-
const [isError, setIsError] = useState(false);
|
|
176
|
-
return {
|
|
177
|
-
handleShare: useCallback(async () => {
|
|
178
|
-
if (!window.FrakSetup?.client) {
|
|
179
|
-
console.error("Frak client not found");
|
|
180
|
-
setDebugInfo(DebugInfoGatherer.empty().formatDebugInfo("Frak client not found"));
|
|
181
|
-
setIsError(true);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const builder = modalBuilder(window.FrakSetup.client, {});
|
|
185
|
-
try {
|
|
186
|
-
await builder.sharing(sharingLink ? { link: sharingLink } : {}).display((metadata) => ({
|
|
187
|
-
...metadata,
|
|
188
|
-
targetInteraction
|
|
189
|
-
}), placement);
|
|
190
|
-
} catch (e) {
|
|
191
|
-
if (e instanceof FrakRpcError && e.code === RpcErrorCodes.clientAborted) {
|
|
192
|
-
console.debug("User aborted the modal");
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
const debugInfo = window.FrakSetup.client.debugInfo.formatDebugInfo(e);
|
|
196
|
-
trackEvent(window.FrakSetup.client, "share_modal_error", {
|
|
197
|
-
placement,
|
|
198
|
-
target_interaction: targetInteraction,
|
|
199
|
-
error: e instanceof Object && "message" in e ? e.message : "Unknown error"
|
|
200
|
-
});
|
|
201
|
-
setDebugInfo(debugInfo);
|
|
202
|
-
setIsError(true);
|
|
203
|
-
console.error("Error while opening the modal", e);
|
|
204
|
-
}
|
|
205
|
-
}, [
|
|
206
|
-
targetInteraction,
|
|
207
|
-
placement,
|
|
208
|
-
sharingLink
|
|
209
|
-
]),
|
|
210
|
-
isError,
|
|
211
|
-
debugInfo
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
//#endregion
|
|
6
|
+
import { t as openSharingPage } from "./sharingPage-DFvQbviS.js";
|
|
7
|
+
import { trackEvent } from "@frak-labs/core-sdk";
|
|
8
|
+
import { useCallback, useMemo } from "preact/hooks";
|
|
9
|
+
import { jsx } from "preact/jsx-runtime";
|
|
215
10
|
//#region src/components/ButtonShare/ButtonShare.tsx
|
|
216
11
|
/**
|
|
217
12
|
* Button to share the current page
|
|
@@ -251,7 +46,7 @@ function useShareModal(targetInteraction, placement, sharingLink) {
|
|
|
251
46
|
* <frak-button-share use-reward text="Share and earn up to {REWARD}!" no-reward-text="Share and earn!" target-interaction="custom.customerMeeting"></frak-button-share>
|
|
252
47
|
* ```
|
|
253
48
|
*
|
|
254
|
-
* @see {@link @frak-labs/core-sdk!actions.
|
|
49
|
+
* @see {@link @frak-labs/core-sdk!actions.displaySharingPage | `displaySharingPage()`} for more info about the sharing-page flow
|
|
255
50
|
* @see {@link @frak-labs/core-sdk!actions.getMerchantInformation | `getMerchantInformation()`} for more info about the estimated reward fetching
|
|
256
51
|
*/
|
|
257
52
|
function ButtonShare({ placement: placementId, text = "Share and earn!", classname = "", useReward: rawUseReward, noRewardText, targetInteraction, clickAction: rawClickAction, preview }) {
|
|
@@ -267,7 +62,6 @@ function ButtonShare({ placement: placementId, text = "Share and earn!", classna
|
|
|
267
62
|
const resolvedClickAction = useMemo(() => componentConfig?.clickAction ?? rawClickAction ?? "sharing-page", [componentConfig?.clickAction, rawClickAction]);
|
|
268
63
|
const { shouldRender, isHidden, isClientReady } = useClientReady();
|
|
269
64
|
const { reward } = useReward(shouldUseReward && isClientReady, resolvedTargetInteraction);
|
|
270
|
-
const { handleShare, isError, debugInfo } = useShareModal(resolvedTargetInteraction, placementId);
|
|
271
65
|
const btnText = useMemo(() => {
|
|
272
66
|
if (!shouldUseReward) return resolvedText;
|
|
273
67
|
if (!reward) return resolvedNoRewardText ?? applyRewardPlaceholder(resolvedText, void 0);
|
|
@@ -278,7 +72,7 @@ function ButtonShare({ placement: placementId, text = "Share and earn!", classna
|
|
|
278
72
|
resolvedNoRewardText,
|
|
279
73
|
reward
|
|
280
74
|
]);
|
|
281
|
-
const onClick = useCallback(
|
|
75
|
+
const onClick = useCallback(() => {
|
|
282
76
|
if (isPreview) return;
|
|
283
77
|
trackEvent(window.FrakSetup.client, "share_button_clicked", {
|
|
284
78
|
placement: placementId,
|
|
@@ -286,13 +80,14 @@ function ButtonShare({ placement: placementId, text = "Share and earn!", classna
|
|
|
286
80
|
has_reward: Boolean(reward),
|
|
287
81
|
click_action: resolvedClickAction
|
|
288
82
|
});
|
|
289
|
-
if (resolvedClickAction === "embedded-wallet")
|
|
290
|
-
|
|
291
|
-
|
|
83
|
+
if (resolvedClickAction === "embedded-wallet") {
|
|
84
|
+
openEmbeddedWallet(resolvedTargetInteraction, placementId);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
openSharingPage(resolvedTargetInteraction, placementId);
|
|
292
88
|
}, [
|
|
293
89
|
isPreview,
|
|
294
90
|
resolvedClickAction,
|
|
295
|
-
handleShare,
|
|
296
91
|
resolvedTargetInteraction,
|
|
297
92
|
placementId,
|
|
298
93
|
reward
|
|
@@ -303,13 +98,13 @@ function ButtonShare({ placement: placementId, text = "Share and earn!", classna
|
|
|
303
98
|
"button__fadeIn",
|
|
304
99
|
classname
|
|
305
100
|
].filter(Boolean).join(" ");
|
|
306
|
-
return /* @__PURE__ */
|
|
101
|
+
return /* @__PURE__ */ jsx("button", {
|
|
307
102
|
type: "button",
|
|
308
103
|
disabled: !isPreview && !isClientReady,
|
|
309
104
|
class: buttonClass,
|
|
310
105
|
onClick,
|
|
311
106
|
children: btnText
|
|
312
|
-
})
|
|
107
|
+
});
|
|
313
108
|
}
|
|
314
109
|
//#endregion
|
|
315
110
|
//#region src/components/ButtonShare/index.ts
|
package/dist/postPurchase.js
CHANGED
|
@@ -2,7 +2,7 @@ import { a as registerWebComponent, i as useClientReady, t as usePlacement } fro
|
|
|
2
2
|
import { t as useGlobalComponents } from "./useGlobalComponents-Cmfszr7v.js";
|
|
3
3
|
import { t as useLightDomStyles } from "./useLightDomStyles-C3lcOwY2.js";
|
|
4
4
|
import { n as formatEstimatedReward, t as applyRewardPlaceholder } from "./formatReward-Bub6Z6eY.js";
|
|
5
|
-
import { t as openSharingPage } from "./sharingPage-
|
|
5
|
+
import { t as openSharingPage } from "./sharingPage-DFvQbviS.js";
|
|
6
6
|
import { c as cssSource$5, l as createElement, o as cssSource$4, r as LogoFrak, s as cssSource$3, t as GiftIcon } from "./GiftIcon-4sr9xXyq.js";
|
|
7
7
|
import { trackEvent } from "@frak-labs/core-sdk";
|
|
8
8
|
import { getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
|
|
@@ -1401,21 +1401,7 @@ var icon = "PostPurchase_icon__5fv5lh4";
|
|
|
1401
1401
|
var message = "PostPurchase_message__5fv5lh2";
|
|
1402
1402
|
const cssSource = cssSource$3 + cssSource$4 + cssSource$5 + cssSource$1;
|
|
1403
1403
|
//#endregion
|
|
1404
|
-
//#region src/components/PostPurchase/
|
|
1405
|
-
/**
|
|
1406
|
-
* Given referral status and merchant info, compute the display variant
|
|
1407
|
-
* and pick the appropriate purchase reward.
|
|
1408
|
-
*/
|
|
1409
|
-
function resolvePostPurchaseContext(referralStatus, merchantInfo) {
|
|
1410
|
-
const purchaseReward = merchantInfo.rewards.find((r) => r.interactionTypeKey === "purchase" && (r.referrer || r.referee));
|
|
1411
|
-
if (!purchaseReward) return null;
|
|
1412
|
-
const variant = referralStatus?.isReferred && purchaseReward.referee ? "referee" : "referrer";
|
|
1413
|
-
return {
|
|
1414
|
-
variant,
|
|
1415
|
-
reward: variant === "referee" ? purchaseReward.referee : purchaseReward.referrer,
|
|
1416
|
-
merchantDomain: merchantInfo.onChainMetadata.domain
|
|
1417
|
-
};
|
|
1418
|
-
}
|
|
1404
|
+
//#region src/components/PostPurchase/products.ts
|
|
1419
1405
|
/**
|
|
1420
1406
|
* Whether `value` is a syntactically valid URL with an `http(s):` scheme.
|
|
1421
1407
|
*
|
|
@@ -1475,6 +1461,22 @@ function normalizeProductCandidate(candidate) {
|
|
|
1475
1461
|
if (typeof item.utmContent === "string" && item.utmContent !== "") entry.utmContent = item.utmContent;
|
|
1476
1462
|
return entry;
|
|
1477
1463
|
}
|
|
1464
|
+
//#endregion
|
|
1465
|
+
//#region src/components/PostPurchase/PostPurchase.tsx
|
|
1466
|
+
/**
|
|
1467
|
+
* Given referral status and merchant info, compute the display variant
|
|
1468
|
+
* and pick the appropriate purchase reward.
|
|
1469
|
+
*/
|
|
1470
|
+
function resolvePostPurchaseContext(referralStatus, merchantInfo) {
|
|
1471
|
+
const purchaseReward = merchantInfo.rewards.find((r) => r.interactionTypeKey === "purchase" && (r.referrer || r.referee));
|
|
1472
|
+
if (!purchaseReward) return null;
|
|
1473
|
+
const variant = referralStatus?.isReferred && purchaseReward.referee ? "referee" : "referrer";
|
|
1474
|
+
return {
|
|
1475
|
+
variant,
|
|
1476
|
+
reward: variant === "referee" ? purchaseReward.referee : purchaseReward.referrer,
|
|
1477
|
+
merchantDomain: merchantInfo.onChainMetadata.domain
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1478
1480
|
/**
|
|
1479
1481
|
* Post-purchase card component.
|
|
1480
1482
|
*
|
|
@@ -1600,12 +1602,18 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
1600
1602
|
}
|
|
1601
1603
|
return sanitized.length > 0 ? sanitized : void 0;
|
|
1602
1604
|
}, [products]);
|
|
1603
|
-
const
|
|
1605
|
+
const handleClick = useCallback(() => {
|
|
1606
|
+
if (!resolvedVariant) return;
|
|
1607
|
+
trackEvent(window.FrakSetup?.client, "post_purchase_clicked", {
|
|
1608
|
+
placement: placementId,
|
|
1609
|
+
variant: resolvedVariant
|
|
1610
|
+
});
|
|
1604
1611
|
openSharingPage(void 0, placementId, {
|
|
1605
1612
|
link: resolvedSharingUrl,
|
|
1606
1613
|
products: parsedProducts
|
|
1607
1614
|
});
|
|
1608
1615
|
}, [
|
|
1616
|
+
resolvedVariant,
|
|
1609
1617
|
placementId,
|
|
1610
1618
|
resolvedSharingUrl,
|
|
1611
1619
|
parsedProducts
|
|
@@ -1635,14 +1643,7 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
1635
1643
|
type: "button",
|
|
1636
1644
|
className: `${cta} button`,
|
|
1637
1645
|
disabled: !isPreview && !isClientReady,
|
|
1638
|
-
onClick: isPreview ? void 0 :
|
|
1639
|
-
if (!resolvedVariant) return;
|
|
1640
|
-
trackEvent(window.FrakSetup?.client, "post_purchase_clicked", {
|
|
1641
|
-
placement: placementId,
|
|
1642
|
-
variant: resolvedVariant
|
|
1643
|
-
});
|
|
1644
|
-
handleShare();
|
|
1645
|
-
},
|
|
1646
|
+
onClick: isPreview ? void 0 : handleClick,
|
|
1646
1647
|
children: [texts.cta, /* @__PURE__ */ jsx("svg", {
|
|
1647
1648
|
width: "16",
|
|
1648
1649
|
height: "16",
|
|
@@ -7,8 +7,8 @@ async function openSharingPage(targetInteraction, placement, options) {
|
|
|
7
7
|
}
|
|
8
8
|
await displaySharingPage(window.FrakSetup.client, {
|
|
9
9
|
...options?.link && { link: options.link },
|
|
10
|
-
...options?.products
|
|
11
|
-
|
|
10
|
+
...options?.products?.length && { products: options.products },
|
|
11
|
+
...targetInteraction && { metadata: { targetInteraction } }
|
|
12
12
|
}, placement);
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "1.0.2-beta.
|
|
14
|
+
"version": "1.0.2-beta.bb30f110",
|
|
15
15
|
"description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"publish": "echo 'Publishing components...'"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@frak-labs/core-sdk": "1.0.2-beta.
|
|
90
|
-
"@frak-labs/frame-connector": "0.2.0-beta.
|
|
89
|
+
"@frak-labs/core-sdk": "1.0.2-beta.bb30f110",
|
|
90
|
+
"@frak-labs/frame-connector": "0.2.0-beta.bb30f110",
|
|
91
91
|
"preact": "^10.29.0",
|
|
92
92
|
"preact-custom-element": "^4.6.0",
|
|
93
93
|
"@frak-labs/design-system": "0.0.0"
|