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,113 +1,113 @@
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 _1 = __importStar(require("."));
32
- const useSDK_1 = __importDefault(require("../../hooks/useSDK"));
33
- const useSnackbar_1 = __importDefault(require("../../hooks/useSnackbar"));
34
- const useUser_1 = __importDefault(require("../../hooks/useUser"));
35
- const ISnackbarContext_1 = require("../SnackbarContext/interfaces/ISnackbarContext");
36
- function StockNotifContextProvider({ locale, children }) {
37
- const { setSnackbar } = (0, useSnackbar_1.default)();
38
- const sdk = (0, useSDK_1.default)();
39
- const { isUserLoggedIn, userData } = (0, useUser_1.default)();
40
- const [dbStockNotif, setDbStockNotif] = (0, react_1.useState)();
41
- const addItem = (product_slug, product_name) => {
42
- let alreadyInStockNotif = false;
43
- setstate((prevstate) => {
44
- alreadyInStockNotif = prevstate.stockNotif.items.map((item) => item).includes(product_slug);
45
- let newItems = prevstate.stockNotif.items;
46
- if (!!!alreadyInStockNotif) {
47
- newItems = [...prevstate.stockNotif.items, product_slug];
48
- }
49
- return Object.assign(Object.assign({}, prevstate), { stockNotif: Object.assign(Object.assign({}, prevstate.stockNotif), { items: newItems }) });
50
- });
51
- if (alreadyInStockNotif) {
52
- setSnackbar({
53
- title: "Cet item est déjà dans votre liste d'alertes",
54
- type: ISnackbarContext_1.SnackbarTypeEnum.ERROR,
55
- isShown: true
56
- });
57
- }
58
- else {
59
- setSnackbar({
60
- title: `${product_name} a bien été ajouté à votre liste d'alertes`,
61
- type: ISnackbarContext_1.SnackbarTypeEnum.SUCCESS,
62
- isShown: true
63
- });
64
- }
65
- };
66
- const removeItem = (product_slug, product_name) => {
67
- setstate((prevstate) => {
68
- const newItems = prevstate.stockNotif.items.filter((item) => item !== product_slug);
69
- return Object.assign(Object.assign({}, prevstate), { stockNotif: Object.assign(Object.assign({}, prevstate.stockNotif), { items: newItems }) });
70
- });
71
- setSnackbar({
72
- title: `${product_name} à bien été retiré de votre liste d'alertes`,
73
- type: ISnackbarContext_1.SnackbarTypeEnum.ALERT,
74
- isShown: true
75
- });
76
- };
77
- const [state, setstate] = (0, react_1.useState)(Object.assign({}, _1.defaultStockNotif));
78
- (0, react_1.useEffect)(() => {
79
- const getData = async () => {
80
- if (!!!sdk)
81
- return;
82
- if (!!!isUserLoggedIn || !!!userData) {
83
- if (!!state.stockNotif) {
84
- setstate((prevState) => (Object.assign(Object.assign({}, prevState), { stockNotif: _1.defaultStockNotif.stockNotif })));
85
- }
86
- return;
87
- }
88
- const currentStockNotif = Object.assign(Object.assign({}, state.stockNotif), { customer_id: String(userData.id), user_email: !!userData.basic_info.customer_email ? userData.basic_info.customer_email : '', locale: locale || 'fr' });
89
- let _stockNotif = await sdk.initStockNotif(currentStockNotif);
90
- if (!!!_stockNotif)
91
- return;
92
- const stockNotifData = _stockNotif.data();
93
- if (!!!stockNotifData)
94
- return;
95
- setstate((prevState) => (Object.assign(Object.assign({}, prevState), { stockNotif: stockNotifData })));
96
- if (!!!_stockNotif)
97
- return;
98
- setDbStockNotif(_stockNotif);
99
- };
100
- getData();
101
- }, [isUserLoggedIn, sdk, userData]);
102
- (0, react_1.useEffect)(() => {
103
- setstate((prevState) => (Object.assign(Object.assign({}, prevState), { stockNotif: Object.assign(Object.assign({}, prevState.stockNotif), { locale: locale || 'fr' }) })));
104
- }, [locale]);
105
- (0, react_1.useEffect)(() => {
106
- if (!!isUserLoggedIn && !!userData && !!dbStockNotif) {
107
- dbStockNotif.saveToDatabase(state.stockNotif);
108
- }
109
- }, [state.stockNotif, dbStockNotif]);
110
- return ((0, jsx_runtime_1.jsx)(_1.default.Provider, Object.assign({ value: Object.assign(Object.assign({}, state), { addItem, removeItem }) }, { children: (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: children }) })));
111
- }
112
- exports.default = StockNotifContextProvider;
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 _1 = __importStar(require("."));
32
+ const useSDK_1 = __importDefault(require("../../hooks/useSDK"));
33
+ const useSnackbar_1 = __importDefault(require("../../hooks/useSnackbar"));
34
+ const useUser_1 = __importDefault(require("../../hooks/useUser"));
35
+ const ISnackbarContext_1 = require("../SnackbarContext/interfaces/ISnackbarContext");
36
+ function StockNotifContextProvider({ locale, children }) {
37
+ const { setSnackbar } = (0, useSnackbar_1.default)();
38
+ const sdk = (0, useSDK_1.default)();
39
+ const { isUserLoggedIn, userData } = (0, useUser_1.default)();
40
+ const [dbStockNotif, setDbStockNotif] = (0, react_1.useState)();
41
+ const addItem = (product_slug, product_name) => {
42
+ let alreadyInStockNotif = false;
43
+ setstate((prevstate) => {
44
+ alreadyInStockNotif = prevstate.stockNotif.items.map((item) => item).includes(product_slug);
45
+ let newItems = prevstate.stockNotif.items;
46
+ if (!!!alreadyInStockNotif) {
47
+ newItems = [...prevstate.stockNotif.items, product_slug];
48
+ }
49
+ return Object.assign(Object.assign({}, prevstate), { stockNotif: Object.assign(Object.assign({}, prevstate.stockNotif), { items: newItems }) });
50
+ });
51
+ if (alreadyInStockNotif) {
52
+ setSnackbar({
53
+ title: "Cet item est déjà dans votre liste d'alertes",
54
+ type: ISnackbarContext_1.SnackbarTypeEnum.ERROR,
55
+ isShown: true
56
+ });
57
+ }
58
+ else {
59
+ setSnackbar({
60
+ title: `${product_name} a bien été ajouté à votre liste d'alertes`,
61
+ type: ISnackbarContext_1.SnackbarTypeEnum.SUCCESS,
62
+ isShown: true
63
+ });
64
+ }
65
+ };
66
+ const removeItem = (product_slug, product_name) => {
67
+ setstate((prevstate) => {
68
+ const newItems = prevstate.stockNotif.items.filter((item) => item !== product_slug);
69
+ return Object.assign(Object.assign({}, prevstate), { stockNotif: Object.assign(Object.assign({}, prevstate.stockNotif), { items: newItems }) });
70
+ });
71
+ setSnackbar({
72
+ title: `${product_name} à bien été retiré de votre liste d'alertes`,
73
+ type: ISnackbarContext_1.SnackbarTypeEnum.ALERT,
74
+ isShown: true
75
+ });
76
+ };
77
+ const [state, setstate] = (0, react_1.useState)(Object.assign({}, _1.defaultStockNotif));
78
+ (0, react_1.useEffect)(() => {
79
+ const getData = async () => {
80
+ if (!!!sdk)
81
+ return;
82
+ if (!!!isUserLoggedIn || !!!userData) {
83
+ if (!!state.stockNotif) {
84
+ setstate((prevState) => (Object.assign(Object.assign({}, prevState), { stockNotif: _1.defaultStockNotif.stockNotif })));
85
+ }
86
+ return;
87
+ }
88
+ const currentStockNotif = Object.assign(Object.assign({}, state.stockNotif), { customer_id: String(userData.id), user_email: !!userData.basic_info.customer_email ? userData.basic_info.customer_email : '', locale: locale || 'fr' });
89
+ let _stockNotif = await sdk.initStockNotif(currentStockNotif);
90
+ if (!!!_stockNotif)
91
+ return;
92
+ const stockNotifData = _stockNotif.data();
93
+ if (!!!stockNotifData)
94
+ return;
95
+ setstate((prevState) => (Object.assign(Object.assign({}, prevState), { stockNotif: stockNotifData })));
96
+ if (!!!_stockNotif)
97
+ return;
98
+ setDbStockNotif(_stockNotif);
99
+ };
100
+ getData();
101
+ }, [isUserLoggedIn, sdk, userData]);
102
+ (0, react_1.useEffect)(() => {
103
+ setstate((prevState) => (Object.assign(Object.assign({}, prevState), { stockNotif: Object.assign(Object.assign({}, prevState.stockNotif), { locale: locale || 'fr' }) })));
104
+ }, [locale]);
105
+ (0, react_1.useEffect)(() => {
106
+ if (!!isUserLoggedIn && !!userData && !!dbStockNotif) {
107
+ dbStockNotif.saveToDatabase(state.stockNotif);
108
+ }
109
+ }, [state.stockNotif, dbStockNotif]);
110
+ return ((0, jsx_runtime_1.jsx)(_1.default.Provider, Object.assign({ value: Object.assign(Object.assign({}, state), { addItem, removeItem }) }, { children: (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: children }) })));
111
+ }
112
+ exports.default = StockNotifContextProvider;
113
113
  //# sourceMappingURL=StockNotifContextProvider.js.map
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
- import IStockNotification from 'addio-admin-sdk/dist/Interfaces/StockNotification';
3
- export declare const defaultStockNotif: IStockNotifContext;
4
- declare const _default: import("react").Context<IStockNotifContext>;
5
- export default _default;
6
- export interface IStockNotifContext {
7
- stockNotif: IStockNotification;
8
- addItem: (_product_slug: string, _product_name: string) => void;
9
- removeItem: (_product_slug: string, _product_name: string) => void;
10
- }
1
+ /// <reference types="react" />
2
+ import IStockNotification from 'addio-admin-sdk/dist/Interfaces/StockNotification';
3
+ export declare const defaultStockNotif: IStockNotifContext;
4
+ declare const _default: import("react").Context<IStockNotifContext>;
5
+ export default _default;
6
+ export interface IStockNotifContext {
7
+ stockNotif: IStockNotification;
8
+ addItem: (_product_slug: string, _product_name: string) => void;
9
+ removeItem: (_product_slug: string, _product_name: string) => void;
10
+ }
@@ -1,11 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultStockNotif = void 0;
4
- const react_1 = require("react");
5
- exports.defaultStockNotif = {
6
- stockNotif: { id: '', customer_id: '', user_email: '', items: [], locale: 'fr' },
7
- addItem: () => { },
8
- removeItem: () => { }
9
- };
10
- exports.default = (0, react_1.createContext)(exports.defaultStockNotif);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultStockNotif = void 0;
4
+ const react_1 = require("react");
5
+ exports.defaultStockNotif = {
6
+ stockNotif: { id: '', customer_id: '', user_email: '', items: [], locale: 'fr' },
7
+ addItem: () => { },
8
+ removeItem: () => { }
9
+ };
10
+ exports.default = (0, react_1.createContext)(exports.defaultStockNotif);
11
11
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- declare const UserContextProvider: ({ children }: {
3
- children: JSX.Element;
4
- }) => JSX.Element;
5
- export default UserContextProvider;
1
+ /// <reference types="react" />
2
+ declare const UserContextProvider: ({ children }: {
3
+ children: JSX.Element;
4
+ }) => JSX.Element;
5
+ export default UserContextProvider;