merchi_cart 1.4.2 → 1.4.3

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 (88) hide show
  1. package/lib/Cart.d.ts +9 -0
  2. package/lib/CartAlert.d.ts +2 -0
  3. package/lib/CartHeader.d.ts +2 -0
  4. package/lib/CartProvider.d.ts +234 -0
  5. package/lib/CartTotals.d.ts +6 -0
  6. package/lib/buttons/Button.d.ts +10 -0
  7. package/lib/buttons/ButtonBack.d.ts +5 -0
  8. package/lib/buttons/ButtonClearCart.d.ts +2 -0
  9. package/lib/buttons/ButtonInvoiceDownload.d.ts +2 -0
  10. package/lib/buttons/ButtonNext.d.ts +2 -0
  11. package/lib/buttons/ButtonNextDynamic.d.ts +2 -0
  12. package/lib/buttons/ButtonOpenCartMerchiCartModal.d.ts +8 -0
  13. package/lib/buttons/ButtonPay.d.ts +6 -0
  14. package/lib/buttons/ButtonShipmentTabNext.d.ts +1 -0
  15. package/lib/buttons/index.d.ts +7 -0
  16. package/lib/components/Alert.d.ts +6 -0
  17. package/lib/components/CartBody.d.ts +6 -0
  18. package/lib/components/CartClient.d.ts +3 -0
  19. package/lib/components/CartFooter.d.ts +5 -0
  20. package/lib/components/CartItemRow.d.ts +6 -0
  21. package/lib/components/CartPaymentSettingsInvalid.d.ts +1 -0
  22. package/lib/components/CartShipment.d.ts +5 -0
  23. package/lib/components/CartTabContent.d.ts +5 -0
  24. package/lib/components/CartTabPanel.d.ts +6 -0
  25. package/lib/components/CartTableContainer.d.ts +5 -0
  26. package/lib/components/CartTitle.d.ts +1 -0
  27. package/lib/components/CartTotalsListGroup.d.ts +2 -0
  28. package/lib/components/Collapse.d.ts +2 -0
  29. package/lib/components/CustomCartProductForm.d.ts +18 -0
  30. package/lib/components/CustomerCheckoutMethodTabs.d.ts +5 -0
  31. package/lib/components/DiscountInputGroup.d.ts +1 -0
  32. package/lib/components/LoadingTemplate.d.ts +6 -0
  33. package/lib/components/NoCartItems.d.ts +2 -0
  34. package/lib/components/ShipmentGroupCard.d.ts +6 -0
  35. package/lib/components/Table.d.ts +6 -0
  36. package/lib/components/containers.d.ts +13 -0
  37. package/lib/components/index.d.ts +18 -0
  38. package/lib/components/product-form-sdk-externals.d.ts +46 -0
  39. package/lib/forms/FormNewCustomer.d.ts +3 -0
  40. package/lib/forms/FormReturningCustomer.d.ts +2 -0
  41. package/lib/forms/FormShipmentAddressAndNotes.d.ts +14 -0
  42. package/lib/forms/FormSquarePayment.d.ts +2 -0
  43. package/lib/forms/FormStripePayment.d.ts +2 -0
  44. package/lib/forms/FormWhatsappCustomer.d.ts +2 -0
  45. package/lib/forms/InputAcceptUserTermsAndConditions.d.ts +6 -0
  46. package/lib/forms/InputError.d.ts +8 -0
  47. package/lib/forms/InputSelect.d.ts +13 -0
  48. package/lib/forms/InputText.d.ts +11 -0
  49. package/lib/forms/InputsAddress.d.ts +10 -0
  50. package/lib/forms/index.d.ts +8 -0
  51. package/lib/index.d.ts +13 -0
  52. package/lib/modals.d.ts +16 -0
  53. package/lib/panels/PanelCartItems.d.ts +2 -0
  54. package/lib/panels/PanelCartShipment.d.ts +2 -0
  55. package/lib/panels/PanelClearCart.d.ts +2 -0
  56. package/lib/panels/PanelClientCheckout.d.ts +2 -0
  57. package/lib/panels/PanelEditCartItem.d.ts +5 -0
  58. package/lib/panels/PanelPaymentSuccess.d.ts +2 -0
  59. package/lib/panels/index.d.ts +7 -0
  60. package/lib/square/SquareCard.d.ts +2 -0
  61. package/lib/stripe/LegacyStripeCardForm.d.ts +2 -0
  62. package/lib/stripe/StripeCardFields.d.ts +14 -0
  63. package/lib/stripe/StripeCardForm.d.ts +1 -0
  64. package/lib/stripe/StripePaymentButtons.d.ts +7 -0
  65. package/lib/stripe/actions.d.ts +4 -0
  66. package/lib/stripe/utils.d.ts +18 -0
  67. package/lib/tabs/CartNav.d.ts +2 -0
  68. package/lib/tabs/NavTab.d.ts +8 -0
  69. package/lib/types/index.d.ts +13 -0
  70. package/lib/utilities/address.d.ts +20 -0
  71. package/lib/utilities/area.d.ts +77 -0
  72. package/lib/utilities/cart.d.ts +9 -0
  73. package/lib/utilities/company.d.ts +2 -0
  74. package/lib/utilities/cookie.d.ts +4 -0
  75. package/lib/utilities/currency.d.ts +5 -0
  76. package/lib/utilities/customForm.d.ts +17 -0
  77. package/lib/utilities/helpers.d.ts +24 -0
  78. package/lib/utilities/index.d.ts +14 -0
  79. package/lib/utilities/invoice.d.ts +3 -0
  80. package/lib/utilities/job.d.ts +1 -0
  81. package/lib/utilities/local_storage.d.ts +31 -0
  82. package/lib/utilities/product.d.ts +2 -0
  83. package/lib/utilities/shipment.d.ts +2 -0
  84. package/lib/utilities/tabs.d.ts +14 -0
  85. package/lib/utilities/user.d.ts +5 -0
  86. package/lib/utilities/variations.d.ts +18 -0
  87. package/package.json +4 -3
  88. package/src/CartProvider.tsx +2 -2
package/lib/Cart.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import { PropsCart } from './CartProvider';
3
+ import './styles/globals.css';
4
+ interface Props {
5
+ footer?: React.ReactElement;
6
+ }
7
+ export declare function CartComponents({ footer }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export default function Cart(props: PropsCart): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ declare function CartAlert(): import("react/jsx-runtime").JSX.Element;
2
+ export default CartAlert;
@@ -0,0 +1,2 @@
1
+ declare function CartHeader(): import("react/jsx-runtime").JSX.Element;
2
+ export default CartHeader;
@@ -0,0 +1,234 @@
1
+ import * as React from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { Alert, Tab } from './types';
4
+ export interface PropsCart {
5
+ cart: any;
6
+ cartClient?: any;
7
+ setCart: (cartJson: any) => void;
8
+ setCartClient: (client: any) => void;
9
+ activeTabIndex: number;
10
+ setActiveTabIndex: (index: number) => void;
11
+ alert: Alert;
12
+ alertError: (message: string) => void;
13
+ alertSuccess: (message: string) => void;
14
+ setAlert: (alert: Alert) => void;
15
+ cartItem: any;
16
+ classNameAlertError?: string;
17
+ classNameAlertInfo?: string;
18
+ classNameAlertSuccess?: string;
19
+ classNameAlertWarning?: string;
20
+ classNameBtn?: string;
21
+ classNameBtnBack?: string;
22
+ classNameBtnCartClear?: string;
23
+ classNameBtnClose?: string;
24
+ classNameBtnDanger?: string;
25
+ classNameBtnDefault?: string;
26
+ classNameBtnDownloadInvoice?: string;
27
+ classNameBtnEditCartItem?: string;
28
+ classNameBtnPrimary?: string;
29
+ classNameBtnLink?: string;
30
+ classNameBtnNext?: string;
31
+ classNameBtnNextComplete?: string;
32
+ classNameBtnPay?: string;
33
+ classNameCartBody?: string;
34
+ classNameCartFooter?: string;
35
+ classNameCartFormCheckbox?: string;
36
+ classNameCartFormGroup?: string;
37
+ classNameCartFormGroupButton?: string;
38
+ classNameCartFormGroupCheckbox?: string;
39
+ classNameCartFormInput?: string;
40
+ classNameCartFormLabelCheckbox?: string;
41
+ classNameCartInputError?: string;
42
+ classNameCartNav?: string;
43
+ classNameCartRow?: string;
44
+ classNameCartRowColumn?: string;
45
+ classNameCartTabItem?: string;
46
+ classNameCartTabItemLink?: string;
47
+ classNameCartGoogleSuggestList?: string;
48
+ classNameCartGoogleSuggestListItem?: string;
49
+ classNameCartHeader?: string;
50
+ classNameCartItemFeatureImage?: string;
51
+ classNameCartItemInfo?: string;
52
+ classNameCartItemInfoCell?: string;
53
+ classNameCartItemInfoCellRight?: string;
54
+ classNameCartItemInfoContainer?: string;
55
+ classNameCartTab?: string;
56
+ classNameCartTabPanel?: string;
57
+ classNameCartTitle?: string;
58
+ classNameCartTotalContainer?: string;
59
+ classNameCartTotalItem?: string;
60
+ classNameCartTotaListContainer?: string;
61
+ classNameCartTotalItemPrice?: string;
62
+ classNameClearCartContainer?: string;
63
+ classNameClearCartText?: string;
64
+ classNameCartToggleIconButton?: string;
65
+ classNameListClientInfo?: string;
66
+ classNameListContainer?: string;
67
+ classNameListItem?: string;
68
+ classNameListItemCartTotals?: string;
69
+ classNameList?: string;
70
+ classNameListInline?: string;
71
+ classNameListUnstyled?: string;
72
+ classNameLoadingTemplate?: string;
73
+ classNameLoadingTemplateContainer?: string;
74
+ classNameNoItems?: string;
75
+ classNameShipmentOption?: string;
76
+ classNameTable?: string;
77
+ classNameTableContainer?: string;
78
+ classNameVariationsList?: string;
79
+ customSuccessMessage?: string;
80
+ discountButtonText?: string;
81
+ discountClassName?: string;
82
+ discountClassNameMainContainer?: string;
83
+ discountClassNameButtonItemRemove?: string;
84
+ discountClassNameButton?: string;
85
+ discountClassNameButtonContainer?: string;
86
+ discountClassNameErrorMessage?: string;
87
+ discountClassNameInput?: string;
88
+ discountClassNameListItem?: string;
89
+ discountClassNameListItems?: string;
90
+ discountClassNameInputContainer?: string;
91
+ discountShowAppliedItems?: boolean;
92
+ showDiscountCode?: boolean;
93
+ domainId?: number;
94
+ footer?: React.ReactElement;
95
+ googlePlacesLoaded?: boolean;
96
+ hideHead?: boolean;
97
+ invoiceJson: any;
98
+ setInvoiceJson: (invoiceJson: any) => void;
99
+ includeTheme?: boolean;
100
+ initialiseCart?: boolean;
101
+ cartSettingsInvalid: boolean;
102
+ fetchingCart: boolean;
103
+ setFetchingCart: (fetchingCart: boolean) => void;
104
+ fetchingShipmentGroups: boolean;
105
+ isCartModalOpen?: boolean;
106
+ setIsCartModalOpen?: (isOpen: boolean) => void;
107
+ onClickClose?: () => void;
108
+ toggleCartModal: () => void;
109
+ showCartItemInfo?: boolean;
110
+ showUserTermsAndConditions?: boolean;
111
+ productFormClassNames?: any;
112
+ apiUrl?: string;
113
+ updateCartShipmentAddress: (addressJson: any) => void;
114
+ urlFrontend?: string;
115
+ urlTrackingPage?: string;
116
+ setCartItem: (cartItem: any) => void;
117
+ tabs: Tab[];
118
+ setTabs: (tabs: Tab[] | ((prev: Tab[]) => Tab[])) => void;
119
+ clearCart: () => void;
120
+ closeClearCart: () => void;
121
+ setCartComplete: () => void;
122
+ refetchCart: () => void;
123
+ createCartAndCookie: (callback?: () => void) => void;
124
+ loadingTotals: boolean;
125
+ setLoadingTotals: (loading: boolean) => void;
126
+ setActiveTabAndEditDisabled: (nextTab: {
127
+ tabId: number;
128
+ tabIndexToSet: number;
129
+ disabled: boolean;
130
+ }) => void;
131
+ loading: boolean;
132
+ getCartShipmentOptions?: () => void;
133
+ }
134
+ export declare const useCartContext: () => PropsCart;
135
+ interface PropsCartProvider {
136
+ cart?: any;
137
+ cartClient?: any;
138
+ children: ReactNode;
139
+ classNameAlertError?: string;
140
+ classNameAlertInfo?: string;
141
+ classNameAlertSuccess?: string;
142
+ classNameAlertWarning?: string;
143
+ classNameBtn?: string;
144
+ classNameBtnBack?: string;
145
+ classNameBtnCartClear?: string;
146
+ classNameBtnClose?: string;
147
+ classNameBtnDanger?: string;
148
+ classNameBtnDefault?: string;
149
+ classNameBtnDownloadInvoice?: string;
150
+ classNameBtnEditCartItem?: string;
151
+ classNameBtnPrimary?: string;
152
+ classNameBtnNext?: string;
153
+ classNameBtnNextComplete?: string;
154
+ classNameBtnLink?: string;
155
+ classNameBtnPay?: string;
156
+ classNameCartBody?: string;
157
+ classNameCartFooter?: string;
158
+ classNameCartFormCheckbox?: string;
159
+ classNameCartFormGroup?: string;
160
+ classNameCartFormGroupButton?: string;
161
+ classNameCartFormGroupCheckbox?: string;
162
+ classNameCartFormInput?: string;
163
+ classNameCartFormLabelCheckbox?: string;
164
+ classNameCartInputError?: string;
165
+ classNameCartRow?: string;
166
+ classNameCartRowColumn?: string;
167
+ classNameCartTabItem?: string;
168
+ classNameCartTabItemLink?: string;
169
+ classNameCartGoogleSuggestList?: string;
170
+ classNameCartGoogleSuggestListItem?: string;
171
+ classNameCartHeader?: string;
172
+ classNameCartItemFeatureImage?: string;
173
+ classNameCartItemInfo?: string;
174
+ classNameCartItemInfoCell?: string;
175
+ classNameCartItemInfoCellRight?: string;
176
+ classNameCartNav?: string;
177
+ classNameCartTab?: string;
178
+ classNameCartTabPanel?: string;
179
+ classNameCartTitle?: string;
180
+ classNameCartTotalContainer?: string;
181
+ classNameCartTotalItem?: string;
182
+ classNameCartTotaListContainer?: string;
183
+ classNameCartTotalItemPrice?: string;
184
+ classNameCartToggleIconButton?: string;
185
+ classNameClearCartContainer?: string;
186
+ classNameClearCartText?: string;
187
+ classNameListClientInfo?: string;
188
+ classNameCartItemInfoContainer?: string;
189
+ classNameList?: string;
190
+ classNameListInline?: string;
191
+ classNameListContainer?: string;
192
+ classNameListItem?: string;
193
+ classNameListItemCartTotals?: string;
194
+ classNameListUnstyled?: string;
195
+ classNameLoadingTemplate?: string;
196
+ classNameLoadingTemplateContainer?: string;
197
+ classNameNoItems?: string;
198
+ classNameShipmentOption?: string;
199
+ classNameTable?: string;
200
+ classNameTableContainer?: string;
201
+ classNameVariationsList?: string;
202
+ customSuccessMessage?: string;
203
+ discountButtonText?: string;
204
+ discountClassName?: string;
205
+ discountClassNameMainContainer?: string;
206
+ discountClassNameButtonItemRemove?: string;
207
+ discountClassNameButton?: string;
208
+ discountClassNameButtonContainer?: string;
209
+ discountClassNameErrorMessage?: string;
210
+ discountClassNameInput?: string;
211
+ discountClassNameListItem?: string;
212
+ discountClassNameListItems?: string;
213
+ discountClassNameInputContainer?: string;
214
+ discountShowAppliedItems?: boolean;
215
+ showDiscountCode?: boolean;
216
+ domainId?: number;
217
+ googlePlacesLoaded?: boolean;
218
+ hideHead?: boolean;
219
+ includeTheme?: boolean;
220
+ initialiseCart?: boolean;
221
+ isCartModalOpen?: boolean;
222
+ setIsCartModalOpen?: (isOpen: boolean) => void;
223
+ createCartAndCookie: (callback?: () => void) => void;
224
+ onClickClose?: () => void;
225
+ productFormClassNames?: any;
226
+ showCartItemInfo?: boolean;
227
+ showUserTermsAndConditions?: boolean;
228
+ apiUrl?: string;
229
+ urlFrontend?: string;
230
+ urlTrackingPage?: string;
231
+ getCartShipmentOptions?: () => void;
232
+ }
233
+ declare const CartProvider: ({ cart: initCart, children, classNameAlertError, classNameAlertInfo, classNameAlertSuccess, classNameAlertWarning, classNameBtn, classNameBtnBack, classNameBtnCartClear, classNameBtnClose, classNameBtnDanger, classNameBtnDefault, classNameBtnDownloadInvoice, classNameBtnEditCartItem, classNameBtnPrimary, classNameBtnLink, classNameBtnNext, classNameBtnNextComplete, classNameBtnPay, classNameCartBody, classNameCartFooter, classNameCartFormCheckbox, classNameCartFormGroup, classNameCartFormGroupButton, classNameCartFormGroupCheckbox, classNameCartFormInput, classNameCartFormLabelCheckbox, classNameCartInputError, classNameCartNav, classNameCartRow, classNameCartRowColumn, classNameCartTabItem, classNameCartTabItemLink, classNameCartToggleIconButton, classNameCartGoogleSuggestList, classNameCartGoogleSuggestListItem, classNameCartHeader, classNameCartItemFeatureImage, classNameCartItemInfo, classNameCartItemInfoCell, classNameCartItemInfoCellRight, classNameCartItemInfoContainer, classNameCartTab, classNameCartTabPanel, classNameCartTitle, classNameCartTotalContainer, classNameCartTotaListContainer, classNameCartTotalItem, classNameCartTotalItemPrice, classNameClearCartContainer, classNameClearCartText, classNameListClientInfo, classNameList, classNameListInline, classNameListUnstyled, classNameListContainer, classNameListItem, classNameListItemCartTotals, classNameLoadingTemplate, classNameLoadingTemplateContainer, classNameNoItems, classNameShipmentOption, classNameTable, classNameTableContainer, classNameVariationsList, customSuccessMessage, domainId, discountButtonText, discountClassName, discountClassNameButton, discountClassNameButtonContainer, discountClassNameButtonItemRemove, discountClassNameErrorMessage, discountClassNameInput, discountClassNameInputContainer, discountClassNameListItem, discountClassNameListItems, discountClassNameMainContainer, discountShowAppliedItems, showDiscountCode, hideHead, includeTheme, initialiseCart, isCartModalOpen, setIsCartModalOpen, onClickClose, productFormClassNames, showUserTermsAndConditions, showCartItemInfo, apiUrl, urlFrontend, urlTrackingPage, }: PropsCartProvider) => import("react/jsx-runtime").JSX.Element;
234
+ export default CartProvider;
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ attribute: string;
3
+ }
4
+ export declare function CartTotal({ attribute }: Props): import("react/jsx-runtime").JSX.Element;
5
+ declare function CartTotals(): import("react/jsx-runtime").JSX.Element;
6
+ export default CartTotals;
@@ -0,0 +1,10 @@
1
+ interface Props {
2
+ children: any;
3
+ className?: string;
4
+ disabled?: boolean;
5
+ form?: string;
6
+ onClick?: () => void;
7
+ type?: string;
8
+ }
9
+ export default function Button({ children, className, disabled, form, onClick, type, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ text?: string;
3
+ }
4
+ declare function ButtonBack({ text }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export default ButtonBack;
@@ -0,0 +1,2 @@
1
+ declare function ButtonClearCart(): import("react/jsx-runtime").JSX.Element;
2
+ export default ButtonClearCart;
@@ -0,0 +1,2 @@
1
+ declare function ButtonInvoiceDownload(): import("react/jsx-runtime").JSX.Element;
2
+ export default ButtonInvoiceDownload;
@@ -0,0 +1,2 @@
1
+ declare function ButtonNext(): import("react/jsx-runtime").JSX.Element;
2
+ export default ButtonNext;
@@ -0,0 +1,2 @@
1
+ declare function ButtonNextDynamic(): import("react/jsx-runtime").JSX.Element;
2
+ export default ButtonNextDynamic;
@@ -0,0 +1,8 @@
1
+ export declare function ButtonOpenCart(): import("react/jsx-runtime").JSX.Element;
2
+ interface Props {
3
+ cartButtonWrappedInContainer?: boolean;
4
+ listContainerClass?: string;
5
+ listItemClass?: string;
6
+ }
7
+ export declare function ButtonListWrappedOpenCart(props: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ cart: any;
3
+ loading: boolean;
4
+ }
5
+ declare function ButtonPay({ cart, loading }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export default ButtonPay;
@@ -0,0 +1 @@
1
+ export default function ButtonShipmentTabNext(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import Button from './Button';
2
+ import ButtonBack from './ButtonBack';
3
+ import ButtonClearCart from './ButtonClearCart';
4
+ import ButtonInvoiceDownload from './ButtonInvoiceDownload';
5
+ import ButtonNextDynamic from './ButtonNextDynamic';
6
+ import ButtonPay from './ButtonPay';
7
+ export { Button, ButtonBack, ButtonClearCart, ButtonNextDynamic, ButtonPay, ButtonInvoiceDownload, };
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ alertType?: 'success' | 'danger' | 'warning' | 'info';
3
+ children: any;
4
+ }
5
+ export default function Alert({ alertType, children }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ children: any;
3
+ style?: any;
4
+ }
5
+ export default function CartBody({ children, style }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function ClientInfo({ client }: any): import("react/jsx-runtime").JSX.Element;
2
+ declare function CartClient(): import("react/jsx-runtime").JSX.Element;
3
+ export default CartClient;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ children: any;
3
+ }
4
+ export default function CartFooter({ children }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ cartItem: any;
3
+ index: number;
4
+ }
5
+ declare function CartItemRow({ cartItem, index }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export default CartItemRow;
@@ -0,0 +1 @@
1
+ export default function CartPaymentSettingsInvalid(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ cart: any;
3
+ }
4
+ declare function CartShipment({ cart }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export default CartShipment;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ children?: any;
3
+ }
4
+ export default function CartTabContent({ children }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ children: any;
3
+ tabId: number;
4
+ }
5
+ export default function CartTabPanel({ children, tabId }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ children: any;
3
+ }
4
+ export default function CartTableContainer({ children }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1 @@
1
+ export default function Title({ icon, title }: any): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ declare function CartTotalsListGroup(): import("react/jsx-runtime").JSX.Element;
2
+ export default CartTotalsListGroup;
@@ -0,0 +1,2 @@
1
+ declare function Collapse({ isOpen, children }: any): import("react/jsx-runtime").JSX.Element;
2
+ export default Collapse;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ interface Props {
3
+ product: any;
4
+ /** Current cart item used to hydrate quantity / selections. */
5
+ initialJob: any;
6
+ apiUrl?: string;
7
+ onSave: (job: any) => void;
8
+ /** Rendered when there is no published bundle or load/runtime fails. */
9
+ fallback: React.ReactNode;
10
+ /** Notifies the host when the custom form is actively rendering. */
11
+ onActiveChange?: (active: boolean) => void;
12
+ }
13
+ /**
14
+ * Loads a product's published custom form for cart-item edit. On any failure
15
+ * renders `fallback` (the default merchi_product_form) so the cart stays usable.
16
+ */
17
+ export declare function CustomCartProductForm({ product, initialJob, apiUrl, onSave, fallback, onActiveChange, }: Props): import("react/jsx-runtime").JSX.Element;
18
+ export default CustomCartProductForm;
@@ -0,0 +1,5 @@
1
+ interface CustomerCheckoutMethodTabsProps {
2
+ whatsappEnabled?: boolean;
3
+ }
4
+ export default function CustomerCheckoutMethodTabs({ whatsappEnabled, }: CustomerCheckoutMethodTabsProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1 @@
1
+ export default function DiscountInputGroup(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ height?: number;
3
+ }
4
+ export default function LoadingTemplate({ height }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export declare function LoadingTemplateSm(): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ declare function NoCartItems(): import("react/jsx-runtime").JSX.Element;
2
+ export default NoCartItems;
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ group: any;
3
+ groupIndex: number;
4
+ }
5
+ declare function ShipmentGroupCard({ group, groupIndex }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export default ShipmentGroupCard;
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ children: any;
3
+ className?: string;
4
+ }
5
+ export default function Table({ children, className }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ interface CheckoutContainerProps {
2
+ children: any;
3
+ textAlign?: any;
4
+ }
5
+ export declare function CheckoutContainer({ children, textAlign }: CheckoutContainerProps): import("react/jsx-runtime").JSX.Element;
6
+ interface InnerProps {
7
+ children: any;
8
+ paddingBottom?: string;
9
+ paddingTop?: string;
10
+ width?: number;
11
+ }
12
+ export declare function InnerContainer({ children, paddingBottom, paddingTop, width }: InnerProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,18 @@
1
+ import Alert from './Alert';
2
+ import CartBody from './CartBody';
3
+ import CartClient from './CartClient';
4
+ import CartFooter from './CartFooter';
5
+ import CartPaymentSettingsInvalid from './CartPaymentSettingsInvalid';
6
+ import CartShipment from './CartShipment';
7
+ import CartTabContent from './CartTabContent';
8
+ import CartTableContainer from './CartTableContainer';
9
+ import CartTabPanel from './CartTabPanel';
10
+ import Collapse from './Collapse';
11
+ import CustomerCheckoutMethodTabs from './CustomerCheckoutMethodTabs';
12
+ import DiscountInputGroup from './DiscountInputGroup';
13
+ import LoadingTemplate, { LoadingTemplateSm } from './LoadingTemplate';
14
+ import NoCartItems from './NoCartItems';
15
+ import ShipmentGroupCard from './ShipmentGroupCard';
16
+ import Table from './Table';
17
+ import Title from './CartTitle';
18
+ export { Alert, CartBody, CartClient, CartFooter, CartPaymentSettingsInvalid, CartShipment, CartTabContent, CartTableContainer, CartTabPanel, Collapse, CustomerCheckoutMethodTabs, DiscountInputGroup, LoadingTemplate, LoadingTemplateSm, NoCartItems, ShipmentGroupCard, Table, Title, };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Full merchi_sdk_product_form runtime for window.MerchiProductFormSdk.
3
+ * Keep in sync with merchi_api/common/js/product_form_gate.cjs SDK_EXPORTS.
4
+ */
5
+ import { serializeJob, nonEmptyGroups, formatCurrency, urlFor, createPricing, createProductFormRuntime, productHasGroups, groupFieldsOf, independentFieldsOf, isOptionQuantityGridProduct, buildProductFormJob, jobToFormState, selectionsToVariations, Section, Stack, Card, Heading, Text, Divider, Field, GroupRows, OptionQuantityGrid, ProductFormProvider, ProductFormShell, ProductFormActions, useProductForm } from 'merchi_sdk_product_form';
6
+ export declare const MerchiProductFormSdkExternals: {
7
+ SDK_VERSION: string;
8
+ serializeJob: typeof serializeJob;
9
+ nonEmptyGroups: typeof nonEmptyGroups;
10
+ formatCurrency: typeof formatCurrency;
11
+ urlFor: typeof urlFor;
12
+ createPricing: typeof createPricing;
13
+ createProductFormRuntime: typeof createProductFormRuntime;
14
+ productHasGroups: typeof productHasGroups;
15
+ groupFieldsOf: typeof groupFieldsOf;
16
+ independentFieldsOf: typeof independentFieldsOf;
17
+ isOptionQuantityGridProduct: typeof isOptionQuantityGridProduct;
18
+ buildProductFormJob: typeof buildProductFormJob;
19
+ jobToFormState: typeof jobToFormState;
20
+ selectionsToVariations: typeof selectionsToVariations;
21
+ Section: typeof Section;
22
+ Stack: typeof Stack;
23
+ Card: typeof Card;
24
+ Heading: typeof Heading;
25
+ Text: typeof Text;
26
+ Divider: typeof Divider;
27
+ Field: typeof Field;
28
+ GroupRows: typeof GroupRows;
29
+ OptionQuantityGrid: typeof OptionQuantityGrid;
30
+ ProductFormProvider: typeof ProductFormProvider;
31
+ ProductFormShell: typeof ProductFormShell;
32
+ ProductFormActions: typeof ProductFormActions;
33
+ useProductForm: typeof useProductForm;
34
+ OPTION_FIELD_TYPES: Set<number>;
35
+ theme: {
36
+ text: string;
37
+ muted: string;
38
+ border: string;
39
+ primary: string;
40
+ primaryText: string;
41
+ card: string;
42
+ surface: string;
43
+ radius: number;
44
+ font: string;
45
+ };
46
+ };
@@ -0,0 +1,3 @@
1
+ export declare const emailValidation: RegExp;
2
+ export declare function FormCustomerNew(): import("react/jsx-runtime").JSX.Element;
3
+ export default FormCustomerNew;
@@ -0,0 +1,2 @@
1
+ declare function FormReturningCustomer(): import("react/jsx-runtime").JSX.Element;
2
+ export default FormReturningCustomer;
@@ -0,0 +1,14 @@
1
+ interface Props {
2
+ address?: any;
3
+ addressFieldsOpen: boolean;
4
+ formId: string;
5
+ notes?: string;
6
+ showIcon?: boolean;
7
+ deliveryNomenclature?: boolean;
8
+ showHeadings?: boolean;
9
+ setCartShipmentAddress: (values: any) => void | Promise<void>;
10
+ toggleAddressFields: () => void;
11
+ }
12
+ declare function FormShipmentAddressAndNotes({ address, formId, notes, showIcon, deliveryNomenclature, showHeadings, setCartShipmentAddress, }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ActiveFormShipmentAddressAndNotes(): import("react/jsx-runtime").JSX.Element;
14
+ export default FormShipmentAddressAndNotes;
@@ -0,0 +1,2 @@
1
+ declare function FormSquarePayment(): import("react/jsx-runtime").JSX.Element;
2
+ export default FormSquarePayment;
@@ -0,0 +1,2 @@
1
+ declare function FormStripePayment(): import("react/jsx-runtime").JSX.Element;
2
+ export default FormStripePayment;
@@ -0,0 +1,2 @@
1
+ declare function FormWhatsappCustomer(): import("react/jsx-runtime").JSX.Element;
2
+ export default FormWhatsappCustomer;
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ isChecked: boolean;
3
+ setIsChecked: (isChecked: boolean) => void;
4
+ }
5
+ declare function InputAcceptUserTermsAndConditions({ isChecked, setIsChecked }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export default InputAcceptUserTermsAndConditions;
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface InputErrorProps {
3
+ error?: {
4
+ message?: string;
5
+ };
6
+ }
7
+ declare const InputError: React.FC<InputErrorProps>;
8
+ export default InputError;
@@ -0,0 +1,13 @@
1
+ interface Option {
2
+ label: string;
3
+ value: string;
4
+ }
5
+ interface Props {
6
+ control: any;
7
+ label?: string;
8
+ name: string;
9
+ options: Option[];
10
+ rules?: any;
11
+ }
12
+ declare function InputSelect({ control, label, name, options, rules, }: Props): import("react/jsx-runtime").JSX.Element;
13
+ export default InputSelect;
@@ -0,0 +1,11 @@
1
+ interface Props {
2
+ control: any;
3
+ label?: string;
4
+ name: string;
5
+ placeholder: string;
6
+ type?: string;
7
+ onChange?: (event: any) => void;
8
+ rules?: Record<string, any>;
9
+ }
10
+ declare function InputText({ control, label, name, placeholder, type, onChange, rules, }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export default InputText;
@@ -0,0 +1,10 @@
1
+ interface Props {
2
+ defaultAddress?: any;
3
+ labelGeoSuggest?: string;
4
+ hookForm: any;
5
+ name: string;
6
+ placeholder?: string;
7
+ updateAddress: (address: any) => void;
8
+ }
9
+ export declare function InputsAddress({ defaultAddress, labelGeoSuggest, hookForm, name, placeholder, updateAddress }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export default InputsAddress;
@@ -0,0 +1,8 @@
1
+ import FormCustomerNew from "./FormNewCustomer";
2
+ import FormReturningCustomer from "./FormReturningCustomer";
3
+ import FormShipmentAddressAndNotes, { ActiveFormShipmentAddressAndNotes } from "./FormShipmentAddressAndNotes";
4
+ import FormSquarePayment from "./FormSquarePayment";
5
+ import FormStripePayment from "./FormStripePayment";
6
+ import FormWhatsappCustomer from "./FormWhatsappCustomer";
7
+ import CustomerCheckoutMethodTabs from "../components/CustomerCheckoutMethodTabs";
8
+ export { ActiveFormShipmentAddressAndNotes, CustomerCheckoutMethodTabs, FormCustomerNew, FormReturningCustomer, FormShipmentAddressAndNotes, FormSquarePayment, FormStripePayment, FormWhatsappCustomer, };
package/lib/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import Cart, { CartComponents } from './Cart';
2
+ import { MerchiCartModal, MerchiShoppingCartModal } from './modals';
3
+ import { ButtonOpenCart, ButtonListWrappedOpenCart } from './buttons/ButtonOpenCartMerchiCartModal';
4
+ import * as components from './components';
5
+ import CartProvider, { useCartContext } from './CartProvider';
6
+ import CartAlert from './CartAlert';
7
+ import CartHeader from './CartHeader';
8
+ import CartTotals from './CartTotals';
9
+ import * as buttons from './buttons';
10
+ import * as forms from './forms';
11
+ import * as panels from './panels';
12
+ import * as utilities from './utilities';
13
+ export { buttons, ButtonOpenCart, ButtonListWrappedOpenCart, Cart, CartComponents, CartAlert, CartHeader, CartProvider, CartTotals, components, forms, MerchiCartModal, MerchiShoppingCartModal, panels, useCartContext, utilities, };
@@ -0,0 +1,16 @@
1
+ import { PropsCart } from './CartProvider';
2
+ interface Props extends PropsCart {
3
+ cartButtonWrappedInContainer?: boolean;
4
+ cartIconButtonClass?: string;
5
+ currentUser?: any;
6
+ customSuccessMessage?: string;
7
+ domainId?: number;
8
+ listContainerClass?: string;
9
+ listItemClass?: string;
10
+ showOpenCartButton?: boolean;
11
+ size?: string;
12
+ storeId?: number;
13
+ }
14
+ export declare function MerchiCartModal(props: Props): import("react/jsx-runtime").JSX.Element;
15
+ export declare function MerchiShoppingCartModal(props: Props): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,2 @@
1
+ declare function PanelCartItems(): import("react/jsx-runtime").JSX.Element;
2
+ export default PanelCartItems;
@@ -0,0 +1,2 @@
1
+ declare function PanelCartShipment(): import("react/jsx-runtime").JSX.Element;
2
+ export default PanelCartShipment;
@@ -0,0 +1,2 @@
1
+ declare function PanelClearCart(): import("react/jsx-runtime").JSX.Element;
2
+ export default PanelClearCart;
@@ -0,0 +1,2 @@
1
+ declare function PanelClientCheckout(): import("react/jsx-runtime").JSX.Element;
2
+ export default PanelClientCheckout;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ cart: any;
3
+ }
4
+ declare function PanelEditCartItem({ cart }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export default PanelEditCartItem;
@@ -0,0 +1,2 @@
1
+ declare function PanelPaymentSuccess(): import("react/jsx-runtime").JSX.Element;
2
+ export default PanelPaymentSuccess;
@@ -0,0 +1,7 @@
1
+ import PanelCartItems from "./PanelCartItems";
2
+ import PanelCartShipment from "./PanelCartShipment";
3
+ import PanelClearCart from "./PanelClearCart";
4
+ import PanelClientCheckout from "./PanelClientCheckout";
5
+ import PanelEditCartItem from "./PanelEditCartItem";
6
+ import PanelPaymentSuccess from "./PanelPaymentSuccess";
7
+ export { PanelCartItems, PanelCartShipment, PanelClearCart, PanelClientCheckout, PanelPaymentSuccess, PanelEditCartItem, };
@@ -0,0 +1,2 @@
1
+ declare function SquareCard(): import("react/jsx-runtime").JSX.Element;
2
+ export default SquareCard;
@@ -0,0 +1,2 @@
1
+ declare function StripeCardForm(): import("react/jsx-runtime").JSX.Element;
2
+ export default StripeCardForm;
@@ -0,0 +1,14 @@
1
+ import { PaymentRequestPaymentMethodEvent } from "@stripe/stripe-js";
2
+ interface Props {
3
+ doStripePayment: (values: any) => void;
4
+ doStripePaymentRequestForButton?: (stripe: any, event: PaymentRequestPaymentMethodEvent) => void;
5
+ cart: any;
6
+ error: any;
7
+ loadingStripePayment: boolean;
8
+ loadingStripePaymentButtons: boolean;
9
+ PaymentButton?: any;
10
+ setLoadingStripePayment: (loading: boolean) => void;
11
+ stripePubKey: string;
12
+ }
13
+ declare function FormStripeCardFields({ doStripePayment, doStripePaymentRequestForButton, cart, error, loadingStripePayment, loadingStripePaymentButtons, PaymentButton, setLoadingStripePayment, stripePubKey, }: Props): import("react/jsx-runtime").JSX.Element;
14
+ export default FormStripeCardFields;
@@ -0,0 +1 @@
1
+ export default function StripeCardForm(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { PaymentRequestPaymentMethodEvent } from '@stripe/stripe-js';
2
+ interface PropsStripePaymentButtons {
3
+ doPaymentRequest: (event: PaymentRequestPaymentMethodEvent) => void;
4
+ cart: any;
5
+ }
6
+ declare function StripePaymentButtons({ doPaymentRequest, cart, }: PropsStripePaymentButtons): import("react/jsx-runtime").JSX.Element;
7
+ export default StripePaymentButtons;
@@ -0,0 +1,4 @@
1
+ import { PaymentRequestPaymentMethodEvent } from '@stripe/stripe-js';
2
+ export declare function stripeInitPromise(apiUrl: string): Promise<any>;
3
+ export declare function stripeCardFormSubmit(apiUrl: string, stripe: any, card: any, cart: any): Promise<any>;
4
+ export declare function stripePaymentButtonSubmit(apiUrl: string, stripe: any, cart: any, paymentMethodEvent: PaymentRequestPaymentMethodEvent): Promise<any>;
@@ -0,0 +1,18 @@
1
+ export declare function companyStripePubKeyOrTestPubKey(company: any): any;
2
+ export declare const CARD_ELEMENT_OPTIONS: {
3
+ hidePostalCode: boolean;
4
+ style: {
5
+ base: {
6
+ '::placeholder': {
7
+ color: string;
8
+ fontSize: string;
9
+ };
10
+ fontSize: string;
11
+ lineHeight: string;
12
+ paddingTop: string;
13
+ };
14
+ invalid: {
15
+ color: string;
16
+ };
17
+ };
18
+ };
@@ -0,0 +1,2 @@
1
+ declare function CartNav(): import("react/jsx-runtime").JSX.Element;
2
+ export default CartNav;
@@ -0,0 +1,8 @@
1
+ interface Props {
2
+ disabled?: boolean;
3
+ icon: any;
4
+ name: string;
5
+ tabId: number;
6
+ }
7
+ declare function NavTab({ disabled, icon, name, tabId }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export default NavTab;
@@ -0,0 +1,13 @@
1
+ export interface Alert {
2
+ icon: any;
3
+ message: string;
4
+ show: boolean;
5
+ title: string;
6
+ type: "info" | "success" | "danger" | "warning" | undefined;
7
+ }
8
+ export interface Tab {
9
+ disabled: boolean;
10
+ icon: any;
11
+ name: string;
12
+ tabId: number;
13
+ }
@@ -0,0 +1,20 @@
1
+ export declare function makeAddress(addressJson: any, makeDirty?: boolean): any;
2
+ /** Plain address fields only — never reuse an existing address id (cart-token auth cannot PATCH it). */
3
+ export declare function sanitizeAddressFields(address?: any): {
4
+ city: any;
5
+ country: any;
6
+ lineOne: any;
7
+ lineTwo: any;
8
+ postcode: any;
9
+ state: any;
10
+ };
11
+ export declare function addressInOneLine(address: any): string;
12
+ export declare const addressComponentsSettings: any;
13
+ export declare function geoSuggestResultAsNewAddress(resp: any): {
14
+ city: string;
15
+ country: string;
16
+ lineOne: any;
17
+ lineTwo: string;
18
+ postcode: string;
19
+ state: string;
20
+ };
@@ -0,0 +1,77 @@
1
+ /** Shared helpers for Area (height × width) variation fields. Stored value is always millimetres. */
2
+ export type AreaUnit = 'mm' | 'cm' | 'm' | 'in' | 'ft';
3
+ export type AreaInputType = 'input' | 'slider';
4
+ export type DisplayModality = 'metric' | 'imperial';
5
+ export declare function parseAreaValue(value: string | null | undefined): {
6
+ heightMm: number;
7
+ widthMm: number;
8
+ } | null;
9
+ export declare function formatAreaValue(heightMm: number, widthMm: number): string;
10
+ export declare function isImperialUnit(unit: AreaUnit | string | null | undefined): boolean;
11
+ export declare function normaliseAreaUnit(unit?: string | null): AreaUnit;
12
+ /** Imperial for en-US / en-LR / en-MM; otherwise metric (incl. en-GB). */
13
+ export declare function localePrefersImperial(locale?: string): boolean;
14
+ /** Millimetres per one unit of the given area unit. */
15
+ export declare function unitFactorMm(unit?: AreaUnit | string): number;
16
+ /** @deprecated use unitFactorMm */
17
+ export declare function metricUnitFactor(unit?: AreaUnit): number;
18
+ export declare function mmToUnit(mm: number, unit?: AreaUnit | string): number;
19
+ export declare function unitToMm(value: number, unit?: AreaUnit | string): number;
20
+ /** @deprecated use mmToUnit */
21
+ export declare function mmToMetricDisplay(mm: number, unit?: AreaUnit): number;
22
+ /** @deprecated use unitToMm */
23
+ export declare function metricDisplayToMm(value: number, unit?: AreaUnit): number;
24
+ export declare function mmToInches(mm: number): number;
25
+ export declare function inchesToMm(inches: number): number;
26
+ /**
27
+ * Unit shown for the current buyer modality.
28
+ * Metric → field unit if metric, else mm.
29
+ * Imperial → field unit if imperial, else inches.
30
+ */
31
+ export declare function activeDisplayUnit(modality: DisplayModality, areaUnit?: AreaUnit | string): AreaUnit;
32
+ export declare function defaultModalityForAreaUnit(areaUnit?: AreaUnit | string): DisplayModality;
33
+ export declare function mmToDisplay(mm: number, modality: DisplayModality, areaUnit?: AreaUnit | string): number;
34
+ export declare function displayToMm(value: number, modality: DisplayModality, areaUnit?: AreaUnit | string): number;
35
+ export declare function unitLabel(modality: DisplayModality, areaUnit?: AreaUnit | string): string;
36
+ export declare function defaultAreaStep(unit?: AreaUnit | string): number;
37
+ /**
38
+ * Step for inputs/sliders in the current display unit.
39
+ * `stepMm` is the admin-configured step stored in millimetres.
40
+ */
41
+ export declare function stepInDisplayUnit(stepMm: number | null | undefined, modality: DisplayModality, areaUnit?: AreaUnit | string): number;
42
+ /** Format a length in mm for buyer-facing summary. */
43
+ export declare function formatLengthFromMm(mm: number, modality: DisplayModality, areaUnit?: AreaUnit | string): string;
44
+ export declare function formatAreaParts(value: string | null | undefined, modality?: DisplayModality, areaUnit?: AreaUnit | string): {
45
+ width: string;
46
+ height: string;
47
+ areaLabel: string;
48
+ } | null;
49
+ export declare function formatAreaSummary(value: string | null | undefined, modality?: DisplayModality, areaUnit?: AreaUnit | string): string | null;
50
+ export declare function clamp(n: number, min?: number | null, max?: number | null): number;
51
+ /**
52
+ * Client-side Area cost estimate (pre-discount), matching API formula:
53
+ * onceOff = heightCost × widthCost × height_u × width_u
54
+ * unitCost = heightUnit × widthUnit × height_u × width_u
55
+ * (dimensions expressed in the field's areaUnit)
56
+ */
57
+ export declare function estimateAreaCosts(variationField: any, value: string | null | undefined): {
58
+ onceOffCost: number;
59
+ unitCost: number;
60
+ } | null;
61
+ /**
62
+ * Keep width/height linked by aspectRatio (width/height).
63
+ * `changed` indicates which dimension the user edited.
64
+ */
65
+ export declare function clampWithAspectRatio(args: {
66
+ heightMm: number;
67
+ widthMm: number;
68
+ changed: 'height' | 'width';
69
+ aspectRatio: number;
70
+ heightMin?: number | null;
71
+ heightMax?: number | null;
72
+ widthMin?: number | null;
73
+ widthMax?: number | null;
74
+ }): {
75
+ heightMm: number;
76
+ widthMm: number;
77
+ };
@@ -0,0 +1,9 @@
1
+ export declare const makeCart: (json: any, makeDirty?: boolean, cartToken?: string) => any;
2
+ export declare const makeCartItem: (cartItemJson: any, makeDirty?: boolean, cartToken?: string) => any;
3
+ export declare function makeDiscountItem(itemJson: any, makeDirty?: boolean): any;
4
+ export declare function makeCartShipmentQuote(json: any, makeDirty?: boolean): any;
5
+ export declare function cartHasSelectedQuotes(cart: any): boolean;
6
+ export declare function getCartShipmentGroupsAndQuotes(cart: any): Promise<any>;
7
+ export declare function hasStripeLegacyAccount(cart: any): boolean;
8
+ export declare function stripeIsValidAndActive(cart: any): boolean;
9
+ export declare function cartRequiresShipment(cart: any): boolean;
@@ -0,0 +1,2 @@
1
+ export declare function companyPrimaryAddress(company: any): any;
2
+ export declare function companyStripePubKeyOrTestPubKey(company: any): any;
@@ -0,0 +1,4 @@
1
+ export declare function getCookie(name: string, defaultValue: any): Promise<any>;
2
+ export declare function getCartCookie(domainId: number | string): Promise<string[]>;
3
+ export declare function getCartCookieToken(domainId: number | string): Promise<string>;
4
+ export declare const setCartCookie: (storeId: number, cart: any, domain?: any) => Promise<void>;
@@ -0,0 +1,5 @@
1
+ export declare const currencyMap: any;
2
+ export declare function formatCurrency(amount: any, options: any): any;
3
+ export declare function calculateTotalWithTax(total: number, tax: any): number;
4
+ export declare function cartItemCurrencyAndCost(cartItem: any): string;
5
+ export declare function currencyTaxAndCost(currency: string, tax: any, theCost: number): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Helpers for loading a product's published custom form bundle in cart edit.
3
+ * Mirrors the product-embed loader: SRI script tag → window.MERCHI_PRODUCT_FORM_<id>.
4
+ */
5
+ import type { ComponentType } from 'react';
6
+ export interface FormBundleRef {
7
+ url: string;
8
+ integrity?: string;
9
+ globalName: string;
10
+ }
11
+ /** If the product has a published custom form with a compiled bundle, return
12
+ * the info needed to load it; otherwise null (caller falls back). */
13
+ export declare function publishedFormBundle(product: any): FormBundleRef | null;
14
+ /** Dynamically load a compiled form bundle and resolve its default export. */
15
+ export declare function loadFormBundle(bundle: FormBundleRef, opts?: {
16
+ timeoutMs?: number;
17
+ }): Promise<ComponentType<any>>;
@@ -0,0 +1,24 @@
1
+ interface JsonObject {
2
+ [key: string]: any;
3
+ }
4
+ interface Counter {
5
+ value: number;
6
+ }
7
+ interface SerialiseOptions {
8
+ existing?: FormData;
9
+ excludeOld?: boolean;
10
+ _prefix?: string;
11
+ }
12
+ export declare function unpackRecursiveJsonIter(jsonObject: JsonObject, options?: SerialiseOptions, fileIndex?: Counter): FormData;
13
+ export declare function encodeMerchiApiData(dataDict: {
14
+ [key: string]: any;
15
+ }): {
16
+ [key: string]: any;
17
+ };
18
+ export declare const phoneOptions: {
19
+ value: string;
20
+ label: any;
21
+ }[];
22
+ export declare function appendStyleSheetText(css: string, callback?: () => void): void;
23
+ export declare const cartEmbed: any;
24
+ export {};
@@ -0,0 +1,14 @@
1
+ export * from './address';
2
+ export * from './cart';
3
+ export * from './company';
4
+ export * from './cookie';
5
+ export * from './currency';
6
+ export * from './helpers';
7
+ export * from './invoice';
8
+ export * from './job';
9
+ export * from './local_storage';
10
+ export * from './product';
11
+ export * from './shipment';
12
+ export * from './tabs';
13
+ export * from './user';
14
+ export * from './variations';
@@ -0,0 +1,3 @@
1
+ export declare function generatePublicInvoicePdf(apiUrl: string, invoice: any, receipt?: boolean): Promise<{
2
+ success: boolean;
3
+ }>;
@@ -0,0 +1 @@
1
+ export declare function makeJob(jobJson: any, makeDirty?: boolean, arrayValueStrict?: boolean): any;
@@ -0,0 +1,31 @@
1
+ export interface SavedCheckoutCustomer {
2
+ id?: number;
3
+ name?: string;
4
+ emailAddress?: string;
5
+ phoneNumbers?: Array<{
6
+ code?: string;
7
+ number?: string;
8
+ }>;
9
+ }
10
+ export interface SavedCheckoutAddress {
11
+ city?: string;
12
+ country?: string;
13
+ lineOne?: string;
14
+ lineTwo?: string;
15
+ postcode?: string;
16
+ state?: string;
17
+ }
18
+ export interface SavedCheckoutDraft {
19
+ customer?: SavedCheckoutCustomer;
20
+ address?: SavedCheckoutAddress;
21
+ receiverNotes?: string;
22
+ }
23
+ export declare function getSavedCheckoutDraft(domainId?: number | string | null): SavedCheckoutDraft;
24
+ export declare function getSavedCheckoutCustomer(domainId?: number | string | null): SavedCheckoutCustomer | undefined;
25
+ export declare function getSavedCheckoutAddress(domainId?: number | string | null): {
26
+ address?: SavedCheckoutAddress;
27
+ receiverNotes?: string;
28
+ };
29
+ export declare function saveCheckoutCustomer(domainId: number | string | undefined | null, customer: SavedCheckoutCustomer): void;
30
+ export declare function saveCheckoutAddress(domainId: number | string | undefined | null, address: SavedCheckoutAddress | null | undefined, receiverNotes?: string): void;
31
+ export declare function addressHasContent(address?: SavedCheckoutAddress | null): boolean;
@@ -0,0 +1,2 @@
1
+ export declare function productFeatureImageUrl(product: any): any;
2
+ export declare const makeProduct: (json: any, makeDirty?: boolean) => any;
@@ -0,0 +1,2 @@
1
+ export declare const shipmentFormId = "_shipment-address-form-id";
2
+ export declare function cartItemsNeedShipment(cart: any): boolean;
@@ -0,0 +1,14 @@
1
+ import { Tab } from '../types';
2
+ export declare const tabIdClearCart = -2;
3
+ export declare const tabIdItem = -1;
4
+ export declare const tabIdItems = 0;
5
+ export declare const tabIdShipment = 1;
6
+ export declare const tabIdCheckout = 2;
7
+ export declare const tabIdPaymentSuccess = 3;
8
+ export declare const tabItems: Tab;
9
+ export declare const tabShipment: Tab;
10
+ export declare const tabCheckout: Tab;
11
+ export declare const initTabs: Tab[];
12
+ export declare const tabsWithShipment: Tab[];
13
+ export declare function setDisableTab(tab: any, disabled: boolean): any;
14
+ export declare function cartHasShippmentGroupsAndAllHaveSelectedGroups(cart: any): boolean;
@@ -0,0 +1,5 @@
1
+ export declare function makeUser(userJson: any, makeDirty?: boolean): any;
2
+ export declare function primaryEmail(user: any): any;
3
+ export declare function primaryPhone(user: any): any;
4
+ export declare function tryReturningCustomerEmail(emailAddress: string): Promise<any>;
5
+ export declare function createNewCustomer(customerJson: any): Promise<any>;
@@ -0,0 +1,18 @@
1
+ export declare enum FieldType {
2
+ TEXT_INPUT = 1,
3
+ SELECT = 2,
4
+ FILE_UPLOAD = 3,
5
+ TEXT_AREA = 4,
6
+ NUMBER_INPUT = 5,
7
+ CHECKBOX = 6,
8
+ RADIO = 7,
9
+ FIELD_INSTRUCTIONS = 8,
10
+ IMAGE_SELECT = 9,
11
+ COLOUR_PICKER = 10,
12
+ COLOUR_SELECT = 11,
13
+ TURNAROUND_TIME = 12,
14
+ COLOUR_EXTRACT = 13,
15
+ AREA = 14
16
+ }
17
+ export declare function isSelectable(fieldType: number): boolean;
18
+ export declare function valueString(variation: any): any;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "merchi_cart",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Merchi's cart",
5
5
  "source": "src/index.ts",
6
6
  "main": "lib/index.js",
7
7
  "module": "esm/index.js",
8
- "types": "types/index.d.ts",
8
+ "types": "lib/index.d.ts",
9
9
  "sideEffects": [
10
10
  "**/*.css",
11
11
  "**/*.scss"
@@ -13,7 +13,8 @@
13
13
  "scripts": {
14
14
  "build:esm": "babel src --out-dir esm --config-file ./babel.esm.config.cjs --extensions .js,.ts,.tsx --verbose && npm run copy-assets && npm run compile-sass",
15
15
  "build:lib": "babel src --out-dir lib --config-file ./babel.build.config.cjs --extensions .js,.ts,.tsx --verbose && npm run copy-assets && npm run compile-sass",
16
- "build": "npm run build:esm && npm run build:lib",
16
+ "build": "npm run build:esm && npm run build:lib && npm run build:types",
17
+ "build:types": "tsc -p tsconfig.build.json",
17
18
  "copy-assets": "copyfiles -u 1 src/assets/**/* esm && copyfiles -u 1 src/assets/**/* lib",
18
19
  "compile-sass": "sass src/styles/globals.scss esm/styles/globals.css && sass src/styles/globals.scss lib/styles/globals.css",
19
20
  "start": "react-scripts start",
@@ -319,7 +319,7 @@ export const useCartContext = () => useContext(CartContext);
319
319
 
320
320
  interface PropsCartProvider {
321
321
  cart?: any;
322
- cartClient: any;
322
+ cartClient?: any;
323
323
  children: ReactNode;
324
324
  classNameAlertError?: string;
325
325
  classNameAlertInfo?: string;
@@ -419,7 +419,7 @@ interface PropsCartProvider {
419
419
  urlFrontend?: string;
420
420
  urlTrackingPage?: string;
421
421
 
422
- getCartShipmentOptions: () => void;
422
+ getCartShipmentOptions?: () => void;
423
423
  }
424
424
 
425
425
  const CartProvider = ({