@frak-labs/components 1.3.3-beta.a79006c4 → 1.3.3-beta.f058df07
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/{Ambassador.7wEDPaYu.js → Ambassador.BqRaiquY.js} +2 -2
- package/cdn/Banner.8mqstDGK.js +208 -0
- package/cdn/ButtonShare.C7xLonci.js +1 -0
- package/cdn/ButtonWallet.CYf4UqML.js +40 -0
- package/cdn/{GiftIcon.CX0gLPUJ.js → GiftIcon.CW1SwrXH.js} +1 -1
- package/cdn/OpenInAppButton.Djz_cb9Y.js +1 -0
- package/cdn/PostPurchase.CxuZ9cs-.js +102 -0
- package/cdn/components.js +1 -1
- package/cdn/{jsxRuntime.module.CUZaa90V.js → jsxRuntime.module.DWH-kRVd.js} +1 -1
- package/cdn/loader.js +14 -14
- package/cdn/useGlobalComponents.DVgSWfOp.js +1 -0
- package/cdn/useLightDomStyles.B72V1WPK.js +31 -0
- package/cdn/usePlacement.DEOEf5_6.js +1 -0
- package/cdn/useReward.g4cWDddX.js +1 -0
- package/dist/{GiftIcon-JVhSFEhP.js → GiftIcon-B9k_syq6.js} +6 -12
- package/dist/ambassador.d.ts +0 -6
- package/dist/ambassador.js +106 -33
- package/dist/banner.d.ts +0 -6
- package/dist/banner.js +20 -29
- package/dist/buttonShare.d.ts +0 -6
- package/dist/buttonShare.js +8 -10
- package/dist/buttonWallet.d.ts +0 -6
- package/dist/buttonWallet.js +7 -11
- package/dist/i18n/defaults.d.ts +0 -2
- package/dist/i18n/defaults.js +1 -2
- package/dist/openInApp.d.ts +0 -6
- package/dist/openInApp.js +7 -11
- package/dist/postPurchase.d.ts +0 -6
- package/dist/postPurchase.js +10 -13
- package/dist/{rewards-HJlTkTcY.js → rewards-CfGynCt6.js} +2 -4
- package/dist/{sharedBaseCss.css-BkMpQeRx.js → sharedBaseCss.css-nYy9vlzH.js} +1 -3
- package/dist/{sharedCss-CPNmnpXA.js → sharedCss-SKmJGZgN.js} +10 -20
- package/dist/{useGlobalComponents-B3s2UQFk.js → useGlobalComponents-BF47jsBt.js} +2 -3
- package/dist/{useLightDomStyles-BQ5FvCPi.js → useLightDomStyles-wGaNXHqN.js} +4 -6
- package/dist/{usePlacement-BpaIbzun.js → usePlacement-Dd7itnCf.js} +2 -3
- package/dist/{useReward-WmsNOFlz.js → useReward-DmukZKoh.js} +2 -3
- package/package.json +13 -13
- package/cdn/Banner.8NeKFnVj.js +0 -208
- package/cdn/ButtonShare.BTT49Sbn.js +0 -1
- package/cdn/ButtonWallet.CB0Ysymx.js +0 -40
- package/cdn/OpenInAppButton.DdL3xii8.js +0 -1
- package/cdn/PostPurchase.ClgDFxmZ.js +0 -102
- package/cdn/useGlobalComponents.CXuceSQ0.js +0 -1
- package/cdn/useLightDomStyles.C3oQ3HLu.js +0 -1
- package/cdn/usePlacement.Cq64cZ9Q.js +0 -1
- package/cdn/useReward.BpO3D675.js +0 -1
|
@@ -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};
|