@behio/storefront-sdk 0.32.0 → 0.34.0
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/dist/{chunk-Y7QAB75P.mjs → chunk-5KJDVDUM.mjs} +43 -0
- package/dist/chunk-CZRSJULD.js +118 -0
- package/dist/chunk-QUU76QUB.mjs +118 -0
- package/dist/{chunk-5OFVG2BO.js → chunk-Y4ZCK5HD.js} +43 -0
- package/dist/{client-BOz1trRk.d.mts → client-DdaC0_6x.d.mts} +239 -5
- package/dist/{client-BOz1trRk.d.ts → client-DdaC0_6x.d.ts} +239 -5
- package/dist/index.d.mts +86 -8
- package/dist/index.d.ts +86 -8
- package/dist/index.js +11 -3
- package/dist/index.mjs +10 -2
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +172 -4
- package/dist/react.d.ts +172 -4
- package/dist/react.js +285 -55
- package/dist/react.mjs +325 -95
- package/package.json +1 -1
- package/dist/chunk-JIAOZ5YW.js +0 -40
- package/dist/chunk-ZOZAJG6T.mjs +0 -40
package/package.json
CHANGED
package/dist/chunk-JIAOZ5YW.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/react/utils/format-price.ts
|
|
2
|
-
function formatPrice(amount, currency, locale) {
|
|
3
|
-
const resolvedLocale = _nullishCoalesce(locale, () => ( "cs"));
|
|
4
|
-
try {
|
|
5
|
-
return new Intl.NumberFormat(resolvedLocale, {
|
|
6
|
-
style: "currency",
|
|
7
|
-
currency,
|
|
8
|
-
minimumFractionDigits: Number.isInteger(amount) ? 0 : 2,
|
|
9
|
-
maximumFractionDigits: 2
|
|
10
|
-
}).format(amount);
|
|
11
|
-
} catch (e) {
|
|
12
|
-
return `${amount} ${currency}`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// src/analytics.ts
|
|
17
|
-
function trackEcommerceEvent(event, payload) {
|
|
18
|
-
if (typeof window === "undefined") return;
|
|
19
|
-
const w = window;
|
|
20
|
-
try {
|
|
21
|
-
_optionalChain([w, 'access', _ => _.__behioEcommerceSink, 'optionalCall', _2 => _2(event, payload)]);
|
|
22
|
-
} catch (e2) {
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
if (typeof w.gtag === "function") {
|
|
26
|
-
w.gtag("event", event, payload);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (Array.isArray(w.dataLayer)) {
|
|
30
|
-
w.dataLayer.push({ ecommerce: null });
|
|
31
|
-
w.dataLayer.push({ event, ecommerce: payload });
|
|
32
|
-
}
|
|
33
|
-
} catch (e3) {
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
exports.formatPrice = formatPrice; exports.trackEcommerceEvent = trackEcommerceEvent;
|
package/dist/chunk-ZOZAJG6T.mjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// src/react/utils/format-price.ts
|
|
2
|
-
function formatPrice(amount, currency, locale) {
|
|
3
|
-
const resolvedLocale = locale ?? "cs";
|
|
4
|
-
try {
|
|
5
|
-
return new Intl.NumberFormat(resolvedLocale, {
|
|
6
|
-
style: "currency",
|
|
7
|
-
currency,
|
|
8
|
-
minimumFractionDigits: Number.isInteger(amount) ? 0 : 2,
|
|
9
|
-
maximumFractionDigits: 2
|
|
10
|
-
}).format(amount);
|
|
11
|
-
} catch {
|
|
12
|
-
return `${amount} ${currency}`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// src/analytics.ts
|
|
17
|
-
function trackEcommerceEvent(event, payload) {
|
|
18
|
-
if (typeof window === "undefined") return;
|
|
19
|
-
const w = window;
|
|
20
|
-
try {
|
|
21
|
-
w.__behioEcommerceSink?.(event, payload);
|
|
22
|
-
} catch {
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
if (typeof w.gtag === "function") {
|
|
26
|
-
w.gtag("event", event, payload);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (Array.isArray(w.dataLayer)) {
|
|
30
|
-
w.dataLayer.push({ ecommerce: null });
|
|
31
|
-
w.dataLayer.push({ event, ecommerce: payload });
|
|
32
|
-
}
|
|
33
|
-
} catch {
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
formatPrice,
|
|
39
|
-
trackEcommerceEvent
|
|
40
|
-
};
|