arky-sdk 0.7.90 → 0.7.92
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/index.cjs +18 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +18 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2477,17 +2477,10 @@ function createStores() {
|
|
|
2477
2477
|
currencyDisplay: "narrowSymbol"
|
|
2478
2478
|
}).formatToParts(0).find((p) => p.type === "currency")?.value || m.currency.toUpperCase();
|
|
2479
2479
|
});
|
|
2480
|
-
const $paymentMethods = nanostores.computed(
|
|
2481
|
-
$market,
|
|
2482
|
-
(m) => (m?.payment_methods || []).map((pm) => pm.id)
|
|
2483
|
-
);
|
|
2484
|
-
const $paymentMethodObjects = nanostores.computed(
|
|
2485
|
-
$market,
|
|
2486
|
-
(m) => m?.payment_methods || []
|
|
2487
|
-
);
|
|
2480
|
+
const $paymentMethods = nanostores.computed($market, (m) => m?.payment_methods || []);
|
|
2488
2481
|
const $paymentConfig = nanostores.computed([$business, $paymentMethods], (biz, methods) => {
|
|
2489
2482
|
const payment = biz?.payment || null;
|
|
2490
|
-
const hasCreditCard = methods.
|
|
2483
|
+
const hasCreditCard = methods.some((m) => m.id === "credit_card");
|
|
2491
2484
|
return {
|
|
2492
2485
|
provider: payment,
|
|
2493
2486
|
enabled: hasCreditCard && !!payment
|
|
@@ -2504,7 +2497,6 @@ function createStores() {
|
|
|
2504
2497
|
currency: $currency,
|
|
2505
2498
|
currencySymbol: $currencySymbol,
|
|
2506
2499
|
paymentMethods: $paymentMethods,
|
|
2507
|
-
paymentMethodObjects: $paymentMethodObjects,
|
|
2508
2500
|
paymentConfig: $paymentConfig,
|
|
2509
2501
|
zones: $zones
|
|
2510
2502
|
};
|
|
@@ -2688,7 +2680,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
2688
2680
|
}
|
|
2689
2681
|
|
|
2690
2682
|
// src/index.ts
|
|
2691
|
-
var SDK_VERSION = "0.7.
|
|
2683
|
+
var SDK_VERSION = "0.7.92";
|
|
2692
2684
|
var SUPPORTED_FRAMEWORKS = [
|
|
2693
2685
|
"astro",
|
|
2694
2686
|
"react",
|
|
@@ -2962,6 +2954,10 @@ function createStorefront(config) {
|
|
|
2962
2954
|
const storefrontApi = createStorefrontApi(apiConfig);
|
|
2963
2955
|
const stores = createStores();
|
|
2964
2956
|
let sessionPromise = null;
|
|
2957
|
+
let resolveReady;
|
|
2958
|
+
const ready = new Promise((r) => {
|
|
2959
|
+
resolveReady = r;
|
|
2960
|
+
});
|
|
2965
2961
|
function session(market2) {
|
|
2966
2962
|
if (market2 !== void 0) apiConfig.market = market2;
|
|
2967
2963
|
if (sessionPromise) return sessionPromise;
|
|
@@ -2978,6 +2974,7 @@ function createStorefront(config) {
|
|
|
2978
2974
|
market: result.market || null
|
|
2979
2975
|
};
|
|
2980
2976
|
populateStores(stores, s);
|
|
2977
|
+
resolveReady();
|
|
2981
2978
|
return s;
|
|
2982
2979
|
} catch (err) {
|
|
2983
2980
|
const status = err?.status || err?.response?.status;
|
|
@@ -2992,6 +2989,7 @@ function createStorefront(config) {
|
|
|
2992
2989
|
market: result.market || null
|
|
2993
2990
|
};
|
|
2994
2991
|
populateStores(stores, s);
|
|
2992
|
+
resolveReady();
|
|
2995
2993
|
return s;
|
|
2996
2994
|
}
|
|
2997
2995
|
throw err;
|
|
@@ -3005,6 +3003,13 @@ function createStorefront(config) {
|
|
|
3005
3003
|
});
|
|
3006
3004
|
return sessionPromise;
|
|
3007
3005
|
}
|
|
3006
|
+
const activity = {
|
|
3007
|
+
...storefrontApi.activity,
|
|
3008
|
+
async track(params) {
|
|
3009
|
+
await ready;
|
|
3010
|
+
return storefrontApi.activity.track(params);
|
|
3011
|
+
}
|
|
3012
|
+
};
|
|
3008
3013
|
function setMarket(key) {
|
|
3009
3014
|
sessionPromise = null;
|
|
3010
3015
|
return session(key);
|
|
@@ -3017,7 +3022,8 @@ function createStorefront(config) {
|
|
|
3017
3022
|
eshop: storefrontApi.eshop,
|
|
3018
3023
|
booking: storefrontApi.booking,
|
|
3019
3024
|
crm: storefrontApi.crm,
|
|
3020
|
-
activity
|
|
3025
|
+
activity,
|
|
3026
|
+
ready,
|
|
3021
3027
|
automation: storefrontApi.automation,
|
|
3022
3028
|
setBusinessId: (businessId) => {
|
|
3023
3029
|
refresh_business_id = businessId;
|