addio-ecomm-sdk 1.3.76 → 1.3.77

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 (149) 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 -1818
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/constants/components/CreditCardInput.d.ts +11 -11
  7. package/dist/lib/constants/components/CreditCardInput.js +65 -79
  8. package/dist/lib/constants/components/CreditCardInput.js.map +1 -1
  9. package/dist/lib/constants/components/Snackbar.d.ts +11 -11
  10. package/dist/lib/constants/components/Snackbar.js +29 -39
  11. package/dist/lib/constants/components/Snackbar.js.map +1 -1
  12. package/dist/lib/constants/contexts/CartContext/CartContextProvider.d.ts +7 -7
  13. package/dist/lib/constants/contexts/CartContext/CartContextProvider.js +640 -980
  14. package/dist/lib/constants/contexts/CartContext/CartContextProvider.js.map +1 -1
  15. package/dist/lib/constants/contexts/CartContext/index.d.ts +79 -79
  16. package/dist/lib/constants/contexts/CartContext/index.js +47 -127
  17. package/dist/lib/constants/contexts/CartContext/index.js.map +1 -1
  18. package/dist/lib/constants/contexts/DataContext/DataContextProvider.d.ts +15 -15
  19. package/dist/lib/constants/contexts/DataContext/DataContextProvider.js +173 -304
  20. package/dist/lib/constants/contexts/DataContext/DataContextProvider.js.map +1 -1
  21. package/dist/lib/constants/contexts/DataContext/index.d.ts +47 -47
  22. package/dist/lib/constants/contexts/DataContext/index.js +27 -67
  23. package/dist/lib/constants/contexts/DataContext/index.js.map +1 -1
  24. package/dist/lib/constants/contexts/LogContext/LogContextProvider.d.ts +6 -6
  25. package/dist/lib/constants/contexts/LogContext/LogContextProvider.js +40 -103
  26. package/dist/lib/constants/contexts/LogContext/LogContextProvider.js.map +1 -1
  27. package/dist/lib/constants/contexts/LogContext/index.d.ts +7 -7
  28. package/dist/lib/constants/contexts/LogContext/index.js +7 -45
  29. package/dist/lib/constants/contexts/LogContext/index.js.map +1 -1
  30. package/dist/lib/constants/contexts/ModalContext/ModalContextProvider.d.ts +7 -7
  31. package/dist/lib/constants/contexts/ModalContext/ModalContextProvider.js +61 -76
  32. package/dist/lib/constants/contexts/ModalContext/ModalContextProvider.js.map +1 -1
  33. package/dist/lib/constants/contexts/ModalContext/index.d.ts +14 -14
  34. package/dist/lib/constants/contexts/ModalContext/index.js +16 -18
  35. package/dist/lib/constants/contexts/ModalContext/index.js.map +1 -1
  36. package/dist/lib/constants/contexts/SDKContext/SDKProvider.d.ts +8 -8
  37. package/dist/lib/constants/contexts/SDKContext/SDKProvider.js +23 -79
  38. package/dist/lib/constants/contexts/SDKContext/SDKProvider.js.map +1 -1
  39. package/dist/lib/constants/contexts/SDKContext/index.d.ts +4 -4
  40. package/dist/lib/constants/contexts/SDKContext/index.js +4 -4
  41. package/dist/lib/constants/contexts/SDKContext/index.js.map +1 -1
  42. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContext.d.ts +4 -4
  43. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContext.js +6 -6
  44. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContext.js.map +1 -1
  45. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContextProvider.d.ts +12 -12
  46. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContextProvider.js +38 -52
  47. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContextProvider.js.map +1 -1
  48. package/dist/lib/constants/contexts/SnackbarContext/interfaces/ISnackbarContext.d.ts +19 -17
  49. package/dist/lib/constants/contexts/SnackbarContext/interfaces/ISnackbarContext.js +21 -21
  50. package/dist/lib/constants/contexts/SnackbarContext/interfaces/ISnackbarContext.js.map +1 -1
  51. package/dist/lib/constants/contexts/StockNotifContext/StockNotifContextProvider.d.ts +7 -7
  52. package/dist/lib/constants/contexts/StockNotifContext/StockNotifContextProvider.js +112 -179
  53. package/dist/lib/constants/contexts/StockNotifContext/StockNotifContextProvider.js.map +1 -1
  54. package/dist/lib/constants/contexts/StockNotifContext/index.d.ts +10 -10
  55. package/dist/lib/constants/contexts/StockNotifContext/index.js +10 -10
  56. package/dist/lib/constants/contexts/StockNotifContext/index.js.map +1 -1
  57. package/dist/lib/constants/contexts/UserContext/UserContextProvider.d.ts +5 -5
  58. package/dist/lib/constants/contexts/UserContext/UserContextProvider.js +313 -470
  59. package/dist/lib/constants/contexts/UserContext/UserContextProvider.js.map +1 -1
  60. package/dist/lib/constants/contexts/UserContext/index.d.ts +54 -54
  61. package/dist/lib/constants/contexts/UserContext/index.js +28 -82
  62. package/dist/lib/constants/contexts/UserContext/index.js.map +1 -1
  63. package/dist/lib/constants/contexts/WishlistContext/WishlistContextProvider.d.ts +6 -6
  64. package/dist/lib/constants/contexts/WishlistContext/WishlistContextProvider.js +231 -327
  65. package/dist/lib/constants/contexts/WishlistContext/WishlistContextProvider.js.map +1 -1
  66. package/dist/lib/constants/contexts/WishlistContext/index.d.ts +12 -12
  67. package/dist/lib/constants/contexts/WishlistContext/index.js +12 -12
  68. package/dist/lib/constants/contexts/WishlistContext/index.js.map +1 -1
  69. package/dist/lib/constants/hooks/useCart.d.ts +2 -2
  70. package/dist/lib/constants/hooks/useCart.js +11 -11
  71. package/dist/lib/constants/hooks/useCart.js.map +1 -1
  72. package/dist/lib/constants/hooks/useData.d.ts +2 -2
  73. package/dist/lib/constants/hooks/useData.js +11 -11
  74. package/dist/lib/constants/hooks/useData.js.map +1 -1
  75. package/dist/lib/constants/hooks/useLogs.d.ts +2 -2
  76. package/dist/lib/constants/hooks/useLogs.js +11 -11
  77. package/dist/lib/constants/hooks/useLogs.js.map +1 -1
  78. package/dist/lib/constants/hooks/useModal.d.ts +2 -2
  79. package/dist/lib/constants/hooks/useModal.js +11 -11
  80. package/dist/lib/constants/hooks/useModal.js.map +1 -1
  81. package/dist/lib/constants/hooks/useSDK.d.ts +2 -2
  82. package/dist/lib/constants/hooks/useSDK.js +11 -11
  83. package/dist/lib/constants/hooks/useSDK.js.map +1 -1
  84. package/dist/lib/constants/hooks/useSnackbar.d.ts +2 -2
  85. package/dist/lib/constants/hooks/useSnackbar.js +11 -11
  86. package/dist/lib/constants/hooks/useSnackbar.js.map +1 -1
  87. package/dist/lib/constants/hooks/useStockNotif.d.ts +2 -2
  88. package/dist/lib/constants/hooks/useStockNotif.js +11 -11
  89. package/dist/lib/constants/hooks/useStockNotif.js.map +1 -1
  90. package/dist/lib/constants/hooks/useUser.d.ts +2 -2
  91. package/dist/lib/constants/hooks/useUser.js +11 -11
  92. package/dist/lib/constants/hooks/useUser.js.map +1 -1
  93. package/dist/lib/constants/hooks/useWishlist.d.ts +2 -2
  94. package/dist/lib/constants/hooks/useWishlist.js +11 -11
  95. package/dist/lib/constants/hooks/useWishlist.js.map +1 -1
  96. package/dist/lib/models/image/index.d.ts +6 -6
  97. package/dist/lib/models/image/index.js +10 -15
  98. package/dist/lib/models/image/index.js.map +1 -1
  99. package/dist/lib/models/stockNotification/index.d.ts +13 -13
  100. package/dist/lib/models/stockNotification/index.js +70 -130
  101. package/dist/lib/models/stockNotification/index.js.map +1 -1
  102. package/dist/lib/models/wishlist/index.d.ts +14 -14
  103. package/dist/lib/models/wishlist/index.js +86 -155
  104. package/dist/lib/models/wishlist/index.js.map +1 -1
  105. package/dist/utils/StripeErrors.d.ts +24 -24
  106. package/dist/utils/StripeErrors.js +55 -55
  107. package/dist/utils/algolia.d.ts +3 -3
  108. package/dist/utils/algolia.js +35 -81
  109. package/dist/utils/algolia.js.map +1 -1
  110. package/dist/utils/analytics.d.ts +71 -71
  111. package/dist/utils/analytics.js +246 -257
  112. package/dist/utils/analytics.js.map +1 -1
  113. package/dist/utils/cart.d.ts +3 -3
  114. package/dist/utils/cart.js +65 -66
  115. package/dist/utils/cart.js.map +1 -1
  116. package/dist/utils/contentful.d.ts +10 -10
  117. package/dist/utils/contentful.js +63 -136
  118. package/dist/utils/contentful.js.map +1 -1
  119. package/dist/utils/functions.d.ts +21 -21
  120. package/dist/utils/functions.js +183 -200
  121. package/dist/utils/functions.js.map +1 -1
  122. package/dist/utils/getSDK.d.ts +4 -4
  123. package/dist/utils/getSDK.js +19 -77
  124. package/dist/utils/getSDK.js.map +1 -1
  125. package/dist/utils/initStoreData.d.ts +3 -3
  126. package/dist/utils/initStoreData.js +17 -62
  127. package/dist/utils/initStoreData.js.map +1 -1
  128. package/dist/utils/interfaces/IClientCMSData.d.ts +132 -132
  129. package/dist/utils/interfaces/IClientCMSData.js +2 -2
  130. package/dist/utils/interfaces/IEndpointResult.d.ts +10 -10
  131. package/dist/utils/interfaces/IEndpointResult.js +2 -2
  132. package/dist/utils/interfaces/IFacebookUserProfile.d.ts +10 -10
  133. package/dist/utils/interfaces/IFacebookUserProfile.js +2 -2
  134. package/dist/utils/interfaces/IFilter.d.ts +23 -23
  135. package/dist/utils/interfaces/IFilter.js +2 -2
  136. package/dist/utils/interfaces/IGoogleUserProfile.d.ts +7 -7
  137. package/dist/utils/interfaces/IGoogleUserProfile.js +2 -2
  138. package/dist/utils/interfaces/ISDKConfig.d.ts +7 -7
  139. package/dist/utils/interfaces/ISDKConfig.js +2 -2
  140. package/dist/utils/interfaces/ISpaceData.d.ts +18 -18
  141. package/dist/utils/interfaces/ISpaceData.js +2 -2
  142. package/dist/utils/larivieremeunier.d.ts +3 -3
  143. package/dist/utils/larivieremeunier.js +156 -156
  144. package/dist/utils/larivieremeunier.js.map +1 -1
  145. package/dist/utils/technosupply.d.ts +3 -3
  146. package/dist/utils/technosupply.js +155 -155
  147. package/dist/utils/technosupply.js.map +1 -1
  148. package/package.json +61 -61
  149. package/publish.sh +132 -132
@@ -1,471 +1,314 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
- return new (P || (P = Promise))(function (resolve, reject) {
39
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
- step((generator = generator.apply(thisArg, _arguments || [])).next());
43
- });
44
- };
45
- var __generator = (this && this.__generator) || function (thisArg, body) {
46
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
- function verb(n) { return function (v) { return step([n, v]); }; }
49
- function step(op) {
50
- if (f) throw new TypeError("Generator is already executing.");
51
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
- if (y = 0, t) op = [op[0] & 2, t.value];
54
- switch (op[0]) {
55
- case 0: case 1: t = op; break;
56
- case 4: _.label++; return { value: op[1], done: false };
57
- case 5: _.label++; y = op[1]; op = [0]; continue;
58
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
- default:
60
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
- if (t[2]) _.ops.pop();
65
- _.trys.pop(); continue;
66
- }
67
- op = body.call(thisArg, _);
68
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
- }
71
- };
72
- var __importDefault = (this && this.__importDefault) || function (mod) {
73
- return (mod && mod.__esModule) ? mod : { "default": mod };
74
- };
75
- Object.defineProperty(exports, "__esModule", { value: true });
76
- var jsx_runtime_1 = require("react/jsx-runtime");
77
- var react_1 = require("react");
78
- var index_1 = __importStar(require("./index"));
79
- var useSDK_1 = __importDefault(require("../../hooks/useSDK"));
80
- var moment_1 = __importDefault(require("moment"));
81
- var functions_1 = require("../../../../utils/functions");
82
- var UserContextProvider = function (_a) {
83
- var children = _a.children;
84
- var sdk = (0, useSDK_1.default)();
85
- var setUserLoggedIn = function (userData) { return __awaiter(void 0, void 0, void 0, function () {
86
- var isPro, isClerk;
87
- return __generator(this, function (_a) {
88
- isPro = !!userData.basic_info.customer_professionnal_info &&
89
- !!userData.basic_info.customer_professionnal_info.proof_doc_value;
90
- localStorage.setItem('userLogged', 'true');
91
- if (!!isPro) {
92
- localStorage.setItem('isPro', 'true');
93
- }
94
- isClerk = localStorage.getItem('isClerk');
95
- if (typeof window !== 'undefined' && !!isClerk) {
96
- window.addEventListener('beforeunload', function (e) { return __awaiter(void 0, void 0, void 0, function () {
97
- var dialogText;
98
- return __generator(this, function (_a) {
99
- if (!!!userData.temp_hash)
100
- return [2];
101
- e.preventDefault();
102
- dialogText = '';
103
- e.returnValue = dialogText;
104
- return [2, dialogText];
105
- });
106
- }); });
107
- }
108
- setState(function (prevState) { return (__assign(__assign({}, prevState), { isUserLoggedIn: true, userData: userData })); });
109
- return [2];
110
- });
111
- }); };
112
- var setUserLoggedOut = function (keepRepCart) { return __awaiter(void 0, void 0, void 0, function () {
113
- return __generator(this, function (_a) {
114
- switch (_a.label) {
115
- case 0:
116
- if (!!!sdk)
117
- return [2];
118
- if (!(!!state.userData && state.userData.temp_hash && !!!keepRepCart)) return [3, 2];
119
- return [4, sdk.user.killRepCart(state.userData.temp_hash)];
120
- case 1:
121
- _a.sent();
122
- _a.label = 2;
123
- case 2:
124
- sdk.user.logout();
125
- setState(function (prevState) { return (__assign(__assign({}, prevState), { isUserLoggedIn: false, isPro: false, customPriceList: undefined, userData: null, resetUserData: true })); });
126
- return [2];
127
- }
128
- });
129
- }); };
130
- var setUserPreferedStore = function (storeId) { return __awaiter(void 0, void 0, void 0, function () {
131
- return __generator(this, function (_a) {
132
- switch (_a.label) {
133
- case 0:
134
- if (!!!state.userData)
135
- return [2];
136
- return [4, saveUser(__assign(__assign({}, state.userData), { prefered_store: storeId }))];
137
- case 1:
138
- _a.sent();
139
- return [2];
140
- }
141
- });
142
- }); };
143
- var saveUser = function (customer) { return __awaiter(void 0, void 0, void 0, function () {
144
- return __generator(this, function (_a) {
145
- switch (_a.label) {
146
- case 0:
147
- if (!!!sdk)
148
- return [2, false];
149
- setState(function (prevState) { return (__assign(__assign({}, prevState), { userData: customer, isPro: !!customer.basic_info.customer_professionnal_info &&
150
- !!customer.basic_info.customer_professionnal_info.professionnal_title })); });
151
- return [4, sdk.user.saveUser(customer)];
152
- case 1: return [2, _a.sent()];
153
- }
154
- });
155
- }); };
156
- var deleteUser = function () { return __awaiter(void 0, void 0, void 0, function () {
157
- return __generator(this, function (_a) {
158
- switch (_a.label) {
159
- case 0:
160
- if (!!!sdk)
161
- return [2, false];
162
- return [4, sdk.user.deleteUser()];
163
- case 1: return [2, _a.sent()];
164
- }
165
- });
166
- }); };
167
- var getOrder = function (orderID, token) { return __awaiter(void 0, void 0, void 0, function () {
168
- var order, err_1;
169
- return __generator(this, function (_a) {
170
- switch (_a.label) {
171
- case 0:
172
- if (!!!sdk)
173
- return [2, 'sdk_not_defined'];
174
- _a.label = 1;
175
- case 1:
176
- _a.trys.push([1, 3, , 4]);
177
- return [4, sdk.user.getOrder(orderID, token)];
178
- case 2:
179
- order = _a.sent();
180
- return [2, order];
181
- case 3:
182
- err_1 = _a.sent();
183
- return [2, 'error'];
184
- case 4: return [2];
185
- }
186
- });
187
- }); };
188
- var changePassword = function (currentPassword, newPassword) { return __awaiter(void 0, void 0, void 0, function () {
189
- var err_2;
190
- return __generator(this, function (_a) {
191
- switch (_a.label) {
192
- case 0:
193
- if (!!!sdk)
194
- return [2, 'sdk_not_defined'];
195
- _a.label = 1;
196
- case 1:
197
- _a.trys.push([1, 3, , 4]);
198
- return [4, sdk.user.changePassword(currentPassword, newPassword)];
199
- case 2: return [2, _a.sent()];
200
- case 3:
201
- err_2 = _a.sent();
202
- return [2, err_2];
203
- case 4: return [2];
204
- }
205
- });
206
- }); };
207
- var changeProfilePicture = function (base64) { return __awaiter(void 0, void 0, void 0, function () {
208
- var upload_1, err_3;
209
- return __generator(this, function (_a) {
210
- switch (_a.label) {
211
- case 0:
212
- if (!!!sdk)
213
- return [2, 'sdk_not_defined'];
214
- _a.label = 1;
215
- case 1:
216
- _a.trys.push([1, 3, , 4]);
217
- return [4, sdk.user.changeProfilePicture(base64)];
218
- case 2:
219
- upload_1 = _a.sent();
220
- setState(function (prevState) {
221
- if (prevState.userData) {
222
- return __assign(__assign({}, prevState), { userData: __assign(__assign({}, prevState.userData), { basic_info: __assign(__assign({}, prevState.userData.basic_info), { customer_image: upload_1 === "Can't upload image." || upload_1 === 'done' ? undefined : upload_1 }) }) });
223
- }
224
- return prevState;
225
- });
226
- return [2, upload_1];
227
- case 3:
228
- err_3 = _a.sent();
229
- return [2, err_3];
230
- case 4: return [2];
231
- }
232
- });
233
- }); };
234
- var setCustomPriceList = function (list) {
235
- setState(function (prevState) { return (__assign(__assign({}, prevState), { customPriceList: list, fetchCustomPrices: false })); });
236
- localStorage.setItem('customPriceList', JSON.stringify(list));
237
- localStorage.setItem('lastCustomPriceFetch', (0, moment_1.default)().format('YYYY-MM-DD'));
238
- };
239
- var setLoaded = function (value) {
240
- setState(function (prevState) { return (__assign(__assign({}, prevState), { loaded: value })); });
241
- };
242
- var _b = (0, react_1.useState)((0, index_1.getDefaultUserContext)()), state = _b[0], setState = _b[1];
243
- (0, react_1.useEffect)(function () {
244
- if (!!!sdk)
245
- return;
246
- var userLoggedData = localStorage.getItem('userLogged');
247
- var userIsPro = localStorage.getItem('isPro');
248
- var isClerk = localStorage.getItem('isClerk');
249
- var isLoggedIn = !!userLoggedData && JSON.parse(userLoggedData);
250
- var isPro = !!userLoggedData && !!userIsPro && JSON.parse(userIsPro);
251
- var newState = __assign({ isUserLoggedIn: !!!isClerk && !!isLoggedIn, isPro: !!!isClerk && !!isPro }, checkForCustomPriceList(!!userIsPro));
252
- if (!!isClerk) {
253
- localStorage.removeItem('isClerk');
254
- }
255
- return setState(function (prevState) { return (__assign(__assign(__assign({}, prevState), newState), { loaded: true })); });
256
- }, [sdk]);
257
- (0, react_1.useEffect)(function () {
258
- if (!!!state.fetchCustomPrices || !!!state.isPro || !!!state.userData || !!!sdk)
259
- return;
260
- var fetchCustomPrices = function () { return __awaiter(void 0, void 0, void 0, function () {
261
- var proUser, newList, e_1;
262
- return __generator(this, function (_a) {
263
- switch (_a.label) {
264
- case 0:
265
- proUser = !!state.userData && !!state.isPro ? state.userData.id : '';
266
- if (!!!proUser)
267
- return [2];
268
- _a.label = 1;
269
- case 1:
270
- _a.trys.push([1, 3, , 4]);
271
- return [4, sdk.user.fetchCustomPriceList(proUser)];
272
- case 2:
273
- newList = _a.sent();
274
- if (!!newList) {
275
- setCustomPriceList(newList);
276
- }
277
- return [3, 4];
278
- case 3:
279
- e_1 = _a.sent();
280
- console.log('error on fetching customPrices from G2: ', e_1.toString());
281
- setState(function (prevState) { return (__assign(__assign({}, prevState), { fetchCustomPrices: false, customPriceList: undefined })); });
282
- return [3, 4];
283
- case 4: return [2];
284
- }
285
- });
286
- }); };
287
- fetchCustomPrices();
288
- }, [sdk, state.fetchCustomPrices, state.isPro, state.userData]);
289
- (0, react_1.useEffect)(function () {
290
- if (!!!sdk)
291
- return;
292
- if (!state.isUserLoggedIn) {
293
- return;
294
- }
295
- var getContent = function () { return __awaiter(void 0, void 0, void 0, function () {
296
- var user, checkIsPro_1, err_4, error;
297
- return __generator(this, function (_a) {
298
- switch (_a.label) {
299
- case 0:
300
- _a.trys.push([0, 2, , 5]);
301
- return [4, sdk.user.getUser(!!localStorage.getItem('isClerk'))];
302
- case 1:
303
- user = (_a.sent());
304
- if (!!!user) {
305
- localStorage.setItem('isPro', JSON.stringify(false));
306
- localStorage.removeItem('foundInG2');
307
- if (!!localStorage.getItem('customPriceList')) {
308
- localStorage.removeItem('customPriceList');
309
- localStorage.removeItem('lastCustomPriceFetch');
310
- }
311
- return [2, setState(function (prevState) { return (__assign(__assign(__assign({}, prevState), { userData: null, isPro: false }), (!!prevState.customPriceList
312
- ? {
313
- customPriceList: undefined
314
- }
315
- : {}))); })];
316
- }
317
- checkIsPro_1 = !!user.basic_info.customer_professionnal_info &&
318
- !!user.basic_info.customer_professionnal_info.professionnal_title;
319
- setState(function (prevState) { return (__assign(__assign(__assign({}, prevState), { userData: user, isPro: checkIsPro_1 }), checkForCustomPriceList(checkIsPro_1))); });
320
- localStorage.setItem('isPro', JSON.stringify(checkIsPro_1));
321
- if (!!!checkIsPro_1) {
322
- localStorage.removeItem('foundInG2');
323
- if (!!localStorage.getItem('customPriceList')) {
324
- localStorage.removeItem('customPriceList');
325
- localStorage.removeItem('lastCustomPriceFetch');
326
- }
327
- }
328
- return [3, 5];
329
- case 2:
330
- err_4 = _a.sent();
331
- if (!!!err_4.message) return [3, 4];
332
- error = JSON.parse(err_4.message);
333
- if (!(!!error && !!error.error)) return [3, 4];
334
- return [4, setUserLoggedOut()];
335
- case 3:
336
- _a.sent();
337
- _a.label = 4;
338
- case 4: return [3, 5];
339
- case 5: return [2];
340
- }
341
- });
342
- }); };
343
- getContent();
344
- }, [sdk, state.isUserLoggedIn]);
345
- (0, react_1.useEffect)(function () {
346
- return function () {
347
- if (typeof window !== 'undefined') {
348
- window.removeEventListener('onbeforeunload', function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
349
- return [2];
350
- }); }); });
351
- }
352
- };
353
- }, []);
354
- var checkForCustomPriceList = function (userIsPro) {
355
- var hasCustomPriceList = !!userIsPro && localStorage.getItem('customPriceList');
356
- var lastCustomPriceFetch = !!userIsPro && localStorage.getItem('lastCustomPriceFetch');
357
- var foundProInG2 = !!userIsPro && localStorage.getItem('foundInG2');
358
- var lastFetchWasBefore = !!userIsPro &&
359
- (!!!lastCustomPriceFetch || (!!lastCustomPriceFetch && (0, moment_1.default)().isAfter((0, moment_1.default)(lastCustomPriceFetch), 'day')));
360
- var parsedJSONCustomPrices = [];
361
- if (!!hasCustomPriceList) {
362
- try {
363
- parsedJSONCustomPrices = JSON.parse(hasCustomPriceList);
364
- }
365
- catch (e) {
366
- console.log(e.toString());
367
- }
368
- }
369
- return __assign(__assign({}, (!!!lastFetchWasBefore && !!foundProInG2
370
- ? { customPriceList: parsedJSONCustomPrices }
371
- : { customPriceList: undefined })), (!!lastFetchWasBefore && !!foundProInG2 ? { fetchCustomPrices: true } : {}));
372
- };
373
- var getPromiseToPurchaseHistory = function (userId, filters) { return __awaiter(void 0, void 0, void 0, function () {
374
- var api, body, requestHistory, responseData, errorStr;
375
- return __generator(this, function (_a) {
376
- switch (_a.label) {
377
- case 0:
378
- if (!state.isPro)
379
- throw new Error('Only the PRO users have a promise to purchase');
380
- api = !!sdk ? sdk.getAPIInfos() : null;
381
- if (!!!api)
382
- return [2];
383
- if (!!!userId) {
384
- if (!!state.userData && !!state.userData.id)
385
- userId = state.userData.id;
386
- else
387
- throw new Error("Can't get user promise to purchase without userId");
388
- }
389
- body = undefined;
390
- if (!!filters) {
391
- body = __assign(__assign({}, (!!filters.bankTypeId
392
- ? {
393
- bank_type_id: filters.bankTypeId
394
- }
395
- : {})), (!!filters.unixDateRange
396
- ? {
397
- unix_date_range: filters.unixDateRange
398
- }
399
- : {}));
400
- }
401
- return [4, fetch("".concat(api.api, "/users/").concat(userId, "/promisestopurchase/history"), {
402
- method: 'POST',
403
- headers: {
404
- Authorization: "Bearer ".concat(api.token),
405
- 'Content-Type': 'application/json',
406
- 'x-gng-ecomm-token': api.userToken
407
- },
408
- body: !!body ? JSON.stringify(body) : undefined
409
- })];
410
- case 1:
411
- requestHistory = _a.sent();
412
- return [4, requestHistory.json()];
413
- case 2:
414
- responseData = _a.sent();
415
- if (responseData.status !== 200) {
416
- errorStr = !!!responseData.error
417
- ? ''
418
- : typeof responseData.error === 'string'
419
- ? responseData.error
420
- : (0, functions_1.getStringByLang)(responseData.error, 'fr');
421
- throw new Error('Error on history fetch: ' + errorStr);
422
- }
423
- return [2, responseData.data.history];
424
- }
425
- });
426
- }); };
427
- var getPromiseToPurchaseRemainingAmounts = function (userId) { return __awaiter(void 0, void 0, void 0, function () {
428
- var api, requestHistory, responseData, errorStr;
429
- return __generator(this, function (_a) {
430
- switch (_a.label) {
431
- case 0:
432
- if (!state.isPro)
433
- throw new Error('Only the PRO users have a promise to purchase');
434
- api = !!sdk ? sdk.getAPIInfos() : null;
435
- if (!!!api)
436
- return [2];
437
- if (!!!userId) {
438
- if (!!state.userData && !!state.userData.id)
439
- userId = state.userData.id;
440
- else
441
- throw new Error("Can't get remaining amounts for user without userId");
442
- }
443
- return [4, fetch("".concat(api.api, "/users/").concat(userId, "/promisestopurchase/remainingAmounts"), {
444
- method: 'GET',
445
- headers: {
446
- Authorization: "Bearer ".concat(api.token),
447
- 'Content-Type': 'application/json',
448
- 'x-gng-ecomm-token': api.userToken
449
- }
450
- })];
451
- case 1:
452
- requestHistory = _a.sent();
453
- return [4, requestHistory.json()];
454
- case 2:
455
- responseData = _a.sent();
456
- if (responseData.status !== 200) {
457
- errorStr = !!!responseData.error
458
- ? ''
459
- : typeof responseData.error === 'string'
460
- ? responseData.error
461
- : (0, functions_1.getStringByLang)(responseData.error, 'fr');
462
- throw new Error('Error on remainingAmounts fetch: ' + errorStr);
463
- }
464
- return [2, responseData.data.availableAmountsForBanks];
465
- }
466
- });
467
- }); };
468
- return ((0, jsx_runtime_1.jsx)(index_1.default.Provider, __assign({ value: __assign(__assign({}, state), { setLoaded: setLoaded, setUserLoggedIn: setUserLoggedIn, setUserLoggedOut: setUserLoggedOut, saveUser: saveUser, deleteUser: deleteUser, getOrder: getOrder, changePassword: changePassword, changeProfilePicture: changeProfilePicture, setUserPreferedStore: setUserPreferedStore, setCustomPriceList: setCustomPriceList, getPromiseToPurchaseHistory: getPromiseToPurchaseHistory, getPromiseToPurchaseRemainingAmounts: getPromiseToPurchaseRemainingAmounts }) }, { children: children })));
469
- };
470
- exports.default = UserContextProvider;
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 react_1 = require("react");
31
+ const index_1 = __importStar(require("./index"));
32
+ const useSDK_1 = __importDefault(require("../../hooks/useSDK"));
33
+ const moment_1 = __importDefault(require("moment"));
34
+ const functions_1 = require("../../../../utils/functions");
35
+ const UserContextProvider = ({ children }) => {
36
+ const sdk = (0, useSDK_1.default)();
37
+ const setUserLoggedIn = async (userData) => {
38
+ const isPro = !!userData.basic_info.customer_professionnal_info &&
39
+ !!userData.basic_info.customer_professionnal_info.proof_doc_value;
40
+ localStorage.setItem('userLogged', 'true');
41
+ if (!!isPro) {
42
+ localStorage.setItem('isPro', 'true');
43
+ }
44
+ const isClerk = localStorage.getItem('isClerk');
45
+ if (typeof window !== 'undefined' && !!isClerk) {
46
+ window.addEventListener('beforeunload', async (e) => {
47
+ if (!!!userData.temp_hash)
48
+ return;
49
+ e.preventDefault();
50
+ const dialogText = '';
51
+ e.returnValue = dialogText;
52
+ return dialogText;
53
+ });
54
+ }
55
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { isUserLoggedIn: true, userData: userData })));
56
+ };
57
+ const setUserLoggedOut = async (keepRepCart) => {
58
+ if (!!!sdk)
59
+ return;
60
+ if (!!state.userData && state.userData.temp_hash && !!!keepRepCart) {
61
+ await sdk.user.killRepCart(state.userData.temp_hash);
62
+ }
63
+ sdk.user.logout();
64
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { isUserLoggedIn: false, isPro: false, customPriceList: undefined, userData: null, resetUserData: true })));
65
+ };
66
+ const setUserPreferedStore = async (storeId) => {
67
+ if (!!!state.userData)
68
+ return;
69
+ await saveUser(Object.assign(Object.assign({}, state.userData), { prefered_store: storeId }));
70
+ };
71
+ const saveUser = async (customer) => {
72
+ if (!!!sdk)
73
+ return false;
74
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { userData: customer, isPro: !!customer.basic_info.customer_professionnal_info &&
75
+ !!customer.basic_info.customer_professionnal_info.professionnal_title })));
76
+ return await sdk.user.saveUser(customer);
77
+ };
78
+ const deleteUser = async () => {
79
+ if (!!!sdk)
80
+ return false;
81
+ return await sdk.user.deleteUser();
82
+ };
83
+ const getOrder = async (orderID, token) => {
84
+ if (!!!sdk)
85
+ return 'sdk_not_defined';
86
+ try {
87
+ const order = await sdk.user.getOrder(orderID, token);
88
+ return order;
89
+ }
90
+ catch (err) {
91
+ return 'error';
92
+ }
93
+ };
94
+ const changePassword = async (currentPassword, newPassword) => {
95
+ if (!!!sdk)
96
+ return 'sdk_not_defined';
97
+ try {
98
+ return await sdk.user.changePassword(currentPassword, newPassword);
99
+ }
100
+ catch (err) {
101
+ return err;
102
+ }
103
+ };
104
+ const changeProfilePicture = async (base64) => {
105
+ if (!!!sdk)
106
+ return 'sdk_not_defined';
107
+ try {
108
+ const upload = await sdk.user.changeProfilePicture(base64);
109
+ setState((prevState) => {
110
+ if (prevState.userData) {
111
+ return Object.assign(Object.assign({}, prevState), { userData: Object.assign(Object.assign({}, prevState.userData), { basic_info: Object.assign(Object.assign({}, prevState.userData.basic_info), { customer_image: upload === "Can't upload image." || upload === 'done' ? undefined : upload }) }) });
112
+ }
113
+ return prevState;
114
+ });
115
+ return upload;
116
+ }
117
+ catch (err) {
118
+ return err;
119
+ }
120
+ };
121
+ const setCustomPriceList = (list) => {
122
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { customPriceList: list, fetchCustomPrices: false })));
123
+ localStorage.setItem('customPriceList', JSON.stringify(list));
124
+ localStorage.setItem('lastCustomPriceFetch', (0, moment_1.default)().format('YYYY-MM-DD'));
125
+ };
126
+ const setLoaded = (value) => {
127
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loaded: value })));
128
+ };
129
+ const [state, setState] = (0, react_1.useState)((0, index_1.getDefaultUserContext)());
130
+ (0, react_1.useEffect)(() => {
131
+ if (!!!sdk)
132
+ return;
133
+ const userLoggedData = localStorage.getItem('userLogged');
134
+ const userIsPro = localStorage.getItem('isPro');
135
+ const isClerk = localStorage.getItem('isClerk');
136
+ const isLoggedIn = !!userLoggedData && JSON.parse(userLoggedData);
137
+ const isPro = !!userLoggedData && !!userIsPro && JSON.parse(userIsPro);
138
+ let newState = Object.assign({ isUserLoggedIn: !!!isClerk && !!isLoggedIn, isPro: !!!isClerk && !!isPro }, checkForCustomPriceList(!!userIsPro));
139
+ if (!!isClerk) {
140
+ localStorage.removeItem('isClerk');
141
+ }
142
+ return setState((prevState) => (Object.assign(Object.assign(Object.assign({}, prevState), newState), { loaded: true })));
143
+ }, [sdk]);
144
+ (0, react_1.useEffect)(() => {
145
+ if (!!!state.fetchCustomPrices || !!!state.isPro || !!!state.userData || !!!sdk)
146
+ return;
147
+ const fetchCustomPrices = async () => {
148
+ const proUser = !!state.userData && !!state.isPro ? state.userData.id : '';
149
+ if (!!!proUser)
150
+ return;
151
+ try {
152
+ const newList = await sdk.user.fetchCustomPriceList(proUser);
153
+ if (!!newList) {
154
+ setCustomPriceList(newList);
155
+ }
156
+ }
157
+ catch (e) {
158
+ console.log('error on fetching customPrices from G2: ', e.toString());
159
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { fetchCustomPrices: false, customPriceList: undefined })));
160
+ }
161
+ };
162
+ fetchCustomPrices();
163
+ }, [sdk, state.fetchCustomPrices, state.isPro, state.userData]);
164
+ (0, react_1.useEffect)(() => {
165
+ if (!!!sdk)
166
+ return;
167
+ if (!state.isUserLoggedIn) {
168
+ return;
169
+ }
170
+ const getContent = async () => {
171
+ let user;
172
+ try {
173
+ user = (await sdk.user.getUser(!!localStorage.getItem('isClerk')));
174
+ if (!!!user) {
175
+ localStorage.setItem('isPro', JSON.stringify(false));
176
+ localStorage.removeItem('foundInG2');
177
+ if (!!localStorage.getItem('customPriceList')) {
178
+ localStorage.removeItem('customPriceList');
179
+ localStorage.removeItem('lastCustomPriceFetch');
180
+ }
181
+ return setState((prevState) => (Object.assign(Object.assign(Object.assign({}, prevState), { userData: null, isPro: false }), (!!prevState.customPriceList
182
+ ? {
183
+ customPriceList: undefined
184
+ }
185
+ : {}))));
186
+ }
187
+ const checkIsPro = !!user.basic_info.customer_professionnal_info &&
188
+ !!user.basic_info.customer_professionnal_info.professionnal_title;
189
+ setState((prevState) => (Object.assign(Object.assign(Object.assign({}, prevState), { userData: user, isPro: checkIsPro }), checkForCustomPriceList(checkIsPro))));
190
+ localStorage.setItem('isPro', JSON.stringify(checkIsPro));
191
+ if (!!!checkIsPro) {
192
+ localStorage.removeItem('foundInG2');
193
+ if (!!localStorage.getItem('customPriceList')) {
194
+ localStorage.removeItem('customPriceList');
195
+ localStorage.removeItem('lastCustomPriceFetch');
196
+ }
197
+ }
198
+ }
199
+ catch (err) {
200
+ if (!!err.message) {
201
+ const error = JSON.parse(err.message);
202
+ if (!!error && !!error.error) {
203
+ await setUserLoggedOut();
204
+ }
205
+ }
206
+ }
207
+ };
208
+ getContent();
209
+ }, [sdk, state.isUserLoggedIn]);
210
+ (0, react_1.useEffect)(() => {
211
+ return () => {
212
+ if (typeof window !== 'undefined') {
213
+ window.removeEventListener('onbeforeunload', async () => { });
214
+ }
215
+ };
216
+ }, []);
217
+ const checkForCustomPriceList = (userIsPro) => {
218
+ const hasCustomPriceList = !!userIsPro && localStorage.getItem('customPriceList');
219
+ const lastCustomPriceFetch = !!userIsPro && localStorage.getItem('lastCustomPriceFetch');
220
+ const foundProInG2 = !!userIsPro && localStorage.getItem('foundInG2');
221
+ const lastFetchWasBefore = !!userIsPro &&
222
+ (!!!lastCustomPriceFetch || (!!lastCustomPriceFetch && (0, moment_1.default)().isAfter((0, moment_1.default)(lastCustomPriceFetch), 'day')));
223
+ let parsedJSONCustomPrices = [];
224
+ if (!!hasCustomPriceList) {
225
+ try {
226
+ parsedJSONCustomPrices = JSON.parse(hasCustomPriceList);
227
+ }
228
+ catch (e) {
229
+ console.log(e.toString());
230
+ }
231
+ }
232
+ return Object.assign(Object.assign({}, (!!!lastFetchWasBefore && !!foundProInG2
233
+ ? { customPriceList: parsedJSONCustomPrices }
234
+ : { customPriceList: undefined })), (!!lastFetchWasBefore && !!foundProInG2 ? { fetchCustomPrices: true } : {}));
235
+ };
236
+ const getPromiseToPurchaseHistory = async (userId, filters) => {
237
+ if (!state.isPro)
238
+ throw new Error('Only the PRO users have a promise to purchase');
239
+ const api = !!sdk ? sdk.getAPIInfos() : null;
240
+ if (!!!api)
241
+ return;
242
+ if (!!!userId) {
243
+ if (!!state.userData && !!state.userData.id)
244
+ userId = state.userData.id;
245
+ else
246
+ throw new Error("Can't get user promise to purchase without userId");
247
+ }
248
+ let body = undefined;
249
+ if (!!filters) {
250
+ body = Object.assign(Object.assign({}, (!!filters.bankTypeId
251
+ ? {
252
+ bank_type_id: filters.bankTypeId
253
+ }
254
+ : {})), (!!filters.unixDateRange
255
+ ? {
256
+ unix_date_range: filters.unixDateRange
257
+ }
258
+ : {}));
259
+ }
260
+ const requestHistory = await fetch(`${api.api}/users/${userId}/promisestopurchase/history`, {
261
+ method: 'POST',
262
+ headers: {
263
+ Authorization: `Bearer ${api.token}`,
264
+ 'Content-Type': 'application/json',
265
+ 'x-gng-ecomm-token': api.userToken
266
+ },
267
+ body: !!body ? JSON.stringify(body) : undefined
268
+ });
269
+ const responseData = await requestHistory.json();
270
+ if (responseData.status !== 200) {
271
+ const errorStr = !!!responseData.error
272
+ ? ''
273
+ : typeof responseData.error === 'string'
274
+ ? responseData.error
275
+ : (0, functions_1.getStringByLang)(responseData.error, 'fr');
276
+ throw new Error('Error on history fetch: ' + errorStr);
277
+ }
278
+ return responseData.data.history;
279
+ };
280
+ const getPromiseToPurchaseRemainingAmounts = async (userId) => {
281
+ if (!state.isPro)
282
+ throw new Error('Only the PRO users have a promise to purchase');
283
+ const api = !!sdk ? sdk.getAPIInfos() : null;
284
+ if (!!!api)
285
+ return;
286
+ if (!!!userId) {
287
+ if (!!state.userData && !!state.userData.id)
288
+ userId = state.userData.id;
289
+ else
290
+ throw new Error("Can't get remaining amounts for user without userId");
291
+ }
292
+ const requestHistory = await fetch(`${api.api}/users/${userId}/promisestopurchase/remainingAmounts`, {
293
+ method: 'GET',
294
+ headers: {
295
+ Authorization: `Bearer ${api.token}`,
296
+ 'Content-Type': 'application/json',
297
+ 'x-gng-ecomm-token': api.userToken
298
+ }
299
+ });
300
+ const responseData = await requestHistory.json();
301
+ if (responseData.status !== 200) {
302
+ const errorStr = !!!responseData.error
303
+ ? ''
304
+ : typeof responseData.error === 'string'
305
+ ? responseData.error
306
+ : (0, functions_1.getStringByLang)(responseData.error, 'fr');
307
+ throw new Error('Error on remainingAmounts fetch: ' + errorStr);
308
+ }
309
+ return responseData.data.availableAmountsForBanks;
310
+ };
311
+ return ((0, jsx_runtime_1.jsx)(index_1.default.Provider, Object.assign({ value: Object.assign(Object.assign({}, state), { setLoaded: setLoaded, setUserLoggedIn: setUserLoggedIn, setUserLoggedOut: setUserLoggedOut, saveUser: saveUser, deleteUser: deleteUser, getOrder: getOrder, changePassword: changePassword, changeProfilePicture: changeProfilePicture, setUserPreferedStore: setUserPreferedStore, setCustomPriceList: setCustomPriceList, getPromiseToPurchaseHistory: getPromiseToPurchaseHistory, getPromiseToPurchaseRemainingAmounts: getPromiseToPurchaseRemainingAmounts }) }, { children: children })));
312
+ };
313
+ exports.default = UserContextProvider;
471
314
  //# sourceMappingURL=UserContextProvider.js.map