ordering-components-external 13.2.30 → 13.2.32

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 (17) hide show
  1. package/_bundles/{7.ordering-component.653104786241a4b2afb5.js → 7.ordering-component.5e6b244837705c07824f.js} +1 -1
  2. package/_bundles/{ordering-component.653104786241a4b2afb5.js → ordering-component.5e6b244837705c07824f.js} +2 -2
  3. package/_modules/components/LoginForm/index.js +9 -7
  4. package/_modules/components/SignupForm/index.js +9 -7
  5. package/package.json +1 -1
  6. package/src/components/LoginForm/index.js +9 -5
  7. package/src/components/SignupForm/index.js +5 -3
  8. package/src/components/UserVerification/index.js +4 -0
  9. /package/_bundles/{0.ordering-component.653104786241a4b2afb5.js → 0.ordering-component.5e6b244837705c07824f.js} +0 -0
  10. /package/_bundles/{1.ordering-component.653104786241a4b2afb5.js → 1.ordering-component.5e6b244837705c07824f.js} +0 -0
  11. /package/_bundles/{2.ordering-component.653104786241a4b2afb5.js → 2.ordering-component.5e6b244837705c07824f.js} +0 -0
  12. /package/_bundles/{4.ordering-component.653104786241a4b2afb5.js → 4.ordering-component.5e6b244837705c07824f.js} +0 -0
  13. /package/_bundles/{5.ordering-component.653104786241a4b2afb5.js → 5.ordering-component.5e6b244837705c07824f.js} +0 -0
  14. /package/_bundles/{6.ordering-component.653104786241a4b2afb5.js → 6.ordering-component.5e6b244837705c07824f.js} +0 -0
  15. /package/_bundles/{7.ordering-component.653104786241a4b2afb5.js.LICENSE.txt → 7.ordering-component.5e6b244837705c07824f.js.LICENSE.txt} +0 -0
  16. /package/_bundles/{8.ordering-component.653104786241a4b2afb5.js → 8.ordering-component.5e6b244837705c07824f.js} +0 -0
  17. /package/_bundles/{ordering-component.653104786241a4b2afb5.js.LICENSE.txt → ordering-component.5e6b244837705c07824f.js.LICENSE.txt} +0 -0
@@ -36,7 +36,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
36
36
  * Component to manage login behavior without UI component
37
37
  */
38
38
  var LoginForm = exports.LoginForm = function LoginForm(props) {
39
- var _configs$phone_passwo, _configs$opt_email_en, _configs$otp_cellphon, _configs$email_passwo, _configs$spoonity_ena, _configs$device_code_;
39
+ var _configs$phone_passwo, _configs$opt_email_en, _configs$otp_cellphon, _configs$whatsapp_otp, _configs$email_passwo, _configs$spoonity_ena, _configs$device_code_;
40
40
  var UIComponent = props.UIComponent,
41
41
  handleButtonLoginClick = props.handleButtonLoginClick,
42
42
  handleSuccessLogin = props.handleSuccessLogin,
@@ -110,9 +110,10 @@ var LoginForm = exports.LoginForm = function LoginForm(props) {
110
110
  var useLoginByCellphone = (configs === null || configs === void 0 || (_configs$phone_passwo = configs.phone_password_login_enabled) === null || _configs$phone_passwo === void 0 ? void 0 : _configs$phone_passwo.value) === '1';
111
111
  var useLoginOtpEmail = (configs === null || configs === void 0 || (_configs$opt_email_en = configs.opt_email_enabled) === null || _configs$opt_email_en === void 0 ? void 0 : _configs$opt_email_en.value) === '1';
112
112
  var useLoginOtpCellphone = (configs === null || configs === void 0 || (_configs$otp_cellphon = configs.otp_cellphone_enabled) === null || _configs$otp_cellphon === void 0 ? void 0 : _configs$otp_cellphon.value) === '1';
113
- var useLoginByEmail = useLoginByCellphone || useLoginOtpEmail || useLoginOtpCellphone ? (configs === null || configs === void 0 || (_configs$email_passwo = configs.email_password_login_enabled) === null || _configs$email_passwo === void 0 ? void 0 : _configs$email_passwo.value) === '1' : true;
113
+ var useLoginOtpWhatsapp = (configs === null || configs === void 0 || (_configs$whatsapp_otp = configs.whatsapp_otp_login_enabled) === null || _configs$whatsapp_otp === void 0 ? void 0 : _configs$whatsapp_otp.value) === '1';
114
+ var useLoginByEmail = useLoginByCellphone || useLoginOtpEmail || useLoginOtpCellphone || useLoginOtpWhatsapp ? (configs === null || configs === void 0 || (_configs$email_passwo = configs.email_password_login_enabled) === null || _configs$email_passwo === void 0 ? void 0 : _configs$email_passwo.value) === '1' : true;
114
115
  var useLoginSpoonity = (configs === null || configs === void 0 || (_configs$spoonity_ena = configs.spoonity_enabled) === null || _configs$spoonity_ena === void 0 ? void 0 : _configs$spoonity_ena.value) === '1';
115
- var useLoginOtp = useLoginOtpEmail || useLoginOtpCellphone;
116
+ var useLoginOtp = useLoginOtpEmail || useLoginOtpCellphone || useLoginOtpWhatsapp;
116
117
  var isDeviceLoginEnabled = (configs === null || configs === void 0 || (_configs$device_code_ = configs.device_code_login_enabled) === null || _configs$device_code_ === void 0 ? void 0 : _configs$device_code_.value) === '1';
117
118
  defaultLoginTab = useLoginByEmail ? 'email' : useLoginByCellphone ? 'cellphone' : 'otp';
118
119
  var _useState13 = (0, _react.useState)(defaultLoginTab),
@@ -163,7 +164,7 @@ var LoginForm = exports.LoginForm = function LoginForm(props) {
163
164
  _credentials = _defineProperty(_defineProperty({}, otpType, values && values[otpType] || credentials[otpType]), "one_time_password", values && (values === null || values === void 0 ? void 0 : values.code) || otpState);
164
165
  if (otpType === 'cellphone') {
165
166
  _credentials = _objectSpread(_objectSpread({}, _credentials), {}, {
166
- country_phone_code: values && ((values === null || values === void 0 ? void 0 : values.country_phone_code) || (credentials === null || credentials === void 0 ? void 0 : credentials.country_phone_code))
167
+ country_phone_code: values && (values === null || values === void 0 ? void 0 : values.country_phone_code) || (credentials === null || credentials === void 0 ? void 0 : credentials.country_phone_code)
167
168
  });
168
169
  }
169
170
  } else {
@@ -475,14 +476,14 @@ var LoginForm = exports.LoginForm = function LoginForm(props) {
475
476
  };
476
477
  }();
477
478
  var generateOtpCode = /*#__PURE__*/function () {
478
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(values) {
479
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(values, channel) {
479
480
  var body, email, cellphone, countryPhoneCode, response, _yield$response$json, result, error, _t5;
480
481
  return _regenerator().w(function (_context4) {
481
482
  while (1) switch (_context4.p = _context4.n) {
482
483
  case 0:
483
484
  body = {
484
485
  type: 4,
485
- channel: otpType === 'email' ? 1 : 2,
486
+ channel: otpType === 'email' ? 1 : channel || 2,
486
487
  size: 6
487
488
  };
488
489
  email = (values === null || values === void 0 ? void 0 : values.email) || (credentials === null || credentials === void 0 ? void 0 : credentials.email);
@@ -552,7 +553,7 @@ var LoginForm = exports.LoginForm = function LoginForm(props) {
552
553
  }
553
554
  }, _callee4, null, [[1, 5]]);
554
555
  }));
555
- return function generateOtpCode(_x4) {
556
+ return function generateOtpCode(_x4, _x5) {
556
557
  return _ref4.apply(this, arguments);
557
558
  };
558
559
  }();
@@ -654,6 +655,7 @@ var LoginForm = exports.LoginForm = function LoginForm(props) {
654
655
  useLoginByCellphone: useLoginByCellphone,
655
656
  useLoginOtpEmail: useLoginOtpEmail,
656
657
  useLoginOtpCellphone: useLoginOtpCellphone,
658
+ useLoginOtpWhatsapp: useLoginOtpWhatsapp,
657
659
  useLoginSpoonity: useLoginSpoonity,
658
660
  handleLoginSpoonity: handleLoginSpoonity,
659
661
  setCellphoneStartZero: setCellphoneStartZero
@@ -37,7 +37,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
37
37
  * Component to manage signup behavior without UI component
38
38
  */
39
39
  var SignupForm = exports.SignupForm = function SignupForm(props) {
40
- var _configs$email_otp_si, _configs$phone_otp_si, _configs$full_details;
40
+ var _configs$email_otp_si, _configs$phone_otp_si, _configs$whatsapp_otp, _configs$full_details;
41
41
  var UIComponent = props.UIComponent,
42
42
  useChekoutFileds = props.useChekoutFileds,
43
43
  handleButtonSignupClick = props.handleButtonSignupClick,
@@ -134,7 +134,8 @@ var SignupForm = exports.SignupForm = function SignupForm(props) {
134
134
  setCellphoneStartZero = _useState18[1];
135
135
  var useSignUpOtpEmail = (configs === null || configs === void 0 || (_configs$email_otp_si = configs.email_otp_signup_enabled) === null || _configs$email_otp_si === void 0 ? void 0 : _configs$email_otp_si.value) === '1' && !isCustomerMode;
136
136
  var useSignUpOtpCellphone = (configs === null || configs === void 0 || (_configs$phone_otp_si = configs.phone_otp_signup_enabled) === null || _configs$phone_otp_si === void 0 ? void 0 : _configs$phone_otp_si.value) === '1' && !isCustomerMode;
137
- var useSignUpFullDetails = useSignUpOtpEmail || useSignUpOtpCellphone ? (configs === null || configs === void 0 || (_configs$full_details = configs.full_details_signup_enabled) === null || _configs$full_details === void 0 ? void 0 : _configs$full_details.value) === '1' : true;
137
+ var useSignUpOtpWhatsapp = (configs === null || configs === void 0 || (_configs$whatsapp_otp = configs.whatsapp_otp_signup_enabled) === null || _configs$whatsapp_otp === void 0 ? void 0 : _configs$whatsapp_otp.value) === '1' && !isCustomerMode;
138
+ var useSignUpFullDetails = useSignUpOtpEmail || useSignUpOtpCellphone || useSignUpOtpWhatsapp ? (configs === null || configs === void 0 || (_configs$full_details = configs.full_details_signup_enabled) === null || _configs$full_details === void 0 ? void 0 : _configs$full_details.value) === '1' : true;
138
139
  var defaultSignUpTab = useSignUpFullDetails ? 'default' : useSignUpOtpEmail ? 'otpEmail' : 'otpCellphone';
139
140
  var _useState19 = (0, _react.useState)(defaultSignUpTab),
140
141
  _useState20 = _slicedToArray(_useState19, 2),
@@ -362,7 +363,7 @@ var SignupForm = exports.SignupForm = function SignupForm(props) {
362
363
  };
363
364
  }();
364
365
  var generateOtpCode = /*#__PURE__*/function () {
365
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(values) {
366
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(values, channel) {
366
367
  var body, email, cellphone, countryPhoneCode, response, _yield$response$json, result, error, _t3;
367
368
  return _regenerator().w(function (_context3) {
368
369
  while (1) switch (_context3.p = _context3.n) {
@@ -382,7 +383,7 @@ var SignupForm = exports.SignupForm = function SignupForm(props) {
382
383
  case 1:
383
384
  body = {
384
385
  type: 4,
385
- channel: signUpTab === 'otpEmail' ? 1 : 2,
386
+ channel: signUpTab === 'otpEmail' ? 1 : channel || 2,
386
387
  size: 6
387
388
  };
388
389
  email = (values === null || values === void 0 ? void 0 : values.email) || (signupData === null || signupData === void 0 ? void 0 : signupData.email);
@@ -465,7 +466,7 @@ var SignupForm = exports.SignupForm = function SignupForm(props) {
465
466
  }
466
467
  }, _callee3, null, [[2, 6]]);
467
468
  }));
468
- return function generateOtpCode(_x3) {
469
+ return function generateOtpCode(_x3, _x4) {
469
470
  return _ref5.apply(this, arguments);
470
471
  };
471
472
  }();
@@ -544,7 +545,7 @@ var SignupForm = exports.SignupForm = function SignupForm(props) {
544
545
  }
545
546
  }, _callee4, null, [[1, 4]]);
546
547
  }));
547
- return function checkVerifyPhoneCode(_x4) {
548
+ return function checkVerifyPhoneCode(_x5) {
548
549
  return _ref6.apply(this, arguments);
549
550
  };
550
551
  }();
@@ -688,7 +689,8 @@ var SignupForm = exports.SignupForm = function SignupForm(props) {
688
689
  willVerifyOtpState: willVerifyOtpState,
689
690
  useSignUpFullDetails: useSignUpFullDetails,
690
691
  useSignUpOtpEmail: useSignUpOtpEmail,
691
- useSignUpOtpCellphone: useSignUpOtpCellphone
692
+ useSignUpOtpCellphone: useSignUpOtpCellphone,
693
+ useSignUpOtpWhatsapp: useSignUpOtpWhatsapp
692
694
  })));
693
695
  };
694
696
  SignupForm.propTypes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-components-external",
3
- "version": "13.2.30",
3
+ "version": "13.2.32",
4
4
  "description": "Ordering Internal Dashboard",
5
5
  "main": "./_modules/index.js",
6
6
  "scripts": {
@@ -39,10 +39,11 @@ export const LoginForm = (props) => {
39
39
  const useLoginByCellphone = configs?.phone_password_login_enabled?.value === '1'
40
40
  const useLoginOtpEmail = configs?.opt_email_enabled?.value === '1'
41
41
  const useLoginOtpCellphone = configs?.otp_cellphone_enabled?.value === '1'
42
- const useLoginByEmail = (useLoginByCellphone || useLoginOtpEmail || useLoginOtpCellphone)
42
+ const useLoginOtpWhatsapp = configs?.whatsapp_otp_login_enabled?.value === '1'
43
+ const useLoginByEmail = (useLoginByCellphone || useLoginOtpEmail || useLoginOtpCellphone || useLoginOtpWhatsapp)
43
44
  ? configs?.email_password_login_enabled?.value === '1' : true
44
45
  const useLoginSpoonity = configs?.spoonity_enabled?.value === '1'
45
- const useLoginOtp = useLoginOtpEmail || useLoginOtpCellphone
46
+ const useLoginOtp = useLoginOtpEmail || useLoginOtpCellphone || useLoginOtpWhatsapp
46
47
  const isDeviceLoginEnabled = configs?.device_code_login_enabled?.value === '1'
47
48
 
48
49
  defaultLoginTab = useLoginByEmail ? 'email' : useLoginByCellphone ? 'cellphone' : 'otp'
@@ -76,7 +77,9 @@ export const LoginForm = (props) => {
76
77
  if (otpType === 'cellphone') {
77
78
  _credentials = {
78
79
  ..._credentials,
79
- country_phone_code: values && (values?.country_phone_code || credentials?.country_phone_code)
80
+ country_phone_code:
81
+ (values && values?.country_phone_code) ||
82
+ credentials?.country_phone_code
80
83
  }
81
84
  }
82
85
  } else {
@@ -312,10 +315,10 @@ export const LoginForm = (props) => {
312
315
  }
313
316
  }
314
317
 
315
- const generateOtpCode = async (values) => {
318
+ const generateOtpCode = async (values, channel) => {
316
319
  const body = {
317
320
  type: 4,
318
- channel: otpType === 'email' ? 1 : 2,
321
+ channel: otpType === 'email' ? 1 : (channel || 2),
319
322
  size: 6
320
323
  }
321
324
  const email = values?.email || credentials?.email
@@ -433,6 +436,7 @@ export const LoginForm = (props) => {
433
436
  useLoginByCellphone={useLoginByCellphone}
434
437
  useLoginOtpEmail={useLoginOtpEmail}
435
438
  useLoginOtpCellphone={useLoginOtpCellphone}
439
+ useLoginOtpWhatsapp={useLoginOtpWhatsapp}
436
440
  useLoginSpoonity={useLoginSpoonity}
437
441
  handleLoginSpoonity={handleLoginSpoonity}
438
442
  setCellphoneStartZero={setCellphoneStartZero}
@@ -49,7 +49,8 @@ export const SignupForm = (props) => {
49
49
 
50
50
  const useSignUpOtpEmail = configs?.email_otp_signup_enabled?.value === '1' && !isCustomerMode
51
51
  const useSignUpOtpCellphone = configs?.phone_otp_signup_enabled?.value === '1' && !isCustomerMode
52
- const useSignUpFullDetails = (useSignUpOtpEmail || useSignUpOtpCellphone) ? configs?.full_details_signup_enabled?.value === '1' : true
52
+ const useSignUpOtpWhatsapp = configs?.whatsapp_otp_login_enabled?.value === '1' && !isCustomerMode
53
+ const useSignUpFullDetails = (useSignUpOtpEmail || useSignUpOtpCellphone || useSignUpOtpWhatsapp) ? configs?.full_details_signup_enabled?.value === '1' : true
53
54
 
54
55
  const defaultSignUpTab = useSignUpFullDetails ? 'default' : useSignUpOtpEmail ? 'otpEmail' : 'otpCellphone'
55
56
  const [signUpTab, setSignUpTab] = useState(defaultSignUpTab)
@@ -232,7 +233,7 @@ export const SignupForm = (props) => {
232
233
  }
233
234
  }
234
235
 
235
- const generateOtpCode = async (values) => {
236
+ const generateOtpCode = async (values, channel) => {
236
237
  if (isReCaptchaEnable && reCaptchaValue === null) {
237
238
  setCheckPhoneCodeState({
238
239
  ...checkPhoneCodeState,
@@ -246,7 +247,7 @@ export const SignupForm = (props) => {
246
247
  }
247
248
  const body = {
248
249
  type: 4,
249
- channel: signUpTab === 'otpEmail' ? 1 : 2,
250
+ channel: signUpTab === 'otpEmail' ? 1 : (channel || 2),
250
251
  size: 6
251
252
  }
252
253
  const email = values?.email || signupData?.email
@@ -478,6 +479,7 @@ export const SignupForm = (props) => {
478
479
  useSignUpFullDetails={useSignUpFullDetails}
479
480
  useSignUpOtpEmail={useSignUpOtpEmail}
480
481
  useSignUpOtpCellphone={useSignUpOtpCellphone}
482
+ useSignUpOtpWhatsapp={useSignUpOtpWhatsapp}
481
483
  />
482
484
  )}
483
485
  </>
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { useSession } from '../../contexts/SessionContext'
3
3
  import { useApi } from '../../contexts/ApiContext'
4
+ import { useConfig } from '../../contexts/ConfigContext'
4
5
  import { useWebsocket } from '../../contexts/WebsocketContext'
5
6
 
6
7
  /**
@@ -14,6 +15,8 @@ export const UserVerification = (props) => {
14
15
  const [ordering] = useApi()
15
16
  const socket = useWebsocket()
16
17
  const [{ user, token }, { changeUser }] = useSession()
18
+ const [{ configs }] = useConfig()
19
+ const useWhatsappVerification = configs?.whatsapp_otp_login_enabled?.value === '1'
17
20
 
18
21
  const [verifyEmailState, setVerifyEmailState] = useState({
19
22
  loadingSendCode: false,
@@ -235,6 +238,7 @@ export const UserVerification = (props) => {
235
238
  checkVerifyEmailCode={checkVerifyEmailCode}
236
239
  checkVerifyPhoneCode={checkVerifyPhoneCode}
237
240
  cleanErrorsState={cleanErrorsState}
241
+ useWhatsappVerification={useWhatsappVerification}
238
242
  />
239
243
  )}
240
244
  </>