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.d.cts
CHANGED
|
@@ -138,7 +138,6 @@ interface StorefrontStores {
|
|
|
138
138
|
currency: ReturnType<typeof computed>;
|
|
139
139
|
currencySymbol: ReturnType<typeof computed>;
|
|
140
140
|
paymentMethods: ReturnType<typeof computed>;
|
|
141
|
-
paymentMethodObjects: ReturnType<typeof computed>;
|
|
142
141
|
paymentConfig: ReturnType<typeof computed>;
|
|
143
142
|
zones: ReturnType<typeof computed>;
|
|
144
143
|
}
|
|
@@ -173,7 +172,7 @@ declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
|
|
|
173
172
|
declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
|
|
174
173
|
declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
175
174
|
|
|
176
|
-
declare const SDK_VERSION = "0.7.
|
|
175
|
+
declare const SDK_VERSION = "0.7.92";
|
|
177
176
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
178
177
|
interface ApiConfig {
|
|
179
178
|
httpClient: any;
|
|
@@ -517,7 +516,6 @@ declare function createStorefront(config: HttpClientConfig & {
|
|
|
517
516
|
currency: nanostores.ReadableAtom<any>;
|
|
518
517
|
currencySymbol: nanostores.ReadableAtom<any>;
|
|
519
518
|
paymentMethods: nanostores.ReadableAtom<any>;
|
|
520
|
-
paymentMethodObjects: nanostores.ReadableAtom<any>;
|
|
521
519
|
paymentConfig: nanostores.ReadableAtom<{
|
|
522
520
|
provider: any;
|
|
523
521
|
enabled: boolean;
|
|
@@ -619,9 +617,10 @@ declare function createStorefront(config: HttpClientConfig & {
|
|
|
619
617
|
};
|
|
620
618
|
};
|
|
621
619
|
activity: {
|
|
620
|
+
track(params: Parameters<(params: TrackParams) => Promise<void>>[0]): Promise<void>;
|
|
622
621
|
COMMON_ACTIVITY_TYPES: readonly ["page_view", "product_view", "service_view", "provider_view", "cart_added", "cart_removed", "checkout_started", "purchase", "booking_created", "signin", "signup", "verified_email", "search", "share", "wishlist_added"];
|
|
623
|
-
track(params: TrackParams): Promise<void>;
|
|
624
622
|
};
|
|
623
|
+
ready: Promise<void>;
|
|
625
624
|
automation: {
|
|
626
625
|
agent: {
|
|
627
626
|
getAgents(params?: any, options?: RequestOptions): any;
|
package/dist/index.d.ts
CHANGED
|
@@ -138,7 +138,6 @@ interface StorefrontStores {
|
|
|
138
138
|
currency: ReturnType<typeof computed>;
|
|
139
139
|
currencySymbol: ReturnType<typeof computed>;
|
|
140
140
|
paymentMethods: ReturnType<typeof computed>;
|
|
141
|
-
paymentMethodObjects: ReturnType<typeof computed>;
|
|
142
141
|
paymentConfig: ReturnType<typeof computed>;
|
|
143
142
|
zones: ReturnType<typeof computed>;
|
|
144
143
|
}
|
|
@@ -173,7 +172,7 @@ declare function fetchSvgContent(mediaObject: any): Promise<string | null>;
|
|
|
173
172
|
declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
|
|
174
173
|
declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
175
174
|
|
|
176
|
-
declare const SDK_VERSION = "0.7.
|
|
175
|
+
declare const SDK_VERSION = "0.7.92";
|
|
177
176
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
178
177
|
interface ApiConfig {
|
|
179
178
|
httpClient: any;
|
|
@@ -517,7 +516,6 @@ declare function createStorefront(config: HttpClientConfig & {
|
|
|
517
516
|
currency: nanostores.ReadableAtom<any>;
|
|
518
517
|
currencySymbol: nanostores.ReadableAtom<any>;
|
|
519
518
|
paymentMethods: nanostores.ReadableAtom<any>;
|
|
520
|
-
paymentMethodObjects: nanostores.ReadableAtom<any>;
|
|
521
519
|
paymentConfig: nanostores.ReadableAtom<{
|
|
522
520
|
provider: any;
|
|
523
521
|
enabled: boolean;
|
|
@@ -619,9 +617,10 @@ declare function createStorefront(config: HttpClientConfig & {
|
|
|
619
617
|
};
|
|
620
618
|
};
|
|
621
619
|
activity: {
|
|
620
|
+
track(params: Parameters<(params: TrackParams) => Promise<void>>[0]): Promise<void>;
|
|
622
621
|
COMMON_ACTIVITY_TYPES: readonly ["page_view", "product_view", "service_view", "provider_view", "cart_added", "cart_removed", "checkout_started", "purchase", "booking_created", "signin", "signup", "verified_email", "search", "share", "wishlist_added"];
|
|
623
|
-
track(params: TrackParams): Promise<void>;
|
|
624
622
|
};
|
|
623
|
+
ready: Promise<void>;
|
|
625
624
|
automation: {
|
|
626
625
|
agent: {
|
|
627
626
|
getAgents(params?: any, options?: RequestOptions): any;
|
package/dist/index.js
CHANGED
|
@@ -2475,17 +2475,10 @@ function createStores() {
|
|
|
2475
2475
|
currencyDisplay: "narrowSymbol"
|
|
2476
2476
|
}).formatToParts(0).find((p) => p.type === "currency")?.value || m.currency.toUpperCase();
|
|
2477
2477
|
});
|
|
2478
|
-
const $paymentMethods = computed(
|
|
2479
|
-
$market,
|
|
2480
|
-
(m) => (m?.payment_methods || []).map((pm) => pm.id)
|
|
2481
|
-
);
|
|
2482
|
-
const $paymentMethodObjects = computed(
|
|
2483
|
-
$market,
|
|
2484
|
-
(m) => m?.payment_methods || []
|
|
2485
|
-
);
|
|
2478
|
+
const $paymentMethods = computed($market, (m) => m?.payment_methods || []);
|
|
2486
2479
|
const $paymentConfig = computed([$business, $paymentMethods], (biz, methods) => {
|
|
2487
2480
|
const payment = biz?.payment || null;
|
|
2488
|
-
const hasCreditCard = methods.
|
|
2481
|
+
const hasCreditCard = methods.some((m) => m.id === "credit_card");
|
|
2489
2482
|
return {
|
|
2490
2483
|
provider: payment,
|
|
2491
2484
|
enabled: hasCreditCard && !!payment
|
|
@@ -2502,7 +2495,6 @@ function createStores() {
|
|
|
2502
2495
|
currency: $currency,
|
|
2503
2496
|
currencySymbol: $currencySymbol,
|
|
2504
2497
|
paymentMethods: $paymentMethods,
|
|
2505
|
-
paymentMethodObjects: $paymentMethodObjects,
|
|
2506
2498
|
paymentConfig: $paymentConfig,
|
|
2507
2499
|
zones: $zones
|
|
2508
2500
|
};
|
|
@@ -2686,7 +2678,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
2686
2678
|
}
|
|
2687
2679
|
|
|
2688
2680
|
// src/index.ts
|
|
2689
|
-
var SDK_VERSION = "0.7.
|
|
2681
|
+
var SDK_VERSION = "0.7.92";
|
|
2690
2682
|
var SUPPORTED_FRAMEWORKS = [
|
|
2691
2683
|
"astro",
|
|
2692
2684
|
"react",
|
|
@@ -2960,6 +2952,10 @@ function createStorefront(config) {
|
|
|
2960
2952
|
const storefrontApi = createStorefrontApi(apiConfig);
|
|
2961
2953
|
const stores = createStores();
|
|
2962
2954
|
let sessionPromise = null;
|
|
2955
|
+
let resolveReady;
|
|
2956
|
+
const ready = new Promise((r) => {
|
|
2957
|
+
resolveReady = r;
|
|
2958
|
+
});
|
|
2963
2959
|
function session(market2) {
|
|
2964
2960
|
if (market2 !== void 0) apiConfig.market = market2;
|
|
2965
2961
|
if (sessionPromise) return sessionPromise;
|
|
@@ -2976,6 +2972,7 @@ function createStorefront(config) {
|
|
|
2976
2972
|
market: result.market || null
|
|
2977
2973
|
};
|
|
2978
2974
|
populateStores(stores, s);
|
|
2975
|
+
resolveReady();
|
|
2979
2976
|
return s;
|
|
2980
2977
|
} catch (err) {
|
|
2981
2978
|
const status = err?.status || err?.response?.status;
|
|
@@ -2990,6 +2987,7 @@ function createStorefront(config) {
|
|
|
2990
2987
|
market: result.market || null
|
|
2991
2988
|
};
|
|
2992
2989
|
populateStores(stores, s);
|
|
2990
|
+
resolveReady();
|
|
2993
2991
|
return s;
|
|
2994
2992
|
}
|
|
2995
2993
|
throw err;
|
|
@@ -3003,6 +3001,13 @@ function createStorefront(config) {
|
|
|
3003
3001
|
});
|
|
3004
3002
|
return sessionPromise;
|
|
3005
3003
|
}
|
|
3004
|
+
const activity = {
|
|
3005
|
+
...storefrontApi.activity,
|
|
3006
|
+
async track(params) {
|
|
3007
|
+
await ready;
|
|
3008
|
+
return storefrontApi.activity.track(params);
|
|
3009
|
+
}
|
|
3010
|
+
};
|
|
3006
3011
|
function setMarket(key) {
|
|
3007
3012
|
sessionPromise = null;
|
|
3008
3013
|
return session(key);
|
|
@@ -3015,7 +3020,8 @@ function createStorefront(config) {
|
|
|
3015
3020
|
eshop: storefrontApi.eshop,
|
|
3016
3021
|
booking: storefrontApi.booking,
|
|
3017
3022
|
crm: storefrontApi.crm,
|
|
3018
|
-
activity
|
|
3023
|
+
activity,
|
|
3024
|
+
ready,
|
|
3019
3025
|
automation: storefrontApi.automation,
|
|
3020
3026
|
setBusinessId: (businessId) => {
|
|
3021
3027
|
refresh_business_id = businessId;
|