@sentecacommerce-theme/lib 0.13.5-alpha.7 → 0.13.7-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/cjs/analytics/Pixel/hooks/usePixelProductClick.js +1 -1
  2. package/dist/cjs/analytics/Pixel/hooks/usePixelProductDetails.js +1 -1
  3. package/dist/cjs/analytics/Pixel/hooks/usePixelProductsImpression.js +1 -1
  4. package/dist/cjs/analytics/Pixel/usePixel.js +1 -1
  5. package/dist/cjs/analytics/Releva/useReleva.js +1 -1
  6. package/dist/cjs/analytics/addToCart.js +0 -1
  7. package/dist/cjs/analytics/initiateCheckout.js +0 -1
  8. package/dist/cjs/analytics/viewContent.js +0 -1
  9. package/dist/cjs/api/myCartApi/index.js +2 -1
  10. package/dist/cjs/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
  11. package/dist/cjs/basket/api/index.js +37 -0
  12. package/dist/cjs/basket/api/mutations/index.js +37 -0
  13. package/dist/cjs/basket/api/mutations/useReplaceBasketMutation.js +58 -0
  14. package/dist/cjs/basket/hooks/index.js +52 -0
  15. package/dist/cjs/basket/hooks/useBasketCrossSaleItems.js +99 -0
  16. package/dist/cjs/basket/hooks/useReplaceBasket.js +10 -0
  17. package/dist/cjs/basket/index.js +37 -0
  18. package/dist/cjs/checkout/api/keys.js +8 -1
  19. package/dist/cjs/checkout/api/queries/index.js +15 -0
  20. package/dist/cjs/checkout/api/queries/useBnpCalculateForCartQuery.js +60 -0
  21. package/dist/cjs/checkout/hooks/index.js +15 -0
  22. package/dist/cjs/checkout/hooks/useBnpCalculateForCart.js +120 -0
  23. package/dist/cjs/components/Html/index.js +1 -1
  24. package/dist/cjs/components/Portal/index.js +1 -1
  25. package/dist/cjs/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
  26. package/dist/cjs/contexts/CheckoutForm/index.js +5 -3
  27. package/dist/cjs/hooks/ui-hooks/useIsDesktop/index.js +2 -2
  28. package/dist/cjs/hooks/useAllSelectedFilters/index.js +3 -3
  29. package/dist/cjs/hooks/useLineItem/index.js +7 -0
  30. package/dist/cjs/hooks/usePrice/index.js +1 -1
  31. package/dist/cjs/hooks/useProduct/index.js +26 -5
  32. package/dist/cjs/hooks/useProduct/utils/index.js +14 -1
  33. package/dist/cjs/hooks/useProgressBar/hooks/useGetSetState.js +1 -24
  34. package/dist/cjs/hooks/useSelectedFilters/index.js +3 -3
  35. package/dist/cjs/hooks/useVouchers/index.js +1 -2
  36. package/dist/cjs/index.js +24 -0
  37. package/dist/cjs/listing/api/queries/useAggregateQuery.js +47 -12
  38. package/dist/cjs/listing/api/queries/useInfiniteListing.js +4 -4
  39. package/dist/cjs/listing/api/queries/useListingQuery.js +37 -22
  40. package/dist/cjs/listing/api/queries/usePredicate.js +4 -4
  41. package/dist/cjs/listing/components/BasicListingSEO.js +1 -1
  42. package/dist/cjs/listing/hooks/useListingAlias.js +2 -4
  43. package/dist/cjs/listing/hooks/useListingBreadcrumbs.js +4 -4
  44. package/dist/cjs/listing/hooks/useListingCategories.js +7 -8
  45. package/dist/cjs/listing/hooks/useListingConfig.js +4 -5
  46. package/dist/cjs/listing/hooks/useListingFilters.js +19 -20
  47. package/dist/cjs/listing/hooks/useListingItems.js +2 -2
  48. package/dist/cjs/listing/hooks/useListingMeta.js +5 -4
  49. package/dist/cjs/listing/hooks/useListingPagination.js +4 -4
  50. package/dist/cjs/listing/hooks/useListingSlug.js +3 -1
  51. package/dist/cjs/listing/hooks/useSlideFilter.js +4 -3
  52. package/dist/cjs/listing/hooks/utils.js +2 -1
  53. package/dist/cjs/listing/ssr/prefetchListing.js +4 -4
  54. package/dist/cjs/listing/types.js +8 -1
  55. package/dist/cjs/listing/utils/buildCategoryQuery.js +16 -12
  56. package/dist/cjs/listing/utils/buildFilterQuery.js +5 -7
  57. package/dist/cjs/listing/utils/getListingAlias.js +5 -6
  58. package/dist/cjs/listing/utils/getListingPageType.js +4 -3
  59. package/dist/cjs/navigation/components/SearchBox/Components/Container/index.js +1 -1
  60. package/dist/cjs/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
  61. package/dist/cjs/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
  62. package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
  63. package/dist/cjs/navigation/components/SearchBox/Components/Products/index.js +2 -2
  64. package/dist/cjs/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
  65. package/dist/cjs/navigation/components/SearchBox/index.js +11 -11
  66. package/dist/cjs/order/api/mutations/index.js +15 -0
  67. package/dist/cjs/order/api/mutations/useUpdateOrderCustomFieldMutation.js +15 -0
  68. package/dist/cjs/order/hooks/index.js +15 -0
  69. package/dist/cjs/order/hooks/useUpdateOrderCustomField.js +9 -0
  70. package/dist/cjs/product/api/keys.js +11 -0
  71. package/dist/cjs/product/api/queries/index.js +37 -0
  72. package/dist/cjs/product/api/queries/useBnpOffersQuery.js +64 -0
  73. package/dist/cjs/product/hooks/index.js +37 -0
  74. package/dist/cjs/product/hooks/useBnpOffers.js +89 -0
  75. package/dist/cjs/product/index.js +15 -0
  76. package/dist/cjs/seo/components/GlobalSEO/index.js +3 -3
  77. package/dist/cjs/user/api/queries/index.js +15 -0
  78. package/dist/cjs/user/api/queries/useGetMyLoyaltyCardQuery.js +21 -0
  79. package/dist/cjs/user/api/utils/getUserToken.js +16 -0
  80. package/dist/cjs/user/api/utils/index.js +12 -0
  81. package/dist/cjs/user/hooks/index.js +24 -0
  82. package/dist/cjs/user/hooks/useGetMyLoyaltyCard.js +9 -0
  83. package/dist/cjs/user/hooks/useGetUserToken.js +15 -0
  84. package/dist/esm/analytics/Pixel/hooks/usePixelProductClick.js +1 -1
  85. package/dist/esm/analytics/Pixel/hooks/usePixelProductDetails.js +1 -1
  86. package/dist/esm/analytics/Pixel/hooks/usePixelProductsImpression.js +1 -1
  87. package/dist/esm/analytics/Pixel/mainScript.js +0 -1
  88. package/dist/esm/analytics/Pixel/usePixel.js +1 -1
  89. package/dist/esm/analytics/Releva/useReleva.js +1 -1
  90. package/dist/esm/analytics/addToCart.js +0 -1
  91. package/dist/esm/analytics/initiateCheckout.js +0 -1
  92. package/dist/esm/analytics/pageView.js +1 -1
  93. package/dist/esm/analytics/viewContent.js +0 -1
  94. package/dist/esm/api/myCartApi/index.js +2 -1
  95. package/dist/esm/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
  96. package/dist/esm/basket/api/index.js +1 -0
  97. package/dist/esm/basket/api/mutations/index.js +1 -0
  98. package/dist/esm/basket/api/mutations/useReplaceBasketMutation.js +48 -0
  99. package/dist/esm/basket/hooks/index.js +2 -0
  100. package/dist/esm/basket/hooks/useBasketCrossSaleItems.js +67 -0
  101. package/dist/esm/basket/hooks/useReplaceBasket.js +2 -0
  102. package/dist/esm/basket/index.js +1 -0
  103. package/dist/esm/checkout/api/keys.js +6 -0
  104. package/dist/esm/checkout/api/queries/index.js +1 -0
  105. package/dist/esm/checkout/api/queries/useBnpCalculateForCartQuery.js +50 -0
  106. package/dist/esm/checkout/hooks/index.js +1 -0
  107. package/dist/esm/checkout/hooks/useBnpCalculateForCart.js +92 -0
  108. package/dist/esm/components/GoogleOneTap/index.js +1 -1
  109. package/dist/esm/components/Html/index.js +1 -1
  110. package/dist/esm/components/Portal/index.js +1 -1
  111. package/dist/esm/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
  112. package/dist/esm/contexts/CheckoutForm/index.js +5 -3
  113. package/dist/esm/hooks/ui-hooks/useIsDesktop/index.js +2 -2
  114. package/dist/esm/hooks/useAllSelectedFilters/index.js +4 -4
  115. package/dist/esm/hooks/useLineItem/index.js +2 -0
  116. package/dist/esm/hooks/usePrice/index.js +1 -1
  117. package/dist/esm/hooks/useProduct/index.js +27 -6
  118. package/dist/esm/hooks/useProduct/utils/index.js +13 -0
  119. package/dist/esm/hooks/useProgressBar/hooks/useGetSetState.js +1 -1
  120. package/dist/esm/hooks/useSelectedFilters/index.js +4 -4
  121. package/dist/esm/hooks/useVouchers/index.js +1 -2
  122. package/dist/esm/index.js +4 -0
  123. package/dist/esm/listing/api/queries/useAggregateQuery.js +47 -12
  124. package/dist/esm/listing/api/queries/useInfiniteListing.js +4 -4
  125. package/dist/esm/listing/api/queries/useListingQuery.js +37 -22
  126. package/dist/esm/listing/api/queries/usePredicate.js +4 -4
  127. package/dist/esm/listing/components/BasicListingSEO.js +1 -1
  128. package/dist/esm/listing/hooks/useListingAlias.js +2 -4
  129. package/dist/esm/listing/hooks/useListingBreadcrumbs.js +5 -5
  130. package/dist/esm/listing/hooks/useListingCategories.js +8 -9
  131. package/dist/esm/listing/hooks/useListingConfig.js +5 -6
  132. package/dist/esm/listing/hooks/useListingFilters.js +19 -20
  133. package/dist/esm/listing/hooks/useListingItems.js +2 -2
  134. package/dist/esm/listing/hooks/useListingMeta.js +6 -5
  135. package/dist/esm/listing/hooks/useListingPagination.js +4 -4
  136. package/dist/esm/listing/hooks/useListingSlug.js +3 -1
  137. package/dist/esm/listing/hooks/useSlideFilter.js +5 -4
  138. package/dist/esm/listing/hooks/utils.js +2 -1
  139. package/dist/esm/listing/ssr/prefetchListing.js +4 -4
  140. package/dist/esm/listing/types.js +7 -0
  141. package/dist/esm/listing/utils/buildCategoryQuery.js +16 -12
  142. package/dist/esm/listing/utils/buildFilterQuery.js +5 -7
  143. package/dist/esm/listing/utils/getListingAlias.js +5 -6
  144. package/dist/esm/listing/utils/getListingPageType.js +4 -3
  145. package/dist/esm/navigation/components/SearchBox/Components/Container/index.js +1 -1
  146. package/dist/esm/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
  147. package/dist/esm/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
  148. package/dist/esm/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
  149. package/dist/esm/navigation/components/SearchBox/Components/Products/index.js +2 -2
  150. package/dist/esm/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
  151. package/dist/esm/navigation/components/SearchBox/index.js +11 -11
  152. package/dist/esm/order/api/mutations/index.js +1 -0
  153. package/dist/esm/order/api/mutations/useUpdateOrderCustomFieldMutation.js +10 -0
  154. package/dist/esm/order/hooks/index.js +1 -0
  155. package/dist/esm/order/hooks/useUpdateOrderCustomField.js +4 -0
  156. package/dist/esm/product/api/keys.js +6 -0
  157. package/dist/esm/product/api/queries/index.js +1 -0
  158. package/dist/esm/product/api/queries/useBnpOffersQuery.js +54 -0
  159. package/dist/esm/product/hooks/index.js +1 -0
  160. package/dist/esm/product/hooks/useBnpOffers.js +84 -0
  161. package/dist/esm/product/index.js +1 -0
  162. package/dist/esm/seo/components/GlobalSEO/index.js +3 -3
  163. package/dist/esm/user/api/queries/index.js +1 -0
  164. package/dist/esm/user/api/queries/useGetMyLoyaltyCardQuery.js +16 -0
  165. package/dist/esm/user/api/utils/getUserToken.js +6 -0
  166. package/dist/esm/user/api/utils/index.js +1 -0
  167. package/dist/esm/user/hooks/index.js +2 -0
  168. package/dist/esm/user/hooks/useGetMyLoyaltyCard.js +4 -0
  169. package/dist/esm/user/hooks/useGetUserToken.js +5 -0
  170. package/dist/types/api/myCartApi/index.d.ts +1 -0
  171. package/dist/types/basket/api/index.d.ts +1 -0
  172. package/dist/types/basket/api/mutations/index.d.ts +1 -0
  173. package/dist/types/basket/api/mutations/useReplaceBasketMutation.d.ts +2 -0
  174. package/dist/types/basket/hooks/index.d.ts +2 -0
  175. package/dist/types/basket/hooks/useBasketCrossSaleItems.d.ts +9 -0
  176. package/dist/types/basket/hooks/useReplaceBasket.d.ts +2 -0
  177. package/dist/types/basket/index.d.ts +1 -0
  178. package/dist/types/checkout/api/keys.d.ts +1 -0
  179. package/dist/types/checkout/api/queries/index.d.ts +1 -0
  180. package/dist/types/checkout/api/queries/useBnpCalculateForCartQuery.d.ts +4 -0
  181. package/dist/types/checkout/hooks/index.d.ts +1 -0
  182. package/dist/types/checkout/hooks/useBnpCalculateForCart.d.ts +39 -0
  183. package/dist/types/contexts/CheckoutForm/hooks/usePayment/index.d.ts +2 -0
  184. package/dist/types/contexts/CheckoutForm/index.d.ts +2 -1
  185. package/dist/types/hooks/order-hooks/useReferralOrders/index.d.ts +1 -0
  186. package/dist/types/hooks/useLineItem/index.d.ts +2 -2
  187. package/dist/types/hooks/useProduct/index.d.ts +1 -0
  188. package/dist/types/hooks/useProduct/utils/index.d.ts +1 -0
  189. package/dist/types/index.d.ts +3 -0
  190. package/dist/types/listing/api/queries/useAggregateQuery.d.ts +6 -4
  191. package/dist/types/listing/api/queries/useListingQuery.d.ts +4 -2
  192. package/dist/types/listing/api/queries/usePredicate.d.ts +2 -1
  193. package/dist/types/listing/hooks/useListingAlias.d.ts +2 -1
  194. package/dist/types/listing/hooks/useListingFilters.d.ts +0 -1
  195. package/dist/types/listing/hooks/useListingItems.d.ts +3 -2
  196. package/dist/types/listing/hooks/useListingSEOCategories.d.ts +6 -4
  197. package/dist/types/listing/hooks/utils.d.ts +3 -2
  198. package/dist/types/listing/ssr/prefetchCategories.d.ts +2 -2
  199. package/dist/types/listing/ssr/prefetchListing.d.ts +4 -4
  200. package/dist/types/listing/ssr/prefetchPredicate.d.ts +2 -1
  201. package/dist/types/listing/types.d.ts +32 -16
  202. package/dist/types/listing/utils/buildCategoryQuery.d.ts +2 -1
  203. package/dist/types/listing/utils/buildFilterQuery.d.ts +2 -1
  204. package/dist/types/listing/utils/extendFilter.d.ts +3 -2
  205. package/dist/types/listing/utils/getListingAlias.d.ts +2 -1
  206. package/dist/types/listing/utils/getListingPageType.d.ts +2 -2
  207. package/dist/types/navigation/components/SearchBox/Components/Container/index.d.ts +10 -9
  208. package/dist/types/navigation/components/SearchBox/Components/EmptyBox/index.d.ts +22 -21
  209. package/dist/types/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.d.ts +8 -7
  210. package/dist/types/navigation/components/SearchBox/Components/Products/index.d.ts +9 -8
  211. package/dist/types/navigation/components/SearchBox/index.d.ts +31 -30
  212. package/dist/types/order/api/mutations/index.d.ts +1 -0
  213. package/dist/types/order/api/mutations/useUpdateCustomLineItemMutation.d.ts +2 -5
  214. package/dist/types/order/api/mutations/useUpdateOrderCustomFieldMutation.d.ts +9 -0
  215. package/dist/types/order/hooks/index.d.ts +1 -0
  216. package/dist/types/order/hooks/useUpdateCustomLineItem.d.ts +2 -2
  217. package/dist/types/order/hooks/useUpdateOrderCustomField.d.ts +2 -0
  218. package/dist/types/product/api/keys.d.ts +1 -0
  219. package/dist/types/product/api/queries/index.d.ts +1 -0
  220. package/dist/types/product/api/queries/useBnpOffersQuery.d.ts +5 -0
  221. package/dist/types/product/hooks/index.d.ts +1 -0
  222. package/dist/types/product/hooks/useBnpOffers.d.ts +37 -0
  223. package/dist/types/product/index.d.ts +1 -0
  224. package/dist/types/types/index.d.ts +38 -40
  225. package/dist/types/user/api/queries/index.d.ts +1 -0
  226. package/dist/types/user/api/queries/useGetMyLoyaltyCardQuery.d.ts +5 -0
  227. package/dist/types/user/api/utils/getUserToken.d.ts +1 -0
  228. package/dist/types/user/api/utils/index.d.ts +1 -0
  229. package/dist/types/user/hooks/index.d.ts +2 -0
  230. package/dist/types/user/hooks/useGetMyLoyaltyCard.d.ts +2 -0
  231. package/dist/types/user/hooks/useGetUserToken.d.ts +1 -0
  232. package/dist/types/utils/getSelectedFilters.d.ts +2 -1
  233. package/package.json +19 -13
@@ -31,13 +31,13 @@ function GlobalSEO() {
31
31
  dangerouslySetInnerHTML: (0, _utils).createDangerousMarkup(organizationJSONLd)
32
32
  }), Boolean(defaultIcon) && /*#__PURE__*/ _react.default.createElement("link", {
33
33
  rel: "icon",
34
- href: defaultIcon
34
+ href: defaultIcon || ''
35
35
  }), Boolean(favicon === null || favicon === void 0 ? void 0 : favicon.svg) && /*#__PURE__*/ _react.default.createElement("link", {
36
36
  rel: "icon",
37
- href: favicon === null || favicon === void 0 ? void 0 : favicon.svg,
37
+ href: (favicon === null || favicon === void 0 ? void 0 : favicon.svg) || '',
38
38
  type: "image/svg+xml"
39
39
  }), Boolean(favicon === null || favicon === void 0 ? void 0 : favicon.medium) && /*#__PURE__*/ _react.default.createElement("link", {
40
40
  rel: "apple-touch-icon",
41
- href: favicon === null || favicon === void 0 ? void 0 : favicon.medium
41
+ href: (favicon === null || favicon === void 0 ? void 0 : favicon.medium) || ''
42
42
  })));
43
43
  }
@@ -1,9 +1,12 @@
1
1
  Object.defineProperty(exports, "__esModule", {
2
2
  value: true
3
3
  });
4
+ var _exportNames = {
5
+ };
4
6
  var _useIsAuthenticatedQuery = _interopRequireWildcard(require("./useIsAuthenticatedQuery"));
5
7
  Object.keys(_useIsAuthenticatedQuery).forEach(function(key) {
6
8
  if (key === "default" || key === "__esModule") return;
9
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
7
10
  if (key in exports && exports[key] === _useIsAuthenticatedQuery[key]) return;
8
11
  Object.defineProperty(exports, key, {
9
12
  enumerable: true,
@@ -12,6 +15,18 @@ Object.keys(_useIsAuthenticatedQuery).forEach(function(key) {
12
15
  }
13
16
  });
14
17
  });
18
+ var _useGetMyLoyaltyCardQuery = _interopRequireWildcard(require("./useGetMyLoyaltyCardQuery"));
19
+ Object.keys(_useGetMyLoyaltyCardQuery).forEach(function(key) {
20
+ if (key === "default" || key === "__esModule") return;
21
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
22
+ if (key in exports && exports[key] === _useGetMyLoyaltyCardQuery[key]) return;
23
+ Object.defineProperty(exports, key, {
24
+ enumerable: true,
25
+ get: function() {
26
+ return _useGetMyLoyaltyCardQuery[key];
27
+ }
28
+ });
29
+ });
15
30
  function _interopRequireWildcard(obj) {
16
31
  if (obj && obj.__esModule) {
17
32
  return obj;
@@ -0,0 +1,21 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.useGetMyLoyaltyCardQuery = void 0;
5
+ var _sdk = require("@sentecacommerce/sdk");
6
+ var _reactQuery = require("react-query");
7
+ var useGetMyLoyaltyCardQuery = function(callback) {
8
+ return (0, _reactQuery).useQuery('get-loyalty-card-key', function() {
9
+ return (0, _sdk).MyWalletGetByType('loyalty-program');
10
+ }, {
11
+ onSuccess: function() {
12
+ var ref;
13
+ return callback === null || callback === void 0 ? void 0 : (ref = callback.onSuccess) === null || ref === void 0 ? void 0 : ref.call(callback);
14
+ },
15
+ onError: function(err) {
16
+ var ref;
17
+ return callback === null || callback === void 0 ? void 0 : (ref = callback.onError) === null || ref === void 0 ? void 0 : ref.call(callback, err);
18
+ }
19
+ });
20
+ };
21
+ exports.useGetMyLoyaltyCardQuery = useGetMyLoyaltyCardQuery;
@@ -0,0 +1,16 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.getUserToken = void 0;
5
+ var _jsCookie = _interopRequireDefault(require("js-cookie"));
6
+ var _index = require("../../../index");
7
+ function _interopRequireDefault(obj) {
8
+ return obj && obj.__esModule ? obj : {
9
+ default: obj
10
+ };
11
+ }
12
+ var ref;
13
+ var getUserToken = function() {
14
+ return (ref = _jsCookie.default.get(_index.AUTH_TOKEN_KEY)) !== null && ref !== void 0 ? ref : _jsCookie.default.get(_index.ANONYMOUS_TOKEN_KEY);
15
+ };
16
+ exports.getUserToken = getUserToken;
@@ -51,6 +51,18 @@ Object.keys(_generateAnonymousToken).forEach(function(key) {
51
51
  }
52
52
  });
53
53
  });
54
+ var _getUserToken = _interopRequireWildcard(require("./getUserToken"));
55
+ Object.keys(_getUserToken).forEach(function(key) {
56
+ if (key === "default" || key === "__esModule") return;
57
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
58
+ if (key in exports && exports[key] === _getUserToken[key]) return;
59
+ Object.defineProperty(exports, key, {
60
+ enumerable: true,
61
+ get: function() {
62
+ return _getUserToken[key];
63
+ }
64
+ });
65
+ });
54
66
  function _interopRequireWildcard(obj) {
55
67
  if (obj && obj.__esModule) {
56
68
  return obj;
@@ -183,6 +183,30 @@ Object.keys(_useRequestEmailConfirmation).forEach(function(key) {
183
183
  }
184
184
  });
185
185
  });
186
+ var _useGetUserToken = _interopRequireWildcard(require("./useGetUserToken"));
187
+ Object.keys(_useGetUserToken).forEach(function(key) {
188
+ if (key === "default" || key === "__esModule") return;
189
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
190
+ if (key in exports && exports[key] === _useGetUserToken[key]) return;
191
+ Object.defineProperty(exports, key, {
192
+ enumerable: true,
193
+ get: function() {
194
+ return _useGetUserToken[key];
195
+ }
196
+ });
197
+ });
198
+ var _useGetMyLoyaltyCard = _interopRequireWildcard(require("./useGetMyLoyaltyCard"));
199
+ Object.keys(_useGetMyLoyaltyCard).forEach(function(key) {
200
+ if (key === "default" || key === "__esModule") return;
201
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
202
+ if (key in exports && exports[key] === _useGetMyLoyaltyCard[key]) return;
203
+ Object.defineProperty(exports, key, {
204
+ enumerable: true,
205
+ get: function() {
206
+ return _useGetMyLoyaltyCard[key];
207
+ }
208
+ });
209
+ });
186
210
  function _interopRequireWildcard(obj) {
187
211
  if (obj && obj.__esModule) {
188
212
  return obj;
@@ -0,0 +1,9 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.useGetMyLoyaltyCard = void 0;
5
+ var _api = require("../api");
6
+ var useGetMyLoyaltyCard = function(callback) {
7
+ return (0, _api).useGetMyLoyaltyCardQuery(callback);
8
+ };
9
+ exports.useGetMyLoyaltyCard = useGetMyLoyaltyCard;
@@ -0,0 +1,15 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.useGetUserToken = void 0;
5
+ var _react = _interopRequireDefault(require("react"));
6
+ var _api = require("../api");
7
+ function _interopRequireDefault(obj) {
8
+ return obj && obj.__esModule ? obj : {
9
+ default: obj
10
+ };
11
+ }
12
+ var useGetUserToken = function() {
13
+ return (0, _api).getUserToken();
14
+ };
15
+ exports.useGetUserToken = useGetUserToken;
@@ -40,7 +40,7 @@ export var usePixelProductClick = function() {
40
40
  var pixel = window.pixel;
41
41
  pixel.productClick(product, _objectSpread({
42
42
  }, info, {
43
- merchantKey: defaultMerchant
43
+ merchantKey: defaultMerchant || ''
44
44
  }));
45
45
  }
46
46
  };
@@ -50,7 +50,7 @@ export var usePixelProductDetails = function() {
50
50
  id: metaData._id,
51
51
  sku: selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.sku
52
52
  }, {
53
- merchantKey: defaultMerchant
53
+ merchantKey: defaultMerchant || ''
54
54
  });
55
55
  setSentData.on();
56
56
  }
@@ -66,7 +66,7 @@ export var usePixelProductsImpression = function(param) {
66
66
  products: products
67
67
  }
68
68
  ] : productsData, {
69
- merchantKey: defaultMerchant
69
+ merchantKey: defaultMerchant || ''
70
70
  });
71
71
  };
72
72
  sendImpressions();
@@ -57,7 +57,6 @@ function _objectSpread(target) {
57
57
  }
58
58
  return target;
59
59
  }
60
- ;
61
60
  (function(global) {
62
61
  var log = function log(message) {
63
62
  if (debug) {
@@ -30,7 +30,7 @@ export var usePixel = function() {
30
30
  var product = param.product, currencyCode = param.currencyCode;
31
31
  pixel === null || pixel === void 0 ? void 0 : pixel.addLineItem(product, {
32
32
  currencyCode: currencyCode,
33
- merchantKey: defaultMerchant
33
+ merchantKey: defaultMerchant || ''
34
34
  });
35
35
  };
36
36
  var pixelRemoveLineItem = function(param) {
@@ -156,7 +156,7 @@ export var RelevaProvider = function(param1) {
156
156
  var ref3, ref4;
157
157
  var token = (ref4 = (ref3 = Cookies.get('token')) !== null && ref3 !== void 0 ? ref3 : Cookies.get('anonymousToken')) !== null && ref4 !== void 0 ? ref4 : process.env.API_KEY;
158
158
  var interfaceKey = useConfigState().interfaceKey;
159
- var ref5 = useRelevaData(payload, isReady, token, interfaceKey), recommenders = ref5.recommenders, banners = ref5.banners, pixelData = ref5.pixelData;
159
+ var ref5 = useRelevaData(payload, isReady, token, interfaceKey || ''), recommenders = ref5.recommenders, banners = ref5.banners, pixelData = ref5.pixelData;
160
160
  var values = {
161
161
  onProductPage: onProductPage,
162
162
  changeProfileData: changeProfileData,
@@ -4,7 +4,6 @@ export var addToCart = function(sku, quantity, price) {
4
4
  var value = decodePrice(price) * quantity;
5
5
  var currency = price.currencyCode;
6
6
  window.fbq('track', 'AddToCart', {
7
- // eslint-disable-next-line @typescript-eslint/camelcase
8
7
  content_type: 'product',
9
8
  value: value,
10
9
  currency: currency,
@@ -10,7 +10,6 @@ export var initiateCheckout = function(order) {
10
10
  var currency = order.currencyCode;
11
11
  var value = decodePrice(order.grandTotalPrice);
12
12
  window.fbq('track', 'InitiateCheckout', {
13
- // eslint-disable-next-line @typescript-eslint/camelcase
14
13
  content_type: 'product',
15
14
  contents: contents,
16
15
  currency: currency,
@@ -1,4 +1,4 @@
1
- /* eslint-disable @typescript-eslint/camelcase */ import { useConfigState } from '../hooks/useConfig';
1
+ import { useConfigState } from '../hooks/useConfig';
2
2
  export var usePageView = function() {
3
3
  var config = useConfigState();
4
4
  return function(url, title) {
@@ -4,7 +4,6 @@ export var viewContent = function(data) {
4
4
  var quantity = data.quantity, price = data.price, currency = data.currencyCode, id = data.sku;
5
5
  var value = price * quantity;
6
6
  window.fbq('track', 'ViewContent', {
7
- // eslint-disable-next-line @typescript-eslint/camelcase
8
7
  content_type: 'product',
9
8
  value: value,
10
9
  currency: currency,
@@ -42,7 +42,8 @@ export var myCartCacheKeys = {
42
42
  useGetShippingMethods: 'mycart-api-use-get-shippingmethods',
43
43
  useGetAllShippingMethods: 'mycart-api-use-get-all-shippingmethods',
44
44
  useGetPaymentMethods: 'mycart-api-use-get-paymentmethods',
45
- useIsExisting: 'mycart-api-is-existing'
45
+ useIsExisting: 'mycart-api-is-existing',
46
+ useGetCrossSaleItems: 'mycart-api-use-get-cross-sale-products'
46
47
  };
47
48
  var LineItemType1;
48
49
  (function(LineItemType) {
@@ -7,7 +7,7 @@ export function useSetMerchantPaymentMethod(onSuccess) {
7
7
  var config = useConfigState();
8
8
  return useMutation(function(values) {
9
9
  return MyCartSetMerchantsPaymentMethods({
10
- methods: formatData(values, config.defaultMerchant)
10
+ methods: formatData(values, config.defaultMerchant || '')
11
11
  });
12
12
  }, {
13
13
  onMutate: function() {
@@ -0,0 +1 @@
1
+ export * from './mutations';
@@ -0,0 +1 @@
1
+ export * from './useReplaceBasketMutation';
@@ -0,0 +1,48 @@
1
+ import regeneratorRuntime from "regenerator-runtime";
2
+ import React from 'react';
3
+ import { useMutation, useQueryCache } from 'react-query';
4
+ import { myCartCacheKeys } from '../../../index';
5
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
6
+ try {
7
+ var info = gen[key](arg);
8
+ var value = info.value;
9
+ } catch (error) {
10
+ reject(error);
11
+ return;
12
+ }
13
+ if (info.done) {
14
+ resolve(value);
15
+ } else {
16
+ Promise.resolve(value).then(_next, _throw);
17
+ }
18
+ }
19
+ function _asyncToGenerator(fn) {
20
+ return function() {
21
+ var self = this, args = arguments;
22
+ return new Promise(function(resolve, reject) {
23
+ var gen = fn.apply(self, args);
24
+ function _next(value) {
25
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
26
+ }
27
+ function _throw(err) {
28
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
29
+ }
30
+ _next(undefined);
31
+ });
32
+ };
33
+ }
34
+ export var useReplaceBasketMutation = function() {
35
+ var queryCache = useQueryCache();
36
+ return useMutation(_asyncToGenerator(regeneratorRuntime.mark(function _callee(newBasket) {
37
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
38
+ while(1)switch(_ctx.prev = _ctx.next){
39
+ case 0:
40
+ queryCache.setQueryData(myCartCacheKeys.useGet, newBasket);
41
+ queryCache.setQueryData(myCartCacheKeys.useGetCompact, newBasket.compact);
42
+ case 2:
43
+ case "end":
44
+ return _ctx.stop();
45
+ }
46
+ }, _callee);
47
+ })));
48
+ };
@@ -0,0 +1,2 @@
1
+ export * from './useReplaceBasket';
2
+ export * from './useBasketCrossSaleItems';
@@ -0,0 +1,67 @@
1
+ import regeneratorRuntime from "regenerator-runtime";
2
+ import React, { useMemo } from 'react';
3
+ import { useQuery } from 'react-query';
4
+ import { MyCartGetCrossSaleProducts } from '@sentecacommerce/sdk';
5
+ import { getTranslatableField } from '../../index';
6
+ import { myCartCacheKeys } from '../../index';
7
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
8
+ try {
9
+ var info = gen[key](arg);
10
+ var value = info.value;
11
+ } catch (error) {
12
+ reject(error);
13
+ return;
14
+ }
15
+ if (info.done) {
16
+ resolve(value);
17
+ } else {
18
+ Promise.resolve(value).then(_next, _throw);
19
+ }
20
+ }
21
+ function _asyncToGenerator(fn) {
22
+ return function() {
23
+ var self = this, args = arguments;
24
+ return new Promise(function(resolve, reject) {
25
+ var gen = fn.apply(self, args);
26
+ function _next(value) {
27
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
28
+ }
29
+ function _throw(err) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
31
+ }
32
+ _next(undefined);
33
+ });
34
+ };
35
+ }
36
+ export var useBasketCrossSaleItems = function() {
37
+ var crossSaleProducts = useQuery(myCartCacheKeys.useGetCrossSaleItems, _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 MyCartGetCrossSaleProducts();
43
+ case 2:
44
+ return _ctx.abrupt("return", _ctx.sent);
45
+ case 3:
46
+ case "end":
47
+ return _ctx.stop();
48
+ }
49
+ }, _callee);
50
+ })));
51
+ return useMemo(function() {
52
+ var ref;
53
+ return crossSaleProducts === null || crossSaleProducts === void 0 ? void 0 : (ref = crossSaleProducts.data) === null || ref === void 0 ? void 0 : ref.map(function(product) {
54
+ return {
55
+ name: getTranslatableField(product.name),
56
+ description: getTranslatableField(product.description),
57
+ slug: getTranslatableField(product.slug),
58
+ attributeRules: product.attributeRules,
59
+ attributes: product.attributes,
60
+ _id: product._id,
61
+ variants: product.variants
62
+ };
63
+ });
64
+ }, [
65
+ crossSaleProducts === null || crossSaleProducts === void 0 ? void 0 : crossSaleProducts.data
66
+ ]);
67
+ };
@@ -0,0 +1,2 @@
1
+ import { useReplaceBasketMutation } from '../api';
2
+ export { useReplaceBasketMutation as useReplaceBasket };
@@ -0,0 +1 @@
1
+ export * from './hooks';
@@ -5,3 +5,9 @@ export var CheckoutQueryKeysEnum;
5
5
  export var getVerifyBoricaResponseKey = function(order) {
6
6
  return "Borica Response for Order: ".concat(order);
7
7
  };
8
+ export var getBnpLoanCalculatorKey = function(preferredInstallmentCentAmount) {
9
+ return [
10
+ 'bnp-loan-calculator',
11
+ preferredInstallmentCentAmount
12
+ ];
13
+ };
@@ -1 +1,2 @@
1
1
  export * from './useVerifyBoricaResponseQuery';
2
+ export * from './useBnpCalculateForCartQuery';
@@ -0,0 +1,50 @@
1
+ import regeneratorRuntime from "regenerator-runtime";
2
+ import React from 'react';
3
+ import { useQuery } from 'react-query';
4
+ import { MyPaymentsBnpCalculateLoanOrder } from '@sentecacommerce/sdk';
5
+ import { getBnpLoanCalculatorKey } 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 useBnpCalculateForCartQuery = function(props) {
36
+ return useQuery(getBnpLoanCalculatorKey(props.preferredInstallmentCentAmount), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
37
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
38
+ while(1)switch(_ctx.prev = _ctx.next){
39
+ case 0:
40
+ _ctx.next = 2;
41
+ return MyPaymentsBnpCalculateLoanOrder(props);
42
+ case 2:
43
+ return _ctx.abrupt("return", _ctx.sent);
44
+ case 3:
45
+ case "end":
46
+ return _ctx.stop();
47
+ }
48
+ }, _callee);
49
+ })));
50
+ };
@@ -1 +1,2 @@
1
1
  export * from './useVerifyBoricaResponse';
2
+ export * from './useBnpCalculateForCart';
@@ -0,0 +1,92 @@
1
+ import React, { useMemo } from 'react';
2
+ import { useBnpCalculateForCartQuery } from '../api';
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 useBnpCalculateForCart = function(props) {
34
+ var ref8, ref1, ref2, ref3;
35
+ var ref4 = props !== null && props !== void 0 ? props : {
36
+ }, _preferredInstallmentCentAmount = ref4.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = ref4.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
37
+ var response = useBnpCalculateForCartQuery({
38
+ preferredInstallmentCentAmount: preferredInstallmentCentAmount,
39
+ downPaymentCentAmount: downPaymentCentAmount
40
+ });
41
+ var configLocale = ((ref8 = useConfigState()) === null || ref8 === void 0 ? void 0 : (ref1 = ref8.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
42
+ return useMemo(function() {
43
+ var ref, ref5, ref6, ref7;
44
+ return _objectSpread({
45
+ }, response, {
46
+ data: _objectSpread({
47
+ }, response === null || response === void 0 ? void 0 : (ref = response.data) === null || ref === void 0 ? void 0 : ref[0], {
48
+ 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) {
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({
78
+ }, 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
+ })
88
+ });
89
+ }, [
90
+ 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
91
+ ]);
92
+ };
@@ -1,5 +1,5 @@
1
1
  import regeneratorRuntime from "regenerator-runtime";
2
- /* eslint-disable @typescript-eslint/camelcase */ import React, { useCallback } from 'react';
2
+ import React, { useCallback } from 'react';
3
3
  import Cookies from 'js-cookie';
4
4
  import { useLoginGoogle } from '../..';
5
5
  import { ExternalScript } from '../ExternalScript';
@@ -23,7 +23,7 @@ export var Html = function(param) {
23
23
  containerRef.current.querySelectorAll('a').forEach(function(a) {
24
24
  var ref;
25
25
  if (!((ref = a.href) === null || ref === void 0 ? void 0 : ref.trim())) return;
26
- var isHrefLocal = a.href[0] === '/' || a.href.includes(domain);
26
+ var isHrefLocal = a.href[0] === '/' || domain && a.href.includes(domain);
27
27
  if (isHrefLocal) {
28
28
  a.addEventListener('click', cb);
29
29
  links.push(a);
@@ -14,7 +14,7 @@ var Portal = function(param) {
14
14
  // In that case, it's important to append to the correct document element.
15
15
  var ownerDocument = mountNode.current.ownerDocument;
16
16
  portalNode.current = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.createElement(type);
17
- ownerDocument.body.appendChild(portalNode.current);
17
+ ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.appendChild(portalNode.current);
18
18
  forceUpdate();
19
19
  return function() {
20
20
  if (portalNode.current && portalNode.current.ownerDocument) {
@@ -35,6 +35,8 @@ function _slicedToArray(arr, i) {
35
35
  export var usePayment = function(param) {
36
36
  var orderQuery = param.orderQuery, errorLabels = param.errorLabels, enabled = param.enabled;
37
37
  var ref = _slicedToArray(useState(false), 2), isPaymentSubmitting = ref[0], setIsPaymentSubmitting = ref[1];
38
+ var ref1 = _slicedToArray(useState({
39
+ }), 2), loanInfo = ref1[0], setLoanInfo = ref1[1];
38
40
  var paymentMethods = useCheckoutPayment({
39
41
  query: orderQuery,
40
42
  enabled: enabled
@@ -46,11 +48,14 @@ export var usePayment = function(param) {
46
48
  errors: isPaymentSubmitting ? paymentErrors : null,
47
49
  isValid: !paymentErrors,
48
50
  updateIsSubmitting: setIsPaymentSubmitting,
49
- paymentMethods: paymentMethods
51
+ updateLoanInfo: setLoanInfo,
52
+ paymentMethods: paymentMethods,
53
+ loanInfo: loanInfo
50
54
  };
51
55
  }, [
52
56
  paymentMethods,
53
57
  paymentErrors,
54
- isPaymentSubmitting
58
+ isPaymentSubmitting,
59
+ loanInfo
55
60
  ]);
56
61
  };