@frak-labs/components 1.3.3-beta.a79006c4 → 1.3.3-beta.bbccfb81

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.
Files changed (48) hide show
  1. package/cdn/Ambassador.CKoap_px.js +392 -0
  2. package/cdn/Banner.BqfCxKs3.js +208 -0
  3. package/cdn/ButtonShare.C7A2tEvB.js +1 -0
  4. package/cdn/ButtonWallet.Cg2OK1di.js +40 -0
  5. package/cdn/{GiftIcon.CX0gLPUJ.js → GiftIcon.CW1SwrXH.js} +1 -1
  6. package/cdn/OpenInAppButton.Djz_cb9Y.js +1 -0
  7. package/cdn/PostPurchase.Ch9VnOQG.js +102 -0
  8. package/cdn/components.js +1 -1
  9. package/cdn/{jsxRuntime.module.CUZaa90V.js → jsxRuntime.module.DWH-kRVd.js} +1 -1
  10. package/cdn/loader.js +14 -14
  11. package/cdn/{rewards.F9iOJSNk.js → rewards.t-rH9M3s.js} +1 -1
  12. package/cdn/useGlobalComponents.DVgSWfOp.js +1 -0
  13. package/cdn/useLightDomStyles.B72V1WPK.js +31 -0
  14. package/cdn/usePlacement.DEOEf5_6.js +1 -0
  15. package/cdn/useReward.D2kXQbtD.js +1 -0
  16. package/dist/{GiftIcon-JVhSFEhP.js → GiftIcon-B9k_syq6.js} +6 -12
  17. package/dist/ambassador.d.ts +0 -6
  18. package/dist/ambassador.js +105 -33
  19. package/dist/banner.d.ts +0 -6
  20. package/dist/banner.js +20 -29
  21. package/dist/buttonShare.d.ts +0 -6
  22. package/dist/buttonShare.js +8 -10
  23. package/dist/buttonWallet.d.ts +0 -6
  24. package/dist/buttonWallet.js +7 -11
  25. package/dist/i18n/defaults.d.ts +0 -2
  26. package/dist/i18n/defaults.js +1 -2
  27. package/dist/openInApp.d.ts +0 -6
  28. package/dist/openInApp.js +7 -11
  29. package/dist/postPurchase.d.ts +0 -6
  30. package/dist/postPurchase.js +10 -13
  31. package/dist/{rewards-HJlTkTcY.js → rewards-BuNthAR2.js} +50 -49
  32. package/dist/{sharedBaseCss.css-BkMpQeRx.js → sharedBaseCss.css-nYy9vlzH.js} +1 -3
  33. package/dist/{sharedCss-CPNmnpXA.js → sharedCss-SKmJGZgN.js} +10 -20
  34. package/dist/{useGlobalComponents-B3s2UQFk.js → useGlobalComponents-BF47jsBt.js} +2 -3
  35. package/dist/{useLightDomStyles-BQ5FvCPi.js → useLightDomStyles-wGaNXHqN.js} +4 -6
  36. package/dist/{usePlacement-BpaIbzun.js → usePlacement-Dd7itnCf.js} +2 -3
  37. package/dist/{useReward-WmsNOFlz.js → useReward-cQ54x8q-.js} +2 -3
  38. package/package.json +13 -13
  39. package/cdn/Ambassador.7wEDPaYu.js +0 -392
  40. package/cdn/Banner.8NeKFnVj.js +0 -208
  41. package/cdn/ButtonShare.BTT49Sbn.js +0 -1
  42. package/cdn/ButtonWallet.CB0Ysymx.js +0 -40
  43. package/cdn/OpenInAppButton.DdL3xii8.js +0 -1
  44. package/cdn/PostPurchase.ClgDFxmZ.js +0 -102
  45. package/cdn/useGlobalComponents.CXuceSQ0.js +0 -1
  46. package/cdn/useLightDomStyles.C3oQ3HLu.js +0 -1
  47. package/cdn/usePlacement.Cq64cZ9Q.js +0 -1
  48. package/cdn/useReward.BpO3D675.js +0 -1
@@ -1,208 +0,0 @@
1
- import{C as e,_ as t,a as n,d as r,f as i,k as a,l as o}from"./loader.js";import{a as s,c,d as l,f as u,l as d,m as f,n as p,p as m,t as h,u as g}from"./jsxRuntime.module.CUZaa90V.js";import{i as _}from"./rewards.F9iOJSNk.js";import{t as v}from"./useGlobalComponents.CXuceSQ0.js";import{t as ee}from"./useLightDomStyles.C3oQ3HLu.js";import{t as y}from"./useReward.BpO3D675.js";import{a as b,i as x,n as S,r as C,t as te}from"./GiftIcon.CX0gLPUJ.js";import{t as ne}from"./usePlacement.Cq64cZ9Q.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 re({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return/* @__PURE__ */ h(`div`,{className:`${E}${o?` ${o}`:``}`,role:`alert`,children:[/* @__PURE__ */ h(`div`,{className:k,children:[/* @__PURE__ */ h(`span`,{className:`${A}${s?.icon?` ${s.icon}`:``}`,children:/* @__PURE__ */ h(S,{width:20,height:20})}),/* @__PURE__ */ h(`p`,{className:`${j}${s?.title?` ${s.title}`:``}`,children:e})]}),/* @__PURE__ */ h(`div`,{className:w,children:[/* @__PURE__ */ h(`p`,{className:`${O}${s?.description?` ${s.description}`:``}`,children:t}),/* @__PURE__ */ h(`button`,{type:`button`,className:`${D}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,/* @__PURE__ */ h(x,{width:14,height:14})]})]}),/* @__PURE__ */ h(`button`,{type:`button`,className:`${T}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:/* @__PURE__ */ h(b,{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`,de=`Banner_referralImage__1gnumzi4`,fe=`Banner_referralTitle__1gnumzi6 reset_base__1831jhd0`;function M({placement:f,classname:b=``,interaction:x,products:S,referralTitle:w,referralDescription:T,referralCta:E,inappTitle:D,inappDescription:O,inappCta:k,imageUrl:A,preview:j,previewMode:M,allowInappRedirect:N}){let P=!!j,F=s(),I=M===`inapp`?`inapp`:`referral`,L=N===!0||N===`true`,R=ne(f),{shouldRender:z,isHidden:B,isClientReady:V}=c();ee(`frak-banner`,f,R?.components?.banner?.css,`@keyframes keyframes_fadeIn__mnqmlt0 {
2
- from {
3
- opacity: 0;
4
- }
5
-
6
- to {
7
- opacity: 1;
8
- }
9
- }
10
-
11
- @keyframes keyframes_fadeOut__mnqmlt1 {
12
- from {
13
- opacity: 1;
14
- }
15
-
16
- to {
17
- opacity: 0;
18
- }
19
- }
20
-
21
- @keyframes keyframes_fadeInDown__mnqmlt2 {
22
- from {
23
- opacity: 0;
24
- transform: translateY(-4px);
25
- }
26
-
27
- to {
28
- opacity: 1;
29
- transform: translateY(0);
30
- }
31
- }
32
- .inAppBanner_container__1ibpiy70 {
33
- top: max(8px, var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
34
- z-index: 1000;
35
- -webkit-backdrop-filter: blur(12px);
36
- backdrop-filter: blur(12px);
37
- color: var(--text-onAction__pbq4ak6);
38
- background-color: #000c;
39
- border-radius: 12px;
40
- flex-direction: column;
41
- gap: 4px;
42
- padding: 12px 32px 12px 16px;
43
- animation: .3s ease-out keyframes_fadeInDown__mnqmlt2;
44
- display: flex;
45
- position: fixed;
46
- left: 16px;
47
- right: 16px;
48
- }
49
-
50
- .inAppBanner_header__1ibpiy71 {
51
- align-items: center;
52
- gap: 8px;
53
- display: flex;
54
- }
55
-
56
- .inAppBanner_iconWrapper__1ibpiy72 {
57
- width: 20px;
58
- height: 20px;
59
- color: var(--text-onAction__pbq4ak6);
60
- flex-shrink: 0;
61
- justify-content: center;
62
- align-items: center;
63
- display: flex;
64
- }
65
-
66
- .inAppBanner_title__1ibpiy73 {
67
- color: var(--text-onAction__pbq4ak6);
68
- margin: 0;
69
- padding: 0;
70
- font-size: 16px;
71
- font-weight: 500;
72
- line-height: 26px;
73
- }
74
-
75
- .inAppBanner_body__1ibpiy74 {
76
- flex-wrap: wrap;
77
- align-items: baseline;
78
- gap: 0 4px;
79
- display: flex;
80
- }
81
-
82
- .inAppBanner_description__1ibpiy75 {
83
- color: var(--text-onAction__pbq4ak6);
84
- opacity: .96;
85
- margin: 0;
86
- padding: 0;
87
- font-size: 14px;
88
- line-height: 22px;
89
- }
90
-
91
- .inAppBanner_cta__1ibpiy76 {
92
- all: unset;
93
- color: #2bb2ff;
94
- text-underline-offset: 2px;
95
- cursor: pointer;
96
- align-items: center;
97
- gap: 4px;
98
- font-size: 14px;
99
- font-weight: 600;
100
- text-decoration: underline;
101
- display: inline-flex;
102
- }
103
-
104
- .inAppBanner_cta__1ibpiy76:focus-visible {
105
- outline-offset: 2px;
106
- border-radius: 4px;
107
- outline: 2px solid #2bb2ff;
108
- }
109
-
110
- .inAppBanner_closeButton__1ibpiy77 {
111
- all: unset;
112
- color: #fff9;
113
- cursor: pointer;
114
- border-radius: 9999px;
115
- justify-content: center;
116
- align-items: center;
117
- width: 28px;
118
- height: 28px;
119
- display: flex;
120
- position: absolute;
121
- top: 8px;
122
- right: 8px;
123
- }
124
-
125
- .inAppBanner_closeButton__1ibpiy77:focus-visible {
126
- outline: 2px solid var(--text-onAction__pbq4ak6);
127
- outline-offset: 2px;
128
- }
129
- .Banner_rootBase__1gnumzi0 {
130
- animation: .3s ease-out keyframes_fadeInDown__mnqmlt2;
131
- display: flex;
132
- position: relative;
133
- }
134
-
135
- .Banner_iconSvg__1gnumzi1 {
136
- width: 100%;
137
- height: 100%;
138
- }
139
-
140
- .Banner_referral__1gnumzi2 {
141
- color: var(--text-primary__pbq4ak0);
142
- border: 1px solid var(--border-default__pbq4akv);
143
- background-color: #fff;
144
- border-radius: 12px;
145
- flex-direction: row;
146
- align-items: center;
147
- gap: 16px;
148
- padding: 16px;
149
- }
150
-
151
- .Banner_referralIconWrapper__1gnumzi3 {
152
- flex-shrink: 0;
153
- justify-content: center;
154
- align-self: flex-start;
155
- align-items: center;
156
- width: 40px;
157
- height: 40px;
158
- display: flex;
159
- overflow: hidden;
160
- }
161
-
162
- .Banner_referralImage__1gnumzi4 {
163
- object-fit: contain;
164
- width: auto;
165
- max-width: 100%;
166
- height: auto;
167
- max-height: 100%;
168
- display: block;
169
- }
170
-
171
- .Banner_referralBody__1gnumzi5 {
172
- flex: 1;
173
- min-width: 0;
174
- }
175
-
176
- .Banner_referralTitle__1gnumzi6 {
177
- color: var(--text-primary__pbq4ak0);
178
- font-size: 16px;
179
- font-weight: 600;
180
- line-height: 22px;
181
- }
182
-
183
- .Banner_referralDescription__1gnumzi7 {
184
- color: #979797;
185
- margin-bottom: 8px;
186
- font-size: 14px;
187
- line-height: 22px;
188
- }
189
-
190
- .Banner_referralCta__1gnumzi8 {
191
- color: var(--text-primary__pbq4ak0);
192
- text-transform: uppercase;
193
- border: 1px solid #000;
194
- border-radius: 9999px;
195
- padding: 8px 16px;
196
- font-size: 10px;
197
- font-weight: 700;
198
- line-height: 12px;
199
- display: inline-block;
200
- }
201
-
202
- .Banner_frakLogo__1gnumzi9 {
203
- pointer-events: none;
204
- position: absolute;
205
- bottom: 12px;
206
- right: 16px;
207
- }
208
- `,a);let[H,U]=l(!1),[W,G]=l(()=>P?I:L&&r?`inapp`:null),K=d(null);u(()=>{P&&G(I)},[P,I]);let pe=g(()=>t(S),[S]),{reward:q}=y(W===`referral`&&V,x,`referee`,pe),[J,Y]=l(null);u(()=>{let e=window.FrakSetup?.client;W===`inapp`&&!P&&V&&e&&o(e).then(e=>Y(e)).catch(()=>{})},[W,P,V]),u(()=>{P||!W||H||K.current!==W&&V&&(e(window.FrakSetup?.client,`banner_impression`,{placement:f,variant:W,has_reward:W===`referral`?!!q:void 0}),K.current=W)},[W,H,V,P,f]),u(()=>{if(P||W===`inapp`)return;let e=()=>G(`referral`);return window.addEventListener(n,e),()=>window.removeEventListener(n,e)},[P,W]);let X=m(async()=>{if(P)return;if(e(window.FrakSetup?.client,`banner_resolved`,{placement:f,variant:W??`referral`,outcome:`clicked`}),W===`referral`){U(!0);return}let t=J;if(!t&&window.FrakSetup?.client)try{t=await o(window.FrakSetup?.client)}catch{}let n=window.location.href;if(t){let e=new URL(n);e.searchParams.set(`fmt`,t),n=e.toString()}i(n)},[P,W,J,f]),me=m(()=>{P||(e(window.FrakSetup?.client,`banner_resolved`,{placement:f,variant:W??`referral`,outcome:`dismissed`}),U(!0))},[P,W,f]),he=v(),Z=R?.components?.banner??he?.banner,Q=A??Z?.imageUrl,$=g(()=>{let e=p[F].banner;if(W===`referral`){let t=q?e.referralTitleReward:e.referralTitle;return{title:_(w??Z?.referralTitle??t,q),description:_(T??Z?.referralDescription??e.referralDescription,q),cta:E??Z?.referralCta??e.referralCta}}return{title:_(D??Z?.inappTitle??e.inappTitle,void 0),description:_(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 ge=[oe,`frak-banner`,`frak-banner--${W}`,b].filter(Boolean).join(` `);return W===`inapp`?/* @__PURE__ */ h(re,{title:$.title,description:$.description,cta:$.cta,dismissLabel:p[F].banner.dismissLabel,onAction:X,onDismiss:me,className:[`frak-banner`,`frak-banner--inapp`,b].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):/* @__PURE__ */ h(`div`,{class:ge,role:`alert`,children:[/* @__PURE__ */ h(`div`,{class:`${ue} frak-banner__icon`,children:Q?/* @__PURE__ */ h(`img`,{src:Q,alt:``,class:de}):/* @__PURE__ */ h(te,{class:ae})}),/* @__PURE__ */ h(`div`,{class:`${se} frak-banner__text`,children:[/* @__PURE__ */ h(`p`,{class:`${fe} frak-banner__title`,children:$.title}),/* @__PURE__ */ h(`p`,{class:`${le} frak-banner__description`,children:$.description}),/* @__PURE__ */ h(`button`,{type:`button`,class:`${ce} frak-banner__cta`,onClick:X,children:$.cta})]}),/* @__PURE__ */ h(C,{class:`${ie} frak-banner__logo`,width:42,height:24})]})}f(M,`frak-banner`,[`placement`,`classname`,`interaction`,`products`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`,`imageUrl`,`allowInappRedirect`],{shadow:!1});export{M as Banner};
@@ -1 +0,0 @@
1
- import{C as e,r as t,u as n}from"./loader.js";import{a as r,c as i,f as a,l as o,m as s,n as c,p as l,t as u,u as d}from"./jsxRuntime.module.CUZaa90V.js";import{i as f}from"./rewards.F9iOJSNk.js";import{t as p}from"./useGlobalComponents.CXuceSQ0.js";import{t as m}from"./useLightDomStyles.C3oQ3HLu.js";import{t as h}from"./useReward.BpO3D675.js";import{t as g}from"./usePlacement.Cq64cZ9Q.js";function _({placement:s,text:_,classname:v=``,noRewardText:y,targetInteraction:b,products:x,clickAction:S,preview:C}){let w=!!C,T=r(),E=g(s),D=p(),O=E?.components?.buttonShare??D?.buttonShare;m(`frak-button-share`,s,O?.css);let k=E?.targetInteraction===void 0?b:E.targetInteraction,A=O?.text??_??c[T].buttonShare.text,j=O?.noRewardText??y,M=A.includes(`{REWARD}`),N=O?.clickAction??S??`sharing-page`,{shouldRender:P,isHidden:F,isClientReady:I}=i(),L=d(()=>n(x),[x]),{reward:R}=h(M&&I,k,void 0,L),z=d(()=>M?R?f(A,R):j??f(A,void 0):A,[M,A,j,R]),B=o(!1);a(()=>{w||B.current||I&&P&&!F&&(e(window.FrakSetup?.client,`share_button_impression`,{placement:s,target_interaction:k,has_reward:!!R}),B.current=!0)},[w,I,P,F,s,k]);let V=l(()=>{w||(e(window.FrakSetup.client,`share_button_clicked`,{placement:s,target_interaction:k,has_reward:!!R,click_action:N}),t(`share_button`,k,s,{products:L}))},[w,N,k,s,R,L]);if(!w&&(!P||F))return null;let H=[`button`,`button__fadeIn`,v].filter(Boolean).join(` `);return/* @__PURE__ */ u(`button`,{type:`button`,disabled:!w&&!I,class:H,onClick:V,children:z})}s(_,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`noRewardText`,`targetInteraction`,`products`,`preview`],{shadow:!1});export{_ as ButtonShare};
@@ -1,40 +0,0 @@
1
- import{C as e,r as t}from"./loader.js";import{a as n,c as r,f as i,h as a,l as o,m as s,n as c,p as l,r as u,t as d}from"./jsxRuntime.module.CUZaa90V.js";import{t as f}from"./useReward.BpO3D675.js";import{t as p}from"./usePlacement.Cq64cZ9Q.js";function m(){`vibrate`in navigator&&navigator.vibrate(10)}function h(e){return/* @__PURE__ */ d(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[/* @__PURE__ */ d(`title`,{children:`Gift icon`}),/* @__PURE__ */ d(`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 g({placement:s,classname:g=``,useReward:_,targetInteraction:v}){let y=n(),b=p(s),x=b?.targetInteraction===void 0?v:b.targetInteraction,S=_===!0,{shouldRender:C,isHidden:w,isClientReady:T}=r(),{reward:E}=f(S&&T,x),D=b?.components?.buttonWallet?.position??window.FrakSetup?.modalWalletConfig?.metadata?.position??`right`,O=o(!1);i(()=>{O.current||T&&C&&!w&&(e(window.FrakSetup?.client,`share_button_impression`,{placement:s,target_interaction:x,has_reward:!!E}),O.current=!0)},[T,C,w,s,x]);let k=l(()=>{e(window.FrakSetup.client,`share_button_clicked`,{placement:s,target_interaction:x,has_reward:!!E,click_action:`sharing-page`}),m(),t(`share_button`,x,s)},[s,x,E]);if(!C||w)return null;let A=[`button`,`button__fadeIn`,D===`left`?`button__left`:`button__right`,g].filter(Boolean).join(` `);return/* @__PURE__ */ d(a,{children:[/* @__PURE__ */ d(`style`,{children:u(`
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
- `,b?.components?.buttonWallet?.css)}),/* @__PURE__ */ d(`button`,{type:`button`,"aria-label":c[y].buttonWallet.ariaLabel,part:`button`,disabled:!T,class:A,onClick:k,children:[/* @__PURE__ */ d(h,{}),E&&/* @__PURE__ */ d(`span`,{class:`reward`,children:E})]})]})}s(g,`frak-button-wallet`,[`placement`,`classname`,`useReward`,`targetInteraction`],{shadow:!0});export{g as ButtonWallet};
@@ -1 +0,0 @@
1
- import{C as e,g as t,m as n,p as r}from"./loader.js";import{a as i,c as a,m as o,n as s,t as c}from"./jsxRuntime.module.CUZaa90V.js";import{t as l}from"./useLightDomStyles.C3oQ3HLu.js";import{t as u}from"./usePlacement.Cq64cZ9Q.js";function d(n=`wallet`,i){let a=window.FrakSetup?.client;a&&e(a,`open_in_app_clicked`,{path:n,placement:i});let o=`${t}${n}`;r(o,{onFallback:()=>{a&&e(a,`app_not_installed`,{path:n,placement:i})}})}function f(){return{isMobile:n()}}function p({placement:e,text:t,classname:n=``}){let r=i(),o=u(e),{shouldRender:p,isHidden:m,isClientReady:h}=a(),{isMobile:g}=f();l(`frak-open-in-app`,e,o?.components?.openInApp?.css);let _=o?.components?.openInApp?.text??t??s[r].openInApp.text;if(!g||!p||m)return null;let v=()=>{d(void 0,e)},y=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return/* @__PURE__ */ c(`button`,{type:`button`,"aria-label":s[r].openInApp.ariaLabel,disabled:!h,class:y,onClick:v,children:_})}o(p,`frak-open-in-app`,[`text`,`placement`,`classname`],{shadow:!1});export{p as OpenInAppButton};
@@ -1,102 +0,0 @@
1
- import{C as e,E as t,T as n,c as r,i,k as a,r as o,s,u as ee}from"./loader.js";import{a as c,c as l,d as u,f as d,l as te,m as f,n as p,p as ne,t as m,u as h}from"./jsxRuntime.module.CUZaa90V.js";import{i as g,n as _,t as re}from"./rewards.F9iOJSNk.js";import{t as v}from"./useGlobalComponents.CXuceSQ0.js";import{t as y}from"./useLightDomStyles.C3oQ3HLu.js";import{r as b,t as x}from"./GiftIcon.CX0gLPUJ.js";import{t as ie}from"./usePlacement.Cq64cZ9Q.js";var ae=`PostPurchase_card__5fv5lh0`,oe=`PostPurchase_cardLayout__5fv5lh1`,se=`PostPurchase_cardLeft__5fv5lh2`,ce=`PostPurchase_cardRight__5fv5lh3`,le=`PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0`,ue=`PostPurchase_customImage__5fv5lha`,de=`PostPurchase_frakLogo__5fv5lhb`,fe=`PostPurchase_giftIcon__5fv5lh8`,pe=`PostPurchase_icon__5fv5lh7`,me=`PostPurchase_imageWrapper__5fv5lh9`,he=`PostPurchase_message__5fv5lh5`;function ge(e){let t=e?.trim();if(!t)return;let n=/^https?:\/\//i.test(t)?t:`https://${t}`;try{return new URL(n).toString()}catch{return}}function _e(e,t,n,r){let i=e?.isReferred?`referee`:`referrer`,a=_(t.rewards,{targetInteraction:`purchase`,currency:n,audience:i,products:r});if(!a)return null;let{campaign:o}=a,s=e?.isReferred&&o.referee?`referee`:`referrer`;return{variant:s,reward:s===`referee`?o.referee:o.referrer,merchantDomain:t.onChainMetadata.domain}}function S({customerId:f,orderId:_,token:S,sharingUrl:ve,merchantId:C,placement:w,classname:T=``,variant:E,badgeText:D,referrerText:O,refereeText:k,ctaText:A,preview:j,previewVariant:M,products:N,imageUrl:P}){let F=!!j,{shouldRender:I,isHidden:L,isClientReady:R}=l(),z=ie(w),B=c(),V=h(()=>ee(N),[N]);y(`frak-post-purchase`,w,z?.components?.postPurchase?.css,`.PostPurchase_card__5fv5lh0 {
2
- background-color: var(--surface-background__pbq4akc);
3
- border: 1px solid var(--border-default__pbq4akv);
4
- border-radius: 12px;
5
- padding: 16px;
6
- }
7
-
8
- .PostPurchase_cardLayout__5fv5lh1 {
9
- flex-direction: row;
10
- align-items: center;
11
- gap: 32px;
12
- display: flex;
13
- }
14
-
15
- .PostPurchase_cardLeft__5fv5lh2 {
16
- flex-direction: column;
17
- flex-grow: 1;
18
- gap: 8px;
19
- min-width: 0;
20
- display: flex;
21
- }
22
-
23
- .PostPurchase_cardRight__5fv5lh3 {
24
- text-align: right;
25
- flex-direction: column;
26
- flex-shrink: 0;
27
- align-items: flex-end;
28
- gap: 8px;
29
- display: flex;
30
- }
31
-
32
- .PostPurchase_badge__5fv5lh4 {
33
- color: var(--text-primary__pbq4ak0);
34
- background-color: #fff534;
35
- border-radius: 4px;
36
- align-self: flex-start;
37
- padding: 4px 8px;
38
- font-size: 12px;
39
- font-weight: 600;
40
- line-height: 12px;
41
- }
42
-
43
- .PostPurchase_message__5fv5lh5 {
44
- color: var(--text-primary__pbq4ak0);
45
- margin: 0;
46
- font-size: 16px;
47
- font-weight: 600;
48
- line-height: 22px;
49
- }
50
-
51
- .PostPurchase_cta__5fv5lh6 {
52
- background-color: var(--text-primary__pbq4ak0);
53
- color: var(--text-onAction__pbq4ak6);
54
- text-transform: uppercase;
55
- border-radius: 9999px;
56
- justify-content: center;
57
- align-items: center;
58
- gap: 4px;
59
- padding: 12px 16px;
60
- font-size: 12px;
61
- font-weight: bold;
62
- display: inline-flex;
63
- }
64
-
65
- .PostPurchase_cta__5fv5lh6:disabled {
66
- opacity: .7;
67
- cursor: default;
68
- }
69
-
70
- .PostPurchase_icon__5fv5lh7 {
71
- margin: -2px 0;
72
- }
73
-
74
- .PostPurchase_giftIcon__5fv5lh8 {
75
- flex-shrink: 0;
76
- display: block;
77
- }
78
-
79
- .PostPurchase_imageWrapper__5fv5lh9 {
80
- flex-shrink: 0;
81
- justify-content: center;
82
- align-items: center;
83
- width: 80px;
84
- height: 80px;
85
- display: flex;
86
- overflow: hidden;
87
- }
88
-
89
- .PostPurchase_customImage__5fv5lha {
90
- object-fit: contain;
91
- width: auto;
92
- max-width: 100%;
93
- height: auto;
94
- max-height: 100%;
95
- display: block;
96
- }
97
-
98
- .PostPurchase_frakLogo__5fv5lhb {
99
- margin-left: auto;
100
- display: block;
101
- }
102
- `,a);let[H,ye]=u(null),[U,W]=u(!1);d(()=>{F||R&&f&&_&&S&&i({customerId:f,orderId:_,token:S,merchantId:C}).catch(()=>{})},[F,R,f,_,S,C]),d(()=>{if(F||!R||U)return;let e=window.FrakSetup?.client;e&&Promise.all([s(e),r(e)]).then(([e,t])=>{W(!0),ye({referralStatus:e,merchantInfo:t})}).catch(e=>{e instanceof t&&e.code===n.configError?W(!0):console.warn(`[Frak] Post-purchase context error`,e)})},[F,R,U]);let G=h(()=>H?_e(H.referralStatus,H.merchantInfo,window.FrakSetup?.client?.config?.metadata?.currency,V):null,[H,V]),K=te(null),q=E??G?.variant??(F?M??`referrer`:void 0),J=ge(ve??G?.merchantDomain),Y=h(()=>{if(!G?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return re(G.reward,e)},[G?.reward]),be=v(),X=z?.components?.postPurchase??be?.postPurchase,Z=D??X?.badgeText,Q=P??X?.imageUrl,$=h(()=>{let e=p[B].postPurchase;return{message:q===`referee`?Y?g(k??X?.refereeText??e.refereeText,Y):k??X?.refereeNoRewardText??e.refereeNoRewardText:Y?g(O??X?.referrerText??e.referrerText,Y):O??X?.referrerNoRewardText??e.referrerNoRewardText,cta:Y?g(A??X?.ctaText??e.ctaText,Y):A??X?.ctaNoRewardText??e.ctaNoRewardText}},[B,q,Y,X,O,k,A]);d(()=>{q&&K.current!==q&&R&&(F||I&&!L)&&(e(window.FrakSetup?.client,`post_purchase_impression`,{placement:w,variant:q,has_reward:!!G?.reward}),K.current=q)},[q,I,L,R,F,w,G?.reward]);let xe=ne(()=>{q&&(e(window.FrakSetup?.client,`post_purchase_clicked`,{placement:w,variant:q}),o(`post_purchase`,void 0,w,{link:J,products:V,checkoutToken:S}))},[q,w,J,V,S]);if(!q||!F&&(!I||L||!G))return null;let Se=[ae,T].filter(Boolean).join(` `);return/* @__PURE__ */ m(`div`,{className:Se,children:/* @__PURE__ */ m(`div`,{class:oe,children:[/* @__PURE__ */ m(`div`,{class:se,children:[Z&&/* @__PURE__ */ m(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:Z}),/* @__PURE__ */ m(`p`,{class:he,children:$.message}),/* @__PURE__ */ m(`button`,{type:`button`,className:`${le} button`,disabled:!F&&!R,onClick:F?void 0:xe,children:[$.cta,/* @__PURE__ */ m(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`${pe} button`,children:/* @__PURE__ */ m(`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`})})]})]}),/* @__PURE__ */ m(`div`,{class:ce,children:[Q?/* @__PURE__ */ m(`span`,{class:me,children:/* @__PURE__ */ m(`img`,{src:Q,alt:``,class:ue})}):/* @__PURE__ */ m(x,{className:fe,width:80,height:80}),/* @__PURE__ */ m(b,{className:de,width:42,height:24})]})]})})}f(S,`frak-post-purchase`,[`customerId`,`orderId`,`token`,`sharingUrl`,`merchantId`,`placement`,`classname`,`variant`,`badgeText`,`referrerText`,`refereeText`,`ctaText`,`products`,`preview`,`previewVariant`,`imageUrl`],{shadow:!1});export{S as PostPurchase};
@@ -1 +0,0 @@
1
- import{w as e}from"./loader.js";import{o as t,s as n}from"./jsxRuntime.module.CUZaa90V.js";function r(){return n(t,()=>e.getConfig().components)}export{r as t};
@@ -1 +0,0 @@
1
- import{O as e}from"./loader.js";import{f as t,i as n}from"./jsxRuntime.module.CUZaa90V.js";function r(r,i,a,o,s){t(()=>{s&&e.injectBase(`shared`,s),e.injectBase(r,o??n)},[r]),t(()=>{a&&e.injectPlacement(r,i??``,a)},[r,i,a])}export{r as t};
@@ -1 +0,0 @@
1
- import{w as e}from"./loader.js";import{o as t,p as n,s as r}from"./jsxRuntime.module.CUZaa90V.js";function i(t){return e.getConfig().placements?.[t]}function a(e){let a=n(()=>e?i(e):void 0,[e]);return r(t,a)}export{a as t};
@@ -1 +0,0 @@
1
- import{c as e}from"./loader.js";import{d as t,f as n}from"./jsxRuntime.module.CUZaa90V.js";import{r}from"./rewards.F9iOJSNk.js";function i(i,a,o,s){let[c,l]=t(void 0),[u,d]=t(!1);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,products:s});d(n!==void 0),n&&n.payoutType!==`percentage`&&l(n.formatted)}).catch(()=>{})},[i,a,o,s]),{reward:c,hasReward:u}}export{i as t};