powr-sdk-web 6.17.2 → 6.18.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/dist/auth/index.js +45 -24
- package/package.json +1 -1
package/dist/auth/index.js
CHANGED
|
@@ -32,6 +32,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
32
32
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
33
33
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
34
34
|
var config = require('../config');
|
|
35
|
+
var DEFAULT_WHATSAPP_HELP_URL = 'https://wa.me/919833189399';
|
|
35
36
|
var PowrLogin = function PowrLogin(_ref) {
|
|
36
37
|
var apiUrl = _ref.apiUrl,
|
|
37
38
|
onLogin = _ref.onLogin,
|
|
@@ -46,7 +47,7 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
46
47
|
_ref$showForgotPasswo = _ref.showForgotPassword,
|
|
47
48
|
showForgotPassword = _ref$showForgotPasswo === void 0 ? true : _ref$showForgotPasswo,
|
|
48
49
|
_ref$passwordResetHel = _ref.passwordResetHelpUrl,
|
|
49
|
-
passwordResetHelpUrl = _ref$passwordResetHel === void 0 ?
|
|
50
|
+
passwordResetHelpUrl = _ref$passwordResetHel === void 0 ? DEFAULT_WHATSAPP_HELP_URL : _ref$passwordResetHel,
|
|
50
51
|
_ref$passwordResetHel2 = _ref.passwordResetHelpLabel,
|
|
51
52
|
passwordResetHelpLabel = _ref$passwordResetHel2 === void 0 ? 'Forgot password? WhatsApp us' : _ref$passwordResetHel2,
|
|
52
53
|
_ref$forgotPasswordCh = _ref.forgotPasswordChannel,
|
|
@@ -73,6 +74,7 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
73
74
|
var projectId = projectIdProp || config.projectId;
|
|
74
75
|
var resolvedDefaultCountry = (0, _phone.resolveCountry)(defaultCountry, defaultCountryCode);
|
|
75
76
|
var resetChannel = forgotPasswordChannel || (otpReset ? 'otp' : 'whatsapp');
|
|
77
|
+
var helpUrl = passwordResetHelpUrl || DEFAULT_WHATSAPP_HELP_URL;
|
|
76
78
|
var _useState = (0, _react.useState)(function () {
|
|
77
79
|
switch (mode) {
|
|
78
80
|
case 'login':
|
|
@@ -544,28 +546,37 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
544
546
|
setLoginGate('password');
|
|
545
547
|
return _context4.a(2);
|
|
546
548
|
case 8:
|
|
547
|
-
if (!(ok &&
|
|
549
|
+
if (!(ok && !data.exists)) {
|
|
548
550
|
_context4.n = 9;
|
|
549
551
|
break;
|
|
550
552
|
}
|
|
551
|
-
|
|
553
|
+
setIsLogin(false);
|
|
554
|
+
setLoginGate('password');
|
|
555
|
+
setSuccess('New number. Set a password to create your PowrAccount.');
|
|
552
556
|
return _context4.a(2);
|
|
553
557
|
case 9:
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
558
|
+
if (!(ok && data.exists && !data.hasPassword)) {
|
|
559
|
+
_context4.n = 10;
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
setLoginGate('help');
|
|
563
|
+
return _context4.a(2);
|
|
557
564
|
case 10:
|
|
558
|
-
_context4.p = 10;
|
|
559
|
-
_t5 = _context4.v;
|
|
560
565
|
setLoginGate('password');
|
|
566
|
+
_context4.n = 12;
|
|
567
|
+
break;
|
|
561
568
|
case 11:
|
|
562
569
|
_context4.p = 11;
|
|
563
|
-
|
|
564
|
-
|
|
570
|
+
_t5 = _context4.v;
|
|
571
|
+
setLoginGate('password');
|
|
565
572
|
case 12:
|
|
573
|
+
_context4.p = 12;
|
|
574
|
+
setLoading(false);
|
|
575
|
+
return _context4.f(12);
|
|
576
|
+
case 13:
|
|
566
577
|
return _context4.a(2);
|
|
567
578
|
}
|
|
568
|
-
}, _callee4, null, [[2,
|
|
579
|
+
}, _callee4, null, [[2, 11, 12, 13]]);
|
|
569
580
|
}));
|
|
570
581
|
return function continuePhone() {
|
|
571
582
|
return _ref6.apply(this, arguments);
|
|
@@ -1174,7 +1185,7 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
1174
1185
|
fontSize: 14,
|
|
1175
1186
|
fontWeight: 400
|
|
1176
1187
|
})
|
|
1177
|
-
}, loginGate === 'password' ? 'Enter your password.' : smsResetStep === 'otp' ? 'Enter the code we sent.' : loginGate === 'help' ? 'WhatsApp us to
|
|
1188
|
+
}, loginGate === 'password' ? 'Enter your password.' : smsResetStep === 'otp' ? 'Enter the code we sent.' : loginGate === 'help' ? 'WhatsApp us to reset.' : smsResetStep === 'password' ? 'Set a password for next time.' : 'Enter your mobile number.') : null, showTooltip && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1178
1189
|
style: styles.tooltip
|
|
1179
1190
|
}, "Secure authentication powered by Lawazia Tech"))), authView === 'add-name' && pendingAuth ? /*#__PURE__*/_react["default"].createElement(_profileNameStep.profileNameStep.Component, {
|
|
1180
1191
|
ctx: {
|
|
@@ -1229,7 +1240,7 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
1229
1240
|
value: formData.phoneOrEmail,
|
|
1230
1241
|
country: phoneCountry,
|
|
1231
1242
|
onChange: handleRegisterPhoneChange,
|
|
1232
|
-
international:
|
|
1243
|
+
international: international,
|
|
1233
1244
|
allowedCountries: allowedCountries,
|
|
1234
1245
|
defaultCountry: resolvedDefaultCountry,
|
|
1235
1246
|
inputStyle: _objectSpread({}, fieldErrors.phoneOrEmail ? styles.inputError : {})
|
|
@@ -1334,8 +1345,8 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
1334
1345
|
style: styles.otpSection
|
|
1335
1346
|
}, /*#__PURE__*/_react["default"].createElement("p", {
|
|
1336
1347
|
style: styles.otpText
|
|
1337
|
-
}, "
|
|
1338
|
-
href:
|
|
1348
|
+
}, "This number already has a PowrAccount but no password yet. WhatsApp us to reset."), /*#__PURE__*/_react["default"].createElement("a", {
|
|
1349
|
+
href: helpUrl,
|
|
1339
1350
|
target: "_blank",
|
|
1340
1351
|
rel: "noopener noreferrer",
|
|
1341
1352
|
style: _objectSpread(_objectSpread({}, styles.otpButton), {}, {
|
|
@@ -1343,9 +1354,7 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
1343
1354
|
textAlign: 'center',
|
|
1344
1355
|
textDecoration: 'none'
|
|
1345
1356
|
})
|
|
1346
|
-
},
|
|
1347
|
-
style: styles.otpText
|
|
1348
|
-
}, "WhatsApp the app\u2019s support number."), /*#__PURE__*/_react["default"].createElement("button", {
|
|
1357
|
+
}, "WhatsApp us"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
1349
1358
|
type: "button",
|
|
1350
1359
|
onClick: function onClick() {
|
|
1351
1360
|
setLoginGate('password');
|
|
@@ -1424,7 +1433,21 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
1424
1433
|
style: _objectSpread(_objectSpread({}, styles.spinner), {}, {
|
|
1425
1434
|
animation: 'spin 1s linear infinite'
|
|
1426
1435
|
})
|
|
1427
|
-
}) : isLogin ? loginGate === 'password' ? 'Sign In' : 'Continue' : 'Sign Up'), isLogin &&
|
|
1436
|
+
}) : isLogin ? loginGate === 'password' ? 'Sign In' : 'Continue' : 'Sign Up'), !isLogin && !smsResetStep && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1437
|
+
style: {
|
|
1438
|
+
textAlign: 'center',
|
|
1439
|
+
marginTop: 12
|
|
1440
|
+
}
|
|
1441
|
+
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
1442
|
+
type: "button",
|
|
1443
|
+
onClick: function onClick() {
|
|
1444
|
+
setIsLogin(true);
|
|
1445
|
+
setLoginGate('phone');
|
|
1446
|
+
setError('');
|
|
1447
|
+
setSuccess('');
|
|
1448
|
+
},
|
|
1449
|
+
style: styles.forgotPasswordLink
|
|
1450
|
+
}, "I already have a password")), isLogin && loginGate === 'password' && !smsResetStep && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1428
1451
|
style: {
|
|
1429
1452
|
textAlign: 'center',
|
|
1430
1453
|
marginTop: 12
|
|
@@ -1434,14 +1457,12 @@ var PowrLogin = function PowrLogin(_ref) {
|
|
|
1434
1457
|
onClick: handleSmsForgotStart,
|
|
1435
1458
|
disabled: otpLoading,
|
|
1436
1459
|
style: styles.forgotPasswordLink
|
|
1437
|
-
}, otpLoading ? 'Sending a code…' : 'Forgot password? Get a code') :
|
|
1438
|
-
href:
|
|
1460
|
+
}, otpLoading ? 'Sending a code…' : 'Forgot password? Get a code') : /*#__PURE__*/_react["default"].createElement("a", {
|
|
1461
|
+
href: helpUrl,
|
|
1439
1462
|
target: "_blank",
|
|
1440
1463
|
rel: "noopener noreferrer",
|
|
1441
1464
|
style: styles.forgotPasswordLink
|
|
1442
|
-
}, passwordResetHelpLabel)
|
|
1443
|
-
style: styles.forgotPasswordLink
|
|
1444
|
-
}, "Forgot password? WhatsApp us"))))), showOtpModal && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1465
|
+
}, passwordResetHelpLabel))))), showOtpModal && /*#__PURE__*/_react["default"].createElement("div", {
|
|
1445
1466
|
style: styles.modalOverlay
|
|
1446
1467
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
1447
1468
|
style: styles.modalContent
|