ordering-ui-external 10.4.0 → 10.5.0
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/_bundles/{0.ordering-ui.487a31b3537d90f69a9d.js → 0.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{1.ordering-ui.487a31b3537d90f69a9d.js → 1.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{2.ordering-ui.487a31b3537d90f69a9d.js → 2.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{4.ordering-ui.487a31b3537d90f69a9d.js → 4.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{5.ordering-ui.487a31b3537d90f69a9d.js → 5.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{6.ordering-ui.487a31b3537d90f69a9d.js → 6.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{7.ordering-ui.487a31b3537d90f69a9d.js → 7.ordering-ui.cc1d13aa04732fde3671.js} +2 -2
- package/_bundles/{8.ordering-ui.487a31b3537d90f69a9d.js → 8.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/{9.ordering-ui.487a31b3537d90f69a9d.js → 9.ordering-ui.cc1d13aa04732fde3671.js} +1 -1
- package/_bundles/ordering-ui.cc1d13aa04732fde3671.js +2 -0
- package/_modules/themes/callcenterOriginal/src/components/Orders/DeliveriesManager/index.js +4 -2
- package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersDashboardControls/index.js +3 -1
- package/_modules/themes/callcenterOriginal/src/components/Orders/OrdersManager/index.js +2 -0
- package/_modules/themes/five/src/components/BusinessItemAccordion/index.js +5 -2
- package/_modules/themes/five/src/components/BusinessItemAccordion/styles.js +25 -19
- package/_modules/themes/five/src/components/BusinessProductsList/index.js +35 -13
- package/_modules/themes/five/src/components/BusinessProductsList/styles.js +7 -3
- package/_modules/themes/five/src/components/BusinessProductsListing/index.js +2 -0
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +133 -31
- package/_modules/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +37 -3
- package/_modules/themes/five/src/components/Cart/index.js +10 -6
- package/_modules/themes/five/src/components/Checkout/index.js +67 -22
- package/_modules/themes/five/src/components/GiftCard/GiftCardOrdersList/index.js +53 -0
- package/_modules/themes/five/src/components/GiftCard/GiftCardOrdersList/styles.js +16 -0
- package/_modules/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/index.js +69 -0
- package/_modules/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/styles.js +16 -0
- package/_modules/themes/five/src/components/GiftCard/SingleGiftCard/index.js +90 -0
- package/_modules/themes/five/src/components/GiftCard/SingleGiftCard/styles.js +43 -0
- package/_modules/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.js +75 -0
- package/_modules/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.js +19 -0
- package/_modules/themes/five/src/components/MyOrders/index.js +6 -1
- package/_modules/themes/five/src/components/OrderProgress/index.js +1 -1
- package/_modules/themes/five/src/components/OrdersOption/index.js +1 -0
- package/_modules/themes/five/src/components/PhoneAutocomplete/index.js +165 -31
- package/_modules/themes/five/src/components/PhoneAutocomplete/styles.js +53 -9
- package/_modules/themes/five/src/components/ProductForm/index.js +1 -0
- package/_modules/themes/five/src/components/RenderProductsLayout/index.js +3 -2
- package/_modules/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
- package/_modules/themes/five/src/components/UserFormDetails/index.js +5 -17
- package/_modules/themes/five/src/components/UserFormDetails/styles.js +3 -7
- package/index-template.js +9 -1
- package/package.json +2 -2
- package/src/themes/callcenterOriginal/src/components/Orders/DeliveriesManager/index.js +3 -1
- package/src/themes/callcenterOriginal/src/components/Orders/OrdersDashboardControls/index.js +5 -1
- package/src/themes/callcenterOriginal/src/components/Orders/OrdersManager/index.js +2 -0
- package/src/themes/five/src/components/BusinessItemAccordion/index.js +2 -2
- package/src/themes/five/src/components/BusinessItemAccordion/styles.js +8 -7
- package/src/themes/five/src/components/BusinessProductsList/index.js +36 -3
- package/src/themes/five/src/components/BusinessProductsList/styles.js +20 -0
- package/src/themes/five/src/components/BusinessProductsListing/index.js +2 -0
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/index.js +156 -36
- package/src/themes/five/src/components/BusinessesListing/layouts/OriginalBusinessesListing/styles.js +66 -0
- package/src/themes/five/src/components/Cart/index.js +7 -4
- package/src/themes/five/src/components/Checkout/index.js +61 -35
- package/src/themes/five/src/components/GiftCard/GiftCardOrdersList/index.js +50 -0
- package/src/themes/five/src/components/GiftCard/GiftCardOrdersList/styles.js +34 -0
- package/src/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/index.js +75 -0
- package/src/themes/five/src/components/GiftCard/HorizontalGiftCardOrdersLayout/styles.js +29 -0
- package/src/themes/five/src/components/GiftCard/SingleGiftCard/index.js +79 -0
- package/src/themes/five/src/components/GiftCard/SingleGiftCard/styles.js +79 -0
- package/src/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.js +72 -0
- package/src/themes/five/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.js +31 -0
- package/src/themes/five/src/components/MyOrders/index.js +6 -1
- package/src/themes/five/src/components/OrderProgress/index.js +1 -1
- package/src/themes/five/src/components/OrdersOption/index.js +1 -0
- package/src/themes/five/src/components/PhoneAutocomplete/index.js +195 -46
- package/src/themes/five/src/components/PhoneAutocomplete/styles.js +106 -10
- package/src/themes/five/src/components/ProductForm/index.js +1 -0
- package/src/themes/five/src/components/RenderProductsLayout/index.js +1 -0
- package/src/themes/five/src/components/SingleProductCard/layouts/original/styles.js +1 -1
- package/src/themes/five/src/components/UserFormDetails/index.js +6 -27
- package/src/themes/five/src/components/UserFormDetails/styles.js +0 -16
- package/template/assets/images/delivery.svg +11 -0
- package/template/assets/images/phone-hero-callcenter.png +0 -0
- package/template/assets/images/phone.svg +11 -0
- package/template/assets/images/pickup.svg +17 -0
- package/template/pages/BusinessProductsList/index.js +2 -1
- package/_bundles/ordering-ui.487a31b3537d90f69a9d.js +0 -2
- /package/_bundles/{7.ordering-ui.487a31b3537d90f69a9d.js.LICENSE.txt → 7.ordering-ui.cc1d13aa04732fde3671.js.LICENSE.txt} +0 -0
- /package/_bundles/{ordering-ui.487a31b3537d90f69a9d.js.LICENSE.txt → ordering-ui.cc1d13aa04732fde3671.js.LICENSE.txt} +0 -0
|
@@ -62,7 +62,7 @@ var mapConfigs = {
|
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
var CheckoutUI = function CheckoutUI(props) {
|
|
65
|
-
var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _theme$header, _validationFields$fie, _validationFields$fie2, _cart$comment, _validationFields$fie3, _validationFields$fie4, _paymethodSelected$da, _paymethodSelected$da2, _cardList$cards, _cartState$cart,
|
|
65
|
+
var _businessDetails$busi, _businessDetails$busi2, _configs$table_numer_, _businessConfigs$find, _businessConfigs$find2, _configs$cash_wallet, _configs$wallet_enabl, _theme$header, _checkoutFieldsState$, _validationFields$fie, _validationFields$fie2, _cart$comment, _validationFields$fie3, _validationFields$fie4, _validationFields$fie5, _validationFields$fie6, _paymethodSelected$da, _paymethodSelected$da2, _cardList$cards, _cartState$cart, _configs$driver_tip_o, _configs$driver_tip_o2, _configs$driver_tip_o3, _instructionsOptions$, _theme$checkout, _theme$checkout2, _theme$checkout3, _theme$checkout4, _validationFields$fie7, _loyaltyPlansState$re, _creditPointPlan$busi, _options$address, _businessDetails$busi3, _theme$images, _configs$google_maps_, _customerState$user, _customerState$user2, _Object$values, _businessDetails$busi4, _businessDetails$busi5, _businessDetails$busi6, _businessDetails$busi7, _businessDetails$busi8, _businessDetails$busi9, _businessDetails$erro, _businessDetails$erro2, _businessDetails$busi10, _businessDetails$busi11, _businessDetails$busi12, _configs$driver_tip_t, _configs$driver_tip_u, _configs$driver_tip_t2, _cartState$cart$spot_, _cartState$cart2, _cart$business2, _cart$products2, _ref, _creditPointPlanOnBus, _configs$driver_tip_t3, _configs$driver_tip_u2, _configs$driver_tip_t4, _customerState$user3;
|
|
66
66
|
var cart = props.cart,
|
|
67
67
|
errors = props.errors,
|
|
68
68
|
placing = props.placing,
|
|
@@ -83,7 +83,8 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
83
83
|
handleStoreRedirect = props.handleStoreRedirect,
|
|
84
84
|
onPlaceOrderClick = props.onPlaceOrderClick,
|
|
85
85
|
setPlaceSpotNumber = props.setPlaceSpotNumber,
|
|
86
|
-
placeSpotNumber = props.placeSpotNumber
|
|
86
|
+
placeSpotNumber = props.placeSpotNumber,
|
|
87
|
+
checkoutFieldsState = props.checkoutFieldsState;
|
|
87
88
|
var theme = (0, _styledComponents.useTheme)();
|
|
88
89
|
var _useValidationFields = (0, _orderingComponentsExternal.useValidationFields)(),
|
|
89
90
|
_useValidationFields2 = _slicedToArray(_useValidationFields, 1),
|
|
@@ -183,16 +184,36 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
183
184
|
})) === null || _businessConfigs$find2 === void 0 ? void 0 : _businessConfigs$find2.value) === '1';
|
|
184
185
|
var isWalletEnabled = (configs === null || configs === void 0 || (_configs$cash_wallet = configs.cash_wallet) === null || _configs$cash_wallet === void 0 ? void 0 : _configs$cash_wallet.value) && (configs === null || configs === void 0 || (_configs$wallet_enabl = configs.wallet_enabled) === null || _configs$wallet_enabl === void 0 ? void 0 : _configs$wallet_enabl.value) === '1' && (isWalletCashEnabled || isWalletCreditPointsEnabled) && !useKioskApp && !isCustomerMode;
|
|
185
186
|
var isMultiDriverTips = (theme === null || theme === void 0 || (_theme$header = theme.header) === null || _theme$header === void 0 || (_theme$header = _theme$header.components) === null || _theme$header === void 0 || (_theme$header = _theme$header.layout) === null || _theme$header === void 0 || (_theme$header = _theme$header.type) === null || _theme$header === void 0 ? void 0 : _theme$header.toLowerCase()) === 'chew';
|
|
187
|
+
var notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments'];
|
|
186
188
|
var placeSpotTypes = [3, 4, 5];
|
|
187
189
|
var placeSpotsEnabled = placeSpotTypes.includes(options === null || options === void 0 ? void 0 : options.type) && !useKioskApp;
|
|
188
190
|
var isGiftCardCart = !(cart !== null && cart !== void 0 && cart.business_id);
|
|
191
|
+
var guestCheckoutDriveTip = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$ = checkoutFieldsState.fields) === null || _checkoutFieldsState$ === void 0 ? void 0 : _checkoutFieldsState$.find(function (field) {
|
|
192
|
+
var _field$validation_fie;
|
|
193
|
+
return field.order_type_id === 1 && (field === null || field === void 0 || (_field$validation_fie = field.validation_field) === null || _field$validation_fie === void 0 ? void 0 : _field$validation_fie.code) === 'driver_tip';
|
|
194
|
+
});
|
|
195
|
+
var guestCheckoutComment = (0, _react.useMemo)(function () {
|
|
196
|
+
var _checkoutFieldsState$2;
|
|
197
|
+
return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$2 = checkoutFieldsState.fields) === null || _checkoutFieldsState$2 === void 0 ? void 0 : _checkoutFieldsState$2.find(function (field) {
|
|
198
|
+
var _field$validation_fie2;
|
|
199
|
+
return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie2 = field.validation_field) === null || _field$validation_fie2 === void 0 ? void 0 : _field$validation_fie2.code) === 'comments';
|
|
200
|
+
});
|
|
201
|
+
}, [checkoutFieldsState, options]);
|
|
202
|
+
var guestCheckoutCupon = (0, _react.useMemo)(function () {
|
|
203
|
+
var _checkoutFieldsState$3;
|
|
204
|
+
return checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$3 = checkoutFieldsState.fields) === null || _checkoutFieldsState$3 === void 0 ? void 0 : _checkoutFieldsState$3.find(function (field) {
|
|
205
|
+
var _field$validation_fie3;
|
|
206
|
+
return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie3 = field.validation_field) === null || _field$validation_fie3 === void 0 ? void 0 : _field$validation_fie3.code) === 'coupon';
|
|
207
|
+
});
|
|
208
|
+
}, [checkoutFieldsState, options]);
|
|
189
209
|
// const [hasBusinessPlaces, setHasBusinessPlaces] = useState(null)
|
|
190
210
|
|
|
191
|
-
var validateCommentsCartField = (validationFields === null || validationFields === void 0 || (_validationFields$fie = validationFields.fields) === null || _validationFields$fie === void 0 || (_validationFields$fie = _validationFields$fie.checkout) === null || _validationFields$fie === void 0 || (_validationFields$fie = _validationFields$fie.comments) === null || _validationFields$fie === void 0 ? void 0 : _validationFields$fie.enabled) && (validationFields === null || validationFields === void 0 || (_validationFields$fie2 = validationFields.fields) === null || _validationFields$fie2 === void 0 || (_validationFields$fie2 = _validationFields$fie2.checkout) === null || _validationFields$fie2 === void 0 || (_validationFields$fie2 = _validationFields$fie2.comments) === null || _validationFields$fie2 === void 0 ? void 0 : _validationFields$fie2.required) && ((cart === null || cart === void 0 ? void 0 : cart.comment) === null || (cart === null || cart === void 0 || (_cart$comment = cart.comment) === null || _cart$comment === void 0 ? void 0 : _cart$comment.trim().length) === 0);
|
|
192
|
-
var
|
|
211
|
+
var validateCommentsCartField = (!(user !== null && user !== void 0 && user.guest_id) ? (validationFields === null || validationFields === void 0 || (_validationFields$fie = validationFields.fields) === null || _validationFields$fie === void 0 || (_validationFields$fie = _validationFields$fie.checkout) === null || _validationFields$fie === void 0 || (_validationFields$fie = _validationFields$fie.comments) === null || _validationFields$fie === void 0 ? void 0 : _validationFields$fie.enabled) && (validationFields === null || validationFields === void 0 || (_validationFields$fie2 = validationFields.fields) === null || _validationFields$fie2 === void 0 || (_validationFields$fie2 = _validationFields$fie2.checkout) === null || _validationFields$fie2 === void 0 || (_validationFields$fie2 = _validationFields$fie2.comments) === null || _validationFields$fie2 === void 0 ? void 0 : _validationFields$fie2.required) : (guestCheckoutComment === null || guestCheckoutComment === void 0 ? void 0 : guestCheckoutComment.enabled) && (guestCheckoutComment === null || guestCheckoutComment === void 0 ? void 0 : guestCheckoutComment.required)) && ((cart === null || cart === void 0 ? void 0 : cart.comment) === null || (cart === null || cart === void 0 || (_cart$comment = cart.comment) === null || _cart$comment === void 0 ? void 0 : _cart$comment.trim().length) === 0);
|
|
212
|
+
var validateDriverTipField = options.type === 1 && (!(user !== null && user !== void 0 && user.guest_id) ? (validationFields === null || validationFields === void 0 || (_validationFields$fie3 = validationFields.fields) === null || _validationFields$fie3 === void 0 || (_validationFields$fie3 = _validationFields$fie3.checkout) === null || _validationFields$fie3 === void 0 || (_validationFields$fie3 = _validationFields$fie3.driver_tip) === null || _validationFields$fie3 === void 0 ? void 0 : _validationFields$fie3.enabled) && (validationFields === null || validationFields === void 0 || (_validationFields$fie4 = validationFields.fields) === null || _validationFields$fie4 === void 0 || (_validationFields$fie4 = _validationFields$fie4.checkout) === null || _validationFields$fie4 === void 0 || (_validationFields$fie4 = _validationFields$fie4.driver_tip) === null || _validationFields$fie4 === void 0 ? void 0 : _validationFields$fie4.required) : (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.enabled) && (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.required)) && Number(cart === null || cart === void 0 ? void 0 : cart.driver_tip) <= 0;
|
|
213
|
+
var validateZipcodeCard = (validationFields === null || validationFields === void 0 || (_validationFields$fie5 = validationFields.fields) === null || _validationFields$fie5 === void 0 || (_validationFields$fie5 = _validationFields$fie5.card) === null || _validationFields$fie5 === void 0 || (_validationFields$fie5 = _validationFields$fie5.zipcode) === null || _validationFields$fie5 === void 0 ? void 0 : _validationFields$fie5.enabled) && (validationFields === null || validationFields === void 0 || (_validationFields$fie6 = validationFields.fields) === null || _validationFields$fie6 === void 0 || (_validationFields$fie6 = _validationFields$fie6.card) === null || _validationFields$fie6 === void 0 || (_validationFields$fie6 = _validationFields$fie6.zipcode) === null || _validationFields$fie6 === void 0 ? void 0 : _validationFields$fie6.required) && (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) === 'stripe' && (paymethodSelected === null || paymethodSelected === void 0 || (_paymethodSelected$da = paymethodSelected.data) === null || _paymethodSelected$da === void 0 ? void 0 : _paymethodSelected$da.card) && !(paymethodSelected !== null && paymethodSelected !== void 0 && (_paymethodSelected$da2 = paymethodSelected.data) !== null && _paymethodSelected$da2 !== void 0 && (_paymethodSelected$da2 = _paymethodSelected$da2.card) !== null && _paymethodSelected$da2 !== void 0 && _paymethodSelected$da2.zipcode);
|
|
193
214
|
var isDisablePlaceOrderButton = !(cart !== null && cart !== void 0 && cart.valid) || !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 || cardsMethods.includes(paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) && (cardList === null || cardList === void 0 || (_cardList$cards = cardList.cards) === null || _cardList$cards === void 0 ? void 0 : _cardList$cards.length) === 0 || placing || errorCash || loading || isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cartState !== null && cartState !== void 0 && (_cartState$cart = cartState.cart) !== null && _cartState$cart !== void 0 && _cartState$cart.spot_number || cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) || !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ||
|
|
194
215
|
// (((placeSpotTypes.includes(options?.type) && !cart?.place) && hasBusinessPlaces)) ||
|
|
195
|
-
|
|
216
|
+
validateDriverTipField && !isGiftCardCart || validateCommentsCartField || validateZipcodeCard;
|
|
196
217
|
var driverTipsOptions = typeof (configs === null || configs === void 0 || (_configs$driver_tip_o = configs.driver_tip_options) === null || _configs$driver_tip_o === void 0 ? void 0 : _configs$driver_tip_o.value) === 'string' ? JSON.parse(configs === null || configs === void 0 || (_configs$driver_tip_o2 = configs.driver_tip_options) === null || _configs$driver_tip_o2 === void 0 ? void 0 : _configs$driver_tip_o2.value) || [] : (configs === null || configs === void 0 || (_configs$driver_tip_o3 = configs.driver_tip_options) === null || _configs$driver_tip_o3 === void 0 ? void 0 : _configs$driver_tip_o3.value) || [];
|
|
197
218
|
var deliveryOptions = (instructionsOptions === null || instructionsOptions === void 0 ? void 0 : instructionsOptions.result) && Array.isArray(instructionsOptions === null || instructionsOptions === void 0 ? void 0 : instructionsOptions.result) && (instructionsOptions === null || instructionsOptions === void 0 || (_instructionsOptions$ = instructionsOptions.result) === null || _instructionsOptions$ === void 0 || (_instructionsOptions$ = _instructionsOptions$.filter(function (option) {
|
|
198
219
|
return option === null || option === void 0 ? void 0 : option.enabled;
|
|
@@ -207,7 +228,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
207
228
|
var hideBusinessDetails = theme === null || theme === void 0 || (_theme$checkout2 = theme.checkout) === null || _theme$checkout2 === void 0 || (_theme$checkout2 = _theme$checkout2.components) === null || _theme$checkout2 === void 0 || (_theme$checkout2 = _theme$checkout2.business) === null || _theme$checkout2 === void 0 ? void 0 : _theme$checkout2.hidden;
|
|
208
229
|
var hideBusinessMap = theme === null || theme === void 0 || (_theme$checkout3 = theme.checkout) === null || _theme$checkout3 === void 0 || (_theme$checkout3 = _theme$checkout3.components) === null || _theme$checkout3 === void 0 || (_theme$checkout3 = _theme$checkout3.map) === null || _theme$checkout3 === void 0 ? void 0 : _theme$checkout3.hidden;
|
|
209
230
|
var hideCustomerDetails = theme === null || theme === void 0 || (_theme$checkout4 = theme.checkout) === null || _theme$checkout4 === void 0 || (_theme$checkout4 = _theme$checkout4.components) === null || _theme$checkout4 === void 0 || (_theme$checkout4 = _theme$checkout4.customer) === null || _theme$checkout4 === void 0 ? void 0 : _theme$checkout4.hidden;
|
|
210
|
-
var driverTipsField = !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && options.type === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (validationFields === null || validationFields === void 0 || (_validationFields$fie7 = validationFields.fields) === null || _validationFields$fie7 === void 0 || (_validationFields$fie7 = _validationFields$fie7.checkout) === null || _validationFields$fie7 === void 0 || (_validationFields$fie7 = _validationFields$fie7.driver_tip) === null || _validationFields$fie7 === void 0 ? void 0 : _validationFields$fie7.enabled) && driverTipsOptions.length > 0 && !useKioskApp;
|
|
231
|
+
var driverTipsField = !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.business_id) && options.type === 1 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && (!(user !== null && user !== void 0 && user.guest_id) && (validationFields === null || validationFields === void 0 || (_validationFields$fie7 = validationFields.fields) === null || _validationFields$fie7 === void 0 || (_validationFields$fie7 = _validationFields$fie7.checkout) === null || _validationFields$fie7 === void 0 || (_validationFields$fie7 = _validationFields$fie7.driver_tip) === null || _validationFields$fie7 === void 0 ? void 0 : _validationFields$fie7.enabled) || (user === null || user === void 0 ? void 0 : user.guest_id) && (guestCheckoutDriveTip === null || guestCheckoutDriveTip === void 0 ? void 0 : guestCheckoutDriveTip.enabled)) && driverTipsOptions.length > 0 && !useKioskApp;
|
|
211
232
|
var creditPointPlan = loyaltyPlansState === null || loyaltyPlansState === void 0 || (_loyaltyPlansState$re = loyaltyPlansState.result) === null || _loyaltyPlansState$re === void 0 ? void 0 : _loyaltyPlansState$re.find(function (loyal) {
|
|
212
233
|
return loyal.type === 'credit_point';
|
|
213
234
|
});
|
|
@@ -223,7 +244,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
223
244
|
}));
|
|
224
245
|
return;
|
|
225
246
|
}
|
|
226
|
-
if (!userErrors.length &&
|
|
247
|
+
if (!userErrors.length && !(requiredFields !== null && requiredFields !== void 0 && requiredFields.length)) {
|
|
227
248
|
var body = {};
|
|
228
249
|
if (behalfName) {
|
|
229
250
|
body.on_behalf_of = behalfName;
|
|
@@ -258,11 +279,29 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
258
279
|
});
|
|
259
280
|
setIsUserDetailsEdit(false);
|
|
260
281
|
};
|
|
282
|
+
var checkGuestValidationFields = function checkGuestValidationFields() {
|
|
283
|
+
var _checkoutFieldsState$4, _configs$verification;
|
|
284
|
+
var userSelected = isCustomerMode ? customerState.user : user;
|
|
285
|
+
var _requiredFields = checkoutFieldsState === null || checkoutFieldsState === void 0 ? void 0 : checkoutFieldsState.fields.filter(function (field) {
|
|
286
|
+
var _field$validation_fie4, _field$validation_fie5;
|
|
287
|
+
return (field === null || field === void 0 ? void 0 : field.order_type_id) === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 ? void 0 : field.enabled) && (field === null || field === void 0 ? void 0 : field.required) && !notFields.includes(field === null || field === void 0 || (_field$validation_fie4 = field.validation_field) === null || _field$validation_fie4 === void 0 ? void 0 : _field$validation_fie4.code) && userSelected && !userSelected[field === null || field === void 0 || (_field$validation_fie5 = field.validation_field) === null || _field$validation_fie5 === void 0 ? void 0 : _field$validation_fie5.code];
|
|
288
|
+
}).map(function (item) {
|
|
289
|
+
var _item$validation_fiel;
|
|
290
|
+
return item === null || item === void 0 || (_item$validation_fiel = item.validation_field) === null || _item$validation_fiel === void 0 ? void 0 : _item$validation_fiel.code;
|
|
291
|
+
});
|
|
292
|
+
var guestCheckoutCellPhone = checkoutFieldsState === null || checkoutFieldsState === void 0 || (_checkoutFieldsState$4 = checkoutFieldsState.fields) === null || _checkoutFieldsState$4 === void 0 ? void 0 : _checkoutFieldsState$4.find(function (field) {
|
|
293
|
+
var _field$validation_fie6;
|
|
294
|
+
return field.order_type_id === (options === null || options === void 0 ? void 0 : options.type) && (field === null || field === void 0 || (_field$validation_fie6 = field.validation_field) === null || _field$validation_fie6 === void 0 ? void 0 : _field$validation_fie6.code) === 'mobile_phone';
|
|
295
|
+
});
|
|
296
|
+
if (userSelected && !(userSelected !== null && userSelected !== void 0 && userSelected.cellphone) && (guestCheckoutCellPhone !== null && guestCheckoutCellPhone !== void 0 && guestCheckoutCellPhone.enabled && guestCheckoutCellPhone !== null && guestCheckoutCellPhone !== void 0 && guestCheckoutCellPhone.required || (configs === null || configs === void 0 || (_configs$verification = configs.verification_phone_required) === null || _configs$verification === void 0 ? void 0 : _configs$verification.value) === '1')) {
|
|
297
|
+
_requiredFields.push('cellphone');
|
|
298
|
+
}
|
|
299
|
+
setRequiredFields(_requiredFields);
|
|
300
|
+
};
|
|
261
301
|
var checkValidationFields = function checkValidationFields() {
|
|
262
|
-
var _validationFields$fie8, _validationFields$fie9, _validationFields$fie10, _configs$
|
|
302
|
+
var _validationFields$fie8, _validationFields$fie9, _validationFields$fie10, _configs$verification2;
|
|
263
303
|
setUserErrors([]);
|
|
264
304
|
var errors = [];
|
|
265
|
-
var notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments'];
|
|
266
305
|
var userSelected = isCustomerMode ? customerState.user : user;
|
|
267
306
|
var _requiredFields = [];
|
|
268
307
|
Object.values(validationFields === null || validationFields === void 0 || (_validationFields$fie8 = validationFields.fields) === null || _validationFields$fie8 === void 0 ? void 0 : _validationFields$fie8.checkout).map(function (field) {
|
|
@@ -272,7 +311,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
272
311
|
}
|
|
273
312
|
}
|
|
274
313
|
});
|
|
275
|
-
if (userSelected && !(userSelected !== null && userSelected !== void 0 && userSelected.cellphone) && (validationFields !== null && validationFields !== void 0 && (_validationFields$fie9 = validationFields.fields) !== null && _validationFields$fie9 !== void 0 && (_validationFields$fie9 = _validationFields$fie9.checkout) !== null && _validationFields$fie9 !== void 0 && (_validationFields$fie9 = _validationFields$fie9.cellphone) !== null && _validationFields$fie9 !== void 0 && _validationFields$fie9.enabled && validationFields !== null && validationFields !== void 0 && (_validationFields$fie10 = validationFields.fields) !== null && _validationFields$fie10 !== void 0 && (_validationFields$fie10 = _validationFields$fie10.checkout) !== null && _validationFields$fie10 !== void 0 && (_validationFields$fie10 = _validationFields$fie10.cellphone) !== null && _validationFields$fie10 !== void 0 && _validationFields$fie10.required || (configs === null || configs === void 0 || (_configs$
|
|
314
|
+
if (userSelected && !(userSelected !== null && userSelected !== void 0 && userSelected.cellphone) && (validationFields !== null && validationFields !== void 0 && (_validationFields$fie9 = validationFields.fields) !== null && _validationFields$fie9 !== void 0 && (_validationFields$fie9 = _validationFields$fie9.checkout) !== null && _validationFields$fie9 !== void 0 && (_validationFields$fie9 = _validationFields$fie9.cellphone) !== null && _validationFields$fie9 !== void 0 && _validationFields$fie9.enabled && validationFields !== null && validationFields !== void 0 && (_validationFields$fie10 = validationFields.fields) !== null && _validationFields$fie10 !== void 0 && (_validationFields$fie10 = _validationFields$fie10.checkout) !== null && _validationFields$fie10 !== void 0 && (_validationFields$fie10 = _validationFields$fie10.cellphone) !== null && _validationFields$fie10 !== void 0 && _validationFields$fie10.required || (configs === null || configs === void 0 || (_configs$verification2 = configs.verification_phone_required) === null || _configs$verification2 === void 0 ? void 0 : _configs$verification2.value) === '1')) {
|
|
276
315
|
_requiredFields.push('cellphone');
|
|
277
316
|
}
|
|
278
317
|
setRequiredFields(_requiredFields);
|
|
@@ -318,6 +357,10 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
318
357
|
checkValidationFields();
|
|
319
358
|
}
|
|
320
359
|
}, [validationFields, user, customerState]);
|
|
360
|
+
(0, _react.useEffect)(function () {
|
|
361
|
+
if (checkoutFieldsState !== null && checkoutFieldsState !== void 0 && checkoutFieldsState.loading || !(user !== null && user !== void 0 && user.guest_id) || customerState.loading || userLoading) return;
|
|
362
|
+
checkGuestValidationFields();
|
|
363
|
+
}, [user, checkoutFieldsState, customerState]);
|
|
321
364
|
(0, _react.useEffect)(function () {
|
|
322
365
|
if (errors) {
|
|
323
366
|
setAlertState({
|
|
@@ -334,17 +377,17 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
334
377
|
}
|
|
335
378
|
}, [isResetPaymethod]);
|
|
336
379
|
(0, _react.useEffect)(function () {
|
|
337
|
-
var _cart$products
|
|
380
|
+
var _cart$products;
|
|
338
381
|
if (cart !== null && cart !== void 0 && (_cart$products = cart.products) !== null && _cart$products !== void 0 && _cart$products.length) return;
|
|
339
|
-
if (cart
|
|
340
|
-
var _cart$
|
|
341
|
-
handleStoreRedirect(cart === null || cart === void 0 || (_cart$
|
|
382
|
+
if ((cart === null || cart === void 0 ? void 0 : cart.business_id) !== null) {
|
|
383
|
+
var _cart$business;
|
|
384
|
+
handleStoreRedirect(cart === null || cart === void 0 || (_cart$business = cart.business) === null || _cart$business === void 0 ? void 0 : _cart$business.slug);
|
|
342
385
|
} else {
|
|
343
386
|
events.emit('go_to_page', {
|
|
344
387
|
page: 'wallets'
|
|
345
388
|
});
|
|
346
389
|
}
|
|
347
|
-
}, [cart === null || cart === void 0 ? void 0 : cart.products]);
|
|
390
|
+
}, [JSON.stringify(cart === null || cart === void 0 ? void 0 : cart.products)]);
|
|
348
391
|
(0, _react.useEffect)(function () {
|
|
349
392
|
window.scrollTo(0, 0);
|
|
350
393
|
}, []);
|
|
@@ -531,10 +574,10 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
531
574
|
spotNumberDefault: (_cartState$cart$spot_ = cartState === null || cartState === void 0 || (_cartState$cart2 = cartState.cart) === null || _cartState$cart2 === void 0 ? void 0 : _cartState$cart2.spot_number) !== null && _cartState$cart$spot_ !== void 0 ? _cartState$cart$spot_ : cart === null || cart === void 0 ? void 0 : cart.spot_number,
|
|
532
575
|
vehicleDefault: cart === null || cart === void 0 ? void 0 : cart.vehicle,
|
|
533
576
|
setPlaceSpotNumber: setPlaceSpotNumber
|
|
534
|
-
})), !cartState.loading && cart && /*#__PURE__*/_react.default.createElement(_styles.CartContainer, null, /*#__PURE__*/_react.default.createElement(_styles.CartHeader, null, /*#__PURE__*/_react.default.createElement("h1", null, t('MOBILE_FRONT_YOUR_ORDER', 'Your order')), (cart === null || cart === void 0 || (_cart$
|
|
577
|
+
})), !cartState.loading && cart && /*#__PURE__*/_react.default.createElement(_styles.CartContainer, null, /*#__PURE__*/_react.default.createElement(_styles.CartHeader, null, /*#__PURE__*/_react.default.createElement("h1", null, t('MOBILE_FRONT_YOUR_ORDER', 'Your order')), (cart === null || cart === void 0 || (_cart$business2 = cart.business) === null || _cart$business2 === void 0 ? void 0 : _cart$business2.slug) && /*#__PURE__*/_react.default.createElement("span", {
|
|
535
578
|
onClick: function onClick() {
|
|
536
|
-
var _cart$
|
|
537
|
-
return (cart === null || cart === void 0 || (_cart$
|
|
579
|
+
var _cart$business3, _cart$business4;
|
|
580
|
+
return (cart === null || cart === void 0 || (_cart$business3 = cart.business) === null || _cart$business3 === void 0 ? void 0 : _cart$business3.slug) && handleStoreRedirect && handleStoreRedirect(cart === null || cart === void 0 || (_cart$business4 = cart.business) === null || _cart$business4 === void 0 ? void 0 : _cart$business4.slug);
|
|
538
581
|
}
|
|
539
582
|
}, t('ADD_PRODUCTS', 'Add products'))), /*#__PURE__*/_react.default.createElement(_Cart.Cart, {
|
|
540
583
|
isCartPending: (cart === null || cart === void 0 ? void 0 : cart.status) === 2,
|
|
@@ -544,7 +587,9 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
544
587
|
isProducts: (cart === null || cart === void 0 || (_cart$products2 = cart.products) === null || _cart$products2 === void 0 ? void 0 : _cart$products2.length) || 0,
|
|
545
588
|
viewString: "checkout",
|
|
546
589
|
businessConfigs: businessConfigs,
|
|
547
|
-
loyaltyRewardRate: (_ref = (_creditPointPlanOnBus = creditPointPlanOnBusiness === null || creditPointPlanOnBusiness === void 0 ? void 0 : creditPointPlanOnBusiness.accumulation_rate) !== null && _creditPointPlanOnBus !== void 0 ? _creditPointPlanOnBus : !!creditPointPlanOnBusiness && (creditPointPlan === null || creditPointPlan === void 0 ? void 0 : creditPointPlan.accumulation_rate)) !== null && _ref !== void 0 ? _ref : 0
|
|
590
|
+
loyaltyRewardRate: (_ref = (_creditPointPlanOnBus = creditPointPlanOnBusiness === null || creditPointPlanOnBusiness === void 0 ? void 0 : creditPointPlanOnBusiness.accumulation_rate) !== null && _creditPointPlanOnBus !== void 0 ? _creditPointPlanOnBus : !!creditPointPlanOnBusiness && (creditPointPlan === null || creditPointPlan === void 0 ? void 0 : creditPointPlan.accumulation_rate)) !== null && _ref !== void 0 ? _ref : 0,
|
|
591
|
+
guestCheckoutComment: guestCheckoutComment,
|
|
592
|
+
guestCheckoutCupon: guestCheckoutCupon
|
|
548
593
|
})), !!(isMultiDriverTips && driverTipsField) && /*#__PURE__*/_react.default.createElement(_styles.DriverTipContainer, null, /*#__PURE__*/_react.default.createElement("h1", null, t('DRIVER_TIPS', 'Driver Tips')), /*#__PURE__*/_react.default.createElement("p", null, t('100%_OF_THE_TIP_YOUR_DRIVER', '100% of the tip goes to your driver')), /*#__PURE__*/_react.default.createElement(_DriverTips.DriverTips, {
|
|
549
594
|
businessId: cart === null || cart === void 0 ? void 0 : cart.business_id,
|
|
550
595
|
driverTipsOptions: driverTipsOptions,
|
|
@@ -559,7 +604,7 @@ var CheckoutUI = function CheckoutUI(props) {
|
|
|
559
604
|
onClick: function onClick() {
|
|
560
605
|
return handlePlaceOrder();
|
|
561
606
|
}
|
|
562
|
-
}, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.maximum)) : !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')),
|
|
607
|
+
}, !(cart !== null && cart !== void 0 && cart.valid_maximum) ? "".concat(t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order'), ": ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.maximum)) : !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? "".concat(t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:'), " ").concat(parsePrice(cart === null || cart === void 0 ? void 0 : cart.minimum)) : placing ? t('PLACING', 'Placing') : t('PLACE_ORDER', 'Place Order'))), !(cart !== null && cart !== void 0 && cart.valid_address) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_ADDRESS', 'Selected address is invalid, please select a closer address.')), !paymethodSelected && (cart === null || cart === void 0 ? void 0 : cart.balance) > 0 && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_NOT_PAYMENT_SELECTED', 'Please, select a payment method to place order.')), !(cart !== null && cart !== void 0 && cart.valid_products) && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_PRODUCTS', 'Some products are invalid, please check them.')), isTableNumberEnabled === '1' && (options === null || options === void 0 ? void 0 : options.type) === 3 && !(cart !== null && cart !== void 0 && cart.spot_number || placeSpotNumber) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_PLACE_SPOT', 'Please, select your spot to place order.')), validateDriverTipField && !isGiftCardCart && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')), validateCommentsCartField && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_INVALID_CART_COMMENTS', 'Cart comments is required.')), validateZipcodeCard && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('WARNING_CARD_ZIPCODE_REQUIRED', 'Your card selected has not zipcode')), (cart === null || cart === void 0 ? void 0 : cart.valid_preorder) !== undefined && !(cart !== null && cart !== void 0 && cart.valid_preorder) && /*#__PURE__*/_react.default.createElement(_styles.WarningText, null, t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.'))), windowSize.width < 576 && !cartState.loading && cart && (cart === null || cart === void 0 ? void 0 : cart.status) !== 2 && /*#__PURE__*/_react.default.createElement(_styles.MobileWrapperPlaceOrderButton, null, /*#__PURE__*/_react.default.createElement("span", null, parsePrice(cart === null || cart === void 0 ? void 0 : cart.total)), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
|
|
563
608
|
color: !(cart !== null && cart !== void 0 && cart.valid_maximum) || !(cart !== null && cart !== void 0 && cart.valid_minimum) && !((cart === null || cart === void 0 ? void 0 : cart.discount_type) === 1 && (cart === null || cart === void 0 ? void 0 : cart.discount_rate) === 100) ? 'secundary' : 'primary',
|
|
564
609
|
disabled: isDisablePlaceOrderButton,
|
|
565
610
|
onClick: function onClick() {
|
|
@@ -702,8 +747,8 @@ var Checkout = function Checkout(props) {
|
|
|
702
747
|
return (cart === null || cart === void 0 ? void 0 : cart.products) && (cart === null || cart === void 0 || (_cart$products3 = cart.products) === null || _cart$products3 === void 0 ? void 0 : _cart$products3.length);
|
|
703
748
|
})) || null);
|
|
704
749
|
var carts = businessSlug ? cartsWithProducts.filter(function (cart) {
|
|
705
|
-
var _cart$
|
|
706
|
-
return (cart === null || cart === void 0 || (_cart$
|
|
750
|
+
var _cart$business5;
|
|
751
|
+
return (cart === null || cart === void 0 || (_cart$business5 = cart.business) === null || _cart$business5 === void 0 ? void 0 : _cart$business5.slug) === businessSlug || businessSlug === (cart === null || cart === void 0 ? void 0 : cart.business_id);
|
|
707
752
|
}) : cartsWithProducts;
|
|
708
753
|
var closeAlert = function closeAlert() {
|
|
709
754
|
setAlertState({
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.GiftCardOrdersList = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _orderingComponentsExternal = require("ordering-components-external");
|
|
10
|
+
var _HorizontalGiftCardOrdersLayout = require("../HorizontalGiftCardOrdersLayout");
|
|
11
|
+
var _styles = require("./styles");
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
var GiftCardOrdersList = function GiftCardOrdersList(props) {
|
|
21
|
+
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
22
|
+
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
23
|
+
t = _useLanguage2[1];
|
|
24
|
+
var _useState = (0, _react.useState)(false),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
isEmptyPending = _useState2[0],
|
|
27
|
+
setIsEmptyPending = _useState2[1];
|
|
28
|
+
var _useState3 = (0, _react.useState)(false),
|
|
29
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
+
isEmptySent = _useState4[0],
|
|
31
|
+
setIsEmptySent = _useState4[1];
|
|
32
|
+
var _useState5 = (0, _react.useState)(false),
|
|
33
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
34
|
+
isEmptyRedeemed = _useState6[0],
|
|
35
|
+
setIsEmptyRedeemed = _useState6[1];
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_styles.Container, null, /*#__PURE__*/_react.default.createElement(_HorizontalGiftCardOrdersLayout.HorizontalGiftCardOrdersLayout, {
|
|
37
|
+
title: t('PENDING', 'Pending'),
|
|
38
|
+
defaultStatus: "pending",
|
|
39
|
+
setIsEmpty: setIsEmptyPending,
|
|
40
|
+
scrollId: "pendingGifts"
|
|
41
|
+
}), isEmptyPending && isEmptySent && isEmptyRedeemed && /*#__PURE__*/_react.default.createElement(_styles.Divider, null), /*#__PURE__*/_react.default.createElement(_HorizontalGiftCardOrdersLayout.HorizontalGiftCardOrdersLayout, {
|
|
42
|
+
title: t('SENT', 'Sent'),
|
|
43
|
+
defaultStatus: "sent",
|
|
44
|
+
setIsEmpty: setIsEmptySent,
|
|
45
|
+
scrollId: "sentGifts"
|
|
46
|
+
}), /*#__PURE__*/_react.default.createElement(_HorizontalGiftCardOrdersLayout.HorizontalGiftCardOrdersLayout, {
|
|
47
|
+
title: t('REDEEMED', 'Redeemed'),
|
|
48
|
+
defaultStatus: "activated",
|
|
49
|
+
setIsEmpty: setIsEmptyRedeemed,
|
|
50
|
+
scrollId: "redeemedgGifts"
|
|
51
|
+
}), isEmptyPending && isEmptySent && isEmptyRedeemed && /*#__PURE__*/_react.default.createElement(_styles.NoOrdersWrapper, null, /*#__PURE__*/_react.default.createElement("p", null, t('YOU_DONT_HAVE_CARDS', 'You don\'t have cards'))));
|
|
52
|
+
};
|
|
53
|
+
exports.GiftCardOrdersList = GiftCardOrdersList;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NoOrdersWrapper = exports.Divider = exports.Container = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n h2 {\n font-size: 24px;\n font-weight: 600;\n margin: 40px 0 20px 0;\n }\n"])));
|
|
12
|
+
exports.Container = Container;
|
|
13
|
+
var Divider = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-top: 25px;\n background: #F8F9FA;\n height: 8px;\n width: 100%;\n"])));
|
|
14
|
+
exports.Divider = Divider;
|
|
15
|
+
var NoOrdersWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 50px 0px;\n box-sizing: border-box;\n min-height: calc(100% - 120px);\n width: 100%;\n\n > p {\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n margin-top: 0px;\n margin-bottom: 25px;\n }\n"])));
|
|
16
|
+
exports.NoOrdersWrapper = NoOrdersWrapper;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.HorizontalGiftCardOrdersLayout = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _orderingComponentsExternal = require("ordering-components-external");
|
|
10
|
+
var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
|
|
11
|
+
var _AutoScroll = require("../../AutoScroll");
|
|
12
|
+
var _SingleGiftCard = require("../SingleGiftCard");
|
|
13
|
+
var _Pagination = require("../../Pagination");
|
|
14
|
+
var _styles = require("./styles");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
22
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
24
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
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); }
|
|
26
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
27
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
28
|
+
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; }
|
|
29
|
+
var HorizontalGiftCardOrdersLayoutUI = function HorizontalGiftCardOrdersLayoutUI(props) {
|
|
30
|
+
var _giftCards$list2, _giftCards$list3;
|
|
31
|
+
var giftCards = props.giftCards,
|
|
32
|
+
paginationProps = props.paginationProps,
|
|
33
|
+
goToPage = props.goToPage,
|
|
34
|
+
title = props.title,
|
|
35
|
+
setIsEmpty = props.setIsEmpty,
|
|
36
|
+
scrollId = props.scrollId;
|
|
37
|
+
(0, _react.useEffect)(function () {
|
|
38
|
+
var _giftCards$list;
|
|
39
|
+
if (giftCards.loading) return;
|
|
40
|
+
if (((_giftCards$list = giftCards.list) === null || _giftCards$list === void 0 ? void 0 : _giftCards$list.length) === 0) setIsEmpty(true);
|
|
41
|
+
}, [giftCards]);
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, giftCards.loading ? /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
43
|
+
width: 100,
|
|
44
|
+
height: 24
|
|
45
|
+
}) : ((_giftCards$list2 = giftCards.list) === null || _giftCards$list2 === void 0 ? void 0 : _giftCards$list2.length) > 0 && /*#__PURE__*/_react.default.createElement("h2", null, title), /*#__PURE__*/_react.default.createElement(_styles.ProductsListContainer, null, /*#__PURE__*/_react.default.createElement(_styles.ProductsList, null, /*#__PURE__*/_react.default.createElement(_AutoScroll.AutoScroll, {
|
|
46
|
+
scrollId: scrollId
|
|
47
|
+
}, giftCards.loading ? _toConsumableArray(Array(10).keys()).map(function (i) {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_SingleGiftCard.SingleGiftCard, {
|
|
49
|
+
isSkeleton: true,
|
|
50
|
+
key: i
|
|
51
|
+
});
|
|
52
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, giftCards.list.map(function (card) {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(_SingleGiftCard.SingleGiftCard, {
|
|
54
|
+
key: card.id,
|
|
55
|
+
card: card
|
|
56
|
+
});
|
|
57
|
+
}))))), ((_giftCards$list3 = giftCards.list) === null || _giftCards$list3 === void 0 ? void 0 : _giftCards$list3.length) > 0 && Math.ceil(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.totalPages) > 1 && /*#__PURE__*/_react.default.createElement(_styles.PaginationWrapper, null, /*#__PURE__*/_react.default.createElement(_Pagination.Pagination, {
|
|
58
|
+
currentPage: paginationProps.currentPage,
|
|
59
|
+
totalPages: Math.ceil(paginationProps === null || paginationProps === void 0 ? void 0 : paginationProps.totalPages),
|
|
60
|
+
handleChangePage: goToPage
|
|
61
|
+
})));
|
|
62
|
+
};
|
|
63
|
+
var HorizontalGiftCardOrdersLayout = function HorizontalGiftCardOrdersLayout(props) {
|
|
64
|
+
var giftCardsProps = _objectSpread(_objectSpread({}, props), {}, {
|
|
65
|
+
UIComponent: HorizontalGiftCardOrdersLayoutUI
|
|
66
|
+
});
|
|
67
|
+
return /*#__PURE__*/_react.default.createElement(_orderingComponentsExternal.GiftCardOrdersList, giftCardsProps);
|
|
68
|
+
};
|
|
69
|
+
exports.HorizontalGiftCardOrdersLayout = HorizontalGiftCardOrdersLayout;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ProductsListContainer = exports.ProductsList = exports.PaginationWrapper = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
11
|
+
var ProductsListContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-top: 10px;\n display: flex;\n overflow: scroll hidden;\n"])));
|
|
12
|
+
exports.ProductsListContainer = ProductsListContainer;
|
|
13
|
+
var ProductsList = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n box-sizing: border-box;\n\n .product-card {\n width: 270px;\n max-width: 270px;\n margin: 10px;\n border: 1px solid #E9ECEF;\n }\n\n @media(min-width: 480px){\n .product-card {\n width: 400px;\n max-width: 400px;\n }\n }\n"])));
|
|
14
|
+
exports.ProductsList = ProductsList;
|
|
15
|
+
var PaginationWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin: 20px 0;\n"])));
|
|
16
|
+
exports.PaginationWrapper = PaginationWrapper;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SingleGiftCard = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _orderingComponentsExternal = require("ordering-components-external");
|
|
9
|
+
var _reactLoadingSkeleton = _interopRequireDefault(require("react-loading-skeleton"));
|
|
10
|
+
var _styledComponents = require("styled-components");
|
|
11
|
+
var _BsDot = _interopRequireDefault(require("@meronex/icons/bs/BsDot"));
|
|
12
|
+
var _styles = require("./styles");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
+
var SingleGiftCard = function SingleGiftCard(props) {
|
|
21
|
+
var _card$order_product2, _theme$images, _card$order_product3, _card$order_product4, _card$order_product5;
|
|
22
|
+
var card = props.card,
|
|
23
|
+
isSkeleton = props.isSkeleton;
|
|
24
|
+
var theme = (0, _styledComponents.useTheme)();
|
|
25
|
+
var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
|
|
26
|
+
_useLanguage2 = _slicedToArray(_useLanguage, 2),
|
|
27
|
+
t = _useLanguage2[1];
|
|
28
|
+
var _useEvent = (0, _orderingComponentsExternal.useEvent)(),
|
|
29
|
+
_useEvent2 = _slicedToArray(_useEvent, 1),
|
|
30
|
+
events = _useEvent2[0];
|
|
31
|
+
var _useUtils = (0, _orderingComponentsExternal.useUtils)(),
|
|
32
|
+
_useUtils2 = _slicedToArray(_useUtils, 1),
|
|
33
|
+
_useUtils2$ = _useUtils2[0],
|
|
34
|
+
parsePrice = _useUtils2$.parsePrice,
|
|
35
|
+
optimizeImage = _useUtils2$.optimizeImage,
|
|
36
|
+
parseDate = _useUtils2$.parseDate;
|
|
37
|
+
var getGiftCardStatus = function getGiftCardStatus(status) {
|
|
38
|
+
switch (status) {
|
|
39
|
+
case 'pending':
|
|
40
|
+
return t('PENDING', 'Pending');
|
|
41
|
+
case 'activated':
|
|
42
|
+
return t('REDEEMED');
|
|
43
|
+
default:
|
|
44
|
+
return status;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var handleClickGiftCardOrder = function handleClickGiftCardOrder(card) {
|
|
48
|
+
var _card$order_product;
|
|
49
|
+
events.emit('go_to_page', {
|
|
50
|
+
page: 'order_detail',
|
|
51
|
+
params: {
|
|
52
|
+
orderId: (_card$order_product = card.order_product) === null || _card$order_product === void 0 ? void 0 : _card$order_product.order_id
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_styles.CardContainer, {
|
|
57
|
+
className: "product-card",
|
|
58
|
+
onClick: function onClick() {
|
|
59
|
+
return handleClickGiftCardOrder(card);
|
|
60
|
+
}
|
|
61
|
+
}, isSkeleton ? /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
62
|
+
height: 86,
|
|
63
|
+
width: 86
|
|
64
|
+
}) : /*#__PURE__*/_react.default.createElement(_styles.CardLogo, {
|
|
65
|
+
bgimage: optimizeImage((card === null || card === void 0 || (_card$order_product2 = card.order_product) === null || _card$order_product2 === void 0 ? void 0 : _card$order_product2.images) || (theme === null || theme === void 0 || (_theme$images = theme.images) === null || _theme$images === void 0 || (_theme$images = _theme$images.dummies) === null || _theme$images === void 0 ? void 0 : _theme$images.product), 'h_86,c_limit')
|
|
66
|
+
}), /*#__PURE__*/_react.default.createElement(_styles.CardInfo, null, /*#__PURE__*/_react.default.createElement("div", null, isSkeleton ? /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
67
|
+
height: 16,
|
|
68
|
+
width: 100
|
|
69
|
+
}) : /*#__PURE__*/_react.default.createElement("span", {
|
|
70
|
+
className: "name"
|
|
71
|
+
}, card === null || card === void 0 || (_card$order_product3 = card.order_product) === null || _card$order_product3 === void 0 ? void 0 : _card$order_product3.name), isSkeleton ? /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
72
|
+
height: 16,
|
|
73
|
+
width: 80
|
|
74
|
+
}) : /*#__PURE__*/_react.default.createElement("span", null, parsePrice(card === null || card === void 0 || (_card$order_product4 = card.order_product) === null || _card$order_product4 === void 0 ? void 0 : _card$order_product4.price))), isSkeleton ? /*#__PURE__*/_react.default.createElement("p", {
|
|
75
|
+
className: "date"
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
77
|
+
width: 150,
|
|
78
|
+
height: 14
|
|
79
|
+
})) : /*#__PURE__*/_react.default.createElement("p", {
|
|
80
|
+
className: "date"
|
|
81
|
+
}, t('ORDER_NUM', 'Order No.'), " ", card === null || card === void 0 || (_card$order_product5 = card.order_product) === null || _card$order_product5 === void 0 ? void 0 : _card$order_product5.order_id, /*#__PURE__*/_react.default.createElement(_BsDot.default, null), parseDate(card === null || card === void 0 ? void 0 : card.created_at)), isSkeleton ? /*#__PURE__*/_react.default.createElement("p", {
|
|
82
|
+
className: "status"
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement(_reactLoadingSkeleton.default, {
|
|
84
|
+
width: 80,
|
|
85
|
+
height: 14
|
|
86
|
+
})) : /*#__PURE__*/_react.default.createElement("p", {
|
|
87
|
+
className: "status"
|
|
88
|
+
}, getGiftCardStatus(card === null || card === void 0 ? void 0 : card.status))));
|
|
89
|
+
};
|
|
90
|
+
exports.SingleGiftCard = SingleGiftCard;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.CardLogo = exports.CardInfo = exports.CardContainer = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
10
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
16
|
+
var CardContainer = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n display: flex;\n cursor: pointer;\n padding: 10px;\n border-radius: 7.6px;\n\n &:hover {\n box-shadow: rgb(0 0 0 / 20%) 0px 8px 24px;\n }\n"])), function (props) {
|
|
17
|
+
var _props$theme$colors;
|
|
18
|
+
return (_props$theme$colors = props.theme.colors) === null || _props$theme$colors === void 0 ? void 0 : _props$theme$colors.backgroundPage;
|
|
19
|
+
});
|
|
20
|
+
exports.CardContainer = CardContainer;
|
|
21
|
+
var CardLogoStyled = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n position: relative;\n background-repeat: no-repeat, repeat;\n background-size: cover;\n background-position: center;\n object-fit: cover;\n height: 86px;\n width: 86px;\n min-width: 86px;\n min-height: 86px;\n border-radius: 8px;\n box-shadow: 0px 1px 4px rgba(0,0,0,0.1);\n"])));
|
|
22
|
+
var CardLogo = function CardLogo(props) {
|
|
23
|
+
var style = {};
|
|
24
|
+
if (props.bgimage) {
|
|
25
|
+
style.backgroundImage = "url(".concat(props.bgimage, ")");
|
|
26
|
+
}
|
|
27
|
+
if (props.soldOut) {
|
|
28
|
+
style.filter = 'brightness(70%)';
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(CardLogoStyled, _extends({}, props, {
|
|
31
|
+
style: style
|
|
32
|
+
}), props.children);
|
|
33
|
+
};
|
|
34
|
+
exports.CardLogo = CardLogo;
|
|
35
|
+
var CardInfo = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n\n flex: 1;\n > div {\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 16px;\n font-weight: 600;\n span.name {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n \n p.date {\n font-size: 14px;\n color: ", ";\n margin: 7px 0;\n line-height: 24px;\n display: flex;\n align-items: center;\n }\n p.status {\n font-size: 14px;\n line-height: 24px;\n color: ", ";\n margin: 0;\n }\n"])), function (props) {
|
|
36
|
+
var _props$theme;
|
|
37
|
+
return (_props$theme = props.theme) !== null && _props$theme !== void 0 && _props$theme.rtl ? (0, _styledComponents.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-right: 15px;\n "]))) : (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-left: 15px;\n "])));
|
|
38
|
+
}, function (props) {
|
|
39
|
+
return props.theme.colors.darkGray;
|
|
40
|
+
}, function (props) {
|
|
41
|
+
return props.theme.colors.primary;
|
|
42
|
+
});
|
|
43
|
+
exports.CardInfo = CardInfo;
|