@sentecacommerce-theme/lib 0.12.70 → 0.12.76

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.
Files changed (128) hide show
  1. package/dist/cjs/api/myOrdersApi/index.js +4 -2
  2. package/dist/cjs/api/myOrdersApi/index.js.map +1 -1
  3. package/dist/cjs/checkout/api/keys.js +7 -1
  4. package/dist/cjs/checkout/api/keys.js.map +1 -1
  5. package/dist/cjs/checkout/api/queries/index.js +8 -0
  6. package/dist/cjs/checkout/api/queries/index.js.map +1 -1
  7. package/dist/cjs/checkout/api/queries/useUniCreditCalculateForCartQuery.js +40 -0
  8. package/dist/cjs/checkout/api/queries/useUniCreditCalculateForCartQuery.js.map +1 -0
  9. package/dist/cjs/checkout/contexts/UniCreditResponseContext.js +29 -0
  10. package/dist/cjs/checkout/contexts/UniCreditResponseContext.js.map +1 -0
  11. package/dist/cjs/checkout/contexts/index.js +8 -0
  12. package/dist/cjs/checkout/contexts/index.js.map +1 -1
  13. package/dist/cjs/checkout/hooks/index.js +8 -0
  14. package/dist/cjs/checkout/hooks/index.js.map +1 -1
  15. package/dist/cjs/checkout/hooks/useUniCreditCalculateForCart.js +82 -0
  16. package/dist/cjs/checkout/hooks/useUniCreditCalculateForCart.js.map +1 -0
  17. package/dist/cjs/checkout/ssr/captureUniCreditOrder.js +36 -0
  18. package/dist/cjs/checkout/ssr/captureUniCreditOrder.js.map +1 -0
  19. package/dist/cjs/checkout/ssr/index.js +8 -0
  20. package/dist/cjs/checkout/ssr/index.js.map +1 -1
  21. package/dist/cjs/contexts/CheckoutForm/Components/UniCreditRedirect/index.js +71 -0
  22. package/dist/cjs/contexts/CheckoutForm/Components/UniCreditRedirect/index.js.map +1 -0
  23. package/dist/cjs/contexts/CheckoutForm/Components/index.js +8 -0
  24. package/dist/cjs/contexts/CheckoutForm/Components/index.js.map +1 -1
  25. package/dist/cjs/contexts/CheckoutForm/hooks/usePayment/index.js.map +1 -1
  26. package/dist/cjs/contexts/CheckoutForm/hooks/useShipping/index.js +4 -2
  27. package/dist/cjs/contexts/CheckoutForm/hooks/useShipping/index.js.map +1 -1
  28. package/dist/cjs/contexts/CheckoutForm/index.js +61 -16
  29. package/dist/cjs/contexts/CheckoutForm/index.js.map +1 -1
  30. package/dist/cjs/hooks/order-hooks/useOrder/index.js +1 -5
  31. package/dist/cjs/hooks/order-hooks/useOrder/index.js.map +1 -1
  32. package/dist/cjs/hooks/order-hooks/useOrderPaymentMethods/index.js.map +1 -1
  33. package/dist/cjs/hooks/order-hooks/useUpdateOrderPaymentMethod/index.js.map +1 -1
  34. package/dist/cjs/hooks/subscriptions-hooks/useAllSubscriptions/index.js +1 -1
  35. package/dist/cjs/hooks/subscriptions-hooks/useAllSubscriptions/index.js.map +1 -1
  36. package/dist/cjs/hooks/useCheckoutSubmit/index.js +37 -16
  37. package/dist/cjs/hooks/useCheckoutSubmit/index.js.map +1 -1
  38. package/dist/cjs/hooks/useContactForm/index.js +9 -4
  39. package/dist/cjs/hooks/useContactForm/index.js.map +1 -1
  40. package/dist/cjs/listing/api/queries/useLabelsQuery.js +2 -1
  41. package/dist/cjs/listing/api/queries/useLabelsQuery.js.map +1 -1
  42. package/dist/cjs/product/api/keys.js +7 -1
  43. package/dist/cjs/product/api/keys.js.map +1 -1
  44. package/dist/cjs/product/api/queries/index.js +8 -0
  45. package/dist/cjs/product/api/queries/index.js.map +1 -1
  46. package/dist/cjs/product/api/queries/useUniCreditOffersQuery.js +45 -0
  47. package/dist/cjs/product/api/queries/useUniCreditOffersQuery.js.map +1 -0
  48. package/dist/cjs/product/hooks/index.js +8 -0
  49. package/dist/cjs/product/hooks/index.js.map +1 -1
  50. package/dist/cjs/product/hooks/useUniCreditOffers.js +72 -0
  51. package/dist/cjs/product/hooks/useUniCreditOffers.js.map +1 -0
  52. package/dist/esm/api/myOrdersApi/index.js +2 -1
  53. package/dist/esm/api/myOrdersApi/index.js.map +1 -1
  54. package/dist/esm/checkout/api/keys.js +3 -0
  55. package/dist/esm/checkout/api/keys.js.map +1 -1
  56. package/dist/esm/checkout/api/queries/index.js +1 -0
  57. package/dist/esm/checkout/api/queries/index.js.map +1 -1
  58. package/dist/esm/checkout/api/queries/useUniCreditCalculateForCartQuery.js +10 -0
  59. package/dist/esm/checkout/api/queries/useUniCreditCalculateForCartQuery.js.map +1 -0
  60. package/dist/esm/checkout/contexts/UniCreditResponseContext.js +17 -0
  61. package/dist/esm/checkout/contexts/UniCreditResponseContext.js.map +1 -0
  62. package/dist/esm/checkout/contexts/index.js +1 -0
  63. package/dist/esm/checkout/contexts/index.js.map +1 -1
  64. package/dist/esm/checkout/hooks/index.js +1 -0
  65. package/dist/esm/checkout/hooks/index.js.map +1 -1
  66. package/dist/esm/checkout/hooks/useUniCreditCalculateForCart.js +66 -0
  67. package/dist/esm/checkout/hooks/useUniCreditCalculateForCart.js.map +1 -0
  68. package/dist/esm/checkout/ssr/captureUniCreditOrder.js +12 -0
  69. package/dist/esm/checkout/ssr/captureUniCreditOrder.js.map +1 -0
  70. package/dist/esm/checkout/ssr/index.js +1 -0
  71. package/dist/esm/checkout/ssr/index.js.map +1 -1
  72. package/dist/esm/contexts/CheckoutForm/Components/UniCreditRedirect/index.js +63 -0
  73. package/dist/esm/contexts/CheckoutForm/Components/UniCreditRedirect/index.js.map +1 -0
  74. package/dist/esm/contexts/CheckoutForm/Components/index.js +1 -0
  75. package/dist/esm/contexts/CheckoutForm/Components/index.js.map +1 -1
  76. package/dist/esm/contexts/CheckoutForm/hooks/usePayment/index.js.map +1 -1
  77. package/dist/esm/contexts/CheckoutForm/hooks/useShipping/index.js +6 -2
  78. package/dist/esm/contexts/CheckoutForm/hooks/useShipping/index.js.map +1 -1
  79. package/dist/esm/contexts/CheckoutForm/index.js +28 -2
  80. package/dist/esm/contexts/CheckoutForm/index.js.map +1 -1
  81. package/dist/esm/hooks/order-hooks/useOrder/index.js +1 -5
  82. package/dist/esm/hooks/order-hooks/useOrder/index.js.map +1 -1
  83. package/dist/esm/hooks/order-hooks/useOrderPaymentMethods/index.js.map +1 -1
  84. package/dist/esm/hooks/order-hooks/useUpdateOrderPaymentMethod/index.js.map +1 -1
  85. package/dist/esm/hooks/subscriptions-hooks/useAllSubscriptions/index.js +1 -1
  86. package/dist/esm/hooks/subscriptions-hooks/useAllSubscriptions/index.js.map +1 -1
  87. package/dist/esm/hooks/useCheckoutSubmit/index.js +10 -3
  88. package/dist/esm/hooks/useCheckoutSubmit/index.js.map +1 -1
  89. package/dist/esm/hooks/useContactForm/index.js +9 -4
  90. package/dist/esm/hooks/useContactForm/index.js.map +1 -1
  91. package/dist/esm/listing/api/queries/useLabelsQuery.js +2 -1
  92. package/dist/esm/listing/api/queries/useLabelsQuery.js.map +1 -1
  93. package/dist/esm/product/api/keys.js +3 -0
  94. package/dist/esm/product/api/keys.js.map +1 -1
  95. package/dist/esm/product/api/queries/index.js +1 -0
  96. package/dist/esm/product/api/queries/index.js.map +1 -1
  97. package/dist/esm/product/api/queries/useUniCreditOffersQuery.js +16 -0
  98. package/dist/esm/product/api/queries/useUniCreditOffersQuery.js.map +1 -0
  99. package/dist/esm/product/hooks/index.js +1 -0
  100. package/dist/esm/product/hooks/index.js.map +1 -1
  101. package/dist/esm/product/hooks/useUniCreditOffers.js +57 -0
  102. package/dist/esm/product/hooks/useUniCreditOffers.js.map +1 -0
  103. package/dist/types/checkout/api/keys.d.ts +1 -0
  104. package/dist/types/checkout/api/queries/index.d.ts +1 -0
  105. package/dist/types/checkout/api/queries/useBnpCalculateForCartQuery.d.ts +1 -1
  106. package/dist/types/checkout/api/queries/useUniCreditCalculateForCartQuery.d.ts +3 -0
  107. package/dist/types/checkout/contexts/UniCreditResponseContext.d.ts +6 -0
  108. package/dist/types/checkout/contexts/index.d.ts +1 -0
  109. package/dist/types/checkout/hooks/index.d.ts +1 -0
  110. package/dist/types/checkout/hooks/useBnpCalculateForCart.d.ts +3 -3
  111. package/dist/types/checkout/hooks/useUniCreditCalculateForCart.d.ts +53 -0
  112. package/dist/types/checkout/ssr/captureUniCreditOrder.d.ts +2 -0
  113. package/dist/types/checkout/ssr/index.d.ts +1 -0
  114. package/dist/types/contexts/CheckoutForm/Components/UniCreditRedirect/index.d.ts +5 -0
  115. package/dist/types/contexts/CheckoutForm/Components/index.d.ts +1 -0
  116. package/dist/types/contexts/CheckoutForm/hooks/usePayment/index.d.ts +2 -2
  117. package/dist/types/contexts/CheckoutForm/index.d.ts +1 -0
  118. package/dist/types/hooks/order-hooks/useOrderPaymentMethods/index.d.ts +4 -4
  119. package/dist/types/hooks/useCheckoutSubmit/index.d.ts +3 -2
  120. package/dist/types/hooks/useContactForm/index.d.ts +2 -1
  121. package/dist/types/product/api/keys.d.ts +1 -0
  122. package/dist/types/product/api/queries/index.d.ts +1 -0
  123. package/dist/types/product/api/queries/useBnpOffersQuery.d.ts +1 -1
  124. package/dist/types/product/api/queries/useUniCreditOffersQuery.d.ts +4 -0
  125. package/dist/types/product/hooks/index.d.ts +1 -0
  126. package/dist/types/product/hooks/useBnpOffers.d.ts +2 -2
  127. package/dist/types/product/hooks/useUniCreditOffers.d.ts +36 -0
  128. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/listing/api/queries/useLabelsQuery.ts"],"names":["useLabelsQuery","labels","keys","ListingQueryKeysEnum","filter","map","el","join","limit","cacheTime"],"mappings":";;;;;;;;;;;AACA;;AACA;;AACA;;AAIO,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,OAA4C;AAAA,yBAAzCC,MAAyC;AAAA,MAAzCA,MAAyC,4BAAhC,EAAgC;AACxE,MAAMC,IAAI,IAAIC,2BAAqBH,cAAzB,SAA4CC,MAA5C,CAAV;AACA,SAAO,0BACLC,IADK,6FAEL;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,6CACE,uBAAa;AACXE,cAAAA,MAAM,mCAAYH,MAAZ,oBAAYA,MAAM,CAAEI,GAAR,CAAY,UAACC,EAAD;AAAA,8BAAYA,EAAZ;AAAA,eAAZ,EAA+BC,IAA/B,CAAoC,GAApC,CAAZ,+BAAwD,EAAxD,CADK;AAEXC,cAAAA,KAAK,EAAE;AAFI,aAAb,CADF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAFK,IAOL;AAAEC,IAAAA,SAAS,EAAE;AAAb,GAPK,CAAP;AASD,CAXM","sourcesContent":["import React from 'react'\nimport { LabelsFilter, LabelDTO } from '@sentecacommerce/sdk'\nimport { useQuery } from 'react-query'\nimport { ListingQueryKeysEnum } from '../keys'\n\nexport interface RawLabelType extends LabelDTO {}\n\nexport const useLabelsQuery = ({ labels = [] }: { labels?: string[] }) => {\n const keys = [ListingQueryKeysEnum.useLabelsQuery, ...labels]\n return useQuery(\n keys,\n async () =>\n LabelsFilter({\n filter: `key;in;${labels?.map((el) => `\"${el}\"`).join(',') ?? ''}`,\n limit: 20,\n }),\n { cacheTime: 0 }\n )\n}\n"],"file":"useLabelsQuery.js"}
1
+ {"version":3,"sources":["../../../../../src/listing/api/queries/useLabelsQuery.ts"],"names":["useLabelsQuery","labels","keys","ListingQueryKeysEnum","filter","map","el","join","limit","cacheTime","refetchOnWindowFocus"],"mappings":";;;;;;;;;;;AACA;;AACA;;AACA;;AAIO,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,OAA4C;AAAA,yBAAzCC,MAAyC;AAAA,MAAzCA,MAAyC,4BAAhC,EAAgC;AACxE,MAAMC,IAAI,IAAIC,2BAAqBH,cAAzB,SAA4CC,MAA5C,CAAV;AACA,SAAO,0BACLC,IADK,6FAEL;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,6CACE,uBAAa;AACXE,cAAAA,MAAM,mCAAYH,MAAZ,oBAAYA,MAAM,CAAEI,GAAR,CAAY,UAACC,EAAD;AAAA,8BAAYA,EAAZ;AAAA,eAAZ,EAA+BC,IAA/B,CAAoC,GAApC,CAAZ,+BAAwD,EAAxD,CADK;AAEXC,cAAAA,KAAK,EAAE;AAFI,aAAb,CADF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAFK,IAOL;AAAEC,IAAAA,SAAS,EAAE,CAAb;AAAgBC,IAAAA,oBAAoB,EAAE;AAAtC,GAPK,CAAP;AASD,CAXM","sourcesContent":["import React from 'react'\nimport { LabelsFilter, LabelDTO } from '@sentecacommerce/sdk'\nimport { useQuery } from 'react-query'\nimport { ListingQueryKeysEnum } from '../keys'\n\nexport interface RawLabelType extends LabelDTO {}\n\nexport const useLabelsQuery = ({ labels = [] }: { labels?: string[] }) => {\n const keys = [ListingQueryKeysEnum.useLabelsQuery, ...labels]\n return useQuery(\n keys,\n async () =>\n LabelsFilter({\n filter: `key;in;${labels?.map((el) => `\"${el}\"`).join(',') ?? ''}`,\n limit: 20,\n }),\n { cacheTime: 0, refetchOnWindowFocus: false }\n )\n}\n"],"file":"useLabelsQuery.js"}
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.getBnpProductOffersKey = void 0;
4
+ exports.getUniCreditProductOffersKey = exports.getBnpProductOffersKey = void 0;
5
5
 
6
6
  var getBnpProductOffersKey = function getBnpProductOffersKey(sku) {
7
7
  return ['product-bnp-offers', sku];
8
8
  };
9
9
 
10
10
  exports.getBnpProductOffersKey = getBnpProductOffersKey;
11
+
12
+ var getUniCreditProductOffersKey = function getUniCreditProductOffersKey(sku) {
13
+ return ['product-unicredit-offers', sku];
14
+ };
15
+
16
+ exports.getUniCreditProductOffersKey = getUniCreditProductOffersKey;
11
17
  //# sourceMappingURL=keys.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/product/api/keys.ts"],"names":["getBnpProductOffersKey","sku"],"mappings":";;;;;AAAO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,GAAD,EAAiB;AACrD,SAAO,CAAC,oBAAD,EAAuBA,GAAvB,CAAP;AACD,CAFM","sourcesContent":["export const getBnpProductOffersKey = (sku: string) => {\n return ['product-bnp-offers', sku]\n}\n"],"file":"keys.js"}
1
+ {"version":3,"sources":["../../../../src/product/api/keys.ts"],"names":["getBnpProductOffersKey","sku","getUniCreditProductOffersKey"],"mappings":";;;;;AAAO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,GAAD,EAAiB;AACrD,SAAO,CAAC,oBAAD,EAAuBA,GAAvB,CAAP;AACD,CAFM;;;;AAIA,IAAMC,4BAA4B,GAAG,SAA/BA,4BAA+B,CAACD,GAAD,EAAiB;AAC3D,SAAO,CAAC,0BAAD,EAA6BA,GAA7B,CAAP;AACD,CAFM","sourcesContent":["export const getBnpProductOffersKey = (sku: string) => {\n return ['product-bnp-offers', sku]\n}\n\nexport const getUniCreditProductOffersKey = (sku: string) => {\n return ['product-unicredit-offers', sku]\n}\n"],"file":"keys.js"}
@@ -9,4 +9,12 @@ Object.keys(_useBnpOffersQuery).forEach(function (key) {
9
9
  if (key in exports && exports[key] === _useBnpOffersQuery[key]) return;
10
10
  exports[key] = _useBnpOffersQuery[key];
11
11
  });
12
+
13
+ var _useUniCreditOffersQuery = require("./useUniCreditOffersQuery");
14
+
15
+ Object.keys(_useUniCreditOffersQuery).forEach(function (key) {
16
+ if (key === "default" || key === "__esModule") return;
17
+ if (key in exports && exports[key] === _useUniCreditOffersQuery[key]) return;
18
+ exports[key] = _useUniCreditOffersQuery[key];
19
+ });
12
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/product/api/queries/index.ts"],"names":[],"mappings":";;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './useBnpOffersQuery'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../../src/product/api/queries/index.ts"],"names":[],"mappings":";;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './useBnpOffersQuery'\nexport * from './useUniCreditOffersQuery'\n"],"file":"index.js"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.useUniCreditOffersQuery = void 0;
7
+
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+
12
+ var _reactQuery = require("react-query");
13
+
14
+ var _sdk = require("@sentecacommerce/sdk");
15
+
16
+ var _keys = require("../keys");
17
+
18
+ var useUniCreditOffersQuery = function useUniCreditOffersQuery(_ref) {
19
+ var sku = _ref.sku,
20
+ _ref$downPaymentCentA = _ref.downPaymentCentAmount,
21
+ downPaymentCentAmount = _ref$downPaymentCentA === void 0 ? 0 : _ref$downPaymentCentA;
22
+ return (0, _reactQuery.useQuery)((0, _keys.getUniCreditProductOffersKey)(sku), /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
23
+ return _regenerator["default"].wrap(function _callee$(_context) {
24
+ while (1) {
25
+ switch (_context.prev = _context.next) {
26
+ case 0:
27
+ _context.next = 2;
28
+ return (0, _sdk.MyPaymentsUnicreditCalculateForSKU)(sku, {
29
+ downPaymentCentAmount: downPaymentCentAmount
30
+ });
31
+
32
+ case 2:
33
+ return _context.abrupt("return", _context.sent);
34
+
35
+ case 3:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }
40
+ }, _callee);
41
+ })));
42
+ };
43
+
44
+ exports.useUniCreditOffersQuery = useUniCreditOffersQuery;
45
+ //# sourceMappingURL=useUniCreditOffersQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/product/api/queries/useUniCreditOffersQuery.ts"],"names":["useUniCreditOffersQuery","sku","downPaymentCentAmount"],"mappings":";;;;;;;;;;;AACA;;AACA;;AACA;;AAEO,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,OAMjC;AAAA,MALJC,GAKI,QALJA,GAKI;AAAA,mCAJJC,qBAII;AAAA,MAJJA,qBAII,sCAJoB,CAIpB;AACJ,SAAO,0BACL,wCAA6BD,GAA7B,CADK,6FAEL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBACQ,6CAAmCA,GAAnC,EAAwC;AAC5CC,cAAAA,qBAAqB,EAArBA;AAD4C,aAAxC,CADR;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAFK,GAAP;AAOD,CAdM","sourcesContent":["import React from 'react'\nimport { useQuery } from 'react-query'\nimport { MyPaymentsUnicreditCalculateForSKU } from '@sentecacommerce/sdk'\nimport { getUniCreditProductOffersKey } from '../keys'\n\nexport const useUniCreditOffersQuery = ({\n sku,\n downPaymentCentAmount = 0,\n}: {\n sku: string\n downPaymentCentAmount?: number\n}) => {\n return useQuery(\n getUniCreditProductOffersKey(sku),\n async () =>\n await MyPaymentsUnicreditCalculateForSKU(sku, {\n downPaymentCentAmount,\n })\n )\n}\n"],"file":"useUniCreditOffersQuery.js"}
@@ -9,4 +9,12 @@ Object.keys(_useBnpOffers).forEach(function (key) {
9
9
  if (key in exports && exports[key] === _useBnpOffers[key]) return;
10
10
  exports[key] = _useBnpOffers[key];
11
11
  });
12
+
13
+ var _useUniCreditOffers = require("./useUniCreditOffers");
14
+
15
+ Object.keys(_useUniCreditOffers).forEach(function (key) {
16
+ if (key === "default" || key === "__esModule") return;
17
+ if (key in exports && exports[key] === _useUniCreditOffers[key]) return;
18
+ exports[key] = _useUniCreditOffers[key];
19
+ });
12
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/product/hooks/index.ts"],"names":[],"mappings":";;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './useBnpOffers'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/product/hooks/index.ts"],"names":[],"mappings":";;;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export * from './useBnpOffers'\nexport * from './useUniCreditOffers'\n"],"file":"index.js"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.useUniCreditOffers = void 0;
7
+
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+
10
+ var _react = require("react");
11
+
12
+ var _queries = require("../api/queries");
13
+
14
+ var _index = require("../../index");
15
+
16
+ var useUniCreditOffers = function useUniCreditOffers(props) {
17
+ var _useConfigState, _useConfigState$price, _response$data2, _response$data2$;
18
+
19
+ var configLocale = (_useConfigState = (0, _index.useConfigState)()) == null ? void 0 : (_useConfigState$price = _useConfigState.price) == null ? void 0 : _useConfigState$price.locale;
20
+ var response = (0, _queries.useUniCreditOffersQuery)(props);
21
+ return (0, _react.useMemo)(function () {
22
+ var _response$data, _response$data$, _response$data$$offer;
23
+
24
+ return (0, _extends2["default"])({}, response, {
25
+ data: response == null ? void 0 : (_response$data = response.data) == null ? void 0 : (_response$data$ = _response$data[0]) == null ? void 0 : (_response$data$$offer = _response$data$.offers) == null ? void 0 : _response$data$$offer.map(function (offer) {
26
+ var _totalRepaymentAmount = (0, _index.decodePrice)(offer.totalRepaymentAmount);
27
+
28
+ var _correctDownPaymentAmount = (0, _index.decodePrice)(offer.correctDownPaymentAmount);
29
+
30
+ var _installmentAmount = (0, _index.decodePrice)(offer.installmentAmount);
31
+
32
+ var _processingFeeAmount = (0, _index.decodePrice)(offer.processingFeeAmount);
33
+
34
+ var totalRepaymentAmount = (0, _index.formatAsCurrency)({
35
+ price: _totalRepaymentAmount,
36
+ precision: offer.totalRepaymentAmount.fractionDigits,
37
+ currency: offer.totalRepaymentAmount.currencyCode,
38
+ locale: configLocale || 'en'
39
+ });
40
+ var correctDownPaymentAmount = (0, _index.formatAsCurrency)({
41
+ price: _correctDownPaymentAmount,
42
+ precision: offer.correctDownPaymentAmount.fractionDigits,
43
+ currency: offer.correctDownPaymentAmount.currencyCode,
44
+ locale: configLocale || 'en'
45
+ });
46
+ var installmentAmount = (0, _index.formatAsCurrency)({
47
+ price: _installmentAmount,
48
+ precision: offer.installmentAmount.fractionDigits,
49
+ currency: offer.installmentAmount.currencyCode,
50
+ locale: configLocale || 'en'
51
+ });
52
+ var processingFeeAmount = (0, _index.formatAsCurrency)({
53
+ price: _processingFeeAmount,
54
+ precision: offer.processingFeeAmount.fractionDigits,
55
+ currency: offer.processingFeeAmount.currencyCode,
56
+ locale: configLocale || 'en'
57
+ });
58
+ return (0, _extends2["default"])({}, offer, {
59
+ totalRepaymentAmount: totalRepaymentAmount,
60
+ correctDownPaymentAmount: correctDownPaymentAmount,
61
+ installmentAmount: installmentAmount,
62
+ processingFeeAmount: processingFeeAmount
63
+ });
64
+ }).sort(function (offer, offer2) {
65
+ return Number(offer.maturity) - Number(offer2.maturity);
66
+ })
67
+ });
68
+ }, [response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : (_response$data2$ = _response$data2[0]) == null ? void 0 : _response$data2$.offers]);
69
+ };
70
+
71
+ exports.useUniCreditOffers = useUniCreditOffers;
72
+ //# sourceMappingURL=useUniCreditOffers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/product/hooks/useUniCreditOffers.ts"],"names":["useUniCreditOffers","props","configLocale","price","locale","response","data","offers","map","offer","_totalRepaymentAmount","totalRepaymentAmount","_correctDownPaymentAmount","correctDownPaymentAmount","_installmentAmount","installmentAmount","_processingFeeAmount","processingFeeAmount","precision","fractionDigits","currency","currencyCode","sort","offer2","Number","maturity"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEO,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,KAAD,EAG5B;AAAA;;AACJ,MAAMC,YAAoB,sBAAG,4BAAH,8CAAG,gBAAkBC,KAArB,qBAAG,sBAAyBC,MA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;AAIzCjB,UAAAA,MAAM,EAAEF,YAAY,IAAI;AAJiB,SAAjB,CAA1B;AAOA,YAAMe,mBAAmB,GAAG,6BAAiB;AAC3Cd,UAAAA,KAAK,EAAEa,oBADoC;AAE3CE,UAAAA,SAAS,EAAET,KAAK,CAACQ,mBAAN,CAA0BE,cAFM;AAG3CC,UAAAA,QAAQ,EAAEX,KAAK,CAACQ,mBAAN,CAA0BI,YAHO;AAI3CjB,UAAAA,MAAM,EAAEF,YAAY,IAAI;AAJmB,SAAjB,CAA5B;AAOA,6CACKO,KADL;AAEEE,UAAAA,oBAAoB,EAApBA,oBAFF;AAGEE,UAAAA,wBAAwB,EAAxBA,wBAHF;AAIEE,UAAAA,iBAAiB,EAAjBA,iBAJF;AAKEE,UAAAA,mBAAmB,EAAnBA;AALF;AAOD,OA5CG,EA6CHK,IA7CG,CA8CF,UAACb,KAAD,EAAQc,MAAR;AAAA,eAAmBC,MAAM,CAACf,KAAK,CAACgB,QAAP,CAAN,GAAyBD,MAAM,CAACD,MAAM,CAACE,QAAR,CAAlD;AAAA,OA9CE;AAFR;AAAA,GADK,EAoDL,CAACpB,QAAD,uCAACA,QAAQ,CAAEC,IAAX,yCAAC,gBAAiB,CAAjB,CAAD,qBAAC,iBAAqBC,MAAtB,CApDK,CAAP;AAsDD,CA7DM","sourcesContent":["import React, { useMemo } from 'react'\nimport { useUniCreditOffersQuery } from '../api/queries'\nimport { decodePrice, formatAsCurrency, useConfigState } from '../../index'\n\nexport const useUniCreditOffers = (props: {\n sku: string\n downPaymentCentAmount?: number\n}) => {\n const configLocale: string = useConfigState()?.price?.locale\n const response = useUniCreditOffersQuery(props)\n\n return useMemo(\n () => ({\n ...response,\n data: response?.data?.[0]?.offers\n ?.map((offer) => {\n const _totalRepaymentAmount = decodePrice(offer.totalRepaymentAmount)\n const _correctDownPaymentAmount = decodePrice(\n offer.correctDownPaymentAmount\n )\n const _installmentAmount = decodePrice(offer.installmentAmount)\n const _processingFeeAmount = decodePrice(offer.processingFeeAmount)\n\n const totalRepaymentAmount = formatAsCurrency({\n price: _totalRepaymentAmount,\n precision: offer.totalRepaymentAmount.fractionDigits,\n currency: offer.totalRepaymentAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n const correctDownPaymentAmount = formatAsCurrency({\n price: _correctDownPaymentAmount,\n precision: offer.correctDownPaymentAmount.fractionDigits,\n currency: offer.correctDownPaymentAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n const installmentAmount = formatAsCurrency({\n price: _installmentAmount,\n precision: offer.installmentAmount.fractionDigits,\n currency: offer.installmentAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n const processingFeeAmount = formatAsCurrency({\n price: _processingFeeAmount,\n precision: offer.processingFeeAmount.fractionDigits,\n currency: offer.processingFeeAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n return {\n ...offer,\n totalRepaymentAmount,\n correctDownPaymentAmount,\n installmentAmount,\n processingFeeAmount,\n }\n })\n .sort(\n (offer, offer2) => Number(offer.maturity) - Number(offer2.maturity)\n ),\n }),\n [response?.data?.[0]?.offers]\n )\n}\n"],"file":"useUniCreditOffers.js"}
@@ -1,4 +1,5 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import { MyOrdersAPI } from '@sentecacommerce/sdk';
3
4
  import { getSDKConfig } from '../getSDKConfig';
4
5
  import { useMutation, useQueryCache, useQuery, useInfiniteQuery } from 'react-query';
@@ -20,7 +21,7 @@ export var MyOrdersApiFactory = function () {
20
21
 
21
22
  var queryCache = useQueryCache();
22
23
  var [syncBasket] = myCartApi.useSync();
23
- return useMutation(() => myOrdersApi.create({}, meta), {
24
+ return useMutation(orderObj => myOrdersApi.create({}, _extends({}, meta, orderObj)), {
24
25
  onSuccess: function (_onSuccess) {
25
26
  function onSuccess(_x) {
26
27
  return _onSuccess.apply(this, arguments);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/api/myOrdersApi/index.ts"],"names":["MyOrdersAPI","getSDKConfig","useMutation","useQueryCache","useQuery","useInfiniteQuery","myCartApi","myCartCacheKeys","MyOrdersApiFactory","instance","initialise","myOrdersApi","cacheKeys","useGet","useOrders","Object","freeze","useCreate","meta","onSuccess","onError","queryCache","syncBasket","useSync","create","data","setQueryData","invalidateQueries","useGetCompact","error","useGetById","id","getById","retry","refetchOnWindowFocus","enabled","Boolean","query","filter","getInstance"],"mappings":";AAAA,SACEA,WADF,QAKO,sBALP;AAMA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SACEC,WADF,EAGEC,aAHF,EAIEC,QAJF,EAOEC,gBAPF,QAQO,aARP;AAUA,SAASC,SAAT,EAAoBC,eAApB,QAA2C,cAA3C;AAeA,OAAO,IAAMC,kBAAkB,GAAI,YAAY;AAC7C,MAAIC,QAAJ;;AAEA,WAASC,UAAT,GAAiD;AAC/C,QAAMC,WAAW,GAAG,IAAIX,WAAJ,CAAgBC,YAAY,EAA5B,CAApB;AAEA,QAAMW,SAAS,GAAG;AAChBC,MAAAA,MAAM,EAAE,uBADQ;AAEhBC,MAAAA,SAAS,EAAE;AAFK,KAAlB;AAKA,WAAOC,MAAM,CAACC,MAAP,CAAc;AACnBC,MAAAA,SAAS,EAAE,mBAACC,IAAD,EAAYC,SAAZ,EAAuBC,OAAvB,EAAmC;AAAA,YAAlCF,IAAkC;AAAlCA,UAAAA,IAAkC,GAA3B,EAA2B;AAAA;;AAC5C,YAAMG,UAAU,GAAGlB,aAAa,EAAhC;AACA,YAAM,CAACmB,UAAD,IAAehB,SAAS,CAACiB,OAAV,EAArB;AAEA,eAAOrB,WAAW,CAAC,MAAMS,WAAW,CAACa,MAAZ,CAAmB,EAAnB,EAAuBN,IAAvB,CAAP,EAAqC;AACrDC,UAAAA,SAAS;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA,YAAGM,IAAD,IAAU;AACnBJ,YAAAA,UAAU,CAACK,YAAX,CAAwBnB,eAAe,CAAC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QAAP;AACD;AAPI,GAAP;AASD,CAjEiC,EAA3B;AAmEP,OAAO,IAAME,WAAW,GAAGH,kBAAkB,CAAC+B,WAAnB,EAApB","sourcesContent":["import {\n MyOrdersAPI,\n OrderDTO,\n OrderFilterResultDTO,\n SendOrderDTO,\n} from '@sentecacommerce/sdk'\nimport { getSDKConfig } from '../getSDKConfig'\nimport {\n useMutation,\n MutationResultPair,\n useQueryCache,\n useQuery,\n QueryResult,\n InfiniteQueryResult,\n useInfiniteQuery,\n} from 'react-query'\n\nimport { myCartApi, myCartCacheKeys } from '../myCartApi'\n\ntype myOrdersApiType = {\n readonly useCreate: (\n meta: SendOrderDTO,\n onSuccess?: (result: OrderDTO) => void,\n onError?: (error: any) => void\n ) => MutationResultPair<OrderDTO, unknown, any, unknown>\n readonly useGetById: (id?: string) => QueryResult<OrderDTO, unknown>\n readonly useOrders: (query?: {\n limit?: number\n offset?: number\n }) => InfiniteQueryResult<OrderFilterResultDTO, unknown>\n}\n\nexport const MyOrdersApiFactory = (function () {\n let instance: myOrdersApiType\n\n function initialise(): Readonly<myOrdersApiType> {\n const myOrdersApi = new MyOrdersAPI(getSDKConfig())\n\n const cacheKeys = {\n useGet: 'my-orders-api-use-get',\n useOrders: 'my-orders-use-orders',\n }\n\n return Object.freeze({\n useCreate: (meta = {}, onSuccess, onError) => {\n const queryCache = useQueryCache()\n const [syncBasket] = myCartApi.useSync()\n\n return useMutation(() => myOrdersApi.create({}, meta), {\n onSuccess: (data) => {\n queryCache.setQueryData(myCartCacheKeys.useGet, data)\n queryCache.invalidateQueries(myCartCacheKeys.useGetCompact)\n syncBasket()\n if (typeof onSuccess === 'function') {\n onSuccess(data)\n }\n },\n onError: (error) => {\n if (typeof onError === 'function') {\n onError(error)\n }\n },\n })\n },\n useGetById: (id) => {\n return useQuery(\n [cacheKeys.useGet, id],\n async () => myOrdersApi.getById(id as string),\n {\n retry: false,\n refetchOnWindowFocus: false,\n enabled: Boolean(id),\n }\n )\n },\n useOrders: (query?: { limit?: number; offset?: number }) => {\n return useInfiniteQuery(\n [cacheKeys.useOrders],\n async () => myOrdersApi.filter(query),\n {\n retry: false,\n refetchOnWindowFocus: false,\n }\n )\n },\n })\n }\n\n return {\n getInstance: function () {\n if (!instance) {\n instance = initialise()\n }\n\n return instance\n },\n }\n})()\n\nexport const myOrdersApi = MyOrdersApiFactory.getInstance()\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/api/myOrdersApi/index.ts"],"names":["MyOrdersAPI","getSDKConfig","useMutation","useQueryCache","useQuery","useInfiniteQuery","myCartApi","myCartCacheKeys","MyOrdersApiFactory","instance","initialise","myOrdersApi","cacheKeys","useGet","useOrders","Object","freeze","useCreate","meta","onSuccess","onError","queryCache","syncBasket","useSync","orderObj","create","data","setQueryData","invalidateQueries","useGetCompact","error","useGetById","id","getById","retry","refetchOnWindowFocus","enabled","Boolean","query","filter","getInstance"],"mappings":";;AAAA,SACEA,WADF,QAKO,sBALP;AAMA,SAASC,YAAT,QAA6B,iBAA7B;AACA,SACEC,WADF,EAGEC,aAHF,EAIEC,QAJF,EAOEC,gBAPF,QAQO,aARP;AAUA,SAASC,SAAT,EAAoBC,eAApB,QAA2C,cAA3C;AAeA,OAAO,IAAMC,kBAAkB,GAAI,YAAY;AAC7C,MAAIC,QAAJ;;AAEA,WAASC,UAAT,GAAiD;AAC/C,QAAMC,WAAW,GAAG,IAAIX,WAAJ,CAAgBC,YAAY,EAA5B,CAApB;AAEA,QAAMW,SAAS,GAAG;AAChBC,MAAAA,MAAM,EAAE,uBADQ;AAEhBC,MAAAA,SAAS,EAAE;AAFK,KAAlB;AAKA,WAAOC,MAAM,CAACC,MAAP,CAAc;AACnBC,MAAAA,SAAS,EAAE,mBAACC,IAAD,EAAYC,SAAZ,EAAuBC,OAAvB,EAAmC;AAAA,YAAlCF,IAAkC;AAAlCA,UAAAA,IAAkC,GAA3B,EAA2B;AAAA;;AAC5C,YAAMG,UAAU,GAAGlB,aAAa,EAAhC;AACA,YAA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,MAAZ,CAAmBD,KAAnB,CAAZ;AAAA,SAFqB,GAGrB;AACEJ,UAAAA,KAAK,EAAE,KADT;AAEEC,UAAAA,oBAAoB,EAAE;AAFxB,SAHqB,CAAvB;AAQD;AA7CkB,KAAd,CAAP;AA+CD;;AAED,SAAO;AACLK,IAAAA,WAAW,EAAE,uBAAY;AACvB,UAAI,CAAC/B,QAAL,EAAe;AACbA,QAAAA,QAAQ,GAAGC,UAAU,EAArB;AACD;;AAED,aAAOD,QAAP;AACD;AAPI,GAAP;AASD,CArEiC,EAA3B;AAuEP,OAAO,IAAME,WAAW,GAAGH,kBAAkB,CAACgC,WAAnB,EAApB","sourcesContent":["import {\n MyOrdersAPI,\n OrderDTO,\n OrderFilterResultDTO,\n SendOrderDTO,\n} from '@sentecacommerce/sdk'\nimport { getSDKConfig } from '../getSDKConfig'\nimport {\n useMutation,\n MutationResultPair,\n useQueryCache,\n useQuery,\n QueryResult,\n InfiniteQueryResult,\n useInfiniteQuery,\n} from 'react-query'\n\nimport { myCartApi, myCartCacheKeys } from '../myCartApi'\n\ntype myOrdersApiType = {\n readonly useCreate: (\n meta: SendOrderDTO,\n onSuccess?: (result: OrderDTO) => void,\n onError?: (error: any) => void\n ) => MutationResultPair<OrderDTO, unknown, any, unknown>\n readonly useGetById: (id?: string) => QueryResult<OrderDTO, unknown>\n readonly useOrders: (query?: {\n limit?: number\n offset?: number\n }) => InfiniteQueryResult<OrderFilterResultDTO, unknown>\n}\n\nexport const MyOrdersApiFactory = (function () {\n let instance: myOrdersApiType\n\n function initialise(): Readonly<myOrdersApiType> {\n const myOrdersApi = new MyOrdersAPI(getSDKConfig())\n\n const cacheKeys = {\n useGet: 'my-orders-api-use-get',\n useOrders: 'my-orders-use-orders',\n }\n\n return Object.freeze({\n useCreate: (meta = {}, onSuccess, onError) => {\n const queryCache = useQueryCache()\n const [syncBasket] = myCartApi.useSync()\n\n return useMutation(\n (orderObj?: SendOrderDTO) =>\n myOrdersApi.create({}, { ...meta, ...orderObj }),\n {\n onSuccess: (data) => {\n queryCache.setQueryData(myCartCacheKeys.useGet, data)\n queryCache.invalidateQueries(myCartCacheKeys.useGetCompact)\n syncBasket()\n if (typeof onSuccess === 'function') {\n onSuccess(data)\n }\n },\n onError: (error) => {\n if (typeof onError === 'function') {\n onError(error)\n }\n },\n }\n )\n },\n useGetById: (id) => {\n return useQuery(\n [cacheKeys.useGet, id],\n async () => myOrdersApi.getById(id as string),\n {\n retry: false,\n refetchOnWindowFocus: false,\n enabled: Boolean(id),\n }\n )\n },\n useOrders: (query?: { limit?: number; offset?: number }) => {\n return useInfiniteQuery(\n [cacheKeys.useOrders],\n async () => myOrdersApi.filter(query),\n {\n retry: false,\n refetchOnWindowFocus: false,\n }\n )\n },\n })\n }\n\n return {\n getInstance: function () {\n if (!instance) {\n instance = initialise()\n }\n\n return instance\n },\n }\n})()\n\nexport const myOrdersApi = MyOrdersApiFactory.getInstance()\n"],"file":"index.js"}
@@ -8,4 +8,7 @@ export var getVerifyBoricaResponseKey = order => {
8
8
  export var getBnpLoanCalculatorKey = preferredInstallmentCentAmount => {
9
9
  return ['bnp-loan-calculator', preferredInstallmentCentAmount];
10
10
  };
11
+ export var getUniCreditLoanCalculatorKey = downPaymentCentAmount => {
12
+ return ['uni-credit-calculator', downPaymentCentAmount];
13
+ };
11
14
  //# sourceMappingURL=keys.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/checkout/api/keys.ts"],"names":["CheckoutQueryKeysEnum","getVerifyBoricaResponseKey","order","getBnpLoanCalculatorKey","preferredInstallmentCentAmount"],"mappings":"AAAA,WAAYA,qBAAZ;;WAAYA,qB,MAAAA,qB,KAAAA,qB;;AAEZ,OAAO,IAAMC,0BAA0B,GAAIC,KAAD,IAAmB;AAC3D,yCAAqCA,KAArC;AACD,CAFM;AAIP,OAAO,IAAMC,uBAAuB,GAClCC,8BADqC,IAElC;AACH,SAAO,CAAC,qBAAD,EAAwBA,8BAAxB,CAAP;AACD,CAJM","sourcesContent":["export enum CheckoutQueryKeysEnum {}\n\nexport const getVerifyBoricaResponseKey = (order: string) => {\n return `Borica Response for Order: ${order}`\n}\n\nexport const getBnpLoanCalculatorKey = (\n preferredInstallmentCentAmount: number\n) => {\n return ['bnp-loan-calculator', preferredInstallmentCentAmount]\n}\n"],"file":"keys.js"}
1
+ {"version":3,"sources":["../../../../src/checkout/api/keys.ts"],"names":["CheckoutQueryKeysEnum","getVerifyBoricaResponseKey","order","getBnpLoanCalculatorKey","preferredInstallmentCentAmount","getUniCreditLoanCalculatorKey","downPaymentCentAmount"],"mappings":"AAAA,WAAYA,qBAAZ;;WAAYA,qB,MAAAA,qB,KAAAA,qB;;AAEZ,OAAO,IAAMC,0BAA0B,GAAIC,KAAD,IAAmB;AAC3D,yCAAqCA,KAArC;AACD,CAFM;AAIP,OAAO,IAAMC,uBAAuB,GAClCC,8BADqC,IAElC;AACH,SAAO,CAAC,qBAAD,EAAwBA,8BAAxB,CAAP;AACD,CAJM;AAMP,OAAO,IAAMC,6BAA6B,GACxCC,qBAD2C,IAExC;AACH,SAAO,CAAC,uBAAD,EAA0BA,qBAA1B,CAAP;AACD,CAJM","sourcesContent":["export enum CheckoutQueryKeysEnum {}\n\nexport const getVerifyBoricaResponseKey = (order: string) => {\n return `Borica Response for Order: ${order}`\n}\n\nexport const getBnpLoanCalculatorKey = (\n preferredInstallmentCentAmount: number\n) => {\n return ['bnp-loan-calculator', preferredInstallmentCentAmount]\n}\n\nexport const getUniCreditLoanCalculatorKey = (\n downPaymentCentAmount: number\n) => {\n return ['uni-credit-calculator', downPaymentCentAmount]\n}\n"],"file":"keys.js"}
@@ -1,3 +1,4 @@
1
1
  export * from './useVerifyBoricaResponseQuery';
2
2
  export * from './useBnpCalculateForCartQuery';
3
+ export * from './useUniCreditCalculateForCartQuery';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/checkout/api/queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAd;AACA,cAAc,+BAAd","sourcesContent":["export * from './useVerifyBoricaResponseQuery'\nexport * from './useBnpCalculateForCartQuery'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../../src/checkout/api/queries/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAd;AACA,cAAc,+BAAd;AACA,cAAc,qCAAd","sourcesContent":["export * from './useVerifyBoricaResponseQuery'\nexport * from './useBnpCalculateForCartQuery'\nexport * from './useUniCreditCalculateForCartQuery'\n"],"file":"index.js"}
@@ -0,0 +1,10 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import { useQuery } from 'react-query';
3
+ import { MyPaymentsUnicreditCalculateLoanOrder } from '@sentecacommerce/sdk';
4
+ import { getUniCreditLoanCalculatorKey } from '../../..';
5
+ export var useUniCreditCalculateForCartQuery = props => {
6
+ return useQuery(getUniCreditLoanCalculatorKey(props.downPaymentCentAmount), /*#__PURE__*/_asyncToGenerator(function* () {
7
+ return yield MyPaymentsUnicreditCalculateLoanOrder(props);
8
+ }));
9
+ };
10
+ //# sourceMappingURL=useUniCreditCalculateForCartQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/checkout/api/queries/useUniCreditCalculateForCartQuery.ts"],"names":["useQuery","MyPaymentsUnicreditCalculateLoanOrder","getUniCreditLoanCalculatorKey","useUniCreditCalculateForCartQuery","props","downPaymentCentAmount"],"mappings":";AACA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,qCAAT,QAAsD,sBAAtD;AACA,SAASC,6BAAT,QAA8C,UAA9C;AAEA,OAAO,IAAMC,iCAAiC,GAAIC,KAAD,IAE3C;AACJ,SAAOJ,QAAQ,CACbE,6BAA6B,CAACE,KAAK,CAACC,qBAAP,CADhB,iCAEb;AAAA,iBAAkBJ,qCAAqC,CAACG,KAAD,CAAvD;AAAA,GAFa,EAAf;AAID,CAPM","sourcesContent":["import React from 'react'\nimport { useQuery } from 'react-query'\nimport { MyPaymentsUnicreditCalculateLoanOrder } from '@sentecacommerce/sdk'\nimport { getUniCreditLoanCalculatorKey } from '../../..'\n\nexport const useUniCreditCalculateForCartQuery = (props: {\n downPaymentCentAmount: number\n}) => {\n return useQuery(\n getUniCreditLoanCalculatorKey(props.downPaymentCentAmount),\n async () => await MyPaymentsUnicreditCalculateLoanOrder(props)\n )\n}\n"],"file":"useUniCreditCalculateForCartQuery.js"}
@@ -0,0 +1,17 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ var UniCreditResponseContext = /*#__PURE__*/createContext({});
3
+ export var UniCreditResponseProvider = (_ref) => {
4
+ var {
5
+ children,
6
+ response
7
+ } = _ref;
8
+ return /*#__PURE__*/React.createElement(UniCreditResponseContext.Provider, {
9
+ value: response
10
+ }, children);
11
+ };
12
+ export var useUniCreditResponse = () => {
13
+ var context = useContext(UniCreditResponseContext);
14
+ if (!context) throw new Error('useUniCreditResponse hook must be within UniCreditResponseProvider');
15
+ return context;
16
+ };
17
+ //# sourceMappingURL=UniCreditResponseContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/checkout/contexts/UniCreditResponseContext.tsx"],"names":["React","createContext","useContext","UniCreditResponseContext","UniCreditResponseProvider","children","response","useUniCreditResponse","context","Error"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,aAAhB,EAA+BC,UAA/B,QAAiD,OAAjD;AAGA,IAAMC,wBAAwB,gBAAGF,aAAa,CAAW,EAAX,CAA9C;AAEA,OAAO,IAAMG,yBAAyB,GAAG,UAMnC;AAAA,MANoC;AACxCC,IAAAA,QADwC;AAExCC,IAAAA;AAFwC,GAMpC;AACJ,sBACE,oBAAC,wBAAD,CAA0B,QAA1B;AAAmC,IAAA,KAAK,EAAEA;AAA1C,KACGD,QADH,CADF;AAKD,CAZM;AAcP,OAAO,IAAME,oBAAoB,GAAG,MAAM;AACxC,MAAMC,OAAO,GAAGN,UAAU,CAACC,wBAAD,CAA1B;AAEA,MAAI,CAACK,OAAL,EACE,MAAM,IAAIC,KAAJ,CACJ,oEADI,CAAN;AAIF,SAAOD,OAAP;AACD,CATM","sourcesContent":["import React, { createContext, useContext } from 'react'\nimport type { PaypalVerifyPaymentDataResponseDTO as Response } from '@sentecacommerce/sdk'\n\nconst UniCreditResponseContext = createContext<Response>({} as Response)\n\nexport const UniCreditResponseProvider = ({\n children,\n response,\n}: {\n children: any\n response: Error | {}\n}) => {\n return (\n <UniCreditResponseContext.Provider value={response as Response}>\n {children}\n </UniCreditResponseContext.Provider>\n )\n}\n\nexport const useUniCreditResponse = () => {\n const context = useContext(UniCreditResponseContext)\n\n if (!context)\n throw new Error(\n 'useUniCreditResponse hook must be within UniCreditResponseProvider'\n )\n\n return context\n}\n"],"file":"UniCreditResponseContext.js"}
@@ -1,3 +1,4 @@
1
1
  export * from './BoricaResponseContext';
2
2
  export * from './PaypalResponseContext';
3
+ export * from './UniCreditResponseContext';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/checkout/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAd;AACA,cAAc,yBAAd","sourcesContent":["export * from './BoricaResponseContext'\nexport * from './PaypalResponseContext'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/checkout/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAd;AACA,cAAc,yBAAd;AACA,cAAc,4BAAd","sourcesContent":["export * from './BoricaResponseContext'\nexport * from './PaypalResponseContext'\nexport * from './UniCreditResponseContext'\n"],"file":"index.js"}
@@ -1,3 +1,4 @@
1
1
  export * from './useVerifyBoricaResponse';
2
2
  export * from './useBnpCalculateForCart';
3
+ export * from './useUniCreditCalculateForCart';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/checkout/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAAd;AACA,cAAc,0BAAd","sourcesContent":["export * from './useVerifyBoricaResponse'\nexport * from './useBnpCalculateForCart'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/checkout/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAAd;AACA,cAAc,0BAAd;AACA,cAAc,gCAAd","sourcesContent":["export * from './useVerifyBoricaResponse'\nexport * from './useBnpCalculateForCart'\nexport * from './useUniCreditCalculateForCart'\n"],"file":"index.js"}
@@ -0,0 +1,66 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import { useMemo } from 'react';
3
+ import { useUniCreditCalculateForCartQuery } from '../api';
4
+ import { decodePrice, formatAsCurrency, useConfigState } from '../../index';
5
+ export var useUniCreditCalculateForCart = props => {
6
+ var _useConfigState, _useConfigState$price, _response$data4, _response$data4$;
7
+
8
+ var {
9
+ downPaymentCentAmount = 0
10
+ } = props != null ? props : {};
11
+ var response = useUniCreditCalculateForCartQuery({
12
+ downPaymentCentAmount
13
+ });
14
+ var configLocale = (_useConfigState = useConfigState()) == null ? void 0 : (_useConfigState$price = _useConfigState.price) == null ? void 0 : _useConfigState$price.locale;
15
+ return useMemo(() => {
16
+ var _response$data, _response$data2, _response$data3, _response$data3$, _response$data3$$offe;
17
+
18
+ return _extends({}, response, {
19
+ dataRaw: response == null ? void 0 : (_response$data = response.data) == null ? void 0 : _response$data[0],
20
+ data: _extends({}, response == null ? void 0 : (_response$data2 = response.data) == null ? void 0 : _response$data2[0], {
21
+ offers: response == null ? void 0 : (_response$data3 = response.data) == null ? void 0 : (_response$data3$ = _response$data3[0]) == null ? void 0 : (_response$data3$$offe = _response$data3$.offers) == null ? void 0 : _response$data3$$offe.map(offer => {
22
+ var _totalRepaymentAmount = decodePrice(offer.totalRepaymentAmount);
23
+
24
+ var _correctDownPaymentAmount = decodePrice(offer.correctDownPaymentAmount);
25
+
26
+ var _installmentAmount = decodePrice(offer.installmentAmount);
27
+
28
+ var _processingFeeAmount = decodePrice(offer.processingFeeAmount);
29
+
30
+ var totalRepaymentAmount = formatAsCurrency({
31
+ price: _totalRepaymentAmount,
32
+ precision: offer.totalRepaymentAmount.fractionDigits,
33
+ currency: offer.totalRepaymentAmount.currencyCode,
34
+ locale: configLocale || 'en'
35
+ });
36
+ var correctDownPaymentAmount = formatAsCurrency({
37
+ price: _correctDownPaymentAmount,
38
+ precision: offer.correctDownPaymentAmount.fractionDigits,
39
+ currency: offer.correctDownPaymentAmount.currencyCode,
40
+ locale: configLocale || 'en'
41
+ });
42
+ var installmentAmount = formatAsCurrency({
43
+ price: _installmentAmount,
44
+ precision: offer.installmentAmount.fractionDigits,
45
+ currency: offer.installmentAmount.currencyCode,
46
+ locale: configLocale || 'en'
47
+ });
48
+ var processingFeeAmount = formatAsCurrency({
49
+ price: _processingFeeAmount,
50
+ precision: offer.processingFeeAmount.fractionDigits,
51
+ currency: offer.processingFeeAmount.currencyCode,
52
+ locale: configLocale || 'en'
53
+ });
54
+ return _extends({}, offer, {
55
+ offerRaw: offer,
56
+ totalRepaymentAmount,
57
+ correctDownPaymentAmount,
58
+ installmentAmount,
59
+ processingFeeAmount
60
+ });
61
+ }).sort((offer, offer2) => Number(offer.maturity) - Number(offer2.maturity))
62
+ })
63
+ });
64
+ }, [response == null ? void 0 : (_response$data4 = response.data) == null ? void 0 : (_response$data4$ = _response$data4[0]) == null ? void 0 : _response$data4$.offers]);
65
+ };
66
+ //# sourceMappingURL=useUniCreditCalculateForCart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/checkout/hooks/useUniCreditCalculateForCart.ts"],"names":["useMemo","useUniCreditCalculateForCartQuery","decodePrice","formatAsCurrency","useConfigState","useUniCreditCalculateForCart","props","downPaymentCentAmount","response","configLocale","price","locale","dataRaw","data","offers","map","offer","_totalRepaymentAmount","totalRepaymentAmount","_correctDownPaymentAmount","correctDownPaymentAmount","_installmentAmount","installmentAmount","_processingFeeAmount","processingFeeAmount","precision","fractionDigits","currency","currencyCode","offerRaw","sort","offer2","Number","maturity"],"mappings":";AAAA,SAAgBA,OAAhB,QAA+B,OAA/B;AACA,S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,CAACzB,QAAD,uCAACA,QAAQ,CAAEK,IAAX,yCAAC,gBAAiB,CAAjB,CAAD,qBAAC,iBAAqBC,MAAtB,CA3DY,CAAd;AA6DD,CAvEM","sourcesContent":["import React, { useMemo } from 'react'\nimport { useUniCreditCalculateForCartQuery } from '../api'\nimport { decodePrice, formatAsCurrency, useConfigState } from '../../index'\nimport { LoanOfferDTO } from '@sentecacommerce/sdk'\n\nexport const useUniCreditCalculateForCart = (props?: {\n downPaymentCentAmount?: number\n}) => {\n const { downPaymentCentAmount = 0 } = props ?? {}\n\n const response = useUniCreditCalculateForCartQuery({\n downPaymentCentAmount,\n })\n const configLocale: string = useConfigState()?.price?.locale\n\n return useMemo(\n () => ({\n ...response,\n dataRaw: response?.data?.[0] as LoanOfferDTO,\n data: {\n ...response?.data?.[0],\n offers: response?.data?.[0]?.offers\n ?.map((offer) => {\n const _totalRepaymentAmount = decodePrice(\n offer.totalRepaymentAmount\n )\n const _correctDownPaymentAmount = decodePrice(\n offer.correctDownPaymentAmount\n )\n const _installmentAmount = decodePrice(offer.installmentAmount)\n const _processingFeeAmount = decodePrice(offer.processingFeeAmount)\n\n const totalRepaymentAmount = formatAsCurrency({\n price: _totalRepaymentAmount,\n precision: offer.totalRepaymentAmount.fractionDigits,\n currency: offer.totalRepaymentAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n const correctDownPaymentAmount = formatAsCurrency({\n price: _correctDownPaymentAmount,\n precision: offer.correctDownPaymentAmount.fractionDigits,\n currency: offer.correctDownPaymentAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n const installmentAmount = formatAsCurrency({\n price: _installmentAmount,\n precision: offer.installmentAmount.fractionDigits,\n currency: offer.installmentAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n const processingFeeAmount = formatAsCurrency({\n price: _processingFeeAmount,\n precision: offer.processingFeeAmount.fractionDigits,\n currency: offer.processingFeeAmount.currencyCode,\n locale: configLocale || 'en',\n })\n\n return {\n ...offer,\n offerRaw: offer,\n totalRepaymentAmount,\n correctDownPaymentAmount,\n installmentAmount,\n processingFeeAmount,\n }\n })\n .sort(\n (offer, offer2) => Number(offer.maturity) - Number(offer2.maturity)\n ),\n },\n }),\n [response?.data?.[0]?.offers]\n )\n}\n"],"file":"useUniCreditCalculateForCart.js"}
@@ -0,0 +1,12 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import { MyPaymentsUnicreditCapture as captureOrder } from '@sentecacommerce/sdk';
3
+ export var captureUniCreditOrder = /*#__PURE__*/function () {
4
+ var _ref = _asyncToGenerator(function* (res) {
5
+ return captureOrder({}, res);
6
+ });
7
+
8
+ return function captureUniCreditOrder(_x) {
9
+ return _ref.apply(this, arguments);
10
+ };
11
+ }();
12
+ //# sourceMappingURL=captureUniCreditOrder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/checkout/ssr/captureUniCreditOrder.ts"],"names":["MyPaymentsUnicreditCapture","captureOrder","captureUniCreditOrder","res"],"mappings":";AAAA,SACEA,0BAA0B,IAAIC,YADhC,QAGO,sBAHP;AAKA,OAAO,IAAMC,qBAAqB;AAAA,+BAAG,WACnCC,GADmC,EAEhC;AACH,WAAOF,YAAY,CAAC,EAAD,EAAKE,GAAL,CAAnB;AACD,GAJiC;;AAAA,kBAArBD,qBAAqB;AAAA;AAAA;AAAA,GAA3B","sourcesContent":["import {\n MyPaymentsUnicreditCapture as captureOrder,\n UniCreditCaptureRequestDTO,\n} from '@sentecacommerce/sdk'\n\nexport const captureUniCreditOrder = async (\n res: UniCreditCaptureRequestDTO\n) => {\n return captureOrder({}, res)\n}\n"],"file":"captureUniCreditOrder.js"}
@@ -1,3 +1,4 @@
1
1
  export * from './verifyBoricaResponse';
2
2
  export * from './capturePaypalOrder';
3
+ export * from './captureUniCreditOrder';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/checkout/ssr/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAd;AACA,cAAc,sBAAd","sourcesContent":["export * from './verifyBoricaResponse'\nexport * from './capturePaypalOrder'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../src/checkout/ssr/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAd;AACA,cAAc,sBAAd;AACA,cAAc,yBAAd","sourcesContent":["export * from './verifyBoricaResponse'\nexport * from './capturePaypalOrder'\nexport * from './captureUniCreditOrder'\n"],"file":"index.js"}
@@ -0,0 +1,63 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ export var UniCreditRedirect = (_ref) => {
3
+ var {
4
+ formData,
5
+ isInDevMode
6
+ } = _ref;
7
+ var formRef = useRef(null);
8
+ useEffect(() => {
9
+ if (isInDevMode) return;
10
+ var timeout = setTimeout(() => {
11
+ var _formRef$current;
12
+
13
+ formRef == null ? void 0 : (_formRef$current = formRef.current) == null ? void 0 : _formRef$current.submit();
14
+ }, 50);
15
+ return () => {
16
+ clearTimeout(timeout);
17
+ };
18
+ }, [formData, isInDevMode]);
19
+ return /*#__PURE__*/React.createElement("form", {
20
+ ref: formRef,
21
+ action: formData.url,
22
+ method: "POST",
23
+ style: isInDevMode ? {
24
+ position: 'fixed',
25
+ zIndex: 9999999,
26
+ width: '100%',
27
+ height: '100%',
28
+ background: '#fff',
29
+ display: 'flex',
30
+ alignItems: 'center',
31
+ flexDirection: 'column',
32
+ justifyContent: 'center',
33
+ top: 0
34
+ } : {
35
+ position: 'absolute',
36
+ left: '100vw',
37
+ width: '10px',
38
+ top: '400vh',
39
+ overflow: 'hidden'
40
+ }
41
+ }, /*#__PURE__*/React.createElement("div", {
42
+ style: {
43
+ margin: 6
44
+ }
45
+ }, /*#__PURE__*/React.createElement("label", {
46
+ style: {
47
+ width: 169,
48
+ display: 'inline-block'
49
+ }
50
+ }, 'suosId'), /*#__PURE__*/React.createElement("input", {
51
+ type: "text",
52
+ name: 'suosId',
53
+ value: formData.sessionId,
54
+ style: {
55
+ width: 333,
56
+ border: '1px solid #000 '
57
+ }
58
+ })), isInDevMode ? /*#__PURE__*/React.createElement("input", {
59
+ type: "submit",
60
+ value: "SUBMIT"
61
+ }) : null);
62
+ };
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../src/contexts/CheckoutForm/Components/UniCreditRedirect/index.tsx"],"names":["React","useEffect","useRef","UniCreditRedirect","formData","isInDevMode","formRef","timeout","setTimeout","current","submit","clearTimeout","url","position","zIndex","width","height","background","display","alignItems","flexDirection","justifyContent","top","left","overflow","margin","sessionId","border"],"mappings":"AACA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,QAAyC,OAAzC;AAEA,OAAO,IAAMC,iBAAiB,GAAG,UAM3B;AAAA,MAN4B;AAChCC,IAAAA,QADgC;AAEhCC,IAAAA;AAFgC,GAM5B;AACJ,MAAMC,OAAO,GAAGJ,MAAM,CAAyB,IAAzB,CAAtB;AAEAD,EAAAA,SAAS,CAAC,MAAM;AACd,QAAII,WAAJ,EAAiB;AAEjB,QAAME,OAAO,GAAGC,UAAU,CAAC,MAAM;AAAA;;AAC/BF,MAAAA,OAAO,QAAP,gCAAAA,OAAO,CAAEG,OAAT,sCAAkBC,MAAlB;AACD,KAFyB,EAEvB,EAFuB,CAA1B;AAIA,WAAO,MAAM;AACXC,MAAAA,YAAY,CAACJ,OAAD,CAAZ;AACD,KAFD;AAGD,GAVQ,EAUN,CAACH,QAAD,EAAWC,WAAX,CAVM,CAAT;AAYA,sBACE;AACE,IAAA,GAAG,EAAEC,OADP;AAEE,IAAA,MAAM,EAAEF,QAAQ,CAACQ,GAFnB;AAGE,IAAA,MAAM,EAAC,MAHT;AAIE,IAAA,KAAK,EACHP,WAAW,GACP;AACEQ,MAAAA,QAAQ,EAAE,OADZ;AAEEC,MAAAA,MAAM,EAAE,OAFV;AAGEC,MAAAA,KAAK,EAAE,MAHT;AAIEC,MAAAA,MAAM,EAAE,MAJV;AAKEC,MAAAA,UAAU,EAAE,MALd;AAMEC,MAAAA,OAAO,EAAE,MANX;AAOEC,MAAAA,UAAU,EAAE,QAPd;AAQEC,MAAAA,aAAa,EAAE,QARjB;AASEC,MAAAA,cAAc,EAAE,QATlB;AAUEC,MAAAA,GAAG,EAAE;AAVP,KADO,GAaP;AACET,MAAAA,QAAQ,EAAE,UADZ;AAEEU,MAAAA,IAAI,EAAE,OAFR;AAGER,MAAAA,KAAK,EAAE,MAHT;AAIEO,MAAAA,GAAG,EAAE,OAJP;AAKEE,MAAAA,QAAQ,EAAE;AALZ;AAlBR,kBA2BE;AAAK,IAAA,KAAK,EAAE;AAAEC,MAAAA,MAAM,EAAE;AAAV;AAAZ,kBACE;AAAO,IAAA,KAAK,EAAE;AAAEV,MAAAA,KAAK,EAAE,GAAT;AAAcG,MAAAA,OAAO,EAAE;AAAvB;AAAd,KACG,QADH,CADF,eAIE;AACE,IAAA,IAAI,EAAC,MADP;AAEE,IAAA,IAAI,EAAE,QAFR;AAGE,IAAA,KAAK,EAAEd,QAAQ,CAACsB,SAHlB;AAIE,IAAA,KAAK,EAAE;AAAEX,MAAAA,KAAK,EAAE,GAAT;AAAcY,MAAAA,MAAM,EAAE;AAAtB;AAJT,IAJF,CA3BF,EAsCGtB,WAAW,gBAAG;AAAO,IAAA,IAAI,EAAC,QAAZ;AAAqB,IAAA,KAAK,EAAC;AAA3B,IAAH,GAA4C,IAtC1D,CADF;AA0CD,CA/DM","sourcesContent":["import { UniCreditSessionStartResponseDTO } from '@sentecacommerce/sdk'\nimport React, { useEffect, useRef } from 'react'\n\nexport const UniCreditRedirect = ({\n formData,\n isInDevMode,\n}: {\n formData: UniCreditSessionStartResponseDTO\n isInDevMode?: boolean\n}) => {\n const formRef = useRef<HTMLFormElement | null>(null)\n\n useEffect(() => {\n if (isInDevMode) return\n\n const timeout = setTimeout(() => {\n formRef?.current?.submit()\n }, 50)\n\n return () => {\n clearTimeout(timeout)\n }\n }, [formData, isInDevMode])\n\n return (\n <form\n ref={formRef}\n action={formData.url}\n method=\"POST\"\n style={\n isInDevMode\n ? {\n position: 'fixed',\n zIndex: 9999999,\n width: '100%',\n height: '100%',\n background: '#fff',\n display: 'flex',\n alignItems: 'center',\n flexDirection: 'column',\n justifyContent: 'center',\n top: 0,\n }\n : {\n position: 'absolute',\n left: '100vw',\n width: '10px',\n top: '400vh',\n overflow: 'hidden',\n }\n }\n >\n <div style={{ margin: 6 }}>\n <label style={{ width: 169, display: 'inline-block' }}>\n {'suosId'}\n </label>\n <input\n type=\"text\"\n name={'suosId'}\n value={formData.sessionId}\n style={{ width: 333, border: '1px solid #000 ' }}\n />\n </div>\n {isInDevMode ? <input type=\"submit\" value=\"SUBMIT\" /> : null}\n </form>\n )\n}\n"],"file":"index.js"}
@@ -1,3 +1,4 @@
1
1
  export * from './BoricaRedirect';
2
2
  export * from './CheckoutCustomState';
3
+ export * from './UniCreditRedirect';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/contexts/CheckoutForm/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAd;AACA,cAAc,uBAAd","sourcesContent":["export * from './BoricaRedirect'\nexport * from './CheckoutCustomState'\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../../src/contexts/CheckoutForm/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAd;AACA,cAAc,uBAAd;AACA,cAAc,qBAAd","sourcesContent":["export * from './BoricaRedirect'\nexport * from './CheckoutCustomState'\nexport * from './UniCreditRedirect'\n"],"file":"index.js"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/contexts/CheckoutForm/hooks/usePayment/index.ts"],"names":["useMemo","useState","useCheckoutPayment","validatePayment","usePayment","orderQuery","errorLabels","enabled","isPaymentSubmitting","setIsPaymentSubmitting","loanInfo","setLoanInfo","paymentMethods","query","paymentErrors","isSubmitting","errors","isValid","updateIsSubmitting","updateLoanInfo"],"mappings":"AACA,SAASA,OAAT,EAAkBC,QAAlB,QAAkC,OAAlC;AAMA,SAEEC,kBAFF,QAGO,sCAHP;AAIA,SAASC,eAAT,QAAgC,aAAhC;AAGA,OAAO,IAAMC,UAAU,GAAG,UAQE;AAAA,MARD;AACzBC,IAAAA,UADyB;AAEzBC,IAAAA,WAFyB;AAGzBC,IAAAA;AAHyB,GAQC;AAC1B,MAAM,CAACC,mBAAD,EAAsBC,sBAAtB,IAAgDR,QAAQ,CAAC,KAAD,CAA9D;AACA,MAAM,CAACS,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,EAAD,CAAxC;AAEA,MAAMW,cAAc,GAAGV,kBAAkB,CAAC;AAAEW,IAAAA,KAAK,EAAER,UAAT;AAAqBE,IAAAA;AAArB,GAAD,CAAzC;AAEA,MAAMO,aAAa,GACjBF,cAAc,IAAIT,eAAe,CAACS,cAAD,EAAiBN,WAAjB,CADnC;AAGA,SAAON,OAAO,CAAC,MAAM;AACnB,WAAO;AACLe,MAAAA,YAAY,EAAEP,mBADT;AAELQ,MAAAA,MAAM,EAAER,mBAAmB,GAAGM,aAAH,GAAmB,IAFzC;AAGLG,MAAAA,OAAO,EAAE,CAACH,aAHL;AAILI,MAAAA,kBAAkB,EAAET,sBAJf;AAKLU,MAAAA,cAAc,EAAER,WALX;AAMLC,MAAAA,cANK;AAOLF,MAAAA;AAPK,KAAP;AASD,GAVa,EAUX,CAACE,cAAD,EAAiBE,aAAjB,EAAgCN,mBAAhC,EAAqDE,QAArD,CAVW,CAAd;AAWD,CA5BM","sourcesContent":["import { OrderDTO } from '@sentecacommerce/sdk'\nimport { useMemo, useState } from 'react'\nimport { QueryResult } from 'react-query'\nimport {\n CheckoutFormErrorLabelsType,\n CheckoutFormErrorsResultType,\n} from '../..'\nimport {\n PaymentMethodsResult,\n useCheckoutPayment,\n} from '../../../../hooks/useCheckoutPayment'\nimport { validatePayment } from '../../utils'\nimport { useBoolean } from '../../../../index'\n\nexport const usePayment = ({\n orderQuery,\n errorLabels,\n enabled,\n}: {\n orderQuery: QueryResult<OrderDTO, unknown>\n errorLabels: CheckoutFormErrorLabelsType\n enabled: boolean\n}): UsePaymentResultType => {\n const [isPaymentSubmitting, setIsPaymentSubmitting] = useState(false)\n const [loanInfo, setLoanInfo] = useState({})\n\n const paymentMethods = useCheckoutPayment({ query: orderQuery, enabled })\n\n const paymentErrors =\n paymentMethods && validatePayment(paymentMethods, errorLabels)\n\n return useMemo(() => {\n return {\n isSubmitting: isPaymentSubmitting,\n errors: isPaymentSubmitting ? paymentErrors : null,\n isValid: !paymentErrors,\n updateIsSubmitting: setIsPaymentSubmitting,\n updateLoanInfo: setLoanInfo,\n paymentMethods,\n loanInfo,\n }\n }, [paymentMethods, paymentErrors, isPaymentSubmitting, loanInfo])\n}\n\nexport type UsePaymentResultType = {\n isSubmitting: boolean\n errors?: CheckoutFormErrorsResultType\n isValid: boolean\n updateIsSubmitting: (value: boolean) => void\n updateLoanInfo: (value: any) => void\n loanInfo: any\n paymentMethods?: PaymentMethodsResult\n}\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../../../../../../src/contexts/CheckoutForm/hooks/usePayment/index.ts"],"names":["useMemo","useState","useCheckoutPayment","validatePayment","usePayment","orderQuery","errorLabels","enabled","isPaymentSubmitting","setIsPaymentSubmitting","loanInfo","setLoanInfo","paymentMethods","query","paymentErrors","isSubmitting","errors","isValid","updateIsSubmitting","updateLoanInfo"],"mappings":"AACA,SAASA,OAAT,EAAkBC,QAAlB,QAAkC,OAAlC;AAMA,SAEEC,kBAFF,QAGO,sCAHP;AAIA,SAASC,eAAT,QAAgC,aAAhC;AAGA,OAAO,IAAMC,UAAU,GAAG,UAQE;AAAA,MARD;AACzBC,IAAAA,UADyB;AAEzBC,IAAAA,WAFyB;AAGzBC,IAAAA;AAHyB,GAQC;AAC1B,MAAM,CAACC,mBAAD,EAAsBC,sBAAtB,IAAgDR,QAAQ,CAAC,KAAD,CAA9D;AACA,MAAM,CAACS,QAAD,EAAWC,WAAX,IAA0BV,QAAQ,CAAC,EAAD,CAAxC;AAEA,MAAMW,cAAc,GAAGV,kBAAkB,CAAC;AAAEW,IAAAA,KAAK,EAAER,UAAT;AAAqBE,IAAAA;AAArB,GAAD,CAAzC;AAEA,MAAMO,aAAa,GACjBF,cAAc,IAAIT,eAAe,CAACS,cAAD,EAAiBN,WAAjB,CADnC;AAGA,SAAON,OAAO,CAAC,MAAM;AACnB,WAAO;AACLe,MAAAA,YAAY,EAAEP,mBADT;AAELQ,MAAAA,MAAM,EAAER,mBAAmB,GAAGM,aAAH,GAAmB,IAFzC;AAGLG,MAAAA,OAAO,EAAE,CAACH,aAHL;AAILI,MAAAA,kBAAkB,EAAET,sBAJf;AAKLU,MAAAA,cAAc,EAAER,WALX;AAMLC,MAAAA,cANK;AAOLF,MAAAA;AAPK,KAAP;AASD,GAVa,EAUX,CAACE,cAAD,EAAiBE,aAAjB,EAAgCN,mBAAhC,EAAqDE,QAArD,CAVW,CAAd;AAWD,CA5BM","sourcesContent":["import { OrderDTO, OrderLoanInfoDTO } from '@sentecacommerce/sdk'\nimport { useMemo, useState } from 'react'\nimport { QueryResult } from 'react-query'\nimport {\n CheckoutFormErrorLabelsType,\n CheckoutFormErrorsResultType,\n} from '../..'\nimport {\n PaymentMethodsResult,\n useCheckoutPayment,\n} from '../../../../hooks/useCheckoutPayment'\nimport { validatePayment } from '../../utils'\nimport { useBoolean } from '../../../../index'\n\nexport const usePayment = ({\n orderQuery,\n errorLabels,\n enabled,\n}: {\n orderQuery: QueryResult<OrderDTO, unknown>\n errorLabels: CheckoutFormErrorLabelsType\n enabled: boolean\n}): UsePaymentResultType => {\n const [isPaymentSubmitting, setIsPaymentSubmitting] = useState(false)\n const [loanInfo, setLoanInfo] = useState({})\n\n const paymentMethods = useCheckoutPayment({ query: orderQuery, enabled })\n\n const paymentErrors =\n paymentMethods && validatePayment(paymentMethods, errorLabels)\n\n return useMemo(() => {\n return {\n isSubmitting: isPaymentSubmitting,\n errors: isPaymentSubmitting ? paymentErrors : null,\n isValid: !paymentErrors,\n updateIsSubmitting: setIsPaymentSubmitting,\n updateLoanInfo: setLoanInfo,\n paymentMethods,\n loanInfo,\n }\n }, [paymentMethods, paymentErrors, isPaymentSubmitting, loanInfo])\n}\n\nexport type UsePaymentResultType = {\n isSubmitting: boolean\n errors?: CheckoutFormErrorsResultType\n isValid: boolean\n updateIsSubmitting: (value: boolean) => void\n updateLoanInfo: (value: OrderLoanInfoDTO) => void\n loanInfo: any\n paymentMethods?: PaymentMethodsResult\n}\n"],"file":"index.js"}
@@ -80,15 +80,19 @@ export var useShipping = (_ref) => {
80
80
  if (!enableSaveAddress) return;
81
81
  setIsShippingSubmitting(true);
82
82
  if (addressErrors) return;
83
- saveAddress(_extends({}, shippingAddressWithModule, {
83
+
84
+ var baseAddress = _extends({}, shippingAddressWithModule, {
84
85
  _id: undefined,
85
- countryCode,
86
86
  custom: shippingAddressWithModule == null ? void 0 : (_shippingAddressWithM = shippingAddressWithModule.custom) == null ? void 0 : _shippingAddressWithM.filter((_ref2) => {
87
87
  var {
88
88
  field
89
89
  } = _ref2;
90
90
  return field !== IS_NEW && field !== SELECTED_ADDRESS_ID;
91
91
  })
92
+ });
93
+
94
+ saveAddress(enableNoShippingMethodMode ? baseAddress : _extends({}, baseAddress, {
95
+ countryCode
92
96
  }), {
93
97
  onSuccess: address => {
94
98
  var data = _extends({}, address, {