@frak-labs/components 1.0.11 → 1.0.12-beta.27533e18

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.
@@ -1,4 +1,20 @@
1
- import{T as e,b as t,f as n,h as r,s as i,u as a}from"./loader.js";import{a as o,d as s,f as c,h as l,l as u,m as d,n as ee,p as f,s as te,t as p,u as m}from"./defaults.kWEdCyGS.js";import{a as h,i as g,n as _,r as v,t as y}from"./GiftIcon.QppqMfWS.js";import{t as b}from"./useGlobalComponents.BC6Jgzg5.js";import{t as ne}from"./useLightDomStyles.imPXuAtf.js";import{r as x}from"./rewards.B6IAemE2.js";import{t as re}from"./useReward.IXcdcQPk.js";const S=`@keyframes keyframes_fadeIn__mnqmlt0 {
1
+ import{T as e,b as t,f as n,h as r,s as i,u as a}from"./loader.js";import{a as o,d as s,f as c,h as l,l as u,m as d,n as ee,p as f,s as te,t as p,u as m}from"./defaults.kWEdCyGS.js";import{a as h,i as g,n as _,r as v,t as y}from"./GiftIcon.DT1i36Fm.js";import{t as b}from"./useGlobalComponents.BC6Jgzg5.js";import{t as ne}from"./useLightDomStyles.imPXuAtf.js";import{r as x}from"./rewards.CIu9qbmI.js";import{t as re}from"./useReward.BAmvPaVu.js";const S=`@keyframes keyframes_fadeIn__mnqmlt0 {
2
+ from {
3
+ opacity: 0;
4
+ }
5
+ to {
6
+ opacity: 1;
7
+ }
8
+ }
9
+ @keyframes keyframes_fadeOut__mnqmlt1 {
10
+ from {
11
+ opacity: 1;
12
+ }
13
+ to {
14
+ opacity: 0;
15
+ }
16
+ }
17
+ @keyframes keyframes_fadeInDown__mnqmlt2 {
2
18
  from {
3
19
  opacity: 0;
4
20
  transform: translateY(-4px);
@@ -23,7 +39,7 @@ import{T as e,b as t,f as n,h as r,s as i,u as a}from"./loader.js";import{a as o
23
39
  backdrop-filter: blur(12px);
24
40
  -webkit-backdrop-filter: blur(12px);
25
41
  color: var(--text-onAction__pbq4ak6);
26
- animation: keyframes_fadeIn__mnqmlt0 300ms ease-out;
42
+ animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
27
43
  }
28
44
  .inAppBanner_header__1ibpiy71 {
29
45
  display: flex;
@@ -98,7 +114,7 @@ import{T as e,b as t,f as n,h as r,s as i,u as a}from"./loader.js";import{a as o
98
114
  }`;var w=`inAppBanner_body__1ibpiy74`,T=`inAppBanner_closeButton__1ibpiy77`,E=`inAppBanner_container__1ibpiy70`,D=`inAppBanner_cta__1ibpiy76`,O=`inAppBanner_description__1ibpiy75`,k=`inAppBanner_header__1ibpiy71`,A=`inAppBanner_iconWrapper__1ibpiy72`,j=`inAppBanner_title__1ibpiy73`;S+C;function M({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return d(`div`,{className:`${E}${o?` ${o}`:``}`,role:`alert`,children:[d(`div`,{className:k,children:[d(`span`,{className:`${A}${s?.icon?` ${s.icon}`:``}`,children:d(_,{width:20,height:20})}),d(`p`,{className:`${j}${s?.title?` ${s.title}`:``}`,children:e})]}),d(`div`,{className:w,children:[d(`p`,{className:`${O}${s?.description?` ${s.description}`:``}`,children:t}),d(`button`,{type:`button`,className:`${D}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,d(g,{width:14,height:14})]})]}),d(`button`,{type:`button`,className:`${T}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:d(h,{width:16,height:16})})]})}var ie=`Banner_frakLogo__1gnumzi9`,ae=`Banner_iconSvg__1gnumzi1`,oe=`Banner_referral__1gnumzi2 reset_base__1831jhd0 Banner_rootBase__1gnumzi0`,se=`Banner_referralBody__1gnumzi5`,ce=`Banner_referralCta__1gnumzi8 sharedBaseCss_buttonReset__7cswil0`,le=`Banner_referralDescription__1gnumzi7 reset_base__1831jhd0`,ue=`Banner_referralIconWrapper__1gnumzi3`,N=`Banner_referralImage__1gnumzi4`,P=`Banner_referralTitle__1gnumzi6 reset_base__1831jhd0`;const F=S+C+`.Banner_rootBase__1gnumzi0 {
99
115
  position: relative;
100
116
  display: flex;
101
- animation: keyframes_fadeIn__mnqmlt0 300ms ease-out;
117
+ animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
102
118
  }
103
119
  .Banner_iconSvg__1gnumzi1 {
104
120
  width: 100%;
@@ -1 +1 @@
1
- import{b as e,i as t}from"./loader.js";import{a as n,f as r,h as i,m as a,n as o,s,t as c,u as l}from"./defaults.kWEdCyGS.js";import{t as u}from"./useGlobalComponents.BC6Jgzg5.js";import{t as d}from"./useLightDomStyles.imPXuAtf.js";import{r as f}from"./rewards.B6IAemE2.js";import{t as p}from"./useReward.IXcdcQPk.js";import{t as m}from"./embeddedWallet.BS-9u4Be.js";function h({placement:i,text:h,classname:g=``,noRewardText:_,targetInteraction:v,clickAction:y,preview:b}){let x=!!b,S=n(),C=o(i),w=u(),T=C?.components?.buttonShare??w?.buttonShare;d(`frak-button-share`,i,T?.css);let E=l(()=>C?.targetInteraction===void 0?v:C.targetInteraction,[C?.targetInteraction,v]),D=T?.text??h??c[S].buttonShare.text,O=T?.noRewardText??_,k=l(()=>D.includes(`{REWARD}`),[D]),A=l(()=>T?.clickAction??y??`sharing-page`,[T?.clickAction,y]),{shouldRender:j,isHidden:M,isClientReady:N}=s(),{reward:P}=p(k&&N,E),F=l(()=>k?P?f(D,P):O??f(D,void 0):D,[k,D,O,P]),I=r(()=>{if(!x){if(e(window.FrakSetup.client,`share_button_clicked`,{placement:i,target_interaction:E,has_reward:!!P,click_action:A}),A===`embedded-wallet`){m(E,i);return}t(E,i)}},[x,A,E,i,P]);if(!x&&(!j||M))return null;let L=[`button`,`button__fadeIn`,g].filter(Boolean).join(` `);return a(`button`,{type:`button`,disabled:!x&&!N,class:L,onClick:I,children:F})}i(h,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`noRewardText`,`targetInteraction`,`preview`],{shadow:!1});export{h as ButtonShare};
1
+ import{b as e,i as t}from"./loader.js";import{a as n,f as r,h as i,m as a,n as o,s,t as c,u as l}from"./defaults.kWEdCyGS.js";import{t as u}from"./useGlobalComponents.BC6Jgzg5.js";import{t as d}from"./useLightDomStyles.imPXuAtf.js";import{r as f}from"./rewards.CIu9qbmI.js";import{t as p}from"./useReward.BAmvPaVu.js";import{t as m}from"./embeddedWallet.CDUxjdX2.js";function h({placement:i,text:h,classname:g=``,noRewardText:_,targetInteraction:v,clickAction:y,preview:b}){let x=!!b,S=n(),C=o(i),w=u(),T=C?.components?.buttonShare??w?.buttonShare;d(`frak-button-share`,i,T?.css);let E=l(()=>C?.targetInteraction===void 0?v:C.targetInteraction,[C?.targetInteraction,v]),D=T?.text??h??c[S].buttonShare.text,O=T?.noRewardText??_,k=l(()=>D.includes(`{REWARD}`),[D]),A=l(()=>T?.clickAction??y??`sharing-page`,[T?.clickAction,y]),{shouldRender:j,isHidden:M,isClientReady:N}=s(),{reward:P}=p(k&&N,E),F=l(()=>k?P?f(D,P):O??f(D,void 0):D,[k,D,O,P]),I=r(()=>{if(!x){if(e(window.FrakSetup.client,`share_button_clicked`,{placement:i,target_interaction:E,has_reward:!!P,click_action:A}),A===`embedded-wallet`){m(E,i);return}t(E,i)}},[x,A,E,i,P]);if(!x&&(!j||M))return null;let L=[`button`,`button__fadeIn`,g].filter(Boolean).join(` `);return a(`button`,{type:`button`,disabled:!x&&!N,class:L,onClick:I,children:F})}i(h,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`noRewardText`,`targetInteraction`,`preview`],{shadow:!1});export{h as ButtonShare};
@@ -0,0 +1,40 @@
1
+ import{a as e,d as t,g as n,h as r,m as i,n as a,p as o,r as s,s as c,t as l,u}from"./defaults.kWEdCyGS.js";import{t as d}from"./useReward.BAmvPaVu.js";import{t as f}from"./embeddedWallet.CDUxjdX2.js";function p(e){return i(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[i(`title`,{children:`Gift icon`}),i(`path`,{d:`m23.14 14v11.43h-18.29v-11.43m9.14 11.43v-17.14m0 0h-5.14c-0.76 0-1.48-0.3-2.02-0.84s-0.84-1.26-0.84-2.020.3-1.480.84-2.02 1.26-0.84 2.02-0.84c4 0 5.14 5.71 5.14 5.71zm0 0h5.14c0.76 0 1.48-0.3 2.02-0.84s0.84-1.260.84-2.02-0.3-1.48-0.84-2.02-1.26-0.84-2.02-0.84c-4 0-5.14 5.71-5.14 5.71zm-11.43 0h22.86v5.71h-22.86z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function m(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function h(e,t){m(),f(e,t)}function g({placement:r,classname:f=``,useReward:m,targetInteraction:g}){let _=e(),v=a(r),y=u(()=>v?.targetInteraction===void 0?g:v.targetInteraction,[v?.targetInteraction,g]),b=u(()=>m===!0,[m]),{shouldRender:x,isHidden:S,isClientReady:C}=c(),{reward:w}=d(b&&C,y),[T,E]=t(`right`);if(o(()=>{let e=v?.components?.buttonWallet?.position,t=window.FrakSetup?.modalWalletConfig?.metadata?.position;E(e??t??`right`)},[v?.components?.buttonWallet?.position]),!x||S)return null;let D=[`button`,`button__fadeIn`,T===`left`?`button__left`:`button__right`,f].filter(Boolean).join(` `);return i(n,{children:[i(`style`,{children:s(`
2
+ .button {
3
+ all: unset;
4
+ position: fixed;
5
+ bottom: 20px;
6
+ z-index: 2000000;
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ background-color: #3e557e;
11
+ width: 45px;
12
+ height: 45px;
13
+ border-radius: 50%;
14
+ cursor: pointer;
15
+ text-align: center;
16
+ font-size: 24px;
17
+ }
18
+
19
+ .button__left {
20
+ left: 20px;
21
+ }
22
+
23
+ .button__right {
24
+ right: 20px;
25
+ }
26
+
27
+ .reward {
28
+ position: absolute;
29
+ top: -4px;
30
+ right: 27px;
31
+ padding: 2px 3px;
32
+ border-radius: 5px;
33
+ background: #ff3f3f;
34
+ font-size: 9px;
35
+ color: #fff;
36
+ font-weight: 600;
37
+ white-space: nowrap;
38
+ line-height: 9px;
39
+ }
40
+ `,v?.components?.buttonWallet?.css)}),i(`button`,{type:`button`,"aria-label":l[_].buttonWallet.ariaLabel,part:`button`,disabled:!C,class:D,onClick:()=>{h(y,r)},children:[i(p,{}),w&&i(`span`,{class:`reward`,children:w})]})]})}r(g,`frak-button-wallet`,[`placement`,`classname`,`useReward`,`targetInteraction`],{shadow:!0});export{g as ButtonWallet};
@@ -0,0 +1 @@
1
+ import{m as e}from"./defaults.kWEdCyGS.js";function t(t){return e(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M7.33 0C11.38 0 14.67 3.28 14.67 7.33C14.67 11.38 11.38 14.67 7.33 14.67C3.28 14.67 0 11.38 0 7.33C0 3.28 3.28 0 7.33 0ZM10.39 4.28C10.15 4.04 9.76 4.04 9.52 4.28L7.33 6.47L5.14 4.28C4.9 4.04 4.52 4.04 4.28 4.28C4.04 4.52 4.04 4.9 4.28 5.14L6.47 7.33L4.28 9.52C4.04 9.76 4.04 10.15 4.28 10.39C4.52 10.63 4.9 10.63 5.14 10.39L7.33 8.2L9.52 10.39C9.76 10.63 10.15 10.63 10.39 10.39C10.63 10.15 10.63 9.76 10.39 9.52L8.2 7.33L10.39 5.14C10.63 4.9 10.63 4.52 10.39 4.28Z`,fill:`currentColor`})})}function n(t){return e(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M5.46 0C5.76 0 6 0.24 6 0.55C6 0.85 5.76 1.09 5.46 1.09H4.36C3.05 1.09 2.28 1.36 1.82 1.82C1.36 2.28 1.09 3.05 1.09 4.36V7.64C1.09 8.95 1.36 9.72 1.82 10.18C2.28 10.64 3.05 10.91 4.36 10.91H7.64C8.95 10.91 9.72 10.64 10.18 10.18C10.64 9.72 10.91 8.95 10.91 7.64V6.55C10.91 6.24 11.15 6 11.46 6C11.76 6 12 6.24 12 6.55V7.64C12 9.05 11.72 10.19 10.95 10.95C10.19 11.72 9.05 12 7.64 12H4.36C2.95 12 1.81 11.72 1.05 10.95C0.28 10.19 6.04e-05 9.05 0 7.64V4.36C0 2.95 0.28 1.81 1.05 1.05C1.81 0.28 2.95 0 4.36 0H5.46ZM11.45 0C11.76 2.2e-05 12 0.24 12 0.55V3.16C12 3.47 11.76 3.71 11.45 3.71C11.15 3.71 10.91 3.46 10.91 3.16V1.86L6.93 5.84C6.72 6.05 6.37 6.05 6.16 5.84C5.95 5.63 5.95 5.28 6.16 5.07L10.14 1.09H8.84C8.54 1.09 8.29 0.85 8.29 0.55C8.29 0.24 8.53 0 8.84 0H11.45Z`,fill:`currentColor`})})}function r(t){return e(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t.width??`63`,height:t.height??`24`,fill:`none`,viewBox:`0 0 63 24`,...t,children:[e(`title`,{children:`Frak`}),e(`rect`,{width:`24`,height:`24`,rx:`6`,fill:`#0043EF`}),e(`path`,{fill:`white`,d:`M9.77 15.91L5.15 14.35C5.06 14.32 4.97 14.38 4.97 14.47V17.33C4.97 17.39 5.01 17.44 5.06 17.46L9.68 19.02C9.77 19.05 9.86 18.98 9.86 18.89V16.04C9.86 15.98 9.82 15.93 9.77 15.91ZM14.58 10.44L9.95 12C9.9 12.02 9.86 12.07 9.86 12.13V14.98C9.86 15.08 9.95 15.14 10.04 15.11L14.66 13.55C14.72 13.53 14.76 13.48 14.76 13.42V10.57C14.76 10.47 14.66 10.41 14.58 10.44ZM18.92 5.02L11.18 7.51C11.12 7.53 11.08 7.58 11.08 7.64V10.57C11.08 10.62 11.14 10.66 11.2 10.65L18.94 8.15C18.99 8.14 19.03 8.08 19.03 8.02V5.1C19.03 5.04 18.97 5 18.92 5.02Z`}),e(`path`,{fill:`currentColor`,d:`M52.72 9.51C52.83 9.51 52.91 9.6 52.91 9.7L52.84 18.21C52.84 18.31 52.76 18.39 52.66 18.39L52.64 18.39H51.3C51.15 18.39 50.78 18.25 50.39 18C49.86 18.25 49.27 18.39 48.64 18.39H48.39C47.24 18.39 46.19 17.91 45.43 17.14C44.67 16.38 44.2 15.32 44.2 14.15C44.2 12.98 44.67 11.92 45.43 11.15C46.16 10.41 47.16 9.94 48.26 9.91C49.17 9.86 49.99 9.99 50.49 10.5V9.7C50.49 9.6 50.57 9.51 50.68 9.51H52.72ZM35.35 5.62H36.96C37.09 5.62 37.19 5.72 37.19 5.85V7.81C37.19 7.94 37.09 8.04 36.96 8.04H34.92C34.32 8.04 33.63 8.64 33.63 9.25V10.61C34.26 9.98 34.93 9.65 35.35 9.63H36.46C36.59 9.63 36.69 9.73 36.69 9.86V11.82C36.69 11.95 36.59 12.05 36.46 12.05H34.92C34.31 12.05 33.63 12.65 33.63 13.27V18.2C33.63 18.3 33.54 18.39 33.44 18.39H31.39C31.29 18.39 31.21 18.3 31.21 18.2V9.94C31.21 9.87 31.2 9.8 31.2 9.73C31.24 8.88 31.15 5.44 35.35 5.62ZM39.93 9.63C40.04 9.63 40.12 9.72 40.12 9.82V10.61C40.76 9.98 41.58 9.63 41.85 9.63H43.46C43.58 9.63 43.68 9.73 43.69 9.86V11.82C43.68 11.95 43.58 12.05 43.46 12.05H41.41C40.81 12.05 40.12 12.65 40.12 13.27V18.2C40.12 18.3 40.04 18.39 39.93 18.39H37.89C37.79 18.39 37.7 18.3 37.7 18.2V9.82C37.7 9.72 37.79 9.63 37.89 9.63H39.93ZM56.2 7.01C56.3 7.01 56.39 7.09 56.39 7.2V13.45L59.83 10.19C59.87 10.16 59.91 10.14 59.96 10.14H62.28C62.45 10.14 62.54 10.34 62.42 10.46L59.3 13.63L62.8 18.07C62.9 18.2 62.81 18.39 62.65 18.39H60.24C60.18 18.39 60.13 18.36 60.09 18.31L57.67 15.32C57.6 15.23 57.47 15.22 57.39 15.3L56.39 16.29V18.19C56.39 18.3 56.3 18.39 56.2 18.39H54.19C54.08 18.39 54 18.3 54 18.19V7.2C54 7.09 54.08 7.01 54.19 7.01H56.2ZM48.37 11.96C47.78 11.96 47.24 12.21 46.85 12.6C46.46 13 46.22 13.54 46.22 14.14C46.22 14.73 46.46 15.28 46.85 15.67C47.24 16.07 47.78 16.31 48.37 16.31H48.66C49.25 16.31 49.79 16.07 50.18 15.67C50.57 15.28 50.81 14.73 50.81 14.14C50.81 13.54 50.57 12.99 50.18 12.6C49.79 12.21 49.25 11.96 48.66 11.96H48.37Z`})]})}2*Math.PI*11;function i(t){return e(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M8 0C12.42 0 16 3.58 16 8C16 12.42 12.42 16 8 16C3.58 16 0 12.42 0 8C0 3.58 3.58 0 8 0ZM8 1.5C4.41 1.5 1.5 4.41 1.5 8C1.5 11.59 4.41 14.5 8 14.5C11.59 14.5 14.5 11.59 14.5 8C14.5 4.41 11.59 1.5 8 1.5ZM8.1 10.21C8.82 10.21 9.24 10.63 9.24 11.33C9.24 12.03 8.82 12.46 8.1 12.46C7.36 12.46 6.97 12.03 6.97 11.33C6.97 10.63 7.36 10.21 8.1 10.21ZM8.85 3.54C9.01 3.54 9.15 3.68 9.15 3.84V4.75L8.84 8.37C8.83 8.53 8.7 8.65 8.54 8.65H7.63C7.47 8.65 7.34 8.52 7.33 8.37L7.08 4.75V3.84C7.09 3.68 7.22 3.54 7.38 3.54H8.85Z`,fill:`currentColor`})})}function a(t){return e(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...t,children:[e(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),e(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),e(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}export{t as a,n as i,i as n,r,a as t};
@@ -0,0 +1,89 @@
1
+ import{S as e,T as t,a as n,b as r,c as i,i as a,o,r as ee,x as s}from"./loader.js";import{a as c,d as l,f as te,h as u,l as ne,m as d,n as f,p,s as m,t as h,u as g}from"./defaults.kWEdCyGS.js";import{r as re,t as ie}from"./GiftIcon.DT1i36Fm.js";import{t as ae}from"./useGlobalComponents.BC6Jgzg5.js";import{t as oe}from"./useLightDomStyles.imPXuAtf.js";import{i as se,n as _,r as v}from"./rewards.CIu9qbmI.js";var y=`PostPurchase_card__5fv5lh0`,ce=`PostPurchase_cardLayout__5fv5lh1`,b=`PostPurchase_cardLeft__5fv5lh2`,x=`PostPurchase_cardRight__5fv5lh3`,S=`PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0`,le=`PostPurchase_customImage__5fv5lha`,ue=`PostPurchase_frakLogo__5fv5lhb`,de=`PostPurchase_giftIcon__5fv5lh8`,fe=`PostPurchase_icon__5fv5lh7`,pe=`PostPurchase_imageWrapper__5fv5lh9`,me=`PostPurchase_message__5fv5lh5`;function he(e,t,n){let r=e?.isReferred?`referee`:`referrer`,i=_(t.rewards,{targetInteraction:`purchase`,currency:n,audience:r});if(!i)return null;let{campaign:a}=i,o=e?.isReferred&&a.referee?`referee`:`referrer`;return{variant:o,reward:o===`referee`?a.referee:a.referrer,merchantDomain:t.onChainMetadata.domain}}function C({customerId:u,orderId:_,token:C,sharingUrl:ge,merchantId:w,placement:T,classname:E=``,variant:D,badgeText:O,referrerText:k,refereeText:A,ctaText:j,preview:M,previewVariant:N,products:P,imageUrl:F}){let I=!!M,{shouldRender:L,isHidden:R,isClientReady:z}=m(),B=f(T),V=c();oe(`frak-post-purchase`,T,B?.components?.postPurchase?.css,`.PostPurchase_card__5fv5lh0 {
2
+ padding: 16px;
3
+ border-radius: 12px;
4
+ background-color: var(--surface-background__pbq4akc);
5
+ border: 1px solid var(--border-default__pbq4akv);
6
+ }
7
+ .PostPurchase_cardLayout__5fv5lh1 {
8
+ display: flex;
9
+ flex-direction: row;
10
+ align-items: center;
11
+ gap: 32px;
12
+ }
13
+ .PostPurchase_cardLeft__5fv5lh2 {
14
+ flex-grow: 1;
15
+ min-width: 0;
16
+ display: flex;
17
+ flex-direction: column;
18
+ gap: 8px;
19
+ }
20
+ .PostPurchase_cardRight__5fv5lh3 {
21
+ flex-shrink: 0;
22
+ display: flex;
23
+ flex-direction: column;
24
+ align-items: flex-end;
25
+ gap: 8px;
26
+ text-align: right;
27
+ }
28
+ .PostPurchase_badge__5fv5lh4 {
29
+ align-self: flex-start;
30
+ background-color: #FFF534;
31
+ border-radius: 4px;
32
+ padding: 4px 8px;
33
+ font-size: 12px;
34
+ font-weight: 600;
35
+ line-height: 12px;
36
+ color: var(--text-primary__pbq4ak0);
37
+ }
38
+ .PostPurchase_message__5fv5lh5 {
39
+ margin: 0;
40
+ font-size: 16px;
41
+ line-height: 22px;
42
+ color: var(--text-primary__pbq4ak0);
43
+ font-weight: 600;
44
+ }
45
+ .PostPurchase_cta__5fv5lh6 {
46
+ display: inline-flex;
47
+ align-items: center;
48
+ justify-content: center;
49
+ gap: 4px;
50
+ padding: 12px 16px;
51
+ border-radius: 9999px;
52
+ background-color: var(--text-primary__pbq4ak0);
53
+ color: var(--text-onAction__pbq4ak6);
54
+ font-size: 12px;
55
+ font-weight: bold;
56
+ text-transform: uppercase;
57
+ }
58
+ .PostPurchase_cta__5fv5lh6:disabled {
59
+ opacity: 0.7;
60
+ cursor: default;
61
+ }
62
+ .PostPurchase_icon__5fv5lh7 {
63
+ margin: -2px 0;
64
+ }
65
+ .PostPurchase_giftIcon__5fv5lh8 {
66
+ display: block;
67
+ flex-shrink: 0;
68
+ }
69
+ .PostPurchase_imageWrapper__5fv5lh9 {
70
+ flex-shrink: 0;
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: center;
74
+ width: 80px;
75
+ height: 80px;
76
+ overflow: hidden;
77
+ }
78
+ .PostPurchase_customImage__5fv5lha {
79
+ max-width: 100%;
80
+ max-height: 100%;
81
+ width: auto;
82
+ height: auto;
83
+ object-fit: contain;
84
+ display: block;
85
+ }
86
+ .PostPurchase_frakLogo__5fv5lhb {
87
+ display: block;
88
+ margin-left: auto;
89
+ }`,t);let[H,_e]=l(null),[U,W]=l(!1);p(()=>{I||!z||!u||!_||!C||n({customerId:u,orderId:_,token:C,merchantId:w}).catch(()=>{})},[I,z,u,_,C,w]),p(()=>{if(I||!z||U)return;let t=window.FrakSetup?.client;t&&Promise.all([o(t),i(t)]).then(([e,n])=>{W(!0),_e(he(e,n,t.config.metadata?.currency))}).catch(t=>{if(t instanceof e&&t.code===s.configError){W(!0);return}console.warn(`[Frak] Post-purchase context error`,t)})},[I,z,U]);let G=ne(null),K=D??H?.variant??(I?N??`referrer`:void 0),q=ge??H?.merchantDomain,J=g(()=>{if(!H?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return se(H.reward,e)},[H?.reward]),ve=ae(),Y=B?.components?.postPurchase??ve?.postPurchase,X=O??Y?.badgeText,Z=F??Y?.imageUrl,Q=g(()=>{let e=h[V].postPurchase;return{message:K===`referee`?J?v(A??Y?.refereeText??e.refereeText,J):A??Y?.refereeNoRewardText??e.refereeNoRewardText:J?v(k??Y?.referrerText??e.referrerText,J):k??Y?.referrerNoRewardText??e.referrerNoRewardText,cta:J?v(j??Y?.ctaText??e.ctaText,J):j??Y?.ctaNoRewardText??e.ctaNoRewardText}},[V,K,J,Y,k,A,j]);p(()=>{K&&G.current!==K&&z&&(!I&&(!L||R)||(r(window.FrakSetup?.client,`post_purchase_impression`,{placement:T,variant:K,has_reward:!!H?.reward}),G.current=K))},[K,L,R,z,I,T,H?.reward]);let $=g(()=>ee(P),[P]),ye=te(()=>{K&&(r(window.FrakSetup?.client,`post_purchase_clicked`,{placement:T,variant:K}),a(void 0,T,{link:q,products:$}))},[K,T,q,$]);return!K||!I&&(!L||R||!H)?null:d(`div`,{className:[y,E].filter(Boolean).join(` `),children:d(`div`,{class:ce,children:[d(`div`,{class:b,children:[X&&d(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:X}),d(`p`,{class:me,children:Q.message}),d(`button`,{type:`button`,className:`${S} button`,disabled:!I&&!z,onClick:I?void 0:ye,children:[Q.cta,d(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`${fe} button`,children:d(`path`,{d:`M13.9 11.14C13.99 11.05 14.15 11.11 14.15 11.24V11.64C14.15 13.05 12.63 14.19 10.75 14.19C8.87 14.19 7.34 13.05 7.34 11.64V11.24C7.34 11.11 7.51 11.05 7.59 11.14C8.35 11.93 9.48 12.43 10.75 12.43C12.01 12.43 13.15 11.93 13.9 11.14ZM1.85 9.65C1.85 9.51 2.01 9.44 2.1 9.54C2.85 10.32 3.99 10.82 5.25 10.82C5.52 10.82 5.79 10.8 6.04 10.76C6.26 10.72 6.47 10.88 6.47 11.1V12.17C6.47 12.32 6.37 12.45 6.22 12.48C5.92 12.55 5.59 12.59 5.25 12.59C3.37 12.59 1.85 11.45 1.85 10.04V9.65ZM10.75 6.21C12.63 6.21 14.15 7.35 14.15 8.75C14.15 10.16 12.63 11.3 10.75 11.3C8.87 11.3 7.34 10.16 7.34 8.75C7.34 7.35 8.87 6.21 10.75 6.21ZM1.85 6.85C1.85 6.71 2.01 6.65 2.1 6.74C2.85 7.53 3.99 8.03 5.25 8.03C5.52 8.03 5.79 8 6.04 7.96C6.26 7.92 6.47 8.09 6.47 8.3V9.37C6.47 9.52 6.37 9.65 6.22 9.69C5.92 9.75 5.59 9.79 5.25 9.79C3.37 9.79 1.85 8.65 1.85 7.24V6.85ZM5.25 1.81C7.13 1.81 8.66 2.95 8.66 4.36C8.66 5.76 7.13 6.9 5.25 6.9C3.37 6.9 1.85 5.76 1.85 4.36C1.85 2.95 3.37 1.81 5.25 1.81Z`,fill:`currentColor`})})]})]}),d(`div`,{class:x,children:[Z?d(`span`,{class:pe,children:d(`img`,{src:Z,alt:``,class:le})}):d(ie,{className:de,width:80,height:80}),d(re,{className:ue,width:42,height:24})]})]})})}u(C,`frak-post-purchase`,[`customerId`,`orderId`,`token`,`sharingUrl`,`merchantId`,`placement`,`classname`,`variant`,`badgeText`,`referrerText`,`refereeText`,`ctaText`,`products`,`preview`,`previewVariant`,`imageUrl`],{shadow:!1});export{C as PostPurchase};
package/cdn/components.js CHANGED
@@ -1 +1 @@
1
- import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@latest/cdn/loader.js?v=1782831755950`);
1
+ import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=1783609459857`);
@@ -0,0 +1 @@
1
+ import{l as e}from"./loader.js";async function t(t,n){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}let r=window.FrakSetup?.modalWalletConfig??{};await e(window.FrakSetup.client,t?{...r,metadata:{...r.metadata,targetInteraction:t}}:r,n)}export{t};
package/cdn/loader.js CHANGED
@@ -151,4 +151,4 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
151
151
  }
152
152
  .sharedBaseCss_buttonReset__7cswil0:focus-visible {
153
153
  outline-color: currentColor;
154
- }`;function r(e,t){let n=document.getElementById(e);if(n){n.textContent!==t&&(n.textContent=t);return}let r=document.createElement(`style`);r.id=e,r.textContent=t,document.head.appendChild(r)}function i(e,t){let n=`frak-base-${e}`;if(document.getElementById(n)||!t)return;let r=document.createElement(`style`);r.id=n,r.textContent=t,document.head.appendChild(r)}function a(e,t,n){r(`frak-placement-${e}-${t}`,n)}const o={injectBase:i,injectPlacement:a};function s(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener(`DOMContentLoaded`,e)}const c={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var l=class extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},u=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}};function d(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function d(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch{}}async function f(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function p(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function m(e){try{if(new URL(e.origin).origin.toLowerCase()!==new URL(r).origin.toLowerCase())return}catch{return}if(s(e.data)){await d(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await p(e.data,r)}catch{return}let n=o.get(e.data.id);n&&n(t)}async function h(e){let n=e;try{n=await f(e)}catch(e){throw e}t.postMessage(n,r)}function g(e){t.postMessage(e,r)}function _(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,m);function v(e){let t=_(),n=new u;return o.set(t,e=>{e.error?n.reject(new l(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),h({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function y(e,t){let n=_();return o.set(n,e=>{e.error?o.delete(n):t(e.result)}),h({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(n)}),()=>{o.delete(n)}}function b(){n.removeEventListener(`message`,m),o.clear()}return{request:v,listen:y,sendLifecycle:g,cleanup:b}}function f(e){return new TextEncoder().encode(JSON.stringify(e))}function p(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const m=`frak-client-id`;function h(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function g(){if(typeof window>`u`||!window.localStorage)return h();let e=localStorage.getItem(m);return e||(e=h(),localStorage.setItem(m,e)),e}var _=class extends Map{maxSize;constructor(e){super(),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};let v;function y(){return v||={promiseCache:new _(1024),responseCache:new _(1024),failureCache:new _(1024)},v}async function b(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=y();if(n>0){let e=i.get(t);if(e&&Date.now()-e.created<n)return e.data}let o=a.get(t);if(o&&Date.now()-o<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let s=r.get(t);s||(s=e(),r.set(t,s));try{let e=await s;return i.set(t,{data:e,created:Date.now()}),a.delete(t),e}catch(e){throw a.set(t,Date.now()),e}finally{r.delete(t)}}function x(){v&&(v.promiseCache.clear(),v.responseCache.clear(),v.failureCache.clear())}const ee=`https://backend.frak.id`;function te(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function ne(e){return te(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:ee}function S(e){if(e)return ne(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return ne(e)}return ee}const C=`__frakSdkConfig`,re=`frak-config-cache`,w=`frak-merchant-id`,T={key:re},E=typeof window<`u`;function D(){return{isResolved:!1,merchantId:``}}let O=null;function ie(){if(!E)return null;try{let e=localStorage.getItem(T.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(O=t,t):null}catch{return null}}function ae(){return(O??ie())?.config}function oe(){let e=O??ie();return e?Date.now()-e.timestamp<3e4:!1}function se(e){if(!(!E||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(T.key,JSON.stringify(t)),O=t}catch{}}function ce(){if(E){O=null;try{localStorage.removeItem(T.key)}catch{}}}function le(){E&&(window[C]||(window[C]=ae()??D()))}function k(){return E?(le(),window[C]??D()):D()}function ue(e){E&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function de(e){return e??(E?window.location.hostname:``)}async function fe(e,t,n){try{let r=S(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok)return;let o=await a.json();if(E)try{sessionStorage.setItem(w,o.merchantId)}catch{}return o}catch{return}}const A={getConfig:k,get isResolved(){return k().isResolved},get isCacheFresh(){return oe()},setCacheScope(e,t){T.key=`${re}:${`${e}:${t??``}`}`,O=null},setConfig(e){if(E&&(window[C]=e),se(e),ue(e),E&&e.merchantId)try{sessionStorage.setItem(w,e.merchantId)}catch{}},reset(){let e=ae()??D();E&&(window[C]=e),ue(e)},clearCache(){if(ce(),x(),E)try{sessionStorage.removeItem(w)}catch{}},resolve(e,t,n){let r=de(e);return r?b(async()=>{let e=await fe(r,t,n);if(!e)throw Error(`Config resolution returned empty`);return e},{cacheKey:`sdkConfig:${r}:${n??``}`,cacheTime:1/0}).catch(()=>void 0):Promise.resolve(void 0)},getMerchantId(){let e=k();if(e.isResolved&&e.merchantId)return e.merchantId;if(E)try{return sessionStorage.getItem(w)??void 0}catch{}},async resolveMerchantId(e,t){return A.getMerchantId()||(await A.resolve(e,t))?.merchantId}};function j(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function M(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function pe(e){return j(f(e))}function me(e,t,n,r,i,a){let o=pe(he({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,merchantId:n,metadata:{name:r,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink},clientId:i})),s=new URL(e);return s.pathname=`/sso`,s.searchParams.set(`p`,o),s.toString()}function he(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}const ge=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,_e=`frak-sso`;async function ve(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config,a={...t,directExit:t.directExit??!t.redirectUrl};if(a.openInSameWindow??!!a.redirectUrl)return await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]});let o=a.ssoPopupUrl??me(i??`https://wallet.frak.id`,a,await A.resolveMerchantId()??``,n.name,g(),r?.css),s=window.open(o,_e,ge);if(!s)throw Error(`Popup was blocked. Please allow popups for this site.`);return s.focus(),await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]})??{}}function N(e,t,n){if(e)try{e.openPanel?.track(t,n)}catch{}}function P(e,t){let n=e.get(t);if(n!==null)return n;let r=t.toLowerCase();for(let[t,n]of e)if(t.toLowerCase()===r)return n;return null}function F(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}const ye=/^0x[a-fA-F0-9]{40}$/;function I(e){return typeof e==`string`&&ye.test(e)}function be(e,t){return e.toLowerCase()===t.toLowerCase()}function xe(e){let t=new Uint8Array(20);for(let n=0;n<20;n++){let r=Number.parseInt(e.substring(2+n*2,4+n*2),16);if(Number.isNaN(r))throw Error(`Invalid address: ${e}`);t[n]=r}return t}const Se=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ce(e){let t=`0x`;for(let n=0;n<20;n++)t+=Se[e[n]];return t}function we(e){return`r`in e&&!(`v`in e)}function L(e){return`v`in e&&e.v===2}const Te=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ee(e){return typeof e==`string`&&Te.test(e)}function De(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=Number.parseInt(t.substring(e*2,e*2+2),16);return n}function Oe(e){let t=``;for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function ke(e){if(!Ee(e.m)||!Number.isInteger(e.t)||e.t<0||e.t>4294967295)return null;let t=typeof e.c==`string`&&e.c.length>0,n=typeof e.w==`string`&&I(e.w);if(!t&&!n||t&&!Ee(e.c))return null;let r=new Uint8Array(21+(t?16:0)+(n?20:0)),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=0;return r[a++]=2|(t?16:0)|(n?32:0),r.set(De(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(De(e.c),a),a+=16),n&&(r.set(xe(e.w),a),a+=20),r}function Ae(e){if(e.length<21)return null;let t=e[0];if((t&15)!=2||t&192)return null;let n=(t&16)!=0,r=(t&32)!=0;if(!n&&!r)return null;let i=21+(n?16:0)+(r?20:0);if(e.length!==i)return null;let a=1,o=Oe(e.subarray(a,a+16));a+=16;let s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(a,!1);a+=4;let c={v:2,m:o,t:s};if(n&&(c.c=Oe(e.subarray(a,a+16)),a+=16),r){let t=Ce(e.subarray(a,a+20));if(!I(t))return null;c.w=t,a+=20}return c}const R=`fCtx`;function je(e){if(e)try{if(L(e)){let t=ke(e);return t?j(t):void 0}return j(xe(e.r))}catch{}}function Me(e){if(!(!e||e.length===0))try{let t=M(e);if(t.length!==20)return Ae(t)||void 0;let n=Ce(t);if(I(n))return{r:n}}catch{}}function Ne({url:e}){if(!e)return null;let t=P(new URL(e).searchParams,R);return t?Me(t):null}function Pe(e){return{utm_source:e.utmSource??`frak`,utm_medium:e.utmMedium??void 0,utm_campaign:e.utmCampaign??void 0,utm_content:e.utmContent,utm_term:e.utmTerm,via:e.via??void 0,ref:e.ref??void 0}}function Fe(e,t){let n=Pe(t??{});for(let[t,r]of Object.entries(n))r===void 0||r===``||e.searchParams.has(t)||e.searchParams.set(t,r)}function Ie({url:e,context:t,attribution:n}){if(!e)return null;let r=je(t);if(!r)return null;let i=new URL(e);return F(i.searchParams,R),i.searchParams.set(R,r),Fe(i,n),i.toString()}function Le(e){let t=new URL(e);return F(t.searchParams,R),t.toString()}function Re({url:e,context:t}){if(!window.location?.href||typeof window>`u`)return;let n=e??window.location.href,r;r=t===null?Le(n):Ie({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const z={compress:je,decompress:Me,parse:Ne,update:Ie,remove:Le,replaceUrl:Re},B={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function V(e){return e&&e in B?e:`eur`}function ze(e){return e?B[e]??B.eur:B.eur}function Be(e,t){let n=ze(t),r=V(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Ve(e){return e?`${e}Amount`:`eurAmount`}var He=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch{if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},Ue=class{constructor(e){this.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.1`,this.api=new He({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.disabled=!1,this.options.waitForProfile=!1,this.flush()}shouldQueue(e){return!!(this.options.disabled||this.options.waitForProfile&&!this.profileId||e.type===`replay`&&!this.sessionId)}addQueue(e){e.type===`track`&&(e.payload.properties={...e.payload.properties??{},__timestamp:new Date().toISOString()}),this.queue.push(e)}async send(e){if(this.options.filter&&!this.options.filter(e))return Promise.resolve();if(this.shouldQueue(e))return this.addQueue(e),Promise.resolve();let t=await this.api.fetch(`/track`,e,{keepalive:e.type!==`replay`});this.deviceId=t?.deviceId;let n=!!this.sessionId;return this.sessionId=t?.sessionId,!n&&this.sessionId&&this.flush(),t}setGlobalProperties(e){this.global={...this.global,...e}}track(e,t){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),e.profileId&&Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug}},We=typeof document<`u`?document.currentScript:null;function Ge(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Ke=class extends Ue{constructor(e){if(super({sdk:`web`,sdkVersion:`1.4.1`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=We,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{e(null)},document.head.appendChild(n)})}return await import(`./replay-V6FXES7X.BoL9fAjx.js`)}catch{return null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[Ge(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};const H=`nexus-wallet-backup`,U=`frakwallet://`;function qe(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}})}).catch(e=>{}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()))}function Je(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const Ye=U.replace(`://`,``);function Xe(e){return`intent://${e.slice(13)}#Intent;scheme=${Ye};end`}function W(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Je()&&Ze(e)?Xe(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function Ze(e){return e.startsWith(U)}function Qe(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}const G=Qe();function $e(){return typeof navigator>`u`?!1:G?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function et(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}const K=et();function tt(e){G&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:G&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}const q={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};function nt({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=q.id,r.name=q.name,r.allow=q.allow,r.style.zIndex=q.style.zIndex.toString(),it({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=g();return ot(i),ot(S(i)),r.src=rt({walletUrl:i,clientId:a,preload:t?.preload}),new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function rt({walletUrl:e,clientId:t,preload:n}){let r=`${e}/listener?clientId=${encodeURIComponent(t)}`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function it({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function at(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch{return null}}function ot(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}const st=G&&K;function ct(e){e?localStorage.setItem(H,e):localStorage.removeItem(H)}function J(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=dt(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function lt(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function ut(e){return e.includes(`/common/social`)}function dt(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function ft(e,t,n,r,i){if(i){let e=J(t,r);window.open(e,`_blank`);return}if(Ze(t)){let i=J(t,r);W(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(st&&ut(t))lt(r);else{let e=J(t,r);window.location.href=e}}function pt({iframe:e,targetOrigin:t}){let n=new u;return{handleEvent:r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:i,data:a}=r;switch(i){case`connected`:n.resolve(!0);break;case`do-backup`:ct(a.backup);break;case`remove-backup`:localStorage.removeItem(H);break;case`show`:case`hide`:it({iframe:e,isVisible:i===`show`});break;case`redirect`:ft(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function mt({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=typeof navigator<`u`?navigator.language?.split(`-`)[0]:void 0,i=e.metadata.lang??(r===`en`||r===`fr`?r:void 0),a=e.domain??(typeof window<`u`?window.location.hostname:``);A.setCacheScope(a,i),A.reset();let o=A.isCacheFresh?void 0:A.resolve(e.domain,e.walletUrl,i),s=pt({iframe:t,targetOrigin:n}),f=new u,p=Date.now();if(!t.contentWindow)throw new l(c.configError,`The iframe does not have a content window`);let m=d({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new l(c.clientNotConnected,`The iframe provider isn't connected yet`);return await f.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),h=ht(m,s),_=async()=>{h(),m.cleanup(),t.remove(),x(),A.clearCache(),A.reset()},v;{v=new Ke({apiUrl:`https://op-api.gcp.frak.id`,clientId:`f305d11d-b93b-487c-80d4-92deb7903e98`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdk_version`in t.properties||(t.properties={...t.properties,sdk_version:`1.1.6`,user_anonymous_client_id:g()}),!0)}),v.setGlobalProperties({sdk_version:`1.1.6`,user_anonymous_client_id:g()}),v.init(),v.track(`sdk_initialized`,{sdk_version:`1.1.6`});let e=!1,t=setTimeout(()=>{e||(e=!0,v?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-p}))}).catch(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let y=gt({config:e,rpcClient:m,lifecycleManager:s,configPromise:o,contextSent:f,openPanel:v}).then(()=>{}).catch(e=>{throw f.reject(e),e});return{config:e,waitForConnection:s.isConnected,waitForSetup:y,request:m.request,listenerRequest:m.listen,destroy:_,openPanel:v}}function ht(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o()},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function gt({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,qe(t,n.isConnected);let o=new URL(window.location.href),s=o.searchParams.get(`fmt`)??void 0;s&&(o.searchParams.delete(`fmt`),window.history.replaceState({},``,o.toString()));let c=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig,o=a?.attribution||e.attribution?{...e.attribution,...a?.attribution}:void 0;A.setConfig(a?{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,hasRawSdkConfig:!0,name:a.name??e.metadata.name,logoUrl:a.logoUrl??e.metadata.logoUrl,homepageLink:a.homepageLink??e.metadata.homepageLink,lang:a.lang??e.metadata.lang,currency:a.currency??e.metadata.currency,hidden:a.hidden,css:a.css,translations:a.translations,placements:a.placements,components:a.components,attribution:o}:{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,name:e.metadata.name,logoUrl:e.metadata.logoUrl,homepageLink:e.metadata.homepageLink,lang:e.metadata.lang,currency:e.metadata.currency,attribution:o})},l=!1,u=e=>{let n=l?void 0:s;l=!0;let r=e.hasRawSdkConfig?{name:e.name,logoUrl:e.logoUrl,homepageLink:e.homepageLink,lang:e.lang,currency:e.currency,hidden:e.hidden,css:e.css,translations:e.translations,placements:e.placements,attribution:e.attribution}:e.attribution?{attribution:e.attribution}:void 0,i=g();if(a){let t=a.global??{};a.setGlobalProperties({...t,merchant_id:e.merchantId,domain:e.domain??``})}t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:window.location.href,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r}}})};A.isResolved&&(u(A.getConfig()),i.resolve()),r&&(c(await r),u(A.getConfig()),i.resolve());async function d(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function f(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function p(){if(typeof window>`u`)return;let e=window.localStorage.getItem(H);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([d(),f(),p()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}function _t(e){return p(M(e))}async function vt({config:e}){let t=yt(e),n=await nt({config:t});if(!n)return;let r=mt({config:t,iframe:n});if(await r.waitForSetup,await r.waitForConnection)return r}function yt(e){let t=V(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function bt({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&!(n!==void 0&&n!==``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}var xt=t({DEEP_LINK_SCHEME:()=>U,FrakContextManager:()=>z,base64urlDecode:()=>M,base64urlEncode:()=>j,baseIframeProps:()=>q,clearAllCache:()=>x,compressJsonToB64:()=>pe,createIFrameFrakClient:()=>mt,decompressJsonFromB64:()=>_t,deleteQueryParamCaseInsensitive:()=>F,findIframeInOpener:()=>at,formatAmount:()=>Be,generateSsoUrl:()=>me,getBackendUrl:()=>S,getClientId:()=>g,getCurrencyAmountKey:()=>Ve,getQueryParamCaseInsensitive:()=>P,getSupportedCurrency:()=>V,isIOS:()=>G,isInAppBrowser:()=>K,isMobile:()=>$e,mergeAttribution:()=>bt,redirectToExternalBrowser:()=>tt,sdkConfigStore:()=>A,setupClient:()=>vt,ssoPopupFeatures:()=>ge,ssoPopupName:()=>_e,trackEvent:()=>N,triggerDeepLinkWithFallback:()=>W,withCache:()=>b});async function St(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Y(e,{steps:t,metadata:n},r){return await e.request({method:`frak_displayModal`,params:r?[t,n,e.config.metadata,r]:[t,n,e.config.metadata]})}async function Ct(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function wt(e){if(typeof window>`u`)return;let t=g();if(!t)return;let n=await A.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=S();(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t},body:JSON.stringify({merchantId:n})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function Tt(e,t){return b(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function Et(e,t){return b(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function Dt(e,t){return b(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function Ot(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function X(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:g()}]})}catch{}}function kt(e,t,n){return L(t)?(N(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),X(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):we(t)?(N(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),X(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function At(e,t){let n=g();return!n&&!t?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...n?{c:n}:{},...t?{w:t}:{}}}function jt(e,t){return L(e)?e.w&&t?.wallet?be(e.w,t.wallet):e.c?g()===e.c:!1:we(e)&&t?.wallet?be(e.r,t.wallet):!1}function Mt(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(jt(n,t))return`self-referral`;if(!kt(e,n,t))return`no-referrer`;let i=L(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?At(i,t?.wallet):null;return z.replaceUrl({url:window.location?.href,context:a}),N(e,`user_referred_completed`,{status:`success`}),`success`}async function Z(e,{options:t}={}){let n=z.parse({url:window.location.href}),r=await Ft(e);try{return Mt(e,{walletStatus:r,frakContext:n,options:t})}catch{}}const Q=`frak:referral-success`;async function Nt(e){try{await Z(e)===`success`&&window.dispatchEvent(new Event(Q))}catch{}}async function Pt(e){if(typeof window>`u`)return;let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=g();if(!t&&!n)return;let r=e.merchantId??await A.resolveMerchantId();if(!r)return;let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=S();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function Ft(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(It(e,t),t));let n=new u,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{It(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function It(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),wt(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function Lt(e,{metadata:t,login:n}){return $(e,{steps:{login:n??{}},metadata:t})}function $(e,t){function n(n){return $(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return $(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return $(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n,r){return n&&(t.metadata=n(t.metadata??{})),await Y(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function Rt(e,{tx:t,metadata:n}){return(await Y(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function zt(e=96){let t=Math.ceil(e/2),n=``;if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint8Array(t);crypto.getRandomValues(e);for(let t=0;t<e.length;t++)n+=e[t].toString(16).padStart(2,`0`)}else for(let e=0;e<t;e++)n+=(Math.random()*256|0).toString(16).padStart(2,`0`);return n.substring(0,e)}async function Bt(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await Y(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??zt(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var Vt=t({REFERRAL_SUCCESS_EVENT:()=>Q,displayEmbeddedWallet:()=>St,displayModal:()=>Y,displaySharingPage:()=>Ct,ensureIdentity:()=>wt,getMerchantInformation:()=>Tt,getMergeToken:()=>Et,getUserReferralStatus:()=>Dt,modalBuilder:()=>Lt,openSso:()=>ve,prepareSso:()=>Ot,processReferral:()=>Mt,referralInteraction:()=>Z,sendInteraction:()=>X,sendTransaction:()=>Rt,setupReferral:()=>Nt,siweAuthenticate:()=>Bt,trackPurchaseStatus:()=>Pt,watchWalletStatus:()=>Ft});async function Ht(e,t,n){window.FrakSetup?.client&&await Ct(window.FrakSetup.client,{...n?.link&&{link:n.link},...n?.products?.length&&{products:n.products},...e&&{metadata:{targetInteraction:e}}},t)}const Ut=[`frak-button-share`,`frak-button-wallet`,`frak-open-in-app`,`frak-post-purchase`,`frak-banner`].join(`,`);function Wt(){return typeof document>`u`||document.querySelector(Ut)===null?[]:[`sharing`]}function Gt(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Kt(e){if(!e)return null;if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function qt(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.title==`string`?t.title.trim():``;if(n===``)return null;let r={title:n};return typeof t.imageUrl==`string`&&Gt(t.imageUrl)&&(r.imageUrl=t.imageUrl),typeof t.link==`string`&&Gt(t.link)&&(r.link=t.link),typeof t.utmContent==`string`&&t.utmContent!==``&&(r.utmContent=t.utmContent),r}function Jt(e){let t=Kt(e);if(!t)return;let n=[];for(let e of t){let t=qt(e);t&&n.push(t)}return n.length>0?n:void 0}function Yt(e){if(!e)return;let t;try{t=_t(e)}catch{return}if(t!==null)return Jt(t)}const Xt=`frak:client`;function Zt(){let e=new CustomEvent(Xt);window.dispatchEvent(e)}function Qt(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(Xt,t,!1)}function $t(){return window.FrakSetup.core={...xt,...Vt},window.FrakSetup?.client?Promise.resolve():b(()=>en(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(e=>{N(window.FrakSetup?.client,`sdk_init_failed`,{reason:e instanceof Error?e.message:typeof e==`string`?e:`unknown`,config_missing:!window.FrakSetup?.config})})}async function en(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);let e=await vt({config:tn(window.FrakSetup.config)});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,Zt(),Nt(e),nn()}function tn(e){return e.preload===void 0?{...e,preload:Wt()}:e}function nn(){let e=new URL(window.location.href);if(P(e.searchParams,`frakAction`)?.toLowerCase()!==`share`)return;let t=P(e.searchParams,`link`)??void 0,n=P(e.searchParams,`placement`)??void 0,r=Yt(P(e.searchParams,`products`));F(e.searchParams,`frakAction`),F(e.searchParams,`link`),F(e.searchParams,`placement`),F(e.searchParams,`products`),window.history.replaceState({},``,e.toString()),Ht(void 0,n,{link:t,products:r})}o.injectBase(`shared`,n),o.injectBase(`fouce`,`frak-button-share:not(:defined), frak-button-wallet:not(:defined), frak-open-in-app:not(:defined), frak-post-purchase:not(:defined), frak-banner:not(:defined) { display: none !important; }`),s($t);const rn={"button-share":()=>import(`./ButtonShare.CHoHLttN.js`),"button-wallet":()=>import(`./ButtonWallet.Dwb6BR-2.js`),"open-in-app":()=>import(`./OpenInAppButton.D1UzTuHx.js`),"post-purchase":()=>import(`./PostPurchase.DBzUVMWW.js`),banner:()=>import(`./Banner.coM5U8Uq.js`)},an=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&on(e)});async function on(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>sn(e)))}async function sn(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in rn))throw Error(`Component ${e} is not supported.`);await rn[t]()}catch{}}on(document.body),an.observe(document.documentElement,{subtree:!0,childList:!0});export{s as C,l as S,n as T,Be as _,Pt as a,N as b,Tt as c,$e as d,tt as f,Ve as g,K as h,Ht as i,St as l,W as m,Qt as n,Dt as o,U as p,Jt as r,Et as s,$t as t,Q as u,V as v,o as w,c as x,A as y};
154
+ }`;function r(e,t){let n=document.getElementById(e);if(n){n.textContent!==t&&(n.textContent=t);return}let r=document.createElement(`style`);r.id=e,r.textContent=t,document.head.appendChild(r)}function i(e,t){let n=`frak-base-${e}`;if(document.getElementById(n)||!t)return;let r=document.createElement(`style`);r.id=n,r.textContent=t,document.head.appendChild(r)}function a(e,t,n){r(`frak-placement-${e}-${t}`,n)}const o={injectBase:i,injectPlacement:a};function s(e){document.readyState===`complete`||document.readyState===`interactive`?setTimeout(e,1):document.addEventListener(`DOMContentLoaded`,e)}const c={parseError:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internalError:-32603,serverError:-32e3,clientNotConnected:-32001,configError:-32002,corruptedResponse:-32003,clientAborted:-32004,walletNotConnected:-32005,serverErrorForInteractionDelegation:-32006,userRejected:-32007};var l=class extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.data=n}toJSON(){return{code:this.code,message:this.message,data:this.data}}},u=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve=e=>{this._resolve?.(e)};reject=e=>{this._reject?.(e)}};function d(e){let{emittingTransport:t,listeningTransport:n,targetOrigin:r,middleware:i=[],lifecycleHandlers:a}=e,o=new Map;function s(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function c(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function d(e){try{`clientLifecycle`in e&&a?.clientLifecycle?await a.clientLifecycle(e,{origin:r,source:null}):`iframeLifecycle`in e&&a?.iframeLifecycle&&await a.iframeLifecycle(e,{origin:r,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function f(e){let t={origin:r,source:null};for(let n of i)n.onRequest&&await n.onRequest(e,t);return e}async function p(e,t){let n={origin:r,source:null},a=t;for(let t of i)t.onResponse&&(a=await t.onResponse(e,a,n));return a}async function m(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(r).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(s(e.data)){await d(e.data);return}if(!c(e.data))return;let t;try{let n=e.data.data,r=n instanceof Uint8Array||ArrayBuffer.isView(n)?{result:n}:n;t=await p(e.data,r)}catch(e){console.error(`[RPC Client] Middleware error on response:`,e);return}let n=o.get(e.data.id);n&&n(t)}async function h(e){let n=e;try{n=await f(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}t.postMessage(n,r)}function g(e){t.postMessage(e,r)}function _(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}n.addEventListener(`message`,m);function v(e){let t=_(),n=new u;return o.set(t,e=>{e.error?n.reject(new l(e.error.code,e.error.message,e.error.data)):n.resolve(e.result),o.delete(t)}),h({id:t,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{o.delete(t),n.reject(e)}),n.promise}function y(e,t){let n=_();return o.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),o.delete(n)):t(e.result)}),h({id:n,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{console.error(`[RPC Client] Failed to send listener request:`,e),o.delete(n)}),()=>{o.delete(n)}}function b(){n.removeEventListener(`message`,m),o.clear()}return{request:v,listen:y,sendLifecycle:g,cleanup:b}}function f(e){return new TextEncoder().encode(JSON.stringify(e))}function p(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const m=`frak-client-id`;function h(){return typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function g(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),h();let e=localStorage.getItem(m);return e||(e=h(),localStorage.setItem(m,e)),e}var _=class extends Map{maxSize;constructor(e){super(),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};let v;function y(){return v||={promiseCache:new _(1024),responseCache:new _(1024),failureCache:new _(1024)},v}async function b(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=y();if(n>0){let e=i.get(t);if(e&&Date.now()-e.created<n)return e.data}let o=a.get(t);if(o&&Date.now()-o<1e3)throw Error(`Cache: ${t} recently failed, backing off`);let s=r.get(t);s||(s=e(),r.set(t,s));try{let e=await s;return i.set(t,{data:e,created:Date.now()}),a.delete(t),e}catch(e){throw a.set(t,Date.now()),e}finally{r.delete(t)}}function x(){v&&(v.promiseCache.clear(),v.responseCache.clear(),v.failureCache.clear())}const ee=`https://backend.frak.id`;function te(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function ne(e){return te(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:ee}function S(e){if(e)return ne(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return ne(e)}return ee}const C=`__frakSdkConfig`,re=`frak-config-cache`,w=`frak-merchant-id`,T={key:re},E=typeof window<`u`;function D(){return{isResolved:!1,merchantId:``}}let O=null;function ie(){if(!E)return null;try{let e=localStorage.getItem(T.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(O=t,t):null}catch{return null}}function ae(){return(O??ie())?.config}function oe(){let e=O??ie();return e?Date.now()-e.timestamp<3e4:!1}function se(e){if(!(!E||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(T.key,JSON.stringify(t)),O=t}catch{}}function ce(){if(E){O=null;try{localStorage.removeItem(T.key)}catch{}}}function le(){E&&(window[C]||(window[C]=ae()??D()))}function k(){return E?(le(),window[C]??D()):D()}function ue(e){E&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function de(e){return e??(E?window.location.hostname:``)}async function fe(e,t,n){try{let r=S(t),i=n?`&lang=${encodeURIComponent(n)}`:``,a=await fetch(`${r}/user/merchant/resolve?domain=${encodeURIComponent(e)}${i}`);if(!a.ok){console.warn(`[Frak SDK] Merchant lookup failed for domain ${e}: ${a.status}`);return}let o=await a.json();if(E)try{sessionStorage.setItem(w,o.merchantId)}catch{}return o}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}const A={getConfig:k,get isResolved(){return k().isResolved},get isCacheFresh(){return oe()},setCacheScope(e,t){T.key=`${re}:${`${e}:${t??``}`}`,O=null},setConfig(e){if(E&&(window[C]=e),se(e),ue(e),E&&e.merchantId)try{sessionStorage.setItem(w,e.merchantId)}catch{}},reset(){let e=ae()??D();E&&(window[C]=e),ue(e)},clearCache(){if(ce(),x(),E)try{sessionStorage.removeItem(w)}catch{}},resolve(e,t,n){let r=de(e);return r?b(async()=>{let e=await fe(r,t,n);if(!e)throw Error(`Config resolution returned empty`);return e},{cacheKey:`sdkConfig:${r}:${n??``}`,cacheTime:1/0}).catch(()=>void 0):Promise.resolve(void 0)},getMerchantId(){let e=k();if(e.isResolved&&e.merchantId)return e.merchantId;if(E)try{return sessionStorage.getItem(w)??void 0}catch{}},async resolveMerchantId(e,t){return A.getMerchantId()||(await A.resolve(e,t))?.merchantId}};function j(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function M(e){let t=e.length%4;return Uint8Array.from(atob(e.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(e.length+(t===0?0:4-t),`=`)),e=>e.charCodeAt(0))}function pe(e){return j(f(e))}function me(e,t,n,r,i,a){let o=pe(he({redirectUrl:t.redirectUrl,directExit:t.directExit,lang:t.lang,merchantId:n,metadata:{name:r,css:a,logoUrl:t.metadata?.logoUrl,homepageLink:t.metadata?.homepageLink},clientId:i})),s=new URL(e);return s.pathname=`/sso`,s.searchParams.set(`p`,o),s.toString()}function he(e){return{r:e.redirectUrl,cId:e.clientId,d:e.directExit,l:e.lang,m:e.merchantId,md:{n:e.metadata?.name,css:e.metadata?.css,l:e.metadata?.logoUrl,h:e.metadata?.homepageLink}}}const ge=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,_e=`frak-sso`;async function ve(e,t){let{metadata:n,customizations:r,walletUrl:i}=e.config,a={...t,directExit:t.directExit??!t.redirectUrl};if(a.openInSameWindow??!!a.redirectUrl)return await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]});let o=a.ssoPopupUrl??me(i??`https://wallet.frak.id`,a,await A.resolveMerchantId()??``,n.name,g(),r?.css),s=window.open(o,_e,ge);if(!s)throw Error(`Popup was blocked. Please allow popups for this site.`);return s.focus(),await e.request({method:`frak_openSso`,params:[a,n.name,r?.css]})??{}}function N(e,t,n){if(!e){console.debug(`[Frak] No client provided, skipping event tracking`);return}try{e.openPanel?.track(t,n)}catch(e){console.debug(`[Frak] Failed to track event:`,t,e)}}function P(e,t){let n=e.get(t);if(n!==null)return n;let r=t.toLowerCase();for(let[t,n]of e)if(t.toLowerCase()===r)return n;return null}function F(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}const ye=/^0x[a-fA-F0-9]{40}$/;function I(e){return typeof e==`string`&&ye.test(e)}function L(e,t){return e.toLowerCase()===t.toLowerCase()}function be(e){let t=new Uint8Array(20);for(let n=0;n<20;n++){let r=Number.parseInt(e.substring(2+n*2,4+n*2),16);if(Number.isNaN(r))throw Error(`Invalid address: ${e}`);t[n]=r}return t}const xe=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Se(e){let t=`0x`;for(let n=0;n<20;n++)t+=xe[e[n]];return t}function Ce(e){return`r`in e&&!(`v`in e)}function R(e){return`v`in e&&e.v===2}const we=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Te(e){return typeof e==`string`&&we.test(e)}function Ee(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=Number.parseInt(t.substring(e*2,e*2+2),16);return n}function De(e){let t=``;for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,`0`);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function Oe(e){if(!Te(e.m)||!Number.isInteger(e.t)||e.t<0||e.t>4294967295)return null;let t=typeof e.c==`string`&&e.c.length>0,n=typeof e.w==`string`&&I(e.w);if(!t&&!n||t&&!Te(e.c))return null;let r=new Uint8Array(21+(t?16:0)+(n?20:0)),i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=0;return r[a++]=2|(t?16:0)|(n?32:0),r.set(Ee(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(Ee(e.c),a),a+=16),n&&(r.set(be(e.w),a),a+=20),r}function ke(e){if(e.length<21)return null;let t=e[0];if((t&15)!=2||t&192)return null;let n=(t&16)!=0,r=(t&32)!=0;if(!n&&!r)return null;let i=21+(n?16:0)+(r?20:0);if(e.length!==i)return null;let a=1,o=De(e.subarray(a,a+16));a+=16;let s=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(a,!1);a+=4;let c={v:2,m:o,t:s};if(n&&(c.c=De(e.subarray(a,a+16)),a+=16),r){let t=Se(e.subarray(a,a+20));if(!I(t))return null;c.w=t,a+=20}return c}const z=`fCtx`;function Ae(e){if(e)try{if(R(e)){let t=Oe(e);return t?j(t):void 0}return j(be(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function je(e){if(!(!e||e.length===0))try{let t=M(e);if(t.length!==20)return ke(t)||void 0;let n=Se(t);if(I(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function Me({url:e}){if(!e)return null;let t=P(new URL(e).searchParams,z);return t?je(t):null}function Ne(e){return{utm_source:e.utmSource??`frak`,utm_medium:e.utmMedium??void 0,utm_campaign:e.utmCampaign??void 0,utm_content:e.utmContent,utm_term:e.utmTerm,via:e.via??void 0,ref:e.ref??void 0}}function Pe(e,t){let n=Ne(t??{});for(let[t,r]of Object.entries(n))r===void 0||r===``||e.searchParams.has(t)||e.searchParams.set(t,r)}function Fe({url:e,context:t,attribution:n}){if(!e)return null;let r=Ae(t);if(!r)return null;let i=new URL(e);return F(i.searchParams,z),i.searchParams.set(z,r),Pe(i,n),i.toString()}function Ie(e){let t=new URL(e);return F(t.searchParams,z),t.toString()}function Le({url:e,context:t}){if(!window.location?.href||typeof window>`u`){console.error(`No window found, can't update context`);return}let n=e??window.location.href,r;r=t===null?Ie(n):Fe({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const B={compress:Ae,decompress:je,parse:Me,update:Fe,remove:Ie,replaceUrl:Le},V={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function H(e){return e&&e in V?e:`eur`}function Re(e){return e?V[e]??V.eur:V.eur}function ze(e,t){let n=Re(t),r=H(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Be(e){return e?`${e}Amount`:`eurAmount`}var Ve=class{constructor(e){this.baseUrl=e.baseUrl,this.headers={"Content-Type":`application/json`,...e.defaultHeaders},this.maxRetries=e.maxRetries??3,this.initialRetryDelay=e.initialRetryDelay??500}async resolveHeaders(){let e={};for(let[t,n]of Object.entries(this.headers)){let r=await n;r!==null&&(e[t]=r)}return e}addHeader(e,t){this.headers[e]=t}async post(e,t,n,r){try{let r=await fetch(e,{method:`POST`,headers:await this.resolveHeaders(),body:t?JSON.stringify(t??{}):void 0,keepalive:!0,...n});if(r.status===401)return null;if(r.status!==200&&r.status!==202)throw Error(`HTTP error! status: ${r.status}`);let i=await r.text();return i?JSON.parse(i):null}catch(i){if(r<this.maxRetries){let i=this.initialRetryDelay*2**r;return await new Promise(e=>setTimeout(e,i)),this.post(e,t,n,r+1)}return console.error(`Max retries reached:`,i),null}}async fetch(e,t,n={}){let r=`${this.baseUrl}${e}`;return this.post(r,t,n,0)}},He=class{constructor(e){this.groups=[],this.queue=[],this.options=e;let t={"openpanel-client-id":e.clientId};e.clientSecret&&(t[`openpanel-client-secret`]=e.clientSecret),t[`openpanel-sdk-name`]=e.sdk||`node`,t[`openpanel-sdk-version`]=e.sdkVersion||`1.3.1`,this.api=new Ve({baseUrl:e.apiUrl||`https://api.openpanel.dev`,defaultHeaders:t})}init(){}ready(){this.options.disabled=!1,this.options.waitForProfile=!1,this.flush()}shouldQueue(e){return!!(this.options.disabled||this.options.waitForProfile&&!this.profileId||e.type===`replay`&&!this.sessionId)}addQueue(e){e.type===`track`&&(e.payload.properties={...e.payload.properties??{},__timestamp:new Date().toISOString()}),this.queue.push(e)}async send(e){if(this.options.filter&&!this.options.filter(e))return Promise.resolve();if(this.shouldQueue(e))return this.addQueue(e),Promise.resolve();let t=await this.api.fetch(`/track`,e,{keepalive:e.type!==`replay`});this.deviceId=t?.deviceId;let n=!!this.sessionId;return this.sessionId=t?.sessionId,!n&&this.sessionId&&this.flush(),t}setGlobalProperties(e){this.global={...this.global,...e}}track(e,t){this.log(`track event`,e,t);let{groups:n,profileId:r,...i}=t??{},a=[...new Set([...this.groups,...n??[]])];return this.send({type:`track`,payload:{name:e,profileId:r??this.profileId,groups:a.length>0?a:void 0,properties:{...this.global??{},...i}}})}identify(e){if(this.log(`identify user`,e),e.profileId&&(this.profileId=e.profileId,this.flush()),e.profileId&&Object.keys(e).length>1)return this.send({type:`identify`,payload:{...e,properties:{...this.global,...e.properties}}})}upsertGroup(e){return this.log(`upsert group`,e),this.send({type:`group`,payload:e})}setGroup(e){return this.log(`set group`,e),this.groups.includes(e)||(this.groups=[...this.groups,e]),this.send({type:`assign_group`,payload:{groupIds:[e],profileId:this.profileId}})}setGroups(e){return this.log(`set groups`,e),this.groups=[...new Set([...this.groups,...e])],this.send({type:`assign_group`,payload:{groupIds:e,profileId:this.profileId}})}alias(e){}increment(e){return this.send({type:`increment`,payload:e})}decrement(e){return this.send({type:`decrement`,payload:e})}revenue(e,t){let n=t?.deviceId;return delete t?.deviceId,this.track(`revenue`,{...t??{},...n?{__deviceId:n}:{},__revenue:e})}getDeviceId(){return this.deviceId??``}getSessionId(){return this.sessionId??``}fetchDeviceId(){return Promise.resolve(this.deviceId??``)}clear(){this.profileId=void 0,this.groups=[],this.deviceId=void 0,this.sessionId=void 0}buildFlushPayload(e){if(e.type===`replay`)return e.payload;if(e.type===`track`){let t=`groups`in e.payload?e.payload.groups??[]:[],n=[...new Set([...this.groups,...t])];return{...e.payload,profileId:e.payload.profileId??this.profileId,groups:n.length>0?n:void 0}}return e.type===`identify`||e.type===`increment`||e.type===`decrement`||e.type===`assign_group`?{...e.payload,profileId:e.payload.profileId??this.profileId}:e.payload}flush(){let e=[];for(let t of this.queue){if(this.shouldQueue(t)){e.push(t);continue}let n=this.buildFlushPayload(t);this.send({...t,payload:n})}this.queue=e}log(...e){this.options.debug&&console.log(`[OpenPanel.dev]`,...e)}},Ue=typeof document<`u`?document.currentScript:null;function We(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Ge=class extends He{constructor(e){if(super({sdk:`web`,sdkVersion:`1.4.1`,...e}),this.options=e,this.lastPath=``,this.pendingRevenues=[],!this.isServer()){try{let e=sessionStorage.getItem(`openpanel-pending-revenues`);if(e){let t=JSON.parse(e);Array.isArray(t)&&(this.pendingRevenues=t)}}catch{this.pendingRevenues=[]}if(this.setGlobalProperties({__referrer:document.referrer}),this.options.trackScreenViews&&(this.trackScreenViews(),setTimeout(()=>this.screenView(),0)),this.options.trackOutgoingLinks&&this.trackOutgoingLinks(),this.options.trackAttributes&&this.trackAttributes(),this.options.sessionReplay?.enabled){let e=this.options.sessionReplay.sampleRate??1;Math.random()<e&&this.loadReplayModule().then(e=>{e&&e.startReplayRecorder(this.options.sessionReplay,e=>{this.send({type:`replay`,payload:{...e}})})})}}}async loadReplayModule(){try{if(typeof __OPENPANEL_REPLAY_URL__<`u`){let e=Ue,t=this.options.sessionReplay?.scriptUrl||e?.src?.replace(`.js`,`-replay.js`)||`https://openpanel.dev/op1-replay.js`;return window.__openpanel_replay?window.__openpanel_replay:new Promise(e=>{let n=document.createElement(`script`);n.src=t,n.onload=()=>{e(window.__openpanel_replay??null)},n.onerror=()=>{console.warn(`[OpenPanel] Failed to load replay script from`,t),e(null)},document.head.appendChild(n)})}return await import(`./replay-V6FXES7X.CNozpSRg.js`)}catch(e){return console.warn(`[OpenPanel] Failed to load replay module`,e),null}}debounce(e,t){clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(e,t)}isServer(){return typeof document>`u`}trackOutgoingLinks(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`a`);if(n&&t){let e=n.getAttribute(`href`);if(e?.startsWith(`http`))try{let r=new URL(e),i=window.location.hostname;r.hostname!==i&&super.track(`link_out`,{href:e,text:n.innerText||n.getAttribute(`title`)||t.getAttribute(`alt`)||t.getAttribute(`title`)})}catch{}}})}trackScreenViews(){if(this.isServer())return;let e=history.pushState;history.pushState=function(...t){let n=e.apply(this,t);return window.dispatchEvent(new Event(`pushstate`)),window.dispatchEvent(new Event(`locationchange`)),n};let t=history.replaceState;history.replaceState=function(...e){let n=t.apply(this,e);return window.dispatchEvent(new Event(`replacestate`)),window.dispatchEvent(new Event(`locationchange`)),n},window.addEventListener(`popstate`,()=>{window.dispatchEvent(new Event(`locationchange`))});let n=()=>this.debounce(()=>this.screenView(),50);this.options.trackHashChanges?window.addEventListener(`hashchange`,n):window.addEventListener(`locationchange`,n)}trackAttributes(){this.isServer()||document.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`button`),r=t.closest(`a`),i=n?.getAttribute(`data-track`)?n:r?.getAttribute(`data-track`)?r:null;if(i){let e={};for(let t of i.attributes)t.name.startsWith(`data-`)&&t.name!==`data-track`&&(e[We(t.name.replace(/^data-/,``))]=t.value);let t=i.getAttribute(`data-track`);t&&super.track(t,e)}})}track(e,t){return super.track(e,{...t,__path:this.lastPath})}screenView(e,t){if(this.isServer())return;let n,r;typeof e==`string`?(n=e,r=t):(n=window.location.href,r=e),this.lastPath!==n&&(this.lastPath=n,super.track(`screen_view`,{...r??{},__path:n,__title:document.title}))}async flushRevenue(){let e=this.pendingRevenues.map(e=>super.revenue(e.amount,e.properties));await Promise.all(e),this.clearRevenue()}clearRevenue(){if(this.pendingRevenues=[],!this.isServer())try{sessionStorage.removeItem(`openpanel-pending-revenues`)}catch{}}pendingRevenue(e,t){if(this.pendingRevenues.push({amount:e,properties:t}),!this.isServer())try{sessionStorage.setItem(`openpanel-pending-revenues`,JSON.stringify(this.pendingRevenues))}catch{}}};const U=`nexus-wallet-backup`,W=`frakwallet://`;function Ke(e,t){if(typeof window>`u`)return;let n=new URL(window.location.href),r=n.searchParams.get(`sso`);r&&(t.then(()=>{e.sendLifecycle({clientLifecycle:`sso-redirect-complete`,data:{compressed:r}}),console.log(`[SSO URL Listener] Forwarded compressed SSO data to iframe`)}).catch(e=>{console.error(`[SSO URL Listener] Failed to forward SSO data:`,e)}),n.searchParams.delete(`sso`),window.history.replaceState({},``,n.toString()),console.log(`[SSO URL Listener] SSO parameter detected and URL cleaned`))}function qe(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const Je=W.replace(`://`,``);function Ye(e){return`intent://${e.slice(13)}#Intent;scheme=${Je};end`}function G(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=qe()&&Xe(e)?Ye(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function Xe(e){return e.startsWith(W)}function Ze(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent;return!!(/iPhone|iPad|iPod/i.test(e)||/Macintosh/i.test(e)&&navigator.maxTouchPoints>1)}const K=Ze();function Qe(){return typeof navigator>`u`?!1:K?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function $e(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent.toLowerCase();return e.includes(`instagram`)||e.includes(`fban`)||e.includes(`fbav`)||e.includes(`facebook`)}const q=$e();function et(e){K&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:K&&e.startsWith(`http://`)?window.location.href=`x-safari-http://${e.slice(7)}`:window.location.href=`https://backend.frak.id/common/social?u=${encodeURIComponent(e)}`}const J={id:`frak-wallet`,name:`frak-wallet`,title:`Frak Wallet`,allow:`publickey-credentials-get *; clipboard-write; web-share *`,style:{width:`0`,height:`0`,border:`0`,position:`absolute`,zIndex:2000001,top:`-1000px`,left:`-1000px`,colorScheme:`auto`}};function tt({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=J.id,r.name=J.name,r.allow=J.allow,r.style.zIndex=J.style.zIndex.toString(),rt({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=g();return at(i),at(S(i)),r.src=nt({walletUrl:i,clientId:a,preload:t?.preload}),new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function nt({walletUrl:e,clientId:t,preload:n}){let r=`${e}/listener?clientId=${encodeURIComponent(t)}`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function rt({iframe:e,isVisible:t}){if(!t){e.style.width=`0`,e.style.height=`0`,e.style.border=`0`,e.style.position=`fixed`,e.style.top=`-1000px`,e.style.left=`-1000px`;return}e.style.position=`fixed`,e.style.top=`0`,e.style.left=`0`,e.style.width=`100%`,e.style.height=`100%`,e.style.pointerEvents=`auto`}function it(e=`/listener`){if(!window.opener)return null;let t=t=>{try{return t.location.origin===window.location.origin&&t.location.pathname===e}catch{return!1}};if(t(window.opener))return window.opener;try{let e=window.opener.frames;for(let n=0;n<e.length;n++)if(t(e[n]))return e[n];return null}catch(t){return console.error(`[findIframeInOpener] Error finding iframe with pathname ${e}:`,t),null}}function at(e){if(!(typeof document>`u`))try{let t=new URL(e).origin,n=`link[rel="preconnect"][data-frak-preconnect="${t}"]`;if(document.head.querySelector(n))return;let r=document.createElement(`link`);r.rel=`preconnect`,r.href=t,r.crossOrigin=``,r.dataset.frakPreconnect=t,document.head.appendChild(r)}catch{}}const ot=K&&q;function st(e){e?localStorage.setItem(U,e):localStorage.removeItem(U)}function Y(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=ut(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function ct(e){let t=new URL(window.location.href);e&&t.searchParams.set(`fmt`,e);let n=t.protocol===`http:`?`x-safari-http`:`x-safari-https`;window.location.href=`${n}://${t.host}${t.pathname}${t.search}${t.hash}`}function lt(e){return e.includes(`/common/social`)}function ut(e,t){if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`fmt`,t),n.toString()}catch{return`${e}${e.includes(`?`)?`&`:`?`}fmt=${encodeURIComponent(t)}`}}function dt(e,t,n,r,i){if(i){let e=Y(t,r);window.open(e,`_blank`);return}if(Xe(t)){let i=Y(t,r);G(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(ot&&lt(t))ct(r);else{let e=Y(t,r);window.location.href=e}}function ft({iframe:e,targetOrigin:t}){let n=new u;return{handleEvent:r=>{if(!(`iframeLifecycle`in r))return;let{iframeLifecycle:i,data:a}=r;switch(i){case`connected`:n.resolve(!0);break;case`do-backup`:st(a.backup);break;case`remove-backup`:localStorage.removeItem(U);break;case`show`:case`hide`:rt({iframe:e,isVisible:i===`show`});break;case`redirect`:dt(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:n.promise}}function pt({config:e,iframe:t}){let n=e?.walletUrl??`https://wallet.frak.id`,r=typeof navigator<`u`?navigator.language?.split(`-`)[0]:void 0,i=e.metadata.lang??(r===`en`||r===`fr`?r:void 0),a=e.domain??(typeof window<`u`?window.location.hostname:``);A.setCacheScope(a,i),A.reset();let o=A.isCacheFresh?void 0:A.resolve(e.domain,e.walletUrl,i),s=ft({iframe:t,targetOrigin:n}),f=new u,p=Date.now();if(!t.contentWindow)throw new l(c.configError,`The iframe does not have a content window`);let m=d({emittingTransport:t.contentWindow,listeningTransport:window,targetOrigin:n,middleware:[{async onRequest(e,t){if(!await s.isConnected)throw new l(c.clientNotConnected,`The iframe provider isn't connected yet`);return await f.promise,t}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{s.handleEvent(e)}}}),h=mt(m,s),_=async()=>{h(),m.cleanup(),t.remove(),x(),A.clearCache(),A.reset()},v;{console.log(`[Frak SDK] Initializing OpenPanel`),v=new Ge({apiUrl:`https://op-api.gcp.frak.id`,clientId:`6eacc8d7-49ac-4936-95e9-81ef29449570`,trackScreenViews:!0,trackOutgoingLinks:!0,trackAttributes:!1,filter:({type:e,payload:t})=>(e!==`track`||!t?.properties||`sdk_version`in t.properties||(t.properties={...t.properties,sdk_version:`1.2.0`,user_anonymous_client_id:g()}),!0)}),v.setGlobalProperties({sdk_version:`1.2.0`,user_anonymous_client_id:g()}),v.init(),v.track(`sdk_initialized`,{sdk_version:`1.2.0`});let e=!1,t=setTimeout(()=>{e||(e=!0,v?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);s.isConnected.then(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-p}))}).catch(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let y=ht({config:e,rpcClient:m,lifecycleManager:s,configPromise:o,contextSent:f,openPanel:v}).then(()=>{}).catch(e=>{throw f.reject(e),e});return{config:e,waitForConnection:s.isConnected,waitForSetup:y,request:m.request,listenerRequest:m.listen,destroy:_,openPanel:v}}function mt(e,t){let n,r,i=()=>e.sendLifecycle({clientLifecycle:`heartbeat`});async function a(){i(),n=setInterval(i,250),r=setTimeout(()=>{o(),console.log(`Heartbeat timeout: connection failed`)},3e4),await t.isConnected,o()}function o(){n&&clearInterval(n),r&&clearTimeout(r)}return a(),o}async function ht({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,Ke(t,n.isConnected);let o=new URL(window.location.href),s=o.searchParams.get(`fmt`)??void 0;s&&(o.searchParams.delete(`fmt`),window.history.replaceState({},``,o.toString()));let c=t=>{let n=t?.merchantId??e.metadata.merchantId??``,r=t?.domain??``,i=t?.allowedDomains??[],a=t?.sdkConfig,o=a?.attribution||e.attribution?{...e.attribution,...a?.attribution}:void 0;A.setConfig(a?{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,hasRawSdkConfig:!0,name:a.name??e.metadata.name,logoUrl:a.logoUrl??e.metadata.logoUrl,homepageLink:a.homepageLink??e.metadata.homepageLink,lang:a.lang??e.metadata.lang,currency:a.currency??e.metadata.currency,hidden:a.hidden,css:a.css,translations:a.translations,placements:a.placements,components:a.components,attribution:o}:{isResolved:!0,merchantId:n,domain:r,allowedDomains:i,name:e.metadata.name,logoUrl:e.metadata.logoUrl,homepageLink:e.metadata.homepageLink,lang:e.metadata.lang,currency:e.metadata.currency,attribution:o})},l=!1,u=e=>{let n=l?void 0:s;l=!0;let r=e.hasRawSdkConfig?{name:e.name,logoUrl:e.logoUrl,homepageLink:e.homepageLink,lang:e.lang,currency:e.currency,hidden:e.hidden,css:e.css,translations:e.translations,placements:e.placements,attribution:e.attribution}:e.attribution?{attribution:e.attribution}:void 0,i=g();if(a){let t=a.global??{};a.setGlobalProperties({...t,merchant_id:e.merchantId,domain:e.domain??``})}t.sendLifecycle({clientLifecycle:`resolved-config`,data:{merchantId:e.merchantId,domain:e.domain??``,allowedDomains:e.allowedDomains??[],sourceUrl:window.location.href,...i&&{sdkAnonymousId:i},...n&&{pendingMergeToken:n},...r&&{sdkConfig:r}}})};A.isResolved&&(u(A.getConfig()),i.resolve()),r&&(c(await r),u(A.getConfig()),i.resolve());async function d(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function f(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function p(){if(typeof window>`u`)return;let e=window.localStorage.getItem(U);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([d(),f(),p()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}function gt(e){return p(M(e))}async function _t({config:e}){let t=vt(e),n=await tt({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=pt({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function vt(e){let t=H(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function yt({perCall:e,defaults:t,productUtmContent:n}){if(e===null)return;let r=e!==void 0,i=t!==void 0&&Object.keys(t).length>0;if(!r&&!i&&!(n!==void 0&&n!==``))return;let a={...t,...e??{}},o=n??e?.utmContent;return o!==void 0&&o!==``?a.utmContent=o:delete a.utmContent,a}var bt=t({DEEP_LINK_SCHEME:()=>W,FrakContextManager:()=>B,areAddressesEqual:()=>L,base64urlDecode:()=>M,base64urlEncode:()=>j,baseIframeProps:()=>J,clearAllCache:()=>x,compressJsonToB64:()=>pe,createIFrameFrakClient:()=>pt,decompressJsonFromB64:()=>gt,deleteQueryParamCaseInsensitive:()=>F,findIframeInOpener:()=>it,formatAmount:()=>ze,generateSsoUrl:()=>me,getBackendUrl:()=>S,getClientId:()=>g,getCurrencyAmountKey:()=>Be,getQueryParamCaseInsensitive:()=>P,getSupportedCurrency:()=>H,isIOS:()=>K,isInAppBrowser:()=>q,isMobile:()=>Qe,mergeAttribution:()=>yt,redirectToExternalBrowser:()=>et,sdkConfigStore:()=>A,setupClient:()=>_t,ssoPopupFeatures:()=>ge,ssoPopupName:()=>_e,trackEvent:()=>N,triggerDeepLinkWithFallback:()=>G,withCache:()=>b});async function xt(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function X(e,{steps:t,metadata:n},r){return await e.request({method:`frak_displayModal`,params:r?[t,n,e.config.metadata,r]:[t,n,e.config.metadata]})}async function St(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function Ct(e){if(typeof window>`u`)return;let t=g();if(!t)return;let n=await A.resolveMerchantId();if(!n)return;let r=`frak-identity-ensured-${n}`;if(!window.sessionStorage.getItem(r))try{let i=S();(await fetch(`${i}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":e,"x-frak-client-id":t},body:JSON.stringify({merchantId:n})})).ok&&window.sessionStorage.setItem(r,`1`)}catch{}}async function wt(e,t){return b(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:t?.cacheTime})}async function Tt(e,t){return b(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:t?.cacheTime})}async function Et(e,t){return b(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:t?.cacheTime})}async function Dt(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function Z(e,t){try{await e.request({method:`frak_sendInteraction`,params:[t,{clientId:g()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,t.type)}}function Ot(e,t,n){return R(t)?(N(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),Z(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):Ce(t)?(N(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),Z(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function kt(e,t){let n=g();return!n&&!t?null:{v:2,m:e,t:Math.floor(Date.now()/1e3),...n?{c:n}:{},...t?{w:t}:{}}}function At(e,t){return R(e)?e.w&&t?.wallet?L(e.w,t.wallet):e.c?g()===e.c:!1:Ce(e)&&t?.wallet?L(e.r,t.wallet):!1}function jt(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(At(n,t))return`self-referral`;if(!Ot(e,n,t))return`no-referrer`;let i=R(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?kt(i,t?.wallet):null;return B.replaceUrl({url:window.location?.href,context:a}),N(e,`user_referred_completed`,{status:`success`}),`success`}async function Mt(e,{options:t}={}){let n=B.parse({url:window.location.href}),r=await Ft(e);try{return jt(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}const Q=`frak:referral-success`;async function Nt(e){try{await Mt(e)===`success`&&window.dispatchEvent(new Event(Q))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function Pt(e){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let t=window.sessionStorage.getItem(`frak-wallet-interaction-token`),n=g();if(!t&&!n){console.warn(`[Frak] No identity found, skipping purchase check`);return}let r=e.merchantId??await A.resolveMerchantId();if(!r){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let i={Accept:`application/json`,"Content-Type":`application/json`};t&&(i[`x-wallet-sdk-auth`]=t),n&&(i[`x-frak-client-id`]=n);let a=S();await fetch(`${a}/user/track/purchase`,{method:`POST`,headers:i,body:JSON.stringify({customerId:e.customerId,orderId:e.orderId,token:e.token,merchantId:r})})}function Ft(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(It(e,t),t));let n=new u,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{It(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function It(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),Ct(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function Lt(e,{metadata:t,login:n}){return $(e,{steps:{login:n??{}},metadata:t})}function $(e,t){function n(n){return $(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return $(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return $(e,{...t,steps:{...t.steps,final:{...r,action:{key:`sharing`,options:n}}}})}async function a(n,r){return n&&(t.metadata=n(t.metadata??{})),await X(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function Rt(e,{tx:t,metadata:n}){return(await X(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function zt(e=96){let t=Math.ceil(e/2),n=``;if(typeof crypto<`u`&&crypto.getRandomValues){let e=new Uint8Array(t);crypto.getRandomValues(e);for(let t=0;t<e.length;t++)n+=e[t].toString(16).padStart(2,`0`)}else for(let e=0;e<t;e++)n+=(Math.random()*256|0).toString(16).padStart(2,`0`);return n.substring(0,e)}async function Bt(e,{siwe:t,metadata:n}){let r=e.config?.domain??window.location.host,i=t?.statement??`I confirm that I want to use my Frak wallet on: ${e.config.metadata.name}`;return(await X(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??zt(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}var Vt=t({REFERRAL_SUCCESS_EVENT:()=>Q,displayEmbeddedWallet:()=>xt,displayModal:()=>X,displaySharingPage:()=>St,ensureIdentity:()=>Ct,getMerchantInformation:()=>wt,getMergeToken:()=>Tt,getUserReferralStatus:()=>Et,modalBuilder:()=>Lt,openSso:()=>ve,prepareSso:()=>Dt,processReferral:()=>jt,referralInteraction:()=>Mt,sendInteraction:()=>Z,sendTransaction:()=>Rt,setupReferral:()=>Nt,siweAuthenticate:()=>Bt,trackPurchaseStatus:()=>Pt,watchWalletStatus:()=>Ft});async function Ht(e,t,n){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}await St(window.FrakSetup.client,{...n?.link&&{link:n.link},...n?.products?.length&&{products:n.products},...e&&{metadata:{targetInteraction:e}}},t)}const Ut=[`frak-button-share`,`frak-button-wallet`,`frak-open-in-app`,`frak-post-purchase`,`frak-banner`].join(`,`);function Wt(){return typeof document>`u`||document.querySelector(Ut)===null?[]:[`sharing`]}function Gt(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Kt(e){if(!e)return null;if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function qt(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.title==`string`?t.title.trim():``;if(n===``)return null;let r={title:n};return typeof t.imageUrl==`string`&&Gt(t.imageUrl)&&(r.imageUrl=t.imageUrl),typeof t.link==`string`&&Gt(t.link)&&(r.link=t.link),typeof t.utmContent==`string`&&t.utmContent!==``&&(r.utmContent=t.utmContent),r}function Jt(e){let t=Kt(e);if(!t)return;let n=[];for(let e of t){let t=qt(e);t&&n.push(t)}return n.length>0?n:void 0}function Yt(e){if(!e)return;let t;try{t=gt(e)}catch{return}if(t!==null)return Jt(t)}const Xt=`frak:client`;function Zt(){let e=new CustomEvent(Xt);window.dispatchEvent(e)}function Qt(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(Xt,t,!1)}function $t(){return window.FrakSetup.core={...bt,...Vt},window.FrakSetup?.client?Promise.resolve():b(()=>en(),{cacheKey:`frak-sdk-init`,cacheTime:1/0}).catch(e=>{N(window.FrakSetup?.client,`sdk_init_failed`,{reason:e instanceof Error?e.message:typeof e==`string`?e:`unknown`,config_missing:!window.FrakSetup?.config})})}async function en(){if(!window.FrakSetup?.config)throw Error(`[Frak SDK] Configuration not found. Please ensure window.FrakSetup.config is set.`);console.log(`[Frak SDK] Starting initialization`);let e=await _t({config:tn(window.FrakSetup.config)});if(!e)throw Error(`[Frak SDK] Failed to create client`);window.FrakSetup.client=e,console.log(`[Frak SDK] Client initialized successfully`),Zt(),Nt(e),nn()}function tn(e){return e.preload===void 0?{...e,preload:Wt()}:e}function nn(){let e=new URL(window.location.href);if(P(e.searchParams,`frakAction`)?.toLowerCase()!==`share`)return;console.log(`[Frak SDK] Auto open share via query param`);let t=P(e.searchParams,`link`)??void 0,n=P(e.searchParams,`placement`)??void 0,r=Yt(P(e.searchParams,`products`));F(e.searchParams,`frakAction`),F(e.searchParams,`link`),F(e.searchParams,`placement`),F(e.searchParams,`products`),window.history.replaceState({},``,e.toString()),Ht(void 0,n,{link:t,products:r})}o.injectBase(`shared`,n),o.injectBase(`fouce`,`frak-button-share:not(:defined), frak-button-wallet:not(:defined), frak-open-in-app:not(:defined), frak-post-purchase:not(:defined), frak-banner:not(:defined) { display: none !important; }`),s($t);const rn={"button-share":()=>import(`./ButtonShare.DJqup6VY.js`),"button-wallet":()=>import(`./ButtonWallet.BKuPBrKl.js`),"open-in-app":()=>import(`./OpenInAppButton.D1UzTuHx.js`),"post-purchase":()=>import(`./PostPurchase.CkqSCboo.js`),banner:()=>import(`./Banner.4o3y8MI1.js`)},an=new MutationObserver(e=>{for(let{addedNodes:t}of e)for(let e of Array.from(t))e.nodeType===Node.ELEMENT_NODE&&on(e)});async function on(e){let t=e instanceof Element?e.tagName.toLowerCase():``,n=t?.startsWith(`frak-`),r=Array.from(e.querySelectorAll(`:not(:defined)`)).map(e=>e.tagName.toLowerCase()).filter(e=>e.startsWith(`frak-`));n&&!customElements.get(t)&&r.push(t);let i=[...new Set(r)];await Promise.allSettled(i.map(e=>sn(e)))}async function sn(e){if(customElements.get(e))return Promise.resolve();try{let t=e.replace(/^frak-/i,``);if(!(t in rn))throw Error(`Component ${e} is not supported.`);await rn[t]()}catch(e){console.error(e)}}on(document.body),an.observe(document.documentElement,{subtree:!0,childList:!0});export{s as C,l as S,n as T,ze as _,Pt as a,N as b,wt as c,Qe as d,et as f,Be as g,q as h,Ht as i,xt as l,G as m,Qt as n,Et as o,W as p,Jt as r,Tt as s,$t as t,Q as u,H as v,o as w,c as x,A as y};
@@ -0,0 +1 @@
1
+ function e(){return()=>{}}var t=null;function n(n,r){if(typeof document>`u`||typeof window>`u`)return;t&&t();let i=n.maxEventsPerChunk??200,a=n.flushIntervalMs??1e4,o=n.maxPayloadBytes??1048576,s=[],c=0,l=null;function u(e){if(s.length===0)return;let t=JSON.stringify(s);if(new TextEncoder().encode(t).length>o){if(s.length>1){let t=Math.floor(s.length/2),n=s.slice(0,t),r=s.slice(t),i=e&&n.some(e=>e.type===2);s=n,u(i),s=r,u(!1);return}s=[];return}let n=s[0].timestamp,i=s[s.length-1].timestamp;try{r({chunk_index:c,events_count:s.length,is_full_snapshot:e,started_at:new Date(n).toISOString(),ended_at:new Date(i).toISOString(),payload:t}),c+=1,s=[]}catch(e){throw console.error(`[ReplayRecorder] sendChunk failed`,e),e}}function d(e){let t=e||s.some(e=>e.type===2);s.length>=i?u(t):e&&s.length>0&&u(!0)}let f=n.maskAllText!==!1,p=n.unmaskTextSelector,m=e({emit(e,t){s.push(e),d(!!t)},checkoutEveryNms:a,maskAllInputs:n.maskAllInputs??!0,maskTextSelector:f?`*`:`[data-openpanel-replay-mask]`,maskTextFn:f&&p?(e,t)=>t?.closest(p)?e:e.replace(/\S/g,`*`):void 0,blockSelector:n.blockSelector??`[data-openpanel-replay-block]`,blockClass:n.blockClass,ignoreSelector:n.ignoreSelector});l=setInterval(()=>{s.length>0&&u(s.some(e=>e.type===2))},a);function h(){document.visibilityState===`hidden`&&s.length>0&&u(s.some(e=>e.type===2))}function g(){s.length>0&&u(s.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,h),window.addEventListener(`pagehide`,g),t=()=>{s.length>0&&u(s.some(e=>e.type===2)),l&&=(clearInterval(l),null),document.removeEventListener(`visibilitychange`,h),window.removeEventListener(`pagehide`,g),m?.(),t=null}}function r(){t&&t()}export{n as startReplayRecorder,r as stopReplayRecorder};
@@ -1 +1 @@
1
- import{_ as e,g as t,v as n}from"./loader.js";function r(e){return Array.isArray(e)?e:e.conditions}function i(e){if(typeof e==`number`)return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function a(e,t,n){let o=[];for(let s of r(e)){if(`logic`in s){o.push(...a(s,t,n));continue}if(s.field===t&&n.has(s.operator)){let e=i(s.value);e!=null&&o.push(e)}}return o}const o=new Set([`gt`,`gte`,`between`]),s=new Set([`gt`,`gte`]);function c(e){let t=a(e,`purchase.amount`,o);return t.length>0?Math.min(...t):void 0}function l(e){let t=a(e,`time.timestamp`,s);if(t.length!==0)return new Date(Math.min(...t)*1e3)}function u(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`percentage`:return e.maxAmount?.[t]??0;case`tiered`:return e.tiers.reduce((e,n)=>`amount`in n?Math.max(e,n.amount[t]):e,0)}}function d(e){return e.payoutType===`percentage`?e.percent:e.payoutType===`tiered`?e.tiers.reduce((e,t)=>`percent`in t?Math.max(e,t.percent):e,0):0}function f(e,t){let n=u(e,t);return n>0?n:d(e)*1e-6}function p(r,i){let a=n(i),o=t(a);switch(r.payoutType){case`fixed`:return e(Math.round(r.amount[o]),a);case`percentage`:return`${r.percent} %`;case`tiered`:{let t=u(r,o);if(t>0)return e(Math.round(t),a);let n=d(r);return n>0?`${n} %`:e(0,a)}}}function m(e,r){if(e&&!(f(e,t(n(r)))<=0))return p(e,r)}function h(e,t){return t?e.replaceAll(`{REWARD}`,t):e.replaceAll(`{REWARD}`,``)}function g(e,t){return e.expiresAt!=null&&new Date(e.expiresAt).getTime()<=t}function _(e,t){let n=l(e.conditions);return n==null||n.getTime()<=t}function v(e,t){return t===`referee`?e.referee:e.referrer}function y(e,t,n){let r=v(e,n);return r?f(r,t):0}function b(e,r={}){let i=(r.now??new Date).getTime(),a=r.audience??`referrer`,o=t(n(r.currency)),s=(r.targetInteraction?e.filter(e=>e.interactionTypeKey===r.targetInteraction):e).filter(e=>!g(e,i)),c=s.filter(e=>_(e,i));if(c.length>0)return{campaign:c.reduce((e,t)=>y(t,o,a)>y(e,o,a)?t:e),status:`live`};let u=s.map(e=>({campaign:e,startsAt:l(e.conditions)})).filter(e=>e.startsAt!=null);if(u.length===0)return;let d=u.reduce((e,t)=>t.startsAt.getTime()<e.startsAt.getTime()?t:e);return{campaign:d.campaign,status:`upcoming`,startsAt:d.startsAt}}function x(t,n={}){let r=b(t,n);if(!r)return;let i=v(r.campaign,n.audience??`referrer`);if(!i)return;let a=m(i,n.currency);if(!a)return;let o=c(r.campaign.conditions),s=o==null?void 0:e(o,n.currency),l=r.campaign.defaultLockupSeconds,u=l&&l>0?Math.round(l/86400):void 0;return{formatted:a,payoutType:i.payoutType,minPurchaseAmount:s,lockupDurationDays:u}}export{m as i,b as n,h as r,x as t};
1
+ import{_ as e,g as t,v as n}from"./loader.js";function r(e){return Array.isArray(e)?e:e.conditions}function i(e){if(typeof e==`number`)return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function a(e,t,n){let o=[];for(let s of r(e)){if(`logic`in s){o.push(...a(s,t,n));continue}if(s.field===t&&n.has(s.operator)){let e=i(s.value);e!=null&&o.push(e)}}return o}const o=new Set([`gt`,`gte`,`between`]),s=new Set([`gt`,`gte`]);function c(e){let t=a(e,`purchase.amount`,o);return t.length>0?Math.min(...t):void 0}function l(e){let t=a(e,`time.timestamp`,s);if(t.length!==0)return new Date(Math.min(...t)*1e3)}function u(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`percentage`:return e.maxAmount?.[t]??0;case`tiered`:return e.tiers.reduce((e,n)=>`amount`in n?Math.max(e,n.amount[t]):e,0)}}function d(e){return e.payoutType===`percentage`?e.percent:e.payoutType===`tiered`?e.tiers.reduce((e,t)=>`percent`in t?Math.max(e,t.percent):e,0):0}function f(e,t){let n=u(e,t);return n>0?n:d(e)*1e-6}function p(r,i){let a=n(i),o=t(a);switch(r.payoutType){case`fixed`:return e(Math.round(r.amount[o]),a);case`percentage`:return`${r.percent} %`;case`tiered`:{let t=u(r,o);if(t>0)return e(Math.round(t),a);let n=d(r);return n>0?`${n} %`:e(0,a)}}}function m(e,r){if(e&&!(f(e,t(n(r)))<=0))return p(e,r)}function h(e,t){return t?e.replaceAll(`{REWARD}`,t):e.replaceAll(`{REWARD}`,``)}function g(e,t){return e.expiresAt!=null&&new Date(e.expiresAt).getTime()<=t}function _(e,t){let n=l(e.conditions);return n==null||n.getTime()<=t}function v(e,t){return t===`referee`?e.referee:e.referrer}function y(e,t,n){let r=v(e,n);return r?f(r,t):0}function b(e,r={}){let i=(r.now??new Date).getTime(),a=r.audience??`referrer`,o=t(n(r.currency)),s=(r.targetInteraction?e.filter(e=>e.interactionTypeKey===r.targetInteraction):e).filter(e=>!g(e,i)),c=s.filter(e=>_(e,i));if(c.length>0)return{campaign:c.reduce((e,t)=>y(t,o,a)>y(e,o,a)?t:e),status:`live`};let u=s.map(e=>({campaign:e,startsAt:l(e.conditions)})).filter(e=>e.startsAt!=null);if(u.length===0)return;let d=u.reduce((e,t)=>t.startsAt.getTime()<e.startsAt.getTime()?t:e);return{campaign:d.campaign,status:`upcoming`,startsAt:d.startsAt}}function x(t,n={}){let r=b(t,n);if(!r)return;let i=v(r.campaign,n.audience??`referrer`);if(!i)return;let a=m(i,n.currency);if(!a)return;let o=c(r.campaign.conditions),s=o==null?void 0:e(o,n.currency),l=r.campaign.defaultLockupSeconds,u=l&&l>0?Math.round(l/86400):void 0;return{formatted:a,payoutType:i.payoutType,minPurchaseAmount:s,lockupDurationDays:u,referrerReward:r.campaign.referrer,refereeReward:r.campaign.referee,minPurchaseValue:o??void 0}}export{m as i,b as n,h as r,x as t};
@@ -1 +1 @@
1
- import{c as e}from"./loader.js";import{d as t,p as n}from"./defaults.kWEdCyGS.js";import{t as r}from"./rewards.B6IAemE2.js";function i(i,a,o){let[s,c]=t(void 0);return n(()=>{if(!i)return;let t=window.FrakSetup?.client;t&&e(t).then(e=>{let n=r(e.rewards,{currency:t.config.metadata?.currency,targetInteraction:a,audience:o});n&&n.payoutType!==`percentage`&&c(n.formatted)}).catch(()=>{})},[i,a,o]),{reward:s}}export{i as t};
1
+ import{c as e}from"./loader.js";import{d as t,p as n}from"./defaults.kWEdCyGS.js";import{t as r}from"./rewards.CIu9qbmI.js";function i(i,a,o){let[s,c]=t(void 0);return n(()=>{if(!i)return;let t=window.FrakSetup?.client;t&&e(t).then(e=>{let n=r(e.rewards,{currency:t.config.metadata?.currency,targetInteraction:a,audience:o});n&&n.payoutType!==`percentage`&&c(n.formatted)}).catch(()=>{})},[i,a,o]),{reward:s}}export{i as t};
@@ -193,7 +193,7 @@ function CloseCircleIcon(props) {
193
193
  "aria-hidden": "true",
194
194
  ...props,
195
195
  children: /* @__PURE__ */ jsx("path", {
196
- d: "M7.33301 0C11.383 0 14.6668 3.28307 14.667 7.33301C14.667 11.3831 11.3831 14.667 7.33301 14.667C3.28307 14.6668 0 11.383 0 7.33301C0.000175746 3.28318 3.28318 0.000175742 7.33301 0ZM10.3896 4.27734C10.151 4.0388 9.76303 4.03775 9.52441 4.27637L7.33301 6.46777L5.14258 4.27637C4.90397 4.03776 4.51601 4.03882 4.27734 4.27734C4.03869 4.516 4.03771 4.90392 4.27637 5.14258L6.4668 7.33398L4.27637 9.52441C4.03807 9.76306 4.03891 10.1511 4.27734 10.3896C4.51589 10.6282 4.9039 10.629 5.14258 10.3906L7.33301 8.2002L9.52344 10.3906C9.76198 10.629 10.15 10.6279 10.3887 10.3896C10.6273 10.151 10.6283 9.76209 10.3896 9.52344L8.2002 7.33398L10.3906 5.14258C10.6293 4.90392 10.6283 4.516 10.3896 4.27734Z",
196
+ d: "M7.33 0C11.38 0 14.67 3.28 14.67 7.33C14.67 11.38 11.38 14.67 7.33 14.67C3.28 14.67 0 11.38 0 7.33C0 3.28 3.28 0 7.33 0ZM10.39 4.28C10.15 4.04 9.76 4.04 9.52 4.28L7.33 6.47L5.14 4.28C4.9 4.04 4.52 4.04 4.28 4.28C4.04 4.52 4.04 4.9 4.28 5.14L6.47 7.33L4.28 9.52C4.04 9.76 4.04 10.15 4.28 10.39C4.52 10.63 4.9 10.63 5.14 10.39L7.33 8.2L9.52 10.39C9.76 10.63 10.15 10.63 10.39 10.39C10.63 10.15 10.63 9.76 10.39 9.52L8.2 7.33L10.39 5.14C10.63 4.9 10.63 4.52 10.39 4.28Z",
197
197
  fill: "currentColor"
198
198
  })
199
199
  });
@@ -209,7 +209,7 @@ function ExternalLinkIcon(props) {
209
209
  "aria-hidden": "true",
210
210
  ...props,
211
211
  children: /* @__PURE__ */ jsx("path", {
212
- d: "M5.45508 0C5.75614 0.000209333 6 0.244788 6 0.545898C5.99979 0.846831 5.75601 1.09159 5.45508 1.0918H4.36426C3.05445 1.0918 2.27964 1.35707 1.81836 1.81836C1.35714 2.27966 1.0918 3.05454 1.0918 4.36426V7.63672C1.09186 8.94625 1.35713 9.72139 1.81836 10.1826C2.2797 10.6436 3.05488 10.9092 4.36426 10.9092H7.63672C8.94628 10.9091 9.72135 10.6438 10.1826 10.1826C10.6438 9.72139 10.9091 8.94625 10.9092 7.63672V6.5459C10.9092 6.24466 11.1538 6 11.4551 6C11.7561 6.00028 12 6.24483 12 6.5459V7.63672C11.9999 9.05391 11.72 10.1882 10.9541 10.9541C10.1882 11.7199 9.05394 12 7.63672 12H4.36426C2.94714 12 1.81283 11.7197 1.04688 10.9541C0.280997 10.1882 6.04321e-05 9.05391 0 7.63672V4.36426C0 2.94692 0.28099 1.81283 1.04688 1.04688C1.81284 0.280915 2.94686 0 4.36426 0H5.45508ZM11.4541 0C11.7553 2.20143e-05 11.999 0.244672 11.999 0.545898V3.16406C11.9988 3.46509 11.7552 3.70896 11.4541 3.70898C11.1532 3.70873 10.9084 3.46495 10.9082 3.16406V1.8623L6.93066 5.83984C6.71766 6.05283 6.37218 6.05283 6.15918 5.83984C5.94657 5.62681 5.94632 5.28124 6.15918 5.06836L10.1357 1.0918H8.83594C8.53504 1.09154 8.29025 0.846803 8.29004 0.545898C8.29004 0.244816 8.53491 0.000254588 8.83594 0H11.4541Z",
212
+ d: "M5.46 0C5.76 0 6 0.24 6 0.55C6 0.85 5.76 1.09 5.46 1.09H4.36C3.05 1.09 2.28 1.36 1.82 1.82C1.36 2.28 1.09 3.05 1.09 4.36V7.64C1.09 8.95 1.36 9.72 1.82 10.18C2.28 10.64 3.05 10.91 4.36 10.91H7.64C8.95 10.91 9.72 10.64 10.18 10.18C10.64 9.72 10.91 8.95 10.91 7.64V6.55C10.91 6.24 11.15 6 11.46 6C11.76 6 12 6.24 12 6.55V7.64C12 9.05 11.72 10.19 10.95 10.95C10.19 11.72 9.05 12 7.64 12H4.36C2.95 12 1.81 11.72 1.05 10.95C0.28 10.19 6.04e-05 9.05 0 7.64V4.36C0 2.95 0.28 1.81 1.05 1.05C1.81 0.28 2.95 0 4.36 0H5.46ZM11.45 0C11.76 2.2e-05 12 0.24 12 0.55V3.16C12 3.47 11.76 3.71 11.45 3.71C11.15 3.71 10.91 3.46 10.91 3.16V1.86L6.93 5.84C6.72 6.05 6.37 6.05 6.16 5.84C5.95 5.63 5.95 5.28 6.16 5.07L10.14 1.09H8.84C8.54 1.09 8.29 0.85 8.29 0.55C8.29 0.24 8.53 0 8.84 0H11.45Z",
213
213
  fill: "currentColor"
214
214
  })
215
215
  });
@@ -244,11 +244,11 @@ function LogoFrakWithName(props) {
244
244
  }),
245
245
  /* @__PURE__ */ jsx("path", {
246
246
  fill: "white",
247
- d: "M9.76941 15.9093L5.1481 14.3453C5.06012 14.3155 4.96875 14.3811 4.96875 14.474V17.3274C4.96875 17.3857 5.00584 17.4373 5.06103 17.4561L9.68234 19.02C9.77032 19.0499 9.86169 18.9843 9.86169 18.8913V16.038C9.86169 15.9796 9.8246 15.9281 9.76941 15.9093ZM14.5764 10.4374L9.95396 12.0013C9.89878 12.0201 9.86169 12.0717 9.86169 12.13V14.9833C9.86169 15.0763 9.95306 15.1419 10.041 15.112L14.6635 13.5481C14.7187 13.5293 14.7558 13.4777 14.7558 13.4194V10.566C14.7558 10.4731 14.6646 10.4075 14.5764 10.4374ZM18.9173 5.01993L11.1787 7.51231C11.1226 7.53041 11.0846 7.58265 11.0846 7.64168V10.5651C11.0846 10.6233 11.1423 10.6644 11.1983 10.6463L18.9369 8.15396C18.993 8.13586 19.0312 8.08362 19.0312 8.02459V5.10113C19.031 5.043 18.9734 5.00184 18.9173 5.01993Z"
247
+ d: "M9.77 15.91L5.15 14.35C5.06 14.32 4.97 14.38 4.97 14.47V17.33C4.97 17.39 5.01 17.44 5.06 17.46L9.68 19.02C9.77 19.05 9.86 18.98 9.86 18.89V16.04C9.86 15.98 9.82 15.93 9.77 15.91ZM14.58 10.44L9.95 12C9.9 12.02 9.86 12.07 9.86 12.13V14.98C9.86 15.08 9.95 15.14 10.04 15.11L14.66 13.55C14.72 13.53 14.76 13.48 14.76 13.42V10.57C14.76 10.47 14.66 10.41 14.58 10.44ZM18.92 5.02L11.18 7.51C11.12 7.53 11.08 7.58 11.08 7.64V10.57C11.08 10.62 11.14 10.66 11.2 10.65L18.94 8.15C18.99 8.14 19.03 8.08 19.03 8.02V5.1C19.03 5.04 18.97 5 18.92 5.02Z"
248
248
  }),
249
249
  /* @__PURE__ */ jsx("path", {
250
250
  fill: "currentColor",
251
- d: "M52.7211 9.5114C52.8254 9.51159 52.9095 9.59651 52.9096 9.70085L52.8383 18.2057C52.8383 18.3069 52.7575 18.3891 52.6577 18.3893L52.6411 18.3864H51.3022C51.1512 18.3861 50.7795 18.2504 50.3901 18.0007C49.8574 18.2487 49.2664 18.3893 48.644 18.3893H48.3901C47.2354 18.3893 46.1869 17.9123 45.4272 17.1442C44.667 16.3763 44.1958 15.316 44.1957 14.1481C44.1957 12.98 44.6675 11.9191 45.4272 11.151C46.1587 10.4118 47.1591 9.94381 48.2631 9.90983C49.1702 9.85599 49.9861 9.98778 50.4887 10.4967V9.70085C50.4888 9.5964 50.5737 9.51141 50.6782 9.5114H52.7211ZM35.352 5.61686H36.9623C37.0879 5.61703 37.1896 5.71855 37.1909 5.84538V7.81022C37.1909 7.93652 37.088 8.03874 36.9623 8.03874H34.9203C34.3151 8.03874 33.6274 8.63552 33.6274 9.25163V10.6149C34.2626 9.97905 34.9289 9.65371 35.352 9.63054H36.4604C36.5867 9.63054 36.6889 9.73339 36.6889 9.85905V11.8239C36.6889 11.9502 36.586 12.0524 36.4604 12.0524H34.9194C34.3143 12.0525 33.6276 12.6493 33.6274 13.2653V18.1999C33.6272 18.3042 33.5423 18.3883 33.4379 18.3883H31.395C31.2907 18.3882 31.2066 18.3042 31.2065 18.1999V9.93815C31.2065 9.86969 31.1975 9.80188 31.2006 9.73405C31.2397 8.87625 31.1516 5.44451 35.352 5.61686ZM39.933 9.63054C40.0375 9.63055 40.1224 9.71555 40.1225 9.81999V10.6149C40.7578 9.97909 41.5843 9.63054 41.8471 9.63054H43.4565C43.5821 9.63054 43.6844 9.73339 43.685 9.85905V11.8239C43.6848 11.95 43.5829 12.0513 43.4575 12.0514H41.4145C40.8093 12.0515 40.1225 12.6492 40.1225 13.2653V18.1999C40.1223 18.3042 40.0374 18.3883 39.933 18.3883H37.8901C37.7859 18.3882 37.7018 18.3041 37.7016 18.1999V9.81999C37.7017 9.71565 37.7858 9.63072 37.8901 9.63054H39.933ZM56.1967 7.00651C56.3021 7.00678 56.3879 7.09283 56.3881 7.1989V13.4479L59.8295 10.1891C59.8654 10.1552 59.912 10.1364 59.9614 10.1364H62.2797C62.4501 10.1364 62.5363 10.3414 62.4174 10.4626L59.3022 13.6325L62.7993 18.0749C62.8986 18.2012 62.8091 18.3864 62.6489 18.3864H60.2387C60.1804 18.3864 60.1258 18.3596 60.0893 18.3141L57.6723 15.3161C57.5998 15.2283 57.4679 15.2203 57.3871 15.3005L56.3881 16.2858V18.194C56.3881 18.2996 56.3029 18.3861 56.1967 18.3864H54.1879C54.0823 18.3862 53.9955 18.3003 53.9955 18.194V7.1989C53.9958 7.09341 54.0818 7.00669 54.1879 7.00651H56.1967ZM48.3705 11.9606C47.7802 11.9607 47.2427 12.2054 46.853 12.6003C46.4626 12.9952 46.2202 13.5386 46.2202 14.1354C46.2202 14.7323 46.4626 15.2763 46.853 15.6706C47.2427 16.0654 47.7802 16.3102 48.3705 16.3102H48.6616C49.2513 16.3102 49.7894 16.0654 50.1791 15.6706C50.5696 15.2763 50.8119 14.7323 50.8119 14.1354C50.8119 13.5386 50.5695 12.9945 50.1791 12.6003C49.7894 12.2055 49.2512 11.9606 48.6616 11.9606H48.3705Z"
251
+ d: "M52.72 9.51C52.83 9.51 52.91 9.6 52.91 9.7L52.84 18.21C52.84 18.31 52.76 18.39 52.66 18.39L52.64 18.39H51.3C51.15 18.39 50.78 18.25 50.39 18C49.86 18.25 49.27 18.39 48.64 18.39H48.39C47.24 18.39 46.19 17.91 45.43 17.14C44.67 16.38 44.2 15.32 44.2 14.15C44.2 12.98 44.67 11.92 45.43 11.15C46.16 10.41 47.16 9.94 48.26 9.91C49.17 9.86 49.99 9.99 50.49 10.5V9.7C50.49 9.6 50.57 9.51 50.68 9.51H52.72ZM35.35 5.62H36.96C37.09 5.62 37.19 5.72 37.19 5.85V7.81C37.19 7.94 37.09 8.04 36.96 8.04H34.92C34.32 8.04 33.63 8.64 33.63 9.25V10.61C34.26 9.98 34.93 9.65 35.35 9.63H36.46C36.59 9.63 36.69 9.73 36.69 9.86V11.82C36.69 11.95 36.59 12.05 36.46 12.05H34.92C34.31 12.05 33.63 12.65 33.63 13.27V18.2C33.63 18.3 33.54 18.39 33.44 18.39H31.39C31.29 18.39 31.21 18.3 31.21 18.2V9.94C31.21 9.87 31.2 9.8 31.2 9.73C31.24 8.88 31.15 5.44 35.35 5.62ZM39.93 9.63C40.04 9.63 40.12 9.72 40.12 9.82V10.61C40.76 9.98 41.58 9.63 41.85 9.63H43.46C43.58 9.63 43.68 9.73 43.69 9.86V11.82C43.68 11.95 43.58 12.05 43.46 12.05H41.41C40.81 12.05 40.12 12.65 40.12 13.27V18.2C40.12 18.3 40.04 18.39 39.93 18.39H37.89C37.79 18.39 37.7 18.3 37.7 18.2V9.82C37.7 9.72 37.79 9.63 37.89 9.63H39.93ZM56.2 7.01C56.3 7.01 56.39 7.09 56.39 7.2V13.45L59.83 10.19C59.87 10.16 59.91 10.14 59.96 10.14H62.28C62.45 10.14 62.54 10.34 62.42 10.46L59.3 13.63L62.8 18.07C62.9 18.2 62.81 18.39 62.65 18.39H60.24C60.18 18.39 60.13 18.36 60.09 18.31L57.67 15.32C57.6 15.23 57.47 15.22 57.39 15.3L56.39 16.29V18.19C56.39 18.3 56.3 18.39 56.2 18.39H54.19C54.08 18.39 54 18.3 54 18.19V7.2C54 7.09 54.08 7.01 54.19 7.01H56.2ZM48.37 11.96C47.78 11.96 47.24 12.21 46.85 12.6C46.46 13 46.22 13.54 46.22 14.14C46.22 14.73 46.46 15.28 46.85 15.67C47.24 16.07 47.78 16.31 48.37 16.31H48.66C49.25 16.31 49.79 16.07 50.18 15.67C50.57 15.28 50.81 14.73 50.81 14.14C50.81 13.54 50.57 12.99 50.18 12.6C49.79 12.21 49.25 11.96 48.66 11.96H48.37Z"
252
252
  })
253
253
  ]
254
254
  });
@@ -265,7 +265,7 @@ function WarningIcon(props) {
265
265
  "aria-hidden": "true",
266
266
  ...props,
267
267
  children: /* @__PURE__ */ jsx("path", {
268
- d: "M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5ZM8.10352 10.207C8.82025 10.2071 9.23531 10.6346 9.23535 11.3262C9.23535 12.0304 8.82028 12.4579 8.10352 12.458C7.36167 12.4579 6.97168 12.0304 6.97168 11.3262C6.97172 10.6346 7.36171 10.2072 8.10352 10.207ZM8.84766 3.54102C9.01311 3.54121 9.14736 3.67535 9.14746 3.84082V4.74805L8.84375 8.37012C8.83069 8.52552 8.6999 8.64551 8.54395 8.64551H7.62891C7.47133 8.64523 7.34074 8.52251 7.33008 8.36523L7.08496 4.74805V3.84082C7.08507 3.67533 7.2193 3.54119 7.38477 3.54102H8.84766Z",
268
+ d: "M8 0C12.42 0 16 3.58 16 8C16 12.42 12.42 16 8 16C3.58 16 0 12.42 0 8C0 3.58 3.58 0 8 0ZM8 1.5C4.41 1.5 1.5 4.41 1.5 8C1.5 11.59 4.41 14.5 8 14.5C11.59 14.5 14.5 11.59 14.5 8C14.5 4.41 11.59 1.5 8 1.5ZM8.1 10.21C8.82 10.21 9.24 10.63 9.24 11.33C9.24 12.03 8.82 12.46 8.1 12.46C7.36 12.46 6.97 12.03 6.97 11.33C6.97 10.63 7.36 10.21 8.1 10.21ZM8.85 3.54C9.01 3.54 9.15 3.68 9.15 3.84V4.75L8.84 8.37C8.83 8.53 8.7 8.65 8.54 8.65H7.63C7.47 8.65 7.34 8.52 7.33 8.37L7.08 4.75V3.84C7.09 3.68 7.22 3.54 7.38 3.54H8.85Z",
269
269
  fill: "currentColor"
270
270
  })
271
271
  });
package/dist/banner.js CHANGED
@@ -1,16 +1,32 @@
1
1
  import { i as useLang, o as useClientReady, s as registerWebComponent, t as usePlacement } from "./usePlacement-4PoDbn2X.js";
2
2
  import { t as useGlobalComponents } from "./useGlobalComponents-CZ7Sh2tZ.js";
3
3
  import { t as useLightDomStyles } from "./useLightDomStyles-DphuQhvx.js";
4
- import { r as b } from "./rewards-B5VmlrcI.js";
5
- import { t as useReward } from "./useReward-DD2mMUN0.js";
4
+ import { r as b } from "./rewards-VoZGH2Ko.js";
5
+ import { t as useReward } from "./useReward-BGgymGoH.js";
6
6
  import { componentDefaults } from "./i18n/defaults.js";
7
- import { a as ExternalLinkIcon, i as LogoFrakWithName, n as cssSource$5, o as CloseCircleIcon, r as WarningIcon, t as GiftIcon } from "./GiftIcon-WEWSJ8kV.js";
7
+ import { a as ExternalLinkIcon, i as LogoFrakWithName, n as cssSource$5, o as CloseCircleIcon, r as WarningIcon, t as GiftIcon } from "./GiftIcon-BEzYdiux.js";
8
8
  import { isInAppBrowser, redirectToExternalBrowser, trackEvent } from "@frak-labs/core-sdk";
9
9
  import { REFERRAL_SUCCESS_EVENT, getMergeToken } from "@frak-labs/core-sdk/actions";
10
10
  import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
11
11
  import { jsx, jsxs } from "preact/jsx-runtime";
12
12
  //#region \0ve-inline:../../packages/design-system/src/keyframes.css.ts.vanilla.js
13
13
  const cssSource$4 = `@keyframes keyframes_fadeIn__mnqmlt0 {
14
+ from {
15
+ opacity: 0;
16
+ }
17
+ to {
18
+ opacity: 1;
19
+ }
20
+ }
21
+ @keyframes keyframes_fadeOut__mnqmlt1 {
22
+ from {
23
+ opacity: 1;
24
+ }
25
+ to {
26
+ opacity: 0;
27
+ }
28
+ }
29
+ @keyframes keyframes_fadeInDown__mnqmlt2 {
14
30
  from {
15
31
  opacity: 0;
16
32
  transform: translateY(-4px);
@@ -38,7 +54,7 @@ const cssSource$3 = `.inAppBanner_container__1ibpiy70 {
38
54
  backdrop-filter: blur(12px);
39
55
  -webkit-backdrop-filter: blur(12px);
40
56
  color: var(--text-onAction__pbq4ak6);
41
- animation: keyframes_fadeIn__mnqmlt0 300ms ease-out;
57
+ animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
42
58
  }
43
59
  .inAppBanner_header__1ibpiy71 {
44
60
  display: flex;
@@ -175,7 +191,7 @@ function InAppBanner({ title: title$1, description: description$1, cta: cta$1, d
175
191
  const cssSource$1 = `.Banner_rootBase__1gnumzi0 {
176
192
  position: relative;
177
193
  display: flex;
178
- animation: keyframes_fadeIn__mnqmlt0 300ms ease-out;
194
+ animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
179
195
  }
180
196
  .Banner_iconSvg__1gnumzi1 {
181
197
  width: 100%;
@@ -2,8 +2,8 @@ import { i as useLang, l as openSharingPage, o as useClientReady, s as registerW
2
2
  import { t as openEmbeddedWallet } from "./embeddedWallet-By3_p5Xc.js";
3
3
  import { t as useGlobalComponents } from "./useGlobalComponents-CZ7Sh2tZ.js";
4
4
  import { t as useLightDomStyles } from "./useLightDomStyles-DphuQhvx.js";
5
- import { r as b } from "./rewards-B5VmlrcI.js";
6
- import { t as useReward } from "./useReward-DD2mMUN0.js";
5
+ import { r as b } from "./rewards-VoZGH2Ko.js";
6
+ import { t as useReward } from "./useReward-BGgymGoH.js";
7
7
  import { componentDefaults } from "./i18n/defaults.js";
8
8
  import { trackEvent } from "@frak-labs/core-sdk";
9
9
  import { useCallback, useMemo } from "preact/hooks";
@@ -1,6 +1,6 @@
1
1
  import { i as useLang, n as buildStyleContent, o as useClientReady, s as registerWebComponent, t as usePlacement } from "./usePlacement-4PoDbn2X.js";
2
2
  import { t as openEmbeddedWallet } from "./embeddedWallet-By3_p5Xc.js";
3
- import { t as useReward } from "./useReward-DD2mMUN0.js";
3
+ import { t as useReward } from "./useReward-BGgymGoH.js";
4
4
  import { componentDefaults } from "./i18n/defaults.js";
5
5
  import { useEffect, useMemo, useState } from "preact/hooks";
6
6
  import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
@@ -14,7 +14,7 @@ function GiftIcon(props) {
14
14
  xmlns: "http://www.w3.org/2000/svg",
15
15
  ...props,
16
16
  children: [/* @__PURE__ */ jsx("title", { children: "Gift icon" }), /* @__PURE__ */ jsx("path", {
17
- d: "m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z",
17
+ d: "m23.14 14v11.43h-18.29v-11.43m9.14 11.43v-17.14m0 0h-5.14c-0.76 0-1.48-0.3-2.02-0.84s-0.84-1.26-0.84-2.020.3-1.480.84-2.02 1.26-0.84 2.02-0.84c4 0 5.14 5.71 5.14 5.71zm0 0h5.14c0.76 0 1.48-0.3 2.02-0.84s0.84-1.260.84-2.02-0.3-1.48-0.84-2.02-1.26-0.84-2.02-0.84c-4 0-5.14 5.71-5.14 5.71zm-11.43 0h22.86v5.71h-22.86z",
18
18
  stroke: "#fff",
19
19
  "stroke-linecap": "round",
20
20
  "stroke-linejoin": "round"
@@ -1,9 +1,9 @@
1
1
  import { c as sanitizeProductList, i as useLang, l as openSharingPage, o as useClientReady, s as registerWebComponent, t as usePlacement } from "./usePlacement-4PoDbn2X.js";
2
2
  import { t as useGlobalComponents } from "./useGlobalComponents-CZ7Sh2tZ.js";
3
3
  import { t as useLightDomStyles } from "./useLightDomStyles-DphuQhvx.js";
4
- import { i as y, n as T, r as b } from "./rewards-B5VmlrcI.js";
4
+ import { i as y, n as T, r as b } from "./rewards-VoZGH2Ko.js";
5
5
  import { componentDefaults } from "./i18n/defaults.js";
6
- import { i as LogoFrakWithName, n as cssSource$2, t as GiftIcon } from "./GiftIcon-WEWSJ8kV.js";
6
+ import { i as LogoFrakWithName, n as cssSource$2, t as GiftIcon } from "./GiftIcon-BEzYdiux.js";
7
7
  import { trackEvent } from "@frak-labs/core-sdk";
8
8
  import { getMerchantInformation, getUserReferralStatus, trackPurchaseStatus } from "@frak-labs/core-sdk/actions";
9
9
  import { useCallback, useEffect, useMemo, useRef, useState } from "preact/hooks";
@@ -300,7 +300,7 @@ function PostPurchase({ customerId, orderId, token, sharingUrl, merchantId, plac
300
300
  "aria-hidden": "true",
301
301
  className: `${icon} button`,
302
302
  children: /* @__PURE__ */ jsx("path", {
303
- d: "M13.8984 11.144C13.9864 11.052 14.1543 11.1114 14.1543 11.2388V11.644C14.1543 13.0509 12.6288 14.1918 10.7471 14.1919C8.86523 14.1919 7.33984 13.051 7.33984 11.644V11.2388C7.33984 11.1114 7.50675 11.052 7.59473 11.144C8.3452 11.9295 9.47906 12.4292 10.7471 12.4292C12.0149 12.4291 13.148 11.9293 13.8984 11.144ZM1.8457 9.64795C1.8457 9.51169 2.01094 9.44452 2.10254 9.54053C2.85304 10.3238 3.98586 10.8247 5.25293 10.8247C5.52246 10.8247 5.78608 10.8026 6.04102 10.7593C6.25744 10.7225 6.46582 10.8816 6.46582 11.1011V12.1704C6.46564 12.319 6.36769 12.4507 6.22266 12.4829C5.91535 12.5512 5.58981 12.5874 5.25293 12.5874C3.3711 12.5874 1.8457 11.4469 1.8457 10.0396V9.64795ZM10.7471 6.20654C12.6288 6.20666 14.1543 7.3475 14.1543 8.75439C14.1541 10.1612 12.6287 11.3012 10.7471 11.3013C8.86535 11.3013 7.34004 10.1612 7.33984 8.75439C7.33984 7.34743 8.86523 6.20654 10.7471 6.20654ZM1.8457 6.8501C1.84597 6.71385 2.01208 6.64848 2.10352 6.74365C2.85393 7.52827 3.98602 8.0278 5.25293 8.02783C5.52282 8.02783 5.78667 8.00448 6.04199 7.96143C6.258 7.92499 6.46582 8.08514 6.46582 8.3042V9.37256C6.46582 9.52127 6.36783 9.65378 6.22266 9.68604C5.91537 9.75429 5.58979 9.79053 5.25293 9.79053C3.3711 9.79048 1.8457 8.64863 1.8457 7.24268V6.8501ZM5.25293 1.80811C7.13481 1.80811 8.66016 2.94856 8.66016 4.35596C8.66008 5.76331 7.13476 6.90381 5.25293 6.90381C3.37115 6.90376 1.84578 5.76328 1.8457 4.35596C1.8457 2.94858 3.3711 1.80815 5.25293 1.80811Z",
303
+ d: "M13.9 11.14C13.99 11.05 14.15 11.11 14.15 11.24V11.64C14.15 13.05 12.63 14.19 10.75 14.19C8.87 14.19 7.34 13.05 7.34 11.64V11.24C7.34 11.11 7.51 11.05 7.59 11.14C8.35 11.93 9.48 12.43 10.75 12.43C12.01 12.43 13.15 11.93 13.9 11.14ZM1.85 9.65C1.85 9.51 2.01 9.44 2.1 9.54C2.85 10.32 3.99 10.82 5.25 10.82C5.52 10.82 5.79 10.8 6.04 10.76C6.26 10.72 6.47 10.88 6.47 11.1V12.17C6.47 12.32 6.37 12.45 6.22 12.48C5.92 12.55 5.59 12.59 5.25 12.59C3.37 12.59 1.85 11.45 1.85 10.04V9.65ZM10.75 6.21C12.63 6.21 14.15 7.35 14.15 8.75C14.15 10.16 12.63 11.3 10.75 11.3C8.87 11.3 7.34 10.16 7.34 8.75C7.34 7.35 8.87 6.21 10.75 6.21ZM1.85 6.85C1.85 6.71 2.01 6.65 2.1 6.74C2.85 7.53 3.99 8.03 5.25 8.03C5.52 8.03 5.79 8 6.04 7.96C6.26 7.92 6.47 8.09 6.47 8.3V9.37C6.47 9.52 6.37 9.65 6.22 9.69C5.92 9.75 5.59 9.79 5.25 9.79C3.37 9.79 1.85 8.65 1.85 7.24V6.85ZM5.25 1.81C7.13 1.81 8.66 2.95 8.66 4.36C8.66 5.76 7.13 6.9 5.25 6.9C3.37 6.9 1.85 5.76 1.85 4.36C1.85 2.95 3.37 1.81 5.25 1.81Z",
304
304
  fill: "currentColor"
305
305
  })
306
306
  })]
@@ -138,7 +138,10 @@ function E(t, n = {}) {
138
138
  formatted: a,
139
139
  payoutType: i.payoutType,
140
140
  minPurchaseAmount: s,
141
- lockupDurationDays: u
141
+ lockupDurationDays: u,
142
+ referrerReward: r.campaign.referrer,
143
+ refereeReward: r.campaign.referee,
144
+ minPurchaseValue: o ?? void 0
142
145
  };
143
146
  }
144
147
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as E } from "./rewards-B5VmlrcI.js";
1
+ import { t as E } from "./rewards-VoZGH2Ko.js";
2
2
  import { getMerchantInformation } from "@frak-labs/core-sdk/actions";
3
3
  import { useEffect, useState } from "preact/hooks";
4
4
  //#region src/hooks/useReward.ts
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "url": "https://twitter.com/QNivelais"
12
12
  }
13
13
  ],
14
- "version": "1.0.11",
14
+ "version": "1.0.12-beta.27533e18",
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",
@@ -84,7 +84,7 @@
84
84
  "clean": "rimraf cdn dist",
85
85
  "build": "tsdown",
86
86
  "build:watch": "tsdown --watch",
87
- "typecheck": "tsgo --noEmit",
87
+ "typecheck": "tsc --noEmit",
88
88
  "test": "vitest",
89
89
  "test:ui": "vitest --ui",
90
90
  "test:coverage": "vitest --coverage",
@@ -92,8 +92,8 @@
92
92
  "publish": "echo 'Publishing components...'"
93
93
  },
94
94
  "dependencies": {
95
- "@frak-labs/core-sdk": "1.1.6",
96
- "@frak-labs/frame-connector": "0.2.0",
95
+ "@frak-labs/core-sdk": "1.2.0-beta.27533e18",
96
+ "@frak-labs/frame-connector": "0.2.0-beta.27533e18",
97
97
  "preact": "^10.29.0",
98
98
  "preact-custom-element": "^4.6.0",
99
99
  "@frak-labs/design-system": "0.0.0"
@@ -108,15 +108,16 @@
108
108
  "@types/jsdom": "^28.0.0",
109
109
  "@types/node": "^25.6.0",
110
110
  "@types/preact-custom-element": "^4.0.4",
111
+ "@typescript/native": "npm:typescript@^7.0.2",
111
112
  "@vanilla-extract/css": "^1.20.1",
112
113
  "@vanilla-extract/integration": "^8.0.10",
113
- "@vanilla-extract/vite-plugin": "^5.2.1",
114
114
  "@vanilla-extract/sprinkles": "^1.6.5",
115
+ "@vanilla-extract/vite-plugin": "^5.2.1",
115
116
  "@vitest/coverage-v8": "^4.1.0",
116
117
  "@vitest/ui": "^4.1.0",
117
118
  "jsdom": "^29.0.0",
118
119
  "tsdown": "^0.22.0",
119
- "typescript": "^6.0.2",
120
+ "typescript": "^6.0.3",
120
121
  "vitest": "^4.1.4"
121
122
  }
122
123
  }
@@ -1,40 +0,0 @@
1
- import{a as e,d as t,g as n,h as r,m as i,n as a,p as o,r as s,s as c,t as l,u}from"./defaults.kWEdCyGS.js";import{t as d}from"./useReward.IXcdcQPk.js";import{t as f}from"./embeddedWallet.BS-9u4Be.js";function p(e){return i(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[i(`title`,{children:`Gift icon`}),i(`path`,{d:`m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function m(){`vibrate`in navigator&&navigator.vibrate(10)}function h(e,t){m(),f(e,t)}function g({placement:r,classname:f=``,useReward:m,targetInteraction:g}){let _=e(),v=a(r),y=u(()=>v?.targetInteraction===void 0?g:v.targetInteraction,[v?.targetInteraction,g]),b=u(()=>m===!0,[m]),{shouldRender:x,isHidden:S,isClientReady:C}=c(),{reward:w}=d(b&&C,y),[T,E]=t(`right`);if(o(()=>{let e=v?.components?.buttonWallet?.position,t=window.FrakSetup?.modalWalletConfig?.metadata?.position;E(e??t??`right`)},[v?.components?.buttonWallet?.position]),!x||S)return null;let D=[`button`,`button__fadeIn`,T===`left`?`button__left`:`button__right`,f].filter(Boolean).join(` `);return i(n,{children:[i(`style`,{children:s(`
2
- .button {
3
- all: unset;
4
- position: fixed;
5
- bottom: 20px;
6
- z-index: 2000000;
7
- display: flex;
8
- justify-content: center;
9
- align-items: center;
10
- background-color: #3e557e;
11
- width: 45px;
12
- height: 45px;
13
- border-radius: 50%;
14
- cursor: pointer;
15
- text-align: center;
16
- font-size: 24px;
17
- }
18
-
19
- .button__left {
20
- left: 20px;
21
- }
22
-
23
- .button__right {
24
- right: 20px;
25
- }
26
-
27
- .reward {
28
- position: absolute;
29
- top: -4px;
30
- right: 27px;
31
- padding: 2px 3px;
32
- border-radius: 5px;
33
- background: #ff3f3f;
34
- font-size: 9px;
35
- color: #fff;
36
- font-weight: 600;
37
- white-space: nowrap;
38
- line-height: 9px;
39
- }
40
- `,v?.components?.buttonWallet?.css)}),i(`button`,{type:`button`,"aria-label":l[_].buttonWallet.ariaLabel,part:`button`,disabled:!C,class:D,onClick:()=>{h(y,r)},children:[i(p,{}),w&&i(`span`,{class:`reward`,children:w})]})]})}r(g,`frak-button-wallet`,[`placement`,`classname`,`useReward`,`targetInteraction`],{shadow:!0});export{g as ButtonWallet};
@@ -1 +0,0 @@
1
- import{m as e}from"./defaults.kWEdCyGS.js";function t(t){return e(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M7.33301 0C11.383 0 14.6668 3.28307 14.667 7.33301C14.667 11.3831 11.3831 14.667 7.33301 14.667C3.28307 14.6668 0 11.383 0 7.33301C0.000175746 3.28318 3.28318 0.000175742 7.33301 0ZM10.3896 4.27734C10.151 4.0388 9.76303 4.03775 9.52441 4.27637L7.33301 6.46777L5.14258 4.27637C4.90397 4.03776 4.51601 4.03882 4.27734 4.27734C4.03869 4.516 4.03771 4.90392 4.27637 5.14258L6.4668 7.33398L4.27637 9.52441C4.03807 9.76306 4.03891 10.1511 4.27734 10.3896C4.51589 10.6282 4.9039 10.629 5.14258 10.3906L7.33301 8.2002L9.52344 10.3906C9.76198 10.629 10.15 10.6279 10.3887 10.3896C10.6273 10.151 10.6283 9.76209 10.3896 9.52344L8.2002 7.33398L10.3906 5.14258C10.6293 4.90392 10.6283 4.516 10.3896 4.27734Z`,fill:`currentColor`})})}function n(t){return e(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M5.45508 0C5.75614 0.000209333 6 0.244788 6 0.545898C5.99979 0.846831 5.75601 1.09159 5.45508 1.0918H4.36426C3.05445 1.0918 2.27964 1.35707 1.81836 1.81836C1.35714 2.27966 1.0918 3.05454 1.0918 4.36426V7.63672C1.09186 8.94625 1.35713 9.72139 1.81836 10.1826C2.2797 10.6436 3.05488 10.9092 4.36426 10.9092H7.63672C8.94628 10.9091 9.72135 10.6438 10.1826 10.1826C10.6438 9.72139 10.9091 8.94625 10.9092 7.63672V6.5459C10.9092 6.24466 11.1538 6 11.4551 6C11.7561 6.00028 12 6.24483 12 6.5459V7.63672C11.9999 9.05391 11.72 10.1882 10.9541 10.9541C10.1882 11.7199 9.05394 12 7.63672 12H4.36426C2.94714 12 1.81283 11.7197 1.04688 10.9541C0.280997 10.1882 6.04321e-05 9.05391 0 7.63672V4.36426C0 2.94692 0.28099 1.81283 1.04688 1.04688C1.81284 0.280915 2.94686 0 4.36426 0H5.45508ZM11.4541 0C11.7553 2.20143e-05 11.999 0.244672 11.999 0.545898V3.16406C11.9988 3.46509 11.7552 3.70896 11.4541 3.70898C11.1532 3.70873 10.9084 3.46495 10.9082 3.16406V1.8623L6.93066 5.83984C6.71766 6.05283 6.37218 6.05283 6.15918 5.83984C5.94657 5.62681 5.94632 5.28124 6.15918 5.06836L10.1357 1.0918H8.83594C8.53504 1.09154 8.29025 0.846803 8.29004 0.545898C8.29004 0.244816 8.53491 0.000254588 8.83594 0H11.4541Z`,fill:`currentColor`})})}function r(t){return e(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t.width??`63`,height:t.height??`24`,fill:`none`,viewBox:`0 0 63 24`,...t,children:[e(`title`,{children:`Frak`}),e(`rect`,{width:`24`,height:`24`,rx:`6`,fill:`#0043EF`}),e(`path`,{fill:`white`,d:`M9.76941 15.9093L5.1481 14.3453C5.06012 14.3155 4.96875 14.3811 4.96875 14.474V17.3274C4.96875 17.3857 5.00584 17.4373 5.06103 17.4561L9.68234 19.02C9.77032 19.0499 9.86169 18.9843 9.86169 18.8913V16.038C9.86169 15.9796 9.8246 15.9281 9.76941 15.9093ZM14.5764 10.4374L9.95396 12.0013C9.89878 12.0201 9.86169 12.0717 9.86169 12.13V14.9833C9.86169 15.0763 9.95306 15.1419 10.041 15.112L14.6635 13.5481C14.7187 13.5293 14.7558 13.4777 14.7558 13.4194V10.566C14.7558 10.4731 14.6646 10.4075 14.5764 10.4374ZM18.9173 5.01993L11.1787 7.51231C11.1226 7.53041 11.0846 7.58265 11.0846 7.64168V10.5651C11.0846 10.6233 11.1423 10.6644 11.1983 10.6463L18.9369 8.15396C18.993 8.13586 19.0312 8.08362 19.0312 8.02459V5.10113C19.031 5.043 18.9734 5.00184 18.9173 5.01993Z`}),e(`path`,{fill:`currentColor`,d:`M52.7211 9.5114C52.8254 9.51159 52.9095 9.59651 52.9096 9.70085L52.8383 18.2057C52.8383 18.3069 52.7575 18.3891 52.6577 18.3893L52.6411 18.3864H51.3022C51.1512 18.3861 50.7795 18.2504 50.3901 18.0007C49.8574 18.2487 49.2664 18.3893 48.644 18.3893H48.3901C47.2354 18.3893 46.1869 17.9123 45.4272 17.1442C44.667 16.3763 44.1958 15.316 44.1957 14.1481C44.1957 12.98 44.6675 11.9191 45.4272 11.151C46.1587 10.4118 47.1591 9.94381 48.2631 9.90983C49.1702 9.85599 49.9861 9.98778 50.4887 10.4967V9.70085C50.4888 9.5964 50.5737 9.51141 50.6782 9.5114H52.7211ZM35.352 5.61686H36.9623C37.0879 5.61703 37.1896 5.71855 37.1909 5.84538V7.81022C37.1909 7.93652 37.088 8.03874 36.9623 8.03874H34.9203C34.3151 8.03874 33.6274 8.63552 33.6274 9.25163V10.6149C34.2626 9.97905 34.9289 9.65371 35.352 9.63054H36.4604C36.5867 9.63054 36.6889 9.73339 36.6889 9.85905V11.8239C36.6889 11.9502 36.586 12.0524 36.4604 12.0524H34.9194C34.3143 12.0525 33.6276 12.6493 33.6274 13.2653V18.1999C33.6272 18.3042 33.5423 18.3883 33.4379 18.3883H31.395C31.2907 18.3882 31.2066 18.3042 31.2065 18.1999V9.93815C31.2065 9.86969 31.1975 9.80188 31.2006 9.73405C31.2397 8.87625 31.1516 5.44451 35.352 5.61686ZM39.933 9.63054C40.0375 9.63055 40.1224 9.71555 40.1225 9.81999V10.6149C40.7578 9.97909 41.5843 9.63054 41.8471 9.63054H43.4565C43.5821 9.63054 43.6844 9.73339 43.685 9.85905V11.8239C43.6848 11.95 43.5829 12.0513 43.4575 12.0514H41.4145C40.8093 12.0515 40.1225 12.6492 40.1225 13.2653V18.1999C40.1223 18.3042 40.0374 18.3883 39.933 18.3883H37.8901C37.7859 18.3882 37.7018 18.3041 37.7016 18.1999V9.81999C37.7017 9.71565 37.7858 9.63072 37.8901 9.63054H39.933ZM56.1967 7.00651C56.3021 7.00678 56.3879 7.09283 56.3881 7.1989V13.4479L59.8295 10.1891C59.8654 10.1552 59.912 10.1364 59.9614 10.1364H62.2797C62.4501 10.1364 62.5363 10.3414 62.4174 10.4626L59.3022 13.6325L62.7993 18.0749C62.8986 18.2012 62.8091 18.3864 62.6489 18.3864H60.2387C60.1804 18.3864 60.1258 18.3596 60.0893 18.3141L57.6723 15.3161C57.5998 15.2283 57.4679 15.2203 57.3871 15.3005L56.3881 16.2858V18.194C56.3881 18.2996 56.3029 18.3861 56.1967 18.3864H54.1879C54.0823 18.3862 53.9955 18.3003 53.9955 18.194V7.1989C53.9958 7.09341 54.0818 7.00669 54.1879 7.00651H56.1967ZM48.3705 11.9606C47.7802 11.9607 47.2427 12.2054 46.853 12.6003C46.4626 12.9952 46.2202 13.5386 46.2202 14.1354C46.2202 14.7323 46.4626 15.2763 46.853 15.6706C47.2427 16.0654 47.7802 16.3102 48.3705 16.3102H48.6616C49.2513 16.3102 49.7894 16.0654 50.1791 15.6706C50.5696 15.2763 50.8119 14.7323 50.8119 14.1354C50.8119 13.5386 50.5695 12.9945 50.1791 12.6003C49.7894 12.2055 49.2512 11.9606 48.6616 11.9606H48.3705Z`})]})}2*Math.PI*11;function i(t){return e(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...t,children:e(`path`,{d:`M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5ZM8.10352 10.207C8.82025 10.2071 9.23531 10.6346 9.23535 11.3262C9.23535 12.0304 8.82028 12.4579 8.10352 12.458C7.36167 12.4579 6.97168 12.0304 6.97168 11.3262C6.97172 10.6346 7.36171 10.2072 8.10352 10.207ZM8.84766 3.54102C9.01311 3.54121 9.14736 3.67535 9.14746 3.84082V4.74805L8.84375 8.37012C8.83069 8.52552 8.6999 8.64551 8.54395 8.64551H7.62891C7.47133 8.64523 7.34074 8.52251 7.33008 8.36523L7.08496 4.74805V3.84082C7.08507 3.67533 7.2193 3.54119 7.38477 3.54102H8.84766Z`,fill:`currentColor`})})}function a(t){return e(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...t,children:[e(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),e(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),e(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),e(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}export{t as a,n as i,i as n,r,a as t};
@@ -1,89 +0,0 @@
1
- import{S as e,T as t,a as n,b as r,c as i,i as a,o,r as ee,x as s}from"./loader.js";import{a as c,d as l,f as te,h as u,l as ne,m as d,n as f,p,s as m,t as h,u as g}from"./defaults.kWEdCyGS.js";import{r as re,t as ie}from"./GiftIcon.QppqMfWS.js";import{t as ae}from"./useGlobalComponents.BC6Jgzg5.js";import{t as oe}from"./useLightDomStyles.imPXuAtf.js";import{i as se,n as _,r as v}from"./rewards.B6IAemE2.js";var y=`PostPurchase_card__5fv5lh0`,ce=`PostPurchase_cardLayout__5fv5lh1`,b=`PostPurchase_cardLeft__5fv5lh2`,x=`PostPurchase_cardRight__5fv5lh3`,S=`PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0`,le=`PostPurchase_customImage__5fv5lha`,ue=`PostPurchase_frakLogo__5fv5lhb`,de=`PostPurchase_giftIcon__5fv5lh8`,fe=`PostPurchase_icon__5fv5lh7`,pe=`PostPurchase_imageWrapper__5fv5lh9`,me=`PostPurchase_message__5fv5lh5`;function he(e,t,n){let r=e?.isReferred?`referee`:`referrer`,i=_(t.rewards,{targetInteraction:`purchase`,currency:n,audience:r});if(!i)return null;let{campaign:a}=i,o=e?.isReferred&&a.referee?`referee`:`referrer`;return{variant:o,reward:o===`referee`?a.referee:a.referrer,merchantDomain:t.onChainMetadata.domain}}function C({customerId:u,orderId:_,token:C,sharingUrl:ge,merchantId:w,placement:T,classname:E=``,variant:D,badgeText:O,referrerText:k,refereeText:A,ctaText:j,preview:M,previewVariant:N,products:P,imageUrl:F}){let I=!!M,{shouldRender:L,isHidden:R,isClientReady:z}=m(),B=f(T),V=c();oe(`frak-post-purchase`,T,B?.components?.postPurchase?.css,`.PostPurchase_card__5fv5lh0 {
2
- padding: 16px;
3
- border-radius: 12px;
4
- background-color: var(--surface-background__pbq4akc);
5
- border: 1px solid var(--border-default__pbq4akv);
6
- }
7
- .PostPurchase_cardLayout__5fv5lh1 {
8
- display: flex;
9
- flex-direction: row;
10
- align-items: center;
11
- gap: 32px;
12
- }
13
- .PostPurchase_cardLeft__5fv5lh2 {
14
- flex-grow: 1;
15
- min-width: 0;
16
- display: flex;
17
- flex-direction: column;
18
- gap: 8px;
19
- }
20
- .PostPurchase_cardRight__5fv5lh3 {
21
- flex-shrink: 0;
22
- display: flex;
23
- flex-direction: column;
24
- align-items: flex-end;
25
- gap: 8px;
26
- text-align: right;
27
- }
28
- .PostPurchase_badge__5fv5lh4 {
29
- align-self: flex-start;
30
- background-color: #FFF534;
31
- border-radius: 4px;
32
- padding: 4px 8px;
33
- font-size: 12px;
34
- font-weight: 600;
35
- line-height: 12px;
36
- color: var(--text-primary__pbq4ak0);
37
- }
38
- .PostPurchase_message__5fv5lh5 {
39
- margin: 0;
40
- font-size: 16px;
41
- line-height: 22px;
42
- color: var(--text-primary__pbq4ak0);
43
- font-weight: 600;
44
- }
45
- .PostPurchase_cta__5fv5lh6 {
46
- display: inline-flex;
47
- align-items: center;
48
- justify-content: center;
49
- gap: 4px;
50
- padding: 12px 16px;
51
- border-radius: 9999px;
52
- background-color: var(--text-primary__pbq4ak0);
53
- color: var(--text-onAction__pbq4ak6);
54
- font-size: 12px;
55
- font-weight: bold;
56
- text-transform: uppercase;
57
- }
58
- .PostPurchase_cta__5fv5lh6:disabled {
59
- opacity: 0.7;
60
- cursor: default;
61
- }
62
- .PostPurchase_icon__5fv5lh7 {
63
- margin: -2px 0;
64
- }
65
- .PostPurchase_giftIcon__5fv5lh8 {
66
- display: block;
67
- flex-shrink: 0;
68
- }
69
- .PostPurchase_imageWrapper__5fv5lh9 {
70
- flex-shrink: 0;
71
- display: flex;
72
- align-items: center;
73
- justify-content: center;
74
- width: 80px;
75
- height: 80px;
76
- overflow: hidden;
77
- }
78
- .PostPurchase_customImage__5fv5lha {
79
- max-width: 100%;
80
- max-height: 100%;
81
- width: auto;
82
- height: auto;
83
- object-fit: contain;
84
- display: block;
85
- }
86
- .PostPurchase_frakLogo__5fv5lhb {
87
- display: block;
88
- margin-left: auto;
89
- }`,t);let[H,_e]=l(null),[U,W]=l(!1);p(()=>{I||!z||!u||!_||!C||n({customerId:u,orderId:_,token:C,merchantId:w}).catch(()=>{})},[I,z,u,_,C,w]),p(()=>{if(I||!z||U)return;let t=window.FrakSetup?.client;t&&Promise.all([o(t),i(t)]).then(([e,n])=>{W(!0),_e(he(e,n,t.config.metadata?.currency))}).catch(t=>{if(t instanceof e&&t.code===s.configError){W(!0);return}})},[I,z,U]);let G=ne(null),K=D??H?.variant??(I?N??`referrer`:void 0),q=ge??H?.merchantDomain,J=g(()=>{if(!H?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return se(H.reward,e)},[H?.reward]),ve=ae(),Y=B?.components?.postPurchase??ve?.postPurchase,X=O??Y?.badgeText,Z=F??Y?.imageUrl,Q=g(()=>{let e=h[V].postPurchase;return{message:K===`referee`?J?v(A??Y?.refereeText??e.refereeText,J):A??Y?.refereeNoRewardText??e.refereeNoRewardText:J?v(k??Y?.referrerText??e.referrerText,J):k??Y?.referrerNoRewardText??e.referrerNoRewardText,cta:J?v(j??Y?.ctaText??e.ctaText,J):j??Y?.ctaNoRewardText??e.ctaNoRewardText}},[V,K,J,Y,k,A,j]);p(()=>{K&&G.current!==K&&z&&(!I&&(!L||R)||(r(window.FrakSetup?.client,`post_purchase_impression`,{placement:T,variant:K,has_reward:!!H?.reward}),G.current=K))},[K,L,R,z,I,T,H?.reward]);let $=g(()=>ee(P),[P]),ye=te(()=>{K&&(r(window.FrakSetup?.client,`post_purchase_clicked`,{placement:T,variant:K}),a(void 0,T,{link:q,products:$}))},[K,T,q,$]);return!K||!I&&(!L||R||!H)?null:d(`div`,{className:[y,E].filter(Boolean).join(` `),children:d(`div`,{class:ce,children:[d(`div`,{class:b,children:[X&&d(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:X}),d(`p`,{class:me,children:Q.message}),d(`button`,{type:`button`,className:`${S} button`,disabled:!I&&!z,onClick:I?void 0:ye,children:[Q.cta,d(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`${fe} button`,children:d(`path`,{d:`M13.8984 11.144C13.9864 11.052 14.1543 11.1114 14.1543 11.2388V11.644C14.1543 13.0509 12.6288 14.1918 10.7471 14.1919C8.86523 14.1919 7.33984 13.051 7.33984 11.644V11.2388C7.33984 11.1114 7.50675 11.052 7.59473 11.144C8.3452 11.9295 9.47906 12.4292 10.7471 12.4292C12.0149 12.4291 13.148 11.9293 13.8984 11.144ZM1.8457 9.64795C1.8457 9.51169 2.01094 9.44452 2.10254 9.54053C2.85304 10.3238 3.98586 10.8247 5.25293 10.8247C5.52246 10.8247 5.78608 10.8026 6.04102 10.7593C6.25744 10.7225 6.46582 10.8816 6.46582 11.1011V12.1704C6.46564 12.319 6.36769 12.4507 6.22266 12.4829C5.91535 12.5512 5.58981 12.5874 5.25293 12.5874C3.3711 12.5874 1.8457 11.4469 1.8457 10.0396V9.64795ZM10.7471 6.20654C12.6288 6.20666 14.1543 7.3475 14.1543 8.75439C14.1541 10.1612 12.6287 11.3012 10.7471 11.3013C8.86535 11.3013 7.34004 10.1612 7.33984 8.75439C7.33984 7.34743 8.86523 6.20654 10.7471 6.20654ZM1.8457 6.8501C1.84597 6.71385 2.01208 6.64848 2.10352 6.74365C2.85393 7.52827 3.98602 8.0278 5.25293 8.02783C5.52282 8.02783 5.78667 8.00448 6.04199 7.96143C6.258 7.92499 6.46582 8.08514 6.46582 8.3042V9.37256C6.46582 9.52127 6.36783 9.65378 6.22266 9.68604C5.91537 9.75429 5.58979 9.79053 5.25293 9.79053C3.3711 9.79048 1.8457 8.64863 1.8457 7.24268V6.8501ZM5.25293 1.80811C7.13481 1.80811 8.66016 2.94856 8.66016 4.35596C8.66008 5.76331 7.13476 6.90381 5.25293 6.90381C3.37115 6.90376 1.84578 5.76328 1.8457 4.35596C1.8457 2.94858 3.3711 1.80815 5.25293 1.80811Z`,fill:`currentColor`})})]})]}),d(`div`,{class:x,children:[Z?d(`span`,{class:pe,children:d(`img`,{src:Z,alt:``,class:le})}):d(ie,{className:de,width:80,height:80}),d(re,{className:ue,width:42,height:24})]})]})})}u(C,`frak-post-purchase`,[`customerId`,`orderId`,`token`,`sharingUrl`,`merchantId`,`placement`,`classname`,`variant`,`badgeText`,`referrerText`,`refereeText`,`ctaText`,`products`,`preview`,`previewVariant`,`imageUrl`],{shadow:!1});export{C as PostPurchase};
@@ -1 +0,0 @@
1
- import{l as e}from"./loader.js";async function t(t,n){if(!window.FrakSetup?.client)return;let r=window.FrakSetup?.modalWalletConfig??{};await e(window.FrakSetup.client,t?{...r,metadata:{...r.metadata,targetInteraction:t}}:r,n)}export{t};
@@ -1 +0,0 @@
1
- function e(){return()=>{}}var t=null;function n(n,r){if(typeof document>`u`||typeof window>`u`)return;t&&t();let i=n.maxEventsPerChunk??200,a=n.flushIntervalMs??1e4,o=n.maxPayloadBytes??1048576,s=[],c=0,l=null;function u(e){if(s.length===0)return;let t=JSON.stringify(s);if(new TextEncoder().encode(t).length>o){if(s.length>1){let t=Math.floor(s.length/2),n=s.slice(0,t),r=s.slice(t),i=e&&n.some(e=>e.type===2);s=n,u(i),s=r,u(!1);return}s=[];return}let n=s[0].timestamp,i=s[s.length-1].timestamp;try{r({chunk_index:c,events_count:s.length,is_full_snapshot:e,started_at:new Date(n).toISOString(),ended_at:new Date(i).toISOString(),payload:t}),c+=1,s=[]}catch(e){throw e}}function d(e){let t=e||s.some(e=>e.type===2);s.length>=i?u(t):e&&s.length>0&&u(!0)}let f=n.maskAllText!==!1,p=n.unmaskTextSelector,m=e({emit(e,t){s.push(e),d(!!t)},checkoutEveryNms:a,maskAllInputs:n.maskAllInputs??!0,maskTextSelector:f?`*`:`[data-openpanel-replay-mask]`,maskTextFn:f&&p?(e,t)=>t?.closest(p)?e:e.replace(/\S/g,`*`):void 0,blockSelector:n.blockSelector??`[data-openpanel-replay-block]`,blockClass:n.blockClass,ignoreSelector:n.ignoreSelector});l=setInterval(()=>{s.length>0&&u(s.some(e=>e.type===2))},a);function h(){document.visibilityState===`hidden`&&s.length>0&&u(s.some(e=>e.type===2))}function g(){s.length>0&&u(s.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,h),window.addEventListener(`pagehide`,g),t=()=>{s.length>0&&u(s.some(e=>e.type===2)),l&&=(clearInterval(l),null),document.removeEventListener(`visibilitychange`,h),window.removeEventListener(`pagehide`,g),m?.(),t=null}}function r(){t&&t()}export{n as startReplayRecorder,r as stopReplayRecorder};