@frak-labs/components 1.0.2-beta.9b94b95c → 1.0.2-beta.bb30f110
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.BjcYEoH4.js +162 -0
- package/cdn/ButtonShare.DNdo_eQJ.js +1 -0
- package/cdn/{ButtonWallet.Cwz9qFhE.js → ButtonWallet.CN2iHSTB.js} +1 -1
- package/cdn/{OpenInAppButton.Hq9EjwJE.js → OpenInAppButton.C1Yipwka.js} +1 -1
- package/cdn/{PostPurchase.CencJT_C.js → PostPurchase.CTE-Q0eK.js} +2 -2
- package/cdn/components.js +1 -1
- package/cdn/formatReward.C7mU9_cV.js +1 -0
- package/cdn/loader.js +1 -1
- package/cdn/sharingPage.Do_xfrTN.js +1 -0
- package/cdn/{sprinkles.css.ts.vanilla.Ct795MMK.js → sprinkles.css.ts.vanilla.DCtQVHA4.js} +1 -1
- package/cdn/useGlobalComponents.UJmjUUxk.js +1 -0
- package/cdn/{useLightDomStyles.DqYouFn3.js → useLightDomStyles.Gt7YUMDl.js} +1 -1
- package/cdn/{usePlacement.Di6eZ4ty.js → usePlacement.BJ7qe-pw.js} +1 -1
- package/cdn/{useReward.DWyyva4u.js → useReward.QsQc2c1D.js} +1 -1
- package/dist/buttonShare.d.ts +9 -4
- package/dist/buttonShare.js +13 -218
- package/dist/postPurchase.js +26 -25
- package/dist/{sharingPage-BHH1xQ_w.js → sharingPage-DFvQbviS.js} +2 -2
- package/package.json +3 -3
- package/cdn/Banner.1iUbfe7Z.js +0 -162
- package/cdn/ButtonShare.DbUZUx82.js +0 -1
- package/cdn/formatReward.BaR9pE50.js +0 -1
- package/cdn/sharingPage.DX1H39Pz.js +0 -1
- package/cdn/useGlobalComponents.CLH7id-Y.js +0 -1
package/cdn/Banner.1iUbfe7Z.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import{C as e,d as t,h as n,l as r,v as i}from"./loader.js";import{a,c as o,d as s,i as c,l,o as u,s as d,t as f,u as p}from"./usePlacement.Di6eZ4ty.js";import{a as m,c as h,i as g,n as _,r as v,s as y,t as b}from"./sprinkles.css.ts.vanilla.Ct795MMK.js";import{t as x}from"./useGlobalComponents.CLH7id-Y.js";import{t as S}from"./useLightDomStyles.DqYouFn3.js";import{t as C}from"./useReward.DWyyva4u.js";const w=`@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
|
-
}`;var T=`inAppBanner_body__1ibpiy75`,E=`inAppBanner_closeButton__1ibpiy78`,D=`inAppBanner_container__1ibpiy71`,O=`inAppBanner_cta__1ibpiy77`,k=`inAppBanner_description__1ibpiy76`,A=`inAppBanner_header__1ibpiy72`,j=`inAppBanner_iconWrapper__1ibpiy73`,M=`inAppBanner_title__1ibpiy74`;g+w;function N({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return p(`div`,{className:`${D}${o?` ${o}`:``}`,role:`alert`,children:[p(`div`,{className:A,children:[p(`span`,{className:`${j}${s?.icon?` ${s.icon}`:``}`,children:p(m,{width:20,height:20})}),p(`p`,{className:`${M}${s?.title?` ${s.title}`:``}`,children:e})]}),p(`div`,{className:T,children:[p(`p`,{className:`${k}${s?.description?` ${s.description}`:``}`,children:t}),p(`button`,{type:`button`,className:`${O}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,p(y,{width:14,height:14})]})]}),p(`button`,{type:`button`,className:`${E}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:p(h,{width:16,height:16})})]})}var P=`Banner_iconSvg__1gnumzi2`,F=`Banner_referral__1gnumzi3 reset_base__1831jhd0 Banner_rootBase__1gnumzi1`,I=`Banner_referralBody__1gnumzi5`,ee=`Banner_referralCta__1gnumzi8 reset_element_button__1831jhd6 reset_fieldAppearance__1831jhd2 reset_focusRing__1831jhd1`,te=`Banner_referralDescription__1gnumzi7 reset_base__1831jhd0`,L=`Banner_referralIconWrapper__1gnumzi4`,R=`Banner_referralTitle__1gnumzi6 reset_base__1831jhd0`;const z=_+g+b+w+`@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
|
-
}
|
|
126
|
-
.Banner_referralIconWrapper__1gnumzi4 {
|
|
127
|
-
flex-shrink: 0;
|
|
128
|
-
align-self: flex-start;
|
|
129
|
-
width: 40px;
|
|
130
|
-
height: 40px;
|
|
131
|
-
}
|
|
132
|
-
.Banner_referralBody__1gnumzi5 {
|
|
133
|
-
flex: 1;
|
|
134
|
-
min-width: 0;
|
|
135
|
-
}
|
|
136
|
-
.Banner_referralTitle__1gnumzi6 {
|
|
137
|
-
font-size: 16px;
|
|
138
|
-
font-weight: 600;
|
|
139
|
-
color: var(--text-primary__pbq4ak0);
|
|
140
|
-
line-height: 22px;
|
|
141
|
-
}
|
|
142
|
-
.Banner_referralDescription__1gnumzi7 {
|
|
143
|
-
margin-bottom: 8px;
|
|
144
|
-
font-size: 14px;
|
|
145
|
-
color: #979797;
|
|
146
|
-
line-height: 22px;
|
|
147
|
-
}
|
|
148
|
-
.Banner_referralCta__1gnumzi8 {
|
|
149
|
-
display: inline-block;
|
|
150
|
-
padding: 8px 16px;
|
|
151
|
-
border: 1px solid #000000;
|
|
152
|
-
border-radius: 9999px;
|
|
153
|
-
color: var(--text-primary__pbq4ak0);
|
|
154
|
-
font-size: 10px;
|
|
155
|
-
font-weight: 700;
|
|
156
|
-
line-height: 12px;
|
|
157
|
-
text-transform: uppercase;
|
|
158
|
-
}
|
|
159
|
-
.Banner_referralCta__1gnumzi8:focus-visible {
|
|
160
|
-
outline: 2px solid #000000;
|
|
161
|
-
outline-offset: 2px;
|
|
162
|
-
}`;function B({placement:s,classname:m=``,interaction:h,referralTitle:g,referralDescription:_,referralCta:y,inappTitle:b,inappDescription:w,inappCta:T,preview:E,previewMode:D}){let O=!!E,k=D===`inapp`?`inapp`:`referral`,A=f(s),{shouldRender:j,isHidden:M,isClientReady:B}=c();S(`frak-banner`,s,A?.components?.banner?.css,z);let[V,H]=d(!1),[U,W]=d(()=>O?k:i?`inapp`:null),G=a(null);l(()=>{O&&W(k)},[O,k]);let{reward:K}=C(U===`referral`&&B,h),[q,J]=d(null);l(()=>{let e=window.FrakSetup?.client;U!==`inapp`||O||!B||!e||t(e).then(e=>J(e)).catch(()=>{})},[U,O,B]),l(()=>{O||!U||V||G.current!==U&&B&&(e(window.FrakSetup?.client,`banner_impression`,{placement:s,variant:U,has_reward:U===`referral`?!!K:void 0}),G.current=U)},[U,V,B,O,s]),l(()=>{if(O||U===`inapp`)return;let e=()=>W(`referral`);return window.addEventListener(r,e),()=>window.removeEventListener(r,e)},[O,U]);let Y=o(async()=>{if(O)return;if(e(window.FrakSetup?.client,`banner_resolved`,{placement:s,variant:U??`referral`,outcome:`clicked`}),U===`referral`){H(!0);return}let r=q;if(!r&&window.FrakSetup?.client)try{r=await t(window.FrakSetup?.client)}catch{}let i=window.location.href;if(r){let e=new URL(i);e.searchParams.set(`fmt`,r),i=e.toString()}n(i)},[O,U,q,s]),X=o(()=>{O||(e(window.FrakSetup?.client,`banner_resolved`,{placement:s,variant:U??`referral`,outcome:`dismissed`}),H(!0))},[O,U,s]),Z=x(),Q=A?.components?.banner??Z?.banner,$=u(()=>{if(U===`referral`){let e=K?`Earn ${K} on purchases on this site`:`You've been referred!`;return{title:g??Q?.referralTitle??e,description:_??Q?.referralDescription??`Earn rewards after your purchase via the Frak partner app.`,cta:y??Q?.referralCta??`Got it`}}return{title:b??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`}},[U,K,Q,g,_,y,b,w,T]);if(!U||!O&&(!j||M||V))return null;let ne=[F,`frak-banner`,`frak-banner--${U}`,m].filter(Boolean).join(` `);return U===`inapp`?p(N,{title:$.title,description:$.description,cta:$.cta,dismissLabel:`Dismiss`,onAction:Y,onDismiss:X,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:ne,role:`alert`,children:[p(`div`,{class:`${L} frak-banner__icon`,children:p(v,{class:P})}),p(`div`,{class:`${I} frak-banner__text`,children:[p(`p`,{class:`${R} frak-banner__title`,children:$.title}),p(`p`,{class:`${te} frak-banner__description`,children:$.description}),p(`button`,{type:`button`,class:`${ee} frak-banner__cta`,onClick:Y,children:$.cta})]})]})}s(B,`frak-banner`,[`placement`,`classname`,`interaction`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`],{shadow:!1});export{B as Banner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{C as e,T as t,m as n,o as r,s as i,w as a}from"./loader.js";import{c as o,d as s,i as c,m as l,o as u,s as d,t as f,u as p}from"./usePlacement.Di6eZ4ty.js";import{t as m}from"./useGlobalComponents.CLH7id-Y.js";import{t as h}from"./useLightDomStyles.DqYouFn3.js";import{t as g}from"./formatReward.BaR9pE50.js";import{t as _}from"./useReward.DWyyva4u.js";import{t as v}from"./sharingPage.DX1H39Pz.js";function y(e={}){let{successDuration:t=2e3}=e,[n,r]=d(!1);return{copy:o(async e=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e),r(!0);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();try{document.execCommand(`copy`),r(!0)}catch(e){return console.error(`Failed to copy text:`,e),!1}finally{t.remove()}}return setTimeout(()=>{r(!1)},t),!0}catch(e){return console.error(`Failed to copy text:`,e),!1}},[t]),copied:n}}const b={errorContainer:{marginTop:`16px`,padding:`16px`,backgroundColor:`#FEE2E2`,border:`1px solid #FCA5A5`,borderRadius:`4px`,color:`#991B1B`},header:{display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`},title:{margin:0,fontSize:`16px`,fontWeight:500},message:{fontSize:`14px`,lineHeight:`1.5`,margin:`0 0 12px 0`},link:{color:`#991B1B`,textDecoration:`underline`,textUnderlineOffset:`2px`},copyButton:{display:`inline-flex`,alignItems:`center`,gap:`8px`,marginBottom:`10px`,padding:`8px 12px`,backgroundColor:`white`,border:`1px solid #D1D5DB`,borderRadius:`4px`,color:`black`,fontSize:`14px`,fontWeight:500}};function x({debugInfo:e}){let[t,n]=d(!1);return p(`div`,{children:[p(`button`,{type:`button`,style:b.copyButton,onClick:()=>n(!t),children:`Ouvrir les informations`}),t&&p(`textarea`,{style:{display:`block`,width:`100%`,height:`200px`,fontSize:`12px`},children:e})]})}function S({debugInfo:e}){let{copied:t,copy:n}=y();return p(`div`,{style:b.errorContainer,children:[p(`div`,{style:b.header,children:p(`h3`,{style:b.title,children:`Oups ! Nous avons rencontré un petit problème`})}),p(`p`,{style:b.message,children:[`Impossible d'ouvrir le menu de partage pour le moment. Si le problème persiste, copiez les informations ci-dessous et collez-les dans votre mail à`,` `,p(`a`,{href:`mailto:help@frak-labs.com?subject=Debug`,style:b.link,children:`help@frak-labs.com`}),` `,p(`br`,{}),`Merci pour votre retour, nous traitons votre demande dans les plus brefs délais.`]}),p(`button`,{type:`button`,onClick:()=>{n(e??``)},style:b.copyButton,children:t?`Informations copiées !`:`Copier les informations de débogage`}),p(x,{debugInfo:e})]})}function C(r,s,c){let[l,u]=d(void 0),[f,p]=d(!1);return{handleShare:o(async()=>{if(!window.FrakSetup?.client){console.error(`Frak client not found`),u(n.empty().formatDebugInfo(`Frak client not found`)),p(!0);return}let o=i(window.FrakSetup.client,{});try{await o.sharing(c?{link:c}:{}).display(e=>({...e,targetInteraction:r}),s)}catch(n){if(n instanceof t&&n.code===a.clientAborted){console.debug(`User aborted the modal`);return}let i=window.FrakSetup.client.debugInfo.formatDebugInfo(n);e(window.FrakSetup.client,`share_modal_error`,{placement:s,target_interaction:r,error:n instanceof Object&&`message`in n?n.message:`Unknown error`}),u(i),p(!0),console.error(`Error while opening the modal`,n)}},[r,s,c]),isError:f,debugInfo:l}}function w({placement:t,text:n=`Share and earn!`,classname:i=``,useReward:a,noRewardText:s,targetInteraction:d,clickAction:y,preview:b}){let x=!!b,w=f(t),T=m(),E=w?.components?.buttonShare??T?.buttonShare;h(`frak-button-share`,t,E?.css);let D=u(()=>w?.targetInteraction===void 0?d:w.targetInteraction,[w?.targetInteraction,d]),O=E?.text??n,k=E?.noRewardText??s,A=u(()=>E?.useReward??a===!0,[E?.useReward,a]),j=u(()=>E?.clickAction??y??`sharing-page`,[E?.clickAction,y]),{shouldRender:M,isHidden:N,isClientReady:P}=c(),{reward:F}=_(A&&P,D),{handleShare:I,isError:L,debugInfo:R}=C(D,t),z=u(()=>A?F?O.includes(`{REWARD}`)?g(O,F):`${O} ${F}`:k??g(O,void 0):O,[A,O,k,F]),B=o(async()=>{x||(e(window.FrakSetup.client,`share_button_clicked`,{placement:t,target_interaction:D,has_reward:!!F,click_action:j}),j===`embedded-wallet`?r(D,t):j===`share-modal`?await I():v(D,t))},[x,j,I,D,t,F]);if(!x&&(!M||N))return null;let V=[`button`,`button__fadeIn`,i].filter(Boolean).join(` `);return p(l,{children:[p(`button`,{type:`button`,disabled:!x&&!P,class:V,onClick:B,children:z}),L&&p(S,{debugInfo:R})]})}s(w,`frak-button-share`,[`text`,`placement`,`classname`,`clickAction`,`useReward`,`noRewardText`,`targetInteraction`,`preview`],{shadow:!1});export{w as ButtonShare};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,g as t,x as n}from"./loader.js";function r(r,i,a){let o=n(i),s=t(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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p as e}from"./loader.js";async function t(t,n,r){if(!window.FrakSetup?.client){console.error(`Frak client not found`);return}await e(window.FrakSetup.client,{...r?.link&&{link:r.link},...r?.products&&r.products.length>0&&{products:r.products},metadata:{...t&&{targetInteraction:t}}},n)}export{t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e}from"./loader.js";import{l as t,o as n,s as r}from"./usePlacement.Di6eZ4ty.js";function i(){let[i,a]=r(0);return t(()=>{let e=e=>{a(e=>e+1)};return window.addEventListener(`frak:config`,e),a(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),n(()=>e.getConfig().components,[i])}export{i as t};
|