@frak-labs/components 1.0.13-beta.e97656d0 → 1.0.13-beta.f4d2e52a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/Banner.wcjTUyP1.js +183 -0
- package/cdn/ButtonShare.CMTO7zcA.js +1 -0
- package/cdn/ButtonWallet.Cwauxojx.js +40 -0
- package/cdn/{GiftIcon.Cwj0ODQr.js → GiftIcon.CSjsnRQh.js} +1 -1
- package/cdn/OpenInAppButton.G3VjbH1_.js +1 -0
- package/cdn/PostPurchase.DFHeDsq_.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/defaults.DNO3nf63.js +58 -0
- package/cdn/embeddedWallet.BR3BC6DE.js +1 -0
- package/cdn/loader.js +164 -1
- package/cdn/rewards.usw1vliR.js +1 -0
- package/cdn/useGlobalComponents.CcNSI-MX.js +1 -0
- package/cdn/useLightDomStyles.mqw3cSdZ.js +1 -0
- package/cdn/useReward.BK8q8FQH.js +1 -0
- package/package.json +31 -19
- package/cdn/Banner.CkdY2dLE.js +0 -183
- package/cdn/ButtonShare.TML2w73z.js +0 -1
- package/cdn/ButtonWallet.B5dTOAAD.js +0 -40
- package/cdn/OpenInAppButton.0v0WDxZL.js +0 -1
- package/cdn/PostPurchase.8Mm3PHA9.js +0 -89
- package/cdn/actions-CMPlZ7CH.CnK_0vla.js +0 -1
- package/cdn/clientReady.0RgyPOYT.js +0 -1
- package/cdn/defaults.euOM2Ohv.js +0 -58
- package/cdn/embeddedWallet.tIACkcKW.js +0 -1
- package/cdn/rewards.CRzXPu4f.js +0 -1
- package/cdn/sharedBaseCss.css.BDzFcWnD.js +0 -154
- package/cdn/sharingPage.BCDR1vjG.js +0 -1
- package/cdn/sharingPageProducts.DfJLxzSf.js +0 -1
- package/cdn/styleManager.Cun1-fKi.js +0 -1
- package/cdn/useGlobalComponents.BokCTIp3.js +0 -1
- package/cdn/useLightDomStyles.DtTuCZg-.js +0 -1
- package/cdn/useReward.0RnHa3DJ.js +0 -1
package/cdn/Banner.CkdY2dLE.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./sharedBaseCss.css.BDzFcWnD.js";import{a as t,i as n,x as r}from"./clientReady.0RgyPOYT.js";import{d as i,v as a}from"./actions-CMPlZ7CH.CnK_0vla.js";import{a as o,d as s,f as c,l,m as u,n as d,p as f,s as p,t as m,u as ee}from"./defaults.euOM2Ohv.js";import{a as h,i as g,n as _,r as v,t as y}from"./GiftIcon.Cwj0ODQr.js";import{t as b}from"./useGlobalComponents.BokCTIp3.js";import{t as x}from"./useLightDomStyles.DtTuCZg-.js";import{r as S}from"./rewards.CRzXPu4f.js";import{t as C}from"./useReward.0RnHa3DJ.js";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`;function te({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return u(`div`,{className:`${E}${o?` ${o}`:``}`,role:`alert`,children:[u(`div`,{className:k,children:[u(`span`,{className:`${A}${s?.icon?` ${s.icon}`:``}`,children:u(_,{width:20,height:20})}),u(`p`,{className:`${j}${s?.title?` ${s.title}`:``}`,children:e})]}),u(`div`,{className:w,children:[u(`p`,{className:`${O}${s?.description?` ${s.description}`:``}`,children:t}),u(`button`,{type:`button`,className:`${D}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,u(g,{width:14,height:14})]})]}),u(`button`,{type:`button`,className:`${T}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:u(h,{width:16,height:16})})]})}var ne=`Banner_frakLogo__1gnumzi9`,re=`Banner_iconSvg__1gnumzi1`,ie=`Banner_referral__1gnumzi2 reset_base__1831jhd0 Banner_rootBase__1gnumzi0`,ae=`Banner_referralBody__1gnumzi5`,oe=`Banner_referralCta__1gnumzi8 sharedBaseCss_buttonReset__7cswil0`,se=`Banner_referralDescription__1gnumzi7 reset_base__1831jhd0`,ce=`Banner_referralIconWrapper__1gnumzi3`,le=`Banner_referralImage__1gnumzi4`,ue=`Banner_referralTitle__1gnumzi6 reset_base__1831jhd0`;function M({placement:h,classname:g=``,interaction:_,referralTitle:w,referralDescription:T,referralCta:E,inappTitle:D,inappDescription:O,inappCta:k,imageUrl:A,preview:j,previewMode:M,allowInappRedirect:N}){let P=!!j,F=o(),I=M===`inapp`?`inapp`:`referral`,L=N===!0||N===`true`,R=d(h),{shouldRender:z,isHidden:B,isClientReady:V}=p();x(`frak-banner`,h,R?.components?.banner?.css,`@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 {
|
|
18
|
-
from {
|
|
19
|
-
opacity: 0;
|
|
20
|
-
transform: translateY(-4px);
|
|
21
|
-
}
|
|
22
|
-
to {
|
|
23
|
-
opacity: 1;
|
|
24
|
-
transform: translateY(0);
|
|
25
|
-
}
|
|
26
|
-
}.inAppBanner_container__1ibpiy70 {
|
|
27
|
-
position: fixed;
|
|
28
|
-
top: max(8px, env(safe-area-inset-top));
|
|
29
|
-
left: 16px;
|
|
30
|
-
right: 16px;
|
|
31
|
-
z-index: 1000;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
gap: 4px;
|
|
35
|
-
padding: 12px 16px;
|
|
36
|
-
padding-right: 32px;
|
|
37
|
-
border-radius: 12px;
|
|
38
|
-
background-color: #000000cc;
|
|
39
|
-
backdrop-filter: blur(12px);
|
|
40
|
-
-webkit-backdrop-filter: blur(12px);
|
|
41
|
-
color: var(--text-onAction__pbq4ak6);
|
|
42
|
-
animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
|
|
43
|
-
}
|
|
44
|
-
.inAppBanner_header__1ibpiy71 {
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
gap: 8px;
|
|
48
|
-
}
|
|
49
|
-
.inAppBanner_iconWrapper__1ibpiy72 {
|
|
50
|
-
flex-shrink: 0;
|
|
51
|
-
width: 20px;
|
|
52
|
-
height: 20px;
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
justify-content: center;
|
|
56
|
-
color: var(--text-onAction__pbq4ak6);
|
|
57
|
-
}
|
|
58
|
-
.inAppBanner_title__1ibpiy73 {
|
|
59
|
-
margin: 0;
|
|
60
|
-
padding: 0;
|
|
61
|
-
font-size: 16px;
|
|
62
|
-
font-weight: 500;
|
|
63
|
-
line-height: 26px;
|
|
64
|
-
color: var(--text-onAction__pbq4ak6);
|
|
65
|
-
}
|
|
66
|
-
.inAppBanner_body__1ibpiy74 {
|
|
67
|
-
display: flex;
|
|
68
|
-
flex-wrap: wrap;
|
|
69
|
-
align-items: baseline;
|
|
70
|
-
gap: 0 4px;
|
|
71
|
-
}
|
|
72
|
-
.inAppBanner_description__1ibpiy75 {
|
|
73
|
-
margin: 0;
|
|
74
|
-
padding: 0;
|
|
75
|
-
font-size: 14px;
|
|
76
|
-
color: var(--text-onAction__pbq4ak6);
|
|
77
|
-
line-height: 22px;
|
|
78
|
-
opacity: 0.96;
|
|
79
|
-
}
|
|
80
|
-
.inAppBanner_cta__1ibpiy76 {
|
|
81
|
-
all: unset;
|
|
82
|
-
display: inline-flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
gap: 4px;
|
|
85
|
-
color: #2bb2ff;
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
font-weight: 600;
|
|
88
|
-
text-decoration: underline;
|
|
89
|
-
text-underline-offset: 2px;
|
|
90
|
-
cursor: pointer;
|
|
91
|
-
}
|
|
92
|
-
.inAppBanner_cta__1ibpiy76:focus-visible {
|
|
93
|
-
outline: 2px solid #2bb2ff;
|
|
94
|
-
outline-offset: 2px;
|
|
95
|
-
border-radius: 4px;
|
|
96
|
-
}
|
|
97
|
-
.inAppBanner_closeButton__1ibpiy77 {
|
|
98
|
-
all: unset;
|
|
99
|
-
position: absolute;
|
|
100
|
-
top: 8px;
|
|
101
|
-
right: 8px;
|
|
102
|
-
width: 28px;
|
|
103
|
-
height: 28px;
|
|
104
|
-
display: flex;
|
|
105
|
-
align-items: center;
|
|
106
|
-
justify-content: center;
|
|
107
|
-
border-radius: 9999px;
|
|
108
|
-
color: #ffffff99;
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
}
|
|
111
|
-
.inAppBanner_closeButton__1ibpiy77:focus-visible {
|
|
112
|
-
outline: 2px solid var(--text-onAction__pbq4ak6);
|
|
113
|
-
outline-offset: 2px;
|
|
114
|
-
}.Banner_rootBase__1gnumzi0 {
|
|
115
|
-
position: relative;
|
|
116
|
-
display: flex;
|
|
117
|
-
animation: keyframes_fadeInDown__mnqmlt2 300ms ease-out;
|
|
118
|
-
}
|
|
119
|
-
.Banner_iconSvg__1gnumzi1 {
|
|
120
|
-
width: 100%;
|
|
121
|
-
height: 100%;
|
|
122
|
-
}
|
|
123
|
-
.Banner_referral__1gnumzi2 {
|
|
124
|
-
flex-direction: row;
|
|
125
|
-
align-items: center;
|
|
126
|
-
gap: 16px;
|
|
127
|
-
padding: 16px;
|
|
128
|
-
background-color: #ffffff;
|
|
129
|
-
color: var(--text-primary__pbq4ak0);
|
|
130
|
-
border: 1px solid var(--border-default__pbq4akv);
|
|
131
|
-
border-radius: 12px;
|
|
132
|
-
}
|
|
133
|
-
.Banner_referralIconWrapper__1gnumzi3 {
|
|
134
|
-
flex-shrink: 0;
|
|
135
|
-
align-self: flex-start;
|
|
136
|
-
display: flex;
|
|
137
|
-
align-items: center;
|
|
138
|
-
justify-content: center;
|
|
139
|
-
width: 40px;
|
|
140
|
-
height: 40px;
|
|
141
|
-
overflow: hidden;
|
|
142
|
-
}
|
|
143
|
-
.Banner_referralImage__1gnumzi4 {
|
|
144
|
-
max-width: 100%;
|
|
145
|
-
max-height: 100%;
|
|
146
|
-
width: auto;
|
|
147
|
-
height: auto;
|
|
148
|
-
object-fit: contain;
|
|
149
|
-
display: block;
|
|
150
|
-
}
|
|
151
|
-
.Banner_referralBody__1gnumzi5 {
|
|
152
|
-
flex: 1;
|
|
153
|
-
min-width: 0;
|
|
154
|
-
}
|
|
155
|
-
.Banner_referralTitle__1gnumzi6 {
|
|
156
|
-
font-size: 16px;
|
|
157
|
-
font-weight: 600;
|
|
158
|
-
color: var(--text-primary__pbq4ak0);
|
|
159
|
-
line-height: 22px;
|
|
160
|
-
}
|
|
161
|
-
.Banner_referralDescription__1gnumzi7 {
|
|
162
|
-
margin-bottom: 8px;
|
|
163
|
-
font-size: 14px;
|
|
164
|
-
color: #979797;
|
|
165
|
-
line-height: 22px;
|
|
166
|
-
}
|
|
167
|
-
.Banner_referralCta__1gnumzi8 {
|
|
168
|
-
display: inline-block;
|
|
169
|
-
padding: 8px 16px;
|
|
170
|
-
border: 1px solid #000000;
|
|
171
|
-
border-radius: 9999px;
|
|
172
|
-
color: var(--text-primary__pbq4ak0);
|
|
173
|
-
font-size: 10px;
|
|
174
|
-
font-weight: 700;
|
|
175
|
-
line-height: 12px;
|
|
176
|
-
text-transform: uppercase;
|
|
177
|
-
}
|
|
178
|
-
.Banner_frakLogo__1gnumzi9 {
|
|
179
|
-
position: absolute;
|
|
180
|
-
right: 16px;
|
|
181
|
-
bottom: 12px;
|
|
182
|
-
pointer-events: none;
|
|
183
|
-
}`,e);let[H,U]=s(!1),[W,G]=s(()=>P?I:L&&t?`inapp`:null),K=l(null);c(()=>{P&&G(I)},[P,I]);let{reward:q}=C(W===`referral`&&V,_,`referee`),[J,de]=s(null);c(()=>{let e=window.FrakSetup?.client;W!==`inapp`||P||!V||!e||i(e).then(e=>de(e)).catch(()=>{})},[W,P,V]),c(()=>{P||!W||H||K.current!==W&&V&&(r(window.FrakSetup?.client,`banner_impression`,{placement:h,variant:W,has_reward:W===`referral`?!!q:void 0}),K.current=W)},[W,H,V,P,h]),c(()=>{if(P||W===`inapp`)return;let e=()=>G(`referral`);return window.addEventListener(a,e),()=>window.removeEventListener(a,e)},[P,W]);let Y=f(async()=>{if(P)return;if(r(window.FrakSetup?.client,`banner_resolved`,{placement:h,variant:W??`referral`,outcome:`clicked`}),W===`referral`){U(!0);return}let e=J;if(!e&&window.FrakSetup?.client)try{e=await i(window.FrakSetup?.client)}catch{}let t=window.location.href;if(e){let n=new URL(t);n.searchParams.set(`fmt`,e),t=n.toString()}n(t)},[P,W,J,h]),fe=f(()=>{P||(r(window.FrakSetup?.client,`banner_resolved`,{placement:h,variant:W??`referral`,outcome:`dismissed`}),U(!0))},[P,W,h]),X=b(),Z=R?.components?.banner??X?.banner,Q=A??Z?.imageUrl,$=ee(()=>{let e=m[F].banner;if(W===`referral`){let t=q?e.referralTitleReward:e.referralTitle;return{title:S(w??Z?.referralTitle??t,q),description:S(T??Z?.referralDescription??e.referralDescription,q),cta:E??Z?.referralCta??e.referralCta}}return{title:S(D??Z?.inappTitle??e.inappTitle,void 0),description:S(O??Z?.inappDescription??e.inappDescription,void 0),cta:k??Z?.inappCta??e.inappCta}},[F,W,q,Z,w,T,E,D,O,k]);if(!W||!P&&(!z||B||H))return null;let pe=[ie,`frak-banner`,`frak-banner--${W}`,g].filter(Boolean).join(` `);return W===`inapp`?u(te,{title:$.title,description:$.description,cta:$.cta,dismissLabel:m[F].banner.dismissLabel,onAction:Y,onDismiss:fe,className:[`frak-banner`,`frak-banner--inapp`,g].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):u(`div`,{class:pe,role:`alert`,children:[u(`div`,{class:`${ce} frak-banner__icon`,children:Q?u(`img`,{src:Q,alt:``,class:le}):u(y,{class:re})}),u(`div`,{class:`${ae} frak-banner__text`,children:[u(`p`,{class:`${ue} frak-banner__title`,children:$.title}),u(`p`,{class:`${se} frak-banner__description`,children:$.description}),u(`button`,{type:`button`,class:`${oe} frak-banner__cta`,onClick:Y,children:$.cta})]}),u(v,{class:`${ne} frak-banner__logo`,width:42,height:24})]})}export{M as Banner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{x as e}from"./clientReady.0RgyPOYT.js";import{t}from"./sharingPage.BCDR1vjG.js";import{a as n,m as r,n as i,p as a,s as o,t as s,u as c}from"./defaults.euOM2Ohv.js";import{t as l}from"./useGlobalComponents.BokCTIp3.js";import{t as u}from"./useLightDomStyles.DtTuCZg-.js";import{r as d}from"./rewards.CRzXPu4f.js";import{t as f}from"./useReward.0RnHa3DJ.js";import{t as p}from"./embeddedWallet.tIACkcKW.js";function m({placement:m,text:h,classname:g=``,noRewardText:_,targetInteraction:v,clickAction:y,preview:b}){let x=!!b,S=n(),C=i(m),w=l(),T=C?.components?.buttonShare??w?.buttonShare;u(`frak-button-share`,m,T?.css);let E=c(()=>C?.targetInteraction===void 0?v:C.targetInteraction,[C?.targetInteraction,v]),D=T?.text??h??s[S].buttonShare.text,O=T?.noRewardText??_,k=c(()=>D.includes(`{REWARD}`),[D]),A=c(()=>T?.clickAction??y??`sharing-page`,[T?.clickAction,y]),{shouldRender:j,isHidden:M,isClientReady:N}=o(),{reward:P}=f(k&&N,E),F=c(()=>k?P?d(D,P):O??d(D,void 0):D,[k,D,O,P]),I=a(()=>{if(!x){if(e(window.FrakSetup.client,`share_button_clicked`,{placement:m,target_interaction:E,has_reward:!!P,click_action:A}),A===`embedded-wallet`){p(E,m);return}t(E,m)}},[x,A,E,m,P]);if(!x&&(!j||M))return null;let L=[`button`,`button__fadeIn`,g].filter(Boolean).join(` `);return r(`button`,{type:`button`,disabled:!x&&!N,class:L,onClick:I,children:F})}export{m as ButtonShare};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{a as e,d as t,f as n,h as r,m as i,n as a,r as o,s,t as c,u as l}from"./defaults.euOM2Ohv.js";import{t as u}from"./useReward.0RnHa3DJ.js";import{t as d}from"./embeddedWallet.tIACkcKW.js";function f(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 p(){`vibrate`in navigator?navigator.vibrate(10):console.log(`Vibration not supported`)}function m(e,t){p(),d(e,t)}function h({placement:d,classname:p=``,useReward:h,targetInteraction:g}){let _=e(),v=a(d),y=l(()=>v?.targetInteraction===void 0?g:v.targetInteraction,[v?.targetInteraction,g]),b=l(()=>h===!0,[h]),{shouldRender:x,isHidden:S,isClientReady:C}=s(),{reward:w}=u(b&&C,y),[T,E]=t(`right`);if(n(()=>{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`,p].filter(Boolean).join(` `);return i(r,{children:[i(`style`,{children:o(`
|
|
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":c[_].buttonWallet.ariaLabel,part:`button`,disabled:!C,class:D,onClick:()=>{m(y,d)},children:[i(f,{}),w&&i(`span`,{class:`reward`,children:w})]})]})}export{h as ButtonWallet};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e,h as t,m as n,x as r}from"./clientReady.0RgyPOYT.js";import{a as i,m as a,n as o,s,t as c,u as l}from"./defaults.euOM2Ohv.js";import{t as u}from"./useLightDomStyles.DtTuCZg-.js";function d(t=`wallet`,i){let a=window.FrakSetup?.client;a&&r(a,`open_in_app_clicked`,{path:t,placement:i}),e(`${n}${t}`,{onFallback:()=>{a&&r(a,`app_not_installed`,{path:t,placement:i})}})}function f(){return{isMobile:l(()=>t(),[])}}function p({placement:e,text:t,classname:n=``}){let r=i(),l=o(e),{shouldRender:p,isHidden:m,isClientReady:h}=s(),{isMobile:g}=f();u(`frak-open-in-app`,e,l?.components?.openInApp?.css);let _=l?.components?.openInApp?.text??t??c[r].openInApp.text;if(!g||!p||m)return null;let v=()=>{d(void 0,e)},y=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return a(`button`,{type:`button`,"aria-label":c[r].openInApp.ariaLabel,disabled:!h,class:y,onClick:v,children:_})}export{p as OpenInAppButton};
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./sharedBaseCss.css.BDzFcWnD.js";import{B as t,x as n,z as r}from"./clientReady.0RgyPOYT.js";import{m as i,r as a,u as o}from"./actions-CMPlZ7CH.CnK_0vla.js";import{t as s}from"./sharingPage.BCDR1vjG.js";import{n as c}from"./sharingPageProducts.DfJLxzSf.js";import{a as ee,d as l,f as u,l as te,m as d,n as f,p,s as m,t as h,u as g}from"./defaults.euOM2Ohv.js";import{r as ne,t as re}from"./GiftIcon.Cwj0ODQr.js";import{t as ie}from"./useGlobalComponents.BokCTIp3.js";import{t as ae}from"./useLightDomStyles.DtTuCZg-.js";import{i as oe,n as _,r as v}from"./rewards.CRzXPu4f.js";var y=`PostPurchase_card__5fv5lh0`,se=`PostPurchase_cardLayout__5fv5lh1`,ce=`PostPurchase_cardLeft__5fv5lh2`,b=`PostPurchase_cardRight__5fv5lh3`,x=`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 S({customerId:_,orderId:S,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=ee();ae(`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
|
-
}`,e);let[H,_e]=l(null),[U,W]=l(!1);u(()=>{I||!z||!_||!S||!C||a({customerId:_,orderId:S,token:C,merchantId:w}).catch(()=>{})},[I,z,_,S,C,w]),u(()=>{if(I||!z||U)return;let e=window.FrakSetup?.client;e&&Promise.all([o(e),i(e)]).then(([t,n])=>{W(!0),_e(he(t,n,e.config.metadata?.currency))}).catch(e=>{if(e instanceof t&&e.code===r.configError){W(!0);return}console.warn(`[Frak] Post-purchase context error`,e)})},[I,z,U]);let G=te(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 oe(H.reward,e)},[H?.reward]),ve=ie(),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]);u(()=>{K&&G.current!==K&&z&&(!I&&(!L||R)||(n(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(()=>c(P),[P]),ye=p(()=>{K&&(n(window.FrakSetup?.client,`post_purchase_clicked`,{placement:T,variant:K}),s(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:se,children:[d(`div`,{class:ce,children:[X&&d(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:X}),d(`p`,{class:me,children:Q.message}),d(`button`,{type:`button`,className:`${x} 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:b,children:[Z?d(`span`,{class:pe,children:d(`img`,{src:Z,alt:``,class:le})}):d(re,{className:de,width:80,height:80}),d(ne,{className:ue,width:42,height:24})]})]})})}export{S as PostPurchase};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{I as e,L as t,M as n,N as r,O as i,R as a,b as o,j as s,k as c,x as l}from"./clientReady.0RgyPOYT.js";async function u(e,t,n){return await e.request({method:`frak_displayEmbeddedWallet`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function d(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 f(e,t,n){return await e.request({method:`frak_displaySharingPage`,params:n?[t,e.config.metadata,n]:[t,e.config.metadata]})}async function p(t){if(typeof window>`u`)return;let r=e();if(!r)return;let i=await o.resolveMerchantId();if(!i)return;let a=`frak-identity-ensured-${i}`;if(!window.sessionStorage.getItem(a))try{let e=n();(await fetch(`${e}/user/identity/ensure`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"x-wallet-sdk-auth":t,"x-frak-client-id":r},body:JSON.stringify({merchantId:i})})).ok&&window.sessionStorage.setItem(a,`1`)}catch{}}async function m(e,n){return t(()=>e.request({method:`frak_getMerchantInformation`}),{cacheKey:`frak_getMerchantInformation`,cacheTime:n?.cacheTime})}async function h(e,n){return t(()=>e.request({method:`frak_getMergeToken`}),{cacheKey:`frak_getMergeToken`,cacheTime:n?.cacheTime})}async function g(e,n){return t(()=>e.request({method:`frak_getUserReferralStatus`}),{cacheKey:`frak_getUserReferralStatus`,cacheTime:n?.cacheTime})}async function _(e,t){let{metadata:n,customizations:r}=e.config;return await e.request({method:`frak_prepareSso`,params:[t,n.name,r?.css]})}async function v(t,n){try{await t.request({method:`frak_sendInteraction`,params:[n,{clientId:e()}]})}catch{console.warn(`[Frak SDK] Failed to send interaction:`,n.type)}}function y(e,t,n){return c(t)?(l(e,`user_referred_started`,{referrer_client_id:t.c,referrer_wallet:t.w,wallet_status:n?.key}),v(e,{type:`arrival`,referrerClientId:t.c,referrerMerchantId:t.m,referrerWallet:t.w,referralTimestamp:t.t}),!0):i(t)?(l(e,`user_referred_started`,{referrer:t.r,wallet_status:n?.key}),v(e,{type:`arrival`,referrerWallet:t.r}),!0):!1}function b(t,n){let r=e();return!r&&!n?null:{v:2,m:t,t:Math.floor(Date.now()/1e3),...r?{c:r}:{},...n?{w:n}:{}}}function x(t,n){return c(t)?t.w&&n?.wallet?r(t.w,n.wallet):t.c?e()===t.c:!1:i(t)&&n?.wallet?r(t.r,n.wallet):!1}function S(e,{walletStatus:t,frakContext:n,options:r}){if(!n)return`no-referrer`;if(x(n,t))return`self-referral`;if(!y(e,n,t))return`no-referrer`;let i=c(n)?n.m:r?.merchantId,a=r?.alwaysAppendUrl&&i?b(i,t?.wallet):null;return s.replaceUrl({url:window.location?.href,context:a}),l(e,`user_referred_completed`,{status:`success`}),`success`}async function C(e,{options:t}={}){let n=s.parse({url:window.location.href}),r=await D(e);try{return S(e,{walletStatus:r,frakContext:n,options:t})}catch(e){console.warn(`Error processing referral`,{error:e})}}const w=`frak:referral-success`;async function T(e){try{await C(e)===`success`&&window.dispatchEvent(new Event(w))}catch(e){console.warn(`[Frak] Referral setup failed`,e)}}async function E(t){if(typeof window>`u`){console.warn(`[Frak] No window found, can't track purchase`);return}let r=window.sessionStorage.getItem(`frak-wallet-interaction-token`),i=e();if(!r&&!i){console.warn(`[Frak] No identity found, skipping purchase check`);return}let a=t.merchantId??await o.resolveMerchantId();if(!a){console.warn(`[Frak] No merchant id found, skipping purchase check`);return}let s={Accept:`application/json`,"Content-Type":`application/json`};r&&(s[`x-wallet-sdk-auth`]=r),i&&(s[`x-frak-client-id`]=i);let c=n();await fetch(`${c}/user/track/purchase`,{method:`POST`,headers:s,body:JSON.stringify({customerId:t.customerId,orderId:t.orderId,token:t.token,merchantId:a})})}function D(e,t){if(!t)return e.request({method:`frak_listenToWalletStatus`}).then(t=>(O(e,t),t));let n=new a,r=!1;return e.listenerRequest({method:`frak_listenToWalletStatus`},i=>{O(e,i),t(i),r||=(n.resolve(i),!0)}),n.promise}function O(e,t){typeof window>`u`||(e.openPanel?.setGlobalProperties({wallet:t.wallet??null}),t.interactionToken?(window.sessionStorage.setItem(`frak-wallet-interaction-token`,t.interactionToken),p(t.interactionToken)):window.sessionStorage.removeItem(`frak-wallet-interaction-token`))}function k(e,{metadata:t,login:n}){return A(e,{steps:{login:n??{}},metadata:t})}function A(e,t){function n(n){return A(e,{...t,steps:{...t.steps,sendTransaction:n}})}function r(n){return A(e,{...t,steps:{...t.steps,final:{...n,action:{key:`reward`}}}})}function i(n,r){return A(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 d(e,t,r)}return{params:t,sendTx:n,reward:r,sharing:i,display:a}}async function j(e,{tx:t,metadata:n}){return(await d(e,{metadata:n,steps:{login:{},sendTransaction:{tx:t}}})).sendTransaction}function M(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 N(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 d(e,{metadata:n,steps:{login:{},siweAuthenticate:{siwe:{...t,statement:i,nonce:t?.nonce??M(),uri:t?.uri??`https://${r}`,version:t?.version??`1`,domain:r}}}})).siweAuthenticate}export{v as _,S as a,d as c,h as d,j as f,u as g,p as h,N as i,f as l,m,D as n,T as o,k as p,E as r,_ as s,C as t,g as u,w as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={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 t=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}}},n=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 r(e){let{emittingTransport:r,listeningTransport:i,targetOrigin:a,middleware:o=[],lifecycleHandlers:s}=e,c=new Map;function l(e){return typeof e!=`object`||!e?!1:`clientLifecycle`in e||`iframeLifecycle`in e}function u(e){return typeof e!=`object`||!e?!1:`id`in e&&`topic`in e&&`data`in e}async function d(e){try{`clientLifecycle`in e&&s?.clientLifecycle?await s.clientLifecycle(e,{origin:a,source:null}):`iframeLifecycle`in e&&s?.iframeLifecycle&&await s.iframeLifecycle(e,{origin:a,source:null})}catch(e){console.error(`[RPC Client] Lifecycle handler error:`,e)}}async function f(e){let t={origin:a,source:null};for(let n of o)n.onRequest&&await n.onRequest(e,t);return e}async function p(e,t){let n={origin:a,source:null},r=t;for(let t of o)t.onResponse&&(r=await t.onResponse(e,r,n));return r}async function m(e){try{let t=new URL(e.origin).origin.toLowerCase(),n=new URL(a).origin.toLowerCase();if(t!==n){console.log(`Not expected origin`,t,n);return}}catch(e){console.error(`[RPC Client] Invalid origin`,e);return}if(l(e.data)){await d(e.data);return}if(!u(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=c.get(e.data.id);n&&n(t)}async function h(e){let t=e;try{t=await f(e)}catch(e){throw console.error(`[RPC Client] Middleware error on request:`,e),e}r.postMessage(t,a)}function g(e){r.postMessage(e,a)}function _(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}i.addEventListener(`message`,m);function v(e){let r=_(),i=new n;return c.set(r,e=>{e.error?i.reject(new t(e.error.code,e.error.message,e.error.data)):i.resolve(e.result),c.delete(r)}),h({id:r,topic:e.method,data:{method:e.method,params:e.params}}).catch(e=>{c.delete(r),i.reject(e)}),i.promise}function y(e,t){let n=_();return c.set(n,e=>{e.error?(console.error(`[RPC Client] Listener error:`,e.error),c.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),c.delete(n)}),()=>{c.delete(n)}}function b(){i.removeEventListener(`message`,m),c.clear()}return{request:v,listen:y,sendLifecycle:g,cleanup:b}}function i(e){return new TextEncoder().encode(JSON.stringify(e))}function a(e){try{return JSON.parse(new TextDecoder().decode(e))}catch{return null}}const o=`frak-client-id`;function s(){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 c(){if(typeof window>`u`||!window.localStorage)return console.warn(`[Frak SDK] No Window / localStorage available to save the clientId`),s();let e=localStorage.getItem(o);return e||(e=s(),localStorage.setItem(o,e)),e}var l=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 u;function d(){return u||={promiseCache:new l(1024),responseCache:new l(1024),failureCache:new l(1024)},u}async function f(e,{cacheKey:t,cacheTime:n=3e4}){let{promiseCache:r,responseCache:i,failureCache:a}=d();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 p(){u&&(u.promiseCache.clear(),u.responseCache.clear(),u.failureCache.clear())}const m=`https://backend.frak.id`;function h(e){return e.includes(`localhost:3000`)||e.includes(`localhost:3010`)}function g(e){return h(e)?`https://localhost:3030`:e.includes(`wallet-dev.frak.id`)||e.includes(`wallet.gcp-dev.frak.id`)?`https://backend.gcp-dev.frak.id`:m}function _(e){if(e)return g(e);if(typeof window<`u`){let e=window.FrakSetup?.client?.config?.walletUrl;if(e)return g(e)}return m}const v=`__frakSdkConfig`,y=`frak-config-cache`,b=`frak-merchant-id`,x={key:y},S=typeof window<`u`;function C(){return{isResolved:!1,merchantId:``}}let w=null;function ee(){if(!S)return null;try{let e=localStorage.getItem(x.key);if(!e)return null;let t=JSON.parse(e);return t.config?.isResolved?(w=t,t):null}catch{return null}}function te(){return(w??ee())?.config}function ne(){let e=w??ee();return e?Date.now()-e.timestamp<3e4:!1}function re(e){if(!(!S||!e.isResolved))try{let t={config:e,timestamp:Date.now()};localStorage.setItem(x.key,JSON.stringify(t)),w=t}catch{}}function ie(){if(S){w=null;try{localStorage.removeItem(x.key)}catch{}}}function ae(){S&&(window[v]||(window[v]=te()??C()))}function T(){return S?(ae(),window[v]??C()):C()}function E(e){S&&window.dispatchEvent(new CustomEvent(`frak:config`,{detail:e}))}function oe(e){return e??(S?window.location.hostname:``)}async function se(e,t,n){try{let r=_(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(S)try{sessionStorage.setItem(b,o.merchantId)}catch{}return o}catch(e){console.warn(`[Frak SDK] Failed to fetch merchant config:`,e);return}}const D={getConfig:T,get isResolved(){return T().isResolved},get isCacheFresh(){return ne()},setCacheScope(e,t){let n=`${e}:${t??``}`;x.key=`${y}:${n}`,w=null},setConfig(e){if(S&&(window[v]=e),re(e),E(e),S&&e.merchantId)try{sessionStorage.setItem(b,e.merchantId)}catch{}},reset(){let e=te()??C();S&&(window[v]=e),E(e)},clearCache(){if(ie(),p(),S)try{sessionStorage.removeItem(b)}catch{}},resolve(e,t,n){let r=oe(e);return r?f(async()=>{let e=await se(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=T();if(e.isResolved&&e.merchantId)return e.merchantId;if(S)try{return sessionStorage.getItem(b)??void 0}catch{}},async resolveMerchantId(e,t){return D.getMerchantId()||(await D.resolve(e,t))?.merchantId}};function O(e){return btoa(Array.from(e,e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function k(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 A(e){return O(i(e))}function j(e,t,n,r,i,a){let o=A(ce({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 ce(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 M=`menubar=no,status=no,scrollbars=no,fullscreen=no,width=500, height=800`,N=`frak-sso`;async function le(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??j(i??`https://wallet.frak.id`,a,await D.resolveMerchantId()??``,n.name,c(),r?.css),s=window.open(o,N,M);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 ue(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 de(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 P(e,t){let n=t.toLowerCase(),r=[...e.keys()].filter(e=>e.toLowerCase()===n);for(let t of r)e.delete(t)}const fe=/^0x[a-fA-F0-9]{40}$/;function F(e){return typeof e==`string`&&fe.test(e)}function pe(e,t){return e.toLowerCase()===t.toLowerCase()}function me(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 he=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ge(e){let t=`0x`;for(let n=0;n<20;n++)t+=he[e[n]];return t}function _e(e){return`r`in e&&!(`v`in e)}function I(e){return`v`in e&&e.v===2}const ve=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function L(e){return typeof e==`string`&&ve.test(e)}function R(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 z(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 ye(e){if(!L(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`&&F(e.w);if(!t&&!n||t&&!L(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(R(e.m),a),a+=16,i.setUint32(a,e.t,!1),a+=4,t&&(r.set(R(e.c),a),a+=16),n&&(r.set(me(e.w),a),a+=20),r}function be(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=z(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=z(e.subarray(a,a+16)),a+=16),r){let t=ge(e.subarray(a,a+20));if(!F(t))return null;c.w=t,a+=20}return c}const B=`fCtx`;function V(e){if(e)try{if(I(e)){let t=ye(e);return t?O(t):void 0}return O(me(e.r))}catch(t){console.error(`Error compressing Frak context`,{e:t,context:e})}}function H(e){if(!(!e||e.length===0))try{let t=k(e);if(t.length!==20)return be(t)||void 0;let n=ge(t);if(F(n))return{r:n}}catch(t){console.error(`Error decompressing Frak context`,{e:t,context:e})}}function xe({url:e}){if(!e)return null;let t=de(new URL(e).searchParams,B);return t?H(t):null}function Se(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 Ce(e,t){let n=Se(t??{});for(let[t,r]of Object.entries(n))r===void 0||r===``||e.searchParams.has(t)||e.searchParams.set(t,r)}function U({url:e,context:t,attribution:n}){if(!e)return null;let r=V(t);if(!r)return null;let i=new URL(e);return P(i.searchParams,B),i.searchParams.set(B,r),Ce(i,n),i.toString()}function W(e){let t=new URL(e);return P(t.searchParams,B),t.toString()}function we({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?W(n):U({url:n,context:t}),r&&window.history.replaceState(null,``,r.toString())}const Te={compress:V,decompress:H,parse:xe,update:U,remove:W,replaceUrl:we},G={eur:`fr-FR`,usd:`en-US`,gbp:`en-GB`};function K(e){return e&&e in G?e:`eur`}function Ee(e){return e?G[e]??G.eur:G.eur}function De(e,t){let n=Ee(t),r=K(t);return e.toLocaleString(n,{style:`currency`,currency:r,minimumFractionDigits:0,maximumFractionDigits:2})}function Oe(e){return e?`${e}Amount`:`eurAmount`}var ke=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)}},Ae=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 ke({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)}},je=typeof document<`u`?document.currentScript:null;function Me(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(`-`,``).replace(`_`,``))}var Ne=class extends Ae{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=je,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.CgBxdfNp.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[Me(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 q=`nexus-wallet-backup`,J=`frakwallet://`;function Y(e){let t=e?.split(`-`)[0]?.toLowerCase();return t===`en`||t===`fr`?t:void 0}function Pe(){return(typeof document<`u`?Y(document.documentElement.lang):void 0)||(typeof navigator<`u`?Y(navigator.language):void 0)}function Fe(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 Ie(){let e=navigator.userAgent;return/Android/i.test(e)&&/Chrome\/\d+/i.test(e)}const Le=J.replace(`://`,``);function Re(e){return`intent://${e.slice(13)}#Intent;scheme=${Le};end`}function ze(e,t){let n=t?.timeout??2500,r=!1,i=()=>{document.hidden&&(r=!0)};document.addEventListener(`visibilitychange`,i);let a=Ie()&&Be(e)?Re(e):e;window.location.href=a,setTimeout(()=>{document.removeEventListener(`visibilitychange`,i),r||t?.onFallback?.()},n)}function Be(e){return e.startsWith(J)}function Ve(){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 X=Ve();function He(){return typeof navigator>`u`?!1:X?!0:/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Ue(){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 We=Ue();function Ge(e){X&&e.startsWith(`https://`)?window.location.href=`x-safari-https://${e.slice(8)}`:X&&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 Z={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 Ke({walletBaseUrl:e,config:t}){let n=document.querySelector(`#frak-wallet`);n&&n.remove();let r=document.createElement(`iframe`);r.id=Z.id,r.name=Z.name,r.allow=Z.allow,r.style.zIndex=Z.style.zIndex.toString(),Q({iframe:r,isVisible:!1});let i=t?.walletUrl??e??`https://wallet.frak.id`,a=c();return Ye(i),Ye(_(i)),r.src=qe({walletUrl:i,clientId:a,preload:t?.preload}),new Promise(e=>{r.addEventListener(`load`,()=>e(r)),document.body.appendChild(r)})}function qe({walletUrl:e,clientId:t,preload:n}){let r=`${e}/listener?clientId=${encodeURIComponent(t)}`;return!n||n.length===0?r:`${r}#preload=${n.join(`,`)}`}function Q({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 Je(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 Ye(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 Xe=X&&We;function Ze(e){e?localStorage.setItem(q,e):localStorage.removeItem(q)}function $(e,t){try{let n=new URL(e);if(!n.searchParams.has(`u`))return e;let r=et(window.location.href,t);return n.searchParams.delete(`u`),n.searchParams.append(`u`,r),n.toString()}catch{return e}}function Qe(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 $e(e){return e.includes(`/common/social`)}function et(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 tt(e,t,n,r,i){if(i){let e=$(t,r);window.open(e,`_blank`);return}if(Be(t)){let i=$(t,r);ze(i,{onFallback:()=>{e.contentWindow?.postMessage({clientLifecycle:`deep-link-failed`,data:{originalUrl:i}},n)}})}else if(Xe&&$e(t))Qe(r);else{let e=$(t,r);window.location.href=e}}function nt({iframe:e,targetOrigin:t}){let r=new n;return{handleEvent:n=>{if(!(`iframeLifecycle`in n))return;let{iframeLifecycle:i,data:a}=n;switch(i){case`connected`:r.resolve(!0);break;case`do-backup`:Ze(a.backup);break;case`remove-backup`:localStorage.removeItem(q);break;case`show`:case`hide`:Q({iframe:e,isVisible:i===`show`});break;case`redirect`:tt(e,a.baseRedirectUrl,t,a.mergeToken,a.openInNewTab);break}},isConnected:r.promise}}function rt({config:i,iframe:a}){let o=i?.walletUrl??`https://wallet.frak.id`,s=i.metadata.lang??Pe(),l=i.domain??(typeof window<`u`?window.location.hostname:``);D.setCacheScope(l,s),D.reset();let u=D.isCacheFresh?void 0:D.resolve(i.domain,i.walletUrl,s),d=nt({iframe:a,targetOrigin:o}),f=new n,m=Date.now();if(!a.contentWindow)throw new t(e.configError,`The iframe does not have a content window`);let h=r({emittingTransport:a.contentWindow,listeningTransport:window,targetOrigin:o,middleware:[{async onRequest(n,r){if(!await d.isConnected)throw new t(e.clientNotConnected,`The iframe provider isn't connected yet`);return await f.promise,r}}],lifecycleHandlers:{iframeLifecycle:(e,t)=>{d.handleEvent(e)}}}),g=it(h,d),_=async()=>{g(),h.cleanup(),a.remove(),p(),D.clearCache(),D.reset()},v;{console.log(`[Frak SDK] Initializing OpenPanel`),v=new Ne({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.1`,user_anonymous_client_id:c()}),!0)}),v.setGlobalProperties({sdk_version:`1.2.1`,user_anonymous_client_id:c()}),v.init(),v.track(`sdk_initialized`,{sdk_version:`1.2.1`});let e=!1,t=setTimeout(()=>{e||(e=!0,v?.track(`sdk_iframe_handshake_failed`,{reason:`timeout`}))},3e4);d.isConnected.then(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_connected`,{handshake_duration_ms:Date.now()-m}))}).catch(()=>{e||(e=!0,clearTimeout(t),v?.track(`sdk_iframe_handshake_failed`,{reason:`unknown`}))})}let y=at({config:i,rpcClient:h,lifecycleManager:d,configPromise:u,contextSent:f,openPanel:v}).then(()=>{}).catch(e=>{throw f.reject(e),e});return{config:i,waitForConnection:d.isConnected,waitForSetup:y,request:h.request,listenerRequest:h.listen,destroy:_,openPanel:v}}function it(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 at({config:e,rpcClient:t,lifecycleManager:n,configPromise:r,contextSent:i,openPanel:a}){await n.isConnected,Fe(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 l=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;D.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})},u=!1,d=e=>{let n=u?void 0:s;u=!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=c();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}}})};D.isResolved&&(d(D.getConfig()),i.resolve()),r&&(l(await r),d(D.getConfig()),i.resolve());async function f(){let n=e.customizations?.css;n&&t.sendLifecycle({clientLifecycle:`modal-css`,data:{cssLink:n}})}async function p(){let n=e.customizations?.i18n;n&&t.sendLifecycle({clientLifecycle:`modal-i18n`,data:{i18n:n}})}async function m(){if(typeof window>`u`)return;let e=window.localStorage.getItem(q);e&&t.sendLifecycle({clientLifecycle:`restore-backup`,data:{backup:e}})}(await Promise.allSettled([f(),p(),m()])).some(e=>e.status===`rejected`)&&a?.track(`sdk_iframe_handshake_failed`,{reason:`asset_push`})}function ot(e){return a(k(e))}async function st({config:e}){let t=ct(e),n=await Ke({config:t});if(!n){console.error(`Failed to create iframe`);return}let r=rt({config:t,iframe:n});if(await r.waitForSetup,!await r.waitForConnection){console.error(`Failed to connect to client`);return}return r}function ct(e){let t=K(e.metadata?.currency);return{...e,metadata:{...e.metadata,currency:t}}}function lt({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}const ut=`frak:client`;function dt(){let e=new CustomEvent(ut);window.dispatchEvent(e)}function ft(e,t){if(window.FrakSetup?.client&&e===`add`){t();return}(e===`add`?window.addEventListener:window.removeEventListener)(ut,t,!1)}export{p as A,t as B,P as C,le as D,O as E,k as F,c as I,f as L,_ as M,pe as N,_e as O,j as P,n as R,de as S,N as T,De as _,We as a,D as b,lt as c,Z as d,ze as f,Oe as g,He as h,Ge as i,Te as j,I as k,st as l,J as m,ft as n,ot as o,Pe as p,X as r,rt as s,dt as t,Je as u,K as v,M as w,ue as x,A as y,e as z};
|
package/cdn/defaults.euOM2Ohv.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import{b as e,n as t,p as n}from"./clientReady.0RgyPOYT.js";var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_={},v=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function S(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function C(e,t,n){var i,a,o,s={};for(o in t)o==`key`?i=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?r.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return w(e,s,i,a,null)}function w(e,t,n,r,o){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++a,__i:-1,__u:0};return o==null&&i.vnode!=null&&i.vnode(s),s}function T(e){return e.children}function E(e,t){this.props=e,this.context=t}function D(e,t){if(t==null)return e.__?D(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?D(e):null}function O(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],a=[],o=x({},t);o.__v=t.__v+1,i.vnode&&i.vnode(o),ie(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??D(t),!!(32&t.__u),a),o.__v=t.__v,o.__.__k[o.__i]=o,oe(r,o,a),t.__e=t.__=null,o.__e!=n&&k(o)}}function k(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),k(e)}function A(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!j.__r++||s!=i.debounceRendering)&&((s=i.debounceRendering)||c)(j)}function j(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(l),e=o.shift(),t=o.length,O(e)}finally{o.length=j.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,y,b=r&&r.__k||v,x=t.length;for(c=M(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||_,p.__i=d,g=ie(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&I(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(y=!!(4&p.__u))||f.__k===p.__k?(c=N(p,c,e,y),y&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function M(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=w(null,o,null,null,null):b(o)?o=e.__k[a]=w(T,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=w(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=D(s)),le(s,s));return r}function N(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=N(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=D(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function P(e,t){return t||=[],e==null||typeof e==`boolean`||(b(e)?e.some(function(e){P(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ne(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||y.test(t)?n:n+`px`}function F(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ne(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(p,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[f]=r[f]:(n[f]=m,e.addEventListener(t,a?g:h,a)):e.removeEventListener(t,a?g:h,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function re(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[d]==null)t[d]=m++;else if(t[d]<n[f])return;return n(i.event?i.event(t):t)}}}function ie(e,t,n,r,a,o,s,c,l,u){var d,f,p,m,h,g,_,y,C,w,D,O,k,A,j,M,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=i.__b)&&d(t);n:if(typeof N==`function`){f=s.length;try{if(C=t.props,w=N.prototype&&N.prototype.render,D=(d=N.contextType)&&r[d.__c],O=d?D?D.props.value:d.__:r,n.__c?y=(p=t.__c=n.__c).__=p.__E:(w?t.__c=p=new N(C,O):(t.__c=p=new E(C,O),p.constructor=N,p.render=ue),D&&D.sub(p),p.state||={},p.__n=r,m=p.__d=!0,p.__h=[],p._sb=[]),w&&p.__s==null&&(p.__s=p.state),w&&N.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=x({},p.__s)),x(p.__s,N.getDerivedStateFromProps(C,p.__s))),h=p.props,g=p.state,p.__v=t,m)w&&N.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),w&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(w&&N.getDerivedStateFromProps==null&&C!==h&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(C,O),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&!1===p.shouldComponentUpdate(C,p.__s,O)){t.__v!=n.__v&&(p.props=C,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),v.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&s.push(p);break n}p.componentWillUpdate!=null&&p.componentWillUpdate(C,p.__s,O),w&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(h,g,_)})}if(p.context=O,p.props=C,p.__P=e,p.__e=!1,k=i.__r,A=0,w)p.state=p.__s,p.__d=!1,k&&k(t),d=p.render(p.props,p.state,p.context),v.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,k&&k(t),d=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++A<25);p.state=p.__s,p.getChildContext!=null&&(r=x(x({},r),p.getChildContext())),w&&!m&&p.getSnapshotBeforeUpdate!=null&&(_=p.getSnapshotBeforeUpdate(h,g)),j=d!=null&&d.type===T&&d.key==null?se(d.props.children):d,c=ee(e,b(j)?j:[j],t,n,r,a,o,s,c,l,u),p.base=t.__e,t.__u&=-161,p.__h.length&&s.push(p),y&&(p.__E=p.__=null)}catch(e){if(s.length=f,t.__v=null,l||o!=null){if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),t.__e=c}else if(o!=null)for(M=o.length;M--;)S(o[M])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||ae(t),i.__e(e,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ce(n.__e,t,n,r,a,o,s,l,u);return(d=i.diffed)&&d(t),128&t.__u?void 0:c}function ae(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ae))}function oe(e,t,n){for(var r=0;r<n.length;r++)I(n[r],n[++r],n[++r]);i.__c&&i.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){i.__e(e,t.__v)}})}function se(e){return typeof e!=`object`||!e||e.__b>0?e:b(e)?e.map(se):e.constructor===void 0?x({},e):null}function ce(e,t,n,a,o,s,c,l,u){var d,f,p,m,h,g,v,y=n.props||_,x=t.props,C=t.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((h=s[d])&&`setAttribute`in h==!!C&&(C?h.localName==C:h.nodeType==3)){e=h,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(x);e=document.createElementNS(o,C,x.is&&x),l&&=(i.__m&&i.__m(t,s),!1),s=null}if(C==null)y===x||l&&e.data==x||(e.data=x);else{if(s=C==`textarea`&&x.defaultValue!=null?null:s&&r.call(e.childNodes),!l&&s!=null)for(y={},d=0;d<e.attributes.length;d++)y[(h=e.attributes[d]).name]=h.value;for(d in y)h=y[d],d==`dangerouslySetInnerHTML`?p=h:d==`children`||d in x||d==`value`&&`defaultValue`in x||d==`checked`&&`defaultChecked`in x||F(e,d,null,h,o);for(d in x)h=x[d],d==`children`?m=h:d==`dangerouslySetInnerHTML`?f=h:d==`value`?g=h:d==`checked`?v=h:l&&typeof h!=`function`||y[d]===h||F(e,d,h,y[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,b(m)?m:[m],t,n,a,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&D(n,0),l,u),s!=null)for(d=s.length;d--;)S(s[d]);l&&C!=`textarea`||(d=`value`,C==`progress`&&g==null?e.removeAttribute(`value`):g!=null&&(g!==e[d]||C==`progress`&&!g||C==`option`&&g!=y[d])&&F(e,d,g,y[d],o),d=`checked`,v!=null&&v!=e[d]&&F(e,d,v,y[d],o))}return e}function I(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){i.__e(e,n)}}function le(e,t,n){var r,a;if(i.unmount&&i.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||I(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){i.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(a=0;a<r.length;a++)r[a]&&le(r[a],t,n||typeof e.type!=`function`);n||S(e.__e),e.__c=e.__=e.__e=void 0}function ue(e,t,n){return this.constructor(e,n)}r=v.slice,i={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},a=0,E.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=x({},this.state);typeof e==`function`&&(e=e(x({},n),this.props)),e&&x(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),A(this))},E.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),A(this))},E.prototype.render=T,o=[],c=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,l=function(e,t){return e.__v.__b-t.__v.__b},j.__r=0,u=Math.random().toString(8),d=`__d`+u,f=`__a`+u,p=/(PointerCapture)$|Capture$/i,m=0,h=re(!1),g=re(!0);var de=0;Array.isArray;function fe(e,t,n,r,a,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--de,__i:-1,__u:0,__source:a,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return i.vnode&&i.vnode(u),u}var L,R,z,pe,B=0,me=[],V=i,he=V.__b,ge=V.__r,_e=V.diffed,ve=V.__c,ye=V.unmount,be=V.__;function H(e,t){V.__h&&V.__h(R,e,B||t),B=0;var n=R.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function U(e){return B=1,xe(Oe,e)}function xe(e,t,n){var r=H(L++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Oe(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=R,!R.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};R.__f=!0;var a=R.shouldComponentUpdate,o=R.componentWillUpdate;R.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},R.shouldComponentUpdate=i}return r.__N||r.__}function W(e,t){var n=H(L++,3);!V.__s&&J(n.__H,t)&&(n.__=e,n.u=t,R.__H.__h.push(n))}function Se(e,t){var n=H(L++,4);!V.__s&&J(n.__H,t)&&(n.__=e,n.u=t,R.__h.push(n))}function Ce(e){return B=5,G(function(){return{current:e}},[])}function G(e,t){var n=H(L++,7);return J(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function we(e,t){return B=8,G(function(){return e},t)}function Te(){for(var e;e=me.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(K),t.__h.some(q),t.__h=[]}catch(n){t.__h=[],V.__e(n,e.__v)}}}V.__b=function(e){R=null,he&&he(e)},V.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),be&&be(e,t)},V.__r=function(e){ge&&ge(e),L=0;var t=(R=e.__c).__H;t&&(z===R?(t.__h=[],R.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(K),t.__h.some(q),t.__h=[],L=0)),z=R},V.diffed=function(e){_e&&_e(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(me.push(t)!==1&&pe===V.requestAnimationFrame||((pe=V.requestAnimationFrame)||De)(Te)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),z=R=null},V.__c=function(e,t){t.some(function(e){try{e.__h.some(K),e.__h=e.__h.filter(function(e){return!e.__||q(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],V.__e(n,e.__v)}}),ve&&ve(e,t)},V.unmount=function(e){ye&&ye(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{K(e)}catch(e){t=e}}),n.__H=void 0,t&&V.__e(t,n.__v))};var Ee=typeof requestAnimationFrame==`function`;function De(e){var t,n=function(){clearTimeout(r),Ee&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ee&&(t=requestAnimationFrame(n))}function K(e){var t=R,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),R=t}function q(e){var t=R;e.__c=e.__(),R=t}function J(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Oe(e,t){return typeof t==`function`?t(e):t}function ke(e,t){for(var n in t)e[n]=t[n];return e}function Ae(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function Y(e,t){var n=t(),r=U({t:{__:n,u:t}}),i=r[0].t,a=r[1];return Se(function(){i.__=n,i.u=t,X(i)&&a({t:i})},[e,n,t]),W(function(){return X(i)&&a({t:i}),e(function(){X(i)&&a({t:i})})},[e]),n}function X(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function je(e,t){this.props=e,this.context=t}(je.prototype=new E).isPureReactComponent=!0,je.prototype.shouldComponentUpdate=function(e,t){return Ae(this.props,e)||Ae(this.state,t)};var Me=i.__b;i.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Me&&Me(e)},typeof Symbol<`u`&&Symbol.for;var Ne=i.__e;i.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}Ne(e,t,n,r)};var Pe=i.unmount;function Fe(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=ke({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Fe(e,t,n)})),e}function Ie(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ie(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Z(){this.__u=0,this.o=null,this.__b=null}function Le(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Q(){this.i=null,this.l=null}i.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Pe&&Pe(e)},(Z.prototype=new E).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=Le(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=Ie(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},Z.prototype.componentWillUnmount=function(){this.o=[]},Z.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=Fe(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&C(T,null,e.fallback);return i&&(i.__u&=-33),[C(T,null,t.__a?null:e.children),i]};var Re=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Q.prototype=new E).__a=function(e){var t=this,n=Le(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),Re(t,e,r)):i()};n?n(a):a()}},Q.prototype.render=function(e){this.i=null,this.l=new Map;var t=P(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Q.prototype.componentDidUpdate=Q.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Re(e,n,t)})};var ze=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Be=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Ve=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,He=/[A-Z0-9]/g,Ue=typeof document<`u`,We=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};E.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(E.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ge=i.event;i.event=function(e){return Ge&&(e=Ge(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Ke={configurable:!0,get:function(){return this.class}},qe=i.vnode;i.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||Ue&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||We(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:Ve.test(a)&&(a=s):s=a=`oninput`:i&&Be.test(a)?a=a.replace(He,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=P(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=P(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",Ke)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=ze,qe&&qe(e)};var Je=i.__r;i.__r=function(e){Je&&Je(e),e.__c};var Ye=i.diffed;i.diffed=function(e){Ye&&Ye(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};function Xe(){let[n,r]=U(()=>window.FrakSetup?.config?.waitForBackendConfig===!1||e.isResolved),[i,a]=U(()=>e.getConfig().hidden??!1),[o,s]=U(()=>!!window.FrakSetup?.client);return W(()=>{let n=e.getConfig();n.isResolved&&(r(!0),a(n.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&r(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return t(`add`,o),()=>{window.removeEventListener(`frak:config`,i),t(`remove`,o)}},[]),{shouldRender:n,isHidden:i,isClientReady:o}}function $(e){return typeof window>`u`?()=>{}:(window.addEventListener(`frak:config`,e),()=>window.removeEventListener(`frak:config`,e))}function Ze(){return Y($,()=>e.getConfig().lang??n()??`en`)}const Qe=`
|
|
2
|
-
:host {
|
|
3
|
-
display: contents;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
:host([hidden]) {
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.button:disabled {
|
|
11
|
-
opacity: 0.7;
|
|
12
|
-
cursor: default;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.button__fadeIn {
|
|
16
|
-
animation: frak-fadeIn 300ms ease-in;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@keyframes frak-fadeIn {
|
|
20
|
-
from {
|
|
21
|
-
opacity: 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
to {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;function $e(e,t){return t?`${Qe}\n${e}\n${t}`:`${Qe}\n${e}`}const et=`
|
|
29
|
-
:where(frak-button-share, frak-open-in-app) {
|
|
30
|
-
display: contents;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:where(frak-button-share .button, frak-open-in-app .button) {
|
|
34
|
-
display: flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
gap: 10px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
|
|
41
|
-
opacity: 0.7;
|
|
42
|
-
cursor: default;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
:where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
|
|
46
|
-
animation: frak-fadeIn 300ms ease-in;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes frak-fadeIn {
|
|
50
|
-
from {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
to {
|
|
55
|
-
opacity: 1;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;function tt(t){return e.getConfig().placements?.[t]}function nt(e){return Y($,we(()=>e?tt(e):void 0,[e]))}const rt={en:{buttonShare:{text:`Share & earn {REWARD}!`},postPurchase:{refereeText:`You just earned {REWARD}! Share with friends to earn even more.`,refereeNoRewardText:`You just earned a reward! Share with friends to earn even more.`,referrerText:`Earn {REWARD} by sharing this with your friends!`,referrerNoRewardText:`Share this with your friends and earn rewards!`,ctaText:`Share & earn {REWARD}`,ctaNoRewardText:`Share & earn`},openInApp:{text:`Open in App`,ariaLabel:`Open in Frak Wallet app`},buttonWallet:{ariaLabel:`Open wallet`},banner:{referralTitleReward:`Earn {REWARD} on purchases`,referralTitle:`You've been referred!`,referralDescription:`Earn rewards after your purchase via the Frak partner app.`,referralCta:`Got it`,inappTitle:`Open in your browser`,inappDescription:`For a better experience and to earn your rewards, open this page in your default browser.`,inappCta:`Open browser`,dismissLabel:`Dismiss`}},fr:{buttonShare:{text:`Partagez et gagnez {REWARD} !`},postPurchase:{refereeText:`Vous venez de gagner {REWARD} ! Partagez avec vos amis pour gagner encore plus.`,refereeNoRewardText:`Vous venez de gagner une récompense ! Partagez avec vos amis pour gagner encore plus.`,referrerText:`Gagnez {REWARD} en partageant avec vos amis !`,referrerNoRewardText:`Partagez avec vos amis et gagnez des récompenses !`,ctaText:`Partagez et gagnez {REWARD}`,ctaNoRewardText:`Partagez et gagnez`},openInApp:{text:`Ouvrir dans l'app`,ariaLabel:`Ouvrir dans l'app Frak Wallet`},buttonWallet:{ariaLabel:`Ouvrir le porte-monnaie`},banner:{referralTitleReward:`Gagnez {REWARD} sur vos achats`,referralTitle:`Vous avez été parrainé !`,referralDescription:`Gagnez des récompenses après votre achat via l'application partenaire Frak.`,referralCta:`J'ai compris`,inappTitle:`Ouvrez dans votre navigateur`,inappDescription:`Pour une meilleure expérience et pour gagner vos récompenses, ouvrez cette page dans votre navigateur par défaut.`,inappCta:`Ouvrir le navigateur`,dismissLabel:`Fermer`}}};export{Ze as a,Y as c,U as d,W as f,T as h,et as i,Ce as l,fe as m,nt as n,$ as o,we as p,$e as r,Xe as s,rt as t,G as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as e}from"./actions-CMPlZ7CH.CnK_0vla.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/rewards.CRzXPu4f.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,g as t,v as n}from"./clientReady.0RgyPOYT.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};
|