merchi_cart 0.0.4-c → 0.0.4-e
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.
- package/lib/Cart.js +20 -25
- package/lib/CartAlert.js +14 -12
- package/lib/CartHeader.js +9 -9
- package/lib/CartProvider.js +157 -226
- package/lib/CartTotals.js +44 -44
- package/lib/MerchiSDK/constants/auto_assign_production_on_actions.js +1 -1
- package/lib/MerchiSDK/constants/call_to_actions.js +1 -1
- package/lib/MerchiSDK/constants/discount_types.js +1 -1
- package/lib/MerchiSDK/constants/domain_types.js +1 -1
- package/lib/MerchiSDK/constants/errors.js +1 -1
- package/lib/MerchiSDK/constants/event_types.js +1 -1
- package/lib/MerchiSDK/constants/field_types.js +1 -1
- package/lib/MerchiSDK/constants/input_types.js +1 -1
- package/lib/MerchiSDK/constants/inventory_statuses.js +1 -1
- package/lib/MerchiSDK/constants/invoice_types.js +1 -1
- package/lib/MerchiSDK/constants/item_types.js +1 -1
- package/lib/MerchiSDK/constants/job/drafting_status.js +1 -1
- package/lib/MerchiSDK/constants/job/payment_status.js +1 -1
- package/lib/MerchiSDK/constants/job/production_status.js +1 -1
- package/lib/MerchiSDK/constants/job/shipment_status.js +1 -1
- package/lib/MerchiSDK/constants/job/supply_chain_request_status.js +1 -1
- package/lib/MerchiSDK/constants/job_priorities.js +1 -1
- package/lib/MerchiSDK/constants/job_status.js +5 -5
- package/lib/MerchiSDK/constants/job_types.js +1 -1
- package/lib/MerchiSDK/constants/notification_sections.js +1 -1
- package/lib/MerchiSDK/constants/notification_types.js +1 -1
- package/lib/MerchiSDK/constants/notification_urgencies.js +1 -1
- package/lib/MerchiSDK/constants/payment_types.js +1 -1
- package/lib/MerchiSDK/constants/platform.js +5 -5
- package/lib/MerchiSDK/constants/product_types.js +1 -1
- package/lib/MerchiSDK/constants/rights.js +1 -1
- package/lib/MerchiSDK/constants/robots_meta_directives.js +1 -1
- package/lib/MerchiSDK/constants/roles.js +8 -14
- package/lib/MerchiSDK/constants/shipment_companies.js +1 -1
- package/lib/MerchiSDK/constants/shipment_services.js +1 -1
- package/lib/MerchiSDK/constants/system_roles.js +1 -1
- package/lib/MerchiSDK/constants/theme_foundations.js +1 -1
- package/lib/MerchiSDK/constants/theme_status.js +1 -1
- package/lib/MerchiSDK/constants/user_types.js +1 -1
- package/lib/MerchiSDK/constants/white_label_accessibilities.js +1 -1
- package/lib/MerchiSDK/cookie.js +3 -3
- package/lib/MerchiSDK/entities/address.js +22 -43
- package/lib/MerchiSDK/entities/assignment.js +28 -49
- package/lib/MerchiSDK/entities/automatic_payment_relationship.js +11 -32
- package/lib/MerchiSDK/entities/backup.js +6 -27
- package/lib/MerchiSDK/entities/bank.js +17 -38
- package/lib/MerchiSDK/entities/cart.js +31 -64
- package/lib/MerchiSDK/entities/cart_item.js +30 -51
- package/lib/MerchiSDK/entities/cart_shipment_group.js +9 -30
- package/lib/MerchiSDK/entities/cart_shipment_quote.js +13 -34
- package/lib/MerchiSDK/entities/category.js +14 -35
- package/lib/MerchiSDK/entities/company.js +88 -109
- package/lib/MerchiSDK/entities/company_invitation.js +13 -34
- package/lib/MerchiSDK/entities/component.js +33 -54
- package/lib/MerchiSDK/entities/component_tag.js +7 -28
- package/lib/MerchiSDK/entities/component_version.js +12 -33
- package/lib/MerchiSDK/entities/country_tax.js +21 -45
- package/lib/MerchiSDK/entities/discount.js +13 -34
- package/lib/MerchiSDK/entities/discount_group.js +11 -32
- package/lib/MerchiSDK/entities/domain.js +80 -101
- package/lib/MerchiSDK/entities/domain_invitation.js +14 -35
- package/lib/MerchiSDK/entities/domain_tag.js +15 -36
- package/lib/MerchiSDK/entities/draft.js +32 -65
- package/lib/MerchiSDK/entities/draft_comment.js +19 -40
- package/lib/MerchiSDK/entities/draft_template.js +15 -36
- package/lib/MerchiSDK/entities/email_address.js +10 -31
- package/lib/MerchiSDK/entities/email_counter.js +8 -29
- package/lib/MerchiSDK/entities/enrolled_domain.js +20 -44
- package/lib/MerchiSDK/entities/exchange_rate.js +9 -30
- package/lib/MerchiSDK/entities/file.js +59 -80
- package/lib/MerchiSDK/entities/internal_tag.js +17 -38
- package/lib/MerchiSDK/entities/inventory.js +19 -42
- package/lib/MerchiSDK/entities/inventory_unit_variation.js +12 -33
- package/lib/MerchiSDK/entities/invoice.js +57 -78
- package/lib/MerchiSDK/entities/item.js +18 -39
- package/lib/MerchiSDK/entities/job.js +117 -140
- package/lib/MerchiSDK/entities/job_comment.js +18 -39
- package/lib/MerchiSDK/entities/matching_inventory.js +11 -32
- package/lib/MerchiSDK/entities/menu.js +12 -33
- package/lib/MerchiSDK/entities/menu_item.js +12 -33
- package/lib/MerchiSDK/entities/notification.js +32 -53
- package/lib/MerchiSDK/entities/page.js +13 -34
- package/lib/MerchiSDK/entities/payment.js +25 -46
- package/lib/MerchiSDK/entities/payment_device.js +12 -33
- package/lib/MerchiSDK/entities/phone_number.js +14 -35
- package/lib/MerchiSDK/entities/product.js +153 -188
- package/lib/MerchiSDK/entities/production_comment.js +18 -39
- package/lib/MerchiSDK/entities/quote.js +70 -106
- package/lib/MerchiSDK/entities/quote_item.js +28 -49
- package/lib/MerchiSDK/entities/seo_domain_page.js +13 -34
- package/lib/MerchiSDK/entities/session.js +11 -32
- package/lib/MerchiSDK/entities/shipment.js +62 -83
- package/lib/MerchiSDK/entities/shipment_item.js +7 -28
- package/lib/MerchiSDK/entities/shipment_item_fulfillment.js +7 -28
- package/lib/MerchiSDK/entities/shipment_method.js +21 -42
- package/lib/MerchiSDK/entities/shipment_method_variation.js +15 -36
- package/lib/MerchiSDK/entities/short_url.js +14 -35
- package/lib/MerchiSDK/entities/subscription_plan.js +26 -47
- package/lib/MerchiSDK/entities/supply_domain.js +11 -32
- package/lib/MerchiSDK/entities/system_role.js +7 -28
- package/lib/MerchiSDK/entities/theme.js +89 -110
- package/lib/MerchiSDK/entities/theme_css_setting.js +10 -31
- package/lib/MerchiSDK/entities/user.js +151 -213
- package/lib/MerchiSDK/entities/user_company.js +11 -32
- package/lib/MerchiSDK/entities/variation.js +21 -42
- package/lib/MerchiSDK/entities/variation_field.js +61 -94
- package/lib/MerchiSDK/entities/variation_fields_option.js +40 -61
- package/lib/MerchiSDK/entities/variation_option.js +20 -41
- package/lib/MerchiSDK/entities/variations_group.js +15 -36
- package/lib/MerchiSDK/entity.js +534 -624
- package/lib/MerchiSDK/merchi.js +42 -53
- package/lib/MerchiSDK/request.js +47 -75
- package/lib/MerchiSDK/test_util.js +6 -10
- package/lib/MerchiSDK/toasts.js +12 -13
- package/lib/MerchiSDK/util/float.js +7 -19
- package/lib/MerchiSDK/util/query_string.js +4 -4
- package/lib/MerchiSDK/util/validation.js +2 -3
- package/lib/MerchiSDK/uuid.js +2 -2
- package/lib/buttons/Button.js +15 -15
- package/lib/buttons/ButtonBack.js +22 -25
- package/lib/buttons/ButtonClearCart.js +8 -9
- package/lib/buttons/ButtonInvoiceDownload.js +26 -61
- package/lib/buttons/ButtonNext.js +20 -25
- package/lib/buttons/ButtonNextDynamic.js +16 -18
- package/lib/buttons/ButtonPay.js +17 -13
- package/lib/buttons/ButtonShipmentTabNext.js +12 -13
- package/lib/buttons/index.js +13 -13
- package/lib/components/Alert.js +14 -12
- package/lib/components/CartBody.js +10 -8
- package/lib/components/CartClient.js +22 -17
- package/lib/components/CartFooter.js +9 -7
- package/lib/components/CartItemRow.js +58 -48
- package/lib/components/CartPaymentSettingsInvalid.js +3 -4
- package/lib/components/CartShipment.js +18 -13
- package/lib/components/CartTabContent.js +9 -7
- package/lib/components/CartTabPanel.js +15 -13
- package/lib/components/CartTableContainer.js +9 -7
- package/lib/components/Collapse.js +14 -22
- package/lib/components/LoadingTemplate.js +10 -7
- package/lib/components/NoCartItems.js +9 -9
- package/lib/components/ShipmentGroupCard.js +69 -52
- package/lib/components/Table.js +7 -4
- package/lib/components/Title.js +11 -9
- package/lib/components/containers.js +12 -11
- package/lib/components/index.js +30 -31
- package/lib/forms/FormNewCustomer.js +48 -76
- package/lib/forms/FormReturningCustomer.js +38 -58
- package/lib/forms/FormShipmentAddressAndNotes.js +42 -47
- package/lib/forms/FormSquarePayment.js +8 -9
- package/lib/forms/FormStripePayment.js +8 -9
- package/lib/forms/InputAcceptUserTermsAndConditions.js +12 -11
- package/lib/forms/InputError.js +11 -9
- package/lib/forms/InputSelect.js +34 -36
- package/lib/forms/InputText.js +38 -42
- package/lib/forms/InputsAddress.js +59 -69
- package/lib/index.js +6 -6
- package/lib/panels/PanelCartItems.js +14 -17
- package/lib/panels/PanelCartShipment.js +10 -13
- package/lib/panels/PanelClearCart.js +8 -7
- package/lib/panels/PanelClientCheckout.js +18 -17
- package/lib/panels/PanelEditCartItem.js +17 -22
- package/lib/panels/PanelPaymentSuccess.js +18 -16
- package/lib/panels/index.js +13 -13
- package/lib/slices/sliceCart.js +53 -56
- package/lib/slices/sliceCartAlert.js +11 -15
- package/lib/slices/sliceCartItem.js +11 -10
- package/lib/slices/sliceCartPayment.js +15 -16
- package/lib/slices/sliceCartShipment.js +23 -26
- package/lib/slices/sliceFormReturningCustomer.js +7 -7
- package/lib/slices/sliceNewCustomerForm.js +6 -6
- package/lib/square/SquareCard.js +16 -18
- package/lib/square/actions.js +24 -46
- package/lib/square/slices/reducersSquare.js +6 -6
- package/lib/square/slices/sliceSquareAlerts.js +10 -16
- package/lib/square/slices/sliceSquareForm.js +10 -9
- package/lib/store.js +359 -565
- package/lib/stripe/StripeCardFields.js +43 -44
- package/lib/stripe/StripeCardForm.js +51 -109
- package/lib/stripe/StripePaymentButtons.js +35 -46
- package/lib/stripe/actions.js +75 -196
- package/lib/stripe/slices/sliceStripeAlerts.js +10 -16
- package/lib/stripe/slices/sliceStripeCardForm.js +6 -6
- package/lib/stripe/slices/sliceStripeForm.js +18 -17
- package/lib/stripe/utils.js +1 -1
- package/lib/tabs/CartNav.js +15 -24
- package/lib/tabs/NavTab.js +20 -19
- package/lib/utilities/address.js +32 -30
- package/lib/utilities/cart.js +33 -50
- package/lib/utilities/cookie.js +46 -129
- package/lib/utilities/currency.js +29 -25
- package/lib/utilities/helpers.js +41 -60
- package/lib/utilities/invoice.js +45 -114
- package/lib/utilities/product.js +5 -3
- package/lib/utilities/user.js +24 -62
- package/lib/utilities/variations.js +16 -14
- package/package.json +1 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
6
|
+
exports.default = void 0;
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _reactRedux = require("react-redux");
|
|
10
9
|
var _store = require("../store");
|
|
@@ -13,16 +12,17 @@ var _currency = require("../utilities/currency");
|
|
|
13
12
|
var _CartProvider = require("../CartProvider");
|
|
14
13
|
var _productNotFound = _interopRequireDefault(require("../assets/product-not-found.png"));
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
18
|
function NoCartShipmentOptionsFound() {
|
|
20
|
-
|
|
21
|
-
classNameNoItems
|
|
19
|
+
const {
|
|
20
|
+
classNameNoItems
|
|
21
|
+
} = (0, _CartProvider.useCartContext)();
|
|
22
22
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
23
23
|
className: classNameNoItems,
|
|
24
24
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
25
|
-
src: _productNotFound
|
|
25
|
+
src: _productNotFound.default.src,
|
|
26
26
|
width: 276,
|
|
27
27
|
height: 215
|
|
28
28
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
@@ -31,17 +31,25 @@ function NoCartShipmentOptionsFound() {
|
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
function PickupInfo(_ref) {
|
|
34
|
-
|
|
34
|
+
let {
|
|
35
|
+
originAddress
|
|
36
|
+
} = _ref;
|
|
35
37
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("small", {
|
|
36
38
|
children: ["Pick up from: ", (0, _address.addressInOneLine)(originAddress)]
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
41
|
function ShipmentPrice(_ref2) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
let {
|
|
43
|
+
quote
|
|
44
|
+
} = _ref2;
|
|
45
|
+
const {
|
|
46
|
+
shipmentMethod,
|
|
47
|
+
taxType,
|
|
48
|
+
totalCost
|
|
49
|
+
} = quote;
|
|
50
|
+
const {
|
|
51
|
+
currency
|
|
52
|
+
} = shipmentMethod;
|
|
45
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
46
54
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("small", {
|
|
47
55
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
@@ -51,14 +59,21 @@ function ShipmentPrice(_ref2) {
|
|
|
51
59
|
});
|
|
52
60
|
}
|
|
53
61
|
function ShipmentOptionInfo(_ref3) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
let {
|
|
63
|
+
quote
|
|
64
|
+
} = _ref3;
|
|
65
|
+
const {
|
|
66
|
+
classNameShipmentOption
|
|
67
|
+
} = (0, _CartProvider.useCartContext)();
|
|
68
|
+
const {
|
|
69
|
+
name,
|
|
70
|
+
shipmentMethod
|
|
71
|
+
} = quote;
|
|
72
|
+
const {
|
|
73
|
+
originAddress,
|
|
74
|
+
pickUp,
|
|
75
|
+
transportCompanyName
|
|
76
|
+
} = shipmentMethod;
|
|
62
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
63
78
|
className: classNameShipmentOption,
|
|
64
79
|
children: [!name ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -83,19 +98,21 @@ function ShipmentOptionInfo(_ref3) {
|
|
|
83
98
|
});
|
|
84
99
|
}
|
|
85
100
|
function ShipmentQuote(_ref4) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
101
|
+
let {
|
|
102
|
+
groupIndex,
|
|
103
|
+
quote
|
|
104
|
+
} = _ref4;
|
|
105
|
+
const {
|
|
106
|
+
classNameListItem
|
|
107
|
+
} = (0, _CartProvider.useCartContext)();
|
|
108
|
+
const {
|
|
109
|
+
selectedQuotes
|
|
110
|
+
} = (0, _reactRedux.useSelector)(s => s.stateCartShipment);
|
|
111
|
+
const isSelected = selectedQuotes[groupIndex].id === quote.id;
|
|
95
112
|
function doClick() {
|
|
96
113
|
(0, _store.setSelectedShipmentQuote)(groupIndex, quote);
|
|
97
114
|
}
|
|
98
|
-
|
|
115
|
+
const icon = isSelected ? 'far fa-check-square' : 'far fa-square';
|
|
99
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
100
117
|
className: classNameListItem,
|
|
101
118
|
onClick: doClick,
|
|
@@ -119,14 +136,18 @@ function ShipmentQuote(_ref4) {
|
|
|
119
136
|
});
|
|
120
137
|
}
|
|
121
138
|
function ShipmentGroupCard(_ref5) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
139
|
+
let {
|
|
140
|
+
group,
|
|
141
|
+
groupIndex
|
|
142
|
+
} = _ref5;
|
|
143
|
+
const {
|
|
144
|
+
classNameList,
|
|
145
|
+
classNameListInline
|
|
146
|
+
} = (0, _CartProvider.useCartContext)();
|
|
147
|
+
const {
|
|
148
|
+
cartItems,
|
|
149
|
+
quotes = []
|
|
150
|
+
} = group;
|
|
130
151
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
131
152
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("ul", {
|
|
132
153
|
className: classNameListInline,
|
|
@@ -134,20 +155,16 @@ function ShipmentGroupCard(_ref5) {
|
|
|
134
155
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("strong", {
|
|
135
156
|
children: ["Shipment ", groupIndex + 1, " contents:"]
|
|
136
157
|
})
|
|
137
|
-
}), cartItems.map(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}, index);
|
|
141
|
-
})]
|
|
158
|
+
}), cartItems.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
159
|
+
children: item.product.name
|
|
160
|
+
}, index))]
|
|
142
161
|
}), quotes.length ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
143
162
|
className: classNameList,
|
|
144
|
-
children: quotes.map(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}, "".concat(i, "-group"));
|
|
149
|
-
})
|
|
163
|
+
children: quotes.map((q, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(ShipmentQuote, {
|
|
164
|
+
quote: q,
|
|
165
|
+
groupIndex: groupIndex
|
|
166
|
+
}, `${i}-group`))
|
|
150
167
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NoCartShipmentOptionsFound, {})]
|
|
151
168
|
});
|
|
152
169
|
}
|
|
153
|
-
var _default = exports
|
|
170
|
+
var _default = exports.default = ShipmentGroupCard;
|
package/lib/components/Table.js
CHANGED
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = Table;
|
|
7
7
|
var _CartProvider = require("../CartProvider");
|
|
8
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
9
|
function Table(_ref) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
let {
|
|
11
|
+
children
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
classNameTable
|
|
15
|
+
} = (0, _CartProvider.useCartContext)();
|
|
13
16
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("table", {
|
|
14
17
|
className: classNameTable,
|
|
15
18
|
children: children
|
package/lib/components/Title.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
|
-
exports
|
|
6
|
+
exports.default = Title;
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
10
9
|
var _CartProvider = require("../CartProvider");
|
|
11
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
13
|
function Title(_ref) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
let {
|
|
15
|
+
icon,
|
|
16
|
+
title
|
|
17
|
+
} = _ref;
|
|
18
|
+
const {
|
|
19
|
+
classNameCartTitle
|
|
20
|
+
} = (0, _CartProvider.useCartContext)();
|
|
19
21
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
20
22
|
className: classNameCartTitle,
|
|
21
23
|
children: [typeof icon === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
22
|
-
className:
|
|
24
|
+
className: `${icon} fa-2x`
|
|
23
25
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
24
26
|
icon: icon,
|
|
25
27
|
size: "2x"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -8,12 +7,13 @@ exports.CheckoutContainer = CheckoutContainer;
|
|
|
8
7
|
exports.InnerContainer = InnerContainer;
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
12
|
function CheckoutContainer(_ref) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
textAlign =
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
textAlign = 'center'
|
|
16
|
+
} = _ref;
|
|
17
17
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
18
18
|
style: {
|
|
19
19
|
display: 'flex',
|
|
@@ -24,11 +24,12 @@ function CheckoutContainer(_ref) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
function InnerContainer(_ref2) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
width =
|
|
27
|
+
let {
|
|
28
|
+
children,
|
|
29
|
+
paddingBottom,
|
|
30
|
+
paddingTop,
|
|
31
|
+
width = 400
|
|
32
|
+
} = _ref2;
|
|
32
33
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
33
34
|
style: {
|
|
34
35
|
padding: '3rem',
|
package/lib/components/index.js
CHANGED
|
@@ -1,91 +1,90 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
Object.defineProperty(exports, "Alert", {
|
|
8
7
|
enumerable: true,
|
|
9
|
-
get: function
|
|
10
|
-
return _Alert
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Alert.default;
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
12
|
Object.defineProperty(exports, "CartBody", {
|
|
14
13
|
enumerable: true,
|
|
15
|
-
get: function
|
|
16
|
-
return _CartBody
|
|
14
|
+
get: function () {
|
|
15
|
+
return _CartBody.default;
|
|
17
16
|
}
|
|
18
17
|
});
|
|
19
18
|
Object.defineProperty(exports, "CartFooter", {
|
|
20
19
|
enumerable: true,
|
|
21
|
-
get: function
|
|
22
|
-
return _CartFooter
|
|
20
|
+
get: function () {
|
|
21
|
+
return _CartFooter.default;
|
|
23
22
|
}
|
|
24
23
|
});
|
|
25
24
|
Object.defineProperty(exports, "CartPaymentSettingsInvalid", {
|
|
26
25
|
enumerable: true,
|
|
27
|
-
get: function
|
|
28
|
-
return _CartPaymentSettingsInvalid
|
|
26
|
+
get: function () {
|
|
27
|
+
return _CartPaymentSettingsInvalid.default;
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
30
|
Object.defineProperty(exports, "CartTabContent", {
|
|
32
31
|
enumerable: true,
|
|
33
|
-
get: function
|
|
34
|
-
return _CartTabContent
|
|
32
|
+
get: function () {
|
|
33
|
+
return _CartTabContent.default;
|
|
35
34
|
}
|
|
36
35
|
});
|
|
37
36
|
Object.defineProperty(exports, "CartTabPanel", {
|
|
38
37
|
enumerable: true,
|
|
39
|
-
get: function
|
|
40
|
-
return _CartTabPanel
|
|
38
|
+
get: function () {
|
|
39
|
+
return _CartTabPanel.default;
|
|
41
40
|
}
|
|
42
41
|
});
|
|
43
42
|
Object.defineProperty(exports, "CartTableContainer", {
|
|
44
43
|
enumerable: true,
|
|
45
|
-
get: function
|
|
46
|
-
return _CartTableContainer
|
|
44
|
+
get: function () {
|
|
45
|
+
return _CartTableContainer.default;
|
|
47
46
|
}
|
|
48
47
|
});
|
|
49
48
|
Object.defineProperty(exports, "Collapse", {
|
|
50
49
|
enumerable: true,
|
|
51
|
-
get: function
|
|
52
|
-
return _Collapse
|
|
50
|
+
get: function () {
|
|
51
|
+
return _Collapse.default;
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
54
|
Object.defineProperty(exports, "LoadingTemplate", {
|
|
56
55
|
enumerable: true,
|
|
57
|
-
get: function
|
|
58
|
-
return _LoadingTemplate
|
|
56
|
+
get: function () {
|
|
57
|
+
return _LoadingTemplate.default;
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
60
|
Object.defineProperty(exports, "LoadingTemplateSm", {
|
|
62
61
|
enumerable: true,
|
|
63
|
-
get: function
|
|
62
|
+
get: function () {
|
|
64
63
|
return _LoadingTemplate.LoadingTemplateSm;
|
|
65
64
|
}
|
|
66
65
|
});
|
|
67
66
|
Object.defineProperty(exports, "NoCartItems", {
|
|
68
67
|
enumerable: true,
|
|
69
|
-
get: function
|
|
70
|
-
return _NoCartItems
|
|
68
|
+
get: function () {
|
|
69
|
+
return _NoCartItems.default;
|
|
71
70
|
}
|
|
72
71
|
});
|
|
73
72
|
Object.defineProperty(exports, "ShipmentGroupCard", {
|
|
74
73
|
enumerable: true,
|
|
75
|
-
get: function
|
|
76
|
-
return _ShipmentGroupCard
|
|
74
|
+
get: function () {
|
|
75
|
+
return _ShipmentGroupCard.default;
|
|
77
76
|
}
|
|
78
77
|
});
|
|
79
78
|
Object.defineProperty(exports, "Table", {
|
|
80
79
|
enumerable: true,
|
|
81
|
-
get: function
|
|
82
|
-
return _Table
|
|
80
|
+
get: function () {
|
|
81
|
+
return _Table.default;
|
|
83
82
|
}
|
|
84
83
|
});
|
|
85
84
|
Object.defineProperty(exports, "Title", {
|
|
86
85
|
enumerable: true,
|
|
87
|
-
get: function
|
|
88
|
-
return _Title
|
|
86
|
+
get: function () {
|
|
87
|
+
return _Title.default;
|
|
89
88
|
}
|
|
90
89
|
});
|
|
91
90
|
var _Alert = _interopRequireDefault(require("./Alert"));
|
|
@@ -101,6 +100,6 @@ var _NoCartItems = _interopRequireDefault(require("./NoCartItems"));
|
|
|
101
100
|
var _ShipmentGroupCard = _interopRequireDefault(require("./ShipmentGroupCard"));
|
|
102
101
|
var _Table = _interopRequireDefault(require("./Table"));
|
|
103
102
|
var _Title = _interopRequireDefault(require("./Title"));
|
|
104
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
105
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
106
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
103
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
104
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
105
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.FormCustomerNew = FormCustomerNew;
|
|
8
|
-
exports.emailValidation = exports
|
|
7
|
+
exports.emailValidation = exports.default = void 0;
|
|
9
8
|
var React = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _reactHookForm = require("react-hook-form");
|
|
11
10
|
var _reactRedux = require("react-redux");
|
|
@@ -18,80 +17,53 @@ var _CartProvider = require("../CartProvider");
|
|
|
18
17
|
var _helpers = require("../utilities/helpers");
|
|
19
18
|
var _InputError = _interopRequireDefault(require("./InputError"));
|
|
20
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
22
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
24
|
-
|
|
25
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
26
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
29
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
31
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
32
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
33
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
34
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
36
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
37
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
38
|
-
var emailValidation = exports.emailValidation = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]/i;
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
const emailValidation = exports.emailValidation = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]/i;
|
|
39
24
|
function FormCustomerNew() {
|
|
40
|
-
|
|
41
|
-
classNameBtnPrimary
|
|
42
|
-
classNameCartFormGroup
|
|
43
|
-
showUserTermsAndConditions
|
|
44
|
-
urlApi
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} // Basic validation for phone. Checking that phone is a number. Can make more complex if we want.
|
|
73
|
-
function _onSubmit() {
|
|
74
|
-
_onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
|
|
75
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
76
|
-
while (1) switch (_context.prev = _context.next) {
|
|
77
|
-
case 0:
|
|
78
|
-
_context.next = 2;
|
|
79
|
-
return (0, _store.actionCreateNewCustomer)(urlApi, _objectSpread({}, values));
|
|
80
|
-
case 2:
|
|
81
|
-
case "end":
|
|
82
|
-
return _context.stop();
|
|
83
|
-
}
|
|
84
|
-
}, _callee);
|
|
85
|
-
}));
|
|
86
|
-
return _onSubmit.apply(this, arguments);
|
|
25
|
+
const {
|
|
26
|
+
classNameBtnPrimary,
|
|
27
|
+
classNameCartFormGroup,
|
|
28
|
+
showUserTermsAndConditions,
|
|
29
|
+
urlApi
|
|
30
|
+
} = (0, _CartProvider.useCartContext)();
|
|
31
|
+
const {
|
|
32
|
+
creatingNewCustomer: loading,
|
|
33
|
+
serverError: error
|
|
34
|
+
} = (0, _reactRedux.useSelector)(s => s.stateNewCustomerForm);
|
|
35
|
+
const [acceptConditions, setAcceptConditions] = React.useState(true);
|
|
36
|
+
const {
|
|
37
|
+
control,
|
|
38
|
+
handleSubmit,
|
|
39
|
+
watch
|
|
40
|
+
} = (0, _reactHookForm.useForm)({
|
|
41
|
+
defaultValues: {
|
|
42
|
+
emailAddresses: [{
|
|
43
|
+
emailAddress: ''
|
|
44
|
+
}],
|
|
45
|
+
name: '',
|
|
46
|
+
phoneNumbers: [{
|
|
47
|
+
code: 'AU',
|
|
48
|
+
number: ''
|
|
49
|
+
}],
|
|
50
|
+
registeredAsGuest: false
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
async function onSubmit(values) {
|
|
54
|
+
await (0, _store.actionCreateNewCustomer)(urlApi, {
|
|
55
|
+
...values
|
|
56
|
+
});
|
|
87
57
|
}
|
|
58
|
+
|
|
59
|
+
// Basic validation for phone. Checking that phone is a number. Can make more complex if we want.
|
|
88
60
|
function validatePhone() {
|
|
89
|
-
|
|
61
|
+
const phone = watch('phoneNumbers.0.number');
|
|
90
62
|
if (isNaN(phone)) return 'Phone number must be a number';else return true;
|
|
91
63
|
}
|
|
92
64
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
93
65
|
onSubmit: handleSubmit(onSubmit),
|
|
94
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputText
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputText.default, {
|
|
95
67
|
control: control,
|
|
96
68
|
label: "Full Name",
|
|
97
69
|
name: "name",
|
|
@@ -99,7 +71,7 @@ function FormCustomerNew() {
|
|
|
99
71
|
rules: {
|
|
100
72
|
required: 'Full name is required.'
|
|
101
73
|
}
|
|
102
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputText
|
|
74
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputText.default, {
|
|
103
75
|
control: control,
|
|
104
76
|
label: "Email",
|
|
105
77
|
name: "emailAddresses[0].emailAddress",
|
|
@@ -117,7 +89,7 @@ function FormCustomerNew() {
|
|
|
117
89
|
style: {
|
|
118
90
|
flexGrow: 1
|
|
119
91
|
},
|
|
120
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSelect
|
|
92
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputSelect.default, {
|
|
121
93
|
control: control,
|
|
122
94
|
label: "Country Code",
|
|
123
95
|
name: "phoneNumbers[0].code",
|
|
@@ -127,7 +99,7 @@ function FormCustomerNew() {
|
|
|
127
99
|
style: {
|
|
128
100
|
flexGrow: 1
|
|
129
101
|
},
|
|
130
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputText
|
|
102
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputText.default, {
|
|
131
103
|
control: control,
|
|
132
104
|
label: "Phone Number",
|
|
133
105
|
name: "phoneNumbers[0].number",
|
|
@@ -141,15 +113,15 @@ function FormCustomerNew() {
|
|
|
141
113
|
})]
|
|
142
114
|
}), showUserTermsAndConditions && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
143
115
|
className: classNameCartFormGroup,
|
|
144
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAcceptUserTermsAndConditions
|
|
116
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputAcceptUserTermsAndConditions.default, {
|
|
145
117
|
isChecked: acceptConditions,
|
|
146
118
|
setIsChecked: setAcceptConditions
|
|
147
|
-
}), !acceptConditions && /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputError
|
|
119
|
+
}), !acceptConditions && /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputError.default, {
|
|
148
120
|
error: {
|
|
149
121
|
message: 'You must agree to the user profile terms and conditions to proceed.'
|
|
150
122
|
}
|
|
151
123
|
})]
|
|
152
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputError
|
|
124
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputError.default, {
|
|
153
125
|
error: error || {}
|
|
154
126
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
155
127
|
className: classNameCartFormGroup,
|
|
@@ -162,4 +134,4 @@ function FormCustomerNew() {
|
|
|
162
134
|
})]
|
|
163
135
|
});
|
|
164
136
|
}
|
|
165
|
-
var _default = exports
|
|
137
|
+
var _default = exports.default = FormCustomerNew;
|