@frak-labs/components 1.0.3-beta.f6df627f → 1.0.4-beta.d970d1ee
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.B1y3jwHv.js +178 -0
- package/cdn/{ButtonShare.DNdo_eQJ.js → ButtonShare.DNELNwqD.js} +1 -1
- package/cdn/{ButtonWallet.CN2iHSTB.js → ButtonWallet.BUUPX0gO.js} +1 -1
- package/cdn/GiftIcon.eRNTGQ_r.js +1 -0
- package/cdn/OpenInAppButton.Dgb-qhM8.js +1 -0
- package/cdn/PostPurchase.C3IH-LUy.js +89 -0
- package/cdn/components.js +1 -1
- package/cdn/formatReward.B1ZyoceC.js +1 -0
- package/cdn/loader.js +154 -14
- package/cdn/replay-V6FXES7X.CNozpSRg.js +1 -0
- package/cdn/{sharingPage.Do_xfrTN.js → sharingPage.Dt8QZhlR.js} +1 -1
- package/cdn/useGlobalComponents.TG9kIYSc.js +1 -0
- package/cdn/useLightDomStyles.tjNBKcOr.js +1 -0
- package/cdn/usePlacement.BgMXY5CX.js +58 -0
- package/cdn/useReward.B530suzR.js +1 -0
- package/dist/GiftIcon-BIp9FTJs.js +338 -0
- package/dist/banner.d.ts +8 -0
- package/dist/banner.js +74 -44
- package/dist/buttonShare.js +6 -6
- package/dist/buttonWallet.js +2 -2
- package/dist/{formatReward-Bub6Z6eY.js → formatReward-Cf2KpA3x.js} +1 -1
- package/dist/openInApp.js +9 -26
- package/dist/postPurchase.d.ts +9 -1
- package/dist/postPurchase.js +93 -1382
- package/dist/{sharingPage-DFvQbviS.js → sharingPage-D6fQEXV9.js} +1 -1
- package/dist/useLightDomStyles-DVe5UDg6.js +48 -0
- package/dist/{usePlacement-V7NrKoub.js → usePlacement-DzEuVg_u.js} +7 -7
- package/dist/{useReward-DU3_yP8Q.js → useReward-ClVShg45.js} +1 -1
- package/package.json +4 -4
- package/cdn/Banner.BTj-CQM6.js +0 -162
- package/cdn/OpenInAppButton.C1Yipwka.js +0 -1
- package/cdn/PostPurchase.BvmSYSpL.js +0 -52
- package/cdn/formatReward.C7mU9_cV.js +0 -1
- package/cdn/sprinkles.css.ts.vanilla.06k5OzG1.js +0 -1175
- package/cdn/useGlobalComponents.UJmjUUxk.js +0 -1
- package/cdn/useLightDomStyles.Gt7YUMDl.js +0 -1
- package/cdn/usePlacement.BJ7qe-pw.js +0 -58
- package/cdn/useReward.QsQc2c1D.js +0 -1
- package/dist/GiftIcon-c28NnqJ7.js +0 -1502
- package/dist/useLightDomStyles-gbuSWvRx.js +0 -89
- /package/dist/{useGlobalComponents-Cmfszr7v.js → useGlobalComponents-mSs9unyN.js} +0 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import{T as e,b as t,c as n,d as r,u as i,v as a}from"./loader.js";import{a as o,c as s,d as c,i as l,l as u,o as d,s as f,t as ee,u as p}from"./usePlacement.BgMXY5CX.js";import{a as m,i as h,n as g,r as te,t as _}from"./GiftIcon.eRNTGQ_r.js";import{t as v}from"./useGlobalComponents.TG9kIYSc.js";import{t as y}from"./useLightDomStyles.tjNBKcOr.js";import{t as b}from"./useReward.B530suzR.js";var x=`inAppBanner_body__1ibpiy75`,S=`inAppBanner_closeButton__1ibpiy78`,C=`inAppBanner_container__1ibpiy71`,w=`inAppBanner_cta__1ibpiy77`,T=`inAppBanner_description__1ibpiy76`,E=`inAppBanner_header__1ibpiy72`,D=`inAppBanner_iconWrapper__1ibpiy73`,O=`inAppBanner_title__1ibpiy74`;function k({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return p(`div`,{className:`${C}${o?` ${o}`:``}`,role:`alert`,children:[p(`div`,{className:E,children:[p(`span`,{className:`${D}${s?.icon?` ${s.icon}`:``}`,children:p(g,{width:20,height:20})}),p(`p`,{className:`${O}${s?.title?` ${s.title}`:``}`,children:e})]}),p(`div`,{className:x,children:[p(`p`,{className:`${T}${s?.description?` ${s.description}`:``}`,children:t}),p(`button`,{type:`button`,className:`${w}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,p(h,{width:14,height:14})]})]}),p(`button`,{type:`button`,className:`${S}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:p(m,{width:16,height:16})})]})}var A=`Banner_frakLogo__1gnumzia`,j=`Banner_iconSvg__1gnumzi2`,M=`Banner_referral__1gnumzi3 reset_base__1831jhd0 Banner_rootBase__1gnumzi1`,N=`Banner_referralBody__1gnumzi6`,P=`Banner_referralCta__1gnumzi9 sharedBaseCss_buttonReset__7cswil0`,ne=`Banner_referralDescription__1gnumzi8 reset_base__1831jhd0`,F=`Banner_referralIconWrapper__1gnumzi4`,I=`Banner_referralImage__1gnumzi5`,L=`Banner_referralTitle__1gnumzi7 reset_base__1831jhd0`;function R({placement:c,classname:m=``,interaction:h,referralTitle:g,referralDescription:x,referralCta:S,inappTitle:C,inappDescription:w,inappCta:T,imageUrl:E,preview:D,previewMode:O}){let R=!!D,z=O===`inapp`?`inapp`:`referral`,B=ee(c),{shouldRender:V,isHidden:H,isClientReady:U}=l();y(`frak-banner`,c,B?.components?.banner?.css,`@keyframes inAppBanner_fadeIn__1ibpiy70 {
|
|
2
|
+
from {
|
|
3
|
+
opacity: 0;
|
|
4
|
+
transform: translateY(-4px);
|
|
5
|
+
}
|
|
6
|
+
to {
|
|
7
|
+
opacity: 1;
|
|
8
|
+
transform: translateY(0);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
.inAppBanner_container__1ibpiy71 {
|
|
12
|
+
position: fixed;
|
|
13
|
+
top: max(8px, env(safe-area-inset-top));
|
|
14
|
+
left: 16px;
|
|
15
|
+
right: 16px;
|
|
16
|
+
z-index: 1000;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 4px;
|
|
20
|
+
padding: 12px 16px;
|
|
21
|
+
padding-right: 32px;
|
|
22
|
+
border-radius: 12px;
|
|
23
|
+
background-color: #000000CC;
|
|
24
|
+
backdrop-filter: blur(12px);
|
|
25
|
+
-webkit-backdrop-filter: blur(12px);
|
|
26
|
+
color: #ffffff;
|
|
27
|
+
animation: inAppBanner_fadeIn__1ibpiy70 300ms ease-out;
|
|
28
|
+
}
|
|
29
|
+
.inAppBanner_header__1ibpiy72 {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
gap: 8px;
|
|
33
|
+
}
|
|
34
|
+
.inAppBanner_iconWrapper__1ibpiy73 {
|
|
35
|
+
flex-shrink: 0;
|
|
36
|
+
width: 20px;
|
|
37
|
+
height: 20px;
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
color: #ffffff;
|
|
42
|
+
}
|
|
43
|
+
.inAppBanner_title__1ibpiy74 {
|
|
44
|
+
margin: 0;
|
|
45
|
+
padding: 0;
|
|
46
|
+
font-size: 16px;
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
line-height: 26px;
|
|
49
|
+
color: var(--text-onAction__pbq4ak6);
|
|
50
|
+
}
|
|
51
|
+
.inAppBanner_body__1ibpiy75 {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
align-items: baseline;
|
|
55
|
+
gap: 0 4px;
|
|
56
|
+
}
|
|
57
|
+
.inAppBanner_description__1ibpiy76 {
|
|
58
|
+
margin: 0;
|
|
59
|
+
padding: 0;
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
color: var(--text-onAction__pbq4ak6);
|
|
62
|
+
line-height: 22px;
|
|
63
|
+
opacity: 0.96;
|
|
64
|
+
}
|
|
65
|
+
.inAppBanner_cta__1ibpiy77 {
|
|
66
|
+
all: unset;
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 4px;
|
|
70
|
+
color: #2BB2FF;
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
text-decoration: underline;
|
|
74
|
+
text-underline-offset: 2px;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
}
|
|
77
|
+
.inAppBanner_cta__1ibpiy77:focus-visible {
|
|
78
|
+
outline: 2px solid #2BB2FF;
|
|
79
|
+
outline-offset: 2px;
|
|
80
|
+
border-radius: 4px;
|
|
81
|
+
}
|
|
82
|
+
.inAppBanner_closeButton__1ibpiy78 {
|
|
83
|
+
all: unset;
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 8px;
|
|
86
|
+
right: 8px;
|
|
87
|
+
width: 28px;
|
|
88
|
+
height: 28px;
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
border-radius: 9999px;
|
|
93
|
+
color: rgba(255, 255, 255, 0.6);
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
}
|
|
96
|
+
.inAppBanner_closeButton__1ibpiy78:focus-visible {
|
|
97
|
+
outline: 2px solid #ffffff;
|
|
98
|
+
outline-offset: 2px;
|
|
99
|
+
}@keyframes Banner_fadeIn__1gnumzi0 {
|
|
100
|
+
from {
|
|
101
|
+
opacity: 0;
|
|
102
|
+
transform: translateY(-4px);
|
|
103
|
+
}
|
|
104
|
+
to {
|
|
105
|
+
opacity: 1;
|
|
106
|
+
transform: translateY(0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
.Banner_rootBase__1gnumzi1 {
|
|
110
|
+
position: relative;
|
|
111
|
+
display: flex;
|
|
112
|
+
animation: Banner_fadeIn__1gnumzi0 300ms ease-out;
|
|
113
|
+
}
|
|
114
|
+
.Banner_iconSvg__1gnumzi2 {
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 100%;
|
|
117
|
+
}
|
|
118
|
+
.Banner_referral__1gnumzi3 {
|
|
119
|
+
flex-direction: row;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: 16px;
|
|
122
|
+
padding: 16px;
|
|
123
|
+
background-color: #ffffff;
|
|
124
|
+
color: var(--text-primary__pbq4ak0);
|
|
125
|
+
border: 1px solid var(--border-default__pbq4akv);
|
|
126
|
+
border-radius: 12px;
|
|
127
|
+
}
|
|
128
|
+
.Banner_referralIconWrapper__1gnumzi4 {
|
|
129
|
+
flex-shrink: 0;
|
|
130
|
+
align-self: flex-start;
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
width: 40px;
|
|
135
|
+
height: 40px;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
}
|
|
138
|
+
.Banner_referralImage__1gnumzi5 {
|
|
139
|
+
max-width: 100%;
|
|
140
|
+
max-height: 100%;
|
|
141
|
+
width: auto;
|
|
142
|
+
height: auto;
|
|
143
|
+
object-fit: contain;
|
|
144
|
+
display: block;
|
|
145
|
+
}
|
|
146
|
+
.Banner_referralBody__1gnumzi6 {
|
|
147
|
+
flex: 1;
|
|
148
|
+
min-width: 0;
|
|
149
|
+
}
|
|
150
|
+
.Banner_referralTitle__1gnumzi7 {
|
|
151
|
+
font-size: 16px;
|
|
152
|
+
font-weight: 600;
|
|
153
|
+
color: var(--text-primary__pbq4ak0);
|
|
154
|
+
line-height: 22px;
|
|
155
|
+
}
|
|
156
|
+
.Banner_referralDescription__1gnumzi8 {
|
|
157
|
+
margin-bottom: 8px;
|
|
158
|
+
font-size: 14px;
|
|
159
|
+
color: #979797;
|
|
160
|
+
line-height: 22px;
|
|
161
|
+
}
|
|
162
|
+
.Banner_referralCta__1gnumzi9 {
|
|
163
|
+
display: inline-block;
|
|
164
|
+
padding: 8px 16px;
|
|
165
|
+
border: 1px solid #000000;
|
|
166
|
+
border-radius: 9999px;
|
|
167
|
+
color: var(--text-primary__pbq4ak0);
|
|
168
|
+
font-size: 10px;
|
|
169
|
+
font-weight: 700;
|
|
170
|
+
line-height: 12px;
|
|
171
|
+
text-transform: uppercase;
|
|
172
|
+
}
|
|
173
|
+
.Banner_frakLogo__1gnumzia {
|
|
174
|
+
position: absolute;
|
|
175
|
+
right: 16px;
|
|
176
|
+
bottom: 12px;
|
|
177
|
+
pointer-events: none;
|
|
178
|
+
}`,e);let[W,G]=f(!1),[K,q]=f(()=>R?z:a?`inapp`:null),J=o(null);u(()=>{R&&q(z)},[R,z]);let{reward:Y}=b(K===`referral`&&U,h),[X,re]=f(null);u(()=>{let e=window.FrakSetup?.client;K!==`inapp`||R||!U||!e||n(e).then(e=>re(e)).catch(()=>{})},[K,R,U]),u(()=>{R||!K||W||J.current!==K&&U&&(t(window.FrakSetup?.client,`banner_impression`,{placement:c,variant:K,has_reward:K===`referral`?!!Y:void 0}),J.current=K)},[K,W,U,R,c]),u(()=>{if(R||K===`inapp`)return;let e=()=>q(`referral`);return window.addEventListener(i,e),()=>window.removeEventListener(i,e)},[R,K]);let Z=s(async()=>{if(R)return;if(t(window.FrakSetup?.client,`banner_resolved`,{placement:c,variant:K??`referral`,outcome:`clicked`}),K===`referral`){G(!0);return}let e=X;if(!e&&window.FrakSetup?.client)try{e=await n(window.FrakSetup?.client)}catch{}let i=window.location.href;if(e){let t=new URL(i);t.searchParams.set(`fmt`,e),i=t.toString()}r(i)},[R,K,X,c]),ie=s(()=>{R||(t(window.FrakSetup?.client,`banner_resolved`,{placement:c,variant:K??`referral`,outcome:`dismissed`}),G(!0))},[R,K,c]),ae=v(),Q=B?.components?.banner??ae?.banner,$=d(()=>{if(K===`referral`){let e=Y?`Earn ${Y} on purchases on this site`:`You've been referred!`;return{title:g??Q?.referralTitle??e,description:x??Q?.referralDescription??`Earn rewards after your purchase via the Frak partner app.`,cta:S??Q?.referralCta??`Got it`}}return{title:C??Q?.inappTitle??`Open in your browser`,description:w??Q?.inappDescription??`For a better experience and to earn your rewards, open this page in your default browser.`,cta:T??Q?.inappCta??`Open browser`}},[K,Y,Q,g,x,S,C,w,T]);if(!K||!R&&(!V||H||W))return null;let oe=[M,`frak-banner`,`frak-banner--${K}`,m].filter(Boolean).join(` `);return K===`inapp`?p(k,{title:$.title,description:$.description,cta:$.cta,dismissLabel:`Dismiss`,onAction:Z,onDismiss:ie,className:[`frak-banner`,`frak-banner--inapp`,m].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):p(`div`,{class:oe,role:`alert`,children:[p(`div`,{class:`${F} frak-banner__icon`,children:E?p(`img`,{src:E,alt:``,class:I}):p(_,{class:j})}),p(`div`,{class:`${N} frak-banner__text`,children:[p(`p`,{class:`${L} frak-banner__title`,children:$.title}),p(`p`,{class:`${ne} frak-banner__description`,children:$.description}),p(`button`,{type:`button`,class:`${P} frak-banner__cta`,onClick:Z,children:$.cta})]}),p(te,{class:`${A} frak-banner__logo`,width:42,height:24})]})}c(R,`frak-banner`,[`placement`,`classname`,`interaction`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`,`imageUrl`],{shadow:!1});export{R as Banner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as e,i as t}from"./loader.js";import{c as n,d as r,i,o as a,t as o,u as s}from"./usePlacement.BgMXY5CX.js";import{t as c}from"./useGlobalComponents.TG9kIYSc.js";import{t as l}from"./useLightDomStyles.tjNBKcOr.js";import{t as u}from"./formatReward.B1ZyoceC.js";import{t as d}from"./useReward.B530suzR.js";import{t as f}from"./sharingPage.Dt8QZhlR.js";function p({placement:r,text:p=`Share and earn!`,classname:m=``,useReward:h,noRewardText:g,targetInteraction:_,clickAction:v,preview:y}){let b=!!y,x=o(r),S=c(),C=x?.components?.buttonShare??S?.buttonShare;l(`frak-button-share`,r,C?.css);let w=a(()=>x?.targetInteraction===void 0?_:x.targetInteraction,[x?.targetInteraction,_]),T=C?.text??p,E=C?.noRewardText??g,D=a(()=>C?.useReward??h===!0,[C?.useReward,h]),O=a(()=>C?.clickAction??v??`sharing-page`,[C?.clickAction,v]),{shouldRender:k,isHidden:A,isClientReady:j}=i(),{reward:M}=d(D&&j,w),N=a(()=>D?M?T.includes(`{REWARD}`)?u(T,M):`${T} ${M}`:E??u(T,void 0):T,[D,T,E,M]),P=n(()=>{if(!b){if(e(window.FrakSetup.client,`share_button_clicked`,{placement:r,target_interaction:w,has_reward:!!M,click_action:O}),O===`embedded-wallet`){t(w,r);return}f(w,r)}},[b,O,w,r,M]);if(!b&&(!k||A))return null;let F=[`button`,`button__fadeIn`,m].filter(Boolean).join(` `);return s(`button`,{type:`button`,disabled:!b&&!j,class:F,onClick:P,children:N})}r(p,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`useReward`,`noRewardText`,`targetInteraction`,`preview`],{shadow:!1});export{p as ButtonShare};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{r as e}from"./loader.js";import{d as t,i as n,l as r,m as i,n as a,o,s,t as c,u as l}from"./usePlacement.BgMXY5CX.js";import{t as u}from"./useReward.B530suzR.js";function d(e){return l(`svg`,{fill:`none`,height:`1em`,viewBox:`0 0 28 28`,width:`1em`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[l(`title`,{children:`Gift icon`}),l(`path`,{d:`m23.1427 13.9999v11.4285h-18.2857v-11.4285m9.1429 11.4285v-17.14282m0 0h-5.1429c-.75776 0-1.48448-.30102-2.0203-.83684s-.83684-1.26255-.83684-2.02031.30102-1.48448.83684-2.0203 1.26254-.83684 2.0203-.83684c4 0 5.1429 5.71429 5.1429 5.71429zm0 0h5.1428c.7578 0 1.4845-.30102 2.0203-.83684s.8369-1.26255.8369-2.02031-.3011-1.48448-.8369-2.0203-1.2625-.83684-2.0203-.83684c-4 0-5.1428 5.71429-5.1428 5.71429zm-11.42861 0h22.85711v5.71432h-22.85711z`,stroke:`#fff`,"stroke-linecap":`round`,"stroke-linejoin":`round`})]})}function f({placement:t,classname:f=``,useReward:p,targetInteraction:m}){let h=c(t),g=o(()=>h?.targetInteraction===void 0?m:h.targetInteraction,[h?.targetInteraction,m]),_=o(()=>p===!0,[p]),{shouldRender:v,isHidden:y,isClientReady:b}=n(),{reward:x}=u(_&&b,g),[S,C]=s(`right`);if(r(()=>{let e=h?.components?.buttonWallet?.position,t=window.FrakSetup?.modalWalletConfig?.metadata?.position;C(e??t??`right`)},[h?.components?.buttonWallet?.position]),!v||y)return null;let w=[`button`,`button__fadeIn`,S===`left`?`button__left`:`button__right`,f].filter(Boolean).join(` `);return l(i,{children:[l(`style`,{children:a(`
|
|
2
2
|
.button {
|
|
3
3
|
all: unset;
|
|
4
4
|
position: fixed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,g as t,h as n,m as r,p as i,u as a}from"./usePlacement.BgMXY5CX.js";function o(e,t){for(var n in t)e[n]=t[n];return e}function s(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 c(e,t){this.props=e,this.context=t}(c.prototype=new t).isPureReactComponent=!0,c.prototype.shouldComponentUpdate=function(e,t){return s(this.props,e)||s(this.state,t)};var l=n.__b;n.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),l&&l(e)},typeof Symbol<`u`&&Symbol.for;var u=n.__e;n.__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)}u(e,t,n,r)};var d=n.unmount;function f(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=o({},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 f(e,t,n)})),e}function p(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return p(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 m(){this.__u=0,this.o=null,this.__b=null}function h(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function g(){this.i=null,this.l=null}n.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),d&&d(e)},(m.prototype=new t).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=h(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]=p(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)},m.prototype.componentWillUnmount=function(){this.o=[]},m.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),a=this.__v.__k[0].__c;this.__v.__k[0]=f(this.__b,n,a.__O=a.__P)}this.__b=null}var o=t.__a&&i(r,null,e.fallback);return o&&(o.__u&=-33),[i(r,null,t.__a?null:e.children),o]};var _=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]}};(g.prototype=new t).__a=function(e){var t=this,n=h(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),_(t,e,r)):i()};n?n(a):a()}},g.prototype.render=function(t){this.i=null,this.l=new Map;var n=e(t.children);t.revealOrder&&t.revealOrder[0]===`b`&&n.reverse();for(var r=n.length;r--;)this.l.set(n[r],this.i=[1,0,this.i]);return t.children},g.prototype.componentDidUpdate=g.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){_(e,n,t)})};var v=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,y=/^(?: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]/,b=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,x=/[A-Z0-9]/g,S=typeof document<`u`,C=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};t.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(t.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var w=n.event;n.event=function(e){return w&&(e=w(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var T={configurable:!0,get:function(){return this.class}},E=n.vnode;n.vnode=function(t){typeof t.type==`string`&&function(t){var n=t.props,r=t.type,i={},a=r.indexOf(`-`)==-1;for(var o in n){var s=n[o];if(!(o===`value`&&`defaultValue`in n&&s==null||S&&o===`children`&&r===`noscript`||o===`class`||o===`className`)){var c=o.toLowerCase();o===`defaultValue`&&`value`in n&&n.value==null?o=`value`:o===`download`&&!0===s?s=``:c===`translate`&&s===`no`?s=!1:c[0]===`o`&&c[1]===`n`?c===`ondoubleclick`?o=`ondblclick`:c!==`onchange`||r!==`input`&&r!==`textarea`||C(n.type)?c===`onfocus`?o=`onfocusin`:c===`onblur`?o=`onfocusout`:b.test(o)&&(o=c):c=o=`oninput`:a&&y.test(o)?o=o.replace(x,`-$&`).toLowerCase():s===null&&(s=void 0),c===`oninput`&&i[o=c]&&(o=`oninputCapture`),i[o]=s}}r==`select`&&(i.multiple&&Array.isArray(i.value)&&(i.value=e(n.children).forEach(function(e){e.props.selected=i.value.indexOf(e.props.value)!=-1})),i.defaultValue!=null&&(i.value=e(n.children).forEach(function(e){e.props.selected=i.multiple?i.defaultValue.indexOf(e.props.value)!=-1:i.defaultValue==e.props.value}))),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,`className`,T)):n.className&&(i.class=i.className=n.className),t.props=i}(t),t.$$typeof=v,E&&E(t)};var D=n.__r;n.__r=function(e){D&&D(e),e.__c};var O=n.diffed;n.diffed=function(e){O&&O(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 k(e){return a(`svg`,{width:`15`,height:`15`,viewBox:`0 0 15 15`,fill:`none`,"aria-hidden":`true`,...e,children:a(`path`,{d:`M7.33301 0C11.383 0 14.6668 3.28307 14.667 7.33301C14.667 11.3831 11.3831 14.667 7.33301 14.667C3.28307 14.6668 0 11.383 0 7.33301C0.000175746 3.28318 3.28318 0.000175742 7.33301 0ZM10.3896 4.27734C10.151 4.0388 9.76303 4.03775 9.52441 4.27637L7.33301 6.46777L5.14258 4.27637C4.90397 4.03776 4.51601 4.03882 4.27734 4.27734C4.03869 4.516 4.03771 4.90392 4.27637 5.14258L6.4668 7.33398L4.27637 9.52441C4.03807 9.76306 4.03891 10.1511 4.27734 10.3896C4.51589 10.6282 4.9039 10.629 5.14258 10.3906L7.33301 8.2002L9.52344 10.3906C9.76198 10.629 10.15 10.6279 10.3887 10.3896C10.6273 10.151 10.6283 9.76209 10.3896 9.52344L8.2002 7.33398L10.3906 5.14258C10.6293 4.90392 10.6283 4.516 10.3896 4.27734Z`,fill:`currentColor`})})}function A(e){return a(`svg`,{width:`12`,height:`12`,viewBox:`0 0 12 12`,fill:`none`,"aria-hidden":`true`,...e,children:a(`path`,{d:`M5.45508 0C5.75614 0.000209333 6 0.244788 6 0.545898C5.99979 0.846831 5.75601 1.09159 5.45508 1.0918H4.36426C3.05445 1.0918 2.27964 1.35707 1.81836 1.81836C1.35714 2.27966 1.0918 3.05454 1.0918 4.36426V7.63672C1.09186 8.94625 1.35713 9.72139 1.81836 10.1826C2.2797 10.6436 3.05488 10.9092 4.36426 10.9092H7.63672C8.94628 10.9091 9.72135 10.6438 10.1826 10.1826C10.6438 9.72139 10.9091 8.94625 10.9092 7.63672V6.5459C10.9092 6.24466 11.1538 6 11.4551 6C11.7561 6.00028 12 6.24483 12 6.5459V7.63672C11.9999 9.05391 11.72 10.1882 10.9541 10.9541C10.1882 11.7199 9.05394 12 7.63672 12H4.36426C2.94714 12 1.81283 11.7197 1.04688 10.9541C0.280997 10.1882 6.04321e-05 9.05391 0 7.63672V4.36426C0 2.94692 0.28099 1.81283 1.04688 1.04688C1.81284 0.280915 2.94686 0 4.36426 0H5.45508ZM11.4541 0C11.7553 2.20143e-05 11.999 0.244672 11.999 0.545898V3.16406C11.9988 3.46509 11.7552 3.70896 11.4541 3.70898C11.1532 3.70873 10.9084 3.46495 10.9082 3.16406V1.8623L6.93066 5.83984C6.71766 6.05283 6.37218 6.05283 6.15918 5.83984C5.94657 5.62681 5.94632 5.28124 6.15918 5.06836L10.1357 1.0918H8.83594C8.53504 1.09154 8.29025 0.846803 8.29004 0.545898C8.29004 0.244816 8.53491 0.000254588 8.83594 0H11.4541Z`,fill:`currentColor`})})}function j(e){return a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e.width??`63`,height:e.height??`24`,fill:`none`,viewBox:`0 0 63 24`,...e,children:[a(`title`,{children:`Frak`}),a(`rect`,{width:`24`,height:`24`,rx:`6`,fill:`#0043EF`}),a(`path`,{fill:`white`,d:`M9.76941 15.9093L5.1481 14.3453C5.06012 14.3155 4.96875 14.3811 4.96875 14.474V17.3274C4.96875 17.3857 5.00584 17.4373 5.06103 17.4561L9.68234 19.02C9.77032 19.0499 9.86169 18.9843 9.86169 18.8913V16.038C9.86169 15.9796 9.8246 15.9281 9.76941 15.9093ZM14.5764 10.4374L9.95396 12.0013C9.89878 12.0201 9.86169 12.0717 9.86169 12.13V14.9833C9.86169 15.0763 9.95306 15.1419 10.041 15.112L14.6635 13.5481C14.7187 13.5293 14.7558 13.4777 14.7558 13.4194V10.566C14.7558 10.4731 14.6646 10.4075 14.5764 10.4374ZM18.9173 5.01993L11.1787 7.51231C11.1226 7.53041 11.0846 7.58265 11.0846 7.64168V10.5651C11.0846 10.6233 11.1423 10.6644 11.1983 10.6463L18.9369 8.15396C18.993 8.13586 19.0312 8.08362 19.0312 8.02459V5.10113C19.031 5.043 18.9734 5.00184 18.9173 5.01993Z`}),a(`path`,{fill:`currentColor`,d:`M52.7211 9.5114C52.8254 9.51159 52.9095 9.59651 52.9096 9.70085L52.8383 18.2057C52.8383 18.3069 52.7575 18.3891 52.6577 18.3893L52.6411 18.3864H51.3022C51.1512 18.3861 50.7795 18.2504 50.3901 18.0007C49.8574 18.2487 49.2664 18.3893 48.644 18.3893H48.3901C47.2354 18.3893 46.1869 17.9123 45.4272 17.1442C44.667 16.3763 44.1958 15.316 44.1957 14.1481C44.1957 12.98 44.6675 11.9191 45.4272 11.151C46.1587 10.4118 47.1591 9.94381 48.2631 9.90983C49.1702 9.85599 49.9861 9.98778 50.4887 10.4967V9.70085C50.4888 9.5964 50.5737 9.51141 50.6782 9.5114H52.7211ZM35.352 5.61686H36.9623C37.0879 5.61703 37.1896 5.71855 37.1909 5.84538V7.81022C37.1909 7.93652 37.088 8.03874 36.9623 8.03874H34.9203C34.3151 8.03874 33.6274 8.63552 33.6274 9.25163V10.6149C34.2626 9.97905 34.9289 9.65371 35.352 9.63054H36.4604C36.5867 9.63054 36.6889 9.73339 36.6889 9.85905V11.8239C36.6889 11.9502 36.586 12.0524 36.4604 12.0524H34.9194C34.3143 12.0525 33.6276 12.6493 33.6274 13.2653V18.1999C33.6272 18.3042 33.5423 18.3883 33.4379 18.3883H31.395C31.2907 18.3882 31.2066 18.3042 31.2065 18.1999V9.93815C31.2065 9.86969 31.1975 9.80188 31.2006 9.73405C31.2397 8.87625 31.1516 5.44451 35.352 5.61686ZM39.933 9.63054C40.0375 9.63055 40.1224 9.71555 40.1225 9.81999V10.6149C40.7578 9.97909 41.5843 9.63054 41.8471 9.63054H43.4565C43.5821 9.63054 43.6844 9.73339 43.685 9.85905V11.8239C43.6848 11.95 43.5829 12.0513 43.4575 12.0514H41.4145C40.8093 12.0515 40.1225 12.6492 40.1225 13.2653V18.1999C40.1223 18.3042 40.0374 18.3883 39.933 18.3883H37.8901C37.7859 18.3882 37.7018 18.3041 37.7016 18.1999V9.81999C37.7017 9.71565 37.7858 9.63072 37.8901 9.63054H39.933ZM56.1967 7.00651C56.3021 7.00678 56.3879 7.09283 56.3881 7.1989V13.4479L59.8295 10.1891C59.8654 10.1552 59.912 10.1364 59.9614 10.1364H62.2797C62.4501 10.1364 62.5363 10.3414 62.4174 10.4626L59.3022 13.6325L62.7993 18.0749C62.8986 18.2012 62.8091 18.3864 62.6489 18.3864H60.2387C60.1804 18.3864 60.1258 18.3596 60.0893 18.3141L57.6723 15.3161C57.5998 15.2283 57.4679 15.2203 57.3871 15.3005L56.3881 16.2858V18.194C56.3881 18.2996 56.3029 18.3861 56.1967 18.3864H54.1879C54.0823 18.3862 53.9955 18.3003 53.9955 18.194V7.1989C53.9958 7.09341 54.0818 7.00669 54.1879 7.00651H56.1967ZM48.3705 11.9606C47.7802 11.9607 47.2427 12.2054 46.853 12.6003C46.4626 12.9952 46.2202 13.5386 46.2202 14.1354C46.2202 14.7323 46.4626 15.2763 46.853 15.6706C47.2427 16.0654 47.7802 16.3102 48.3705 16.3102H48.6616C49.2513 16.3102 49.7894 16.0654 50.1791 15.6706C50.5696 15.2763 50.8119 14.7323 50.8119 14.1354C50.8119 13.5386 50.5695 12.9945 50.1791 12.6003C49.7894 12.2055 49.2512 11.9606 48.6616 11.9606H48.3705Z`})]})}2*Math.PI*11;function M(e){return a(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,...e,children:a(`path`,{d:`M8 0C12.4183 0 16 3.58172 16 8C16 12.4183 12.4183 16 8 16C3.58172 16 0 12.4183 0 8C0 3.58172 3.58172 0 8 0ZM8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5ZM8.10352 10.207C8.82025 10.2071 9.23531 10.6346 9.23535 11.3262C9.23535 12.0304 8.82028 12.4579 8.10352 12.458C7.36167 12.4579 6.97168 12.0304 6.97168 11.3262C6.97172 10.6346 7.36171 10.2072 8.10352 10.207ZM8.84766 3.54102C9.01311 3.54121 9.14736 3.67535 9.14746 3.84082V4.74805L8.84375 8.37012C8.83069 8.52552 8.6999 8.64551 8.54395 8.64551H7.62891C7.47133 8.64523 7.34074 8.52251 7.33008 8.36523L7.08496 4.74805V3.84082C7.08507 3.67533 7.2193 3.54119 7.38477 3.54102H8.84766Z`,fill:`currentColor`})})}function N(e){return a(`svg`,{viewBox:`0 0 100 100`,fill:`none`,"aria-hidden":`true`,...e,children:[a(`circle`,{cx:`38`,cy:`28`,r:`23`,fill:`#FFF533`}),a(`path`,{d:`M50 38C30 10 12 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),a(`path`,{d:`M50 38C70 10 88 30 50 38Z`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),a(`rect`,{x:`10`,y:`38`,width:`80`,height:`16`,rx:`2`,stroke:`#222222`,"stroke-width":`4`}),a(`path`,{d:`M15 54V89C15 90.6 16.4 92 18 92H82C83.6 92 85 90.6 85 89V54`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),a(`line`,{x1:`50`,y1:`54`,x2:`50`,y2:`92`,stroke:`#222222`,"stroke-width":`4`,"stroke-linecap":`round`})]})}export{k as a,A as i,M as n,j as r,N as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,b as t,g as n,m as r}from"./loader.js";import{d as i,i as a,o,t as s,u as c}from"./usePlacement.BgMXY5CX.js";import{t as l}from"./useLightDomStyles.tjNBKcOr.js";function u(r=`wallet`,i){let a=window.FrakSetup?.client;a&&t(a,`open_in_app_clicked`,{path:r,placement:i}),n(`${e}${r}`,{onFallback:()=>{a&&t(a,`app_not_installed`,{path:r,placement:i})}})}function d(){return{isMobile:o(()=>r(),[])}}function f({placement:e,text:t=`Open in App`,classname:n=``}){let r=s(e),{shouldRender:i,isHidden:o,isClientReady:f}=a(),{isMobile:p}=d();l(`frak-open-in-app`,e,r?.components?.openInApp?.css);let m=r?.components?.openInApp?.text??t;if(!p||!i||o)return null;let h=()=>{u(void 0,e)},g=[`button`,`button__fadeIn`,n].filter(Boolean).join(` `);return c(`button`,{type:`button`,"aria-label":`Open in Frak Wallet app`,disabled:!f,class:g,onClick:h,children:m})}i(f,`frak-open-in-app`,[`text`,`placement`,`classname`],{shadow:!1});export{f as OpenInAppButton};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import{S as e,T as t,a as n,b as r,l as i,s as a,x as o}from"./loader.js";import{a as s,c,d as l,i as ee,l as u,o as d,s as f,t as p,u as m}from"./usePlacement.BgMXY5CX.js";import{r as h,t as g}from"./GiftIcon.eRNTGQ_r.js";import{t as _}from"./useGlobalComponents.TG9kIYSc.js";import{t as v}from"./useLightDomStyles.tjNBKcOr.js";import{n as te,t as y}from"./formatReward.B1ZyoceC.js";import{t as b}from"./sharingPage.Dt8QZhlR.js";var ne=`PostPurchase_card__5fv5lh0`,re=`PostPurchase_cardLayout__5fv5lh1`,ie=`PostPurchase_cardLeft__5fv5lh2`,ae=`PostPurchase_cardRight__5fv5lh3`,oe=`PostPurchase_cta__5fv5lh6 sharedBaseCss_buttonReset__7cswil0`,se=`PostPurchase_customImage__5fv5lha`,ce=`PostPurchase_frakLogo__5fv5lhb`,le=`PostPurchase_giftIcon__5fv5lh8`,ue=`PostPurchase_icon__5fv5lh7`,de=`PostPurchase_imageWrapper__5fv5lh9`,fe=`PostPurchase_message__5fv5lh5`;function x(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function pe(e){if(!e)return null;if(Array.isArray(e))return e;if(typeof e!=`string`)return null;try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function S(e){if(!e||typeof e!=`object`)return null;let t=e,n=typeof t.title==`string`?t.title.trim():``;if(n===``)return null;let r={title:n};return typeof t.imageUrl==`string`&&x(t.imageUrl)&&(r.imageUrl=t.imageUrl),typeof t.link==`string`&&x(t.link)&&(r.link=t.link),typeof t.utmContent==`string`&&t.utmContent!==``&&(r.utmContent=t.utmContent),r}function C(e,t){let n=t.rewards.find(e=>e.interactionTypeKey===`purchase`&&(e.referrer||e.referee));if(!n)return null;let r=e?.isReferred&&n.referee?`referee`:`referrer`;return{variant:r,reward:r===`referee`?n.referee:n.referrer,merchantDomain:t.onChainMetadata.domain}}function w({customerId:l,orderId:x,token:w,sharingUrl:T,merchantId:E,placement:D,classname:O=``,variant:k,badgeText:A,referrerText:j,refereeText:M,ctaText:N,preview:P,previewVariant:F,products:I,imageUrl:L}){let R=!!P,{shouldRender:z,isHidden:B,isClientReady:V}=ee(),H=p(D);v(`frak-post-purchase`,D,H?.components?.postPurchase?.css,`.PostPurchase_card__5fv5lh0 {
|
|
2
|
+
padding: 16px;
|
|
3
|
+
border-radius: 12px;
|
|
4
|
+
background-color: var(--surface-background__pbq4akc);
|
|
5
|
+
border: 1px solid var(--border-default__pbq4akv);
|
|
6
|
+
}
|
|
7
|
+
.PostPurchase_cardLayout__5fv5lh1 {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 32px;
|
|
12
|
+
}
|
|
13
|
+
.PostPurchase_cardLeft__5fv5lh2 {
|
|
14
|
+
flex-grow: 1;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
gap: 8px;
|
|
19
|
+
}
|
|
20
|
+
.PostPurchase_cardRight__5fv5lh3 {
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
align-items: flex-end;
|
|
25
|
+
gap: 8px;
|
|
26
|
+
text-align: right;
|
|
27
|
+
}
|
|
28
|
+
.PostPurchase_badge__5fv5lh4 {
|
|
29
|
+
align-self: flex-start;
|
|
30
|
+
background-color: #FFF534;
|
|
31
|
+
border-radius: 4px;
|
|
32
|
+
padding: 4px 8px;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
line-height: 12px;
|
|
36
|
+
color: var(--text-primary__pbq4ak0);
|
|
37
|
+
}
|
|
38
|
+
.PostPurchase_message__5fv5lh5 {
|
|
39
|
+
margin: 0;
|
|
40
|
+
font-size: 16px;
|
|
41
|
+
line-height: 22px;
|
|
42
|
+
color: var(--text-primary__pbq4ak0);
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
}
|
|
45
|
+
.PostPurchase_cta__5fv5lh6 {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
gap: 4px;
|
|
50
|
+
padding: 12px 16px;
|
|
51
|
+
border-radius: 9999px;
|
|
52
|
+
background-color: var(--text-primary__pbq4ak0);
|
|
53
|
+
color: var(--text-onAction__pbq4ak6);
|
|
54
|
+
font-size: 12px;
|
|
55
|
+
font-weight: bold;
|
|
56
|
+
text-transform: uppercase;
|
|
57
|
+
}
|
|
58
|
+
.PostPurchase_cta__5fv5lh6:disabled {
|
|
59
|
+
opacity: 0.7;
|
|
60
|
+
cursor: default;
|
|
61
|
+
}
|
|
62
|
+
.PostPurchase_icon__5fv5lh7 {
|
|
63
|
+
margin: -2px 0;
|
|
64
|
+
}
|
|
65
|
+
.PostPurchase_giftIcon__5fv5lh8 {
|
|
66
|
+
display: block;
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
}
|
|
69
|
+
.PostPurchase_imageWrapper__5fv5lh9 {
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
width: 80px;
|
|
75
|
+
height: 80px;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
}
|
|
78
|
+
.PostPurchase_customImage__5fv5lha {
|
|
79
|
+
max-width: 100%;
|
|
80
|
+
max-height: 100%;
|
|
81
|
+
width: auto;
|
|
82
|
+
height: auto;
|
|
83
|
+
object-fit: contain;
|
|
84
|
+
display: block;
|
|
85
|
+
}
|
|
86
|
+
.PostPurchase_frakLogo__5fv5lhb {
|
|
87
|
+
display: block;
|
|
88
|
+
margin-left: auto;
|
|
89
|
+
}`,t);let[U,me]=f(null),[W,G]=f(!1);u(()=>{R||!V||!l||!x||!w||n({customerId:l,orderId:x,token:w,merchantId:E}).catch(()=>{})},[R,V,l,x,w,E]),u(()=>{if(R||!V||W)return;let t=window.FrakSetup?.client;t&&Promise.all([a(t),i(t)]).then(([e,t])=>{G(!0),me(C(e,t))}).catch(t=>{if(t instanceof e&&t.code===o.configError){G(!0);return}console.warn(`[Frak] Post-purchase context error`,t)})},[R,V,W]);let K=s(null),q=k??U?.variant??(R?F??`referrer`:void 0),J=T??U?.merchantDomain,Y=d(()=>{if(!U?.reward)return;let e=window.FrakSetup?.client?.config?.metadata?.currency;return te(U.reward,e)},[U?.reward]),he=_(),X=H?.components?.postPurchase??he?.postPurchase,Z=A??X?.badgeText,Q=d(()=>({message:q===`referee`?Y?y(M??X?.refereeText??`You just earned {REWARD}! Share with friends to earn even more.`,Y):M??X?.refereeNoRewardText??`You just earned a reward! Share with friends to earn even more.`:Y?y(j??X?.referrerText??`Earn {REWARD} by sharing this with your friends!`,Y):j??X?.referrerNoRewardText??`Share this with your friends and earn rewards!`,cta:Y?y(N??X?.ctaText??`Share & earn {REWARD}`,Y):N??X?.ctaNoRewardText??`Share & earn`}),[q,Y,X,j,M,N]);u(()=>{q&&K.current!==q&&(!R&&(!z||B||!V)||(r(window.FrakSetup?.client,`post_purchase_impression`,{placement:D,variant:q,has_reward:!!U?.reward}),K.current=q))},[q,z,B,V,R,D,U?.reward]);let $=d(()=>{let e=pe(I);if(!e)return;let t=[];for(let n of e){let e=S(n);e&&t.push(e)}return t.length>0?t:void 0},[I]),ge=c(()=>{q&&(r(window.FrakSetup?.client,`post_purchase_clicked`,{placement:D,variant:q}),b(void 0,D,{link:J,products:$}))},[q,D,J,$]);return!q||!R&&(!z||B||!U)?null:m(`div`,{className:[ne,O].filter(Boolean).join(` `),children:m(`div`,{class:re,children:[m(`div`,{class:ie,children:[Z&&m(`span`,{class:`PostPurchase_badge__5fv5lh4`,children:Z}),m(`p`,{class:fe,children:Q.message}),m(`button`,{type:`button`,className:`${oe} button`,disabled:!R&&!V,onClick:R?void 0:ge,children:[Q.cta,m(`svg`,{width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":`true`,className:`${ue} button`,children:m(`path`,{d:`M13.8984 11.144C13.9864 11.052 14.1543 11.1114 14.1543 11.2388V11.644C14.1543 13.0509 12.6288 14.1918 10.7471 14.1919C8.86523 14.1919 7.33984 13.051 7.33984 11.644V11.2388C7.33984 11.1114 7.50675 11.052 7.59473 11.144C8.3452 11.9295 9.47906 12.4292 10.7471 12.4292C12.0149 12.4291 13.148 11.9293 13.8984 11.144ZM1.8457 9.64795C1.8457 9.51169 2.01094 9.44452 2.10254 9.54053C2.85304 10.3238 3.98586 10.8247 5.25293 10.8247C5.52246 10.8247 5.78608 10.8026 6.04102 10.7593C6.25744 10.7225 6.46582 10.8816 6.46582 11.1011V12.1704C6.46564 12.319 6.36769 12.4507 6.22266 12.4829C5.91535 12.5512 5.58981 12.5874 5.25293 12.5874C3.3711 12.5874 1.8457 11.4469 1.8457 10.0396V9.64795ZM10.7471 6.20654C12.6288 6.20666 14.1543 7.3475 14.1543 8.75439C14.1541 10.1612 12.6287 11.3012 10.7471 11.3013C8.86535 11.3013 7.34004 10.1612 7.33984 8.75439C7.33984 7.34743 8.86523 6.20654 10.7471 6.20654ZM1.8457 6.8501C1.84597 6.71385 2.01208 6.64848 2.10352 6.74365C2.85393 7.52827 3.98602 8.0278 5.25293 8.02783C5.52282 8.02783 5.78667 8.00448 6.04199 7.96143C6.258 7.92499 6.46582 8.08514 6.46582 8.3042V9.37256C6.46582 9.52127 6.36783 9.65378 6.22266 9.68604C5.91537 9.75429 5.58979 9.79053 5.25293 9.79053C3.3711 9.79048 1.8457 8.64863 1.8457 7.24268V6.8501ZM5.25293 1.80811C7.13481 1.80811 8.66016 2.94856 8.66016 4.35596C8.66008 5.76331 7.13476 6.90381 5.25293 6.90381C3.37115 6.90376 1.84578 5.76328 1.8457 4.35596C1.8457 2.94858 3.3711 1.80815 5.25293 1.80811Z`,fill:`currentColor`})})]})]}),m(`div`,{class:ae,children:[L?m(`span`,{class:de,children:m(`img`,{src:L,alt:``,class:se})}):m(g,{className:le,width:80,height:80}),m(h,{className:ce,width:42,height:24})]})]})})}l(w,`frak-post-purchase`,[`customerId`,`orderId`,`token`,`sharingUrl`,`merchantId`,`placement`,`classname`,`variant`,`badgeText`,`referrerText`,`refereeText`,`ctaText`,`products`,`preview`,`previewVariant`,`imageUrl`],{shadow:!1});export{w as PostPurchase};
|
package/cdn/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=
|
|
1
|
+
import(`https://cdn.jsdelivr.net/npm/@frak-labs/components@beta/cdn/loader.js?v=1778512490343`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as e,h as t,p as n}from"./loader.js";function r(r,i,a){let o=t(i),s=n(o);switch(r.payoutType){case`fixed`:return e(Math.round(r.amount[s]),o);case`percentage`:return a===void 0?`${r.percent} %`:e(Math.round(r.percent*a/100),o);case`tiered`:{let t=r.tiers.reduce((e,t)=>Math.max(e,t.amount[s]),0);return e(Math.round(t),o)}}}function i(e,t){return t?e.replace(`{REWARD}`,t):e.replace(`{REWARD}`,``)}export{r as n,i as t};
|