@frak-labs/components 1.3.2 → 1.3.3-beta.e9b6b7db
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.DugUIOLT.js → Ambassador.BtZXbHrE.js} +2 -2
- package/cdn/{Banner.gDEO8VKX.js → Banner.BaMe3Y_o.js} +2 -2
- package/cdn/{ButtonShare.OuDvPMdk.js → ButtonShare.DBG3qW4U.js} +1 -1
- package/cdn/{ButtonWallet.DNE6ZhkT.js → ButtonWallet.CibSy_fI.js} +1 -1
- package/cdn/{PostPurchase.DCNA-GAT.js → PostPurchase.4VD_vKnI.js} +2 -2
- package/cdn/components.js +1 -1
- package/cdn/loader.js +13 -13
- package/cdn/replay-V6FXES7X.CgBxdfNp.js +1 -0
- package/cdn/rewards.F9iOJSNk.js +1 -0
- package/cdn/{useReward.By-xuybY.js → useReward.Cl4hkDZp.js} +1 -1
- package/dist/ambassador.d.ts +2 -1
- package/dist/ambassador.js +2 -2
- package/dist/banner.d.ts +2 -1
- package/dist/banner.js +2 -2
- package/dist/buttonShare.d.ts +2 -1
- package/dist/buttonShare.js +2 -2
- package/dist/buttonWallet.d.ts +2 -1
- package/dist/buttonWallet.js +1 -1
- package/dist/i18n/defaults.d.ts +3 -2
- package/dist/openInApp.d.ts +2 -1
- package/dist/postPurchase.d.ts +2 -1
- package/dist/postPurchase.js +1 -1
- package/dist/{rewards-DoVY1pWr.js → rewards-HJlTkTcY.js} +4 -9
- package/dist/{useReward-DEhiMfgl.js → useReward-WmsNOFlz.js} +1 -1
- package/package.json +5 -5
- package/cdn/replay-V6FXES7X.efKsNT6s.js +0 -1
- package/cdn/rewards.COyZ6-7W.js +0 -1
package/dist/buttonShare.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-CPNmnpXA.js";
|
|
2
|
-
import { i as w } from "./rewards-
|
|
2
|
+
import { i as w } from "./rewards-HJlTkTcY.js";
|
|
3
3
|
import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
|
|
4
4
|
import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
|
|
5
|
-
import { t as useReward } from "./useReward-
|
|
5
|
+
import { t as useReward } from "./useReward-WmsNOFlz.js";
|
|
6
6
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
7
7
|
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
8
8
|
import { sanitizeSharingProducts, trackEvent } from "@frak-labs/core-sdk";
|
package/dist/buttonWallet.d.ts
CHANGED
package/dist/buttonWallet.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage, t as buildStyleContent } from "./sharedCss-CPNmnpXA.js";
|
|
2
|
-
import { t as useReward } from "./useReward-
|
|
2
|
+
import { t as useReward } from "./useReward-WmsNOFlz.js";
|
|
3
3
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
4
4
|
import { t as usePlacement } from "./usePlacement-BpaIbzun.js";
|
|
5
5
|
import { trackEvent } from "@frak-labs/core-sdk";
|
package/dist/i18n/defaults.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ type ComponentCopy = {
|
|
|
96
96
|
faq5Question: string;
|
|
97
97
|
/** The two frak.id anchors are markup inside plain copy: each is split into
|
|
98
98
|
* before/link-text/after keys so the component can render a real `<a>` around
|
|
99
|
-
* the link text without flattening it to a string
|
|
99
|
+
* the link text without flattening it to a string. */
|
|
100
100
|
faq5AnswerBeforeLink: string;
|
|
101
101
|
faq5AnswerLinkText: string;
|
|
102
102
|
faq5AnswerAfterLink: string;
|
|
@@ -112,4 +112,5 @@ type ComponentCopy = {
|
|
|
112
112
|
* keyed by the active language keeps an i18n runtime out of the CDN bundle.
|
|
113
113
|
*/
|
|
114
114
|
export declare const componentDefaults: Record<Language, ComponentCopy>;
|
|
115
|
-
//#endregion
|
|
115
|
+
//#endregion
|
|
116
|
+
export {};
|
package/dist/openInApp.d.ts
CHANGED
package/dist/postPurchase.d.ts
CHANGED
package/dist/postPurchase.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as useClientReady, o as registerWebComponent, r as useLang, s as openSharingPage } from "./sharedCss-CPNmnpXA.js";
|
|
2
|
-
import { i as w, n as K, t as C } from "./rewards-
|
|
2
|
+
import { i as w, n as K, t as C } from "./rewards-HJlTkTcY.js";
|
|
3
3
|
import { t as useGlobalComponents } from "./useGlobalComponents-B3s2UQFk.js";
|
|
4
4
|
import { t as useLightDomStyles } from "./useLightDomStyles-BQ5FvCPi.js";
|
|
5
5
|
import { componentDefaults } from "./i18n/defaults.js";
|
|
@@ -71,15 +71,10 @@ function o(e) {
|
|
|
71
71
|
}
|
|
72
72
|
function s(e, t, n) {
|
|
73
73
|
let r = [];
|
|
74
|
-
for (let i of a(e))
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
if (i.field === t && n.has(i.operator)) {
|
|
80
|
-
let e = o(i.value);
|
|
81
|
-
e != null && r.push(e);
|
|
82
|
-
}
|
|
74
|
+
for (let i of a(e)) if (`logic` in i) r.push(...s(i, t, n));
|
|
75
|
+
else if (i.field === t && n.has(i.operator)) {
|
|
76
|
+
let e = o(i.value);
|
|
77
|
+
e != null && r.push(e);
|
|
83
78
|
}
|
|
84
79
|
return r;
|
|
85
80
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "1.3.
|
|
14
|
+
"version": "1.3.3-beta.e9b6b7db",
|
|
15
15
|
"description": "Frak web components (share button, banner, post-purchase, ambassador page) for any merchant page; load the shim from https://sdk.frak.id/components.js.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -108,14 +108,14 @@
|
|
|
108
108
|
"try:merchant": "bun scripts/tryOnMerchant.ts"
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
|
-
"@frak-labs/core-sdk": "1.5.
|
|
112
|
-
"@frak-labs/frame-connector": "1.5.2",
|
|
111
|
+
"@frak-labs/core-sdk": "1.5.3-beta.e9b6b7db",
|
|
112
|
+
"@frak-labs/frame-connector": "1.5.2-beta.e9b6b7db",
|
|
113
113
|
"preact": "^10.29.8",
|
|
114
114
|
"preact-custom-element": "^4.6.0",
|
|
115
115
|
"qr": "^0.7.0"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|
|
118
|
-
"@playwright/test": "^1.
|
|
118
|
+
"@playwright/test": "^1.64.0",
|
|
119
119
|
"@frak-labs/design-system": "0.0.0",
|
|
120
120
|
"@frak-labs/test-foundation": "0.1.0",
|
|
121
121
|
"@preact/preset-vite": "^2.10.6",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"jsdom": "^30.0.1",
|
|
137
137
|
"lightningcss": "^1.33.0",
|
|
138
138
|
"rolldown": "~1.2.0",
|
|
139
|
-
"tsdown": "^0.23.
|
|
139
|
+
"tsdown": "^0.23.1",
|
|
140
140
|
"typescript": "^6.0.3",
|
|
141
141
|
"vitest": "^5.0.0"
|
|
142
142
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){return()=>{}}var t=null;function n(n,r){if(typeof document>`u`||typeof window>`u`)return;t&&t();let i=n.maxEventsPerChunk??200,a=n.flushIntervalMs??1e4,o=n.maxPayloadBytes??1048576,s=[],c=0,l=null;function u(e){if(s.length===0)return;let t=JSON.stringify(s);if(new TextEncoder().encode(t).length>o){if(s.length>1){let t=Math.floor(s.length/2),n=s.slice(0,t),r=s.slice(t),i=e&&n.some(e=>e.type===2);s=n,u(i),s=r,u(!1);return}s=[];return}let n=s[0].timestamp,i=s[s.length-1].timestamp;try{r({chunk_index:c,events_count:s.length,is_full_snapshot:e,started_at:new Date(n).toISOString(),ended_at:new Date(i).toISOString(),payload:t}),c+=1,s=[]}catch(e){throw e}}function d(e){let t=e||s.some(e=>e.type===2);s.length>=i?u(t):e&&s.length>0&&u(!0)}let f=n.maskAllText!==!1,p=n.unmaskTextSelector,m=e({emit(e,t){s.push(e),d(!!t)},checkoutEveryNms:a,maskAllInputs:n.maskAllInputs??!0,maskTextSelector:f?`*`:`[data-openpanel-replay-mask]`,maskTextFn:f&&p?(e,t)=>t?.closest(p)?e:e.replace(/\S/g,`*`):void 0,blockSelector:n.blockSelector??`[data-openpanel-replay-block]`,blockClass:n.blockClass,ignoreSelector:n.ignoreSelector});l=setInterval(()=>{s.length>0&&u(s.some(e=>e.type===2))},a);function h(){document.visibilityState===`hidden`&&s.length>0&&u(s.some(e=>e.type===2))}function g(){s.length>0&&u(s.some(e=>e.type===2))}document.addEventListener(`visibilitychange`,h),window.addEventListener(`pagehide`,g),t=()=>{s.length>0&&u(s.some(e=>e.type===2)),l&&=(clearInterval(l),null),document.removeEventListener(`visibilitychange`,h),window.removeEventListener(`pagehide`,g),m?.(),t=null}}function r(){t&&t()}export{n as startReplayRecorder,r as stopReplayRecorder};
|
package/cdn/rewards.COyZ6-7W.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,b as t,v as n,x as r,y as i}from"./loader.js";function a(e){return Array.isArray(e)?e:e.conditions}function o(e){if(typeof e==`number`)return e;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function s(e,t,n){let r=[];for(let i of a(e)){if(`logic`in i){r.push(...s(i,t,n));continue}if(i.field===t&&n.has(i.operator)){let e=o(i.value);e!=null&&r.push(e)}}return r}const c=/* @__PURE__ */ new Set([`gt`,`gte`,`between`]),l=/* @__PURE__ */ new Set([`gt`,`gte`]);function u(e){let t=s(e,`purchase.amount`,c);return t.length>0?Math.min(...t):void 0}function d(e){let t=s(e,`time.timestamp`,l);if(t.length!==0)return/* @__PURE__ */ new Date(Math.min(...t)*1e3)}function f(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`percentage`:return e.maxAmount?.[t]??0;case`tiered`:return e.tiers.reduce((e,n)=>`amount`in n?Math.max(e,n.amount[t]):e,0)}}function p(e){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}function m(e,t){let n=f(e,t);return n>0?n:p(e)*1e-6}function h(n,i){let a=e(i),o=r(a);switch(n.payoutType){case`fixed`:return t(Math.round(n.amount[o]),a);case`percentage`:return`${n.percent} %`;case`tiered`:{let e=f(n,o);if(e>0)return t(Math.round(e),a);let r=p(n);return r>0?`${r} %`:t(0,a)}}}function g(t,a){let o=e(a),s=r(o);switch(t.payoutType){case`fixed`:return n(Math.round(t.amount[s]),o);case`percentage`:return i(t.percent);case`tiered`:{let e=f(t,s);if(e>0)return n(Math.round(e),o);let r=p(t);return r>0?i(r):n(0,o)}}}function _(t,n){if(!(!t||m(t,r(e(n)))<=0))return h(t,n)}function v(e,t){return t?e.replaceAll(`{REWARD}`,t):e.replaceAll(`{REWARD}`,``)}const y=/* @__PURE__ */ new Set([`eq`,`neq`,`gt`,`gte`,`lt`,`lte`,`between`]),b=/* @__PURE__ */ new Set([`contains`,`starts_with`,`ends_with`]);function x(e){return`logic`in e&&`conditions`in e}function S(e,t){return e[t]}function C(e){if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e==`string`&&e.trim()!==``){let t=Number(e);return Number.isFinite(t)?t:void 0}}function w(e,t){let n=C(e),r=C(t);return n!==void 0&&r!==void 0?n-r:String(e).localeCompare(String(t))}function T(e,t,n){if(!Array.isArray(n))return e===`not_in`;if(t==null)return;let r=n.includes(t);return e===`in`?r:!r}function E(e,t,n,r){switch(e){case`eq`:return t===n;case`neq`:return t!==n;case`gt`:return w(t,n)>0;case`gte`:return w(t,n)>=0;case`lt`:return w(t,n)<0;case`lte`:return w(t,n)<=0;case`between`:return r==null||Array.isArray(r)?void 0:w(t,n)>=0&&w(t,r)<=0}}function D(e,t,n){if(typeof t==`string`&&typeof n==`string`)return e===`contains`?t.includes(n):e===`starts_with`?t.startsWith(n):t.endsWith(n)}function O(e,t){let n=S(t,e.field),{operator:r,value:i,valueTo:a}=e;if(r===`exists`)return n!=null;if(r===`not_exists`)return n==null;if(r===`in`||r===`not_in`)return T(r,n,i);if(!(Array.isArray(i)||n==null||i==null)){if(y.has(r))return E(r,n,i,a);if(b.has(r))return D(r,n,i)}}function k(e,t){if(x(e)){let n=e.conditions.map(e=>k(e,t));return e.logic===`all`?n.every(Boolean):e.logic===`any`?n.some(Boolean):e.logic!==`none`||!n.some(Boolean)}return O(e,t)??!0}function A(e,t){return e?Array.isArray(e)?e.every(e=>k(e,t)):k(e,t):!0}function j(e,t){return e.expiresAt!=null&&new Date(e.expiresAt).getTime()<=t}function M(e,t){let n=d(e.conditions);return n==null||n.getTime()<=t}function N(e,t){return t===`referee`?e.referee:e.referrer}function P(e,t,n){let r=N(e,n);return r?m(r,t):0}function F(e,t){if(!t||t.length===0||!e.productScope)return;let n=t.filter(t=>A(e.productScope,t));return n.length>0?n:void 0}function I(e,t){return!t||t.length===0||!e.productScope||t.some(t=>A(e.productScope,t))}function L(t,n={}){let i=(n.now??/* @__PURE__ */ new Date).getTime(),a=n.audience??`referrer`,o=r(e(n.currency)),s=(n.targetInteraction?t.filter(e=>e.interactionTypeKey===n.targetInteraction):t).filter(e=>!j(e,i)),c=s.filter(e=>M(e,i));if(c.length>0){let e=c.reduce((e,t)=>{let r=I(e,n.products),i=I(t,n.products);return r===i?P(t,o,a)>P(e,o,a)?t:e:i?t:e});return{campaign:e,status:`live`,matchedProducts:F(e,n.products)}}let l=s.map(e=>({campaign:e,startsAt:d(e.conditions)})).filter(e=>e.startsAt!=null);if(l.length===0)return;let u=l.reduce((e,t)=>{let r=I(e.campaign,n.products),i=I(t.campaign,n.products);return r===i?t.startsAt.getTime()<e.startsAt.getTime()?t:e:i?t:e});return{campaign:u.campaign,status:`upcoming`,startsAt:u.startsAt,matchedProducts:F(u.campaign,n.products)}}function R(e,n={}){let r=L(e,n);if(!r)return;let i=N(r.campaign,n.audience??`referrer`);if(!i)return;let a=_(i,n.currency);if(!a)return;let o=u(r.campaign.conditions),s=o==null?void 0:t(o,n.currency),c=r.campaign.defaultLockupSeconds,l=c&&c>0?Math.round(c/86400):void 0;return{formatted:a,parts:g(i,n.currency),payoutType:i.payoutType,minPurchaseAmount:s,lockupDurationDays:l,referrerReward:r.campaign.referrer,refereeReward:r.campaign.referee,minPurchaseValue:o??void 0,isProductScoped:r.campaign.productScope!=null,matchedProducts:r.matchedProducts}}export{v as i,L as n,R as r,_ as t};
|