@sentecacommerce-theme/lib 0.13.5-alpha.1 → 0.13.5-alpha.9
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/api/myCartApi/index.js +2 -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/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
- package/dist/cjs/contexts/CheckoutForm/index.js +5 -3
- package/dist/cjs/hooks/useLineItem/index.js +7 -0
- package/dist/cjs/hooks/useProduct/index.js +26 -5
- package/dist/cjs/hooks/useProduct/utils/index.js +14 -1
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/listing/api/queries/useAggregateQuery.js +40 -5
- package/dist/cjs/listing/hooks/useListingConfig.js +2 -1
- package/dist/cjs/listing/hooks/useListingFilters.js +2 -2
- package/dist/cjs/listing/types.js +8 -1
- package/dist/cjs/listing/utils/buildCategoryQuery.js +11 -6
- 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 +112 -0
- package/dist/cjs/product/index.js +15 -0
- 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/api/myCartApi/index.js +2 -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/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
- package/dist/esm/contexts/CheckoutForm/index.js +5 -3
- package/dist/esm/hooks/useLineItem/index.js +2 -0
- package/dist/esm/hooks/useProduct/index.js +27 -6
- package/dist/esm/hooks/useProduct/utils/index.js +13 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/listing/api/queries/useAggregateQuery.js +40 -5
- package/dist/esm/listing/hooks/useListingConfig.js +2 -1
- package/dist/esm/listing/hooks/useListingFilters.js +2 -2
- package/dist/esm/listing/types.js +7 -0
- package/dist/esm/listing/utils/buildCategoryQuery.js +11 -6
- 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/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/basket-hooks/useBasketItemList/index.d.ts +1 -0
- package/dist/types/hooks/order-hooks/api/queries/useOrderGetPaymentMethodQuery.d.ts +1 -16
- 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 +4 -3
- package/dist/types/listing/types.d.ts +5 -0
- 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/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/package.json +2 -2
@@ -37,6 +37,35 @@ function _asyncToGenerator(fn) {
|
|
37
37
|
});
|
38
38
|
};
|
39
39
|
}
|
40
|
+
function _defineProperty(obj, key, value) {
|
41
|
+
if (key in obj) {
|
42
|
+
Object.defineProperty(obj, key, {
|
43
|
+
value: value,
|
44
|
+
enumerable: true,
|
45
|
+
configurable: true,
|
46
|
+
writable: true
|
47
|
+
});
|
48
|
+
} else {
|
49
|
+
obj[key] = value;
|
50
|
+
}
|
51
|
+
return obj;
|
52
|
+
}
|
53
|
+
function _objectSpread(target) {
|
54
|
+
for(var i = 1; i < arguments.length; i++){
|
55
|
+
var source = arguments[i] != null ? arguments[i] : {
|
56
|
+
};
|
57
|
+
var ownKeys = Object.keys(source);
|
58
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
59
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
60
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
61
|
+
}));
|
62
|
+
}
|
63
|
+
ownKeys.forEach(function(key) {
|
64
|
+
_defineProperty(target, key, source[key]);
|
65
|
+
});
|
66
|
+
}
|
67
|
+
return target;
|
68
|
+
}
|
40
69
|
var AggregateRequestEnum1;
|
41
70
|
export { AggregateRequestEnum1 as AggregateRequestEnum, };
|
42
71
|
(function(AggregateRequestEnum) {
|
@@ -44,7 +73,7 @@ export { AggregateRequestEnum1 as AggregateRequestEnum, };
|
|
44
73
|
AggregateRequestEnum["Categories"] = 'categories';
|
45
74
|
})(AggregateRequestEnum1 || (AggregateRequestEnum1 = {
|
46
75
|
}));
|
47
|
-
export var useAggregateQuery = function(aggregates, request) {
|
76
|
+
export var useAggregateQuery = function(aggregates, request, sort) {
|
48
77
|
var router = useRouter();
|
49
78
|
var ref = usePredicate(), predicate = ref.data;
|
50
79
|
var defaultConfig = useConfigState();
|
@@ -78,12 +107,18 @@ export var useAggregateQuery = function(aggregates, request) {
|
|
78
107
|
slug: aliasedSlug,
|
79
108
|
config: defaultConfig
|
80
109
|
});
|
81
|
-
|
110
|
+
if (sort) {
|
111
|
+
query = _objectSpread({
|
112
|
+
}, query, {
|
113
|
+
attributeSortType: sort
|
114
|
+
});
|
115
|
+
}
|
116
|
+
_ctx.next = 6;
|
82
117
|
return CatalogAggregate(query);
|
83
|
-
case
|
118
|
+
case 6:
|
84
119
|
response = _ctx.sent;
|
85
120
|
return _ctx.abrupt("return", response);
|
86
|
-
case
|
121
|
+
case 8:
|
87
122
|
case "end":
|
88
123
|
return _ctx.stop();
|
89
124
|
}
|
@@ -97,7 +132,7 @@ export var useAggregateQuery = function(aggregates, request) {
|
|
97
132
|
});
|
98
133
|
};
|
99
134
|
export function prepareAggregateQuery(param) {
|
100
|
-
var request = param.request, predicate = param.predicate, aggregates = param.aggregates, router = param.router, postFilter = param.postFilter, slug = param.slug, config = param.config;
|
135
|
+
var request = param.request, predicate = param.predicate, aggregates = param.aggregates, router = param.router, postFilter = param.postFilter, slug = param.slug, config = param.config, attributeSortType = param.attributeSortType;
|
101
136
|
var pageType = getListingPageType(router, slug, config);
|
102
137
|
switch(request){
|
103
138
|
case AggregateRequestEnum1.Categories:
|
@@ -52,7 +52,8 @@ export function ListingPageProvider(param) {
|
|
52
52
|
config.productsPerPage,
|
53
53
|
config.seoAggregates,
|
54
54
|
config.sortOptions,
|
55
|
-
config.filterExtension,
|
55
|
+
config.filterExtension,
|
56
|
+
config.attributeSortType,
|
56
57
|
]);
|
57
58
|
return(/*#__PURE__*/ React.createElement(ListingPageContext.Provider, {
|
58
59
|
value: data
|
@@ -71,8 +71,8 @@ function _slicedToArray(arr, i) {
|
|
71
71
|
var ListingFiltersStateContext = /*#__PURE__*/ React.createContext(undefined);
|
72
72
|
export function ListingFiltersProvider(param) {
|
73
73
|
var children = param.children;
|
74
|
-
var ref = useListingConfig(), aggregates = ref.aggregates, pageType = ref.type;
|
75
|
-
var ref1 = useAggregateQuery(aggregates, AggregateRequestEnum.Filters), aggData = ref1.data, isLoading = ref1.isLoading, isFetching = ref1.isFetching;
|
74
|
+
var ref = useListingConfig(), aggregates = ref.aggregates, pageType = ref.type, attributeSortType = ref.attributeSortType;
|
75
|
+
var ref1 = useAggregateQuery(aggregates, AggregateRequestEnum.Filters, attributeSortType), aggData = ref1.data, isLoading = ref1.isLoading, isFetching = ref1.isFetching;
|
76
76
|
var config = useConfigState();
|
77
77
|
var router = useRouter();
|
78
78
|
var slug = useListingSlug();
|
@@ -1,3 +1,10 @@
|
|
1
|
+
var AggregateSortEnum1;
|
2
|
+
export { AggregateSortEnum1 as AggregateSortEnum, };
|
3
|
+
(function(AggregateSortEnum) {
|
4
|
+
AggregateSortEnum["Index"] = 'index';
|
5
|
+
AggregateSortEnum["Alphabetically"] = 'alphabetically';
|
6
|
+
})(AggregateSortEnum1 || (AggregateSortEnum1 = {
|
7
|
+
}));
|
1
8
|
var ListingTypesEnum1;
|
2
9
|
export { ListingTypesEnum1 as ListingTypesEnum, };
|
3
10
|
(function(ListingTypesEnum) {
|
@@ -32,8 +32,8 @@ function _objectSpread(target) {
|
|
32
32
|
var _obj;
|
33
33
|
export var buildCategoryQuery = function(param) {
|
34
34
|
var aggregates = param.aggregates, predicate = param.predicate, postFilter = param.postFilter, pageType = param.pageType, config = param.config, router = param.router, slug = param.slug;
|
35
|
-
var
|
36
|
-
var type = aggregates === null || aggregates === void 0 ? void 0 : (
|
35
|
+
var ref2, ref1;
|
36
|
+
var type = aggregates === null || aggregates === void 0 ? void 0 : (ref2 = aggregates[0]) === null || ref2 === void 0 ? void 0 : ref2.aggregationType;
|
37
37
|
var term = aggregates === null || aggregates === void 0 ? void 0 : (ref1 = aggregates[0]) === null || ref1 === void 0 ? void 0 : ref1.aggregationDefinition;
|
38
38
|
var aggValue = getAggValue({
|
39
39
|
id: predicate === null || predicate === void 0 ? void 0 : predicate._id,
|
@@ -53,10 +53,15 @@ export var buildCategoryQuery = function(param) {
|
|
53
53
|
});
|
54
54
|
break;
|
55
55
|
case ListingTypesEnum.Category:
|
56
|
-
if (router.query.cat)
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
if (router.query.cat) {
|
57
|
+
filter += extendFilter({
|
58
|
+
slug: slug,
|
59
|
+
filterExtension: listingConfig === null || listingConfig === void 0 ? void 0 : listingConfig.filterExtension
|
60
|
+
});
|
61
|
+
} else {
|
62
|
+
var ref;
|
63
|
+
filter += (ref = listingConfig === null || listingConfig === void 0 ? void 0 : listingConfig.filterExtension) !== null && ref !== void 0 ? ref : '';
|
64
|
+
}
|
60
65
|
if (postFilter) {
|
61
66
|
if (router.query.cat) filter += '&';
|
62
67
|
filter += postFilter;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { MyCartSetCartCustomField } from '@sentecacommerce/sdk';
|
2
|
+
import { useMutation } from 'react-query';
|
3
|
+
export var useUpdateOrderCustomFieldMutation = function(callback) {
|
4
|
+
return useMutation(function(values) {
|
5
|
+
return MyCartSetCartCustomField(values.customFields);
|
6
|
+
}, {
|
7
|
+
onSuccess: callback === null || callback === void 0 ? void 0 : callback.onSuccess,
|
8
|
+
onError: callback === null || callback === void 0 ? void 0 : callback.onError
|
9
|
+
});
|
10
|
+
};
|
@@ -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 React, { 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
|
+
};
|
@@ -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;
|
@@ -1,16 +1 @@
|
|
1
|
-
export declare const useOrderGetPaymentMethodQuery: (orderId: string) => import("react-query").QueryResult<
|
2
|
-
name: string;
|
3
|
-
description: string;
|
4
|
-
_id: string;
|
5
|
-
createdAt: number;
|
6
|
-
updatedAt: number;
|
7
|
-
version?: number | undefined;
|
8
|
-
key: string;
|
9
|
-
type: import("@sentecacommerce/sdk").PaymentMethodDTOTypeEnum;
|
10
|
-
moduleKey?: string | undefined;
|
11
|
-
authority: import("@sentecacommerce/sdk").PaymentMethodDTOAuthorityEnum;
|
12
|
-
merchantKey?: string | undefined;
|
13
|
-
countryCode: string;
|
14
|
-
currencyCode: string;
|
15
|
-
config: any;
|
16
|
-
}, unknown>;
|
1
|
+
export declare const useOrderGetPaymentMethodQuery: (orderId: string) => import("react-query").QueryResult<any, unknown>;
|
@@ -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,15 +1,15 @@
|
|
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
5
|
export declare type AggregationResultType = RangeAggregationResult & TermAggregationResult & RangeAggregationResult;
|
6
6
|
export declare type AggregateType = TermAggregation & StatAggregation & RangeAggregation;
|
7
7
|
export declare enum AggregateRequestEnum {
|
8
8
|
Filters = "filters",
|
9
9
|
Categories = "categories"
|
10
10
|
}
|
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, }: {
|
11
|
+
export declare const useAggregateQuery: (aggregates: Aggregate[], request: AggregateRequestEnum, sort?: AggregateSortEnum | undefined) => import("react-query").QueryResult<import("@sentecacommerce/sdk").CatalogAggregateResponseDTO | undefined, unknown>;
|
12
|
+
export declare function prepareAggregateQuery({ request, predicate, aggregates, router, postFilter, slug, config, attributeSortType, }: {
|
13
13
|
request: AggregateRequestEnum;
|
14
14
|
aggregates: Aggregate[];
|
15
15
|
router: NextRouter;
|
@@ -17,5 +17,6 @@ export declare function prepareAggregateQuery({ request, predicate, aggregates,
|
|
17
17
|
predicate?: PredicateType;
|
18
18
|
config?: any;
|
19
19
|
slug: string;
|
20
|
+
attributeSortType?: AggregateSortEnum;
|
20
21
|
}): any;
|
21
22
|
export declare function generateAggregateKey(aggregates?: Aggregate[]): string | undefined;
|
@@ -16,6 +16,10 @@ export declare type FiltersQuery = {
|
|
16
16
|
offset?: number;
|
17
17
|
sort?: string;
|
18
18
|
};
|
19
|
+
export declare enum AggregateSortEnum {
|
20
|
+
Index = "index",
|
21
|
+
Alphabetically = "alphabetically"
|
22
|
+
}
|
19
23
|
export declare enum ListingTypesEnum {
|
20
24
|
Category = "category",
|
21
25
|
Brand = "brand",
|
@@ -66,5 +70,6 @@ export interface DefaultListingPageProps {
|
|
66
70
|
categoryTreeConfig?: Aggregate;
|
67
71
|
sortOptions: ListingPageSortOption[];
|
68
72
|
productsPerPage?: NumberField;
|
73
|
+
attributeSortType?: AggregateSortEnum;
|
69
74
|
filterExtension?: TextField;
|
70
75
|
}
|