@frak-labs/components 1.0.13 → 1.1.0-beta.d76e66ff

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/Banner.D-DIhGBs.js +183 -0
  2. package/cdn/ButtonShare.BXBkl-NK.js +1 -0
  3. package/cdn/ButtonWallet.BWpTwDnw.js +40 -0
  4. package/cdn/{GiftIcon.DcyE1R1V.js → GiftIcon.DabDdDcp.js} +1 -1
  5. package/cdn/OpenInAppButton.DAGgrKRg.js +1 -0
  6. package/cdn/PostPurchase.Cp4JWG5x.js +89 -0
  7. package/cdn/components.js +1 -1
  8. package/cdn/defaults.DjBUlRT8.js +58 -0
  9. package/cdn/embeddedWallet.BjQSXLkP.js +1 -0
  10. package/cdn/loader.js +164 -1
  11. package/cdn/replay-V6FXES7X.CgBxdfNp.js +1 -0
  12. package/cdn/rewards.BaTam2j1.js +1 -0
  13. package/cdn/useGlobalComponents.4DaqvbCn.js +1 -0
  14. package/cdn/useLightDomStyles.DNP8gafA.js +1 -0
  15. package/cdn/useReward.Bi4Hs7kk.js +1 -0
  16. package/dist/banner.d.ts +10 -2
  17. package/dist/banner.js +14 -12
  18. package/dist/buttonShare.d.ts +19 -2
  19. package/dist/buttonShare.js +23 -12
  20. package/dist/buttonWallet.js +2 -2
  21. package/dist/openInApp.js +2 -2
  22. package/dist/postPurchase.d.ts +5 -10
  23. package/dist/postPurchase.js +22 -14
  24. package/dist/rewards-CDS1CYlm.js +241 -0
  25. package/dist/{useGlobalComponents-Da9LDlRy.js → useGlobalComponents-CeTO2xYs.js} +1 -1
  26. package/dist/{useLightDomStyles-DRkTVy4s.js → useLightDomStyles-B2U96tzU.js} +1 -1
  27. package/dist/{usePlacement-NZOjZ6IR.js → usePlacement-Bpo25qjA.js} +2 -108
  28. package/dist/{useReward-B-yZ7nhY.js → useReward-Cg2wk8XI.js} +10 -5
  29. package/package.json +31 -19
  30. package/cdn/Banner.BM-XicfW.js +0 -183
  31. package/cdn/ButtonShare.DsCfkEG1.js +0 -1
  32. package/cdn/ButtonWallet.BQt3QmKr.js +0 -40
  33. package/cdn/OpenInAppButton.BIfTfSWS.js +0 -1
  34. package/cdn/PostPurchase.Bcnzehoo.js +0 -89
  35. package/cdn/actions-CMPlZ7CH.CJIqArwi.js +0 -1
  36. package/cdn/clientReady.ClcVd4_w.js +0 -1
  37. package/cdn/defaults.CIT5-NpH.js +0 -58
  38. package/cdn/embeddedWallet.BXl45f3Y.js +0 -1
  39. package/cdn/replay-V6FXES7X.efKsNT6s.js +0 -1
  40. package/cdn/rewards.CW3JGWuC.js +0 -1
  41. package/cdn/sharedBaseCss.css.BDzFcWnD.js +0 -154
  42. package/cdn/sharingPage.BjReoj_N.js +0 -1
  43. package/cdn/sharingPageProducts.BoDmfrdn.js +0 -1
  44. package/cdn/styleManager.Cun1-fKi.js +0 -1
  45. package/cdn/useGlobalComponents.DqV5lr6s.js +0 -1
  46. package/cdn/useLightDomStyles.BsQue5kI.js +0 -1
  47. package/cdn/useReward.CcsZ70zp.js +0 -1
  48. package/dist/rewards-BtPHdGcI.js +0 -149
@@ -1,154 +0,0 @@
1
- const e=`.reset_base__1831jhd0 {
2
- margin: 0;
3
- padding: 0;
4
- border: 0;
5
- box-sizing: border-box;
6
- font-size: 100%;
7
- font: inherit;
8
- vertical-align: baseline;
9
- -webkit-tap-highlight-color: transparent;
10
- }
11
- .reset_focusRing__1831jhd1 {
12
- outline: 2px solid transparent;
13
- outline-offset: 2px;
14
- }
15
- .reset_focusRing__1831jhd1:focus-visible {
16
- outline-color: currentColor;
17
- }
18
- .reset_fieldAppearance__1831jhd2 {
19
- appearance: none;
20
- background-color: transparent;
21
- }
22
- .reset_visuallyHidden__1831jhd3 {
23
- position: absolute;
24
- width: 1px;
25
- height: 1px;
26
- padding: 0;
27
- margin: -1px;
28
- overflow: hidden;
29
- clip: rect(0, 0, 0, 0);
30
- white-space: nowrap;
31
- border-width: 0;
32
- }
33
- .reset_element_ul__1831jhd4 {
34
- list-style: none;
35
- }
36
- .reset_element_ol__1831jhd5 {
37
- list-style: none;
38
- }
39
- .reset_element_button__1831jhd6 {
40
- cursor: pointer;
41
- }
42
- .reset_element_a__1831jhd7 {
43
- text-decoration: none;
44
- color: inherit;
45
- }
46
- .reset_element_table__1831jhdb {
47
- border-collapse: collapse;
48
- border-spacing: 0;
49
- }
50
- .reset_element_img__1831jhdc {
51
- display: block;
52
- max-width: 100%;
53
- }:root {
54
- --text-primary__pbq4ak0: #000000;
55
- --text-secondary__pbq4ak1: #525252;
56
- --text-tertiary__pbq4ak2: #a3a3a3;
57
- --text-disabled__pbq4ak3: #a3a3a3;
58
- --text-action__pbq4ak4: #0043ef;
59
- --text-actionHover__pbq4ak5: #0036bf;
60
- --text-onAction__pbq4ak6: #ffffff;
61
- --text-error__pbq4ak7: #e31c31;
62
- --text-success__pbq4ak8: #09be67;
63
- --text-warning__pbq4ak9: #ec7e00;
64
- --surface-primary__pbq4aka: #0043ef;
65
- --surface-secondary__pbq4akb: #f2f6fe;
66
- --surface-background__pbq4akc: #ffffff;
67
- --surface-background2__pbq4akd: #f9fafb;
68
- --surface-elevated__pbq4ake: #ffffff;
69
- --surface-muted__pbq4akf: #f7f7f7;
70
- --surface-tertiary__pbq4akg: #f7f7f7;
71
- --surface-overlay__pbq4akh: #000000b2;
72
- --surface-disabled__pbq4aki: #e2e2e2;
73
- --surface-primaryHover__pbq4akj: #0036bf;
74
- --surface-primaryPressed__pbq4akk: #00288f;
75
- --surface-secondaryHover__pbq4akl: #e5ecfd;
76
- --surface-secondaryPressed__pbq4akm: #ccd9fc;
77
- --surface-error__pbq4akn: #fce8ea;
78
- --surface-success__pbq4ako: #f3fcf7;
79
- --surface-warning__pbq4akp: #fef9f2;
80
- --border-subtle__pbq4akq: #f5f5f5;
81
- --border-focus__pbq4akr: #a3a3a3;
82
- --border-error__pbq4aks: #e31c31;
83
- --border-success__pbq4akt: #09be67;
84
- --border-warning__pbq4aku: #ec7e00;
85
- --border-default__pbq4akv: #e2e2e2;
86
- --icon-primary__pbq4akw: #000000;
87
- --icon-secondary__pbq4akx: #525252;
88
- --icon-tertiary__pbq4aky: #a3a3a3;
89
- --icon-disabled__pbq4akz: #a3a3a3;
90
- --icon-action__pbq4ak10: #0043ef;
91
- --icon-actionHover__pbq4ak11: #0036bf;
92
- --icon-onAction__pbq4ak12: #ffffff;
93
- --icon-error__pbq4ak13: #e31c31;
94
- --icon-success__pbq4ak14: #09be67;
95
- --icon-warning__pbq4ak15: #ec7e00;
96
- }
97
- [data-theme='dark'] {
98
- --text-primary__pbq4ak0: #ffffff;
99
- --text-secondary__pbq4ak1: #f7f7f7;
100
- --text-tertiary__pbq4ak2: #f5f5f5;
101
- --text-disabled__pbq4ak3: #a3a3a3;
102
- --text-action__pbq4ak4: #668ef5;
103
- --text-actionHover__pbq4ak5: #0036bf;
104
- --text-onAction__pbq4ak6: #ffffff;
105
- --text-error__pbq4ak7: #e9495a;
106
- --text-success__pbq4ak8: #09be67;
107
- --text-warning__pbq4ak9: #ec7e00;
108
- --surface-primary__pbq4aka: #0043ef;
109
- --surface-secondary__pbq4akb: #00288f;
110
- --surface-background__pbq4akc: #000000;
111
- --surface-background2__pbq4akd: #000000;
112
- --surface-elevated__pbq4ake: #262626;
113
- --surface-muted__pbq4akf: #525252;
114
- --surface-tertiary__pbq4akg: #737373;
115
- --surface-overlay__pbq4akh: #000000b2;
116
- --surface-disabled__pbq4aki: #e2e2e2;
117
- --surface-primaryHover__pbq4akj: #0036bf;
118
- --surface-primaryPressed__pbq4akk: #00288f;
119
- --surface-secondaryHover__pbq4akl: #e5ecfd;
120
- --surface-secondaryPressed__pbq4akm: #ccd9fc;
121
- --surface-error__pbq4akn: #b61627;
122
- --surface-success__pbq4ako: #05723e;
123
- --surface-warning__pbq4akp: #8e4c00;
124
- --border-subtle__pbq4akq: #737373;
125
- --border-focus__pbq4akr: #a3a3a3;
126
- --border-error__pbq4aks: #e31c31;
127
- --border-success__pbq4akt: #09be67;
128
- --border-warning__pbq4aku: #ec7e00;
129
- --border-default__pbq4akv: #525252;
130
- --icon-primary__pbq4akw: #ffffff;
131
- --icon-secondary__pbq4akx: #f7f7f7;
132
- --icon-tertiary__pbq4aky: #f7f7f7;
133
- --icon-disabled__pbq4akz: #a3a3a3;
134
- --icon-action__pbq4ak10: #0043ef;
135
- --icon-actionHover__pbq4ak11: #0036bf;
136
- --icon-onAction__pbq4ak12: #ffffff;
137
- --icon-error__pbq4ak13: #e31c31;
138
- --icon-success__pbq4ak14: #09be67;
139
- --icon-warning__pbq4ak15: #ec7e00;
140
- }.sharedBaseCss_buttonReset__7cswil0 {
141
- margin: 0;
142
- border: 0;
143
- appearance: none;
144
- background-color: transparent;
145
- box-sizing: border-box;
146
- font-family: inherit;
147
- -webkit-tap-highlight-color: transparent;
148
- cursor: pointer;
149
- outline: 2px solid transparent;
150
- outline-offset: 2px;
151
- }
152
- .sharedBaseCss_buttonReset__7cswil0:focus-visible {
153
- outline-color: currentColor;
154
- }`;export{e as t};
@@ -1 +0,0 @@
1
- import{l as e}from"./actions-CMPlZ7CH.CJIqArwi.js";async function t(t,n,r){window.FrakSetup?.client&&await e(window.FrakSetup.client,{...r?.link&&{link:r.link},...r?.products?.length&&{products:r.products},...t&&{metadata:{targetInteraction:t}}},n)}export{t};
@@ -1 +0,0 @@
1
- import{o as e}from"./clientReady.ClcVd4_w.js";function t(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function n(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 r(e){if(!e||typeof e!=`object`)return null;let n=e,r=typeof n.title==`string`?n.title.trim():``;if(r===``)return null;let i={title:r};return typeof n.imageUrl==`string`&&t(n.imageUrl)&&(i.imageUrl=n.imageUrl),typeof n.link==`string`&&t(n.link)&&(i.link=n.link),typeof n.utmContent==`string`&&n.utmContent!==``&&(i.utmContent=n.utmContent),i}function i(e){let t=n(e);if(!t)return;let i=[];for(let e of t){let t=r(e);t&&i.push(t)}return i.length>0?i:void 0}function a(t){if(!t)return;let n;try{n=e(t)}catch{return}if(n!==null)return i(n)}export{i as n,a as t};
@@ -1 +0,0 @@
1
- function e(e,t){let n=document.getElementById(e);if(n){n.textContent!==t&&(n.textContent=t);return}let r=document.createElement(`style`);r.id=e,r.textContent=t,document.head.appendChild(r)}function t(e,t){let n=`frak-base-${e}`;if(document.getElementById(n)||!t)return;let r=document.createElement(`style`);r.id=n,r.textContent=t,document.head.appendChild(r)}function n(t,n,r){e(`frak-placement-${t}-${n}`,r)}const r={injectBase:t,injectPlacement:n};export{r as t};
@@ -1 +0,0 @@
1
- import{b as e}from"./clientReady.ClcVd4_w.js";import{c as t,o as n}from"./defaults.CIT5-NpH.js";function r(){return t(n,()=>e.getConfig().components)}export{r as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./styleManager.Cun1-fKi.js";import{f as t,i as n}from"./defaults.CIT5-NpH.js";function r(r,i,a,o,s){t(()=>{s&&e.injectBase(`shared`,s),e.injectBase(r,o??n)},[r]),t(()=>{!i||!a||e.injectPlacement(r,i,a)},[r,i,a])}export{r as t};
@@ -1 +0,0 @@
1
- import{m as e}from"./actions-CMPlZ7CH.CJIqArwi.js";import{d as t,f as n}from"./defaults.CIT5-NpH.js";import{t as r}from"./rewards.CW3JGWuC.js";function i(i,a,o){let[s,c]=t(void 0);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});n&&n.payoutType!==`percentage`&&c(n.formatted)}).catch(()=>{})},[i,a,o]),{reward:s}}export{i as t};
@@ -1,149 +0,0 @@
1
- //#region ../core/dist/getCurrencyAmountKey-C-1W-BRg.js
2
- const e = {
3
- eur: `fr-FR`,
4
- usd: `en-US`,
5
- gbp: `en-GB`
6
- };
7
- function t(t) {
8
- return t && t in e ? t : `eur`;
9
- }
10
- function n(t) {
11
- return t ? e[t] ?? e.eur : e.eur;
12
- }
13
- function r$1(e, r) {
14
- let i = n(r), a = t(r);
15
- return e.toLocaleString(i, {
16
- style: `currency`,
17
- currency: a,
18
- minimumFractionDigits: 0,
19
- maximumFractionDigits: 2
20
- });
21
- }
22
- function i$1(e) {
23
- return e ? `${e}Amount` : `eurAmount`;
24
- }
25
- //#endregion
26
- //#region ../core/dist/rewards.js
27
- function r(e) {
28
- return Array.isArray(e) ? e : e.conditions;
29
- }
30
- function i(e) {
31
- if (typeof e == `number`) return e;
32
- if (typeof e == `string` && e.trim() !== ``) {
33
- let t = Number(e);
34
- return Number.isFinite(t) ? t : void 0;
35
- }
36
- }
37
- function a(e, t, n) {
38
- let o = [];
39
- for (let s of r(e)) {
40
- if (`logic` in s) {
41
- o.push(...a(s, t, n));
42
- continue;
43
- }
44
- if (s.field === t && n.has(s.operator)) {
45
- let e = i(s.value);
46
- e != null && o.push(e);
47
- }
48
- }
49
- return o;
50
- }
51
- const o = /* @__PURE__ */ new Set([
52
- `gt`,
53
- `gte`,
54
- `between`
55
- ]);
56
- const s = /* @__PURE__ */ new Set([`gt`, `gte`]);
57
- function c(e) {
58
- let t = a(e, `purchase.amount`, o);
59
- return t.length > 0 ? Math.min(...t) : void 0;
60
- }
61
- function l(e) {
62
- let t = a(e, `time.timestamp`, s);
63
- if (t.length !== 0) return /* @__PURE__ */ new Date(Math.min(...t) * 1e3);
64
- }
65
- function h(e, t) {
66
- switch (e.payoutType) {
67
- case `fixed`: return e.amount[t];
68
- case `percentage`: return e.maxAmount?.[t] ?? 0;
69
- case `tiered`: return e.tiers.reduce((e, n) => `amount` in n ? Math.max(e, n.amount[t]) : e, 0);
70
- }
71
- }
72
- function g(e) {
73
- return e.payoutType === `percentage` ? e.percent : e.payoutType === `tiered` ? e.tiers.reduce((e, t) => `percent` in t ? Math.max(e, t.percent) : e, 0) : 0;
74
- }
75
- function _(e, t) {
76
- let n = h(e, t);
77
- return n > 0 ? n : g(e) * 1e-6;
78
- }
79
- function v(r, i) {
80
- let a = t(i), o = i$1(a);
81
- switch (r.payoutType) {
82
- case `fixed`: return r$1(Math.round(r.amount[o]), a);
83
- case `percentage`: return `${r.percent} %`;
84
- case `tiered`: {
85
- let t = h(r, o);
86
- if (t > 0) return r$1(Math.round(t), a);
87
- let n = g(r);
88
- return n > 0 ? `${n} %` : r$1(0, a);
89
- }
90
- }
91
- }
92
- function y(e, r) {
93
- if (e && !(_(e, i$1(t(r))) <= 0)) return v(e, r);
94
- }
95
- function b(e, t) {
96
- return t ? e.replaceAll(`{REWARD}`, t) : e.replaceAll(`{REWARD}`, ``);
97
- }
98
- function x(e, t) {
99
- return e.expiresAt != null && new Date(e.expiresAt).getTime() <= t;
100
- }
101
- function S(e, t) {
102
- let n = l(e.conditions);
103
- return n == null || n.getTime() <= t;
104
- }
105
- function C(e, t) {
106
- return t === `referee` ? e.referee : e.referrer;
107
- }
108
- function w(e, t, n) {
109
- let r = C(e, n);
110
- return r ? _(r, t) : 0;
111
- }
112
- function T(e, r = {}) {
113
- let i = (r.now ?? /* @__PURE__ */ new Date()).getTime(), a = r.audience ?? `referrer`, o = i$1(t(r.currency)), s = (r.targetInteraction ? e.filter((e) => e.interactionTypeKey === r.targetInteraction) : e).filter((e) => !x(e, i)), c = s.filter((e) => S(e, i));
114
- if (c.length > 0) return {
115
- campaign: c.reduce((e, t) => w(t, o, a) > w(e, o, a) ? t : e),
116
- status: `live`
117
- };
118
- let u = s.map((e) => ({
119
- campaign: e,
120
- startsAt: l(e.conditions)
121
- })).filter((e) => e.startsAt != null);
122
- if (u.length === 0) return;
123
- let d = u.reduce((e, t) => t.startsAt.getTime() < e.startsAt.getTime() ? t : e);
124
- return {
125
- campaign: d.campaign,
126
- status: `upcoming`,
127
- startsAt: d.startsAt
128
- };
129
- }
130
- function E(t, n = {}) {
131
- let r = T(t, n);
132
- if (!r) return;
133
- let i = C(r.campaign, n.audience ?? `referrer`);
134
- if (!i) return;
135
- let a = y(i, n.currency);
136
- if (!a) return;
137
- let o = c(r.campaign.conditions), s = o == null ? void 0 : r$1(o, n.currency), l = r.campaign.defaultLockupSeconds, u = l && l > 0 ? Math.round(l / 86400) : void 0;
138
- return {
139
- formatted: a,
140
- payoutType: i.payoutType,
141
- minPurchaseAmount: s,
142
- lockupDurationDays: u,
143
- referrerReward: r.campaign.referrer,
144
- refereeReward: r.campaign.referee,
145
- minPurchaseValue: o ?? void 0
146
- };
147
- }
148
- //#endregion
149
- export { y as i, T as n, b as r, E as t };