@frak-labs/components 1.0.13-beta.f4d2e52a → 1.1.0-beta.41fca73f

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 (37) hide show
  1. package/cdn/Banner.DGYexiiS.js +183 -0
  2. package/cdn/ButtonShare.DFg0XCDd.js +1 -0
  3. package/cdn/{ButtonWallet.Cwauxojx.js → ButtonWallet.sGDvcAXt.js} +1 -1
  4. package/cdn/{GiftIcon.CSjsnRQh.js → GiftIcon.C1uAOx7A.js} +1 -1
  5. package/cdn/{OpenInAppButton.G3VjbH1_.js → OpenInAppButton.CxLPpqFO.js} +1 -1
  6. package/cdn/PostPurchase.D6Mzbjtu.js +89 -0
  7. package/cdn/components.js +1 -1
  8. package/cdn/defaults.BEvoSiy5.js +58 -0
  9. package/cdn/{embeddedWallet.BR3BC6DE.js → embeddedWallet.BjQSXLkP.js} +1 -1
  10. package/cdn/loader.js +6 -6
  11. package/cdn/rewards.B2smvfIs.js +1 -0
  12. package/cdn/useGlobalComponents.CqTI84Mw.js +1 -0
  13. package/cdn/useLightDomStyles.CKtA4k-_.js +1 -0
  14. package/cdn/useReward.CXgeQcsH.js +1 -0
  15. package/dist/banner.d.ts +10 -2
  16. package/dist/banner.js +14 -12
  17. package/dist/buttonShare.d.ts +19 -2
  18. package/dist/buttonShare.js +23 -12
  19. package/dist/buttonWallet.js +2 -2
  20. package/dist/openInApp.js +2 -2
  21. package/dist/postPurchase.d.ts +5 -10
  22. package/dist/postPurchase.js +22 -14
  23. package/dist/rewards-Cxn-bgzC.js +293 -0
  24. package/dist/{useGlobalComponents-Da9LDlRy.js → useGlobalComponents-CeTO2xYs.js} +1 -1
  25. package/dist/{useLightDomStyles-DRkTVy4s.js → useLightDomStyles-B2U96tzU.js} +1 -1
  26. package/dist/{usePlacement-NZOjZ6IR.js → usePlacement-Bpo25qjA.js} +2 -108
  27. package/dist/{useReward-B-yZ7nhY.js → useReward-BMYSGY-o.js} +10 -5
  28. package/package.json +3 -3
  29. package/cdn/Banner.wcjTUyP1.js +0 -183
  30. package/cdn/ButtonShare.CMTO7zcA.js +0 -1
  31. package/cdn/PostPurchase.DFHeDsq_.js +0 -89
  32. package/cdn/defaults.DNO3nf63.js +0 -58
  33. package/cdn/rewards.usw1vliR.js +0 -1
  34. package/cdn/useGlobalComponents.CcNSI-MX.js +0 -1
  35. package/cdn/useLightDomStyles.mqw3cSdZ.js +0 -1
  36. package/cdn/useReward.BK8q8FQH.js +0 -1
  37. package/dist/rewards-BtPHdGcI.js +0 -149
@@ -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 };