@sentecacommerce-theme/lib 0.13.18 → 0.13.21-alpha.0

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.
@@ -53,18 +53,18 @@ var getSDKConfig = function() {
53
53
  exports.getSDKConfig = getSDKConfig;
54
54
  var getOptions = function() {
55
55
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
56
+ var ref;
57
+ var basePath = process.env.NEXT_PUBLIC_PROXY_URL + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/platform');
56
58
  if (!(0, _utils).canUseDOM()) {
57
59
  // eslint-disable-next-line @typescript-eslint/no-var-requires
58
60
  var nodeFetch = require('node-fetch');
59
- var ref;
60
61
  return _objectSpread({}, options, {
61
- basePath: process.env.PLATFORM_HOST + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/api'),
62
+ basePath: basePath,
62
63
  fetchApi: nodeFetch
63
64
  }, process.env.sdkConfig || {});
64
65
  } else {
65
- var ref2;
66
66
  return _objectSpread({}, options, {
67
- basePath: (ref2 = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref2 !== void 0 ? ref2 : '/api',
67
+ basePath: basePath,
68
68
  token: _jsCookie.default.get(_utils.AUTH_TOKEN_KEY) || _jsCookie.default.get(_utils.ANONYMOUS_TOKEN_KEY) || process.env.API_KEY || process.env.apiKey,
69
69
  fetchApi: window.fetch.bind(window)
70
70
  }, process.env.sdkConfig || {});
@@ -55,56 +55,61 @@ function _objectSpread(target) {
55
55
  return target;
56
56
  }
57
57
  var useBnpCalculateForCart = function(props) {
58
- var ref8, ref1, ref2, ref3;
58
+ var ref5, ref1, ref2, ref3;
59
59
  var ref4 = props !== null && props !== void 0 ? props : {}, _preferredInstallmentCentAmount = ref4.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = ref4.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
60
60
  var response = (0, _api).useBnpCalculateForCartQuery({
61
61
  preferredInstallmentCentAmount: preferredInstallmentCentAmount,
62
62
  downPaymentCentAmount: downPaymentCentAmount
63
63
  });
64
- var configLocale = ((ref8 = (0, _index).useConfigState()) === null || ref8 === void 0 ? void 0 : (ref1 = ref8.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
64
+ var configLocale = ((ref5 = (0, _index).useConfigState()) === null || ref5 === void 0 ? void 0 : (ref1 = ref5.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
65
65
  return (0, _react).useMemo(function() {
66
- var ref, ref5, ref6, ref7;
66
+ var ref6;
67
67
  return _objectSpread({}, response, {
68
- data: _objectSpread({}, response === null || response === void 0 ? void 0 : (ref = response.data) === null || ref === void 0 ? void 0 : ref[0], {
69
- offers: response === null || response === void 0 ? void 0 : (ref5 = response.data) === null || ref5 === void 0 ? void 0 : (ref6 = ref5[0]) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.offers) === null || ref7 === void 0 ? void 0 : ref7.map(function(offer) {
70
- var _totalRepaymentAmount = (0, _index).decodePrice(offer.totalRepaymentAmount);
71
- var _correctDownPaymentAmount = (0, _index).decodePrice(offer.correctDownPaymentAmount);
72
- var _installmentAmount = (0, _index).decodePrice(offer.installmentAmount);
73
- var _processingFeeAmount = (0, _index).decodePrice(offer.processingFeeAmount);
74
- var totalRepaymentAmount = (0, _index).formatAsCurrency({
75
- price: _totalRepaymentAmount,
76
- precision: offer.totalRepaymentAmount.fractionDigits,
77
- currency: offer.totalRepaymentAmount.currencyCode,
78
- locale: configLocale || 'en'
79
- });
80
- var correctDownPaymentAmount = (0, _index).formatAsCurrency({
81
- price: _correctDownPaymentAmount,
82
- precision: offer.correctDownPaymentAmount.fractionDigits,
83
- currency: offer.correctDownPaymentAmount.currencyCode,
84
- locale: configLocale || 'en'
85
- });
86
- var installmentAmount = (0, _index).formatAsCurrency({
87
- price: _installmentAmount,
88
- precision: offer.installmentAmount.fractionDigits,
89
- currency: offer.installmentAmount.currencyCode,
90
- locale: configLocale || 'en'
91
- });
92
- var processingFeeAmount = (0, _index).formatAsCurrency({
93
- price: _processingFeeAmount,
94
- precision: offer.processingFeeAmount.fractionDigits,
95
- currency: offer.processingFeeAmount.currencyCode,
96
- locale: configLocale || 'en'
97
- });
98
- return _objectSpread({}, offer, {
99
- offerRaw: offer,
100
- totalRepaymentAmount: totalRepaymentAmount,
101
- correctDownPaymentAmount: correctDownPaymentAmount,
102
- installmentAmount: installmentAmount,
103
- processingFeeAmount: processingFeeAmount
104
- });
105
- }).sort(function(offer, offer2) {
106
- return Number(offer.maturity) - Number(offer2.maturity);
107
- })
68
+ data: (ref6 = response.data) === null || ref6 === void 0 ? void 0 : ref6.map(function(options) {
69
+ var ref;
70
+ return {
71
+ name: options.scheme.name,
72
+ scheme: options.scheme,
73
+ offers: (ref = options.offers) === null || ref === void 0 ? void 0 : ref.map(function(offer) {
74
+ var _totalRepaymentAmount = (0, _index).decodePrice(offer.totalRepaymentAmount);
75
+ var _correctDownPaymentAmount = (0, _index).decodePrice(offer.correctDownPaymentAmount);
76
+ var _installmentAmount = (0, _index).decodePrice(offer.installmentAmount);
77
+ var _processingFeeAmount = (0, _index).decodePrice(offer.processingFeeAmount);
78
+ var totalRepaymentAmount = (0, _index).formatAsCurrency({
79
+ price: _totalRepaymentAmount,
80
+ precision: offer.totalRepaymentAmount.fractionDigits,
81
+ currency: offer.totalRepaymentAmount.currencyCode,
82
+ locale: configLocale || 'en'
83
+ });
84
+ var correctDownPaymentAmount = (0, _index).formatAsCurrency({
85
+ price: _correctDownPaymentAmount,
86
+ precision: offer.correctDownPaymentAmount.fractionDigits,
87
+ currency: offer.correctDownPaymentAmount.currencyCode,
88
+ locale: configLocale || 'en'
89
+ });
90
+ var installmentAmount = (0, _index).formatAsCurrency({
91
+ price: _installmentAmount,
92
+ precision: offer.installmentAmount.fractionDigits,
93
+ currency: offer.installmentAmount.currencyCode,
94
+ locale: configLocale || 'en'
95
+ });
96
+ var processingFeeAmount = (0, _index).formatAsCurrency({
97
+ price: _processingFeeAmount,
98
+ precision: offer.processingFeeAmount.fractionDigits,
99
+ currency: offer.processingFeeAmount.currencyCode,
100
+ locale: configLocale || 'en'
101
+ });
102
+ return _objectSpread({}, offer, {
103
+ offerRaw: offer,
104
+ totalRepaymentAmount: totalRepaymentAmount,
105
+ correctDownPaymentAmount: correctDownPaymentAmount,
106
+ installmentAmount: installmentAmount,
107
+ processingFeeAmount: processingFeeAmount
108
+ });
109
+ }).sort(function(offer, offer2) {
110
+ return Number(offer.maturity) - Number(offer2.maturity);
111
+ })
112
+ };
108
113
  })
109
114
  });
110
115
  }, [
@@ -226,7 +226,7 @@ exports.createMappedAttributes = createMappedAttributes;
226
226
  var processAvailabilityPerStore = function(availabilities) {
227
227
  var ref;
228
228
  return (ref = availabilities === null || availabilities === void 0 ? void 0 : availabilities.filter(function(x) {
229
- return !x.isPhysical;
229
+ return x.availableQuantity > 0;
230
230
  })) === null || ref === void 0 ? void 0 : ref.map(function(param) {
231
231
  var acceptsBackorders = param.acceptsBackorders, stockLocationName = param.stockLocationName, restockableInDays = param.restockableInDays, availableQuantity = param.availableQuantity;
232
232
  return {
@@ -34,49 +34,56 @@ function _objectSpread(target) {
34
34
  return target;
35
35
  }
36
36
  var useBnpOffers = function(props) {
37
- var ref6, ref1, ref2, ref3;
38
- var configLocale = ((ref6 = (0, _index).useConfigState()) === null || ref6 === void 0 ? void 0 : (ref1 = ref6.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
37
+ var ref4, ref1, ref2, ref3;
38
+ var configLocale = ((ref4 = (0, _index).useConfigState()) === null || ref4 === void 0 ? void 0 : (ref1 = ref4.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
39
39
  var response = (0, _queries).useBnpOffersQuery(props);
40
40
  return (0, _react).useMemo(function() {
41
- var ref, ref4, ref5;
41
+ var ref5;
42
42
  return _objectSpread({}, response, {
43
- 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) {
44
- var _totalRepaymentAmount = (0, _index).decodePrice(offer.totalRepaymentAmount);
45
- var _correctDownPaymentAmount = (0, _index).decodePrice(offer.correctDownPaymentAmount);
46
- var _installmentAmount = (0, _index).decodePrice(offer.installmentAmount);
47
- var _processingFeeAmount = (0, _index).decodePrice(offer.processingFeeAmount);
48
- var totalRepaymentAmount = (0, _index).formatAsCurrency({
49
- price: _totalRepaymentAmount,
50
- precision: offer.totalRepaymentAmount.fractionDigits,
51
- currency: offer.totalRepaymentAmount.currencyCode,
52
- locale: configLocale || 'en'
53
- });
54
- var correctDownPaymentAmount = (0, _index).formatAsCurrency({
55
- price: _correctDownPaymentAmount,
56
- precision: offer.correctDownPaymentAmount.fractionDigits,
57
- currency: offer.correctDownPaymentAmount.currencyCode,
58
- locale: configLocale || 'en'
59
- });
60
- var installmentAmount = (0, _index).formatAsCurrency({
61
- price: _installmentAmount,
62
- precision: offer.installmentAmount.fractionDigits,
63
- currency: offer.installmentAmount.currencyCode,
64
- locale: configLocale || 'en'
65
- });
66
- var processingFeeAmount = (0, _index).formatAsCurrency({
67
- price: _processingFeeAmount,
68
- precision: offer.processingFeeAmount.fractionDigits,
69
- currency: offer.processingFeeAmount.currencyCode,
70
- locale: configLocale || 'en'
71
- });
72
- return _objectSpread({}, offer, {
73
- totalRepaymentAmount: totalRepaymentAmount,
74
- correctDownPaymentAmount: correctDownPaymentAmount,
75
- installmentAmount: installmentAmount,
76
- processingFeeAmount: processingFeeAmount
77
- });
78
- }).sort(function(offer, offer2) {
79
- return Number(offer.maturity) - Number(offer2.maturity);
43
+ data: response === null || response === void 0 ? void 0 : (ref5 = response.data) === null || ref5 === void 0 ? void 0 : ref5.map(function(result) {
44
+ var ref;
45
+ return {
46
+ name: result.scheme.name,
47
+ scheme: result.scheme,
48
+ offers: (ref = result.offers) === null || ref === void 0 ? void 0 : ref.map(function(offer) {
49
+ var _totalRepaymentAmount = (0, _index).decodePrice(offer.totalRepaymentAmount);
50
+ var _correctDownPaymentAmount = (0, _index).decodePrice(offer.correctDownPaymentAmount);
51
+ var _installmentAmount = (0, _index).decodePrice(offer.installmentAmount);
52
+ var _processingFeeAmount = (0, _index).decodePrice(offer.processingFeeAmount);
53
+ var totalRepaymentAmount = (0, _index).formatAsCurrency({
54
+ price: _totalRepaymentAmount,
55
+ precision: offer.totalRepaymentAmount.fractionDigits,
56
+ currency: offer.totalRepaymentAmount.currencyCode,
57
+ locale: configLocale || 'en'
58
+ });
59
+ var correctDownPaymentAmount = (0, _index).formatAsCurrency({
60
+ price: _correctDownPaymentAmount,
61
+ precision: offer.correctDownPaymentAmount.fractionDigits,
62
+ currency: offer.correctDownPaymentAmount.currencyCode,
63
+ locale: configLocale || 'en'
64
+ });
65
+ var installmentAmount = (0, _index).formatAsCurrency({
66
+ price: _installmentAmount,
67
+ precision: offer.installmentAmount.fractionDigits,
68
+ currency: offer.installmentAmount.currencyCode,
69
+ locale: configLocale || 'en'
70
+ });
71
+ var processingFeeAmount = (0, _index).formatAsCurrency({
72
+ price: _processingFeeAmount,
73
+ precision: offer.processingFeeAmount.fractionDigits,
74
+ currency: offer.processingFeeAmount.currencyCode,
75
+ locale: configLocale || 'en'
76
+ });
77
+ return _objectSpread({}, offer, {
78
+ totalRepaymentAmount: totalRepaymentAmount,
79
+ correctDownPaymentAmount: correctDownPaymentAmount,
80
+ installmentAmount: installmentAmount,
81
+ processingFeeAmount: processingFeeAmount
82
+ });
83
+ }).sort(function(offer, offer2) {
84
+ return Number(offer.maturity) - Number(offer2.maturity);
85
+ })
86
+ };
80
87
  })
81
88
  });
82
89
  }, [
@@ -1,6 +1,6 @@
1
1
  import { Configuration, HttpClient } from '@sentecacommerce/sdk';
2
2
  import Cookies from 'js-cookie';
3
- import { ANONYMOUS_TOKEN_KEY, AUTH_TOKEN_KEY, getLocaleFromPath, canUseDOM } from '../utils';
3
+ import { ANONYMOUS_TOKEN_KEY, AUTH_TOKEN_KEY, canUseDOM, getLocaleFromPath } from '../utils';
4
4
  function _defineProperty(obj, key, value) {
5
5
  if (key in obj) {
6
6
  Object.defineProperty(obj, key, {
@@ -43,18 +43,18 @@ export var getSDKConfig = function() {
43
43
  };
44
44
  export var getOptions = function() {
45
45
  var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
46
+ var ref;
47
+ var basePath = process.env.NEXT_PUBLIC_PROXY_URL + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/platform');
46
48
  if (!canUseDOM()) {
47
49
  // eslint-disable-next-line @typescript-eslint/no-var-requires
48
50
  var nodeFetch = require('node-fetch');
49
- var ref;
50
51
  return _objectSpread({}, options, {
51
- basePath: process.env.PLATFORM_HOST + ((ref = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref !== void 0 ? ref : '/api'),
52
+ basePath: basePath,
52
53
  fetchApi: nodeFetch
53
54
  }, process.env.sdkConfig || {});
54
55
  } else {
55
- var ref2;
56
56
  return _objectSpread({}, options, {
57
- basePath: (ref2 = options === null || options === void 0 ? void 0 : options.basePath) !== null && ref2 !== void 0 ? ref2 : '/api',
57
+ basePath: basePath,
58
58
  token: Cookies.get(AUTH_TOKEN_KEY) || Cookies.get(ANONYMOUS_TOKEN_KEY) || process.env.API_KEY || process.env.apiKey,
59
59
  fetchApi: window.fetch.bind(window)
60
60
  }, process.env.sdkConfig || {});
@@ -30,56 +30,61 @@ function _objectSpread(target) {
30
30
  return target;
31
31
  }
32
32
  export var useBnpCalculateForCart = function(props) {
33
- var ref8, ref1, ref2, ref3;
33
+ var ref5, ref1, ref2, ref3;
34
34
  var ref4 = props !== null && props !== void 0 ? props : {}, _preferredInstallmentCentAmount = ref4.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = ref4.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
35
35
  var response = useBnpCalculateForCartQuery({
36
36
  preferredInstallmentCentAmount: preferredInstallmentCentAmount,
37
37
  downPaymentCentAmount: downPaymentCentAmount
38
38
  });
39
- var configLocale = ((ref8 = useConfigState()) === null || ref8 === void 0 ? void 0 : (ref1 = ref8.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
39
+ var configLocale = ((ref5 = useConfigState()) === null || ref5 === void 0 ? void 0 : (ref1 = ref5.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
40
40
  return useMemo(function() {
41
- var ref, ref5, ref6, ref7;
41
+ var ref6;
42
42
  return _objectSpread({}, response, {
43
- data: _objectSpread({}, response === null || response === void 0 ? void 0 : (ref = response.data) === null || ref === void 0 ? void 0 : ref[0], {
44
- offers: response === null || response === void 0 ? void 0 : (ref5 = response.data) === null || ref5 === void 0 ? void 0 : (ref6 = ref5[0]) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.offers) === null || ref7 === void 0 ? void 0 : ref7.map(function(offer) {
45
- var _totalRepaymentAmount = decodePrice(offer.totalRepaymentAmount);
46
- var _correctDownPaymentAmount = decodePrice(offer.correctDownPaymentAmount);
47
- var _installmentAmount = decodePrice(offer.installmentAmount);
48
- var _processingFeeAmount = decodePrice(offer.processingFeeAmount);
49
- var totalRepaymentAmount = formatAsCurrency({
50
- price: _totalRepaymentAmount,
51
- precision: offer.totalRepaymentAmount.fractionDigits,
52
- currency: offer.totalRepaymentAmount.currencyCode,
53
- locale: configLocale || 'en'
54
- });
55
- var correctDownPaymentAmount = formatAsCurrency({
56
- price: _correctDownPaymentAmount,
57
- precision: offer.correctDownPaymentAmount.fractionDigits,
58
- currency: offer.correctDownPaymentAmount.currencyCode,
59
- locale: configLocale || 'en'
60
- });
61
- var installmentAmount = formatAsCurrency({
62
- price: _installmentAmount,
63
- precision: offer.installmentAmount.fractionDigits,
64
- currency: offer.installmentAmount.currencyCode,
65
- locale: configLocale || 'en'
66
- });
67
- var processingFeeAmount = formatAsCurrency({
68
- price: _processingFeeAmount,
69
- precision: offer.processingFeeAmount.fractionDigits,
70
- currency: offer.processingFeeAmount.currencyCode,
71
- locale: configLocale || 'en'
72
- });
73
- return _objectSpread({}, offer, {
74
- offerRaw: offer,
75
- totalRepaymentAmount: totalRepaymentAmount,
76
- correctDownPaymentAmount: correctDownPaymentAmount,
77
- installmentAmount: installmentAmount,
78
- processingFeeAmount: processingFeeAmount
79
- });
80
- }).sort(function(offer, offer2) {
81
- return Number(offer.maturity) - Number(offer2.maturity);
82
- })
43
+ data: (ref6 = response.data) === null || ref6 === void 0 ? void 0 : ref6.map(function(options) {
44
+ var ref;
45
+ return {
46
+ name: options.scheme.name,
47
+ scheme: options.scheme,
48
+ offers: (ref = options.offers) === null || ref === void 0 ? void 0 : ref.map(function(offer) {
49
+ var _totalRepaymentAmount = decodePrice(offer.totalRepaymentAmount);
50
+ var _correctDownPaymentAmount = decodePrice(offer.correctDownPaymentAmount);
51
+ var _installmentAmount = decodePrice(offer.installmentAmount);
52
+ var _processingFeeAmount = decodePrice(offer.processingFeeAmount);
53
+ var totalRepaymentAmount = formatAsCurrency({
54
+ price: _totalRepaymentAmount,
55
+ precision: offer.totalRepaymentAmount.fractionDigits,
56
+ currency: offer.totalRepaymentAmount.currencyCode,
57
+ locale: configLocale || 'en'
58
+ });
59
+ var correctDownPaymentAmount = formatAsCurrency({
60
+ price: _correctDownPaymentAmount,
61
+ precision: offer.correctDownPaymentAmount.fractionDigits,
62
+ currency: offer.correctDownPaymentAmount.currencyCode,
63
+ locale: configLocale || 'en'
64
+ });
65
+ var installmentAmount = formatAsCurrency({
66
+ price: _installmentAmount,
67
+ precision: offer.installmentAmount.fractionDigits,
68
+ currency: offer.installmentAmount.currencyCode,
69
+ locale: configLocale || 'en'
70
+ });
71
+ var processingFeeAmount = formatAsCurrency({
72
+ price: _processingFeeAmount,
73
+ precision: offer.processingFeeAmount.fractionDigits,
74
+ currency: offer.processingFeeAmount.currencyCode,
75
+ locale: configLocale || 'en'
76
+ });
77
+ return _objectSpread({}, offer, {
78
+ offerRaw: offer,
79
+ totalRepaymentAmount: totalRepaymentAmount,
80
+ correctDownPaymentAmount: correctDownPaymentAmount,
81
+ installmentAmount: installmentAmount,
82
+ processingFeeAmount: processingFeeAmount
83
+ });
84
+ }).sort(function(offer, offer2) {
85
+ return Number(offer.maturity) - Number(offer2.maturity);
86
+ })
87
+ };
83
88
  })
84
89
  });
85
90
  }, [
@@ -230,7 +230,7 @@ export var createMappedAttributes = function(currentVariant) {
230
230
  export var processAvailabilityPerStore = function(availabilities) {
231
231
  var ref;
232
232
  return (ref = availabilities === null || availabilities === void 0 ? void 0 : availabilities.filter(function(x) {
233
- return !x.isPhysical;
233
+ return x.availableQuantity > 0;
234
234
  })) === null || ref === void 0 ? void 0 : ref.map(function(param) {
235
235
  var acceptsBackorders = param.acceptsBackorders, stockLocationName = param.stockLocationName, restockableInDays = param.restockableInDays, availableQuantity = param.availableQuantity;
236
236
  return {
@@ -30,49 +30,56 @@ function _objectSpread(target) {
30
30
  return target;
31
31
  }
32
32
  export var useBnpOffers = function(props) {
33
- var ref6, ref1, ref2, ref3;
34
- var configLocale = ((ref6 = useConfigState()) === null || ref6 === void 0 ? void 0 : (ref1 = ref6.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
33
+ var ref4, ref1, ref2, ref3;
34
+ var configLocale = ((ref4 = useConfigState()) === null || ref4 === void 0 ? void 0 : (ref1 = ref4.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
35
35
  var response = useBnpOffersQuery(props);
36
36
  return useMemo(function() {
37
- var ref, ref4, ref5;
37
+ var ref5;
38
38
  return _objectSpread({}, response, {
39
- 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) {
40
- var _totalRepaymentAmount = decodePrice(offer.totalRepaymentAmount);
41
- var _correctDownPaymentAmount = decodePrice(offer.correctDownPaymentAmount);
42
- var _installmentAmount = decodePrice(offer.installmentAmount);
43
- var _processingFeeAmount = decodePrice(offer.processingFeeAmount);
44
- var totalRepaymentAmount = formatAsCurrency({
45
- price: _totalRepaymentAmount,
46
- precision: offer.totalRepaymentAmount.fractionDigits,
47
- currency: offer.totalRepaymentAmount.currencyCode,
48
- locale: configLocale || 'en'
49
- });
50
- var correctDownPaymentAmount = formatAsCurrency({
51
- price: _correctDownPaymentAmount,
52
- precision: offer.correctDownPaymentAmount.fractionDigits,
53
- currency: offer.correctDownPaymentAmount.currencyCode,
54
- locale: configLocale || 'en'
55
- });
56
- var installmentAmount = formatAsCurrency({
57
- price: _installmentAmount,
58
- precision: offer.installmentAmount.fractionDigits,
59
- currency: offer.installmentAmount.currencyCode,
60
- locale: configLocale || 'en'
61
- });
62
- var processingFeeAmount = formatAsCurrency({
63
- price: _processingFeeAmount,
64
- precision: offer.processingFeeAmount.fractionDigits,
65
- currency: offer.processingFeeAmount.currencyCode,
66
- locale: configLocale || 'en'
67
- });
68
- return _objectSpread({}, offer, {
69
- totalRepaymentAmount: totalRepaymentAmount,
70
- correctDownPaymentAmount: correctDownPaymentAmount,
71
- installmentAmount: installmentAmount,
72
- processingFeeAmount: processingFeeAmount
73
- });
74
- }).sort(function(offer, offer2) {
75
- return Number(offer.maturity) - Number(offer2.maturity);
39
+ data: response === null || response === void 0 ? void 0 : (ref5 = response.data) === null || ref5 === void 0 ? void 0 : ref5.map(function(result) {
40
+ var ref;
41
+ return {
42
+ name: result.scheme.name,
43
+ scheme: result.scheme,
44
+ offers: (ref = result.offers) === null || ref === void 0 ? void 0 : ref.map(function(offer) {
45
+ var _totalRepaymentAmount = decodePrice(offer.totalRepaymentAmount);
46
+ var _correctDownPaymentAmount = decodePrice(offer.correctDownPaymentAmount);
47
+ var _installmentAmount = decodePrice(offer.installmentAmount);
48
+ var _processingFeeAmount = decodePrice(offer.processingFeeAmount);
49
+ var totalRepaymentAmount = formatAsCurrency({
50
+ price: _totalRepaymentAmount,
51
+ precision: offer.totalRepaymentAmount.fractionDigits,
52
+ currency: offer.totalRepaymentAmount.currencyCode,
53
+ locale: configLocale || 'en'
54
+ });
55
+ var correctDownPaymentAmount = formatAsCurrency({
56
+ price: _correctDownPaymentAmount,
57
+ precision: offer.correctDownPaymentAmount.fractionDigits,
58
+ currency: offer.correctDownPaymentAmount.currencyCode,
59
+ locale: configLocale || 'en'
60
+ });
61
+ var installmentAmount = formatAsCurrency({
62
+ price: _installmentAmount,
63
+ precision: offer.installmentAmount.fractionDigits,
64
+ currency: offer.installmentAmount.currencyCode,
65
+ locale: configLocale || 'en'
66
+ });
67
+ var processingFeeAmount = formatAsCurrency({
68
+ price: _processingFeeAmount,
69
+ precision: offer.processingFeeAmount.fractionDigits,
70
+ currency: offer.processingFeeAmount.currencyCode,
71
+ locale: configLocale || 'en'
72
+ });
73
+ return _objectSpread({}, offer, {
74
+ totalRepaymentAmount: totalRepaymentAmount,
75
+ correctDownPaymentAmount: correctDownPaymentAmount,
76
+ installmentAmount: installmentAmount,
77
+ processingFeeAmount: processingFeeAmount
78
+ });
79
+ }).sort(function(offer, offer2) {
80
+ return Number(offer.maturity) - Number(offer2.maturity);
81
+ })
82
+ };
76
83
  })
77
84
  });
78
85
  }, [
@@ -3,6 +3,8 @@ export declare const useBnpCalculateForCart: (props?: {
3
3
  downPaymentCentAmount?: number | undefined;
4
4
  } | undefined) => {
5
5
  data: {
6
+ name: string;
7
+ scheme: import("@sentecacommerce/sdk").PricingSchemesDTO;
6
8
  offers: {
7
9
  offerRaw: import("@sentecacommerce/sdk").LoanVariantDTO;
8
10
  totalRepaymentAmount: import("../../index").FormattedPriceType;
@@ -13,9 +15,8 @@ export declare const useBnpCalculateForCart: (props?: {
13
15
  maturity: string;
14
16
  nir: string;
15
17
  variantId: string;
16
- }[] | undefined;
17
- scheme?: import("@sentecacommerce/sdk").PricingSchemesDTO | undefined;
18
- };
18
+ }[];
19
+ }[] | undefined;
19
20
  canFetchMore: boolean | undefined;
20
21
  clear: () => void;
21
22
  error: unknown;
@@ -4,14 +4,18 @@ export declare const useBnpOffers: (props: {
4
4
  downPaymentCentAmount?: number;
5
5
  }) => {
6
6
  data: {
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;
7
+ name: string;
8
+ scheme: import("@sentecacommerce/sdk").PricingSchemesDTO;
9
+ offers: {
10
+ totalRepaymentAmount: import("../../index").FormattedPriceType;
11
+ correctDownPaymentAmount: import("../../index").FormattedPriceType;
12
+ installmentAmount: import("../../index").FormattedPriceType;
13
+ processingFeeAmount: import("../../index").FormattedPriceType;
14
+ apr: string;
15
+ maturity: string;
16
+ nir: string;
17
+ variantId: string;
18
+ }[];
15
19
  }[] | undefined;
16
20
  canFetchMore: boolean | undefined;
17
21
  clear: () => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentecacommerce-theme/lib",
3
3
  "sideEffects": false,
4
- "version": "0.13.18",
4
+ "version": "0.13.21-alpha.0+1eaf982",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
@@ -31,13 +31,13 @@
31
31
  "watch:cjs": "swc src --out-dir dist/cjs -w",
32
32
  "watch:esm": "swc src --out-dir dist/esm --no-swcrc -w"
33
33
  },
34
- "gitHead": "d03d8560515b6806d5fa33ff85088cfd4012801a",
34
+ "gitHead": "1eaf9822c6a7e00f5e893efbe7b4d74adac6ead9",
35
35
  "peerDependencies": {
36
36
  "react-query": "^2.26.2"
37
37
  },
38
38
  "dependencies": {
39
- "@sentecacommerce-theme/base": "^0.13.18",
40
- "@sentecacommerce-theme/cms": "^0.13.18",
39
+ "@sentecacommerce-theme/base": "^0.13.21-alpha.0+1eaf982",
40
+ "@sentecacommerce-theme/cms": "^0.13.21-alpha.0+1eaf982",
41
41
  "@sentecacommerce/sdk": "2.0.175",
42
42
  "body-scroll-lock": "^3.1.5",
43
43
  "copy-to-clipboard": "^3.3.1",