@sentecacommerce-theme/lib 0.13.5-alpha.7 → 0.13.7-alpha.6
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/cjs/analytics/Pixel/hooks/usePixelProductClick.js +1 -1
- package/dist/cjs/analytics/Pixel/hooks/usePixelProductDetails.js +1 -1
- package/dist/cjs/analytics/Pixel/hooks/usePixelProductsImpression.js +1 -1
- package/dist/cjs/analytics/Pixel/usePixel.js +1 -1
- package/dist/cjs/analytics/Releva/useReleva.js +1 -1
- package/dist/cjs/analytics/addToCart.js +0 -1
- package/dist/cjs/analytics/initiateCheckout.js +0 -1
- package/dist/cjs/analytics/viewContent.js +0 -1
- package/dist/cjs/api/myCartApi/index.js +2 -1
- package/dist/cjs/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
- package/dist/cjs/basket/api/index.js +37 -0
- package/dist/cjs/basket/api/mutations/index.js +37 -0
- package/dist/cjs/basket/api/mutations/useReplaceBasketMutation.js +58 -0
- package/dist/cjs/basket/hooks/index.js +52 -0
- package/dist/cjs/basket/hooks/useBasketCrossSaleItems.js +99 -0
- package/dist/cjs/basket/hooks/useReplaceBasket.js +10 -0
- package/dist/cjs/basket/index.js +37 -0
- package/dist/cjs/checkout/api/keys.js +8 -1
- package/dist/cjs/checkout/api/queries/index.js +15 -0
- package/dist/cjs/checkout/api/queries/useBnpCalculateForCartQuery.js +60 -0
- package/dist/cjs/checkout/hooks/index.js +15 -0
- package/dist/cjs/checkout/hooks/useBnpCalculateForCart.js +120 -0
- package/dist/cjs/components/Html/index.js +1 -1
- package/dist/cjs/components/Portal/index.js +1 -1
- package/dist/cjs/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
- package/dist/cjs/contexts/CheckoutForm/index.js +5 -3
- package/dist/cjs/hooks/ui-hooks/useIsDesktop/index.js +2 -2
- package/dist/cjs/hooks/useAllSelectedFilters/index.js +3 -3
- package/dist/cjs/hooks/useLineItem/index.js +7 -0
- package/dist/cjs/hooks/usePrice/index.js +1 -1
- package/dist/cjs/hooks/useProduct/index.js +26 -5
- package/dist/cjs/hooks/useProduct/utils/index.js +14 -1
- package/dist/cjs/hooks/useProgressBar/hooks/useGetSetState.js +1 -24
- package/dist/cjs/hooks/useSelectedFilters/index.js +3 -3
- package/dist/cjs/hooks/useVouchers/index.js +1 -2
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/listing/api/queries/useAggregateQuery.js +47 -12
- package/dist/cjs/listing/api/queries/useInfiniteListing.js +4 -4
- package/dist/cjs/listing/api/queries/useListingQuery.js +37 -22
- package/dist/cjs/listing/api/queries/usePredicate.js +4 -4
- package/dist/cjs/listing/components/BasicListingSEO.js +1 -1
- package/dist/cjs/listing/hooks/useListingAlias.js +2 -4
- package/dist/cjs/listing/hooks/useListingBreadcrumbs.js +4 -4
- package/dist/cjs/listing/hooks/useListingCategories.js +7 -8
- package/dist/cjs/listing/hooks/useListingConfig.js +4 -5
- package/dist/cjs/listing/hooks/useListingFilters.js +19 -20
- package/dist/cjs/listing/hooks/useListingItems.js +2 -2
- package/dist/cjs/listing/hooks/useListingMeta.js +5 -4
- package/dist/cjs/listing/hooks/useListingPagination.js +4 -4
- package/dist/cjs/listing/hooks/useListingSlug.js +3 -1
- package/dist/cjs/listing/hooks/useSlideFilter.js +4 -3
- package/dist/cjs/listing/hooks/utils.js +2 -1
- package/dist/cjs/listing/ssr/prefetchListing.js +4 -4
- package/dist/cjs/listing/types.js +8 -1
- package/dist/cjs/listing/utils/buildCategoryQuery.js +16 -12
- package/dist/cjs/listing/utils/buildFilterQuery.js +5 -7
- package/dist/cjs/listing/utils/getListingAlias.js +5 -6
- package/dist/cjs/listing/utils/getListingPageType.js +4 -3
- package/dist/cjs/navigation/components/SearchBox/Components/Container/index.js +1 -1
- package/dist/cjs/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
- package/dist/cjs/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
- package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
- package/dist/cjs/navigation/components/SearchBox/Components/Products/index.js +2 -2
- package/dist/cjs/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
- package/dist/cjs/navigation/components/SearchBox/index.js +11 -11
- package/dist/cjs/order/api/mutations/index.js +15 -0
- package/dist/cjs/order/api/mutations/useUpdateOrderCustomFieldMutation.js +15 -0
- package/dist/cjs/order/hooks/index.js +15 -0
- package/dist/cjs/order/hooks/useUpdateOrderCustomField.js +9 -0
- package/dist/cjs/product/api/keys.js +11 -0
- package/dist/cjs/product/api/queries/index.js +37 -0
- package/dist/cjs/product/api/queries/useBnpOffersQuery.js +64 -0
- package/dist/cjs/product/hooks/index.js +37 -0
- package/dist/cjs/product/hooks/useBnpOffers.js +89 -0
- package/dist/cjs/product/index.js +15 -0
- package/dist/cjs/seo/components/GlobalSEO/index.js +3 -3
- package/dist/cjs/user/api/queries/index.js +15 -0
- package/dist/cjs/user/api/queries/useGetMyLoyaltyCardQuery.js +21 -0
- package/dist/cjs/user/api/utils/getUserToken.js +16 -0
- package/dist/cjs/user/api/utils/index.js +12 -0
- package/dist/cjs/user/hooks/index.js +24 -0
- package/dist/cjs/user/hooks/useGetMyLoyaltyCard.js +9 -0
- package/dist/cjs/user/hooks/useGetUserToken.js +15 -0
- package/dist/esm/analytics/Pixel/hooks/usePixelProductClick.js +1 -1
- package/dist/esm/analytics/Pixel/hooks/usePixelProductDetails.js +1 -1
- package/dist/esm/analytics/Pixel/hooks/usePixelProductsImpression.js +1 -1
- package/dist/esm/analytics/Pixel/mainScript.js +0 -1
- package/dist/esm/analytics/Pixel/usePixel.js +1 -1
- package/dist/esm/analytics/Releva/useReleva.js +1 -1
- package/dist/esm/analytics/addToCart.js +0 -1
- package/dist/esm/analytics/initiateCheckout.js +0 -1
- package/dist/esm/analytics/pageView.js +1 -1
- package/dist/esm/analytics/viewContent.js +0 -1
- package/dist/esm/api/myCartApi/index.js +2 -1
- package/dist/esm/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
- package/dist/esm/basket/api/index.js +1 -0
- package/dist/esm/basket/api/mutations/index.js +1 -0
- package/dist/esm/basket/api/mutations/useReplaceBasketMutation.js +48 -0
- package/dist/esm/basket/hooks/index.js +2 -0
- package/dist/esm/basket/hooks/useBasketCrossSaleItems.js +67 -0
- package/dist/esm/basket/hooks/useReplaceBasket.js +2 -0
- package/dist/esm/basket/index.js +1 -0
- package/dist/esm/checkout/api/keys.js +6 -0
- package/dist/esm/checkout/api/queries/index.js +1 -0
- package/dist/esm/checkout/api/queries/useBnpCalculateForCartQuery.js +50 -0
- package/dist/esm/checkout/hooks/index.js +1 -0
- package/dist/esm/checkout/hooks/useBnpCalculateForCart.js +92 -0
- package/dist/esm/components/GoogleOneTap/index.js +1 -1
- package/dist/esm/components/Html/index.js +1 -1
- package/dist/esm/components/Portal/index.js +1 -1
- package/dist/esm/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
- package/dist/esm/contexts/CheckoutForm/index.js +5 -3
- package/dist/esm/hooks/ui-hooks/useIsDesktop/index.js +2 -2
- package/dist/esm/hooks/useAllSelectedFilters/index.js +4 -4
- package/dist/esm/hooks/useLineItem/index.js +2 -0
- package/dist/esm/hooks/usePrice/index.js +1 -1
- package/dist/esm/hooks/useProduct/index.js +27 -6
- package/dist/esm/hooks/useProduct/utils/index.js +13 -0
- package/dist/esm/hooks/useProgressBar/hooks/useGetSetState.js +1 -1
- package/dist/esm/hooks/useSelectedFilters/index.js +4 -4
- package/dist/esm/hooks/useVouchers/index.js +1 -2
- package/dist/esm/index.js +4 -0
- package/dist/esm/listing/api/queries/useAggregateQuery.js +47 -12
- package/dist/esm/listing/api/queries/useInfiniteListing.js +4 -4
- package/dist/esm/listing/api/queries/useListingQuery.js +37 -22
- package/dist/esm/listing/api/queries/usePredicate.js +4 -4
- package/dist/esm/listing/components/BasicListingSEO.js +1 -1
- package/dist/esm/listing/hooks/useListingAlias.js +2 -4
- package/dist/esm/listing/hooks/useListingBreadcrumbs.js +5 -5
- package/dist/esm/listing/hooks/useListingCategories.js +8 -9
- package/dist/esm/listing/hooks/useListingConfig.js +5 -6
- package/dist/esm/listing/hooks/useListingFilters.js +19 -20
- package/dist/esm/listing/hooks/useListingItems.js +2 -2
- package/dist/esm/listing/hooks/useListingMeta.js +6 -5
- package/dist/esm/listing/hooks/useListingPagination.js +4 -4
- package/dist/esm/listing/hooks/useListingSlug.js +3 -1
- package/dist/esm/listing/hooks/useSlideFilter.js +5 -4
- package/dist/esm/listing/hooks/utils.js +2 -1
- package/dist/esm/listing/ssr/prefetchListing.js +4 -4
- package/dist/esm/listing/types.js +7 -0
- package/dist/esm/listing/utils/buildCategoryQuery.js +16 -12
- package/dist/esm/listing/utils/buildFilterQuery.js +5 -7
- package/dist/esm/listing/utils/getListingAlias.js +5 -6
- package/dist/esm/listing/utils/getListingPageType.js +4 -3
- package/dist/esm/navigation/components/SearchBox/Components/Container/index.js +1 -1
- package/dist/esm/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
- package/dist/esm/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
- package/dist/esm/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
- package/dist/esm/navigation/components/SearchBox/Components/Products/index.js +2 -2
- package/dist/esm/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
- package/dist/esm/navigation/components/SearchBox/index.js +11 -11
- package/dist/esm/order/api/mutations/index.js +1 -0
- package/dist/esm/order/api/mutations/useUpdateOrderCustomFieldMutation.js +10 -0
- package/dist/esm/order/hooks/index.js +1 -0
- package/dist/esm/order/hooks/useUpdateOrderCustomField.js +4 -0
- package/dist/esm/product/api/keys.js +6 -0
- package/dist/esm/product/api/queries/index.js +1 -0
- package/dist/esm/product/api/queries/useBnpOffersQuery.js +54 -0
- package/dist/esm/product/hooks/index.js +1 -0
- package/dist/esm/product/hooks/useBnpOffers.js +84 -0
- package/dist/esm/product/index.js +1 -0
- package/dist/esm/seo/components/GlobalSEO/index.js +3 -3
- package/dist/esm/user/api/queries/index.js +1 -0
- package/dist/esm/user/api/queries/useGetMyLoyaltyCardQuery.js +16 -0
- package/dist/esm/user/api/utils/getUserToken.js +6 -0
- package/dist/esm/user/api/utils/index.js +1 -0
- package/dist/esm/user/hooks/index.js +2 -0
- package/dist/esm/user/hooks/useGetMyLoyaltyCard.js +4 -0
- package/dist/esm/user/hooks/useGetUserToken.js +5 -0
- package/dist/types/api/myCartApi/index.d.ts +1 -0
- package/dist/types/basket/api/index.d.ts +1 -0
- package/dist/types/basket/api/mutations/index.d.ts +1 -0
- package/dist/types/basket/api/mutations/useReplaceBasketMutation.d.ts +2 -0
- package/dist/types/basket/hooks/index.d.ts +2 -0
- package/dist/types/basket/hooks/useBasketCrossSaleItems.d.ts +9 -0
- package/dist/types/basket/hooks/useReplaceBasket.d.ts +2 -0
- package/dist/types/basket/index.d.ts +1 -0
- package/dist/types/checkout/api/keys.d.ts +1 -0
- package/dist/types/checkout/api/queries/index.d.ts +1 -0
- package/dist/types/checkout/api/queries/useBnpCalculateForCartQuery.d.ts +4 -0
- package/dist/types/checkout/hooks/index.d.ts +1 -0
- package/dist/types/checkout/hooks/useBnpCalculateForCart.d.ts +39 -0
- package/dist/types/contexts/CheckoutForm/hooks/usePayment/index.d.ts +2 -0
- package/dist/types/contexts/CheckoutForm/index.d.ts +2 -1
- package/dist/types/hooks/order-hooks/useReferralOrders/index.d.ts +1 -0
- package/dist/types/hooks/useLineItem/index.d.ts +2 -2
- package/dist/types/hooks/useProduct/index.d.ts +1 -0
- package/dist/types/hooks/useProduct/utils/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/listing/api/queries/useAggregateQuery.d.ts +6 -4
- package/dist/types/listing/api/queries/useListingQuery.d.ts +4 -2
- package/dist/types/listing/api/queries/usePredicate.d.ts +2 -1
- package/dist/types/listing/hooks/useListingAlias.d.ts +2 -1
- package/dist/types/listing/hooks/useListingFilters.d.ts +0 -1
- package/dist/types/listing/hooks/useListingItems.d.ts +3 -2
- package/dist/types/listing/hooks/useListingSEOCategories.d.ts +6 -4
- package/dist/types/listing/hooks/utils.d.ts +3 -2
- package/dist/types/listing/ssr/prefetchCategories.d.ts +2 -2
- package/dist/types/listing/ssr/prefetchListing.d.ts +4 -4
- package/dist/types/listing/ssr/prefetchPredicate.d.ts +2 -1
- package/dist/types/listing/types.d.ts +32 -16
- package/dist/types/listing/utils/buildCategoryQuery.d.ts +2 -1
- package/dist/types/listing/utils/buildFilterQuery.d.ts +2 -1
- package/dist/types/listing/utils/extendFilter.d.ts +3 -2
- package/dist/types/listing/utils/getListingAlias.d.ts +2 -1
- package/dist/types/listing/utils/getListingPageType.d.ts +2 -2
- package/dist/types/navigation/components/SearchBox/Components/Container/index.d.ts +10 -9
- package/dist/types/navigation/components/SearchBox/Components/EmptyBox/index.d.ts +22 -21
- package/dist/types/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.d.ts +8 -7
- package/dist/types/navigation/components/SearchBox/Components/Products/index.d.ts +9 -8
- package/dist/types/navigation/components/SearchBox/index.d.ts +31 -30
- package/dist/types/order/api/mutations/index.d.ts +1 -0
- package/dist/types/order/api/mutations/useUpdateCustomLineItemMutation.d.ts +2 -5
- package/dist/types/order/api/mutations/useUpdateOrderCustomFieldMutation.d.ts +9 -0
- package/dist/types/order/hooks/index.d.ts +1 -0
- package/dist/types/order/hooks/useUpdateCustomLineItem.d.ts +2 -2
- package/dist/types/order/hooks/useUpdateOrderCustomField.d.ts +2 -0
- package/dist/types/product/api/keys.d.ts +1 -0
- package/dist/types/product/api/queries/index.d.ts +1 -0
- package/dist/types/product/api/queries/useBnpOffersQuery.d.ts +5 -0
- package/dist/types/product/hooks/index.d.ts +1 -0
- package/dist/types/product/hooks/useBnpOffers.d.ts +37 -0
- package/dist/types/product/index.d.ts +1 -0
- package/dist/types/types/index.d.ts +38 -40
- package/dist/types/user/api/queries/index.d.ts +1 -0
- package/dist/types/user/api/queries/useGetMyLoyaltyCardQuery.d.ts +5 -0
- package/dist/types/user/api/utils/getUserToken.d.ts +1 -0
- package/dist/types/user/api/utils/index.d.ts +1 -0
- package/dist/types/user/hooks/index.d.ts +2 -0
- package/dist/types/user/hooks/useGetMyLoyaltyCard.d.ts +2 -0
- package/dist/types/user/hooks/useGetUserToken.d.ts +1 -0
- package/dist/types/utils/getSelectedFilters.d.ts +2 -1
- package/package.json +19 -13
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useBnpOffersQuery';
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import regeneratorRuntime from "regenerator-runtime";
|
2
|
+
import React from 'react';
|
3
|
+
import { useQuery } from 'react-query';
|
4
|
+
import { MyPaymentsBnpCalculateForSKU } from '@sentecacommerce/sdk';
|
5
|
+
import { getBnpProductOffersKey } from '../keys';
|
6
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
7
|
+
try {
|
8
|
+
var info = gen[key](arg);
|
9
|
+
var value = info.value;
|
10
|
+
} catch (error) {
|
11
|
+
reject(error);
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
if (info.done) {
|
15
|
+
resolve(value);
|
16
|
+
} else {
|
17
|
+
Promise.resolve(value).then(_next, _throw);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
function _asyncToGenerator(fn) {
|
21
|
+
return function() {
|
22
|
+
var self = this, args = arguments;
|
23
|
+
return new Promise(function(resolve, reject) {
|
24
|
+
var gen = fn.apply(self, args);
|
25
|
+
function _next(value) {
|
26
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
27
|
+
}
|
28
|
+
function _throw(err) {
|
29
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
30
|
+
}
|
31
|
+
_next(undefined);
|
32
|
+
});
|
33
|
+
};
|
34
|
+
}
|
35
|
+
export var useBnpOffersQuery = function(param) {
|
36
|
+
var sku = param.sku, _preferredInstallmentCentAmount = param.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
|
37
|
+
return useQuery(getBnpProductOffersKey(sku), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
38
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
39
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
40
|
+
case 0:
|
41
|
+
_ctx.next = 2;
|
42
|
+
return MyPaymentsBnpCalculateForSKU(sku, {
|
43
|
+
preferredInstallmentCentAmount: preferredInstallmentCentAmount,
|
44
|
+
downPaymentCentAmount: downPaymentCentAmount
|
45
|
+
});
|
46
|
+
case 2:
|
47
|
+
return _ctx.abrupt("return", _ctx.sent);
|
48
|
+
case 3:
|
49
|
+
case "end":
|
50
|
+
return _ctx.stop();
|
51
|
+
}
|
52
|
+
}, _callee);
|
53
|
+
})));
|
54
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useBnpOffers';
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import { useMemo } from 'react';
|
2
|
+
import { useBnpOffersQuery } from '../api/queries';
|
3
|
+
import { decodePrice, formatAsCurrency, useConfigState } from '../../index';
|
4
|
+
function _defineProperty(obj, key, value) {
|
5
|
+
if (key in obj) {
|
6
|
+
Object.defineProperty(obj, key, {
|
7
|
+
value: value,
|
8
|
+
enumerable: true,
|
9
|
+
configurable: true,
|
10
|
+
writable: true
|
11
|
+
});
|
12
|
+
} else {
|
13
|
+
obj[key] = value;
|
14
|
+
}
|
15
|
+
return obj;
|
16
|
+
}
|
17
|
+
function _objectSpread(target) {
|
18
|
+
for(var i = 1; i < arguments.length; i++){
|
19
|
+
var source = arguments[i] != null ? arguments[i] : {
|
20
|
+
};
|
21
|
+
var ownKeys = Object.keys(source);
|
22
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
23
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
24
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
25
|
+
}));
|
26
|
+
}
|
27
|
+
ownKeys.forEach(function(key) {
|
28
|
+
_defineProperty(target, key, source[key]);
|
29
|
+
});
|
30
|
+
}
|
31
|
+
return target;
|
32
|
+
}
|
33
|
+
export var useBnpOffers = function(props) {
|
34
|
+
var ref6, ref1, ref2, ref3;
|
35
|
+
var configLocale = ((ref6 = useConfigState()) === null || ref6 === void 0 ? void 0 : (ref1 = ref6.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
|
36
|
+
var response = useBnpOffersQuery(props);
|
37
|
+
return useMemo(function() {
|
38
|
+
var ref, ref4, ref5;
|
39
|
+
return _objectSpread({
|
40
|
+
}, response, {
|
41
|
+
data: response === null || response === void 0 ? void 0 : (ref = response.data) === null || ref === void 0 ? void 0 : (ref4 = ref[0]) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.offers) === null || ref5 === void 0 ? void 0 : ref5.map(function(offer) {
|
42
|
+
var _totalRepaymentAmount = decodePrice(offer.totalRepaymentAmount);
|
43
|
+
var _correctDownPaymentAmount = decodePrice(offer.correctDownPaymentAmount);
|
44
|
+
var _installmentAmount = decodePrice(offer.installmentAmount);
|
45
|
+
var _processingFeeAmount = decodePrice(offer.processingFeeAmount);
|
46
|
+
var totalRepaymentAmount = formatAsCurrency({
|
47
|
+
price: _totalRepaymentAmount,
|
48
|
+
precision: offer.totalRepaymentAmount.fractionDigits,
|
49
|
+
currency: offer.totalRepaymentAmount.currencyCode,
|
50
|
+
locale: configLocale || 'en'
|
51
|
+
});
|
52
|
+
var correctDownPaymentAmount = formatAsCurrency({
|
53
|
+
price: _correctDownPaymentAmount,
|
54
|
+
precision: offer.correctDownPaymentAmount.fractionDigits,
|
55
|
+
currency: offer.correctDownPaymentAmount.currencyCode,
|
56
|
+
locale: configLocale || 'en'
|
57
|
+
});
|
58
|
+
var installmentAmount = formatAsCurrency({
|
59
|
+
price: _installmentAmount,
|
60
|
+
precision: offer.installmentAmount.fractionDigits,
|
61
|
+
currency: offer.installmentAmount.currencyCode,
|
62
|
+
locale: configLocale || 'en'
|
63
|
+
});
|
64
|
+
var processingFeeAmount = formatAsCurrency({
|
65
|
+
price: _processingFeeAmount,
|
66
|
+
precision: offer.processingFeeAmount.fractionDigits,
|
67
|
+
currency: offer.processingFeeAmount.currencyCode,
|
68
|
+
locale: configLocale || 'en'
|
69
|
+
});
|
70
|
+
return _objectSpread({
|
71
|
+
}, offer, {
|
72
|
+
totalRepaymentAmount: totalRepaymentAmount,
|
73
|
+
correctDownPaymentAmount: correctDownPaymentAmount,
|
74
|
+
installmentAmount: installmentAmount,
|
75
|
+
processingFeeAmount: processingFeeAmount
|
76
|
+
});
|
77
|
+
}).sort(function(offer, offer2) {
|
78
|
+
return Number(offer.maturity) - Number(offer2.maturity);
|
79
|
+
})
|
80
|
+
});
|
81
|
+
}, [
|
82
|
+
response === null || response === void 0 ? void 0 : (ref2 = response.data) === null || ref2 === void 0 ? void 0 : (ref3 = ref2[0]) === null || ref3 === void 0 ? void 0 : ref3.offers
|
83
|
+
]);
|
84
|
+
};
|
@@ -21,13 +21,13 @@ export function GlobalSEO() {
|
|
21
21
|
dangerouslySetInnerHTML: createDangerousMarkup(organizationJSONLd)
|
22
22
|
}), Boolean(defaultIcon) && /*#__PURE__*/ React.createElement("link", {
|
23
23
|
rel: "icon",
|
24
|
-
href: defaultIcon
|
24
|
+
href: defaultIcon || ''
|
25
25
|
}), Boolean(favicon === null || favicon === void 0 ? void 0 : favicon.svg) && /*#__PURE__*/ React.createElement("link", {
|
26
26
|
rel: "icon",
|
27
|
-
href: favicon === null || favicon === void 0 ? void 0 : favicon.svg,
|
27
|
+
href: (favicon === null || favicon === void 0 ? void 0 : favicon.svg) || '',
|
28
28
|
type: "image/svg+xml"
|
29
29
|
}), Boolean(favicon === null || favicon === void 0 ? void 0 : favicon.medium) && /*#__PURE__*/ React.createElement("link", {
|
30
30
|
rel: "apple-touch-icon",
|
31
|
-
href: favicon === null || favicon === void 0 ? void 0 : favicon.medium
|
31
|
+
href: (favicon === null || favicon === void 0 ? void 0 : favicon.medium) || ''
|
32
32
|
})));
|
33
33
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { MyWalletGetByType } from '@sentecacommerce/sdk';
|
2
|
+
import { useQuery } from 'react-query';
|
3
|
+
export var useGetMyLoyaltyCardQuery = function(callback) {
|
4
|
+
return useQuery('get-loyalty-card-key', function() {
|
5
|
+
return MyWalletGetByType('loyalty-program');
|
6
|
+
}, {
|
7
|
+
onSuccess: function() {
|
8
|
+
var ref;
|
9
|
+
return callback === null || callback === void 0 ? void 0 : (ref = callback.onSuccess) === null || ref === void 0 ? void 0 : ref.call(callback);
|
10
|
+
},
|
11
|
+
onError: function(err) {
|
12
|
+
var ref;
|
13
|
+
return callback === null || callback === void 0 ? void 0 : (ref = callback.onError) === null || ref === void 0 ? void 0 : ref.call(callback, err);
|
14
|
+
}
|
15
|
+
});
|
16
|
+
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import Cookie from 'js-cookie';
|
2
|
+
import { AUTH_TOKEN_KEY, ANONYMOUS_TOKEN_KEY } from '../../../index';
|
3
|
+
var ref;
|
4
|
+
export var getUserToken = function() {
|
5
|
+
return (ref = Cookie.get(AUTH_TOKEN_KEY)) !== null && ref !== void 0 ? ref : Cookie.get(ANONYMOUS_TOKEN_KEY);
|
6
|
+
};
|
@@ -8,6 +8,7 @@ export declare const myCartCacheKeys: {
|
|
8
8
|
useGetAllShippingMethods: string;
|
9
9
|
useGetPaymentMethods: string;
|
10
10
|
useIsExisting: string;
|
11
|
+
useGetCrossSaleItems: string;
|
11
12
|
};
|
12
13
|
declare type myCartApiType = {
|
13
14
|
readonly useGetWithCookies: (queryCache: QueryCache, cookies: any) => Promise<OrderDTO>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './mutations';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './useReplaceBasketMutation';
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare const useBasketCrossSaleItems: () => {
|
2
|
+
name: string;
|
3
|
+
description: string;
|
4
|
+
slug: string;
|
5
|
+
attributeRules: import("@sentecacommerce/sdk").AttributeRuleDTO[] | undefined;
|
6
|
+
attributes: import("@sentecacommerce/sdk").ProductAttributeDTO[] | undefined;
|
7
|
+
_id: string | undefined;
|
8
|
+
variants: import("@sentecacommerce/sdk").ProductVariantDTO[] | undefined;
|
9
|
+
}[] | undefined;
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './hooks';
|
@@ -0,0 +1,39 @@
|
|
1
|
+
export declare const useBnpCalculateForCart: (props?: {
|
2
|
+
preferredInstallmentCentAmount?: number | undefined;
|
3
|
+
downPaymentCentAmount?: number | undefined;
|
4
|
+
} | undefined) => {
|
5
|
+
data: {
|
6
|
+
offers: {
|
7
|
+
totalRepaymentAmount: import("../../index").FormattedPriceType;
|
8
|
+
correctDownPaymentAmount: import("../../index").FormattedPriceType;
|
9
|
+
installmentAmount: import("../../index").FormattedPriceType;
|
10
|
+
processingFeeAmount: import("../../index").FormattedPriceType;
|
11
|
+
apr: string;
|
12
|
+
maturity: string;
|
13
|
+
nir: string;
|
14
|
+
variantId: string;
|
15
|
+
}[] | undefined;
|
16
|
+
scheme?: import("@sentecacommerce/sdk").BNPPricingSchemesDTO | undefined;
|
17
|
+
};
|
18
|
+
canFetchMore: boolean | undefined;
|
19
|
+
clear: () => void;
|
20
|
+
error: unknown;
|
21
|
+
failureCount: number;
|
22
|
+
fetchMore: (fetchMoreVariable?: unknown, options?: import("react-query/types/core/query").FetchMoreOptions | undefined) => Promise<import("@sentecacommerce/sdk").BNPLoanOfferDTO[] | undefined>;
|
23
|
+
isError: boolean;
|
24
|
+
isFetched: boolean;
|
25
|
+
isFetchedAfterMount: boolean;
|
26
|
+
isFetching: boolean;
|
27
|
+
isFetchingMore?: import("react-query").IsFetchingMoreValue | undefined;
|
28
|
+
isIdle: boolean;
|
29
|
+
isInitialData: boolean;
|
30
|
+
isLoading: boolean;
|
31
|
+
isPreviousData: boolean;
|
32
|
+
isPlaceholderData: boolean;
|
33
|
+
isStale: boolean;
|
34
|
+
isSuccess: boolean;
|
35
|
+
refetch: (options?: import("react-query/types/core/query").RefetchOptions | undefined) => Promise<import("@sentecacommerce/sdk").BNPLoanOfferDTO[] | undefined>;
|
36
|
+
remove: () => void;
|
37
|
+
status: import("react-query").QueryStatus;
|
38
|
+
updatedAt: number;
|
39
|
+
};
|
@@ -12,5 +12,7 @@ export declare type UsePaymentResultType = {
|
|
12
12
|
errors?: CheckoutFormErrorsResultType;
|
13
13
|
isValid: boolean;
|
14
14
|
updateIsSubmitting: (value: boolean) => void;
|
15
|
+
updateLoanInfo: (value: any) => void;
|
16
|
+
loanInfo: any;
|
15
17
|
paymentMethods?: PaymentMethodsResult;
|
16
18
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { OrderDTO, AddressDTO } from '@sentecacommerce/sdk';
|
2
|
+
import { OrderDTO, AddressDTO, OrderLoanInfoDTO } from '@sentecacommerce/sdk';
|
3
3
|
import { MutateFunction, QueryResult } from 'react-query';
|
4
4
|
import { UseBillingResultType, UsePaymentResultType, UseShippingResultType } from './hooks';
|
5
5
|
import { ShippingValidationsType, BillingAddressValidationType } from './utils';
|
@@ -20,6 +20,7 @@ export declare type CheckoutFormOnSubmitData = {
|
|
20
20
|
scrollToFirstError: () => void;
|
21
21
|
shippingState: UseShippingResultType;
|
22
22
|
shippingAddress?: AddressDTO;
|
23
|
+
loanInfo?: OrderLoanInfoDTO;
|
23
24
|
};
|
24
25
|
declare type Props = {
|
25
26
|
children: any;
|
@@ -3,4 +3,5 @@ export declare const useReferralOrders: (query?: {
|
|
3
3
|
offset?: number | undefined;
|
4
4
|
filter?: string | undefined;
|
5
5
|
project?: string | undefined;
|
6
|
+
sort?: string | undefined;
|
6
7
|
} | undefined) => import("react-query").InfiniteQueryResult<import("@sentecacommerce/sdk").OrderFilterResultDTO, unknown>;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import { SearchResultDTO, ImageDTO, MoneyDTO, ReviewRatingStatisticsDTO, OfferDTO } from '@sentecacommerce/sdk';
|
1
|
+
import { SearchResultDTO, ImageDTO, MoneyDTO, ReviewRatingStatisticsDTO, OfferDTO, OfferDTOStatusEnum } from '@sentecacommerce/sdk';
|
2
|
+
export { OfferDTOStatusEnum };
|
2
3
|
export interface BaseProductType {
|
3
4
|
name: string;
|
4
5
|
slug: string;
|
@@ -47,4 +48,3 @@ interface LineItemType extends BaseProductType {
|
|
47
48
|
getCustomFieldByKey: (key: string) => any;
|
48
49
|
}
|
49
50
|
export declare const useLineItem: (props: SearchResultDTO) => LineItemType;
|
50
|
-
export {};
|
@@ -11,6 +11,7 @@ export declare const createProductContent: (data: any) => {
|
|
11
11
|
name: string;
|
12
12
|
content: string;
|
13
13
|
};
|
14
|
+
export declare const createCollapseKeyImagesMap: (product?: ProductDTO | undefined) => {} | undefined;
|
14
15
|
export declare const createAttributeRulesMap: (product?: ProductDTO | undefined) => any;
|
15
16
|
export declare const createMappedOptions: (options?: OptionDefinitionDTO[] | undefined) => OptionsType[];
|
16
17
|
export declare type SelectedOptionType = {
|
package/dist/types/index.d.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import Cookie from 'js-cookie';
|
2
|
+
export { Cookie };
|
1
3
|
export * from './dto';
|
2
4
|
export * from './api/productsApi';
|
3
5
|
export * from './api/pagesApi';
|
@@ -105,6 +107,7 @@ export * from './brands';
|
|
105
107
|
export * from './navigation';
|
106
108
|
export * from './GDPR';
|
107
109
|
export * from './user';
|
110
|
+
export * from './basket';
|
108
111
|
export * from './ui';
|
109
112
|
export * from './wishlist';
|
110
113
|
export * from './build';
|
@@ -1,21 +1,23 @@
|
|
1
1
|
import { RangeAggregationResult, TermAggregationResult, RangeAggregation, TermAggregation, StatAggregation } from '@sentecacommerce/sdk';
|
2
2
|
import { NextRouter } from 'next/router';
|
3
3
|
import { PredicateType } from './usePredicate';
|
4
|
-
import { Aggregate } from '../../types';
|
4
|
+
import { Aggregate, AggregateSortEnum } from '../../types';
|
5
|
+
import { ListingPageMeta } from '../..';
|
5
6
|
export declare type AggregationResultType = RangeAggregationResult & TermAggregationResult & RangeAggregationResult;
|
6
7
|
export declare type AggregateType = TermAggregation & StatAggregation & RangeAggregation;
|
7
8
|
export declare enum AggregateRequestEnum {
|
8
9
|
Filters = "filters",
|
9
10
|
Categories = "categories"
|
10
11
|
}
|
11
|
-
export declare const useAggregateQuery: (aggregates: Aggregate[], request: AggregateRequestEnum) => import("react-query").QueryResult<import("@sentecacommerce/sdk").CatalogAggregateResponseDTO | undefined, unknown>;
|
12
|
-
export declare function prepareAggregateQuery({ request, predicate, aggregates, router, postFilter, slug, config, }: {
|
12
|
+
export declare const useAggregateQuery: (aggregates: Aggregate[], request: AggregateRequestEnum, sort?: AggregateSortEnum | undefined) => import("react-query").QueryResult<import("@sentecacommerce/sdk").CatalogAggregateResponseDTO | undefined, unknown>;
|
13
|
+
export declare function prepareAggregateQuery({ request, predicate, aggregates, router, postFilter, slug, config, attributeSortType, }: {
|
13
14
|
request: AggregateRequestEnum;
|
14
15
|
aggregates: Aggregate[];
|
15
16
|
router: NextRouter;
|
16
17
|
postFilter: string | undefined;
|
17
18
|
predicate?: PredicateType;
|
18
|
-
config?:
|
19
|
+
config?: ListingPageMeta;
|
19
20
|
slug: string;
|
21
|
+
attributeSortType?: AggregateSortEnum;
|
20
22
|
}): any;
|
21
23
|
export declare function generateAggregateKey(aggregates?: Aggregate[]): string | undefined;
|
@@ -2,6 +2,8 @@ import { CatalogFilterResultDTO } from '@sentecacommerce/sdk';
|
|
2
2
|
import { QueryResult } from 'react-query';
|
3
3
|
import { NextRouter } from 'next/router';
|
4
4
|
import { PredicateType } from '..';
|
5
|
+
import { ListingPageMeta } from '../..';
|
6
|
+
import { StringField } from '@sentecacommerce-theme/cms';
|
5
7
|
export declare const useListingQuery: () => QueryResult<CatalogFilterResultDTO, unknown>;
|
6
8
|
export declare function processListingQuery({ predicate, router, limit, sort, postFilter, offset, config, slug, }: {
|
7
9
|
predicate?: PredicateType;
|
@@ -10,7 +12,7 @@ export declare function processListingQuery({ predicate, router, limit, sort, po
|
|
10
12
|
offset: number;
|
11
13
|
sort?: string;
|
12
14
|
postFilter?: string;
|
13
|
-
config?:
|
15
|
+
config?: ListingPageMeta;
|
14
16
|
slug?: string;
|
15
17
|
}): Promise<CatalogFilterResultDTO>;
|
16
|
-
export declare function isListingQueryEnabled(type:
|
18
|
+
export declare function isListingQueryEnabled(type: StringField, predicate?: PredicateType): boolean;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { CategoryDTO, ViewDTO, BrandDTO } from '@sentecacommerce/sdk';
|
2
2
|
import { QueryResult } from 'react-query';
|
3
3
|
import { NextRouter } from 'next/router';
|
4
|
+
import { ListingPageMeta } from '../..';
|
4
5
|
export declare type PredicateType = CategoryDTO & ViewDTO & BrandDTO & {
|
5
6
|
breadcrumb?: any;
|
6
7
|
};
|
7
8
|
export declare const usePredicate: () => QueryResult<PredicateType | undefined, unknown>;
|
8
|
-
export declare function processPredicateRequest(slug: string, router: NextRouter, aliasedSlug: string, mainConfig?:
|
9
|
+
export declare function processPredicateRequest(slug: string, router: NextRouter, aliasedSlug: string, mainConfig?: ListingPageMeta): Promise<any>;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { AggregationResultType } from '../api';
|
3
3
|
import { RangeAggregation, StatAggregation, TermAggregation } from '@sentecacommerce/sdk';
|
4
|
-
export type { RangeAggregation, StatAggregation, TermAggregation, } from '@sentecacommerce/sdk';
|
5
4
|
export declare type ListingAggregationResultType = {
|
6
5
|
selected: boolean;
|
7
6
|
data: AggregationResultType;
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { SearchResultDTO } from '@sentecacommerce/sdk';
|
2
|
+
import type { NumberField, StringField } from '@sentecacommerce-theme/cms';
|
2
3
|
export declare type SearchResultItem = {
|
3
4
|
isPlaceholder?: boolean;
|
4
5
|
} & SearchResultDTO;
|
5
6
|
export declare type UseListingItemsProps = {
|
6
7
|
items?: SearchResultItem[];
|
7
|
-
total?:
|
8
|
-
didYouMean?:
|
8
|
+
total?: NumberField;
|
9
|
+
didYouMean?: StringField;
|
9
10
|
isLoading: boolean;
|
10
11
|
isFetching: boolean;
|
11
12
|
};
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import type { EnumField, StringField } from '@sentecacommerce-theme/cms';
|
2
|
+
import { ComponentTypeEnum } from '..';
|
1
3
|
export declare type SeoFilter = {
|
2
|
-
name?:
|
3
|
-
component?:
|
4
|
+
name?: StringField;
|
5
|
+
component?: EnumField<ComponentTypeEnum>;
|
4
6
|
items?: {
|
5
|
-
name:
|
6
|
-
url:
|
7
|
+
name: StringField;
|
8
|
+
url: StringField;
|
7
9
|
}[];
|
8
10
|
};
|
9
11
|
export declare type UseListingSEOCategoriesPropsResult = {
|
@@ -2,9 +2,10 @@ import { AggregationResultType } from '../api';
|
|
2
2
|
import { CatalogAggregateResponseDTO } from '@sentecacommerce/sdk';
|
3
3
|
import { Aggregate } from '../types';
|
4
4
|
import { NextRouter } from 'next/router';
|
5
|
-
|
5
|
+
import type { StringField } from '@sentecacommerce-theme/cms';
|
6
|
+
export declare function processCategoriesResponse(response?: CatalogAggregateResponseDTO, type?: StringField, term?: StringField): AggregationResultType[];
|
6
7
|
export declare function getAggregateTypeAndTerm(aggregates?: Aggregate): {
|
7
8
|
type: string;
|
8
|
-
term:
|
9
|
+
term: import("@sentecacommerce-theme/cms").EnumField<StringField>;
|
9
10
|
};
|
10
11
|
export declare function getAttributePageType(router: NextRouter, slug: string): string[];
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { NextRouter } from 'next/router';
|
2
2
|
import type { QueryCache } from 'react-query';
|
3
|
-
import { Aggregate } from '../types';
|
3
|
+
import { Aggregate, ListingPageMeta } from '../types';
|
4
4
|
import { PredicateType } from '../api';
|
5
|
-
export declare function prefetchCategories(queryCache: QueryCache, router: NextRouter, predicate: PredicateType, aggregates: Aggregate[], config
|
5
|
+
export declare function prefetchCategories(queryCache: QueryCache, router: NextRouter, predicate: PredicateType, aggregates: Aggregate[], config: ListingPageMeta): Promise<import("@sentecacommerce/sdk").CatalogAggregateResponseDTO>;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { NextRouter } from 'next/router';
|
2
2
|
import type { QueryCache } from 'react-query';
|
3
3
|
import { PredicateType } from '../api';
|
4
|
-
|
4
|
+
import { ListingPageMeta } from '..';
|
5
|
+
export declare function prefetchListing({ queryCache, router, predicate, config, defaultSortKey }: {
|
5
6
|
queryCache: QueryCache;
|
6
7
|
router: NextRouter;
|
7
8
|
predicate?: PredicateType;
|
8
9
|
filterExtension?: string;
|
9
|
-
|
10
|
-
|
11
|
-
config?: any;
|
10
|
+
defaultSortKey: string;
|
11
|
+
config: ListingPageMeta;
|
12
12
|
}): Promise<import("@sentecacommerce/sdk").CatalogFilterResultDTO>;
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import { NextRouter } from 'next/router';
|
2
2
|
import type { QueryCache } from 'react-query';
|
3
|
-
|
3
|
+
import { ListingPageMeta } from '..';
|
4
|
+
export declare function prefetchPredicate(queryCache: QueryCache, router: NextRouter, config: ListingPageMeta): Promise<any>;
|