@zenky/storefront-vue 0.10.3 → 0.10.5
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/CHANGELOG.md +90 -1
- package/README.md +76 -6
- package/dist/cart/index.js +5 -7
- package/dist/catalog/index.d.ts +1 -11
- package/dist/catalog/index.js +1 -1
- package/dist/chunk-2CI4RW7V.js +21 -0
- package/dist/chunk-2CI4RW7V.js.map +1 -0
- package/dist/{chunk-GW2QNTAD.js → chunk-4IFPVEO7.js} +3 -113
- package/dist/chunk-4IFPVEO7.js.map +1 -0
- package/dist/{chunk-N3NOTJUC.js → chunk-4YAEIKLA.js} +4 -6
- package/dist/chunk-4YAEIKLA.js.map +1 -0
- package/dist/{chunk-TEG7EL4N.js → chunk-CUSQYIEU.js} +46 -17
- package/dist/chunk-CUSQYIEU.js.map +1 -0
- package/dist/{chunk-57IOMDAM.js → chunk-CY6LA6C7.js} +3 -3
- package/dist/{chunk-57IOMDAM.js.map → chunk-CY6LA6C7.js.map} +1 -1
- package/dist/{chunk-GLTOJTZO.js → chunk-MOG6UMFM.js} +6 -3
- package/dist/chunk-MOG6UMFM.js.map +1 -0
- package/dist/{chunk-RYYY7MVP.js → chunk-NG7RUIWW.js} +3 -13
- package/dist/chunk-NG7RUIWW.js.map +1 -0
- package/dist/{chunk-JLFBAAFT.js → chunk-Q2TVQ3BG.js} +4 -5
- package/dist/chunk-Q2TVQ3BG.js.map +1 -0
- package/dist/{chunk-FFBZKQRV.js → chunk-SHASMBMV.js} +42 -5
- package/dist/chunk-SHASMBMV.js.map +1 -0
- package/dist/{chunk-G2X4SBCO.js → chunk-SPMUTUNX.js} +50 -50
- package/dist/chunk-SPMUTUNX.js.map +1 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.js +13 -15
- package/dist/order/index.d.ts +2 -0
- package/dist/order/index.js +2 -5
- package/dist/order/index.js.map +1 -1
- package/dist/ports/index.d.ts +14 -2
- package/dist/ports/index.js +1 -1
- package/dist/products/index.js +3 -4
- package/dist/promotions/index.d.ts +13 -0
- package/dist/promotions/index.js +3 -5
- package/dist/seo/index.d.ts +5 -11
- package/dist/seo/index.js +14 -24
- package/dist/seo/index.js.map +1 -1
- package/dist/snippets/index.d.ts +21 -15
- package/dist/snippets/index.js +1 -1
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +3 -5
- package/dist/theme/index.d.ts +1 -11
- package/dist/theme/index.js +1 -1
- package/dist/utils/index.d.ts +26 -3
- package/dist/website-settings/index.d.ts +1 -1
- package/docs/consumer-setup.md +15 -4
- package/docs/ports.md +5 -1
- package/docs/releasing.md +10 -2
- package/package.json +8 -10
- package/dist/chunk-7FRMMCR5.js +0 -93
- package/dist/chunk-7FRMMCR5.js.map +0 -1
- package/dist/chunk-BWUKMWHL.js +0 -45
- package/dist/chunk-BWUKMWHL.js.map +0 -1
- package/dist/chunk-FFBZKQRV.js.map +0 -1
- package/dist/chunk-G2X4SBCO.js.map +0 -1
- package/dist/chunk-GLTOJTZO.js.map +0 -1
- package/dist/chunk-GW2QNTAD.js.map +0 -1
- package/dist/chunk-JLFBAAFT.js.map +0 -1
- package/dist/chunk-N3NOTJUC.js.map +0 -1
- package/dist/chunk-RYYY7MVP.js.map +0 -1
- package/dist/chunk-TEG7EL4N.js.map +0 -1
- package/dist/chunk-V3VVDQIR.js +0 -27
- package/dist/chunk-V3VVDQIR.js.map +0 -1
- package/dist/layout/index.d.ts +0 -54
- package/dist/layout/index.js +0 -106
- package/dist/layout/index.js.map +0 -1
- package/dist/schedule-Dd3zwHEb.d.ts +0 -27
- package/dist/snippets-BC5bkSjm.d.ts +0 -23
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { useCartCredentials, usePromotionsChecker } from './chunk-
|
|
2
|
-
import { createRuntimeState } from './chunk-5QCUH3FF.js';
|
|
1
|
+
import { useCartCredentials, usePromotionsChecker } from './chunk-4YAEIKLA.js';
|
|
3
2
|
import { useCatalogStore } from './chunk-Z3IW4ODZ.js';
|
|
4
|
-
import { usePromotionsStore } from './chunk-
|
|
5
|
-
import { useStoreProfileStore, useAuthStore } from './chunk-TEG7EL4N.js';
|
|
3
|
+
import { useCartStore, useOrderSettingsStore, usePromotionsStore } from './chunk-SHASMBMV.js';
|
|
6
4
|
import { getRemoteCatalog } from './chunk-E3G7NGCH.js';
|
|
7
|
-
import { useCartStore, useOrderSettingsStore } from './chunk-FFBZKQRV.js';
|
|
8
|
-
import { useRuntime } from './chunk-V3VVDQIR.js';
|
|
9
5
|
import { minorToMajor, majorToMinor } from './chunk-RO25KNM5.js';
|
|
6
|
+
import { createRuntimeState } from './chunk-5QCUH3FF.js';
|
|
7
|
+
import { useRuntime, useStoreProfileStore, useAuthStore } from './chunk-CUSQYIEU.js';
|
|
10
8
|
import { PaymentMethod, OrderAuthenticationMethod, DeliveryMethod, OrderCartCheckerResultAction, RecaptchaAction } from '@zenky/storefront-api';
|
|
11
9
|
import { ref, computed, watch, watchEffect, getCurrentScope, onScopeDispose, toValue } from 'vue';
|
|
12
10
|
import { storeToRefs } from 'pinia';
|
|
@@ -100,17 +98,24 @@ var MAX_LOG_DEPTH = 6;
|
|
|
100
98
|
var MAX_ARRAY_ITEMS = 25;
|
|
101
99
|
var MAX_OBJECT_KEYS = 50;
|
|
102
100
|
var SENSITIVE_KEY_PARTS = [
|
|
101
|
+
"address",
|
|
103
102
|
"authorization",
|
|
103
|
+
"checkouturl",
|
|
104
104
|
"cookie",
|
|
105
105
|
"credential",
|
|
106
|
+
"email",
|
|
106
107
|
"password",
|
|
108
|
+
"paymentlink",
|
|
109
|
+
"paymentpageurl",
|
|
110
|
+
"phone",
|
|
107
111
|
"recaptcha",
|
|
112
|
+
"redirecturl",
|
|
108
113
|
"secret",
|
|
109
114
|
"token"
|
|
110
115
|
];
|
|
111
116
|
var SENSITIVE_EXACT_KEYS = /* @__PURE__ */ new Set(["cvc", "cvv", "otp", "pan", "pin"]);
|
|
112
|
-
var SENSITIVE_ASSIGNMENT = /((?:authorization|cookie|password|recaptcha|secret|(?:api|access|auth|card|order|refresh)[_-]?token|token)\s*[=:]\s*["']?)([^\s,"';&}\]]+)/gi;
|
|
113
|
-
var SENSITIVE_QUERY_PARAM = /([?&#](?:authorization|password|recaptcha|secret|(?:api|access|auth|card|order|refresh)[_-]?token|token)=)([^&#\s]+)/gi;
|
|
117
|
+
var SENSITIVE_ASSIGNMENT = /((?:address|authorization|cookie|email|password|phone|recaptcha|secret|(?:checkout|redirect)[_-]?url|payment(?:[_-]?page)?[_-]?(?:link|url)|(?:api|access|auth|card|order|refresh)[_-]?token|token)\s*[=:]\s*["']?)([^\s,"';&}\]]+)/gi;
|
|
118
|
+
var SENSITIVE_QUERY_PARAM = /([?&#](?:address|authorization|email|password|phone|recaptcha|secret|(?:checkout|redirect)[_-]?url|payment(?:[_-]?page)?[_-]?(?:link|url)|(?:api|access|auth|card|order|refresh)[_-]?token|token)=)([^&#\s]+)/gi;
|
|
114
119
|
var BEARER_TOKEN = /(bearer\s+)[a-z0-9._~+/=-]+/gi;
|
|
115
120
|
function isSensitiveKey(key) {
|
|
116
121
|
const normalized = key.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
@@ -634,11 +639,11 @@ function useOrderBonuses(deps = {}) {
|
|
|
634
639
|
}
|
|
635
640
|
var PAYMENT_DEBOUNCE_MS = 300;
|
|
636
641
|
function usePaymentSelection() {
|
|
637
|
-
const { sdk, notifier, activity } = useRuntime();
|
|
642
|
+
const { sdk, notifier, messages, activity } = useRuntime();
|
|
638
643
|
const credentials = useCartCredentials();
|
|
639
644
|
const cartStore = useCartStore();
|
|
640
645
|
const profileStore = useStoreProfileStore();
|
|
641
|
-
const { fetchTotal } = useOrderTotal();
|
|
646
|
+
const { fetchTotal, total } = useOrderTotal();
|
|
642
647
|
const { run: runMutation } = useCartMutation();
|
|
643
648
|
async function sendPayments(payments, debounce = PAYMENT_DEBOUNCE_MS) {
|
|
644
649
|
const storeId = profileStore.store?.id;
|
|
@@ -671,7 +676,7 @@ function usePaymentSelection() {
|
|
|
671
676
|
},
|
|
672
677
|
e
|
|
673
678
|
);
|
|
674
|
-
notifier.error(getCartErrorMessage(e, "
|
|
679
|
+
notifier.error(getCartErrorMessage(e, messages.format("cart.payment.updateFailed")));
|
|
675
680
|
} finally {
|
|
676
681
|
activity.end("payment");
|
|
677
682
|
}
|
|
@@ -689,7 +694,6 @@ function usePaymentSelection() {
|
|
|
689
694
|
}
|
|
690
695
|
function getCurrentBonusesPayment() {
|
|
691
696
|
if (!cartStore.hasBonusesApplied) return null;
|
|
692
|
-
const { total } = useOrderTotal();
|
|
693
697
|
const bonusPayment = total.value?.payments?.find(
|
|
694
698
|
(p) => p.method === PaymentMethod.Bonuses
|
|
695
699
|
);
|
|
@@ -718,6 +722,7 @@ function usePaymentSelection() {
|
|
|
718
722
|
return { setPayment, syncPaymentNow, clearPayments };
|
|
719
723
|
}
|
|
720
724
|
function useBonusesReconciliation(deps) {
|
|
725
|
+
const { messages } = useRuntime();
|
|
721
726
|
const cartStore = useCartStore();
|
|
722
727
|
const profileStore = useStoreProfileStore();
|
|
723
728
|
const { maxAvailable, apply, remove } = useOrderBonuses({ activity: deps.activity });
|
|
@@ -770,8 +775,8 @@ function useBonusesReconciliation(deps) {
|
|
|
770
775
|
);
|
|
771
776
|
}
|
|
772
777
|
cartStore.setBonusesRequiresConfirmation(true);
|
|
773
|
-
deps.notifier.message("
|
|
774
|
-
description: "
|
|
778
|
+
deps.notifier.message(messages.format("cart.bonuses.changed.title"), {
|
|
779
|
+
description: messages.format("cart.bonuses.changed.description")
|
|
775
780
|
});
|
|
776
781
|
return;
|
|
777
782
|
}
|
|
@@ -807,7 +812,7 @@ function useCartRecalculation(deps) {
|
|
|
807
812
|
return { recalculateAfterOrderChange };
|
|
808
813
|
}
|
|
809
814
|
function useCustomerAttach(cache) {
|
|
810
|
-
const { sdk, notifier, activity } = useRuntime();
|
|
815
|
+
const { sdk, notifier, messages, activity } = useRuntime();
|
|
811
816
|
const credentials = useCartCredentials();
|
|
812
817
|
const cartStore = useCartStore();
|
|
813
818
|
const profileStore = useStoreProfileStore();
|
|
@@ -849,7 +854,7 @@ function useCustomerAttach(cache) {
|
|
|
849
854
|
},
|
|
850
855
|
e
|
|
851
856
|
);
|
|
852
|
-
notifier.error(getCartErrorMessage(e, "
|
|
857
|
+
notifier.error(getCartErrorMessage(e, messages.format("cart.customer.saveFailed")));
|
|
853
858
|
throw e;
|
|
854
859
|
}
|
|
855
860
|
}
|
|
@@ -861,7 +866,7 @@ function normalizePhone(phone) {
|
|
|
861
866
|
return digits || null;
|
|
862
867
|
}
|
|
863
868
|
function useCartCustomerAttachment(cache) {
|
|
864
|
-
const { sdk, notifier } = useRuntime();
|
|
869
|
+
const { sdk, notifier, messages } = useRuntime();
|
|
865
870
|
const authStore = useAuthStore();
|
|
866
871
|
const cartStore = useCartStore();
|
|
867
872
|
const profileStore = useStoreProfileStore();
|
|
@@ -891,7 +896,7 @@ function useCartCustomerAttachment(cache) {
|
|
|
891
896
|
if (previousPhone && newPhone && previousPhone !== newPhone) {
|
|
892
897
|
const firstName = fresh.customer?.first_name;
|
|
893
898
|
notifier.success(
|
|
894
|
-
firstName ?
|
|
899
|
+
firstName ? messages.format("cart.customer.updatedWithName", { firstName }) : messages.format("cart.customer.updated")
|
|
895
900
|
);
|
|
896
901
|
}
|
|
897
902
|
}
|
|
@@ -904,7 +909,7 @@ function useCartCustomerAttachment(cache) {
|
|
|
904
909
|
e
|
|
905
910
|
);
|
|
906
911
|
if (notifyOnPhoneChange) {
|
|
907
|
-
notifier.error("
|
|
912
|
+
notifier.error(messages.format("cart.customer.updateAfterLoginFailed"));
|
|
908
913
|
}
|
|
909
914
|
}
|
|
910
915
|
}
|
|
@@ -954,7 +959,7 @@ function useCartCustomerAttachment(cache) {
|
|
|
954
959
|
var KEY_STOCK_ID = "zenky_stock_id";
|
|
955
960
|
var YEAR_SECONDS = 60 * 60 * 24 * 365;
|
|
956
961
|
function useCartStockWatcher() {
|
|
957
|
-
const { sdk, notifier, storage, catalogReloader } = useRuntime();
|
|
962
|
+
const { sdk, notifier, messages, storage, catalogReloader } = useRuntime();
|
|
958
963
|
const profileStore = useStoreProfileStore();
|
|
959
964
|
const catalogStore = useCatalogStore();
|
|
960
965
|
const cartStore = useCartStore();
|
|
@@ -989,7 +994,7 @@ function useCartStockWatcher() {
|
|
|
989
994
|
},
|
|
990
995
|
e
|
|
991
996
|
);
|
|
992
|
-
notifier.warning("
|
|
997
|
+
notifier.warning(messages.format("cart.stock.catalogReloadFailed"));
|
|
993
998
|
}
|
|
994
999
|
}
|
|
995
1000
|
async function checkCartProducts() {
|
|
@@ -1001,10 +1006,10 @@ function useCartStockWatcher() {
|
|
|
1001
1006
|
const freshOrder = await sdk.orders.getOrder(storeId, orderCredentials, ORDER_WITH);
|
|
1002
1007
|
cartStore.setOrder(freshOrder);
|
|
1003
1008
|
await fetchTotal();
|
|
1004
|
-
notifier.warning("
|
|
1009
|
+
notifier.warning(messages.format("cart.stock.itemsRemoved"));
|
|
1005
1010
|
} else if (result.order_variants.length > 0) {
|
|
1006
1011
|
await fetchTotal();
|
|
1007
|
-
notifier.warning("
|
|
1012
|
+
notifier.warning(messages.format("cart.stock.pricesUpdated"));
|
|
1008
1013
|
}
|
|
1009
1014
|
} catch (e) {
|
|
1010
1015
|
logCartError(
|
|
@@ -1014,7 +1019,7 @@ function useCartStockWatcher() {
|
|
|
1014
1019
|
},
|
|
1015
1020
|
e
|
|
1016
1021
|
);
|
|
1017
|
-
notifier.warning("
|
|
1022
|
+
notifier.warning(messages.format("cart.stock.checkFailed"));
|
|
1018
1023
|
}
|
|
1019
1024
|
}
|
|
1020
1025
|
return { handleStockChange };
|
|
@@ -1155,20 +1160,9 @@ function useOrderDelivery(deps = {}) {
|
|
|
1155
1160
|
() => {
|
|
1156
1161
|
const storeId = credentials.getStoreId();
|
|
1157
1162
|
const orderCredentials = credentials.getCredentials();
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
}
|
|
1161
|
-
const path = sdk.client.getStoreUrl(
|
|
1162
|
-
storeId,
|
|
1163
|
-
`/orders/${orderCredentials.id}/checkout/delivery/time`,
|
|
1164
|
-
{ token: orderCredentials.token }
|
|
1165
|
-
);
|
|
1166
|
-
return sdk.client.request(
|
|
1167
|
-
"POST",
|
|
1168
|
-
path,
|
|
1169
|
-
{ deliver_at: deliverAt },
|
|
1170
|
-
orderCredentials.api_token ?? null
|
|
1171
|
-
);
|
|
1163
|
+
return sdk.orders.setOrderDeliveryTime(storeId, orderCredentials, {
|
|
1164
|
+
deliver_at: deliverAt
|
|
1165
|
+
});
|
|
1172
1166
|
},
|
|
1173
1167
|
{ deliverAt },
|
|
1174
1168
|
options.awaitSettle ?? false
|
|
@@ -1243,7 +1237,10 @@ function useOrderPromocode(deps = {}) {
|
|
|
1243
1237
|
}
|
|
1244
1238
|
});
|
|
1245
1239
|
} catch (e) {
|
|
1246
|
-
errorMessage.value = getCartErrorMessage(
|
|
1240
|
+
errorMessage.value = getCartErrorMessage(
|
|
1241
|
+
e,
|
|
1242
|
+
runtime.messages.format("cart.promocode.applyFailed")
|
|
1243
|
+
);
|
|
1247
1244
|
logCartError(
|
|
1248
1245
|
{
|
|
1249
1246
|
scope: "promocode-apply",
|
|
@@ -1275,7 +1272,10 @@ function useOrderPromocode(deps = {}) {
|
|
|
1275
1272
|
}
|
|
1276
1273
|
});
|
|
1277
1274
|
} catch (e) {
|
|
1278
|
-
errorMessage.value = getCartErrorMessage(
|
|
1275
|
+
errorMessage.value = getCartErrorMessage(
|
|
1276
|
+
e,
|
|
1277
|
+
runtime.messages.format("cart.promocode.removeFailed")
|
|
1278
|
+
);
|
|
1279
1279
|
logCartError(
|
|
1280
1280
|
{
|
|
1281
1281
|
scope: "promocode-remove",
|
|
@@ -1410,7 +1410,7 @@ var getOperationsState = createRuntimeState(() => ({
|
|
|
1410
1410
|
function useCartOperations(credentials, initialization, sdk, deps) {
|
|
1411
1411
|
const { notifier, activity } = deps;
|
|
1412
1412
|
const runtime = useRuntime();
|
|
1413
|
-
const { events, rum, commerceEvents } = runtime;
|
|
1413
|
+
const { events, rum, commerceEvents, messages } = runtime;
|
|
1414
1414
|
const { batches, inflight } = getOperationsState(runtime);
|
|
1415
1415
|
const cartStore = useCartStore();
|
|
1416
1416
|
const profileStore = useStoreProfileStore();
|
|
@@ -1529,7 +1529,9 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1529
1529
|
await recalculateAfterOrderChange();
|
|
1530
1530
|
if (isAdd && productName) {
|
|
1531
1531
|
const parts = [productName, variantLabel].filter(Boolean);
|
|
1532
|
-
notifier.message(
|
|
1532
|
+
notifier.message(messages.format("cart.added.title"), {
|
|
1533
|
+
description: parts.join(", ")
|
|
1534
|
+
});
|
|
1533
1535
|
}
|
|
1534
1536
|
});
|
|
1535
1537
|
} catch (e) {
|
|
@@ -1554,7 +1556,7 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1554
1556
|
} else {
|
|
1555
1557
|
integrations?.productQuantityDecreaseFailed({ order: cartStore.order });
|
|
1556
1558
|
}
|
|
1557
|
-
notifier.error(getCartErrorMessage(e, "
|
|
1559
|
+
notifier.error(getCartErrorMessage(e, messages.format("cart.updateFailed")));
|
|
1558
1560
|
try {
|
|
1559
1561
|
await refreshCart({ silent: true });
|
|
1560
1562
|
} catch (refreshErr) {
|
|
@@ -1972,12 +1974,10 @@ function useRestrictedAddToCart() {
|
|
|
1972
1974
|
if (!storeId || !cityId) return true;
|
|
1973
1975
|
let blocking = [];
|
|
1974
1976
|
try {
|
|
1975
|
-
const
|
|
1976
|
-
city_id: cityId
|
|
1977
|
-
stock_id: profileStore.stock?.id ?? void 0
|
|
1977
|
+
const restrictions = await sdk.products.getProductRestrictions(storeId, product.id, {
|
|
1978
|
+
city_id: cityId
|
|
1978
1979
|
});
|
|
1979
|
-
|
|
1980
|
-
blocking = (response?.data ?? []).filter((item) => item.is_blocking);
|
|
1980
|
+
blocking = (restrictions ?? []).filter((item) => item.is_blocking);
|
|
1981
1981
|
} catch (error) {
|
|
1982
1982
|
logCartError({ scope: "restrictions-check", context: { productId: product.id } }, error);
|
|
1983
1983
|
return true;
|
|
@@ -2007,5 +2007,5 @@ function useVisibleCartVariants() {
|
|
|
2007
2007
|
}
|
|
2008
2008
|
|
|
2009
2009
|
export { CASH_DENOMINATIONS_MAJOR, DEFAULT_ROUND_STEPS_MAJOR, ORDER_EVENTS, ORDER_WITH, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCartErrorCode, getCartErrorHttpCode, getCartErrorMessage, getCashDenominationsMinor, getDefaultRoundStepsMinor, getValidationErrors, logCartError, normalizeAddress, useBonusesReconciliation, useCartAddressSync, useCartCustomerAttachment, useCartDeliveryAttachment, useCartInitialization, useCartMutation, useCartOperations, useCartQuantities, useCartRecalculation, useCartStockWatcher, useCheckoutFlow, useCheckoutSubmit, useCustomerAttach, useOnlinePaymentRetry, useOrderBonuses, useOrderChannel, useOrderDelivery, useOrderPromocode, useOrderSettings, useOrderTotal, usePaymentSelection, useRestrictedAddToCart, useRestrictionGate, useStorefrontCart, useVisibleCartVariants, variantLineKey };
|
|
2010
|
-
//# sourceMappingURL=chunk-
|
|
2011
|
-
//# sourceMappingURL=chunk-
|
|
2010
|
+
//# sourceMappingURL=chunk-SPMUTUNX.js.map
|
|
2011
|
+
//# sourceMappingURL=chunk-SPMUTUNX.js.map
|