ordering-components-external 13.0.39 → 13.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. package/_bundles/{7.ordering-component.25ccab3d29565dfca44c.js → 7.ordering-component.60d1e84ab037f739d802.js} +1 -1
  2. package/_bundles/{ordering-component.25ccab3d29565dfca44c.js → ordering-component.60d1e84ab037f739d802.js} +2 -2
  3. package/_modules/components/AddressForm/index.js +3 -1
  4. package/_modules/components/Checkout/index.js +28 -21
  5. package/_modules/components/MultiCheckout/index.js +21 -14
  6. package/package.json +1 -1
  7. package/src/components/AddressForm/index.js +8 -2
  8. package/src/components/Checkout/index.js +4 -0
  9. package/src/components/MultiCheckout/index.js +4 -0
  10. /package/_bundles/{0.ordering-component.25ccab3d29565dfca44c.js → 0.ordering-component.60d1e84ab037f739d802.js} +0 -0
  11. /package/_bundles/{1.ordering-component.25ccab3d29565dfca44c.js → 1.ordering-component.60d1e84ab037f739d802.js} +0 -0
  12. /package/_bundles/{2.ordering-component.25ccab3d29565dfca44c.js → 2.ordering-component.60d1e84ab037f739d802.js} +0 -0
  13. /package/_bundles/{4.ordering-component.25ccab3d29565dfca44c.js → 4.ordering-component.60d1e84ab037f739d802.js} +0 -0
  14. /package/_bundles/{5.ordering-component.25ccab3d29565dfca44c.js → 5.ordering-component.60d1e84ab037f739d802.js} +0 -0
  15. /package/_bundles/{6.ordering-component.25ccab3d29565dfca44c.js → 6.ordering-component.60d1e84ab037f739d802.js} +0 -0
  16. /package/_bundles/{7.ordering-component.25ccab3d29565dfca44c.js.LICENSE.txt → 7.ordering-component.60d1e84ab037f739d802.js.LICENSE.txt} +0 -0
  17. /package/_bundles/{8.ordering-component.25ccab3d29565dfca44c.js → 8.ordering-component.60d1e84ab037f739d802.js} +0 -0
  18. /package/_bundles/{ordering-component.25ccab3d29565dfca44c.js.LICENSE.txt → ordering-component.60d1e84ab037f739d802.js.LICENSE.txt} +0 -0
@@ -286,7 +286,9 @@ var AddressForm = exports.AddressForm = function AddressForm(props) {
286
286
  conditions = [];
287
287
  parameters = {
288
288
  location: "".concat(location === null || location === void 0 ? void 0 : location.lat, ",").concat(location === null || location === void 0 ? void 0 : location.lng),
289
- type: options === null || options === void 0 ? void 0 : options.type
289
+ type: 2,
290
+ page: 1,
291
+ page_size: 5
290
292
  };
291
293
  if (franchiseId) {
292
294
  conditions.push({
@@ -276,6 +276,13 @@ var Checkout = exports.Checkout = function Checkout(props) {
276
276
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
277
277
  while (1) switch (_context2.prev = _context2.next) {
278
278
  case 0:
279
+ if (!placing) {
280
+ _context2.next = 3;
281
+ break;
282
+ }
283
+ showToast(_ToastContext.ToastType.Info, t('CART_IN_PROGRESS', 'Cart in progress'));
284
+ return _context2.abrupt("return");
285
+ case 3:
279
286
  paymethodData = paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.data;
280
287
  if (paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod && ['stripe', 'stripe_connect', 'stripe_direct'].includes(paymethodSelected === null || paymethodSelected === void 0 || (_paymethodSelected$pa5 = paymethodSelected.paymethod) === null || _paymethodSelected$pa5 === void 0 ? void 0 : _paymethodSelected$pa5.gateway)) {
281
288
  paymethodData = {
@@ -298,75 +305,75 @@ var Checkout = exports.Checkout = function Checkout(props) {
298
305
  });
299
306
  }
300
307
  if (!handleCustomClick) {
301
- _context2.next = 9;
308
+ _context2.next = 12;
302
309
  break;
303
310
  }
304
311
  handleCustomClick(payload, paymethodSelected, cart);
305
312
  return _context2.abrupt("return");
306
- case 9:
313
+ case 12:
307
314
  if (cart) {
308
- _context2.next = 11;
315
+ _context2.next = 14;
309
316
  break;
310
317
  }
311
318
  return _context2.abrupt("return");
312
- case 11:
319
+ case 14:
313
320
  payload = _objectSpread(_objectSpread(_objectSpread({}, payload), payloadProps), {}, {
314
321
  paymethod_data: _objectSpread(_objectSpread({}, paymethodData), paymentOptions)
315
322
  });
316
323
  setPlacing(true);
317
- _context2.next = 15;
324
+ _context2.next = 18;
318
325
  return onChangeSpot();
319
- case 15:
326
+ case 18:
320
327
  if (paymethodsWithoutSaveCard.includes(paymethodSelected === null || paymethodSelected === void 0 || (_paymethodSelected$pa6 = paymethodSelected.paymethod) === null || _paymethodSelected$pa6 === void 0 ? void 0 : _paymethodSelected$pa6.gateway)) {
321
328
  delete payload.paymethod_data;
322
329
  }
323
- _context2.next = 18;
330
+ _context2.next = 21;
324
331
  return placeCart(cart.uuid, payload);
325
- case 18:
332
+ case 21:
326
333
  result = _context2.sent;
327
334
  if (!(result !== null && result !== void 0 && result.error || !result)) {
328
- _context2.next = 27;
335
+ _context2.next = 30;
329
336
  break;
330
337
  }
331
338
  setErrors(result === null || result === void 0 ? void 0 : result.result);
332
339
  if (!(dismissPlatformPay && (paymethodSelected === null || paymethodSelected === void 0 || (_paymethodSelected$pa7 = paymethodSelected.paymethod) === null || _paymethodSelected$pa7 === void 0 ? void 0 : _paymethodSelected$pa7.gateway) === 'apple_pay')) {
333
- _context2.next = 24;
340
+ _context2.next = 27;
334
341
  break;
335
342
  }
336
- _context2.next = 24;
343
+ _context2.next = 27;
337
344
  return dismissPlatformPay();
338
- case 24:
345
+ case 27:
339
346
  refreshOrderOptions();
340
347
  setPlacing(false);
341
348
  return _context2.abrupt("return");
342
- case 27:
349
+ case 30:
343
350
  cartResult = result === null || result === void 0 ? void 0 : result.result;
344
351
  if (!((cartResult === null || cartResult === void 0 || (_cartResult$paymethod = cartResult.paymethod_data) === null || _cartResult$paymethod === void 0 ? void 0 : _cartResult$paymethod.status) === 2 && actionsBeforePlace)) {
345
- _context2.next = 31;
352
+ _context2.next = 34;
346
353
  break;
347
354
  }
348
- _context2.next = 31;
355
+ _context2.next = 34;
349
356
  return actionsBeforePlace(paymethodSelected, result.result);
350
- case 31:
357
+ case 34:
351
358
  if (!(confirmPayment && (result === null || result === void 0 || (_result$result = result.result) === null || _result$result === void 0 || (_result$result = _result$result.paymethod_data) === null || _result$result === void 0 ? void 0 : _result$result.gateway) === 'apple_pay')) {
352
- _context2.next = 37;
359
+ _context2.next = 40;
353
360
  break;
354
361
  }
355
- _context2.next = 34;
362
+ _context2.next = 37;
356
363
  return confirmPayment(result === null || result === void 0 || (_result$result2 = result.result) === null || _result$result2 === void 0 || (_result$result2 = _result$result2.paymethod_data) === null || _result$result2 === void 0 || (_result$result2 = _result$result2.result) === null || _result$result2 === void 0 ? void 0 : _result$result2.client_secret);
357
- case 34:
364
+ case 37:
358
365
  _yield$confirmPayment = _context2.sent;
359
366
  confirmApplePayError = _yield$confirmPayment.error;
360
367
  if (confirmApplePayError) {
361
368
  setErrors(confirmApplePayError);
362
369
  }
363
- case 37:
370
+ case 40:
364
371
  if (paymethodsWithoutSaveCard.includes(cartResult === null || cartResult === void 0 || (_cartResult$paymethod2 = cartResult.paymethod_data) === null || _cartResult$paymethod2 === void 0 ? void 0 : _cartResult$paymethod2.gateway) && cartResult !== null && cartResult !== void 0 && (_cartResult$paymethod3 = cartResult.paymethod_data) !== null && _cartResult$paymethod3 !== void 0 && (_cartResult$paymethod3 = _cartResult$paymethod3.result) !== null && _cartResult$paymethod3 !== void 0 && _cartResult$paymethod3.hash && (cartResult === null || cartResult === void 0 || (_cartResult$paymethod4 = cartResult.paymethod_data) === null || _cartResult$paymethod4 === void 0 ? void 0 : _cartResult$paymethod4.status) === 2 && !payloadProps.isNative) {
365
372
  handleConfirmCredomaticPage(cartResult, paymethodSelected);
366
373
  }
367
374
  setPlacing(false);
368
375
  onPlaceOrderClick && onPlaceOrderClick(payload, paymethodSelected, cartResult);
369
- case 40:
376
+ case 43:
370
377
  case "end":
371
378
  return _context2.stop();
372
379
  }
@@ -152,6 +152,13 @@ var MultiCheckout = exports.MultiCheckout = function MultiCheckout(props) {
152
152
  return _regeneratorRuntime().wrap(function _callee$(_context) {
153
153
  while (1) switch (_context.prev = _context.next) {
154
154
  case 0:
155
+ if (!placing) {
156
+ _context.next = 3;
157
+ break;
158
+ }
159
+ showToast(_ToastContext.ToastType.Info, t('CART_IN_PROGRESS', 'Cart in progress'));
160
+ return _context.abrupt("return");
161
+ case 3:
155
162
  paymethodData = paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.paymethod_data;
156
163
  if (paymethodSelected !== null && paymethodSelected !== void 0 && paymethodSelected.paymethod_data && ['stripe', 'stripe_connect', 'stripe_direct'].includes(paymethodSelected === null || paymethodSelected === void 0 || (_paymethodSelected$pa = paymethodSelected.paymethod) === null || _paymethodSelected$pa === void 0 ? void 0 : _paymethodSelected$pa.gateway)) {
157
164
  paymethodData = JSON.stringify({
@@ -178,27 +185,27 @@ var MultiCheckout = exports.MultiCheckout = function MultiCheckout(props) {
178
185
  });
179
186
  }
180
187
  setPlacing(true);
181
- _context.next = 9;
188
+ _context.next = 12;
182
189
  return placeMultiCarts(payload, cartUuid);
183
- case 9:
190
+ case 12:
184
191
  _yield$placeMultiCart = _context.sent;
185
192
  error = _yield$placeMultiCart.error;
186
193
  result = _yield$placeMultiCart.result;
187
194
  if (!error) {
188
- _context.next = 14;
195
+ _context.next = 17;
189
196
  break;
190
197
  }
191
198
  return _context.abrupt("return");
192
- case 14:
199
+ case 17:
193
200
  if (!((result === null || result === void 0 || (_result$paymethod_dat = result.paymethod_data) === null || _result$paymethod_dat === void 0 ? void 0 : _result$paymethod_dat.status) === 2 && actionsBeforePlace)) {
194
- _context.next = 17;
201
+ _context.next = 20;
195
202
  break;
196
203
  }
197
- _context.next = 17;
204
+ _context.next = 20;
198
205
  return actionsBeforePlace(paymethodSelected, result);
199
- case 17:
206
+ case 20:
200
207
  if (!(confirmPayment && (paymethodSelected === null || paymethodSelected === void 0 ? void 0 : paymethodSelected.gateway) === 'global_apple_pay')) {
201
- _context.next = 27;
208
+ _context.next = 30;
202
209
  break;
203
210
  }
204
211
  paymentEvent = result === null || result === void 0 || (_result$payment_event = result.payment_events) === null || _result$payment_event === void 0 ? void 0 : _result$payment_event.find(function (event) {
@@ -206,28 +213,28 @@ var MultiCheckout = exports.MultiCheckout = function MultiCheckout(props) {
206
213
  return event === null || event === void 0 || (_event$data = event.data) === null || _event$data === void 0 || (_event$data = _event$data.extra) === null || _event$data === void 0 ? void 0 : _event$data.client_secret;
207
214
  });
208
215
  if (!(paymentEvent !== null && paymentEvent !== void 0 && (_paymentEvent$data = paymentEvent.data) !== null && _paymentEvent$data !== void 0 && (_paymentEvent$data = _paymentEvent$data.extra) !== null && _paymentEvent$data !== void 0 && _paymentEvent$data.client_secret)) {
209
- _context.next = 25;
216
+ _context.next = 28;
210
217
  break;
211
218
  }
212
- _context.next = 22;
219
+ _context.next = 25;
213
220
  return confirmPayment(paymentEvent === null || paymentEvent === void 0 || (_paymentEvent$data2 = paymentEvent.data) === null || _paymentEvent$data2 === void 0 || (_paymentEvent$data2 = _paymentEvent$data2.extra) === null || _paymentEvent$data2 === void 0 ? void 0 : _paymentEvent$data2.client_secret);
214
- case 22:
221
+ case 25:
215
222
  _yield$confirmPayment = _context.sent;
216
223
  confirmApplePayError = _yield$confirmPayment.error;
217
224
  if (confirmApplePayError !== null && confirmApplePayError !== void 0 && confirmApplePayError.message || confirmApplePayError !== null && confirmApplePayError !== void 0 && confirmApplePayError.localizedMessage) {
218
225
  showToast(_ToastContext.ToastType.Error, (confirmApplePayError === null || confirmApplePayError === void 0 ? void 0 : confirmApplePayError.message) || (confirmApplePayError === null || confirmApplePayError === void 0 ? void 0 : confirmApplePayError.localizedMessage));
219
226
  }
220
- case 25:
227
+ case 28:
221
228
  setPlacing(false);
222
229
  if (!error) {
223
230
  onPlaceOrderClick && onPlaceOrderClick(result);
224
231
  }
225
- case 27:
232
+ case 30:
226
233
  setPlacing(false);
227
234
  if (!error) {
228
235
  onPlaceOrderClick && onPlaceOrderClick(result);
229
236
  }
230
- case 29:
237
+ case 32:
231
238
  case "end":
232
239
  return _context.stop();
233
240
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-components-external",
3
- "version": "13.0.39",
3
+ "version": "13.0.41",
4
4
  "description": "Ordering Internal Dashboard",
5
5
  "main": "./_modules/index.js",
6
6
  "scripts": {
@@ -175,7 +175,9 @@ export const AddressForm = (props) => {
175
175
  const conditions = []
176
176
  const parameters = {
177
177
  location: `${location?.lat},${location?.lng}`,
178
- type: options?.type
178
+ type: 2,
179
+ page: 1,
180
+ page_size: 5
179
181
  }
180
182
  if (franchiseId) {
181
183
  conditions.push({ attribute: 'franchise_id', value: franchiseId })
@@ -186,7 +188,11 @@ export const AddressForm = (props) => {
186
188
  }
187
189
  const source = {}
188
190
  requestsState.businesses = source
189
- const fetchEndpoint = ordering.businesses().select(['delivery_zone', 'name', 'id', 'location', 'logo', 'slug', 'zones']).parameters(parameters).where(where)
191
+ const fetchEndpoint = ordering
192
+ .businesses()
193
+ .select(['delivery_zone', 'name', 'id', 'location', 'logo', 'slug', 'zones'])
194
+ .parameters(parameters)
195
+ .where(where)
190
196
  const { content: { error, result } } = await fetchEndpoint.get({ cancelToken: source })
191
197
  setBusinessesList({
192
198
  ...businessesList,
@@ -150,6 +150,10 @@ export const Checkout = (props) => {
150
150
  * Method to handle click on Place order
151
151
  */
152
152
  const handlerClickPlaceOrder = async (paymentOptions, payloadProps, confirmPayment, dismissPlatformPay) => {
153
+ if (placing) {
154
+ showToast(ToastType.Info, t('CART_IN_PROGRESS', 'Cart in progress'))
155
+ return
156
+ }
153
157
  let paymethodData = paymethodSelected?.data
154
158
  if (paymethodSelected?.paymethod && ['stripe', 'stripe_connect', 'stripe_direct'].includes(paymethodSelected?.paymethod?.gateway)) {
155
159
  paymethodData = {
@@ -56,6 +56,10 @@ export const MultiCheckout = (props) => {
56
56
  const totalCartsFee = openCarts?.length && openCarts?.filter(cart => cart?.status !== 1 && cart?.valid)?.reduce((total, cart) => { return total + (cart?.delivery_price_with_discount) }, 0)
57
57
 
58
58
  const handleGroupPlaceOrder = async (confirmPayment) => {
59
+ if (placing) {
60
+ showToast(ToastType.Info, t('CART_IN_PROGRESS', 'Cart in progress'))
61
+ return
62
+ }
59
63
  let paymethodData = paymethodSelected?.paymethod_data
60
64
  if (paymethodSelected?.paymethod_data && ['stripe', 'stripe_connect', 'stripe_direct'].includes(paymethodSelected?.paymethod?.gateway)) {
61
65
  paymethodData = JSON.stringify({