addio-ecomm-sdk 1.3.78 → 1.3.79

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 (107) hide show
  1. package/.vscode/settings.json +34 -34
  2. package/README.md +79 -79
  3. package/dist/index.d.ts +203 -203
  4. package/dist/index.js +1237 -1237
  5. package/dist/lib/constants/components/CreditCardInput.d.ts +11 -11
  6. package/dist/lib/constants/components/CreditCardInput.js +65 -65
  7. package/dist/lib/constants/components/Snackbar.d.ts +11 -11
  8. package/dist/lib/constants/components/Snackbar.js +29 -29
  9. package/dist/lib/constants/contexts/CartContext/CartContextProvider.d.ts +7 -7
  10. package/dist/lib/constants/contexts/CartContext/CartContextProvider.js +640 -640
  11. package/dist/lib/constants/contexts/CartContext/CartContextProvider.js.map +1 -1
  12. package/dist/lib/constants/contexts/CartContext/index.d.ts +79 -79
  13. package/dist/lib/constants/contexts/CartContext/index.js +47 -47
  14. package/dist/lib/constants/contexts/DataContext/DataContextProvider.d.ts +15 -15
  15. package/dist/lib/constants/contexts/DataContext/DataContextProvider.js +173 -173
  16. package/dist/lib/constants/contexts/DataContext/index.d.ts +47 -47
  17. package/dist/lib/constants/contexts/DataContext/index.js +27 -27
  18. package/dist/lib/constants/contexts/LogContext/LogContextProvider.d.ts +6 -6
  19. package/dist/lib/constants/contexts/LogContext/LogContextProvider.js +40 -40
  20. package/dist/lib/constants/contexts/LogContext/index.d.ts +7 -7
  21. package/dist/lib/constants/contexts/LogContext/index.js +7 -7
  22. package/dist/lib/constants/contexts/ModalContext/ModalContextProvider.d.ts +7 -7
  23. package/dist/lib/constants/contexts/ModalContext/ModalContextProvider.js +61 -61
  24. package/dist/lib/constants/contexts/ModalContext/index.d.ts +14 -14
  25. package/dist/lib/constants/contexts/ModalContext/index.js +16 -16
  26. package/dist/lib/constants/contexts/SDKContext/SDKProvider.d.ts +8 -8
  27. package/dist/lib/constants/contexts/SDKContext/SDKProvider.js +23 -23
  28. package/dist/lib/constants/contexts/SDKContext/index.d.ts +4 -4
  29. package/dist/lib/constants/contexts/SDKContext/index.js +4 -4
  30. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContext.d.ts +4 -4
  31. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContext.js +6 -6
  32. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContextProvider.d.ts +12 -12
  33. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContextProvider.js +38 -38
  34. package/dist/lib/constants/contexts/SnackbarContext/interfaces/ISnackbarContext.d.ts +19 -19
  35. package/dist/lib/constants/contexts/SnackbarContext/interfaces/ISnackbarContext.js +21 -21
  36. package/dist/lib/constants/contexts/StockNotifContext/StockNotifContextProvider.d.ts +7 -7
  37. package/dist/lib/constants/contexts/StockNotifContext/StockNotifContextProvider.js +112 -112
  38. package/dist/lib/constants/contexts/StockNotifContext/index.d.ts +10 -10
  39. package/dist/lib/constants/contexts/StockNotifContext/index.js +10 -10
  40. package/dist/lib/constants/contexts/UserContext/UserContextProvider.d.ts +5 -5
  41. package/dist/lib/constants/contexts/UserContext/UserContextProvider.js +313 -313
  42. package/dist/lib/constants/contexts/UserContext/index.d.ts +54 -54
  43. package/dist/lib/constants/contexts/UserContext/index.js +28 -28
  44. package/dist/lib/constants/contexts/WishlistContext/WishlistContextProvider.d.ts +6 -6
  45. package/dist/lib/constants/contexts/WishlistContext/WishlistContextProvider.js +231 -231
  46. package/dist/lib/constants/contexts/WishlistContext/index.d.ts +12 -12
  47. package/dist/lib/constants/contexts/WishlistContext/index.js +12 -12
  48. package/dist/lib/constants/hooks/useCart.d.ts +2 -2
  49. package/dist/lib/constants/hooks/useCart.js +11 -11
  50. package/dist/lib/constants/hooks/useData.d.ts +2 -2
  51. package/dist/lib/constants/hooks/useData.js +11 -11
  52. package/dist/lib/constants/hooks/useLogs.d.ts +2 -2
  53. package/dist/lib/constants/hooks/useLogs.js +11 -11
  54. package/dist/lib/constants/hooks/useModal.d.ts +2 -2
  55. package/dist/lib/constants/hooks/useModal.js +11 -11
  56. package/dist/lib/constants/hooks/useSDK.d.ts +2 -2
  57. package/dist/lib/constants/hooks/useSDK.js +11 -11
  58. package/dist/lib/constants/hooks/useSnackbar.d.ts +2 -2
  59. package/dist/lib/constants/hooks/useSnackbar.js +11 -11
  60. package/dist/lib/constants/hooks/useStockNotif.d.ts +2 -2
  61. package/dist/lib/constants/hooks/useStockNotif.js +11 -11
  62. package/dist/lib/constants/hooks/useUser.d.ts +2 -2
  63. package/dist/lib/constants/hooks/useUser.js +11 -11
  64. package/dist/lib/constants/hooks/useWishlist.d.ts +2 -2
  65. package/dist/lib/constants/hooks/useWishlist.js +11 -11
  66. package/dist/lib/models/image/index.d.ts +6 -6
  67. package/dist/lib/models/image/index.js +10 -10
  68. package/dist/lib/models/stockNotification/index.d.ts +13 -13
  69. package/dist/lib/models/stockNotification/index.js +70 -70
  70. package/dist/lib/models/wishlist/index.d.ts +14 -14
  71. package/dist/lib/models/wishlist/index.js +86 -86
  72. package/dist/utils/StripeErrors.d.ts +24 -24
  73. package/dist/utils/StripeErrors.js +55 -55
  74. package/dist/utils/algolia.d.ts +3 -3
  75. package/dist/utils/algolia.js +35 -35
  76. package/dist/utils/analytics.d.ts +71 -71
  77. package/dist/utils/analytics.js +246 -246
  78. package/dist/utils/cart.d.ts +3 -3
  79. package/dist/utils/cart.js +65 -65
  80. package/dist/utils/contentful.d.ts +10 -10
  81. package/dist/utils/contentful.js +63 -63
  82. package/dist/utils/functions.d.ts +21 -21
  83. package/dist/utils/functions.js +183 -183
  84. package/dist/utils/getSDK.d.ts +4 -4
  85. package/dist/utils/getSDK.js +19 -19
  86. package/dist/utils/initStoreData.d.ts +3 -3
  87. package/dist/utils/initStoreData.js +17 -17
  88. package/dist/utils/interfaces/IClientCMSData.d.ts +132 -132
  89. package/dist/utils/interfaces/IClientCMSData.js +2 -2
  90. package/dist/utils/interfaces/IEndpointResult.d.ts +10 -10
  91. package/dist/utils/interfaces/IEndpointResult.js +2 -2
  92. package/dist/utils/interfaces/IFacebookUserProfile.d.ts +10 -10
  93. package/dist/utils/interfaces/IFacebookUserProfile.js +2 -2
  94. package/dist/utils/interfaces/IFilter.d.ts +23 -23
  95. package/dist/utils/interfaces/IFilter.js +2 -2
  96. package/dist/utils/interfaces/IGoogleUserProfile.d.ts +7 -7
  97. package/dist/utils/interfaces/IGoogleUserProfile.js +2 -2
  98. package/dist/utils/interfaces/ISDKConfig.d.ts +7 -7
  99. package/dist/utils/interfaces/ISDKConfig.js +2 -2
  100. package/dist/utils/interfaces/ISpaceData.d.ts +18 -18
  101. package/dist/utils/interfaces/ISpaceData.js +2 -2
  102. package/dist/utils/larivieremeunier.d.ts +3 -3
  103. package/dist/utils/larivieremeunier.js +156 -156
  104. package/dist/utils/technosupply.d.ts +3 -3
  105. package/dist/utils/technosupply.js +155 -155
  106. package/package.json +61 -61
  107. package/publish.sh +132 -132
@@ -1,174 +1,174 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const jsx_runtime_1 = require("react/jsx-runtime");
30
- const toNumber_1 = __importDefault(require("lodash/toNumber"));
31
- const react_1 = require("react");
32
- const _1 = __importStar(require("."));
33
- const useSDK_1 = __importDefault(require("../../hooks/useSDK"));
34
- const functions_1 = require("../../../../utils/functions");
35
- function DataContextProvider({ spaceData, children, maintenanceComponent, ssrStoreData, ssrCategories, ssrAttributes, ssrBrands }) {
36
- const sdk = (0, useSDK_1.default)();
37
- const api = !!sdk ? sdk.getAPIInfos() : null;
38
- const [state, setState] = (0, react_1.useState)(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, _1.getDefaultDataContext)()), (!!spaceData ? spaceData : {})), (!!ssrStoreData ? { data: ssrStoreData } : {})), (!!ssrCategories ? { categories: ssrCategories, categoryTree: (0, functions_1.printTree)(ssrCategories) } : {})), (!!ssrAttributes ? { attributes: ssrAttributes } : {})), (!!ssrBrands ? { brands: ssrBrands } : {})));
39
- const [fetchingContent, setFetchingContent] = (0, react_1.useState)(false);
40
- const setCurrency = (currency) => {
41
- setState((prevstate) => (Object.assign(Object.assign({}, prevstate), { currency: currency })));
42
- };
43
- const calculateAmountByCurrency = (amountToCalculate) => {
44
- const formatPrice = (price) => {
45
- try {
46
- if ((0, toNumber_1.default)(price) === 0)
47
- return '0';
48
- return (0, toNumber_1.default)(price).toFixed(2);
49
- }
50
- catch (error) {
51
- console.log(`error while formating number`, error);
52
- return `${price}`;
53
- }
54
- };
55
- if (state.currency === state.defaultCurrency)
56
- return formatPrice((0, toNumber_1.default)(amountToCalculate));
57
- const allCurrencies = state.exchangeRates;
58
- if (!!!allCurrencies)
59
- return formatPrice((0, toNumber_1.default)(amountToCalculate));
60
- const currencyRate = (0, toNumber_1.default)(state.exchangeRates.rates[state.currency] || 1);
61
- const storeCurrencyRate = (0, toNumber_1.default)(allCurrencies.rates[state.defaultCurrency] || 1);
62
- return formatPrice((amountToCalculate / storeCurrencyRate) * currencyRate);
63
- };
64
- const fetchProductSDK = async (slug, locale = 'fr', useFeeArray, noDrafts) => {
65
- if (!!!sdk)
66
- return;
67
- try {
68
- const prod = await sdk.products.getProduct(slug, locale, !!useFeeArray ? state.fees : undefined, noDrafts);
69
- return prod;
70
- }
71
- catch (e) {
72
- console.log('Error on fetching product from DB: ', e.toString());
73
- }
74
- };
75
- (0, react_1.useEffect)(() => {
76
- if (!!!sdk)
77
- return;
78
- const getContent = async () => {
79
- let data = undefined;
80
- let categories = [];
81
- let categoryTree = [];
82
- let attributes = [];
83
- let brands = [];
84
- let fees = [];
85
- try {
86
- data = !!!ssrStoreData ? await sdk.initStoreData(spaceData) : ssrStoreData;
87
- }
88
- catch (e) {
89
- console.log('error on fetching data for space: ', e.toString());
90
- setFetchingContent(false);
91
- }
92
- try {
93
- categories = !!!ssrCategories
94
- ? !!state.categories && !!state.categories.length
95
- ? state.categories
96
- : (await sdk.products.getCategories()) || []
97
- : ssrCategories;
98
- if (!!categories.length) {
99
- categoryTree = (0, functions_1.printTree)(categories);
100
- }
101
- }
102
- catch (e) {
103
- console.log('error on fetching categories for space: ', e.toString());
104
- setFetchingContent(false);
105
- }
106
- try {
107
- attributes = !!!ssrAttributes
108
- ? !!state.attributes && !!state.attributes.length
109
- ? state.attributes
110
- : (await sdk.products.getAttributes()) || []
111
- : ssrAttributes;
112
- }
113
- catch (e) {
114
- console.log('error on fetching attributes for space: ', e.toString());
115
- setFetchingContent(false);
116
- }
117
- try {
118
- brands = !!!ssrBrands
119
- ? !!state.brands && !!state.brands.length
120
- ? state.brands
121
- : (await sdk.products.getBrands()) || []
122
- : ssrBrands;
123
- }
124
- catch (e) {
125
- console.log('error on fetching brands for space: ', e.toString());
126
- setFetchingContent(false);
127
- }
128
- try {
129
- fees =
130
- !!state.fees && state.fees.length
131
- ? state.fees
132
- : !!api && api.org === 'gr'
133
- ? (await sdk.products.getFees()) || []
134
- : [];
135
- }
136
- catch (e) {
137
- console.log('error on fetching fees for space: ', e.toString());
138
- setFetchingContent(false);
139
- }
140
- setState((prevState) => (Object.assign(Object.assign(Object.assign({}, prevState), (!!data ? data : {})), { categories,
141
- categoryTree,
142
- attributes,
143
- brands,
144
- fees })));
145
- setFetchingContent(false);
146
- };
147
- if (!fetchingContent) {
148
- setFetchingContent(true);
149
- getContent();
150
- }
151
- }, [sdk, state.currency]);
152
- (0, react_1.useEffect)(() => {
153
- const storageCurrency = localStorage.getItem('currency');
154
- if ((!!storageCurrency && storageCurrency === 'CAD') || storageCurrency === 'USD') {
155
- setCurrency(storageCurrency);
156
- }
157
- else {
158
- localStorage.setItem('currency', state.currency);
159
- }
160
- }, []);
161
- (0, react_1.useEffect)(() => {
162
- if ((!!state.currency && state.currency === 'CAD') || state.currency === 'USD') {
163
- localStorage.setItem('currency', state.currency);
164
- }
165
- }, [state.currency]);
166
- return ((0, jsx_runtime_1.jsx)(_1.default.Provider, Object.assign({ value: Object.assign(Object.assign({}, state), { calculateAmountByCurrency: calculateAmountByCurrency, setCurrency: setCurrency, fetchProductSDK: fetchProductSDK }) }, { children: !!state.website_in_maintenance &&
167
- !!maintenanceComponent &&
168
- !!!process.env.IS_TEST_ENV &&
169
- !!!process.env.IS_STAGING
170
- ? maintenanceComponent
171
- : children })));
172
- }
173
- exports.default = DataContextProvider;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const jsx_runtime_1 = require("react/jsx-runtime");
30
+ const toNumber_1 = __importDefault(require("lodash/toNumber"));
31
+ const react_1 = require("react");
32
+ const _1 = __importStar(require("."));
33
+ const useSDK_1 = __importDefault(require("../../hooks/useSDK"));
34
+ const functions_1 = require("../../../../utils/functions");
35
+ function DataContextProvider({ spaceData, children, maintenanceComponent, ssrStoreData, ssrCategories, ssrAttributes, ssrBrands }) {
36
+ const sdk = (0, useSDK_1.default)();
37
+ const api = !!sdk ? sdk.getAPIInfos() : null;
38
+ const [state, setState] = (0, react_1.useState)(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, _1.getDefaultDataContext)()), (!!spaceData ? spaceData : {})), (!!ssrStoreData ? { data: ssrStoreData } : {})), (!!ssrCategories ? { categories: ssrCategories, categoryTree: (0, functions_1.printTree)(ssrCategories) } : {})), (!!ssrAttributes ? { attributes: ssrAttributes } : {})), (!!ssrBrands ? { brands: ssrBrands } : {})));
39
+ const [fetchingContent, setFetchingContent] = (0, react_1.useState)(false);
40
+ const setCurrency = (currency) => {
41
+ setState((prevstate) => (Object.assign(Object.assign({}, prevstate), { currency: currency })));
42
+ };
43
+ const calculateAmountByCurrency = (amountToCalculate) => {
44
+ const formatPrice = (price) => {
45
+ try {
46
+ if ((0, toNumber_1.default)(price) === 0)
47
+ return '0';
48
+ return (0, toNumber_1.default)(price).toFixed(2);
49
+ }
50
+ catch (error) {
51
+ console.log(`error while formating number`, error);
52
+ return `${price}`;
53
+ }
54
+ };
55
+ if (state.currency === state.defaultCurrency)
56
+ return formatPrice((0, toNumber_1.default)(amountToCalculate));
57
+ const allCurrencies = state.exchangeRates;
58
+ if (!!!allCurrencies)
59
+ return formatPrice((0, toNumber_1.default)(amountToCalculate));
60
+ const currencyRate = (0, toNumber_1.default)(state.exchangeRates.rates[state.currency] || 1);
61
+ const storeCurrencyRate = (0, toNumber_1.default)(allCurrencies.rates[state.defaultCurrency] || 1);
62
+ return formatPrice((amountToCalculate / storeCurrencyRate) * currencyRate);
63
+ };
64
+ const fetchProductSDK = async (slug, locale = 'fr', useFeeArray, noDrafts) => {
65
+ if (!!!sdk)
66
+ return;
67
+ try {
68
+ const prod = await sdk.products.getProduct(slug, locale, !!useFeeArray ? state.fees : undefined, noDrafts);
69
+ return prod;
70
+ }
71
+ catch (e) {
72
+ console.log('Error on fetching product from DB: ', e.toString());
73
+ }
74
+ };
75
+ (0, react_1.useEffect)(() => {
76
+ if (!!!sdk)
77
+ return;
78
+ const getContent = async () => {
79
+ let data = undefined;
80
+ let categories = [];
81
+ let categoryTree = [];
82
+ let attributes = [];
83
+ let brands = [];
84
+ let fees = [];
85
+ try {
86
+ data = !!!ssrStoreData ? await sdk.initStoreData(spaceData) : ssrStoreData;
87
+ }
88
+ catch (e) {
89
+ console.log('error on fetching data for space: ', e.toString());
90
+ setFetchingContent(false);
91
+ }
92
+ try {
93
+ categories = !!!ssrCategories
94
+ ? !!state.categories && !!state.categories.length
95
+ ? state.categories
96
+ : (await sdk.products.getCategories()) || []
97
+ : ssrCategories;
98
+ if (!!categories.length) {
99
+ categoryTree = (0, functions_1.printTree)(categories);
100
+ }
101
+ }
102
+ catch (e) {
103
+ console.log('error on fetching categories for space: ', e.toString());
104
+ setFetchingContent(false);
105
+ }
106
+ try {
107
+ attributes = !!!ssrAttributes
108
+ ? !!state.attributes && !!state.attributes.length
109
+ ? state.attributes
110
+ : (await sdk.products.getAttributes()) || []
111
+ : ssrAttributes;
112
+ }
113
+ catch (e) {
114
+ console.log('error on fetching attributes for space: ', e.toString());
115
+ setFetchingContent(false);
116
+ }
117
+ try {
118
+ brands = !!!ssrBrands
119
+ ? !!state.brands && !!state.brands.length
120
+ ? state.brands
121
+ : (await sdk.products.getBrands()) || []
122
+ : ssrBrands;
123
+ }
124
+ catch (e) {
125
+ console.log('error on fetching brands for space: ', e.toString());
126
+ setFetchingContent(false);
127
+ }
128
+ try {
129
+ fees =
130
+ !!state.fees && state.fees.length
131
+ ? state.fees
132
+ : !!api && api.org === 'gr'
133
+ ? (await sdk.products.getFees()) || []
134
+ : [];
135
+ }
136
+ catch (e) {
137
+ console.log('error on fetching fees for space: ', e.toString());
138
+ setFetchingContent(false);
139
+ }
140
+ setState((prevState) => (Object.assign(Object.assign(Object.assign({}, prevState), (!!data ? data : {})), { categories,
141
+ categoryTree,
142
+ attributes,
143
+ brands,
144
+ fees })));
145
+ setFetchingContent(false);
146
+ };
147
+ if (!fetchingContent) {
148
+ setFetchingContent(true);
149
+ getContent();
150
+ }
151
+ }, [sdk, state.currency]);
152
+ (0, react_1.useEffect)(() => {
153
+ const storageCurrency = localStorage.getItem('currency');
154
+ if ((!!storageCurrency && storageCurrency === 'CAD') || storageCurrency === 'USD') {
155
+ setCurrency(storageCurrency);
156
+ }
157
+ else {
158
+ localStorage.setItem('currency', state.currency);
159
+ }
160
+ }, []);
161
+ (0, react_1.useEffect)(() => {
162
+ if ((!!state.currency && state.currency === 'CAD') || state.currency === 'USD') {
163
+ localStorage.setItem('currency', state.currency);
164
+ }
165
+ }, [state.currency]);
166
+ return ((0, jsx_runtime_1.jsx)(_1.default.Provider, Object.assign({ value: Object.assign(Object.assign({}, state), { calculateAmountByCurrency: calculateAmountByCurrency, setCurrency: setCurrency, fetchProductSDK: fetchProductSDK }) }, { children: !!state.website_in_maintenance &&
167
+ !!maintenanceComponent &&
168
+ !!!process.env.IS_TEST_ENV &&
169
+ !!!process.env.IS_STAGING
170
+ ? maintenanceComponent
171
+ : children })));
172
+ }
173
+ exports.default = DataContextProvider;
174
174
  //# sourceMappingURL=DataContextProvider.js.map
@@ -1,47 +1,47 @@
1
- /// <reference types="react" />
2
- import { IBlockedDates, ICustomerGroup } from 'addio-admin-sdk/dist/Interfaces/Space';
3
- import IStore from 'addio-admin-sdk/dist/Interfaces/Store';
4
- import IAttribute from 'addio-admin-sdk/dist/Interfaces/Attribute';
5
- import ICategory from 'addio-admin-sdk/dist/Interfaces/Category';
6
- import IBrand from 'addio-admin-sdk/dist/Interfaces/Brand';
7
- import IIndexedProduct from 'addio-admin-sdk/dist/Interfaces/Indexed/Product';
8
- import { IFixedPromoBanner } from 'addio-admin-sdk/dist/Interfaces/Space';
9
- import { IBankType } from 'addio-admin-sdk/dist/Interfaces/PromiseToPurchase/BankType';
10
- import ISlider, { ISlide } from 'addio-admin-sdk/dist/Interfaces/Slider';
11
- import { ISlideGR } from 'addio-admin-sdk/dist/Interfaces/Slider/GR';
12
- import { ISpaceSchedule } from 'addio-admin-sdk/dist/Interfaces/Schedule';
13
- export interface IDataContext {
14
- readonly categories: ICategory[];
15
- readonly categoryTree: ICategory[];
16
- readonly attributes: IAttribute[];
17
- readonly brands: IBrand[];
18
- readonly fees?: IIndexedProduct[];
19
- readonly currency: string;
20
- readonly website_in_maintenance: boolean;
21
- readonly setCurrency: (_locale: 'CAD' | 'USD') => void;
22
- readonly stores: IStore[];
23
- readonly languages: string[];
24
- readonly defaultCurrency: string;
25
- readonly exchangeRates: {
26
- readonly [key: string]: number;
27
- };
28
- readonly payments_accepted: string[];
29
- readonly deposit_amount?: number;
30
- readonly calculateAmountByCurrency: (amount: number) => string;
31
- readonly customerGroups: ICustomerGroup[];
32
- readonly zones: any[];
33
- readonly blocked_shipping_dates: IBlockedDates[];
34
- readonly hide_pro_prices: boolean;
35
- readonly fetchProductSDK: (slug: string, locale: string | undefined, useFeeArray?: boolean, noDrafts?: boolean) => Promise<IIndexedProduct | undefined>;
36
- readonly pa_bank_types?: IBankType[];
37
- readonly fixed_promo_banner?: IFixedPromoBanner;
38
- readonly sliders?: ISlider<ISlideGR | ISlide>[];
39
- readonly schedule?: ISpaceSchedule;
40
- readonly space_inventory_units?: {
41
- slug: string;
42
- roundToOneQte: boolean;
43
- }[];
44
- }
45
- export declare const getDefaultDataContext: () => IDataContext;
46
- declare const _default: import("react").Context<IDataContext>;
47
- export default _default;
1
+ /// <reference types="react" />
2
+ import { IBlockedDates, ICustomerGroup } from 'addio-admin-sdk/dist/Interfaces/Space';
3
+ import IStore from 'addio-admin-sdk/dist/Interfaces/Store';
4
+ import IAttribute from 'addio-admin-sdk/dist/Interfaces/Attribute';
5
+ import ICategory from 'addio-admin-sdk/dist/Interfaces/Category';
6
+ import IBrand from 'addio-admin-sdk/dist/Interfaces/Brand';
7
+ import IIndexedProduct from 'addio-admin-sdk/dist/Interfaces/Indexed/Product';
8
+ import { IFixedPromoBanner } from 'addio-admin-sdk/dist/Interfaces/Space';
9
+ import { IBankType } from 'addio-admin-sdk/dist/Interfaces/PromiseToPurchase/BankType';
10
+ import ISlider, { ISlide } from 'addio-admin-sdk/dist/Interfaces/Slider';
11
+ import { ISlideGR } from 'addio-admin-sdk/dist/Interfaces/Slider/GR';
12
+ import { ISpaceSchedule } from 'addio-admin-sdk/dist/Interfaces/Schedule';
13
+ export interface IDataContext {
14
+ readonly categories: ICategory[];
15
+ readonly categoryTree: ICategory[];
16
+ readonly attributes: IAttribute[];
17
+ readonly brands: IBrand[];
18
+ readonly fees?: IIndexedProduct[];
19
+ readonly currency: string;
20
+ readonly website_in_maintenance: boolean;
21
+ readonly setCurrency: (_locale: 'CAD' | 'USD') => void;
22
+ readonly stores: IStore[];
23
+ readonly languages: string[];
24
+ readonly defaultCurrency: string;
25
+ readonly exchangeRates: {
26
+ readonly [key: string]: number;
27
+ };
28
+ readonly payments_accepted: string[];
29
+ readonly deposit_amount?: number;
30
+ readonly calculateAmountByCurrency: (amount: number) => string;
31
+ readonly customerGroups: ICustomerGroup[];
32
+ readonly zones: any[];
33
+ readonly blocked_shipping_dates: IBlockedDates[];
34
+ readonly hide_pro_prices: boolean;
35
+ readonly fetchProductSDK: (slug: string, locale: string | undefined, useFeeArray?: boolean, noDrafts?: boolean) => Promise<IIndexedProduct | undefined>;
36
+ readonly pa_bank_types?: IBankType[];
37
+ readonly fixed_promo_banner?: IFixedPromoBanner;
38
+ readonly sliders?: ISlider<ISlideGR | ISlide>[];
39
+ readonly schedule?: ISpaceSchedule;
40
+ readonly space_inventory_units?: {
41
+ slug: string;
42
+ roundToOneQte: boolean;
43
+ }[];
44
+ }
45
+ export declare const getDefaultDataContext: () => IDataContext;
46
+ declare const _default: import("react").Context<IDataContext>;
47
+ export default _default;
@@ -1,28 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultDataContext = void 0;
4
- const react_1 = require("react");
5
- const getDefaultDataContext = () => ({
6
- website_in_maintenance: false,
7
- currency: 'CAD',
8
- setCurrency: (_currency) => { },
9
- stores: [],
10
- languages: ['fr', 'en'],
11
- defaultCurrency: 'CAD',
12
- categories: [],
13
- categoryTree: [],
14
- attributes: [],
15
- brands: [],
16
- fees: [],
17
- exchangeRates: {},
18
- payments_accepted: [],
19
- calculateAmountByCurrency: (_amount) => '',
20
- customerGroups: [],
21
- zones: [],
22
- blocked_shipping_dates: [],
23
- hide_pro_prices: false,
24
- fetchProductSDK: async (_slug, _locale, _useFeeArray, _noDrafts) => undefined
25
- });
26
- exports.getDefaultDataContext = getDefaultDataContext;
27
- exports.default = (0, react_1.createContext)((0, exports.getDefaultDataContext)());
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultDataContext = void 0;
4
+ const react_1 = require("react");
5
+ const getDefaultDataContext = () => ({
6
+ website_in_maintenance: false,
7
+ currency: 'CAD',
8
+ setCurrency: (_currency) => { },
9
+ stores: [],
10
+ languages: ['fr', 'en'],
11
+ defaultCurrency: 'CAD',
12
+ categories: [],
13
+ categoryTree: [],
14
+ attributes: [],
15
+ brands: [],
16
+ fees: [],
17
+ exchangeRates: {},
18
+ payments_accepted: [],
19
+ calculateAmountByCurrency: (_amount) => '',
20
+ customerGroups: [],
21
+ zones: [],
22
+ blocked_shipping_dates: [],
23
+ hide_pro_prices: false,
24
+ fetchProductSDK: async (_slug, _locale, _useFeeArray, _noDrafts) => undefined
25
+ });
26
+ exports.getDefaultDataContext = getDefaultDataContext;
27
+ exports.default = (0, react_1.createContext)((0, exports.getDefaultDataContext)());
28
28
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
- interface LogProviderProps {
3
- children: any;
4
- }
5
- declare const LogContextProvider: ({ children }: LogProviderProps) => JSX.Element;
6
- export default LogContextProvider;
1
+ /// <reference types="react" />
2
+ interface LogProviderProps {
3
+ children: any;
4
+ }
5
+ declare const LogContextProvider: ({ children }: LogProviderProps) => JSX.Element;
6
+ export default LogContextProvider;
@@ -1,41 +1,41 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const logs_1 = require("addio-admin-sdk/dist/services/logs");
9
- const useSDK_1 = __importDefault(require("../../hooks/useSDK"));
10
- const _1 = __importDefault(require("."));
11
- const LogContextProvider = ({ children }) => {
12
- const sdk = (0, useSDK_1.default)();
13
- const [systemLogParams, setSystemLogParams] = (0, react_1.useState)();
14
- (0, react_1.useEffect)(() => {
15
- var _a;
16
- if (!!!sdk || !!systemLogParams)
17
- return;
18
- const orgName = sdk.getSDKOrgInitials();
19
- const initParams = {
20
- clientName: `Site Front - ${orgName}`,
21
- clientToken: (_a = process.env.NEXT_PUBLIC_LOG_SYSTEM_KEY) !== null && _a !== void 0 ? _a : ''
22
- };
23
- (0, logs_1.initLoggingSystem)(initParams);
24
- setSystemLogParams(initParams);
25
- }, [sdk]);
26
- const logCustomMessage = async (message, type = logs_1.LogType.ERROR, localLogToo = true) => {
27
- try {
28
- if (!!!systemLogParams)
29
- throw new Error('Could not log, no params set');
30
- await (0, logs_1.SystemLog)(systemLogParams, type, message);
31
- }
32
- catch (e) {
33
- console.log('error on logging custom message: ', e.toString());
34
- }
35
- if (!!localLogToo)
36
- console.log(message);
37
- };
38
- return (0, jsx_runtime_1.jsx)(_1.default.Provider, Object.assign({ value: { logCustomMessage } }, { children: children }));
39
- };
40
- exports.default = LogContextProvider;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const logs_1 = require("addio-admin-sdk/dist/services/logs");
9
+ const useSDK_1 = __importDefault(require("../../hooks/useSDK"));
10
+ const _1 = __importDefault(require("."));
11
+ const LogContextProvider = ({ children }) => {
12
+ const sdk = (0, useSDK_1.default)();
13
+ const [systemLogParams, setSystemLogParams] = (0, react_1.useState)();
14
+ (0, react_1.useEffect)(() => {
15
+ var _a;
16
+ if (!!!sdk || !!systemLogParams)
17
+ return;
18
+ const orgName = sdk.getSDKOrgInitials();
19
+ const initParams = {
20
+ clientName: `Site Front - ${orgName}`,
21
+ clientToken: (_a = process.env.NEXT_PUBLIC_LOG_SYSTEM_KEY) !== null && _a !== void 0 ? _a : ''
22
+ };
23
+ (0, logs_1.initLoggingSystem)(initParams);
24
+ setSystemLogParams(initParams);
25
+ }, [sdk]);
26
+ const logCustomMessage = async (message, type = logs_1.LogType.ERROR, localLogToo = true) => {
27
+ try {
28
+ if (!!!systemLogParams)
29
+ throw new Error('Could not log, no params set');
30
+ await (0, logs_1.SystemLog)(systemLogParams, type, message);
31
+ }
32
+ catch (e) {
33
+ console.log('error on logging custom message: ', e.toString());
34
+ }
35
+ if (!!localLogToo)
36
+ console.log(message);
37
+ };
38
+ return (0, jsx_runtime_1.jsx)(_1.default.Provider, Object.assign({ value: { logCustomMessage } }, { children: children }));
39
+ };
40
+ exports.default = LogContextProvider;
41
41
  //# sourceMappingURL=LogContextProvider.js.map
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- import { LogType } from 'addio-admin-sdk/dist/services/logs';
3
- export interface ILogContext {
4
- logCustomMessage: (message: string, type?: LogType, logLocalToo?: boolean) => Promise<void>;
5
- }
6
- declare const _default: import("react").Context<ILogContext>;
7
- export default _default;
1
+ /// <reference types="react" />
2
+ import { LogType } from 'addio-admin-sdk/dist/services/logs';
3
+ export interface ILogContext {
4
+ logCustomMessage: (message: string, type?: LogType, logLocalToo?: boolean) => Promise<void>;
5
+ }
6
+ declare const _default: import("react").Context<ILogContext>;
7
+ export default _default;
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_1 = require("react");
4
- const getDefaultLogContext = () => ({
5
- logCustomMessage: async (_message) => { }
6
- });
7
- exports.default = (0, react_1.createContext)(getDefaultLogContext());
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_1 = require("react");
4
+ const getDefaultLogContext = () => ({
5
+ logCustomMessage: async (_message) => { }
6
+ });
7
+ exports.default = (0, react_1.createContext)(getDefaultLogContext());
8
8
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- interface IProps {
3
- readonly children: JSX.Element;
4
- readonly closeIcon: JSX.Element;
5
- }
6
- export default function ModalContextProvider({ children, closeIcon }: IProps): JSX.Element;
7
- export {};
1
+ /// <reference types="react" />
2
+ interface IProps {
3
+ readonly children: JSX.Element;
4
+ readonly closeIcon: JSX.Element;
5
+ }
6
+ export default function ModalContextProvider({ children, closeIcon }: IProps): JSX.Element;
7
+ export {};