@frak-labs/components 1.0.5 → 1.0.6-beta.dc7ed9db
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.L6HcKGUv.js +178 -0
- package/cdn/ButtonShare.O2wAgNZa.js +1 -0
- package/cdn/ButtonWallet.Cm8Qzz45.js +40 -0
- package/cdn/{GiftIcon.eRNTGQ_r.js → GiftIcon.DnSW4dJQ.js} +1 -1
- package/cdn/{OpenInAppButton.Dgb-qhM8.js → OpenInAppButton.CTBE114K.js} +1 -1
- package/cdn/PostPurchase.fx6VasmG.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/embeddedWallet.CDUxjdX2.js +1 -0
- package/cdn/{formatReward.B1ZyoceC.js → formatReward.Cmg_Q___.js} +1 -1
- package/cdn/loader.js +1 -1
- package/cdn/replay-V6FXES7X.CNozpSRg.js +1 -0
- package/cdn/{useGlobalComponents.TG9kIYSc.js → useGlobalComponents.pjgSwLk9.js} +1 -1
- package/cdn/{useLightDomStyles.tjNBKcOr.js → useLightDomStyles.2RQE6Iby.js} +1 -1
- package/cdn/usePlacement.CRfzWKVY.js +58 -0
- package/cdn/useReward.cZ7bx5ND.js +1 -0
- package/dist/{GiftIcon-BIp9FTJs.js → GiftIcon-WEWSJ8kV.js} +1 -1
- package/dist/banner.d.ts +1 -2
- package/dist/banner.js +3 -3
- package/dist/buttonShare.d.ts +1 -2
- package/dist/buttonShare.js +3 -3
- package/dist/buttonWallet.d.ts +1 -2
- package/dist/buttonWallet.js +17 -1
- package/dist/embeddedWallet-By3_p5Xc.js +18 -0
- package/dist/openInApp.d.ts +1 -3
- package/dist/openInApp.js +2 -2
- package/dist/postPurchase.d.ts +1 -2
- package/dist/postPurchase.js +4 -75
- package/dist/{useLightDomStyles-DVe5UDg6.js → useLightDomStyles-Xi52h2yV.js} +1 -1
- package/dist/usePlacement-SHVjZ5IW.js +404 -0
- package/package.json +3 -3
- package/cdn/Banner.CIxY6tCU.js +0 -178
- package/cdn/ButtonShare.elMtdxF3.js +0 -1
- package/cdn/ButtonWallet.BUUPX0gO.js +0 -40
- package/cdn/PostPurchase.Cy7-FrRh.js +0 -89
- package/cdn/replay-V6FXES7X.BoL9fAjx.js +0 -1
- package/cdn/sharingPage.BYsqcN9O.js +0 -1
- package/cdn/usePlacement.BgMXY5CX.js +0 -58
- package/cdn/useReward.B530suzR.js +0 -1
- package/dist/sharingPage-D6fQEXV9.js +0 -15
- package/dist/usePlacement-DzEuVg_u.js +0 -253
|
@@ -1 +1 @@
|
|
|
1
|
-
import{w as e}from"./loader.js";import{l as t,r as n}from"./usePlacement.
|
|
1
|
+
import{w as e}from"./loader.js";import{l as t,r as n}from"./usePlacement.CRfzWKVY.js";function r(r,i,a,o,s){t(()=>{s&&e.injectBase(`shared`,s),e.injectBase(r,o??n)},[r]),t(()=>{!i||!a||e.injectPlacement(r,i,a)},[r,i,a])}export{r as t};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{C as e,n as t,t as n,y as r}from"./loader.js";var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v={},y=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,x=Array.isArray;function S(e,t){for(var n in t)e[n]=t[n];return e}function C(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function w(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 T(e,s,r,a,null)}function T(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 E(e){return e.children}function D(e,t){this.props=e,this.context=t}function O(e,t){if(t==null)return e.__?O(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`?O(e):null}function k(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=S({},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??O(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,oe(r,o,i),t.__e=t.__=null,o.__e!=n&&A(o)}}function A(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}),A(e)}function j(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!M.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(M)}function M(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,k(e)}finally{s.length=M.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,b=r&&r.__k||y,x=t.length;for(c=te(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||v,p.__i=d,g=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)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?(c=ne(p,c,e,_),_&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function te(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]=T(null,o,null,null,null):x(o)?o=e.__k[a]=T(E,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=T(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=ie(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=O(s)),le(s,s));return r}function ne(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=ne(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=O(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function re(e,t){return t||=[],e==null||typeof e==`boolean`||(x(e)?e.some(function(e){re(e,t)}):t.push(e)),t}function ie(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 N(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||b.test(t)?n:n+`px`}function P(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||N(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||N(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(m,`$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[p]=r[p]:(n[p]=h,e.addEventListener(t,a?_:g,a)):e.removeEventListener(t,a?_:g,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 ae(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[f]==null)t[f]=h++;else if(t[f]<n[p])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,g,_,v,b,w,T,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(v=t.props,b=M.prototype&&M.prototype.render,w=(d=M.contextType)&&r[d.__c],T=d?w?w.props.value:d.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new M(v,T):(t.__c=f=new D(v,T),f.constructor=M,f.render=ue),w&&w.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=S({},f.__s)),S(f.__s,M.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)b&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&M.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,T),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,T)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),y.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,T),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=T,f.props=v,f.__P=e,f.__e=!1,O=a.__r,k=0,b)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),y.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=S(S({},r),f.getChildContext())),b&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===E&&d.key==null?se(d.props.children):d,c=ee(e,x(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),_&&(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--;)C(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=ce(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 oe(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 se(e){return typeof e!=`object`||!e||e.__b>0?e:x(e)?e.map(se):e.constructor===void 0?S({},e):null}function ce(e,t,n,r,o,s,c,l,u){var d,f,p,m,h,g,_,y=n.props||v,b=t.props,S=t.type;if(S==`svg`?o=`http://www.w3.org/2000/svg`:S==`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((h=s[d])&&`setAttribute`in h==!!S&&(S?h.localName==S:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(b);e=document.createElementNS(o,S,b.is&&b),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(S==null)y===b||l&&e.data==b||(e.data=b);else{if(s=S==`textarea`&&b.defaultValue!=null?null:s&&i.call(e.childNodes),!l&&s!=null)for(y={},d=0;d<e.attributes.length;d++)y[(h=e.attributes[d]).name]=h.value;for(d in y)h=y[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in b||d==`value`&&`defaultValue`in b||d==`checked`&&`defaultChecked`in b||P(e,d,null,h,o);for(d in b)h=b[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?_=h:l&&typeof h!=`function`||y[d]===h||P(e,d,h,y[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,x(m)?m:[m],t,n,r,S==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&O(n,0),l,u),s!=null)for(d=s.length;d--;)C(s[d]);l&&S!=`textarea`||(d=`value`,S==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||S==`progress`&&!g||S==`option`&&g!=y[d])&&P(e,d,g,y[d],o),d=`checked`,_!=null&&_!=e[d]&&P(e,d,_,y[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 le(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]&&le(r[i],t,n||typeof e.type!=`function`);n||C(e.__e),e.__c=e.__=e.__e=void 0}function ue(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=w(E,null,[e]),o||v,v,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),oe(s,e,c)}function de(e,t){R(e,t,de)}function fe(e,t,n){var r,a,o,s,c=S({},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),T(e.type,c,r||e.key,a||e.ref,null)}i=y.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,D.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=S({},this.state);typeof e==`function`&&(e=e(S({},n),this.props)),e&&S(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),j(this))},D.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),j(this))},D.prototype.render=E,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},M.__r=0,d=Math.random().toString(8),f=`__d`+d,p=`__a`+d,m=/(PointerCapture)$|Capture$/i,h=0,g=ae(!1),_=ae(!0);function z(){return z=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},z.apply(this,arguments)}function B(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 pe=[`context`,`children`],me=[`useFragment`];function he(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(){_e.call(this,r)},i.prototype.attributeChangedCallback=ve,i.prototype.disconnectedCallback=ye,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 ge(e){this.getChildContext=function(){return e.context};var t=e.children;return fe(t,B(e,pe))}function _e(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=w(ge,z({},this._props,{context:t.detail.context}),xe(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?de:R)(this._vdom,this._root)}function V(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function ve(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[V(e)]=n,this._vdom=fe(this._vdom,r),R(this._vdom,this._root)}}function ye(){R(this._vdom=null,this._root)}function be(e,t){var n=this,r=e.useFragment,i=B(e,me);return w(r?E:`slot`,z({},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 xe(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[V(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=xe(s[a],null,n),l=s[a].slot;l?i[l]=w(be,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?w(be,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),w(t||e.nodeName.toLowerCase(),i,d)}function Se(t,r,i=[],a={shadow:!0}){typeof window<`u`&&(e(n),customElements.get(r)||he(t,r,i,a))}var Ce=0;Array.isArray;function we(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:--Ce,__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 H,U,W,Te,G=0,Ee=[],K=a,De=K.__b,Oe=K.__r,ke=K.diffed,Ae=K.__c,je=K.unmount,Me=K.__;function q(e,t){K.__h&&K.__h(U,e,G||t),G=0;var n=U.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function J(e){return G=1,Ne(ze,e)}function Ne(e,t,n){var r=q(H++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):ze(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=U,!U.__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};U.__f=!0;var a=U.shouldComponentUpdate,o=U.componentWillUpdate;U.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)},U.shouldComponentUpdate=i}return r.__N||r.__}function Y(e,t){var n=q(H++,3);!K.__s&&Re(n.__H,t)&&(n.__=e,n.u=t,U.__H.__h.push(n))}function Pe(e){return G=5,X(function(){return{current:e}},[])}function X(e,t){var n=q(H++,7);return Re(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Fe(e,t){return G=8,X(function(){return e},t)}function Ie(){for(var e;e=Ee.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Q),t.__h.some($),t.__h=[]}catch(n){t.__h=[],K.__e(n,e.__v)}}}K.__b=function(e){U=null,De&&De(e)},K.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Me&&Me(e,t)},K.__r=function(e){Oe&&Oe(e),H=0;var t=(U=e.__c).__H;t&&(W===U?(t.__h=[],U.__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=[],H=0)),W=U},K.diffed=function(e){ke&&ke(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ee.push(t)!==1&&Te===K.requestAnimationFrame||((Te=K.requestAnimationFrame)||Le)(Ie)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),W=U=null},K.__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=[],K.__e(n,e.__v)}}),Ae&&Ae(e,t)},K.unmount=function(e){je&&je(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&&K.__e(t,n.__v))};var Z=typeof requestAnimationFrame==`function`;function Le(e){var t,n=function(){clearTimeout(r),Z&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Z&&(t=requestAnimationFrame(n))}function Q(e){var t=U,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),U=t}function $(e){var t=U;e.__c=e.__(),U=t}function Re(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function ze(e,t){return typeof t==`function`?t(e):t}function Be(){let[e,n]=J(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:r.isResolved),[i,a]=J(()=>r.getConfig().hidden??!1),[o,s]=J(()=>!!window.FrakSetup?.client);return Y(()=>{let e=r.getConfig();e.isResolved&&(n(!0),a(e.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&n(!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:e,isHidden:i,isClientReady:o}}const Ve=`
|
|
2
|
+
:host {
|
|
3
|
+
display: contents;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:host([hidden]) {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.button:disabled {
|
|
11
|
+
opacity: 0.7;
|
|
12
|
+
cursor: default;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.button__fadeIn {
|
|
16
|
+
animation: frak-fadeIn 300ms ease-in;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@keyframes frak-fadeIn {
|
|
20
|
+
from {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
to {
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;function He(e,t){return t?`${Ve}\n${e}\n${t}`:`${Ve}\n${e}`}const Ue=`
|
|
29
|
+
:where(frak-button-share, frak-open-in-app) {
|
|
30
|
+
display: contents;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:where(frak-button-share .button, frak-open-in-app .button) {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
gap: 10px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
|
|
41
|
+
opacity: 0.7;
|
|
42
|
+
cursor: default;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
|
|
46
|
+
animation: frak-fadeIn 300ms ease-in;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes frak-fadeIn {
|
|
50
|
+
from {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
to {
|
|
55
|
+
opacity: 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;function We(e){return r.getConfig().placements?.[e]}function Ge(e){let[t,n]=J(0);return Y(()=>{let e=e=>{n(e=>e+1)};return window.addEventListener(`frak:config`,e),n(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),X(()=>e?We(e):void 0,[e,t])}export{Pe as a,Fe as c,Se as d,D as f,a as g,w as h,Be as i,Y as l,E as m,He as n,X as o,re as p,Ue as r,J as s,Ge as t,we as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,h as t,v as n}from"./loader.js";import{l as r,s as i}from"./usePlacement.CRfzWKVY.js";import{n as a}from"./formatReward.Cmg_Q___.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=n(t(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};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "preact/hooks";
|
|
2
2
|
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
3
3
|
import { Component, Fragment as Fragment$1, createElement, options, toChildArray } from "preact";
|
|
4
|
-
//#region ../../node_modules/.bun/preact@10.29.
|
|
4
|
+
//#region ../../node_modules/.bun/preact@10.29.2/node_modules/preact/compat/dist/compat.module.js
|
|
5
5
|
function g(n, t) {
|
|
6
6
|
for (var e in t) n[e] = t[e];
|
|
7
7
|
return n;
|
package/dist/banner.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/Banner/types.d.ts
|
|
5
4
|
/**
|
|
@@ -123,7 +122,7 @@ declare function Banner({
|
|
|
123
122
|
preview,
|
|
124
123
|
previewMode,
|
|
125
124
|
allowInappRedirect
|
|
126
|
-
}: BannerProps):
|
|
125
|
+
}: BannerProps): import("preact").JSX.Element | null;
|
|
127
126
|
//#endregion
|
|
128
127
|
//#region src/components/Banner/index.d.ts
|
|
129
128
|
/**
|
package/dist/banner.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-SHVjZ5IW.js";
|
|
2
2
|
import { t as useGlobalComponents } from "./useGlobalComponents-mSs9unyN.js";
|
|
3
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-Xi52h2yV.js";
|
|
4
4
|
import { t as useReward } from "./useReward-ClVShg45.js";
|
|
5
|
-
import { a as ExternalLinkIcon, i as LogoFrakWithName, n as cssSource$3, o as CloseCircleIcon, r as WarningIcon, t as GiftIcon } from "./GiftIcon-
|
|
5
|
+
import { a as ExternalLinkIcon, i as LogoFrakWithName, n as cssSource$3, o as CloseCircleIcon, r as WarningIcon, t as GiftIcon } from "./GiftIcon-WEWSJ8kV.js";
|
|
6
6
|
import { isInAppBrowser, redirectToExternalBrowser, trackEvent } from "@frak-labs/core-sdk";
|
|
7
7
|
import { REFERRAL_SUCCESS_EVENT, getMergeToken } from "@frak-labs/core-sdk/actions";
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
package/dist/buttonShare.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/ButtonShare/types.d.ts
|
|
5
4
|
/**
|
|
@@ -101,7 +100,7 @@ declare function ButtonShare({
|
|
|
101
100
|
targetInteraction,
|
|
102
101
|
clickAction: rawClickAction,
|
|
103
102
|
preview
|
|
104
|
-
}: ButtonShareProps):
|
|
103
|
+
}: ButtonShareProps): import("preact").JSX.Element | null;
|
|
105
104
|
//#endregion
|
|
106
105
|
//#region src/components/ButtonShare/index.d.ts
|
|
107
106
|
/**
|
package/dist/buttonShare.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, s as
|
|
2
|
-
import { t as
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, s as openSharingPage, t as usePlacement } from "./usePlacement-SHVjZ5IW.js";
|
|
2
|
+
import { t as openEmbeddedWallet } from "./embeddedWallet-By3_p5Xc.js";
|
|
3
3
|
import { t as useGlobalComponents } from "./useGlobalComponents-mSs9unyN.js";
|
|
4
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
4
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-Xi52h2yV.js";
|
|
5
5
|
import { t as applyRewardPlaceholder } from "./formatReward-Cf2KpA3x.js";
|
|
6
6
|
import { t as useReward } from "./useReward-ClVShg45.js";
|
|
7
7
|
import { trackEvent } from "@frak-labs/core-sdk";
|
package/dist/buttonWallet.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InteractionTypeKey } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/ButtonWallet/types.d.ts
|
|
5
4
|
/**
|
|
@@ -70,7 +69,7 @@ declare function ButtonWallet({
|
|
|
70
69
|
classname,
|
|
71
70
|
useReward: rawUseReward,
|
|
72
71
|
targetInteraction
|
|
73
|
-
}: ButtonWalletProps):
|
|
72
|
+
}: ButtonWalletProps): import("preact").JSX.Element | null;
|
|
74
73
|
//#endregion
|
|
75
74
|
//#region src/components/ButtonWallet/index.d.ts
|
|
76
75
|
/**
|
package/dist/buttonWallet.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, n as buildStyleContent,
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, n as buildStyleContent, t as usePlacement } from "./usePlacement-SHVjZ5IW.js";
|
|
2
|
+
import { t as openEmbeddedWallet } from "./embeddedWallet-By3_p5Xc.js";
|
|
2
3
|
import { t as useReward } from "./useReward-ClVShg45.js";
|
|
3
4
|
import { useEffect, useMemo, useState } from "preact/hooks";
|
|
4
5
|
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
@@ -20,6 +21,21 @@ function GiftIcon(props) {
|
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
//#endregion
|
|
24
|
+
//#region src/utils/browser/safeVibrate.ts
|
|
25
|
+
/**
|
|
26
|
+
* Attempt to vibrate the device
|
|
27
|
+
*/
|
|
28
|
+
function safeVibrate() {
|
|
29
|
+
if ("vibrate" in navigator) navigator.vibrate(10);
|
|
30
|
+
else console.log("Vibration not supported");
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/components/ButtonWallet/utils.ts
|
|
34
|
+
function openWalletModal(targetInteraction, placement) {
|
|
35
|
+
safeVibrate();
|
|
36
|
+
openEmbeddedWallet(targetInteraction, placement);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
23
39
|
//#region src/components/ButtonWallet/ButtonWallet.tsx
|
|
24
40
|
const componentCss = `
|
|
25
41
|
.button {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { displayEmbeddedWallet } from "@frak-labs/core-sdk/actions";
|
|
2
|
+
//#region src/actions/embeddedWallet.ts
|
|
3
|
+
async function openEmbeddedWallet(targetInteraction, placement) {
|
|
4
|
+
if (!window.FrakSetup?.client) {
|
|
5
|
+
console.error("Frak client not found");
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const modalWalletConfig = window.FrakSetup?.modalWalletConfig ?? {};
|
|
9
|
+
await displayEmbeddedWallet(window.FrakSetup.client, targetInteraction ? {
|
|
10
|
+
...modalWalletConfig,
|
|
11
|
+
metadata: {
|
|
12
|
+
...modalWalletConfig.metadata,
|
|
13
|
+
targetInteraction
|
|
14
|
+
}
|
|
15
|
+
} : modalWalletConfig, placement);
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { openEmbeddedWallet as t };
|
package/dist/openInApp.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as _$preact from "preact";
|
|
2
|
-
|
|
3
1
|
//#region src/components/OpenInAppButton/types.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The props type for {@link OpenInAppButton}.
|
|
@@ -49,7 +47,7 @@ declare function OpenInAppButton({
|
|
|
49
47
|
placement: placementId,
|
|
50
48
|
text,
|
|
51
49
|
classname
|
|
52
|
-
}: OpenInAppButtonProps):
|
|
50
|
+
}: OpenInAppButtonProps): import("preact").JSX.Element | null;
|
|
53
51
|
//#endregion
|
|
54
52
|
//#region src/components/OpenInAppButton/index.d.ts
|
|
55
53
|
/**
|
package/dist/openInApp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-
|
|
2
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-SHVjZ5IW.js";
|
|
2
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-Xi52h2yV.js";
|
|
3
3
|
import { DEEP_LINK_SCHEME, isMobile, trackEvent, triggerDeepLinkWithFallback } from "@frak-labs/core-sdk";
|
|
4
4
|
import { useMemo } from "preact/hooks";
|
|
5
5
|
import { jsx } from "preact/jsx-runtime";
|
package/dist/postPurchase.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SharingPageProduct } from "@frak-labs/core-sdk";
|
|
2
|
-
import * as _$preact from "preact";
|
|
3
2
|
|
|
4
3
|
//#region src/components/PostPurchase/types.d.ts
|
|
5
4
|
/**
|
|
@@ -143,7 +142,7 @@ declare function PostPurchase({
|
|
|
143
142
|
previewVariant,
|
|
144
143
|
products,
|
|
145
144
|
imageUrl
|
|
146
|
-
}: PostPurchaseProps):
|
|
145
|
+
}: PostPurchaseProps): import("preact").JSX.Element | null;
|
|
147
146
|
//#endregion
|
|
148
147
|
//#region src/components/PostPurchase/index.d.ts
|
|
149
148
|
/**
|
package/dist/postPurchase.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as registerWebComponent, i as useClientReady, t as usePlacement } from "./usePlacement-
|
|
2
|
-
import { t as openSharingPage } from "./sharingPage-D6fQEXV9.js";
|
|
1
|
+
import { a as registerWebComponent, i as useClientReady, o as sanitizeProductList, s as openSharingPage, t as usePlacement } from "./usePlacement-SHVjZ5IW.js";
|
|
3
2
|
import { t as useGlobalComponents } from "./useGlobalComponents-mSs9unyN.js";
|
|
4
|
-
import { t as useLightDomStyles } from "./useLightDomStyles-
|
|
3
|
+
import { t as useLightDomStyles } from "./useLightDomStyles-Xi52h2yV.js";
|
|
5
4
|
import { n as formatEstimatedReward, t as applyRewardPlaceholder } from "./formatReward-Cf2KpA3x.js";
|
|
6
|
-
import { i as LogoFrakWithName, n as cssSource$2, t as GiftIcon } from "./GiftIcon-
|
|
5
|
+
import { i as LogoFrakWithName, n as cssSource$2, t as GiftIcon } from "./GiftIcon-WEWSJ8kV.js";
|
|
7
6
|
import { trackEvent } from "@frak-labs/core-sdk";
|
|
8
7
|
import { getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
|
|
9
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
@@ -112,67 +111,6 @@ var imageWrapper = "PostPurchase_imageWrapper__5fv5lh9";
|
|
|
112
111
|
var message = "PostPurchase_message__5fv5lh5";
|
|
113
112
|
const cssSource = cssSource$1;
|
|
114
113
|
//#endregion
|
|
115
|
-
//#region src/components/PostPurchase/products.ts
|
|
116
|
-
/**
|
|
117
|
-
* Whether `value` is a syntactically valid URL with an `http(s):` scheme.
|
|
118
|
-
*
|
|
119
|
-
* Used to gate `imageUrl` / `link` fields coming from the public `products`
|
|
120
|
-
* prop — the listener-side sharing-page builder calls `new URL(...)` on the
|
|
121
|
-
* incoming product link, and a `javascript:` URL would be a XSS sink in any
|
|
122
|
-
* consumer that binds the value to an `href`.
|
|
123
|
-
*/
|
|
124
|
-
function isHttpUrl(value) {
|
|
125
|
-
try {
|
|
126
|
-
const parsed = new URL(value);
|
|
127
|
-
return parsed.protocol === "http:" || parsed.protocol === "https:";
|
|
128
|
-
} catch {
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Coerce a raw `products` prop value into a candidate array suitable for
|
|
134
|
-
* per-item normalisation, or null when it cannot be reduced to one.
|
|
135
|
-
*
|
|
136
|
-
* Surfaces that set the prop via the JS property (`el.products = [...]`)
|
|
137
|
-
* deliver a real array; surfaces that bind it as an HTML attribute
|
|
138
|
-
* (WP / Magento server-render) deliver a JSON-stringified array. Anything
|
|
139
|
-
* else (truthy non-array non-string, JSON parse failure, JSON that decodes
|
|
140
|
-
* to a non-array) is treated as "no products" so the share still works
|
|
141
|
-
* without the product card section.
|
|
142
|
-
*/
|
|
143
|
-
function coerceProductCandidates(products) {
|
|
144
|
-
if (!products) return null;
|
|
145
|
-
if (Array.isArray(products)) return products;
|
|
146
|
-
if (typeof products !== "string") return null;
|
|
147
|
-
try {
|
|
148
|
-
const parsed = JSON.parse(products);
|
|
149
|
-
return Array.isArray(parsed) ? parsed : null;
|
|
150
|
-
} catch {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Normalise one untrusted candidate into a {@link SharingPageProduct}, or
|
|
156
|
-
* return null when the candidate has no usable title.
|
|
157
|
-
*
|
|
158
|
-
* The `products` prop is a public API boundary (merchants can set it
|
|
159
|
-
* server-side via WP/Magento or imperatively from arbitrary JS). Each entry
|
|
160
|
-
* is validated structurally so a malformed `link` reaching `new URL(...)`
|
|
161
|
-
* downstream would not crash the sharing-page builder, and so a
|
|
162
|
-
* `javascript:` URL cannot slip through as `imageUrl` / `link`.
|
|
163
|
-
*/
|
|
164
|
-
function normalizeProductCandidate(candidate) {
|
|
165
|
-
if (!candidate || typeof candidate !== "object") return null;
|
|
166
|
-
const item = candidate;
|
|
167
|
-
const title = typeof item.title === "string" ? item.title.trim() : "";
|
|
168
|
-
if (title === "") return null;
|
|
169
|
-
const entry = { title };
|
|
170
|
-
if (typeof item.imageUrl === "string" && isHttpUrl(item.imageUrl)) entry.imageUrl = item.imageUrl;
|
|
171
|
-
if (typeof item.link === "string" && isHttpUrl(item.link)) entry.link = item.link;
|
|
172
|
-
if (typeof item.utmContent === "string" && item.utmContent !== "") entry.utmContent = item.utmContent;
|
|
173
|
-
return entry;
|
|
174
|
-
}
|
|
175
|
-
//#endregion
|
|
176
114
|
//#region src/components/PostPurchase/PostPurchase.tsx
|
|
177
115
|
/**
|
|
178
116
|
* Given referral status and merchant info, compute the display variant
|
|
@@ -303,16 +241,7 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
|
|
|
303
241
|
placementId,
|
|
304
242
|
context?.reward
|
|
305
243
|
]);
|
|
306
|
-
const parsedProducts = useMemo(() =>
|
|
307
|
-
const candidates = coerceProductCandidates(products);
|
|
308
|
-
if (!candidates) return void 0;
|
|
309
|
-
const sanitized = [];
|
|
310
|
-
for (const candidate of candidates) {
|
|
311
|
-
const entry = normalizeProductCandidate(candidate);
|
|
312
|
-
if (entry) sanitized.push(entry);
|
|
313
|
-
}
|
|
314
|
-
return sanitized.length > 0 ? sanitized : void 0;
|
|
315
|
-
}, [products]);
|
|
244
|
+
const parsedProducts = useMemo(() => sanitizeProductList(products), [products]);
|
|
316
245
|
const handleClick = useCallback(() => {
|
|
317
246
|
if (!resolvedVariant) return;
|
|
318
247
|
trackEvent(window.FrakSetup?.client, "post_purchase_clicked", {
|