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
package/lib/MerchiSDK/merchi.js
CHANGED
|
@@ -75,28 +75,24 @@ var _subscription_plan = require("./entities/subscription_plan");
|
|
|
75
75
|
var _uuid = require("./uuid");
|
|
76
76
|
var _request = require("./request");
|
|
77
77
|
var _cookie = require("./cookie");
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
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; }
|
|
81
|
-
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; }
|
|
82
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
83
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
84
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
85
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
86
|
-
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); } // eslint-disable-next-line no-unused-vars
|
|
78
|
+
// eslint-disable-next-line no-unused-vars
|
|
79
|
+
|
|
87
80
|
// the type of classes
|
|
88
81
|
|
|
89
82
|
function cloneClass(original, arg) {
|
|
90
83
|
// copy the constructor, but use the empty object as `this`
|
|
91
|
-
|
|
84
|
+
const copy = original.bind({}, arg);
|
|
92
85
|
// pick up any static members (this is shallow, the members are not copied)
|
|
93
86
|
Object.assign(copy, original);
|
|
94
87
|
return copy;
|
|
95
88
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
89
|
+
class Merchi {
|
|
90
|
+
setupClass(cls) {
|
|
91
|
+
const result = cloneClass(cls, this);
|
|
92
|
+
result.merchi = this;
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
constructor(sessionToken, clientToken, invoiceToken, cartToken) {
|
|
100
96
|
this.id = (0, _uuid.generateUUID)();
|
|
101
97
|
this.sessionToken = void 0;
|
|
102
98
|
this.invoiceToken = void 0;
|
|
@@ -170,67 +166,68 @@ var Merchi = exports.Merchi = /*#__PURE__*/function () {
|
|
|
170
166
|
this.QuoteItem = void 0;
|
|
171
167
|
this.MatchingInventory = void 0;
|
|
172
168
|
this.SubscriptionPlan = void 0;
|
|
173
|
-
this.authenticatedFetch =
|
|
169
|
+
this.authenticatedFetch = (resource, options, expectEmptyResponse) => {
|
|
174
170
|
if (!options.query) {
|
|
175
171
|
/* istanbul ignore next */
|
|
176
172
|
options.query = [];
|
|
177
173
|
}
|
|
178
|
-
if (
|
|
174
|
+
if (this.sessionToken) {
|
|
179
175
|
/* istanbul ignore next */
|
|
180
|
-
options.query.push(['session_token',
|
|
176
|
+
options.query.push(['session_token', this.sessionToken]);
|
|
181
177
|
}
|
|
182
|
-
if (
|
|
178
|
+
if (this.clientToken) {
|
|
183
179
|
/* istanbul ignore next */
|
|
184
|
-
options.query.push(['client_token',
|
|
180
|
+
options.query.push(['client_token', this.clientToken]);
|
|
185
181
|
}
|
|
186
|
-
if (
|
|
182
|
+
if (this.invoiceToken) {
|
|
187
183
|
/* istanbul ignore next */
|
|
188
|
-
options.query.push(['invoice_token',
|
|
184
|
+
options.query.push(['invoice_token', this.invoiceToken]);
|
|
189
185
|
}
|
|
190
|
-
if (
|
|
186
|
+
if (this.cartToken) {
|
|
191
187
|
/* istanbul ignore next */
|
|
192
|
-
options.query.push(['cart_token',
|
|
188
|
+
options.query.push(['cart_token', this.cartToken]);
|
|
193
189
|
}
|
|
194
190
|
return (0, _request.apiFetch)(resource, options, expectEmptyResponse);
|
|
195
191
|
};
|
|
196
192
|
/* istanbul ignore next */
|
|
197
|
-
this.authenticatedFetchWithProgress =
|
|
193
|
+
this.authenticatedFetchWithProgress = (resource, options, progressCallback) => {
|
|
198
194
|
if (!options.query) {
|
|
199
195
|
options.query = [];
|
|
200
196
|
}
|
|
201
|
-
if (
|
|
202
|
-
options.query.push(['session_token',
|
|
197
|
+
if (this.sessionToken) {
|
|
198
|
+
options.query.push(['session_token', this.sessionToken]);
|
|
203
199
|
}
|
|
204
|
-
if (
|
|
205
|
-
options.query.push(['client_token',
|
|
200
|
+
if (this.clientToken) {
|
|
201
|
+
options.query.push(['client_token', this.clientToken]);
|
|
206
202
|
}
|
|
207
|
-
if (
|
|
208
|
-
options.query.push(['invoice_token',
|
|
203
|
+
if (this.invoiceToken) {
|
|
204
|
+
options.query.push(['invoice_token', this.invoiceToken]);
|
|
209
205
|
}
|
|
210
|
-
if (
|
|
211
|
-
options.query.push(['cart_token',
|
|
206
|
+
if (this.cartToken) {
|
|
207
|
+
options.query.push(['cart_token', this.cartToken]);
|
|
212
208
|
}
|
|
213
209
|
return (0, _request.apiFetchWithProgress)(resource, options, progressCallback);
|
|
214
210
|
};
|
|
215
|
-
this.getCurrentUser =
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
211
|
+
this.getCurrentUser = options => {
|
|
212
|
+
const {
|
|
213
|
+
embed = {}
|
|
214
|
+
} = options || {};
|
|
215
|
+
const defaultEmbed = {
|
|
220
216
|
user: {
|
|
221
217
|
enrolledDomains: {
|
|
222
218
|
domain: {}
|
|
223
219
|
}
|
|
224
220
|
}
|
|
225
221
|
};
|
|
226
|
-
if (!
|
|
222
|
+
if (!this.sessionToken) {
|
|
227
223
|
return Promise.resolve(null);
|
|
228
224
|
}
|
|
229
|
-
return
|
|
230
|
-
embed:
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
225
|
+
return this.Session.get(this.sessionToken, {
|
|
226
|
+
embed: {
|
|
227
|
+
...defaultEmbed,
|
|
228
|
+
...embed
|
|
229
|
+
}
|
|
230
|
+
}).then(session => session.user);
|
|
234
231
|
};
|
|
235
232
|
if (sessionToken) {
|
|
236
233
|
this.sessionToken = sessionToken;
|
|
@@ -323,13 +320,5 @@ var Merchi = exports.Merchi = /*#__PURE__*/function () {
|
|
|
323
320
|
this.MatchingInventory = this.setupClass(_matching_inventory.MatchingInventory);
|
|
324
321
|
this.SubscriptionPlan = this.setupClass(_subscription_plan.SubscriptionPlan);
|
|
325
322
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
value: function setupClass(cls) {
|
|
329
|
-
var result = cloneClass(cls, this);
|
|
330
|
-
result.merchi = this;
|
|
331
|
-
return result;
|
|
332
|
-
}
|
|
333
|
-
}]);
|
|
334
|
-
return Merchi;
|
|
335
|
-
}();
|
|
323
|
+
}
|
|
324
|
+
exports.Merchi = Merchi;
|
package/lib/MerchiSDK/request.js
CHANGED
|
@@ -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
|
});
|
|
@@ -10,64 +9,35 @@ exports.apiFetchWithProgress = apiFetchWithProgress;
|
|
|
10
9
|
exports.backendFetch = backendFetch;
|
|
11
10
|
exports.version = void 0;
|
|
12
11
|
var _errors = require("./constants/errors");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
-
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); }
|
|
20
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
22
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
23
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
26
|
-
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
27
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
-
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
29
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
30
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } // eslint-disable-next-line no-unused-vars
|
|
12
|
+
// eslint-disable-next-line no-unused-vars
|
|
13
|
+
|
|
31
14
|
/* this constant are expected to be defined in webpack (or provided as
|
|
32
15
|
globals by some other means. */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var _this;
|
|
38
|
-
_classCallCheck(this, ApiError);
|
|
39
|
-
var message = JSON.stringify(err);
|
|
16
|
+
const BACKEND_URI = window && window.merchiBackendUri ? window.merchiBackendUri : process && process.env.BACKEND_URL ? process.env.BACKEND_URL : 'https://api.staging.merchi.co/';
|
|
17
|
+
class ApiError extends Error {
|
|
18
|
+
constructor(err) {
|
|
19
|
+
const message = JSON.stringify(err);
|
|
40
20
|
/* istanbul ignore next */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return _this;
|
|
21
|
+
super(message);
|
|
22
|
+
this.statusCode = void 0;
|
|
23
|
+
this.errorCode = void 0;
|
|
24
|
+
this.errorMessage = void 0;
|
|
25
|
+
this.original = void 0;
|
|
26
|
+
this.statusCode = err.statusCode;
|
|
27
|
+
this.errorCode = (0, _errors.getErrorFromCode)(err.errorCode);
|
|
28
|
+
this.errorMessage = err.message ? err.message : 'No error message';
|
|
29
|
+
this.name = 'ApiError';
|
|
30
|
+
this.original = err;
|
|
52
31
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
32
|
+
}
|
|
33
|
+
exports.ApiError = ApiError;
|
|
34
|
+
const version = exports.version = 'v6';
|
|
56
35
|
function backendFetch(resource, options) {
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
const server = window && window.merchiBackendUri ? window.merchiBackendUri : BACKEND_URI;
|
|
37
|
+
const url = new URL(server + version + resource);
|
|
59
38
|
if (options && options.query) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
try {
|
|
63
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
64
|
-
var entry = _step.value;
|
|
65
|
-
url.searchParams.append(entry[0], entry[1]);
|
|
66
|
-
}
|
|
67
|
-
} catch (err) {
|
|
68
|
-
_iterator.e(err);
|
|
69
|
-
} finally {
|
|
70
|
-
_iterator.f();
|
|
39
|
+
for (const entry of options.query) {
|
|
40
|
+
url.searchParams.append(entry[0], entry[1]);
|
|
71
41
|
}
|
|
72
42
|
}
|
|
73
43
|
return fetch(url.toString(), options);
|
|
@@ -76,7 +46,7 @@ function apiFetch(resource, options, expectEmptyResponse) {
|
|
|
76
46
|
return backendFetch(resource, options).then(function (response) {
|
|
77
47
|
if (response.status < 200 || response.status > 299) {
|
|
78
48
|
return response.json().then(function (json) {
|
|
79
|
-
|
|
49
|
+
const err = new ApiError(json);
|
|
80
50
|
return Promise.reject(err);
|
|
81
51
|
});
|
|
82
52
|
} else {
|
|
@@ -89,25 +59,27 @@ function apiFetch(resource, options, expectEmptyResponse) {
|
|
|
89
59
|
function apiFetchWithProgress(resource, options, progressCallback) {
|
|
90
60
|
return backendFetch(resource, options).then(function (response) {
|
|
91
61
|
if (!response.body) {
|
|
92
|
-
|
|
62
|
+
const err = new ApiError('empty response');
|
|
93
63
|
return Promise.reject(err);
|
|
94
64
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
65
|
+
const reader = response.body.getReader();
|
|
66
|
+
let bodyText = '';
|
|
67
|
+
let errorText = '';
|
|
68
|
+
let haveError = false;
|
|
69
|
+
const expected = '{"loadingBar": "' + '.'.repeat(100) + '"}';
|
|
100
70
|
function readChunk() {
|
|
101
|
-
return reader.read().then(
|
|
102
|
-
|
|
103
|
-
|
|
71
|
+
return reader.read().then(_ref => {
|
|
72
|
+
let {
|
|
73
|
+
done,
|
|
74
|
+
value
|
|
75
|
+
} = _ref;
|
|
104
76
|
if (done) {
|
|
105
77
|
if (response.status < 200 || response.status > 299) {
|
|
106
|
-
|
|
107
|
-
return Promise.reject(
|
|
78
|
+
const err = new ApiError('Unknown error');
|
|
79
|
+
return Promise.reject(err);
|
|
108
80
|
} else if (haveError) {
|
|
109
81
|
try {
|
|
110
|
-
|
|
82
|
+
const jsonText = JSON.parse(errorText);
|
|
111
83
|
return Promise.reject(new ApiError(jsonText));
|
|
112
84
|
} catch (e) {
|
|
113
85
|
return Promise.reject(new ApiError(errorText));
|
|
@@ -116,24 +88,24 @@ function apiFetchWithProgress(resource, options, progressCallback) {
|
|
|
116
88
|
return bodyText;
|
|
117
89
|
}
|
|
118
90
|
} else {
|
|
119
|
-
|
|
91
|
+
const chunk = new TextDecoder().decode(value);
|
|
120
92
|
if (haveError) {
|
|
121
93
|
errorText += chunk;
|
|
122
94
|
} else {
|
|
123
|
-
for (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
if (expectedChar ==
|
|
127
|
-
bodyText +=
|
|
95
|
+
for (let i = 0; i < chunk.length; ++i) {
|
|
96
|
+
const char = chunk[i];
|
|
97
|
+
const expectedChar = expected[bodyText.length];
|
|
98
|
+
if (expectedChar == char && !haveError) {
|
|
99
|
+
bodyText += char;
|
|
128
100
|
} else {
|
|
129
101
|
haveError = true;
|
|
130
|
-
errorText +=
|
|
102
|
+
errorText += char;
|
|
131
103
|
}
|
|
132
104
|
}
|
|
133
105
|
}
|
|
134
106
|
if (!haveError && progressCallback) {
|
|
135
|
-
|
|
136
|
-
progressCallback(
|
|
107
|
+
const progress = Math.min(Math.max(0, bodyText.length - 16), 100);
|
|
108
|
+
progressCallback(progress);
|
|
137
109
|
}
|
|
138
110
|
return readChunk();
|
|
139
111
|
}
|
|
@@ -11,16 +11,12 @@ function setup() {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
function mockFetch(ok, data, status) {
|
|
14
|
-
|
|
15
|
-
mock.mockImplementation(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return Promise.resolve(data);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
14
|
+
const mock = jest.fn();
|
|
15
|
+
mock.mockImplementation(() => Promise.resolve({
|
|
16
|
+
status: status,
|
|
17
|
+
ok: ok,
|
|
18
|
+
json: () => Promise.resolve(data)
|
|
19
|
+
}));
|
|
24
20
|
global.fetch = mock;
|
|
25
21
|
return mock;
|
|
26
22
|
}
|
package/lib/MerchiSDK/toasts.js
CHANGED
|
@@ -12,22 +12,21 @@ exports.toastNotifications = void 0;
|
|
|
12
12
|
|
|
13
13
|
// eslint-disable-next-line no-unused-vars
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const toastNotifications = (merchi, options) => {
|
|
16
|
+
const resource = '/notifications-check-update/';
|
|
17
|
+
const data = new FormData();
|
|
18
|
+
const {
|
|
19
|
+
entities,
|
|
20
|
+
sections,
|
|
21
|
+
notificationTypes
|
|
22
|
+
} = options;
|
|
21
23
|
data.set('entities', JSON.stringify(entities));
|
|
22
24
|
data.set('sections', JSON.stringify(sections));
|
|
23
25
|
data.set('notificationTypes', JSON.stringify(notificationTypes));
|
|
24
|
-
|
|
26
|
+
const fetchOptions = {
|
|
25
27
|
method: 'POST',
|
|
26
28
|
body: data
|
|
27
29
|
};
|
|
28
|
-
return merchi.authenticatedFetch(resource, fetchOptions).then(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
};
|
|
30
|
+
return merchi.authenticatedFetch(resource, fetchOptions).then(data => data.notifications.map(n => new merchi.Notification().fromJson(n)));
|
|
31
|
+
};
|
|
32
|
+
exports.toastNotifications = toastNotifications;
|
|
@@ -4,27 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.kahanSum = kahanSum;
|
|
7
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
8
|
-
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); }
|
|
9
|
-
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; }
|
|
10
7
|
function kahanSum(values) {
|
|
11
8
|
/* Return the kahan summation of the input number array */
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var y = value - compensation;
|
|
20
|
-
var t = accumulator + y;
|
|
21
|
-
compensation = t - accumulator - y;
|
|
22
|
-
accumulator = t;
|
|
23
|
-
}
|
|
24
|
-
} catch (err) {
|
|
25
|
-
_iterator.e(err);
|
|
26
|
-
} finally {
|
|
27
|
-
_iterator.f();
|
|
9
|
+
let accumulator = 0;
|
|
10
|
+
let compensation = 0;
|
|
11
|
+
for (const value of values) {
|
|
12
|
+
const y = value - compensation;
|
|
13
|
+
const t = accumulator + y;
|
|
14
|
+
compensation = t - accumulator - y;
|
|
15
|
+
accumulator = t;
|
|
28
16
|
}
|
|
29
17
|
return accumulator;
|
|
30
18
|
}
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getQueryStringValue = getQueryStringValue;
|
|
7
7
|
function getQueryStringValue(name) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
for (
|
|
11
|
-
|
|
8
|
+
const query = window.location.search.substring(1);
|
|
9
|
+
const vars = query.split('&');
|
|
10
|
+
for (let i = 0; i < vars.length; i++) {
|
|
11
|
+
const pair = vars[i].split('=');
|
|
12
12
|
if (pair[0] === name) {
|
|
13
13
|
return decodeURIComponent(pair[1]);
|
|
14
14
|
}
|
|
@@ -4,6 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isUndefinedOrNull = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
7
|
+
const isUndefinedOrNull = value => value === undefined || value === null;
|
|
8
|
+
exports.isUndefinedOrNull = isUndefinedOrNull;
|
package/lib/MerchiSDK/uuid.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.generateUUID = generateUUID;
|
|
7
7
|
function generateUUID() {
|
|
8
|
-
|
|
8
|
+
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
9
9
|
uuid = uuid.replace(/[xy]/g, function (c) {
|
|
10
|
-
|
|
10
|
+
const r = Math.random() * 16 % 16 | 0;
|
|
11
11
|
return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
|
|
12
12
|
});
|
|
13
13
|
return uuid;
|
package/lib/buttons/Button.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
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 = Button;
|
|
8
7
|
var React = _interopRequireWildcard(require("react"));
|
|
9
8
|
var _CartProvider = require("../CartProvider");
|
|
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 Button(_ref) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
className =
|
|
17
|
-
disabled
|
|
18
|
-
form
|
|
19
|
-
onClick
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
classNameBtn
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
className = '',
|
|
16
|
+
disabled,
|
|
17
|
+
form,
|
|
18
|
+
onClick,
|
|
19
|
+
type = 'button'
|
|
20
|
+
} = _ref;
|
|
21
|
+
const {
|
|
22
|
+
classNameBtn
|
|
23
|
+
} = (0, _CartProvider.useCartContext)();
|
|
24
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
25
|
-
className:
|
|
25
|
+
className: `${classNameBtn} ${className}`,
|
|
26
26
|
disabled: disabled,
|
|
27
27
|
form: form,
|
|
28
28
|
onClick: onClick,
|
|
@@ -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 _CartProvider = require("../CartProvider");
|
|
@@ -13,35 +12,33 @@ var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
|
13
12
|
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
14
13
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
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 ButtonBack(_ref) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
let {
|
|
20
|
+
text
|
|
21
|
+
} = _ref;
|
|
22
|
+
const {
|
|
23
|
+
classNameBtnBack,
|
|
24
|
+
onClickClose
|
|
25
|
+
} = (0, _CartProvider.useCartContext)();
|
|
26
|
+
const {
|
|
27
|
+
activeTab,
|
|
28
|
+
tabs
|
|
29
|
+
} = (0, _reactRedux.useSelector)(s => s.stateCart);
|
|
30
|
+
const currentTabIndex = tabs.findIndex(t => t.tabId === activeTab);
|
|
31
|
+
let nextTab = null;
|
|
33
32
|
if (currentTabIndex > 0) {
|
|
34
33
|
nextTab = tabs[currentTabIndex - 1];
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button
|
|
35
|
+
const nextTabId = nextTab ? nextTab.tabId : 0;
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Button.default, {
|
|
38
37
|
className: classNameBtnBack,
|
|
39
|
-
onClick: activeTab === 0 ? onClickClose :
|
|
40
|
-
return (0, _store.setActiveTab)(nextTabId);
|
|
41
|
-
},
|
|
38
|
+
onClick: activeTab === 0 ? onClickClose : () => (0, _store.setActiveTab)(nextTabId),
|
|
42
39
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactFontawesome.FontAwesomeIcon, {
|
|
43
40
|
icon: _freeSolidSvgIcons.faArrowLeft
|
|
44
|
-
}), text ?
|
|
41
|
+
}), text ? ` ${text}` : '']
|
|
45
42
|
});
|
|
46
43
|
}
|
|
47
|
-
var _default = exports
|
|
44
|
+
var _default = exports.default = ButtonBack;
|
|
@@ -3,22 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _CartProvider = require("../CartProvider");
|
|
8
8
|
var _sliceCart = require("../slices/sliceCart");
|
|
9
9
|
var _store = require("../store");
|
|
10
10
|
var _Button = _interopRequireDefault(require("./Button"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function ButtonClearCart() {
|
|
14
|
-
|
|
15
|
-
classNameBtnCartClear
|
|
16
|
-
|
|
14
|
+
const {
|
|
15
|
+
classNameBtnCartClear
|
|
16
|
+
} = (0, _CartProvider.useCartContext)();
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
17
18
|
className: classNameBtnCartClear,
|
|
18
|
-
onClick:
|
|
19
|
-
return (0, _store.setActiveTab)(_sliceCart.tabIdClearCart);
|
|
20
|
-
},
|
|
19
|
+
onClick: () => (0, _store.setActiveTab)(_sliceCart.tabIdClearCart),
|
|
21
20
|
children: "Clear cart"
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
|
-
var _default = exports
|
|
23
|
+
var _default = exports.default = ButtonClearCart;
|