ordering-ui-external 14.1.99 → 14.2.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.
Files changed (19) hide show
  1. package/_bundles/{7.ordering-ui.d7f11b55444bf5fe5d10.js → 7.ordering-ui.8d0a7561ec9cfa16ed5a.js} +1 -1
  2. package/_bundles/{ordering-ui.d7f11b55444bf5fe5d10.js → ordering-ui.8d0a7561ec9cfa16ed5a.js} +2 -2
  3. package/_modules/themes/five/src/components/LoginForm/index.js +2 -1
  4. package/_modules/themes/five/src/components/SignUpForm/index.js +2 -1
  5. package/_modules/themes/five/src/components/UserVerification/index.js +39 -5
  6. package/package.json +2 -2
  7. package/src/themes/five/src/components/LoginForm/index.js +1 -1
  8. package/src/themes/five/src/components/SignUpForm/index.js +1 -1
  9. package/src/themes/five/src/components/UserVerification/index.js +40 -12
  10. /package/_bundles/{0.ordering-ui.d7f11b55444bf5fe5d10.js → 0.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  11. /package/_bundles/{1.ordering-ui.d7f11b55444bf5fe5d10.js → 1.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  12. /package/_bundles/{2.ordering-ui.d7f11b55444bf5fe5d10.js → 2.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  13. /package/_bundles/{4.ordering-ui.d7f11b55444bf5fe5d10.js → 4.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  14. /package/_bundles/{5.ordering-ui.d7f11b55444bf5fe5d10.js → 5.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  15. /package/_bundles/{6.ordering-ui.d7f11b55444bf5fe5d10.js → 6.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  16. /package/_bundles/{7.ordering-ui.d7f11b55444bf5fe5d10.js.LICENSE.txt → 7.ordering-ui.8d0a7561ec9cfa16ed5a.js.LICENSE.txt} +0 -0
  17. /package/_bundles/{8.ordering-ui.d7f11b55444bf5fe5d10.js → 8.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  18. /package/_bundles/{9.ordering-ui.d7f11b55444bf5fe5d10.js → 9.ordering-ui.8d0a7561ec9cfa16ed5a.js} +0 -0
  19. /package/_bundles/{ordering-ui.d7f11b55444bf5fe5d10.js.LICENSE.txt → ordering-ui.8d0a7561ec9cfa16ed5a.js.LICENSE.txt} +0 -0
@@ -578,7 +578,8 @@ var LoginFormUI = function LoginFormUI(props) {
578
578
  })), !willVerifyOtpState && isOtpCellphone && useLoginOtpWhatsapp ? /*#__PURE__*/_react.default.createElement("div", {
579
579
  style: {
580
580
  display: 'flex',
581
- gap: 10
581
+ gap: 10,
582
+ width: '100%'
582
583
  }
583
584
  }, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
584
585
  color: "primary",
@@ -536,7 +536,8 @@ var SignUpFormUI = function SignUpFormUI(props) {
536
536
  }, t('TERMS_AND_CONDITIONS', 'Terms & Conditions')))))), signUpTab === 'otpCellphone' && useSignUpOtpWhatsapp ? /*#__PURE__*/_react.default.createElement("div", {
537
537
  style: {
538
538
  display: 'flex',
539
- gap: 10
539
+ gap: 10,
540
+ width: '100%'
540
541
  }
541
542
  }, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
542
543
  color: "primary",
@@ -48,7 +48,8 @@ var UserVerificationUI = function UserVerificationUI(props) {
48
48
  sendVerifyPhoneCode = props.sendVerifyPhoneCode,
49
49
  checkVerifyEmailCode = props.checkVerifyEmailCode,
50
50
  checkVerifyPhoneCode = props.checkVerifyPhoneCode,
51
- cleanErrorsState = props.cleanErrorsState;
51
+ cleanErrorsState = props.cleanErrorsState,
52
+ useWhatsappVerification = props.useWhatsappVerification;
52
53
  var _useLanguage = (0, _orderingComponentsExternal.useLanguage)(),
53
54
  _useLanguage2 = _slicedToArray(_useLanguage, 2),
54
55
  t = _useLanguage2[1];
@@ -86,6 +87,10 @@ var UserVerificationUI = function UserVerificationUI(props) {
86
87
  _useState0 = _slicedToArray(_useState9, 2),
87
88
  modalIsOpen = _useState0[0],
88
89
  setModalIsOpen = _useState0[1];
90
+ var _useState1 = (0, _react.useState)(2),
91
+ _useState10 = _slicedToArray(_useState1, 2),
92
+ selectedChannel = _useState10[0],
93
+ setSelectedChannel = _useState10[1];
89
94
  var isEmailVerifyRequired = auth && (configs === null || configs === void 0 || (_configs$verification = configs.verification_email_required) === null || _configs$verification === void 0 ? void 0 : _configs$verification.value) === '1' && !(user !== null && user !== void 0 && user.email_verified);
90
95
  var isPhoneVerifyRequired = auth && (configs === null || configs === void 0 || (_configs$verification2 = configs.verification_phone_required) === null || _configs$verification2 === void 0 ? void 0 : _configs$verification2.value) === '1' && !(user !== null && user !== void 0 && user.phone_verified);
91
96
  var phoneLength = (phoneState === null || phoneState === void 0 ? void 0 : phoneState.cellphone) && (phoneState === null || phoneState === void 0 ? void 0 : phoneState.country_phone_code) && (phoneState === null || phoneState === void 0 || (_phoneState$cellphone = phoneState.cellphone) === null || _phoneState$cellphone === void 0 || (_phoneState$cellphone = _phoneState$cellphone.split('')) === null || _phoneState$cellphone === void 0 ? void 0 : _phoneState$cellphone.length);
@@ -95,12 +100,15 @@ var UserVerificationUI = function UserVerificationUI(props) {
95
100
  otpLeftTime = _useCountdownTimer2[0],
96
101
  resetOtpLeftTime = _useCountdownTimer2[2];
97
102
  var numOtpInputs = isEmailVerifyRequired ? 6 : 4;
98
- var handleSendOtp = function handleSendOtp(opt) {
103
+ var handleSendOtp = function handleSendOtp(opt, channel) {
99
104
  resetOtpLeftTime();
100
105
  if (opt === 'phone') {
106
+ var ch = channel || 2;
107
+ setSelectedChannel(ch);
101
108
  sendVerifyPhoneCode({
102
109
  cellphone: phoneState === null || phoneState === void 0 ? void 0 : phoneState.cellphone,
103
- country_phone_code: phoneState === null || phoneState === void 0 ? void 0 : phoneState.country_phone_code
110
+ country_phone_code: phoneState === null || phoneState === void 0 ? void 0 : phoneState.country_phone_code,
111
+ channel: ch
104
112
  });
105
113
  return;
106
114
  }
@@ -236,7 +244,33 @@ var UserVerificationUI = function UserVerificationUI(props) {
236
244
  disabled: !!(phoneState !== null && phoneState !== void 0 && phoneState.formatted),
237
245
  setValue: function setValue() {},
238
246
  handleIsValid: function handleIsValid() {}
239
- })), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
247
+ })), useWhatsappVerification ? /*#__PURE__*/_react.default.createElement("div", {
248
+ style: {
249
+ display: 'flex',
250
+ gap: 10,
251
+ width: '100%'
252
+ }
253
+ }, /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
254
+ type: "button",
255
+ color: "primary",
256
+ disabled: (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingSendCode) || (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingCheckCode),
257
+ onClick: function onClick() {
258
+ return handleSendOtp('phone', 2);
259
+ },
260
+ style: {
261
+ flex: 1
262
+ }
263
+ }, t('SEND_BY_SMS', 'Send by SMS')), /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
264
+ type: "button",
265
+ color: "primary",
266
+ disabled: (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingSendCode) || (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingCheckCode),
267
+ onClick: function onClick() {
268
+ return handleSendOtp('phone', 4);
269
+ },
270
+ style: {
271
+ flex: 1
272
+ }
273
+ }, t('SEND_BY_WHATSAPP', 'Send by WhatsApp'))) : /*#__PURE__*/_react.default.createElement(_Buttons.Button, {
240
274
  type: "button",
241
275
  color: "primary",
242
276
  disabled: (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingSendCode) || (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingCheckCode),
@@ -284,7 +318,7 @@ var UserVerificationUI = function UserVerificationUI(props) {
284
318
  color: "secundary",
285
319
  disabled: (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingSendCode) || (verifyPhoneState === null || verifyPhoneState === void 0 ? void 0 : verifyPhoneState.loadingCheckCode),
286
320
  onClick: function onClick() {
287
- return handleSendOtp('phone');
321
+ return handleSendOtp('phone', selectedChannel);
288
322
  }
289
323
  }, t('RESEND_AGAIN', 'Resend again?'))))))), modalIsOpen && /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
290
324
  title: t('UPDATE_PROFILE', 'Update Profile'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-external",
3
- "version": "14.1.99",
3
+ "version": "14.2.0",
4
4
  "description": "Ordering UI Components",
5
5
  "main": "./_modules/index.js",
6
6
  "exports": {
@@ -88,7 +88,7 @@
88
88
  "lodash": "^4.17.19",
89
89
  "moment": "^2.29.4",
90
90
  "nanoid": "^4.0.0",
91
- "ordering-components-external": "13.2.31",
91
+ "ordering-components-external": "13.2.33",
92
92
  "payment": "^2.4.6",
93
93
  "polished": "^3.6.6",
94
94
  "react-bootstrap-icons": "^1.7.2",
@@ -620,7 +620,7 @@ const LoginFormUI = (props) => {
620
620
  )}
621
621
  {(!willVerifyOtpState && isOtpCellphone && useLoginOtpWhatsapp)
622
622
  ? (
623
- <div style={{ display: 'flex', gap: 10 }}>
623
+ <div style={{ display: 'flex', gap: 10, width: '100%' }}>
624
624
  <Button
625
625
  color='primary'
626
626
  type='button'
@@ -615,7 +615,7 @@ const SignUpFormUI = (props) => {
615
615
 
616
616
  {(signUpTab === 'otpCellphone' && useSignUpOtpWhatsapp)
617
617
  ? (
618
- <div style={{ display: 'flex', gap: 10 }}>
618
+ <div style={{ display: 'flex', gap: 10, width: '100%' }}>
619
619
  <Button
620
620
  color='primary'
621
621
  type='button'
@@ -51,7 +51,8 @@ const UserVerificationUI = (props) => {
51
51
  sendVerifyPhoneCode,
52
52
  checkVerifyEmailCode,
53
53
  checkVerifyPhoneCode,
54
- cleanErrorsState
54
+ cleanErrorsState,
55
+ useWhatsappVerification
55
56
  } = props
56
57
 
57
58
  const [, t] = useLanguage()
@@ -63,6 +64,7 @@ const UserVerificationUI = (props) => {
63
64
 
64
65
  const [phoneState, setPhoneState] = useState(null)
65
66
  const [modalIsOpen, setModalIsOpen] = useState(false)
67
+ const [selectedChannel, setSelectedChannel] = useState(2)
66
68
 
67
69
  const isEmailVerifyRequired = auth && configs?.verification_email_required?.value === '1' && !user?.email_verified
68
70
  const isPhoneVerifyRequired = auth && configs?.verification_phone_required?.value === '1' && !user?.phone_verified
@@ -79,12 +81,15 @@ const UserVerificationUI = (props) => {
79
81
 
80
82
  const numOtpInputs = isEmailVerifyRequired ? 6 : 4
81
83
 
82
- const handleSendOtp = (opt) => {
84
+ const handleSendOtp = (opt, channel) => {
83
85
  resetOtpLeftTime()
84
86
  if (opt === 'phone') {
87
+ const ch = channel || 2
88
+ setSelectedChannel(ch)
85
89
  sendVerifyPhoneCode({
86
90
  cellphone: phoneState?.cellphone,
87
- country_phone_code: phoneState?.country_phone_code
91
+ country_phone_code: phoneState?.country_phone_code,
92
+ channel: ch
88
93
  })
89
94
  return
90
95
  }
@@ -287,14 +292,37 @@ const UserVerificationUI = (props) => {
287
292
  handleIsValid={() => { }}
288
293
  />
289
294
  </InputWrapper>
290
- <Button
291
- type='button'
292
- color='primary'
293
- disabled={verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
294
- onClick={() => handleSendOtp('phone')}
295
- >
296
- {t('SEND_CODE', 'Send code')}
297
- </Button>
295
+ {useWhatsappVerification ? (
296
+ <div style={{ display: 'flex', gap: 10, width: '100%' }}>
297
+ <Button
298
+ type='button'
299
+ color='primary'
300
+ disabled={verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
301
+ onClick={() => handleSendOtp('phone', 2)}
302
+ style={{ flex: 1 }}
303
+ >
304
+ {t('SEND_BY_SMS', 'Send by SMS')}
305
+ </Button>
306
+ <Button
307
+ type='button'
308
+ color='primary'
309
+ disabled={verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
310
+ onClick={() => handleSendOtp('phone', 4)}
311
+ style={{ flex: 1 }}
312
+ >
313
+ {t('SEND_BY_WHATSAPP', 'Send by WhatsApp')}
314
+ </Button>
315
+ </div>
316
+ ) : (
317
+ <Button
318
+ type='button'
319
+ color='primary'
320
+ disabled={verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
321
+ onClick={() => handleSendOtp('phone')}
322
+ >
323
+ {t('SEND_CODE', 'Send code')}
324
+ </Button>
325
+ )}
298
326
  </>
299
327
  ) : (
300
328
  <>
@@ -350,7 +378,7 @@ const UserVerificationUI = (props) => {
350
378
  type='button'
351
379
  color='secundary'
352
380
  disabled={verifyPhoneState?.loadingSendCode || verifyPhoneState?.loadingCheckCode}
353
- onClick={() => handleSendOtp('phone')}
381
+ onClick={() => handleSendOtp('phone', selectedChannel)}
354
382
  >
355
383
  {t('RESEND_AGAIN', 'Resend again?')}
356
384
  </Button>