@rownd/react-native 0.2.5 → 2.1.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/LICENSE +1 -2
- package/README.md +15 -52
- package/android/build.gradle +127 -37
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/reactnativerowndplugin/RowndPluginModule.kt +98 -0
- package/android/src/main/java/com/reactnativerowndplugin/RowndPluginPackage.kt +16 -0
- package/ios/{ReactNative.xcodeproj → Rownd.xcodeproj}/project.pbxproj +13 -12
- package/ios/Rownd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/ios/RowndPlugin-Bridging-Header.h +3 -0
- package/ios/RowndPlugin.m +26 -0
- package/ios/RowndPlugin.swift +83 -0
- package/ios/RowndPluginEventEmitter.m +12 -0
- package/ios/RowndPluginEventEmitter.swift +19 -0
- package/lib/commonjs/components/GlobalContext.js +30 -298
- package/lib/commonjs/components/GlobalContext.js.map +1 -1
- package/lib/commonjs/components/{BottomSheetTextInput/types.js → GlobalContext.types.js} +1 -1
- package/lib/commonjs/components/GlobalContext.types.js.map +1 -0
- package/lib/commonjs/constants/action.js +13 -0
- package/lib/commonjs/constants/action.js.map +1 -0
- package/lib/commonjs/hooks/rownd.js +15 -146
- package/lib/commonjs/hooks/rownd.js.map +1 -1
- package/lib/commonjs/index.js +2 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/reducer/rowndReducer.js +89 -0
- package/lib/commonjs/reducer/rowndReducer.js.map +1 -0
- package/lib/commonjs/utils/config.js +0 -26
- package/lib/commonjs/utils/config.js.map +1 -1
- package/lib/commonjs/utils/nativeModule.js +72 -0
- package/lib/commonjs/utils/nativeModule.js.map +1 -0
- package/lib/module/components/GlobalContext.js +29 -293
- package/lib/module/components/GlobalContext.js.map +1 -1
- package/lib/module/components/GlobalContext.types.js +2 -0
- package/lib/module/components/GlobalContext.types.js.map +1 -0
- package/lib/module/constants/action.js +6 -0
- package/lib/module/constants/action.js.map +1 -0
- package/lib/module/hooks/rownd.js +12 -137
- package/lib/module/hooks/rownd.js.map +1 -1
- package/lib/module/index.js +2 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/reducer/rowndReducer.js +78 -0
- package/lib/module/reducer/rowndReducer.js.map +1 -0
- package/lib/module/utils/config.js +1 -16
- package/lib/module/utils/config.js.map +1 -1
- package/lib/module/utils/nativeModule.js +48 -0
- package/lib/module/utils/nativeModule.js.map +1 -0
- package/lib/typescript/components/GlobalContext.d.ts +13 -0
- package/lib/typescript/{src/components/GlobalContext.d.ts → components/GlobalContext.types.d.ts} +9 -35
- package/lib/typescript/constants/action.d.ts +7 -0
- package/lib/typescript/{src/hooks → hooks}/rownd.d.ts +10 -13
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/reducer/rowndReducer.d.ts +4 -0
- package/lib/typescript/utils/config.d.ts +10 -0
- package/lib/typescript/utils/nativeModule.d.ts +10 -0
- package/package.json +36 -56
- package/rownd-react-native.podspec +36 -0
- package/src/components/GlobalContext.tsx +44 -457
- package/src/components/GlobalContext.types.ts +105 -0
- package/src/constants/action.ts +8 -0
- package/src/hooks/rownd.ts +29 -147
- package/src/index.tsx +2 -4
- package/src/reducer/rowndReducer.ts +78 -0
- package/src/utils/config.ts +0 -27
- package/src/utils/nativeModule.ts +69 -0
- package/android/src/main/java/com/reactnative/ReactNativePackage.java +0 -22
- package/android/src/main/java/com/reactnative/ReactNativeViewManager.java +0 -31
- package/ios/ReactNativeViewManager.m +0 -34
- package/lib/commonjs/assets/images/checkmark--filled.svg +0 -12
- package/lib/commonjs/assets/images/email-verify-waiting.svg +0 -36
- package/lib/commonjs/assets/images/error-icon-material.svg +0 -1
- package/lib/commonjs/assets/images/phone-verify-waiting.svg +0 -26
- package/lib/commonjs/components/AuthenticatedComponent.js +0 -35
- package/lib/commonjs/components/AuthenticatedComponent.js.map +0 -1
- package/lib/commonjs/components/AutoSigninDialog.js +0 -132
- package/lib/commonjs/components/AutoSigninDialog.js.map +0 -1
- package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js +0 -65
- package/lib/commonjs/components/BottomSheetTextInput/BottomSheetTextInput.js.map +0 -1
- package/lib/commonjs/components/BottomSheetTextInput/index.js +0 -24
- package/lib/commonjs/components/BottomSheetTextInput/index.js.map +0 -1
- package/lib/commonjs/components/BottomSheetTextInput/types.js.map +0 -1
- package/lib/commonjs/components/DarkText.js +0 -35
- package/lib/commonjs/components/DarkText.js.map +0 -1
- package/lib/commonjs/components/DefaultContext.js +0 -266
- package/lib/commonjs/components/DefaultContext.js.map +0 -1
- package/lib/commonjs/components/RowndComponents.js +0 -25
- package/lib/commonjs/components/RowndComponents.js.map +0 -1
- package/lib/commonjs/components/RowndProvider.js +0 -55
- package/lib/commonjs/components/RowndProvider.js.map +0 -1
- package/lib/commonjs/components/SignIn.js +0 -644
- package/lib/commonjs/components/SignIn.js.map +0 -1
- package/lib/commonjs/components/images/CheckmarkFilled.js +0 -40
- package/lib/commonjs/components/images/CheckmarkFilled.js.map +0 -1
- package/lib/commonjs/components/images/EmailVerifyWaiting.js +0 -100
- package/lib/commonjs/components/images/EmailVerifyWaiting.js.map +0 -1
- package/lib/commonjs/components/images/ErrorIcon.js +0 -31
- package/lib/commonjs/components/images/ErrorIcon.js.map +0 -1
- package/lib/commonjs/components/images/PhoneVerifyWaiting.js +0 -91
- package/lib/commonjs/components/images/PhoneVerifyWaiting.js.map +0 -1
- package/lib/commonjs/data/actions.js +0 -26
- package/lib/commonjs/data/actions.js.map +0 -1
- package/lib/commonjs/hooks/api.js +0 -155
- package/lib/commonjs/hooks/api.js.map +0 -1
- package/lib/commonjs/hooks/debounce.js +0 -38
- package/lib/commonjs/hooks/debounce.js.map +0 -1
- package/lib/commonjs/hooks/fingerprint.js +0 -176
- package/lib/commonjs/hooks/fingerprint.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -48
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/interval.js +0 -31
- package/lib/commonjs/hooks/interval.js.map +0 -1
- package/lib/commonjs/hooks/nav.js +0 -39
- package/lib/commonjs/hooks/nav.js.map +0 -1
- package/lib/commonjs/index.tsx.bak +0 -26
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/events.js +0 -57
- package/lib/commonjs/utils/events.js.map +0 -1
- package/lib/commonjs/utils/form.js +0 -46
- package/lib/commonjs/utils/form.js.map +0 -1
- package/lib/commonjs/utils/queue.js +0 -117
- package/lib/commonjs/utils/queue.js.map +0 -1
- package/lib/commonjs/utils/storage.js +0 -15
- package/lib/commonjs/utils/storage.js.map +0 -1
- package/lib/commonjs/utils/tokens.js +0 -35
- package/lib/commonjs/utils/tokens.js.map +0 -1
- package/lib/commonjs/utils/user-data.js +0 -21
- package/lib/commonjs/utils/user-data.js.map +0 -1
- package/lib/module/assets/images/checkmark--filled.svg +0 -12
- package/lib/module/assets/images/email-verify-waiting.svg +0 -36
- package/lib/module/assets/images/error-icon-material.svg +0 -1
- package/lib/module/assets/images/phone-verify-waiting.svg +0 -26
- package/lib/module/components/AuthenticatedComponent.js +0 -24
- package/lib/module/components/AuthenticatedComponent.js.map +0 -1
- package/lib/module/components/AutoSigninDialog.js +0 -110
- package/lib/module/components/AutoSigninDialog.js.map +0 -1
- package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js +0 -52
- package/lib/module/components/BottomSheetTextInput/BottomSheetTextInput.js.map +0 -1
- package/lib/module/components/BottomSheetTextInput/index.js +0 -5
- package/lib/module/components/BottomSheetTextInput/index.js.map +0 -1
- package/lib/module/components/BottomSheetTextInput/types.js +0 -2
- package/lib/module/components/BottomSheetTextInput/types.js.map +0 -1
- package/lib/module/components/DarkText.js +0 -24
- package/lib/module/components/DarkText.js.map +0 -1
- package/lib/module/components/DefaultContext.js +0 -244
- package/lib/module/components/DefaultContext.js.map +0 -1
- package/lib/module/components/RowndComponents.js +0 -12
- package/lib/module/components/RowndComponents.js.map +0 -1
- package/lib/module/components/RowndProvider.js +0 -39
- package/lib/module/components/RowndProvider.js.map +0 -1
- package/lib/module/components/SignIn.js +0 -616
- package/lib/module/components/SignIn.js.map +0 -1
- package/lib/module/components/images/CheckmarkFilled.js +0 -27
- package/lib/module/components/images/CheckmarkFilled.js.map +0 -1
- package/lib/module/components/images/EmailVerifyWaiting.js +0 -87
- package/lib/module/components/images/EmailVerifyWaiting.js.map +0 -1
- package/lib/module/components/images/ErrorIcon.js +0 -18
- package/lib/module/components/images/ErrorIcon.js.map +0 -1
- package/lib/module/components/images/PhoneVerifyWaiting.js +0 -78
- package/lib/module/components/images/PhoneVerifyWaiting.js.map +0 -1
- package/lib/module/data/actions.js +0 -19
- package/lib/module/data/actions.js.map +0 -1
- package/lib/module/hooks/api.js +0 -135
- package/lib/module/hooks/api.js.map +0 -1
- package/lib/module/hooks/debounce.js +0 -29
- package/lib/module/hooks/debounce.js.map +0 -1
- package/lib/module/hooks/fingerprint.js +0 -157
- package/lib/module/hooks/fingerprint.js.map +0 -1
- package/lib/module/hooks/index.js +0 -7
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/hooks/interval.js +0 -23
- package/lib/module/hooks/interval.js.map +0 -1
- package/lib/module/hooks/nav.js +0 -30
- package/lib/module/hooks/nav.js.map +0 -1
- package/lib/module/index.tsx.bak +0 -26
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/events.js +0 -45
- package/lib/module/utils/events.js.map +0 -1
- package/lib/module/utils/form.js +0 -34
- package/lib/module/utils/form.js.map +0 -1
- package/lib/module/utils/queue.js +0 -109
- package/lib/module/utils/queue.js.map +0 -1
- package/lib/module/utils/storage.js +0 -6
- package/lib/module/utils/storage.js.map +0 -1
- package/lib/module/utils/tokens.js +0 -24
- package/lib/module/utils/tokens.js.map +0 -1
- package/lib/module/utils/user-data.js +0 -14
- package/lib/module/utils/user-data.js.map +0 -1
- package/lib/package.json +0 -173
- package/lib/typescript/src/components/AuthenticatedComponent.d.ts +0 -7
- package/lib/typescript/src/components/AutoSigninDialog.d.ts +0 -2
- package/lib/typescript/src/components/BottomSheetTextInput/BottomSheetTextInput.d.ts +0 -4
- package/lib/typescript/src/components/BottomSheetTextInput/index.d.ts +0 -2
- package/lib/typescript/src/components/BottomSheetTextInput/types.d.ts +0 -3
- package/lib/typescript/src/components/DarkText.d.ts +0 -3
- package/lib/typescript/src/components/DefaultContext.d.ts +0 -12
- package/lib/typescript/src/components/RowndComponents.d.ts +0 -2
- package/lib/typescript/src/components/RowndProvider.d.ts +0 -8
- package/lib/typescript/src/components/SignIn.d.ts +0 -2
- package/lib/typescript/src/components/images/CheckmarkFilled.d.ts +0 -4
- package/lib/typescript/src/components/images/EmailVerifyWaiting.d.ts +0 -4
- package/lib/typescript/src/components/images/ErrorIcon.d.ts +0 -4
- package/lib/typescript/src/components/images/PhoneVerifyWaiting.d.ts +0 -4
- package/lib/typescript/src/data/actions.d.ts +0 -20
- package/lib/typescript/src/hooks/api.d.ts +0 -12
- package/lib/typescript/src/hooks/debounce.d.ts +0 -5
- package/lib/typescript/src/hooks/fingerprint.d.ts +0 -12
- package/lib/typescript/src/hooks/index.d.ts +0 -6
- package/lib/typescript/src/hooks/interval.d.ts +0 -2
- package/lib/typescript/src/hooks/nav.d.ts +0 -6
- package/lib/typescript/src/index.d.ts +0 -4
- package/lib/typescript/src/types.d.ts +0 -26
- package/lib/typescript/src/utils/config.d.ts +0 -18
- package/lib/typescript/src/utils/events.d.ts +0 -22
- package/lib/typescript/src/utils/form.d.ts +0 -18
- package/lib/typescript/src/utils/queue.d.ts +0 -21
- package/lib/typescript/src/utils/storage.d.ts +0 -3
- package/lib/typescript/src/utils/tokens.d.ts +0 -4
- package/lib/typescript/src/utils/user-data.d.ts +0 -3
- package/react-native.podspec +0 -19
- package/src/assets/images/checkmark--filled.svg +0 -12
- package/src/assets/images/email-verify-waiting.svg +0 -36
- package/src/assets/images/error-icon-material.svg +0 -1
- package/src/assets/images/phone-verify-waiting.svg +0 -26
- package/src/components/AuthenticatedComponent.tsx +0 -30
- package/src/components/AutoSigninDialog.tsx +0 -131
- package/src/components/BottomSheetTextInput/BottomSheetTextInput.tsx +0 -57
- package/src/components/BottomSheetTextInput/index.ts +0 -5
- package/src/components/BottomSheetTextInput/types.ts +0 -3
- package/src/components/DarkText.tsx +0 -16
- package/src/components/DefaultContext.tsx +0 -278
- package/src/components/RowndComponents.tsx +0 -18
- package/src/components/RowndProvider.tsx +0 -56
- package/src/components/SignIn.tsx +0 -797
- package/src/components/images/CheckmarkFilled.tsx +0 -30
- package/src/components/images/EmailVerifyWaiting.tsx +0 -95
- package/src/components/images/ErrorIcon.tsx +0 -11
- package/src/components/images/PhoneVerifyWaiting.tsx +0 -74
- package/src/data/actions.ts +0 -21
- package/src/hooks/api.ts +0 -162
- package/src/hooks/debounce.ts +0 -36
- package/src/hooks/fingerprint.ts +0 -217
- package/src/hooks/index.ts +0 -7
- package/src/hooks/interval.ts +0 -25
- package/src/hooks/nav.tsx +0 -29
- package/src/index.tsx.bak +0 -26
- package/src/types.ts +0 -27
- package/src/utils/events.ts +0 -54
- package/src/utils/form.tsx +0 -64
- package/src/utils/queue.ts +0 -75
- package/src/utils/storage.ts +0 -7
- package/src/utils/tokens.ts +0 -26
- package/src/utils/user-data.ts +0 -15
|
@@ -1,644 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SignIn = SignIn;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _dateFns = require("date-fns");
|
|
11
|
-
|
|
12
|
-
var _reactNative = require("react-native");
|
|
13
|
-
|
|
14
|
-
var _reactNativeSvg = require("react-native-svg");
|
|
15
|
-
|
|
16
|
-
var _phone = _interopRequireDefault(require("phone"));
|
|
17
|
-
|
|
18
|
-
var _jwtDecode = _interopRequireDefault(require("jwt-decode"));
|
|
19
|
-
|
|
20
|
-
var _bottomSheet = require("@gorhom/bottom-sheet");
|
|
21
|
-
|
|
22
|
-
var _BottomSheetTextInput = _interopRequireDefault(require("./BottomSheetTextInput"));
|
|
23
|
-
|
|
24
|
-
var _package = _interopRequireDefault(require("@gorhom/bottom-sheet/package.json"));
|
|
25
|
-
|
|
26
|
-
var _hooks = require("../hooks");
|
|
27
|
-
|
|
28
|
-
var _GlobalContext = require("./GlobalContext");
|
|
29
|
-
|
|
30
|
-
var _actions = require("../data/actions");
|
|
31
|
-
|
|
32
|
-
var _form = require("../utils/form");
|
|
33
|
-
|
|
34
|
-
var _EmailVerifyWaiting = _interopRequireDefault(require("./images/EmailVerifyWaiting"));
|
|
35
|
-
|
|
36
|
-
var _PhoneVerifyWaiting = _interopRequireDefault(require("./images/PhoneVerifyWaiting"));
|
|
37
|
-
|
|
38
|
-
var _CheckmarkFilled = _interopRequireDefault(require("./images/CheckmarkFilled"));
|
|
39
|
-
|
|
40
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
-
|
|
42
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
|
-
|
|
44
|
-
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; }
|
|
45
|
-
|
|
46
|
-
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); }
|
|
47
|
-
|
|
48
|
-
var LoginStep;
|
|
49
|
-
|
|
50
|
-
(function (LoginStep) {
|
|
51
|
-
LoginStep["INIT"] = "init";
|
|
52
|
-
LoginStep["WAITING"] = "waiting";
|
|
53
|
-
LoginStep["SUCCESS"] = "success";
|
|
54
|
-
LoginStep["FAILURE"] = "failure";
|
|
55
|
-
LoginStep["ERROR"] = "error";
|
|
56
|
-
})(LoginStep || (LoginStep = {}));
|
|
57
|
-
|
|
58
|
-
var LoginVerificationStatus;
|
|
59
|
-
|
|
60
|
-
(function (LoginVerificationStatus) {
|
|
61
|
-
LoginVerificationStatus["PENDING"] = "pending";
|
|
62
|
-
LoginVerificationStatus["EXPIRED"] = "expired";
|
|
63
|
-
LoginVerificationStatus["VERIFIED"] = "verified";
|
|
64
|
-
})(LoginVerificationStatus || (LoginVerificationStatus = {}));
|
|
65
|
-
|
|
66
|
-
function SignIn() {
|
|
67
|
-
var _decodedAccessToken, _nav$options, _app$config2, _app$config2$hub, _app$config2$hub$auth, _nav$options4, _nav$options5, _nav$options8, _state$config3, _nav$options10, _state$config5, _app$config5, _app$config6, _app$config6$hub, _app$config6$hub$auth, _app$config7, _app$config7$hub, _app$config7$hub$auth;
|
|
68
|
-
|
|
69
|
-
const navTo = (0, _hooks.useNav)();
|
|
70
|
-
const {
|
|
71
|
-
getFingerprint,
|
|
72
|
-
getChallengeIfPresent,
|
|
73
|
-
clearFingerprint
|
|
74
|
-
} = (0, _hooks.useDeviceFingerprint)();
|
|
75
|
-
const {
|
|
76
|
-
state,
|
|
77
|
-
dispatch
|
|
78
|
-
} = (0, _GlobalContext.useGlobalContext)();
|
|
79
|
-
const {
|
|
80
|
-
config,
|
|
81
|
-
nav,
|
|
82
|
-
app,
|
|
83
|
-
user
|
|
84
|
-
} = state;
|
|
85
|
-
let decodedAccessToken;
|
|
86
|
-
|
|
87
|
-
if (state.auth.access_token) {
|
|
88
|
-
decodedAccessToken = (0, _jwtDecode.default)(state.auth.access_token);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const [userIdentifier, setUserIdentifier] = (0, _react.useState)('');
|
|
92
|
-
const [fieldError, setFieldError] = (0, _react.useState)(null);
|
|
93
|
-
const [step, setStep] = (0, _react.useState)(state.auth.access_token && ((_decodedAccessToken = decodedAccessToken) === null || _decodedAccessToken === void 0 ? void 0 : _decodedAccessToken['https://auth.rownd.io/is_verified_user']) !== false ? LoginStep.SUCCESS : LoginStep.INIT);
|
|
94
|
-
const [error, setError] = (0, _react.useState)('');
|
|
95
|
-
const allowedIdentifiers = (0, _react.useMemo)(() => ['email', 'phone'], []);
|
|
96
|
-
const [requestId, setRequestId] = (0, _react.useState)(null);
|
|
97
|
-
const [loginPollStart, setLoginPollStart] = (0, _react.useState)(null);
|
|
98
|
-
const [isSubmitting, setIsSubmitting] = (0, _react.useState)(false);
|
|
99
|
-
const [loginType, setLoginType] = (0, _react.useState)(null); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
|
-
|
|
101
|
-
const [_phoneDetails, setPhoneDetails] = (0, _react.useState)(null); // TODO: For parity with web, need to use `phoneDetails` to update the input visuals
|
|
102
|
-
|
|
103
|
-
const [isValidUserIdentifier, setIsValidUserIdentifier] = (0, _react.useState)(false);
|
|
104
|
-
const [requiresAdditionalFields, setRequiresAdditionalFields] = (0, _react.useState)(nav === null || nav === void 0 ? void 0 : (_nav$options = nav.options) === null || _nav$options === void 0 ? void 0 : _nav$options.init_data);
|
|
105
|
-
const bottomSheetModalRef = (0, _react.useRef)(null);
|
|
106
|
-
(0, _react.useEffect)(() => {
|
|
107
|
-
if (bottomSheetModalRef.current) {
|
|
108
|
-
bottomSheetModalRef.current.present();
|
|
109
|
-
}
|
|
110
|
-
}, []);
|
|
111
|
-
const addlFieldInit = (0, _react.useCallback)(currentState => {
|
|
112
|
-
var _app$config, _app$config$hub, _app$config$hub$auth, _nav$options2, _nav$options3;
|
|
113
|
-
|
|
114
|
-
const addlFields = app === null || app === void 0 ? void 0 : (_app$config = app.config) === null || _app$config === void 0 ? void 0 : (_app$config$hub = _app$config.hub) === null || _app$config$hub === void 0 ? void 0 : (_app$config$hub$auth = _app$config$hub.auth) === null || _app$config$hub$auth === void 0 ? void 0 : _app$config$hub$auth.additional_fields;
|
|
115
|
-
const addlInputs = (nav === null || nav === void 0 ? void 0 : (_nav$options2 = nav.options) === null || _nav$options2 === void 0 ? void 0 : _nav$options2.init_data) || (nav === null || nav === void 0 ? void 0 : (_nav$options3 = nav.options) === null || _nav$options3 === void 0 ? void 0 : _nav$options3.default_values) || {};
|
|
116
|
-
const newState = {};
|
|
117
|
-
|
|
118
|
-
if (addlFields !== null && addlFields !== void 0 && addlFields.length) {
|
|
119
|
-
for (const field of addlFields) {
|
|
120
|
-
if (field !== null && field !== void 0 && field.options) {
|
|
121
|
-
newState[field.name] = (addlInputs === null || addlInputs === void 0 ? void 0 : addlInputs[field.name]) || field.options[0].value;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return { ...currentState,
|
|
127
|
-
...newState
|
|
128
|
-
};
|
|
129
|
-
}, [app === null || app === void 0 ? void 0 : (_app$config2 = app.config) === null || _app$config2 === void 0 ? void 0 : (_app$config2$hub = _app$config2.hub) === null || _app$config2$hub === void 0 ? void 0 : (_app$config2$hub$auth = _app$config2$hub.auth) === null || _app$config2$hub$auth === void 0 ? void 0 : _app$config2$hub$auth.additional_fields, nav === null || nav === void 0 ? void 0 : (_nav$options4 = nav.options) === null || _nav$options4 === void 0 ? void 0 : _nav$options4.default_values, nav === null || nav === void 0 ? void 0 : (_nav$options5 = nav.options) === null || _nav$options5 === void 0 ? void 0 : _nav$options5.init_data]);
|
|
130
|
-
const fieldReducer = (0, _react.useCallback)((currentState, action) => {
|
|
131
|
-
console.log('fieldReducer', action);
|
|
132
|
-
|
|
133
|
-
switch (action.type) {
|
|
134
|
-
case 'reset':
|
|
135
|
-
return addlFieldInit(currentState);
|
|
136
|
-
|
|
137
|
-
default:
|
|
138
|
-
return { ...currentState,
|
|
139
|
-
...action.payload
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
}, [addlFieldInit]);
|
|
143
|
-
const [addlFieldValues, addlFieldDispatch] = (0, _react.useReducer)(fieldReducer, {}, addlFieldInit);
|
|
144
|
-
const {
|
|
145
|
-
client: api
|
|
146
|
-
} = (0, _hooks.useApi)();
|
|
147
|
-
|
|
148
|
-
function validateEmail(email) {
|
|
149
|
-
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
150
|
-
const isValid = re.test(String(email).toLowerCase());
|
|
151
|
-
|
|
152
|
-
if (!isValid) {
|
|
153
|
-
setFieldError('Invalid email address');
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
setFieldError(null);
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const isValidPhone = (0, _react.useCallback)(() => {
|
|
162
|
-
const phoneResult = (0, _phone.default)(userIdentifier);
|
|
163
|
-
|
|
164
|
-
if (!phoneResult.isValid) {
|
|
165
|
-
setLoginType(null);
|
|
166
|
-
setPhoneDetails(null);
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
setLoginType('phone');
|
|
171
|
-
setPhoneDetails(phoneResult);
|
|
172
|
-
setUserIdentifier(phoneResult.phoneNumber);
|
|
173
|
-
return true;
|
|
174
|
-
}, [userIdentifier]);
|
|
175
|
-
const isValidEmail = (0, _react.useCallback)(() => {
|
|
176
|
-
const emailAtIdx = userIdentifier === null || userIdentifier === void 0 ? void 0 : userIdentifier.indexOf('@');
|
|
177
|
-
const emailSuffixIdx = userIdentifier === null || userIdentifier === void 0 ? void 0 : userIdentifier.substring(emailAtIdx).indexOf('.');
|
|
178
|
-
|
|
179
|
-
if (emailAtIdx > 0 && emailSuffixIdx > 0 && (userIdentifier === null || userIdentifier === void 0 ? void 0 : userIdentifier.substring(emailAtIdx + emailSuffixIdx).length) >= 3) {
|
|
180
|
-
return validateEmail(userIdentifier);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return false;
|
|
184
|
-
}, [userIdentifier]);
|
|
185
|
-
const validateInput = (0, _react.useCallback)(() => {
|
|
186
|
-
const validations = [];
|
|
187
|
-
|
|
188
|
-
if (allowedIdentifiers.includes('phone')) {
|
|
189
|
-
validations.push(isValidPhone);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
if (allowedIdentifiers.includes('email')) {
|
|
193
|
-
validations.push(isValidEmail);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (!validations.some(fn => fn())) {
|
|
197
|
-
setIsValidUserIdentifier(false);
|
|
198
|
-
} else {
|
|
199
|
-
setIsValidUserIdentifier(true);
|
|
200
|
-
}
|
|
201
|
-
}, [allowedIdentifiers, isValidEmail, isValidPhone]); // Fire validation as data changes in field
|
|
202
|
-
|
|
203
|
-
(0, _react.useEffect)(validateInput, [validateInput]);
|
|
204
|
-
const pollLoginStatus = (0, _react.useCallback)(async () => {
|
|
205
|
-
try {
|
|
206
|
-
const resp = await api.post(`hub/auth/challenge_status`, {
|
|
207
|
-
headers: {
|
|
208
|
-
'x-rownd-app-key': config === null || config === void 0 ? void 0 : config.appKey
|
|
209
|
-
},
|
|
210
|
-
json: {
|
|
211
|
-
challenge_id: requestId,
|
|
212
|
-
[loginType === 'phone' ? 'phone' : 'email']: userIdentifier
|
|
213
|
-
}
|
|
214
|
-
}).json();
|
|
215
|
-
let err;
|
|
216
|
-
|
|
217
|
-
switch (resp.status) {
|
|
218
|
-
case 'pending':
|
|
219
|
-
err = new Error('Login challenge is still pending');
|
|
220
|
-
err.code = LoginVerificationStatus.PENDING;
|
|
221
|
-
throw err;
|
|
222
|
-
|
|
223
|
-
case 'expired':
|
|
224
|
-
err = new Error('Login challenge is still pending');
|
|
225
|
-
err.code = LoginVerificationStatus.PENDING;
|
|
226
|
-
throw err;
|
|
227
|
-
|
|
228
|
-
case 'verified':
|
|
229
|
-
break;
|
|
230
|
-
|
|
231
|
-
default:
|
|
232
|
-
err = new Error('Unknown login challenge status');
|
|
233
|
-
throw err;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
dispatch({
|
|
237
|
-
type: _actions.ActionType.LOGIN_SUCCESS,
|
|
238
|
-
payload: resp
|
|
239
|
-
});
|
|
240
|
-
setStep(LoginStep.SUCCESS);
|
|
241
|
-
} catch (err) {
|
|
242
|
-
// logger.log('login poll error', err);
|
|
243
|
-
// If network error, try again up to 1 minute, else fail
|
|
244
|
-
if (!err.code && (0, _dateFns.differenceInMinutes)(Date.now(), loginPollStart) > 0) {
|
|
245
|
-
setStep(LoginStep.ERROR);
|
|
246
|
-
setError('Network error. Please try again later.');
|
|
247
|
-
return;
|
|
248
|
-
} // If request expires, then fail (assume > 6 mins is a failure/expiration)
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if ((err.status || err.code) && (0, _dateFns.differenceInMinutes)(Date.now(), loginPollStart) > 6) {
|
|
252
|
-
setStep(LoginStep.ERROR);
|
|
253
|
-
setError('The sign in request expired.');
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (err.status && err.status >= 400) {
|
|
258
|
-
setStep(LoginStep.FAILURE);
|
|
259
|
-
setError('Sign in unsuccessful.');
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}, [api, config === null || config === void 0 ? void 0 : config.appKey, dispatch, loginPollStart, loginType, requestId, userIdentifier]); // Polling when a login flow is in progress
|
|
263
|
-
|
|
264
|
-
(0, _hooks.useInterval)(pollLoginStatus, step === LoginStep.WAITING ? 5000 : null); // login polling manager
|
|
265
|
-
|
|
266
|
-
(0, _react.useEffect)(() => {
|
|
267
|
-
if (step === LoginStep.SUCCESS) {
|
|
268
|
-
var _nav$options6, _state$config;
|
|
269
|
-
|
|
270
|
-
if (nav !== null && nav !== void 0 && (_nav$options6 = nav.options) !== null && _nav$options6 !== void 0 && _nav$options6.post_login_redirect || (_state$config = state.config) !== null && _state$config !== void 0 && _state$config.postLoginUrl) {
|
|
271
|
-
var _nav$options7, _state$config2;
|
|
272
|
-
|
|
273
|
-
_reactNative.Linking.openURL((nav === null || nav === void 0 ? void 0 : (_nav$options7 = nav.options) === null || _nav$options7 === void 0 ? void 0 : _nav$options7.post_login_redirect) || ((_state$config2 = state.config) === null || _state$config2 === void 0 ? void 0 : _state$config2.postLoginUrl));
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
dispatch({
|
|
277
|
-
type: _actions.ActionType.CHANGE_ROUTE,
|
|
278
|
-
payload: {
|
|
279
|
-
route: '/'
|
|
280
|
-
}
|
|
281
|
-
}); // Reset modal state if this user is unverified, since we'll need to re-submit at some point
|
|
282
|
-
|
|
283
|
-
if (!state.auth.is_verified_user) {
|
|
284
|
-
setStep(LoginStep.INIT);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}, [dispatch, nav === null || nav === void 0 ? void 0 : (_nav$options8 = nav.options) === null || _nav$options8 === void 0 ? void 0 : _nav$options8.post_login_redirect, pollLoginStatus, state.auth.is_verified_user, (_state$config3 = state.config) === null || _state$config3 === void 0 ? void 0 : _state$config3.postLoginUrl, step]);
|
|
288
|
-
const initSignIn = (0, _react.useCallback)(async () => {
|
|
289
|
-
var _nav$options9, _state$config4, _app$config3;
|
|
290
|
-
|
|
291
|
-
if (step === LoginStep.WAITING) {
|
|
292
|
-
return;
|
|
293
|
-
} // Validation
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
if (fieldError) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
const payload = {
|
|
301
|
-
[loginType === 'phone' ? 'phone' : 'email']: userIdentifier,
|
|
302
|
-
return_url: (nav === null || nav === void 0 ? void 0 : (_nav$options9 = nav.options) === null || _nav$options9 === void 0 ? void 0 : _nav$options9.post_login_redirect) || ((_state$config4 = state.config) === null || _state$config4 === void 0 ? void 0 : _state$config4.postLoginUrl),
|
|
303
|
-
user_data: Object.values(user.data).some(f => f !== null && f !== undefined) ? user.data : {} // Include user.data if at least one field is defined
|
|
304
|
-
|
|
305
|
-
}; // Set the user_id to the application's default user id format if it is defined
|
|
306
|
-
|
|
307
|
-
if ((_app$config3 = app.config) !== null && _app$config3 !== void 0 && _app$config3.default_user_id_format) {
|
|
308
|
-
var _app$config4;
|
|
309
|
-
|
|
310
|
-
payload.user_id = (_app$config4 = app.config) === null || _app$config4 === void 0 ? void 0 : _app$config4.default_user_id_format;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
if (requiresAdditionalFields) {
|
|
314
|
-
payload.user_data = { ...payload.user_data,
|
|
315
|
-
...addlFieldValues
|
|
316
|
-
};
|
|
317
|
-
} // Submission
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
try {
|
|
321
|
-
var _payload$fingerprint;
|
|
322
|
-
|
|
323
|
-
setIsSubmitting(true); // Get the browser fingerprint for future sign-ins that don't require re-verification
|
|
324
|
-
|
|
325
|
-
const fingerprint = await getFingerprint();
|
|
326
|
-
const challengeEntry = await getChallengeIfPresent(app.id, [userIdentifier]);
|
|
327
|
-
payload.fingerprint = {
|
|
328
|
-
hash: fingerprint.visitorId,
|
|
329
|
-
challenge: challengeEntry === null || challengeEntry === void 0 ? void 0 : challengeEntry.value
|
|
330
|
-
};
|
|
331
|
-
const resp = await api.post('hub/auth/init', {
|
|
332
|
-
headers: {
|
|
333
|
-
'x-rownd-app-key': config === null || config === void 0 ? void 0 : config.appKey
|
|
334
|
-
},
|
|
335
|
-
json: payload
|
|
336
|
-
}).json(); // This will only be true when a user is signing in for the very first time and
|
|
337
|
-
// the app allows unverified users OR the user was successfully fingerprinted.
|
|
338
|
-
|
|
339
|
-
if (resp.auth_tokens) {
|
|
340
|
-
dispatch({
|
|
341
|
-
type: _actions.ActionType.LOGIN_SUCCESS,
|
|
342
|
-
payload: { ...resp.auth_tokens,
|
|
343
|
-
app_id: app.id
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
setStep(LoginStep.SUCCESS);
|
|
347
|
-
return;
|
|
348
|
-
} else if (payload !== null && payload !== void 0 && (_payload$fingerprint = payload.fingerprint) !== null && _payload$fingerprint !== void 0 && _payload$fingerprint.challenge) {
|
|
349
|
-
// The fingerprint is probably expired, so delete the challenge for re-registration
|
|
350
|
-
try {
|
|
351
|
-
clearFingerprint(payload.fingerprint.challenge);
|
|
352
|
-
} catch (err) {// no-op, but not likely to throw anyway
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
setRequestId(resp.challenge_id);
|
|
357
|
-
setStep(LoginStep.WAITING);
|
|
358
|
-
setLoginPollStart(Date.now());
|
|
359
|
-
} catch (err) {
|
|
360
|
-
// logger.error(err);
|
|
361
|
-
if (err.response.status === 400) {
|
|
362
|
-
setStep(LoginStep.INIT);
|
|
363
|
-
setRequiresAdditionalFields(true);
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
setStep(LoginStep.ERROR);
|
|
368
|
-
setError(err.message);
|
|
369
|
-
} finally {
|
|
370
|
-
setIsSubmitting(false);
|
|
371
|
-
}
|
|
372
|
-
}, [step, fieldError, loginType, userIdentifier, nav === null || nav === void 0 ? void 0 : (_nav$options10 = nav.options) === null || _nav$options10 === void 0 ? void 0 : _nav$options10.post_login_redirect, (_state$config5 = state.config) === null || _state$config5 === void 0 ? void 0 : _state$config5.postLoginUrl, user.data, (_app$config5 = app.config) === null || _app$config5 === void 0 ? void 0 : _app$config5.default_user_id_format, app.id, requiresAdditionalFields, addlFieldValues, getFingerprint, getChallengeIfPresent, api, config === null || config === void 0 ? void 0 : config.appKey, dispatch, clearFingerprint]);
|
|
373
|
-
|
|
374
|
-
const launchRowndWebsite = () => {
|
|
375
|
-
_reactNative.Linking.openURL('https://rownd.io');
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
const handleAddlFieldChange = evt => {
|
|
379
|
-
const target = evt.target;
|
|
380
|
-
const {
|
|
381
|
-
value,
|
|
382
|
-
name
|
|
383
|
-
} = target;
|
|
384
|
-
addlFieldDispatch({
|
|
385
|
-
type: 'default',
|
|
386
|
-
payload: {
|
|
387
|
-
[name]: value
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
const handleClose = (0, _react.useCallback)(() => {
|
|
393
|
-
setTimeout(() => {
|
|
394
|
-
navTo({
|
|
395
|
-
hide: true
|
|
396
|
-
});
|
|
397
|
-
}, 150);
|
|
398
|
-
}, [navTo]);
|
|
399
|
-
const snapPoints = (0, _react.useMemo)(() => ['25%', '70%'], []);
|
|
400
|
-
const renderBackdrop = (0, _react.useCallback)(cbProps => /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetBackdrop, _extends({}, cbProps, {
|
|
401
|
-
pressBehavior: "close"
|
|
402
|
-
})), []);
|
|
403
|
-
let extraBottomSheetProps = {};
|
|
404
|
-
|
|
405
|
-
if (_package.default.version.startsWith('4')) {
|
|
406
|
-
var _state$nav, _state$nav$options;
|
|
407
|
-
|
|
408
|
-
extraBottomSheetProps.keyboardBehavior = 'fillParent';
|
|
409
|
-
extraBottomSheetProps.android_keyboardInputMode = 'adjustResize';
|
|
410
|
-
extraBottomSheetProps.enablePanDownToClose = (state === null || state === void 0 ? void 0 : (_state$nav = state.nav) === null || _state$nav === void 0 ? void 0 : (_state$nav$options = _state$nav.options) === null || _state$nav$options === void 0 ? void 0 : _state$nav$options.type) === 'error';
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
return /*#__PURE__*/_react.default.createElement(_bottomSheet.BottomSheetModal, _extends({
|
|
414
|
-
snapPoints: snapPoints,
|
|
415
|
-
index: 1,
|
|
416
|
-
backdropComponent: renderBackdrop,
|
|
417
|
-
onDismiss: handleClose,
|
|
418
|
-
style: styles.bottomSheet,
|
|
419
|
-
ref: bottomSheetModalRef
|
|
420
|
-
}, extraBottomSheetProps), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
421
|
-
style: styles.innerContainer
|
|
422
|
-
}, step === LoginStep.INIT && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (app === null || app === void 0 ? void 0 : (_app$config6 = app.config) === null || _app$config6 === void 0 ? void 0 : (_app$config6$hub = _app$config6.hub) === null || _app$config6$hub === void 0 ? void 0 : (_app$config6$hub$auth = _app$config6$hub.auth) === null || _app$config6$hub$auth === void 0 ? void 0 : _app$config6$hub$auth.show_app_icon) && (app === null || app === void 0 ? void 0 : app.icon) && (app.icon_content_type === 'image/svg+xml' ? /*#__PURE__*/_react.default.createElement(_reactNativeSvg.SvgCssUri, {
|
|
423
|
-
uri: app.icon,
|
|
424
|
-
style: styles.appLogo
|
|
425
|
-
}) : /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
426
|
-
style: styles.appLogo,
|
|
427
|
-
source: {
|
|
428
|
-
uri: app.icon
|
|
429
|
-
}
|
|
430
|
-
})), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
431
|
-
style: styles.dialogHeading
|
|
432
|
-
}, "Sign in or sign up"), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
433
|
-
style: styles.inputLabel
|
|
434
|
-
}, "Email or phone number"), /*#__PURE__*/_react.default.createElement(_BottomSheetTextInput.default, {
|
|
435
|
-
style: styles.identifierInput,
|
|
436
|
-
placeholder: "Enter here",
|
|
437
|
-
keyboardType: "email-address",
|
|
438
|
-
textContentType: "emailAddress",
|
|
439
|
-
returnKeyLabel: "Sign in",
|
|
440
|
-
returnKeyType: "go",
|
|
441
|
-
enablesReturnKeyAutomatically: true,
|
|
442
|
-
autoCapitalize: "none",
|
|
443
|
-
onChangeText: text => setUserIdentifier(text.trim()),
|
|
444
|
-
onBlur: validateInput // value={userIdentifier} // managed inputs that modify values cause strange issues on Android :-(
|
|
445
|
-
,
|
|
446
|
-
onSubmitEditing: initSignIn,
|
|
447
|
-
autoCorrect: false
|
|
448
|
-
}), requiresAdditionalFields && (app === null || app === void 0 ? void 0 : (_app$config7 = app.config) === null || _app$config7 === void 0 ? void 0 : (_app$config7$hub = _app$config7.hub) === null || _app$config7$hub === void 0 ? void 0 : (_app$config7$hub$auth = _app$config7$hub.auth) === null || _app$config7$hub$auth === void 0 ? void 0 : _app$config7$hub$auth.additional_fields.map(field => {
|
|
449
|
-
return (0, _form.renderField)({ ...field,
|
|
450
|
-
value: addlFieldValues[field.name] || '',
|
|
451
|
-
[['input', 'text', 'tel', 'email'].includes(field.type) ? 'onInput' : 'onChange']: handleAddlFieldChange
|
|
452
|
-
});
|
|
453
|
-
})), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
454
|
-
disabled: !isValidUserIdentifier || isSubmitting,
|
|
455
|
-
onPress: initSignIn
|
|
456
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
457
|
-
style: { ...styles.button,
|
|
458
|
-
...(!isValidUserIdentifier && styles.buttonDisabled),
|
|
459
|
-
...(isSubmitting && styles.buttonSubmitting)
|
|
460
|
-
}
|
|
461
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
462
|
-
style: styles.buttonText
|
|
463
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
464
|
-
style: isValidUserIdentifier ? styles.buttonContent : { ...styles.buttonContent,
|
|
465
|
-
...styles.buttonDisabledText
|
|
466
|
-
}
|
|
467
|
-
}, isSubmitting &&
|
|
468
|
-
/*#__PURE__*/
|
|
469
|
-
// <View width={25} height={25}>
|
|
470
|
-
_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
471
|
-
size: "small",
|
|
472
|
-
color: "#efefef",
|
|
473
|
-
style: styles.loadingIndicator
|
|
474
|
-
}) // </View>
|
|
475
|
-
, isSubmitting ? 'Just a sec...' : 'Continue')))), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
476
|
-
style: styles.signInNoticeText
|
|
477
|
-
}, "By continuing, you're agreeing to the terms of service that govern this app and to receive email or text messages for verification purposes.")), step === LoginStep.WAITING && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
478
|
-
style: styles.dialogHeading
|
|
479
|
-
}, "Thanks! Verify your", ' ', loginType === 'phone' ? 'phone number' : 'email', " to finish"), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
480
|
-
style: styles.py6
|
|
481
|
-
}, "Click the link in the message we just sent to", ' ', /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
482
|
-
style: styles.italic
|
|
483
|
-
}, userIdentifier), " to verify and finish.", /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
484
|
-
style: [styles.link],
|
|
485
|
-
onPress: () => setStep(LoginStep.INIT)
|
|
486
|
-
}, "\xA0Re-send message")), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
487
|
-
style: styles.signInVerificationImage
|
|
488
|
-
}, loginType === 'phone' ? /*#__PURE__*/_react.default.createElement(_PhoneVerifyWaiting.default, null) : /*#__PURE__*/_react.default.createElement(_EmailVerifyWaiting.default, null)), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
489
|
-
style: [styles.button],
|
|
490
|
-
onPress: () => setStep(LoginStep.INIT)
|
|
491
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
492
|
-
style: styles.buttonContent
|
|
493
|
-
}, "Try a different", ' ', loginType === 'phone' ? 'phone number' : 'email'))), step === LoginStep.SUCCESS && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
494
|
-
style: styles.signInVerificationImage
|
|
495
|
-
}, /*#__PURE__*/_react.default.createElement(_CheckmarkFilled.default, null))), step === LoginStep.FAILURE && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
496
|
-
style: styles.textBase
|
|
497
|
-
}, "Whoops, that didn't work!"), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
498
|
-
style: styles.button,
|
|
499
|
-
onPress: () => setStep(LoginStep.INIT)
|
|
500
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
501
|
-
style: styles.buttonContent
|
|
502
|
-
}, "Try again"))), step === LoginStep.ERROR && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
503
|
-
style: styles.textBase
|
|
504
|
-
}, "An error occurred while signing you in."), !!error && /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
505
|
-
style: styles.textRose800
|
|
506
|
-
}, error), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
507
|
-
style: styles.button,
|
|
508
|
-
onPress: () => setStep(LoginStep.INIT)
|
|
509
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
510
|
-
style: styles.buttonContent
|
|
511
|
-
}, "Try again"))), /*#__PURE__*/_react.default.createElement(_reactNative.Text, null, "Powered by", ' ', /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
512
|
-
style: styles.link,
|
|
513
|
-
onPress: launchRowndWebsite
|
|
514
|
-
}, "Rownd"))));
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
const styles = _reactNative.StyleSheet.create({
|
|
518
|
-
modal: {// flex: 1,
|
|
519
|
-
},
|
|
520
|
-
bottomSheet: {
|
|
521
|
-
shadowColor: '#000',
|
|
522
|
-
shadowOffset: {
|
|
523
|
-
width: 0,
|
|
524
|
-
height: 12
|
|
525
|
-
},
|
|
526
|
-
shadowOpacity: 0.58,
|
|
527
|
-
shadowRadius: 16.0,
|
|
528
|
-
elevation: 24
|
|
529
|
-
},
|
|
530
|
-
innerContainer: {
|
|
531
|
-
borderRadius: 20,
|
|
532
|
-
borderColor: 'transparent',
|
|
533
|
-
borderWidth: 0,
|
|
534
|
-
padding: 25
|
|
535
|
-
},
|
|
536
|
-
container: {
|
|
537
|
-
flex: 1,
|
|
538
|
-
padding: 24
|
|
539
|
-
},
|
|
540
|
-
header: {
|
|
541
|
-
alignItems: 'center',
|
|
542
|
-
backgroundColor: 'white',
|
|
543
|
-
paddingVertical: 20,
|
|
544
|
-
borderTopLeftRadius: 20,
|
|
545
|
-
borderTopRightRadius: 20
|
|
546
|
-
},
|
|
547
|
-
panelHandle: {
|
|
548
|
-
width: 40,
|
|
549
|
-
height: 2,
|
|
550
|
-
backgroundColor: 'rgba(0,0,0,0.3)',
|
|
551
|
-
borderRadius: 4
|
|
552
|
-
},
|
|
553
|
-
appLogo: {
|
|
554
|
-
padding: 50,
|
|
555
|
-
width: 75,
|
|
556
|
-
height: 75,
|
|
557
|
-
resizeMode: 'center',
|
|
558
|
-
textAlign: 'center',
|
|
559
|
-
marginLeft: 'auto',
|
|
560
|
-
marginRight: 'auto',
|
|
561
|
-
marginBottom: 20
|
|
562
|
-
},
|
|
563
|
-
dialogHeading: {
|
|
564
|
-
fontSize: 24
|
|
565
|
-
},
|
|
566
|
-
inputLabel: {
|
|
567
|
-
marginTop: 20,
|
|
568
|
-
marginBottom: 5
|
|
569
|
-
},
|
|
570
|
-
identifierInput: {
|
|
571
|
-
backgroundColor: '#eee',
|
|
572
|
-
borderRadius: 8,
|
|
573
|
-
padding: 10,
|
|
574
|
-
fontSize: 18
|
|
575
|
-
},
|
|
576
|
-
button: {
|
|
577
|
-
borderRadius: 10,
|
|
578
|
-
padding: 10,
|
|
579
|
-
marginTop: 20,
|
|
580
|
-
marginBottom: 30,
|
|
581
|
-
elevation: 0,
|
|
582
|
-
backgroundColor: '#5b0ae0',
|
|
583
|
-
color: '#fff',
|
|
584
|
-
display: 'flex',
|
|
585
|
-
alignItems: 'center',
|
|
586
|
-
justifyContent: 'center' // height: 45,
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
buttonDisabled: {
|
|
590
|
-
backgroundColor: '#eee'
|
|
591
|
-
},
|
|
592
|
-
buttonPressed: {
|
|
593
|
-
opacity: 0.5
|
|
594
|
-
},
|
|
595
|
-
buttonContent: {
|
|
596
|
-
textAlign: 'center',
|
|
597
|
-
fontSize: 18,
|
|
598
|
-
color: '#fff'
|
|
599
|
-
},
|
|
600
|
-
buttonText: {// marginHorizontal: 10,
|
|
601
|
-
// paddingHorizontal: 10,
|
|
602
|
-
// fontSize: 18,
|
|
603
|
-
// color: '#fff',
|
|
604
|
-
},
|
|
605
|
-
buttonTextInner: {
|
|
606
|
-
fontSize: 18
|
|
607
|
-
},
|
|
608
|
-
buttonDisabledText: {
|
|
609
|
-
color: '#8e8e8e'
|
|
610
|
-
},
|
|
611
|
-
buttonSubmitting: {
|
|
612
|
-
backgroundColor: '#2f0492',
|
|
613
|
-
color: '#c7c7c7'
|
|
614
|
-
},
|
|
615
|
-
loadingIndicator: {
|
|
616
|
-
marginRight: 10,
|
|
617
|
-
width: 25,
|
|
618
|
-
height: 25
|
|
619
|
-
},
|
|
620
|
-
signInNoticeText: {
|
|
621
|
-
fontSize: 12,
|
|
622
|
-
marginBottom: 20
|
|
623
|
-
},
|
|
624
|
-
signInVerificationImage: {
|
|
625
|
-
alignItems: 'center'
|
|
626
|
-
},
|
|
627
|
-
link: {
|
|
628
|
-
color: '#6114e1'
|
|
629
|
-
},
|
|
630
|
-
py6: {
|
|
631
|
-
paddingVertical: 6
|
|
632
|
-
},
|
|
633
|
-
italic: {
|
|
634
|
-
fontStyle: 'italic'
|
|
635
|
-
},
|
|
636
|
-
textBase: {
|
|
637
|
-
fontSize: 16,
|
|
638
|
-
lineHeight: 24
|
|
639
|
-
},
|
|
640
|
-
textRose800: {
|
|
641
|
-
color: 'rgb(159, 18, 57)'
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
//# sourceMappingURL=SignIn.js.map
|