@syntrologie/adapt-product 2.42.0 → 2.44.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify-ajax.d.ts","sourceRoot":"","sources":["../../src/bind/shopify-ajax.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjE,KAAK,oBAAoB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC,CAAC;AACzE,KAAK,oBAAoB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"shopify-ajax.d.ts","sourceRoot":"","sources":["../../src/bind/shopify-ajax.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjE,KAAK,oBAAoB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC,CAAC;AACzE,KAAK,oBAAoB,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,CAAC,CAAC;AAiDzE,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBxB;AAED,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,oBAAoB,EAC3B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAIxB"}
|
package/dist/cdn.js
CHANGED
|
@@ -4212,6 +4212,16 @@ async function resolveOpenGraphImage(input, signal) {
|
|
|
4212
4212
|
}
|
|
4213
4213
|
|
|
4214
4214
|
// src/bind/shopify-ajax.ts
|
|
4215
|
+
function storefrontCurrency(payload) {
|
|
4216
|
+
if (payload.currency) return payload.currency;
|
|
4217
|
+
const g = globalThis;
|
|
4218
|
+
const active = g.Shopify?.currency?.active;
|
|
4219
|
+
if (typeof active === "string" && /^[A-Za-z]{3}$/.test(active)) return active.toUpperCase();
|
|
4220
|
+
console.warn(
|
|
4221
|
+
"[adaptive-product.bind] shopify-ajax/price: storefront exposes no currency \u2014 falling back to USD"
|
|
4222
|
+
);
|
|
4223
|
+
return "USD";
|
|
4224
|
+
}
|
|
4215
4225
|
function originFor(base) {
|
|
4216
4226
|
if (base) return base.replace(/\/$/, "");
|
|
4217
4227
|
return typeof location !== "undefined" ? location.origin : "";
|
|
@@ -4231,7 +4241,7 @@ async function fetchProduct(handle, base, signal) {
|
|
|
4231
4241
|
async function resolveShopifyAjaxPrice(input, signal) {
|
|
4232
4242
|
const payload = await fetchProduct(input.handle, input.base, signal);
|
|
4233
4243
|
if (!payload || typeof payload.price !== "number") return null;
|
|
4234
|
-
const currency = payload
|
|
4244
|
+
const currency = storefrontCurrency(payload);
|
|
4235
4245
|
try {
|
|
4236
4246
|
return new Intl.NumberFormat(void 0, { style: "currency", currency }).format(
|
|
4237
4247
|
payload.price / 100
|
|
@@ -11927,4 +11937,4 @@ export {
|
|
|
11927
11937
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11928
11938
|
*)
|
|
11929
11939
|
*/
|
|
11930
|
-
//# sourceMappingURL=chunk-
|
|
11940
|
+
//# sourceMappingURL=chunk-VUU65MYQ.js.map
|