addio-ecomm-sdk 1.3.71 → 1.3.72

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 (106) hide show
  1. package/.vscode/settings.json +34 -34
  2. package/README.md +79 -79
  3. package/dist/index.d.ts +202 -202
  4. package/dist/index.js +1818 -1818
  5. package/dist/lib/constants/components/CreditCardInput.d.ts +11 -11
  6. package/dist/lib/constants/components/CreditCardInput.js +79 -79
  7. package/dist/lib/constants/components/Snackbar.d.ts +11 -11
  8. package/dist/lib/constants/components/Snackbar.js +39 -39
  9. package/dist/lib/constants/contexts/CartContext/CartContextProvider.d.ts +7 -7
  10. package/dist/lib/constants/contexts/CartContext/CartContextProvider.js +980 -980
  11. package/dist/lib/constants/contexts/CartContext/index.d.ts +79 -79
  12. package/dist/lib/constants/contexts/CartContext/index.js +127 -127
  13. package/dist/lib/constants/contexts/DataContext/DataContextProvider.d.ts +15 -15
  14. package/dist/lib/constants/contexts/DataContext/DataContextProvider.js +299 -299
  15. package/dist/lib/constants/contexts/DataContext/index.d.ts +46 -46
  16. package/dist/lib/constants/contexts/DataContext/index.js +66 -66
  17. package/dist/lib/constants/contexts/LogContext/LogContextProvider.d.ts +6 -6
  18. package/dist/lib/constants/contexts/LogContext/LogContextProvider.js +103 -103
  19. package/dist/lib/constants/contexts/LogContext/index.d.ts +7 -7
  20. package/dist/lib/constants/contexts/LogContext/index.js +45 -45
  21. package/dist/lib/constants/contexts/ModalContext/ModalContextProvider.d.ts +7 -7
  22. package/dist/lib/constants/contexts/ModalContext/ModalContextProvider.js +76 -76
  23. package/dist/lib/constants/contexts/ModalContext/index.d.ts +14 -14
  24. package/dist/lib/constants/contexts/ModalContext/index.js +18 -18
  25. package/dist/lib/constants/contexts/SDKContext/SDKProvider.d.ts +8 -8
  26. package/dist/lib/constants/contexts/SDKContext/SDKProvider.js +79 -79
  27. package/dist/lib/constants/contexts/SDKContext/index.d.ts +4 -4
  28. package/dist/lib/constants/contexts/SDKContext/index.js +4 -4
  29. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContext.d.ts +4 -4
  30. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContext.js +6 -6
  31. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContextProvider.d.ts +12 -12
  32. package/dist/lib/constants/contexts/SnackbarContext/SnackbarContextProvider.js +52 -52
  33. package/dist/lib/constants/contexts/SnackbarContext/interfaces/ISnackbarContext.d.ts +17 -17
  34. package/dist/lib/constants/contexts/SnackbarContext/interfaces/ISnackbarContext.js +21 -21
  35. package/dist/lib/constants/contexts/StockNotifContext/StockNotifContextProvider.d.ts +7 -7
  36. package/dist/lib/constants/contexts/StockNotifContext/StockNotifContextProvider.js +179 -179
  37. package/dist/lib/constants/contexts/StockNotifContext/index.d.ts +10 -10
  38. package/dist/lib/constants/contexts/StockNotifContext/index.js +10 -10
  39. package/dist/lib/constants/contexts/UserContext/UserContextProvider.d.ts +5 -5
  40. package/dist/lib/constants/contexts/UserContext/UserContextProvider.js +470 -470
  41. package/dist/lib/constants/contexts/UserContext/index.d.ts +54 -54
  42. package/dist/lib/constants/contexts/UserContext/index.js +82 -82
  43. package/dist/lib/constants/contexts/WishlistContext/WishlistContextProvider.d.ts +6 -6
  44. package/dist/lib/constants/contexts/WishlistContext/WishlistContextProvider.js +327 -327
  45. package/dist/lib/constants/contexts/WishlistContext/index.d.ts +12 -12
  46. package/dist/lib/constants/contexts/WishlistContext/index.js +12 -12
  47. package/dist/lib/constants/hooks/useCart.d.ts +2 -2
  48. package/dist/lib/constants/hooks/useCart.js +11 -11
  49. package/dist/lib/constants/hooks/useData.d.ts +2 -2
  50. package/dist/lib/constants/hooks/useData.js +11 -11
  51. package/dist/lib/constants/hooks/useLogs.d.ts +2 -2
  52. package/dist/lib/constants/hooks/useLogs.js +11 -11
  53. package/dist/lib/constants/hooks/useModal.d.ts +2 -2
  54. package/dist/lib/constants/hooks/useModal.js +11 -11
  55. package/dist/lib/constants/hooks/useSDK.d.ts +2 -2
  56. package/dist/lib/constants/hooks/useSDK.js +11 -11
  57. package/dist/lib/constants/hooks/useSnackbar.d.ts +2 -2
  58. package/dist/lib/constants/hooks/useSnackbar.js +11 -11
  59. package/dist/lib/constants/hooks/useStockNotif.d.ts +2 -2
  60. package/dist/lib/constants/hooks/useStockNotif.js +11 -11
  61. package/dist/lib/constants/hooks/useUser.d.ts +2 -2
  62. package/dist/lib/constants/hooks/useUser.js +11 -11
  63. package/dist/lib/constants/hooks/useWishlist.d.ts +2 -2
  64. package/dist/lib/constants/hooks/useWishlist.js +11 -11
  65. package/dist/lib/models/image/index.d.ts +6 -6
  66. package/dist/lib/models/image/index.js +15 -15
  67. package/dist/lib/models/stockNotification/index.d.ts +13 -13
  68. package/dist/lib/models/stockNotification/index.js +130 -130
  69. package/dist/lib/models/wishlist/index.d.ts +14 -14
  70. package/dist/lib/models/wishlist/index.js +155 -155
  71. package/dist/utils/StripeErrors.d.ts +24 -24
  72. package/dist/utils/StripeErrors.js +55 -55
  73. package/dist/utils/algolia.d.ts +3 -3
  74. package/dist/utils/algolia.js +81 -81
  75. package/dist/utils/analytics.d.ts +71 -71
  76. package/dist/utils/analytics.js +257 -257
  77. package/dist/utils/cart.d.ts +3 -3
  78. package/dist/utils/cart.js +66 -66
  79. package/dist/utils/contentful.d.ts +10 -10
  80. package/dist/utils/contentful.js +136 -136
  81. package/dist/utils/functions.d.ts +21 -21
  82. package/dist/utils/functions.js +195 -195
  83. package/dist/utils/getSDK.d.ts +4 -4
  84. package/dist/utils/getSDK.js +77 -77
  85. package/dist/utils/initStoreData.d.ts +3 -3
  86. package/dist/utils/initStoreData.js +62 -62
  87. package/dist/utils/interfaces/IClientCMSData.d.ts +132 -132
  88. package/dist/utils/interfaces/IClientCMSData.js +2 -2
  89. package/dist/utils/interfaces/IEndpointResult.d.ts +10 -10
  90. package/dist/utils/interfaces/IEndpointResult.js +2 -2
  91. package/dist/utils/interfaces/IFacebookUserProfile.d.ts +10 -10
  92. package/dist/utils/interfaces/IFacebookUserProfile.js +2 -2
  93. package/dist/utils/interfaces/IFilter.d.ts +23 -23
  94. package/dist/utils/interfaces/IFilter.js +2 -2
  95. package/dist/utils/interfaces/IGoogleUserProfile.d.ts +7 -7
  96. package/dist/utils/interfaces/IGoogleUserProfile.js +2 -2
  97. package/dist/utils/interfaces/ISDKConfig.d.ts +7 -7
  98. package/dist/utils/interfaces/ISDKConfig.js +2 -2
  99. package/dist/utils/interfaces/ISpaceData.d.ts +18 -18
  100. package/dist/utils/interfaces/ISpaceData.js +2 -2
  101. package/dist/utils/larivieremeunier.d.ts +3 -3
  102. package/dist/utils/larivieremeunier.js +156 -156
  103. package/dist/utils/technosupply.d.ts +3 -3
  104. package/dist/utils/technosupply.js +155 -155
  105. package/package.json +61 -61
  106. package/publish.sh +132 -132
@@ -1,79 +1,79 @@
1
- import React from 'react';
2
- import { IExpeditionInfo } from 'addio-admin-sdk/dist/Interfaces/Customer';
3
- import ICart, { IActionDoneOnCart, ICartItem, ICartPromoApplied, IShippingQuote, PaymentTypeEnum } from 'addio-admin-sdk/dist/Interfaces/Cart';
4
- import IStripePayload from 'addio-admin-sdk/dist/Interfaces/Cart/IStripePayload';
5
- import IPaypalPayload from 'addio-admin-sdk/dist/Interfaces/Cart/IPaypalPayload';
6
- import ILang from 'addio-admin-sdk/dist/utils/string';
7
- import { ICustomPriceItem } from 'addio-admin-sdk/dist/Interfaces/G2';
8
- import { ApplyBanksToCartErrorsEnum } from 'addio-admin-sdk/dist/Interfaces/PromiseToPurchase';
9
- import { RuleFieldEnum } from 'addio-admin-sdk/dist/Interfaces/Rules/IDiscountRule';
10
- export interface ICartContext {
11
- readonly loading: boolean;
12
- readonly cartData?: ICart;
13
- readonly cartErrors: string[];
14
- readonly isGuest?: string;
15
- readonly setIsGuest: (isGuest: string) => void;
16
- readonly setCartErrors: (errorCodes: string[]) => void;
17
- readonly setCartData: (cart: ICart) => void;
18
- readonly saveCart: (cartData?: Partial<ICart>, saveToDatabase?: boolean, promo_code?: string | undefined, onlyNewCart?: boolean, onlyPartial?: boolean) => Promise<ICart>;
19
- readonly setCartLoading: (value: boolean) => void;
20
- readonly getCartFromDatabase: (cardID: string) => Promise<ICart | undefined>;
21
- readonly handlePayment: (data?: any) => Promise<{
22
- accessToken?: string;
23
- error?: ILang;
24
- }>;
25
- readonly cartSliderOpen: boolean;
26
- readonly addItem: (cartData: ICart | undefined, items: ICartItem | ICartItem[], retro?: boolean, useParentName?: boolean, saveToDatabase?: boolean, defaultAdd?: boolean, isServiceUpsellOfSku?: boolean, customPriceList?: ICustomPriceItem[]) => Promise<ICart>;
27
- readonly setCartSliderOpen: (open: boolean) => void;
28
- readonly updateItem: (cartData: ICart | undefined, items: {
29
- sku: string;
30
- qte: number;
31
- }[] | {
32
- sku: string;
33
- qte: number;
34
- }, saveToDatabase?: boolean) => Promise<ICart>;
35
- readonly deleteItem: (cartData: ICart | undefined, sku: string | string[], saveToDatabase?: boolean, onlyIfUpsellOf?: string) => Promise<ICart>;
36
- readonly verifyCart: () => Promise<false | IActionDoneOnCart[]>;
37
- readonly uploadFileToOrder: (newCart: ICart | undefined, file: File, propsName: string, saveToDatabase?: boolean) => Promise<{
38
- cart: ICart;
39
- data: undefined;
40
- error: string;
41
- } | {
42
- cart: ICart;
43
- data: {
44
- url: string;
45
- ref: string;
46
- };
47
- error: undefined;
48
- } | undefined>;
49
- readonly updateEmail: (newCart: ICart | undefined, email: string, saveToDatabase: boolean) => Promise<ICart>;
50
- readonly updateDefaultCustomer: (newCart: ICart | undefined, email: string, id: string, pro_info?: {
51
- pro_title?: string;
52
- pro_proof_doc?: string;
53
- customer_external_code?: string;
54
- }, saveToDatabase?: boolean) => Promise<ICart>;
55
- readonly emptyCart: (removeCartIDFromLocalStorage?: boolean) => Promise<boolean>;
56
- readonly saveOrder: (payload: IStripePayload | IPaypalPayload) => Promise<{
57
- orderID: string;
58
- accessToken: string;
59
- } | 'error'>;
60
- readonly updateShippingAddress: (cartData: ICart | undefined, _isPickup: boolean, _shipping: IExpeditionInfo | undefined, saveToDatabase?: boolean, setCAIfNoCountry?: boolean) => Promise<ICart>;
61
- readonly updateBillingAddress: (cartData: ICart | undefined, _billing: IExpeditionInfo, saveToDatabase?: boolean, setCAIfNoCountry?: boolean) => Promise<ICart>;
62
- readonly getIsSameBillingThenShipping: () => boolean;
63
- readonly setShippingPayload: (newCart: ICart | undefined, payload: any, saveToDatabase?: boolean) => Promise<ICart>;
64
- readonly removeDiscountRule: (cart: ICart, code: string) => Promise<boolean>;
65
- readonly getShippingQuotes: () => Promise<Partial<IShippingQuote>[] | undefined>;
66
- readonly selectShippingQuote: (_quote: Partial<IShippingQuote>) => Promise<ICart | undefined>;
67
- readonly setPromoCode: (promo_code: string) => Promise<void>;
68
- readonly getApplicablePromos: (forceShipping: boolean) => Promise<ICartPromoApplied[] | undefined>;
69
- readonly canBePaidWithPA: (userId: string) => Promise<{
70
- canBePaid: boolean;
71
- updatedCart: ICart | undefined;
72
- canBePaidReason?: ApplyBanksToCartErrorsEnum;
73
- } | undefined>;
74
- readonly getPaymentIncentiveDiscountAmount: (skipCheckForRuleFields?: RuleFieldEnum[]) => number | undefined;
75
- readonly setPaidBy: (paidByValue: PaymentTypeEnum | null, customPriceList?: ICustomPriceItem[] | undefined, chosenPayment?: PaymentTypeEnum) => Promise<void>;
76
- }
77
- export declare const getDefaultCartContext: () => ICartContext;
78
- declare const CartContext: React.Context<ICartContext>;
79
- export default CartContext;
1
+ import React from 'react';
2
+ import { IExpeditionInfo } from 'addio-admin-sdk/dist/Interfaces/Customer';
3
+ import ICart, { IActionDoneOnCart, ICartItem, ICartPromoApplied, IShippingQuote, PaymentTypeEnum } from 'addio-admin-sdk/dist/Interfaces/Cart';
4
+ import IStripePayload from 'addio-admin-sdk/dist/Interfaces/Cart/IStripePayload';
5
+ import IPaypalPayload from 'addio-admin-sdk/dist/Interfaces/Cart/IPaypalPayload';
6
+ import ILang from 'addio-admin-sdk/dist/utils/string';
7
+ import { ICustomPriceItem } from 'addio-admin-sdk/dist/Interfaces/G2';
8
+ import { ApplyBanksToCartErrorsEnum } from 'addio-admin-sdk/dist/Interfaces/PromiseToPurchase';
9
+ import { RuleFieldEnum } from 'addio-admin-sdk/dist/Interfaces/Rules/IDiscountRule';
10
+ export interface ICartContext {
11
+ readonly loading: boolean;
12
+ readonly cartData?: ICart;
13
+ readonly cartErrors: string[];
14
+ readonly isGuest?: string;
15
+ readonly setIsGuest: (isGuest: string) => void;
16
+ readonly setCartErrors: (errorCodes: string[]) => void;
17
+ readonly setCartData: (cart: ICart) => void;
18
+ readonly saveCart: (cartData?: Partial<ICart>, saveToDatabase?: boolean, promo_code?: string | undefined, onlyNewCart?: boolean, onlyPartial?: boolean) => Promise<ICart>;
19
+ readonly setCartLoading: (value: boolean) => void;
20
+ readonly getCartFromDatabase: (cardID: string) => Promise<ICart | undefined>;
21
+ readonly handlePayment: (data?: any) => Promise<{
22
+ accessToken?: string;
23
+ error?: ILang;
24
+ }>;
25
+ readonly cartSliderOpen: boolean;
26
+ readonly addItem: (cartData: ICart | undefined, items: ICartItem | ICartItem[], retro?: boolean, useParentName?: boolean, saveToDatabase?: boolean, defaultAdd?: boolean, isServiceUpsellOfSku?: boolean, customPriceList?: ICustomPriceItem[]) => Promise<ICart>;
27
+ readonly setCartSliderOpen: (open: boolean) => void;
28
+ readonly updateItem: (cartData: ICart | undefined, items: {
29
+ sku: string;
30
+ qte: number;
31
+ }[] | {
32
+ sku: string;
33
+ qte: number;
34
+ }, saveToDatabase?: boolean) => Promise<ICart>;
35
+ readonly deleteItem: (cartData: ICart | undefined, sku: string | string[], saveToDatabase?: boolean, onlyIfUpsellOf?: string) => Promise<ICart>;
36
+ readonly verifyCart: () => Promise<false | IActionDoneOnCart[]>;
37
+ readonly uploadFileToOrder: (newCart: ICart | undefined, file: File, propsName: string, saveToDatabase?: boolean) => Promise<{
38
+ cart: ICart;
39
+ data: undefined;
40
+ error: string;
41
+ } | {
42
+ cart: ICart;
43
+ data: {
44
+ url: string;
45
+ ref: string;
46
+ };
47
+ error: undefined;
48
+ } | undefined>;
49
+ readonly updateEmail: (newCart: ICart | undefined, email: string, saveToDatabase: boolean) => Promise<ICart>;
50
+ readonly updateDefaultCustomer: (newCart: ICart | undefined, email: string, id: string, pro_info?: {
51
+ pro_title?: string;
52
+ pro_proof_doc?: string;
53
+ customer_external_code?: string;
54
+ }, saveToDatabase?: boolean) => Promise<ICart>;
55
+ readonly emptyCart: (removeCartIDFromLocalStorage?: boolean) => Promise<boolean>;
56
+ readonly saveOrder: (payload: IStripePayload | IPaypalPayload) => Promise<{
57
+ orderID: string;
58
+ accessToken: string;
59
+ } | 'error'>;
60
+ readonly updateShippingAddress: (cartData: ICart | undefined, _isPickup: boolean, _shipping: IExpeditionInfo | undefined, saveToDatabase?: boolean, setCAIfNoCountry?: boolean) => Promise<ICart>;
61
+ readonly updateBillingAddress: (cartData: ICart | undefined, _billing: IExpeditionInfo, saveToDatabase?: boolean, setCAIfNoCountry?: boolean) => Promise<ICart>;
62
+ readonly getIsSameBillingThenShipping: () => boolean;
63
+ readonly setShippingPayload: (newCart: ICart | undefined, payload: any, saveToDatabase?: boolean) => Promise<ICart>;
64
+ readonly removeDiscountRule: (cart: ICart, code: string) => Promise<boolean>;
65
+ readonly getShippingQuotes: () => Promise<Partial<IShippingQuote>[] | undefined>;
66
+ readonly selectShippingQuote: (_quote: Partial<IShippingQuote>) => Promise<ICart | undefined>;
67
+ readonly setPromoCode: (promo_code: string) => Promise<void>;
68
+ readonly getApplicablePromos: (forceShipping: boolean) => Promise<ICartPromoApplied[] | undefined>;
69
+ readonly canBePaidWithPA: (userId: string) => Promise<{
70
+ canBePaid: boolean;
71
+ updatedCart: ICart | undefined;
72
+ canBePaidReason?: ApplyBanksToCartErrorsEnum;
73
+ } | undefined>;
74
+ readonly getPaymentIncentiveDiscountAmount: (skipCheckForRuleFields?: RuleFieldEnum[]) => number | undefined;
75
+ readonly setPaidBy: (paidByValue: PaymentTypeEnum | null, customPriceList?: ICustomPriceItem[] | undefined, chosenPayment?: PaymentTypeEnum) => Promise<void>;
76
+ }
77
+ export declare const getDefaultCartContext: () => ICartContext;
78
+ declare const CartContext: React.Context<ICartContext>;
79
+ export default CartContext;
@@ -1,128 +1,128 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.getDefaultCartContext = void 0;
43
- var react_1 = __importDefault(require("react"));
44
- var Cart_1 = require("addio-admin-sdk/dist/Interfaces/Cart");
45
- var getDefaultCartContext = function () { return ({
46
- loading: false,
47
- cartData: (0, Cart_1.getDefaultCart)(Cart_1.CartTypeEnum.WEB),
48
- cartErrors: [],
49
- cartSliderOpen: false,
50
- isGuest: undefined,
51
- setIsGuest: function (_isGuest) { },
52
- setCartErrors: function (_errorCodes) { },
53
- setCartData: function (_cart) { },
54
- setCartLoading: function (_value) { },
55
- getCartFromDatabase: function (_cartID) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
56
- return [2, undefined];
57
- }); }); },
58
- saveCart: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
59
- return [2, (0, Cart_1.getDefaultCart)()];
60
- }); }); },
61
- handlePayment: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
62
- return [2, ({})];
63
- }); }); },
64
- addItem: function (_cart, _item) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
65
- return [2, (0, Cart_1.getDefaultCart)()];
66
- }); }); },
67
- setCartSliderOpen: function (_open) { },
68
- deleteItem: function (_cart, _sku) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
69
- return [2, (0, Cart_1.getDefaultCart)()];
70
- }); }); },
71
- updateItem: function (_cartData, _items, _saveToDatabase) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
72
- return [2, (0, Cart_1.getDefaultCart)()];
73
- }); }); },
74
- verifyCart: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
75
- return [2, false];
76
- }); }); },
77
- uploadFileToOrder: function (_cart, _) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
78
- return [2, undefined];
79
- }); }); },
80
- updateEmail: function (_cart, _email) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
81
- return [2, (0, Cart_1.getDefaultCart)()];
82
- }); }); },
83
- updateDefaultCustomer: function (_cart, _email, _id, _pro_info, _saveToDatabase) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
84
- return [2, (0, Cart_1.getDefaultCart)()];
85
- }); }); },
86
- emptyCart: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
87
- return [2, false];
88
- }); }); },
89
- saveOrder: function (_payload) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
90
- return [2, ({ orderID: '', accessToken: '' })];
91
- }); }); },
92
- updateShippingAddress: function (_cart, _isPickup, _shipping) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
93
- return [2, (0, Cart_1.getDefaultCart)()];
94
- }); }); },
95
- updateBillingAddress: function (_cart, _billing) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
96
- return [2, (0, Cart_1.getDefaultCart)()];
97
- }); }); },
98
- getIsSameBillingThenShipping: function () { return false; },
99
- setShippingPayload: function (_cart, _payload) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
100
- return [2, (0, Cart_1.getDefaultCart)()];
101
- }); }); },
102
- removeDiscountRule: function (_cart, _code) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
103
- return [2, true];
104
- }); }); },
105
- getShippingQuotes: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
106
- return [2, []];
107
- }); }); },
108
- selectShippingQuote: function (_quote) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
109
- return [2, (0, Cart_1.getDefaultCart)()];
110
- }); }); },
111
- setPromoCode: function (_promo_code) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
112
- return [2];
113
- }); }); },
114
- getApplicablePromos: function (_forceShipping) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
115
- return [2, []];
116
- }); }); },
117
- canBePaidWithPA: function (_userId) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
118
- return [2, ({ canBePaid: false, updatedCart: (0, Cart_1.getDefaultCart)() })];
119
- }); }); },
120
- getPaymentIncentiveDiscountAmount: function (_skipCheckForRuleFields) { return undefined; },
121
- setPaidBy: function (_paidByValue, _customPriceList) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
122
- return [2, undefined];
123
- }); }); }
124
- }); };
125
- exports.getDefaultCartContext = getDefaultCartContext;
126
- var CartContext = react_1.default.createContext((0, exports.getDefaultCartContext)());
127
- exports.default = CartContext;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.getDefaultCartContext = void 0;
43
+ var react_1 = __importDefault(require("react"));
44
+ var Cart_1 = require("addio-admin-sdk/dist/Interfaces/Cart");
45
+ var getDefaultCartContext = function () { return ({
46
+ loading: false,
47
+ cartData: (0, Cart_1.getDefaultCart)(Cart_1.CartTypeEnum.WEB),
48
+ cartErrors: [],
49
+ cartSliderOpen: false,
50
+ isGuest: undefined,
51
+ setIsGuest: function (_isGuest) { },
52
+ setCartErrors: function (_errorCodes) { },
53
+ setCartData: function (_cart) { },
54
+ setCartLoading: function (_value) { },
55
+ getCartFromDatabase: function (_cartID) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
56
+ return [2, undefined];
57
+ }); }); },
58
+ saveCart: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
59
+ return [2, (0, Cart_1.getDefaultCart)()];
60
+ }); }); },
61
+ handlePayment: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
62
+ return [2, ({})];
63
+ }); }); },
64
+ addItem: function (_cart, _item) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
65
+ return [2, (0, Cart_1.getDefaultCart)()];
66
+ }); }); },
67
+ setCartSliderOpen: function (_open) { },
68
+ deleteItem: function (_cart, _sku) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
69
+ return [2, (0, Cart_1.getDefaultCart)()];
70
+ }); }); },
71
+ updateItem: function (_cartData, _items, _saveToDatabase) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
72
+ return [2, (0, Cart_1.getDefaultCart)()];
73
+ }); }); },
74
+ verifyCart: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
75
+ return [2, false];
76
+ }); }); },
77
+ uploadFileToOrder: function (_cart, _) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
78
+ return [2, undefined];
79
+ }); }); },
80
+ updateEmail: function (_cart, _email) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
81
+ return [2, (0, Cart_1.getDefaultCart)()];
82
+ }); }); },
83
+ updateDefaultCustomer: function (_cart, _email, _id, _pro_info, _saveToDatabase) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
84
+ return [2, (0, Cart_1.getDefaultCart)()];
85
+ }); }); },
86
+ emptyCart: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
87
+ return [2, false];
88
+ }); }); },
89
+ saveOrder: function (_payload) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
90
+ return [2, ({ orderID: '', accessToken: '' })];
91
+ }); }); },
92
+ updateShippingAddress: function (_cart, _isPickup, _shipping) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
93
+ return [2, (0, Cart_1.getDefaultCart)()];
94
+ }); }); },
95
+ updateBillingAddress: function (_cart, _billing) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
96
+ return [2, (0, Cart_1.getDefaultCart)()];
97
+ }); }); },
98
+ getIsSameBillingThenShipping: function () { return false; },
99
+ setShippingPayload: function (_cart, _payload) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
100
+ return [2, (0, Cart_1.getDefaultCart)()];
101
+ }); }); },
102
+ removeDiscountRule: function (_cart, _code) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
103
+ return [2, true];
104
+ }); }); },
105
+ getShippingQuotes: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
106
+ return [2, []];
107
+ }); }); },
108
+ selectShippingQuote: function (_quote) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
109
+ return [2, (0, Cart_1.getDefaultCart)()];
110
+ }); }); },
111
+ setPromoCode: function (_promo_code) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
112
+ return [2];
113
+ }); }); },
114
+ getApplicablePromos: function (_forceShipping) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
115
+ return [2, []];
116
+ }); }); },
117
+ canBePaidWithPA: function (_userId) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
118
+ return [2, ({ canBePaid: false, updatedCart: (0, Cart_1.getDefaultCart)() })];
119
+ }); }); },
120
+ getPaymentIncentiveDiscountAmount: function (_skipCheckForRuleFields) { return undefined; },
121
+ setPaidBy: function (_paidByValue, _customPriceList) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
122
+ return [2, undefined];
123
+ }); }); }
124
+ }); };
125
+ exports.getDefaultCartContext = getDefaultCartContext;
126
+ var CartContext = react_1.default.createContext((0, exports.getDefaultCartContext)());
127
+ exports.default = CartContext;
128
128
  //# sourceMappingURL=index.js.map
@@ -1,15 +1,15 @@
1
- /// <reference types="react" />
2
- import IBrand from 'addio-admin-sdk/dist/Interfaces/Brand';
3
- import ICategory from 'addio-admin-sdk/dist/Interfaces/Category';
4
- import ISpaceData from '../../../../utils/interfaces/ISpaceData';
5
- interface IProps {
6
- readonly spaceData?: ISpaceData;
7
- readonly children: JSX.Element;
8
- readonly maintenanceComponent: JSX.Element;
9
- readonly ssrStoreData?: ISpaceData | undefined;
10
- readonly ssrCategories?: ICategory[] | undefined;
11
- readonly ssrAttributes?: any[] | undefined;
12
- readonly ssrBrands?: IBrand[] | undefined;
13
- }
14
- export default function DataContextProvider({ spaceData, children, maintenanceComponent, ssrStoreData, ssrCategories, ssrAttributes, ssrBrands }: IProps): JSX.Element;
15
- export {};
1
+ /// <reference types="react" />
2
+ import IBrand from 'addio-admin-sdk/dist/Interfaces/Brand';
3
+ import ICategory from 'addio-admin-sdk/dist/Interfaces/Category';
4
+ import ISpaceData from '../../../../utils/interfaces/ISpaceData';
5
+ interface IProps {
6
+ readonly spaceData?: ISpaceData;
7
+ readonly children: JSX.Element;
8
+ readonly maintenanceComponent: JSX.Element;
9
+ readonly ssrStoreData?: ISpaceData | undefined;
10
+ readonly ssrCategories?: ICategory[] | undefined;
11
+ readonly ssrAttributes?: any[] | undefined;
12
+ readonly ssrBrands?: IBrand[] | undefined;
13
+ }
14
+ export default function DataContextProvider({ spaceData, children, maintenanceComponent, ssrStoreData, ssrCategories, ssrAttributes, ssrBrands }: IProps): JSX.Element;
15
+ export {};