@supertokens/rownd-react-native 0.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 +20 -0
- package/README.md +554 -0
- package/android/build.gradle +153 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +5 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativerowndplugin/RowndPluginModule.kt +235 -0
- package/android/src/main/java/com/reactnativerowndplugin/RowndPluginPackage.kt +25 -0
- package/app.plugin.js +3 -0
- package/expo/plugin.js +61 -0
- package/ios/Rownd.xcodeproj/project.pbxproj +283 -0
- package/ios/RowndHelper.swift +62 -0
- package/ios/RowndPlugin-Bridging-Header.h +3 -0
- package/ios/RowndPlugin.m +31 -0
- package/ios/RowndPlugin.swift +233 -0
- package/ios/RowndPluginEventEmitter.m +12 -0
- package/ios/RowndPluginEventEmitter.swift +19 -0
- package/lib/commonjs/components/GlobalContext.js +72 -0
- package/lib/commonjs/components/GlobalContext.js.map +1 -0
- package/lib/commonjs/components/GlobalContext.types.js +6 -0
- package/lib/commonjs/components/GlobalContext.types.js.map +1 -0
- package/lib/commonjs/components/GlobalContext.web.js +21 -0
- package/lib/commonjs/components/GlobalContext.web.js.map +1 -0
- package/lib/commonjs/components/RequireSignIn.js +37 -0
- package/lib/commonjs/components/RequireSignIn.js.map +1 -0
- package/lib/commonjs/components/SignedIn.js +22 -0
- package/lib/commonjs/components/SignedIn.js.map +1 -0
- package/lib/commonjs/components/SignedOut.js +22 -0
- package/lib/commonjs/components/SignedOut.js.map +1 -0
- package/lib/commonjs/constants/action.js +11 -0
- package/lib/commonjs/constants/action.js.map +1 -0
- package/lib/commonjs/hooks/rownd.js +30 -0
- package/lib/commonjs/hooks/rownd.js.map +1 -0
- package/lib/commonjs/hooks/rownd.web.js +56 -0
- package/lib/commonjs/hooks/rownd.web.js.map +1 -0
- package/lib/commonjs/index.js +42 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/reducer/rowndReducer.js +67 -0
- package/lib/commonjs/reducer/rowndReducer.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils/config.js +6 -0
- package/lib/commonjs/utils/config.js.map +1 -0
- package/lib/commonjs/utils/nativeModule.js +70 -0
- package/lib/commonjs/utils/nativeModule.js.map +1 -0
- package/lib/module/components/GlobalContext.js +64 -0
- package/lib/module/components/GlobalContext.js.map +1 -0
- package/lib/module/components/GlobalContext.types.js +2 -0
- package/lib/module/components/GlobalContext.types.js.map +1 -0
- package/lib/module/components/GlobalContext.web.js +14 -0
- package/lib/module/components/GlobalContext.web.js.map +1 -0
- package/lib/module/components/RequireSignIn.js +30 -0
- package/lib/module/components/RequireSignIn.js.map +1 -0
- package/lib/module/components/SignedIn.js +15 -0
- package/lib/module/components/SignedIn.js.map +1 -0
- package/lib/module/components/SignedOut.js +15 -0
- package/lib/module/components/SignedOut.js.map +1 -0
- package/lib/module/constants/action.js +5 -0
- package/lib/module/constants/action.js.map +1 -0
- package/lib/module/hooks/rownd.js +24 -0
- package/lib/module/hooks/rownd.js.map +1 -0
- package/lib/module/hooks/rownd.web.js +50 -0
- package/lib/module/hooks/rownd.web.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/reducer/rowndReducer.js +60 -0
- package/lib/module/reducer/rowndReducer.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils/config.js +2 -0
- package/lib/module/utils/config.js.map +1 -0
- package/lib/module/utils/nativeModule.js +55 -0
- package/lib/module/utils/nativeModule.js.map +1 -0
- package/lib/typescript/components/GlobalContext.d.ts +13 -0
- package/lib/typescript/components/GlobalContext.types.d.ts +90 -0
- package/lib/typescript/components/GlobalContext.web.d.ts +4 -0
- package/lib/typescript/components/RequireSignIn.d.ts +9 -0
- package/lib/typescript/components/SignedIn.d.ts +6 -0
- package/lib/typescript/components/SignedOut.d.ts +6 -0
- package/lib/typescript/constants/action.d.ts +7 -0
- package/lib/typescript/hooks/rownd.d.ts +31 -0
- package/lib/typescript/hooks/rownd.web.d.ts +2 -0
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/reducer/rowndReducer.d.ts +4 -0
- package/lib/typescript/types.d.ts +21 -0
- package/lib/typescript/utils/config.d.ts +7 -0
- package/lib/typescript/utils/nativeModule.d.ts +14 -0
- package/package.json +167 -0
- package/rownd-react-native.podspec +38 -0
- package/src/components/GlobalContext.tsx +93 -0
- package/src/components/GlobalContext.types.ts +109 -0
- package/src/components/GlobalContext.web.tsx +17 -0
- package/src/components/RequireSignIn.tsx +35 -0
- package/src/components/SignedIn.tsx +17 -0
- package/src/components/SignedOut.tsx +17 -0
- package/src/constants/action.ts +8 -0
- package/src/hooks/rownd.ts +68 -0
- package/src/hooks/rownd.web.ts +56 -0
- package/src/index.tsx +7 -0
- package/src/reducer/rowndReducer.ts +63 -0
- package/src/types.ts +32 -0
- package/src/utils/config.ts +9 -0
- package/src/utils/nativeModule.ts +83 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "RequireSignIn", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _RequireSignIn.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "RowndProvider", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _GlobalContext.RowndProvider;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "SignedIn", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _SignedIn.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "SignedOut", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _SignedOut.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "useRownd", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _rownd.useRownd;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var _GlobalContext = require("./components/GlobalContext");
|
|
37
|
+
var _rownd = require("./hooks/rownd");
|
|
38
|
+
var _RequireSignIn = _interopRequireDefault(require("./components/RequireSignIn"));
|
|
39
|
+
var _SignedIn = _interopRequireDefault(require("./components/SignedIn"));
|
|
40
|
+
var _SignedOut = _interopRequireDefault(require("./components/SignedOut"));
|
|
41
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_GlobalContext","require","_rownd","_RequireSignIn","_interopRequireDefault","_SignedIn","_SignedOut","e","__esModule","default"],"sources":["index.tsx"],"sourcesContent":["import { RowndProvider } from './components/GlobalContext';\nimport { useRownd } from './hooks/rownd';\nimport RequireSignIn from './components/RequireSignIn';\nimport SignedIn from './components/SignedIn';\nimport SignedOut from './components/SignedOut';\n\nexport { RowndProvider, useRownd, RequireSignIn, SignedIn, SignedOut };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,UAAA,GAAAF,sBAAA,CAAAH,OAAA;AAA+C,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.initialRowndState = void 0;
|
|
7
|
+
exports.rowndReducer = rowndReducer;
|
|
8
|
+
var _action = require("../constants/action");
|
|
9
|
+
const initialRowndState = exports.initialRowndState = {
|
|
10
|
+
// is_initializing: false,
|
|
11
|
+
user: {
|
|
12
|
+
data: {
|
|
13
|
+
email: null
|
|
14
|
+
},
|
|
15
|
+
isLoading: false
|
|
16
|
+
// meta: {}
|
|
17
|
+
},
|
|
18
|
+
auth: {
|
|
19
|
+
access_token: null,
|
|
20
|
+
refresh_token: null,
|
|
21
|
+
app_id: null
|
|
22
|
+
},
|
|
23
|
+
app: {
|
|
24
|
+
schema: null,
|
|
25
|
+
config: null
|
|
26
|
+
}
|
|
27
|
+
// is_saving_user_data: false,
|
|
28
|
+
// config,
|
|
29
|
+
};
|
|
30
|
+
function rowndReducer(state, action) {
|
|
31
|
+
var _action$payload, _action$payload2, _action$payload3, _user$data;
|
|
32
|
+
let newState;
|
|
33
|
+
switch (action.type) {
|
|
34
|
+
case _action.ActionType.UPDATE_STATE:
|
|
35
|
+
const user = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.user) || {};
|
|
36
|
+
const auth = ((_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : _action$payload2.auth) || {};
|
|
37
|
+
const appConfig = ((_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : _action$payload3.appConfig) || {};
|
|
38
|
+
newState = {
|
|
39
|
+
user: {
|
|
40
|
+
data: {
|
|
41
|
+
...user.data,
|
|
42
|
+
email: (_user$data = user.data) === null || _user$data === void 0 ? void 0 : _user$data.email
|
|
43
|
+
},
|
|
44
|
+
isLoading: Boolean(user.isLoading ?? user.is_loading)
|
|
45
|
+
// meta: {}
|
|
46
|
+
},
|
|
47
|
+
auth: {
|
|
48
|
+
access_token: auth.access_token ?? null,
|
|
49
|
+
refresh_token: auth.refresh_token ?? null,
|
|
50
|
+
app_id: appConfig.id || auth.app_id || null,
|
|
51
|
+
is_verified_user: auth.is_verified_user,
|
|
52
|
+
auth_level: auth.auth_level ?? user.auth_level ?? null
|
|
53
|
+
},
|
|
54
|
+
app: {
|
|
55
|
+
schema: appConfig.schema ?? null,
|
|
56
|
+
config: null
|
|
57
|
+
}
|
|
58
|
+
// is_saving_user_data: false,
|
|
59
|
+
// config
|
|
60
|
+
};
|
|
61
|
+
return newState;
|
|
62
|
+
default:
|
|
63
|
+
newState = state;
|
|
64
|
+
return newState;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=rowndReducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_action","require","initialRowndState","exports","user","data","email","isLoading","auth","access_token","refresh_token","app_id","app","schema","config","rowndReducer","state","action","_action$payload","_action$payload2","_action$payload3","_user$data","newState","type","ActionType","UPDATE_STATE","payload","appConfig","Boolean","is_loading","id","is_verified_user","auth_level"],"sources":["rowndReducer.ts"],"sourcesContent":["import type { GlobalState } from '../components/GlobalContext.types';\nimport { ActionType, TAction } from '../constants/action';\n\nexport const initialRowndState: GlobalState = {\n // is_initializing: false,\n user: {\n data: {\n email: null,\n },\n isLoading: false,\n // meta: {}\n },\n auth: {\n access_token: null,\n refresh_token: null,\n app_id: null,\n },\n app: {\n schema: null,\n config: null,\n },\n // is_saving_user_data: false,\n // config,\n};\n\nexport function rowndReducer(state: GlobalState, action: TAction): GlobalState {\n let newState: GlobalState;\n\n switch (action.type) {\n case ActionType.UPDATE_STATE:\n const user = action.payload?.user || {};\n const auth = action.payload?.auth || {};\n const appConfig = action.payload?.appConfig || {};\n\n newState = {\n user: {\n data: {\n ...user.data,\n email: user.data?.email,\n },\n isLoading: Boolean(user.isLoading ?? user.is_loading),\n // meta: {}\n },\n auth: {\n access_token: auth.access_token ?? null,\n refresh_token: auth.refresh_token ?? null,\n app_id: appConfig.id || auth.app_id || null,\n is_verified_user: auth.is_verified_user,\n auth_level: auth.auth_level ?? user.auth_level ?? null,\n },\n app: {\n schema: appConfig.schema ?? null,\n config: null,\n },\n // is_saving_user_data: false,\n // config\n };\n return newState;\n default:\n newState = state;\n return newState;\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AAEO,MAAMC,iBAA8B,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC5C;EACAE,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,KAAK,EAAE;IACT,CAAC;IACDC,SAAS,EAAE;IACX;EACF,CAAC;EACDC,IAAI,EAAE;IACJC,YAAY,EAAE,IAAI;IAClBC,aAAa,EAAE,IAAI;IACnBC,MAAM,EAAE;EACV,CAAC;EACDC,GAAG,EAAE;IACHC,MAAM,EAAE,IAAI;IACZC,MAAM,EAAE;EACV;EACA;EACA;AACF,CAAC;AAEM,SAASC,YAAYA,CAACC,KAAkB,EAAEC,MAAe,EAAe;EAAA,IAAAC,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,UAAA;EAC7E,IAAIC,QAAqB;EAEzB,QAAQL,MAAM,CAACM,IAAI;IACjB,KAAKC,kBAAU,CAACC,YAAY;MAC1B,MAAMrB,IAAI,GAAG,EAAAc,eAAA,GAAAD,MAAM,CAACS,OAAO,cAAAR,eAAA,uBAAdA,eAAA,CAAgBd,IAAI,KAAI,CAAC,CAAC;MACvC,MAAMI,IAAI,GAAG,EAAAW,gBAAA,GAAAF,MAAM,CAACS,OAAO,cAAAP,gBAAA,uBAAdA,gBAAA,CAAgBX,IAAI,KAAI,CAAC,CAAC;MACvC,MAAMmB,SAAS,GAAG,EAAAP,gBAAA,GAAAH,MAAM,CAACS,OAAO,cAAAN,gBAAA,uBAAdA,gBAAA,CAAgBO,SAAS,KAAI,CAAC,CAAC;MAEjDL,QAAQ,GAAG;QACTlB,IAAI,EAAE;UACJC,IAAI,EAAE;YACJ,GAAGD,IAAI,CAACC,IAAI;YACZC,KAAK,GAAAe,UAAA,GAAEjB,IAAI,CAACC,IAAI,cAAAgB,UAAA,uBAATA,UAAA,CAAWf;UACpB,CAAC;UACDC,SAAS,EAAEqB,OAAO,CAACxB,IAAI,CAACG,SAAS,IAAIH,IAAI,CAACyB,UAAU;UACpD;QACF,CAAC;QACDrB,IAAI,EAAE;UACJC,YAAY,EAAED,IAAI,CAACC,YAAY,IAAI,IAAI;UACvCC,aAAa,EAAEF,IAAI,CAACE,aAAa,IAAI,IAAI;UACzCC,MAAM,EAAEgB,SAAS,CAACG,EAAE,IAAItB,IAAI,CAACG,MAAM,IAAI,IAAI;UAC3CoB,gBAAgB,EAAEvB,IAAI,CAACuB,gBAAgB;UACvCC,UAAU,EAAExB,IAAI,CAACwB,UAAU,IAAI5B,IAAI,CAAC4B,UAAU,IAAI;QACpD,CAAC;QACDpB,GAAG,EAAE;UACHC,MAAM,EAAEc,SAAS,CAACd,MAAM,IAAI,IAAI;UAChCC,MAAM,EAAE;QACV;QACA;QACA;MACF,CAAC;MACD,OAAOQ,QAAQ;IACjB;MACEA,QAAQ,GAAGN,KAAK;MAChB,OAAOM,QAAQ;EACnB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type SuperTokensConfig = {\n appInfo: {\n appName?: string;\n apiDomain: string;\n apiBasePath?: string;\n };\n};\n\nexport type RowndProviderConfig = {\n appKey: string;\n supertokens: SuperTokensConfig;\n hubUrlOverride?: string;\n deepLinkScheme?: string;\n};\n\nexport type RequestSignInMethods =\n | 'default'\n | 'email'\n | 'phone'\n | 'google'\n | 'apple'\n | 'anonymous'\n | 'guest';\n\nexport type RequestSignInIntent = 'sign_in' | 'sign_up';\n\nexport type RequestSignIn = {\n method?: RequestSignInMethods;\n postSignInRedirect?: string;\n intent?: RequestSignInIntent;\n prevent_closing?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["import type { RowndProviderConfig } from '../types';\n\nexport type IConfig = RowndProviderConfig;\n\nexport interface Customizations {\n sheetBackgroundHexColor?: string;\n sheetCornerBorderRadius?: string;\n loadingAnimation?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Rownd = exports.LINKING_ERROR = exports.IOSRowndEventEmitter = void 0;
|
|
7
|
+
exports.configure = configure;
|
|
8
|
+
exports.customizations = customizations;
|
|
9
|
+
exports.getAccessToken = getAccessToken;
|
|
10
|
+
exports.handleSignInLink = handleSignInLink;
|
|
11
|
+
exports.manageAccount = manageAccount;
|
|
12
|
+
exports.requestSignIn = requestSignIn;
|
|
13
|
+
exports.setUserData = setUserData;
|
|
14
|
+
exports.setUserDataValue = setUserDataValue;
|
|
15
|
+
exports.signOut = signOut;
|
|
16
|
+
var _reactNative = require("react-native");
|
|
17
|
+
const LINKING_ERROR = exports.LINKING_ERROR = `The package '@supertokens/rownd-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
18
|
+
ios: "- You have run 'pod install'\n",
|
|
19
|
+
default: ''
|
|
20
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
21
|
+
const Rownd = exports.Rownd = _reactNative.NativeModules.RowndPlugin ? _reactNative.NativeModules.RowndPlugin : new Proxy({}, {
|
|
22
|
+
get() {
|
|
23
|
+
throw new Error(LINKING_ERROR);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const IOSRowndEventEmitter = exports.IOSRowndEventEmitter = _reactNative.Platform.OS !== 'ios' ? null : _reactNative.NativeModules.RowndPluginEventEmitter ? _reactNative.NativeModules.RowndPluginEventEmitter : new Proxy({}, {
|
|
27
|
+
get() {
|
|
28
|
+
throw new Error(LINKING_ERROR);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
function configure(config) {
|
|
32
|
+
return Rownd.configure(config);
|
|
33
|
+
}
|
|
34
|
+
function customizations(customizationConfig) {
|
|
35
|
+
return Rownd.customizations(customizationConfig);
|
|
36
|
+
}
|
|
37
|
+
function requestSignIn(config) {
|
|
38
|
+
const method = (config === null || config === void 0 ? void 0 : config.method) === 'guest' ? 'anonymous' : config === null || config === void 0 ? void 0 : config.method;
|
|
39
|
+
if (!config) {
|
|
40
|
+
return Rownd.requestSignIn({
|
|
41
|
+
method: 'default'
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return Rownd.requestSignIn({
|
|
45
|
+
method: method || 'default',
|
|
46
|
+
postSignInRedirect: config === null || config === void 0 ? void 0 : config.postSignInRedirect,
|
|
47
|
+
intent: config === null || config === void 0 ? void 0 : config.intent
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function signOut() {
|
|
51
|
+
return Rownd.signOut();
|
|
52
|
+
}
|
|
53
|
+
function manageAccount() {
|
|
54
|
+
return Rownd.manageAccount();
|
|
55
|
+
}
|
|
56
|
+
function getAccessToken() {
|
|
57
|
+
return Rownd.getAccessToken();
|
|
58
|
+
}
|
|
59
|
+
function setUserDataValue(key, value) {
|
|
60
|
+
return Rownd.setUserDataValue(key, _reactNative.Platform.OS === 'android' ? {
|
|
61
|
+
value
|
|
62
|
+
} : value);
|
|
63
|
+
}
|
|
64
|
+
function setUserData(data) {
|
|
65
|
+
return Rownd.setUserData(data);
|
|
66
|
+
}
|
|
67
|
+
function handleSignInLink(url) {
|
|
68
|
+
return Rownd.handleSignInLink(url);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","exports","Platform","select","ios","default","Rownd","NativeModules","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","configure","config","customizations","customizationConfig","requestSignIn","method","postSignInRedirect","intent","signOut","manageAccount","getAccessToken","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport type { RequestSignIn } from '../types';\nimport type { Customizations, IConfig } from './config';\n\nexport const LINKING_ERROR =\n `The package '@supertokens/rownd-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport const Rownd = NativeModules.RowndPlugin\n ? NativeModules.RowndPlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const IOSRowndEventEmitter =\n Platform.OS !== 'ios'\n ? null\n : NativeModules.RowndPluginEventEmitter\n ? NativeModules.RowndPluginEventEmitter\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport function configure(config: IConfig): Promise<string> {\n return Rownd.configure(config);\n}\n\nexport function customizations(customizationConfig: Customizations) {\n return Rownd.customizations(customizationConfig);\n}\n\nexport function requestSignIn(config?: RequestSignIn) {\n const method = config?.method === 'guest' ? 'anonymous' : config?.method;\n\n if (!config) {\n return Rownd.requestSignIn({ method: 'default' });\n }\n\n return Rownd.requestSignIn({\n method: method || 'default',\n postSignInRedirect: config?.postSignInRedirect,\n intent: config?.intent,\n });\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n return Rownd.getAccessToken();\n}\n\nexport function setUserDataValue(key: string, value: any) {\n return Rownd.setUserDataValue(\n key,\n Platform.OS === 'android' ? { value } : value\n );\n}\n\nexport function setUserData(data: Record<string, any>) {\n return Rownd.setUserData(data);\n}\n\nexport function handleSignInLink(url: string) {\n return Rownd.handleSignInLink(url);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIO,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GACxB,0FAA0F,GAC1FE,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAExC,MAAMC,KAAK,GAAAL,OAAA,CAAAK,KAAA,GAAGC,0BAAa,CAACC,WAAW,GAC1CD,0BAAa,CAACC,WAAW,GACzB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,MAAMY,oBAAoB,GAAAX,OAAA,CAAAW,oBAAA,GAC/BV,qBAAQ,CAACW,EAAE,KAAK,KAAK,GACjB,IAAI,GACJN,0BAAa,CAACO,uBAAuB,GACrCP,0BAAa,CAACO,uBAAuB,GACrC,IAAIL,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACX,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEA,SAASe,SAASA,CAACC,MAAe,EAAmB;EAC1D,OAAOV,KAAK,CAACS,SAAS,CAACC,MAAM,CAAC;AAChC;AAEO,SAASC,cAAcA,CAACC,mBAAmC,EAAE;EAClE,OAAOZ,KAAK,CAACW,cAAc,CAACC,mBAAmB,CAAC;AAClD;AAEO,SAASC,aAAaA,CAACH,MAAsB,EAAE;EACpD,MAAMI,MAAM,GAAG,CAAAJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEI,MAAM,MAAK,OAAO,GAAG,WAAW,GAAGJ,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEI,MAAM;EAExE,IAAI,CAACJ,MAAM,EAAE;IACX,OAAOV,KAAK,CAACa,aAAa,CAAC;MAAEC,MAAM,EAAE;IAAU,CAAC,CAAC;EACnD;EAEA,OAAOd,KAAK,CAACa,aAAa,CAAC;IACzBC,MAAM,EAAEA,MAAM,IAAI,SAAS;IAC3BC,kBAAkB,EAAEL,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEK,kBAAkB;IAC9CC,MAAM,EAAEN,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEM;EAClB,CAAC,CAAC;AACJ;AAEO,SAASC,OAAOA,CAAA,EAAG;EACxB,OAAOjB,KAAK,CAACiB,OAAO,CAAC,CAAC;AACxB;AAEO,SAASC,aAAaA,CAAA,EAAG;EAC9B,OAAOlB,KAAK,CAACkB,aAAa,CAAC,CAAC;AAC9B;AAEO,SAASC,cAAcA,CAAA,EAAoB;EAChD,OAAOnB,KAAK,CAACmB,cAAc,CAAC,CAAC;AAC/B;AAEO,SAASC,gBAAgBA,CAACC,GAAW,EAAEC,KAAU,EAAE;EACxD,OAAOtB,KAAK,CAACoB,gBAAgB,CAC3BC,GAAG,EACHzB,qBAAQ,CAACW,EAAE,KAAK,SAAS,GAAG;IAAEe;EAAM,CAAC,GAAGA,KAC1C,CAAC;AACH;AAEO,SAASC,WAAWA,CAACC,IAAyB,EAAE;EACrD,OAAOxB,KAAK,CAACuB,WAAW,CAACC,IAAI,CAAC;AAChC;AAEO,SAASC,gBAAgBA,CAACC,GAAW,EAAE;EAC5C,OAAO1B,KAAK,CAACyB,gBAAgB,CAACC,GAAG,CAAC;AACpC","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useReducer, createContext, useEffect, useContext } from 'react';
|
|
2
|
+
import { NativeEventEmitter, LogBox, Platform, Linking } from 'react-native';
|
|
3
|
+
import { initialRowndState, rowndReducer } from '../reducer/rowndReducer';
|
|
4
|
+
import * as NativeRowndModules from '../utils/nativeModule';
|
|
5
|
+
import { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';
|
|
6
|
+
import { ActionType } from '../constants/action';
|
|
7
|
+
LogBox.ignoreLogs(['Sending `update_state` with no listeners registered.']);
|
|
8
|
+
LogBox.ignoreLogs(['YellowBox has been replaced with LogBox.']);
|
|
9
|
+
export const GlobalContext = /*#__PURE__*/createContext(undefined);
|
|
10
|
+
const eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);
|
|
11
|
+
const RowndProvider = ({
|
|
12
|
+
children,
|
|
13
|
+
config,
|
|
14
|
+
customizations
|
|
15
|
+
}) => {
|
|
16
|
+
const [state, dispatch] = useReducer(rowndReducer, initialRowndState);
|
|
17
|
+
const value = {
|
|
18
|
+
state,
|
|
19
|
+
dispatch
|
|
20
|
+
};
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
NativeRowndModules.configure(config);
|
|
23
|
+
if (customizations) {
|
|
24
|
+
NativeRowndModules.customizations(customizations);
|
|
25
|
+
}
|
|
26
|
+
}, [config, customizations]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const onSessionConnect = event => {
|
|
29
|
+
dispatch({
|
|
30
|
+
type: ActionType.UPDATE_STATE,
|
|
31
|
+
payload: Platform.OS === 'android' ? JSON.parse(event.state) : event
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const subscription = eventEmitter.addListener('update_state', onSessionConnect);
|
|
35
|
+
if (!subscription) return;
|
|
36
|
+
return () => {
|
|
37
|
+
subscription.remove();
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
|
|
41
|
+
// Handle deep linking
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
const subscription = Linking.addEventListener('url', event => NativeRowndModules.handleSignInLink(event.url));
|
|
44
|
+
(async () => {
|
|
45
|
+
const initialUrl = await Linking.getInitialURL();
|
|
46
|
+
if (initialUrl) {
|
|
47
|
+
NativeRowndModules.handleSignInLink(initialUrl);
|
|
48
|
+
}
|
|
49
|
+
})();
|
|
50
|
+
return () => subscription.remove();
|
|
51
|
+
}, []);
|
|
52
|
+
return /*#__PURE__*/React.createElement(GlobalContext.Provider, {
|
|
53
|
+
value: value
|
|
54
|
+
}, children);
|
|
55
|
+
};
|
|
56
|
+
function useRowndContext() {
|
|
57
|
+
const context = useContext(GlobalContext);
|
|
58
|
+
if (context === undefined) {
|
|
59
|
+
throw new Error('useGlobalContext must be used within a GlobalContext Provider');
|
|
60
|
+
}
|
|
61
|
+
return context;
|
|
62
|
+
}
|
|
63
|
+
export { RowndProvider, useRowndContext };
|
|
64
|
+
//# sourceMappingURL=GlobalContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useReducer","createContext","useEffect","useContext","NativeEventEmitter","LogBox","Platform","Linking","initialRowndState","rowndReducer","NativeRowndModules","Rownd","IOSRowndEventEmitter","ActionType","ignoreLogs","GlobalContext","undefined","eventEmitter","RowndProvider","children","config","customizations","state","dispatch","value","configure","onSessionConnect","event","type","UPDATE_STATE","payload","OS","JSON","parse","subscription","addListener","remove","addEventListener","handleSignInLink","url","initialUrl","getInitialURL","createElement","Provider","useRowndContext","context","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, LogBox, Platform, Linking } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nLogBox.ignoreLogs(['Sending `update_state` with no listeners registered.']);\nLogBox.ignoreLogs(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n customizations,\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config);\n if (customizations) {\n NativeRowndModules.customizations(customizations);\n }\n }, [config, customizations]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n // Handle deep linking\n useEffect(() => {\n const subscription = Linking.addEventListener('url', (event) =>\n NativeRowndModules.handleSignInLink(event.url)\n );\n\n (async () => {\n const initialUrl = await Linking.getInitialURL();\n if (initialUrl) {\n NativeRowndModules.handleSignInLink(initialUrl);\n }\n })();\n\n return () => subscription.remove();\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,UAAU,EACVC,aAAa,EAEbC,SAAS,EACTC,UAAU,QACL,OAAO;AACd,SAASC,kBAAkB,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,cAAc;AAC5E,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,yBAAyB;AAEzE,OAAO,KAAKC,kBAAkB,MAAM,uBAAuB;AAC3D,SAASC,KAAK,EAAEC,oBAAoB,QAAQ,uBAAuB;AAGnE,SAASC,UAAU,QAAQ,qBAAqB;AAEhDR,MAAM,CAACS,UAAU,CAAC,CAAC,sDAAsD,CAAC,CAAC;AAC3ET,MAAM,CAACS,UAAU,CAAC,CAAC,0CAA0C,CAAC,CAAC;AAE/D,OAAO,MAAMC,aAAa,gBAAGd,aAAa,CAExCe,SAAS,CAAC;AAEZ,MAAMC,YAAY,GAAG,IAAIb,kBAAkB,CAACQ,oBAAoB,IAAID,KAAK,CAAC;AAE1E,MAAMO,aAA8C,GAAGA,CAAC;EACtDC,QAAQ;EACRC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGvB,UAAU,CAACS,YAAY,EAAED,iBAAiB,CAAC;EACrE,MAAMgB,KAAK,GAAG;IAAEF,KAAK;IAAEC;EAAS,CAAC;EAEjCrB,SAAS,CAAC,MAAM;IACdQ,kBAAkB,CAACe,SAAS,CAACL,MAAM,CAAC;IACpC,IAAIC,cAAc,EAAE;MAClBX,kBAAkB,CAACW,cAAc,CAACA,cAAc,CAAC;IACnD;EACF,CAAC,EAAE,CAACD,MAAM,EAAEC,cAAc,CAAC,CAAC;EAE5BnB,SAAS,CAAC,MAAM;IACd,MAAMwB,gBAAgB,GAAIC,KAAU,IAAK;MACvCJ,QAAQ,CAAC;QACPK,IAAI,EAAEf,UAAU,CAACgB,YAAY;QAC7BC,OAAO,EAAExB,QAAQ,CAACyB,EAAE,KAAK,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACN,KAAK,CAACL,KAAK,CAAC,GAAGK;MACjE,CAAC,CAAC;IACJ,CAAC;IACD,MAAMO,YAAY,GAAGjB,YAAY,CAACkB,WAAW,CAC3C,cAAc,EACdT,gBACF,CAAC;IAED,IAAI,CAACQ,YAAY,EAAE;IAEnB,OAAO,MAAM;MACXA,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;;EAEN;EACAlC,SAAS,CAAC,MAAM;IACd,MAAMgC,YAAY,GAAG3B,OAAO,CAAC8B,gBAAgB,CAAC,KAAK,EAAGV,KAAK,IACzDjB,kBAAkB,CAAC4B,gBAAgB,CAACX,KAAK,CAACY,GAAG,CAC/C,CAAC;IAED,CAAC,YAAY;MACX,MAAMC,UAAU,GAAG,MAAMjC,OAAO,CAACkC,aAAa,CAAC,CAAC;MAChD,IAAID,UAAU,EAAE;QACd9B,kBAAkB,CAAC4B,gBAAgB,CAACE,UAAU,CAAC;MACjD;IACF,CAAC,EAAE,CAAC;IAEJ,OAAO,MAAMN,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,EAAE,CAAC;EAEN,oBACErC,KAAA,CAAA2C,aAAA,CAAC3B,aAAa,CAAC4B,QAAQ;IAACnB,KAAK,EAAEA;EAAM,GAAEL,QAAiC,CAAC;AAE7E,CAAC;AAED,SAASyB,eAAeA,CAAA,EAAG;EACzB,MAAMC,OAAO,GAAG1C,UAAU,CAACY,aAAa,CAAC;EAEzC,IAAI8B,OAAO,KAAK7B,SAAS,EAAE;IACzB,MAAM,IAAI8B,KAAK,CACb,+DACF,CAAC;EACH;EAEA,OAAOD,OAAO;AAChB;AAEA,SAAS3B,aAAa,EAAE0B,eAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["GlobalContext.types.ts"],"sourcesContent":["import type { TAction } from '../constants/action';\nimport type { Customizations, IConfig } from '../utils/config';\n\nexport type ContextProps = {\n config: IConfig;\n customizations?: Customizations;\n children?: React.ReactNode;\n};\n\nexport type Dispatch = (action: TAction) => void;\n\nexport type GlobalState = {\n // is_initializing: boolean;\n // is_container_visible: boolean;\n // use_modal: boolean;\n // nav: {\n // current_route: string;\n // route_trigger: string;\n // event_id: string;\n // section: string;\n // options?: any;\n // };\n user: {\n data: {\n id?: string;\n email?: string | null;\n [key: string]: any;\n };\n isLoading: boolean;\n // needs_refresh?: boolean;\n // redacted: string[];\n };\n auth: {\n access_token: string | null;\n refresh_token?: string | null;\n app_id: string | null;\n init_data?: Record<string, any>;\n is_verified_user?: boolean;\n auth_level?: string | null;\n };\n app: {\n id?: string;\n icon?: string;\n icon_content_type?: string;\n config: AppConfig | null;\n schema: AppSchema | null;\n user_verification_field?: string;\n user_verification_fields?: string[];\n };\n // local_acls: Record<string, { shared: boolean }> | null;\n // is_saving_user_data: boolean;\n config?: IConfig;\n};\n\ntype AppSchema = Record<string, SchemaField>;\n\nexport interface SchemaField {\n display_name: string;\n type: string;\n data_category: string;\n required: boolean;\n owned_by: string;\n user_visible: boolean;\n revoke_after: string;\n required_retention: string;\n collection_justification: string;\n opt_out_warning: string;\n}\n\nexport interface AppConfig {\n customizations: {\n primary_color: string;\n };\n default_user_id_format?: string;\n hub: {\n auth: {\n allow_unverified_users?: boolean;\n additional_fields: [\n {\n name: string;\n type: string;\n label: string;\n placeholder?: string;\n options: [\n {\n value: string;\n label: string;\n }\n ];\n }\n ];\n email: {\n from_address: string;\n image: string;\n };\n show_app_icon: boolean;\n };\n customizations: HubCustomizations;\n };\n}\n\nexport interface HubCustomizations {\n rounded_corners: boolean;\n primary_color: string;\n placement: 'bottom-left' | 'hidden';\n offset_x: number;\n offset_y: number;\n property_overrides: Record<string, string>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RowndProvider as RowndReactProvider } from '@supertokens/rownd-react';
|
|
3
|
+
const RowndProvider = ({
|
|
4
|
+
children,
|
|
5
|
+
config
|
|
6
|
+
}) => {
|
|
7
|
+
return /*#__PURE__*/React.createElement(RowndReactProvider, {
|
|
8
|
+
appKey: config.appKey,
|
|
9
|
+
supertokens: config.supertokens,
|
|
10
|
+
hubUrlOverride: config.hubUrlOverride
|
|
11
|
+
}, children);
|
|
12
|
+
};
|
|
13
|
+
export { RowndProvider };
|
|
14
|
+
//# sourceMappingURL=GlobalContext.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","RowndProvider","RowndReactProvider","children","config","createElement","appKey","supertokens","hubUrlOverride"],"sources":["GlobalContext.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { ContextProps } from './GlobalContext.types';\nimport { RowndProvider as RowndReactProvider } from '@supertokens/rownd-react';\n\nconst RowndProvider: React.FC<ContextProps> = ({ children, config }) => {\n return (\n <RowndReactProvider\n appKey={config.appKey}\n supertokens={config.supertokens}\n hubUrlOverride={config.hubUrlOverride}\n >\n {children}\n </RowndReactProvider>\n );\n};\n\nexport { RowndProvider };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,aAAa,IAAIC,kBAAkB,QAAQ,0BAA0B;AAE9E,MAAMD,aAAqC,GAAGA,CAAC;EAAEE,QAAQ;EAAEC;AAAO,CAAC,KAAK;EACtE,oBACEJ,KAAA,CAAAK,aAAA,CAACH,kBAAkB;IACjBI,MAAM,EAAEF,MAAM,CAACE,MAAO;IACtBC,WAAW,EAAEH,MAAM,CAACG,WAAY;IAChCC,cAAc,EAAEJ,MAAM,CAACI;EAAe,GAErCL,QACiB,CAAC;AAEzB,CAAC;AAED,SAASF,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useRownd } from '../hooks/rownd';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
const RequireSignIn = ({
|
|
5
|
+
children,
|
|
6
|
+
initializing,
|
|
7
|
+
signInProps
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
is_authenticated,
|
|
11
|
+
is_initializing,
|
|
12
|
+
requestSignIn
|
|
13
|
+
} = useRownd();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!is_authenticated && !is_initializing) {
|
|
16
|
+
requestSignIn({
|
|
17
|
+
...(Platform.OS === 'web' ? {
|
|
18
|
+
prevent_closing: true
|
|
19
|
+
} : undefined),
|
|
20
|
+
...signInProps
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}, [is_authenticated, is_initializing, signInProps, requestSignIn]);
|
|
24
|
+
if (is_initializing && initializing) {
|
|
25
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, initializing);
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
28
|
+
};
|
|
29
|
+
export default RequireSignIn;
|
|
30
|
+
//# sourceMappingURL=RequireSignIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRownd","Platform","RequireSignIn","children","initializing","signInProps","is_authenticated","is_initializing","requestSignIn","OS","prevent_closing","undefined","createElement","Fragment"],"sources":["RequireSignIn.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { useRownd } from '../hooks/rownd';\nimport type { RequestSignIn } from '../types';\nimport { Platform } from 'react-native';\n\nexport type ContextProps = {\n children?: React.ReactNode;\n initializing?: React.ReactNode;\n signInProps?: RequestSignIn;\n};\n\nconst RequireSignIn: React.FC<ContextProps> = ({\n children,\n initializing,\n signInProps,\n}) => {\n const { is_authenticated, is_initializing, requestSignIn } = useRownd();\n\n useEffect(() => {\n if (!is_authenticated && !is_initializing) {\n requestSignIn({\n ...(Platform.OS === 'web' ? { prevent_closing: true } : undefined),\n ...signInProps,\n });\n }\n }, [is_authenticated, is_initializing, signInProps, requestSignIn]);\n\n if (is_initializing && initializing) {\n return <>{initializing}</>;\n }\n\n return <>{children}</>;\n};\n\nexport default RequireSignIn;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,SAASC,QAAQ,QAAQ,cAAc;AAQvC,MAAMC,aAAqC,GAAGA,CAAC;EAC7CC,QAAQ;EACRC,YAAY;EACZC;AACF,CAAC,KAAK;EACJ,MAAM;IAAEC,gBAAgB;IAAEC,eAAe;IAAEC;EAAc,CAAC,GAAGR,QAAQ,CAAC,CAAC;EAEvED,SAAS,CAAC,MAAM;IACd,IAAI,CAACO,gBAAgB,IAAI,CAACC,eAAe,EAAE;MACzCC,aAAa,CAAC;QACZ,IAAIP,QAAQ,CAACQ,EAAE,KAAK,KAAK,GAAG;UAAEC,eAAe,EAAE;QAAK,CAAC,GAAGC,SAAS,CAAC;QAClE,GAAGN;MACL,CAAC,CAAC;IACJ;EACF,CAAC,EAAE,CAACC,gBAAgB,EAAEC,eAAe,EAAEF,WAAW,EAAEG,aAAa,CAAC,CAAC;EAEnE,IAAID,eAAe,IAAIH,YAAY,EAAE;IACnC,oBAAON,KAAA,CAAAc,aAAA,CAAAd,KAAA,CAAAe,QAAA,QAAGT,YAAe,CAAC;EAC5B;EAEA,oBAAON,KAAA,CAAAc,aAAA,CAAAd,KAAA,CAAAe,QAAA,QAAGV,QAAW,CAAC;AACxB,CAAC;AAED,eAAeD,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useRownd } from '../hooks/rownd';
|
|
3
|
+
const SignedIn = ({
|
|
4
|
+
children
|
|
5
|
+
}) => {
|
|
6
|
+
const {
|
|
7
|
+
is_authenticated
|
|
8
|
+
} = useRownd();
|
|
9
|
+
if (!is_authenticated) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
13
|
+
};
|
|
14
|
+
export default SignedIn;
|
|
15
|
+
//# sourceMappingURL=SignedIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useRownd","SignedIn","children","is_authenticated","createElement","Fragment"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from 'react';\nimport { useRownd } from '../hooks/rownd';\n\ninterface SignedInProps {\n children: React.ReactNode;\n}\n\nconst SignedIn: React.FC<SignedInProps> = ({ children }) => {\n const { is_authenticated } = useRownd();\n\n if (!is_authenticated) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport default SignedIn;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AAMzC,MAAMC,QAAiC,GAAGA,CAAC;EAAEC;AAAS,CAAC,KAAK;EAC1D,MAAM;IAAEC;EAAiB,CAAC,GAAGH,QAAQ,CAAC,CAAC;EAEvC,IAAI,CAACG,gBAAgB,EAAE;IACrB,OAAO,IAAI;EACb;EACA,oBAAOJ,KAAA,CAAAK,aAAA,CAAAL,KAAA,CAAAM,QAAA,QAAGH,QAAW,CAAC;AACxB,CAAC;AAED,eAAeD,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useRownd } from '../hooks/rownd';
|
|
3
|
+
const SignedOut = ({
|
|
4
|
+
children
|
|
5
|
+
}) => {
|
|
6
|
+
const {
|
|
7
|
+
is_authenticated
|
|
8
|
+
} = useRownd();
|
|
9
|
+
if (is_authenticated) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
13
|
+
};
|
|
14
|
+
export default SignedOut;
|
|
15
|
+
//# sourceMappingURL=SignedOut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useRownd","SignedOut","children","is_authenticated","createElement","Fragment"],"sources":["SignedOut.tsx"],"sourcesContent":["import React from 'react';\nimport { useRownd } from '../hooks/rownd';\n\ninterface SignedOutProps {\n children: React.ReactNode;\n}\n\nconst SignedOut: React.FC<SignedOutProps> = ({ children }) => {\n const { is_authenticated } = useRownd();\n\n if (is_authenticated) {\n return null;\n }\n return <>{children}</>;\n};\n\nexport default SignedOut;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,gBAAgB;AAMzC,MAAMC,SAAmC,GAAGA,CAAC;EAAEC;AAAS,CAAC,KAAK;EAC5D,MAAM;IAAEC;EAAiB,CAAC,GAAGH,QAAQ,CAAC,CAAC;EAEvC,IAAIG,gBAAgB,EAAE;IACpB,OAAO,IAAI;EACb;EACA,oBAAOJ,KAAA,CAAAK,aAAA,CAAAL,KAAA,CAAAM,QAAA,QAAGH,QAAW,CAAC;AACxB,CAAC;AAED,eAAeD,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActionType"],"sources":["action.ts"],"sourcesContent":["export enum ActionType {\n UPDATE_STATE = 'UPDATE_STATE',\n}\n\nexport type TAction = {\n type: ActionType;\n payload?: any;\n};\n"],"mappings":"AAAA,WAAYA,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { requestSignIn, signOut, manageAccount, getAccessToken, setUserDataValue, setUserData } from '../utils/nativeModule';
|
|
2
|
+
import { useRowndContext } from '../components/GlobalContext';
|
|
3
|
+
export function useRownd() {
|
|
4
|
+
const {
|
|
5
|
+
state
|
|
6
|
+
} = useRowndContext();
|
|
7
|
+
return {
|
|
8
|
+
access_token: state.auth.access_token,
|
|
9
|
+
auth: state.auth,
|
|
10
|
+
getAccessToken,
|
|
11
|
+
is_authenticated: !!state.auth.access_token,
|
|
12
|
+
is_initializing: !state.auth.app_id,
|
|
13
|
+
manageAccount,
|
|
14
|
+
requestSignIn,
|
|
15
|
+
signOut,
|
|
16
|
+
user: {
|
|
17
|
+
data: state.user.data,
|
|
18
|
+
setValue: setUserDataValue,
|
|
19
|
+
set: setUserData,
|
|
20
|
+
isLoading: state.user.isLoading
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=rownd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","access_token","auth","is_authenticated","is_initializing","app_id","user","data","setValue","set","isLoading"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\nimport type {\n RequestSignIn,\n RequestSignInMethods,\n RequestSignInIntent,\n} from '../types';\n\nexport type { RequestSignIn, RequestSignInMethods, RequestSignInIntent };\n\nexport type TRowndContext = {\n access_token: string | null;\n auth: AuthContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n getAccessToken: () => Promise<string>;\n manageAccount: () => void;\n requestSignIn: (e?: RequestSignIn) => void;\n signOut: () => void;\n user: UserContext;\n};\n\ntype UserContext = {\n data: {\n user_id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n isLoading: boolean;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n auth_level?: string | null;\n};\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n access_token: state.auth.access_token,\n auth: state.auth,\n getAccessToken,\n is_authenticated: !!state.auth.access_token,\n is_initializing: !state.auth.app_id,\n manageAccount,\n requestSignIn,\n signOut,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n isLoading: state.user.isLoading,\n },\n };\n}\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,OAAO,EACPC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,WAAW,QACN,uBAAuB;AAC9B,SAASC,eAAe,QAAQ,6BAA6B;AAwC7D,OAAO,SAASC,QAAQA,CAAA,EAAkB;EACxC,MAAM;IAAEC;EAAM,CAAC,GAAGF,eAAe,CAAC,CAAC;EAEnC,OAAO;IACLG,YAAY,EAAED,KAAK,CAACE,IAAI,CAACD,YAAY;IACrCC,IAAI,EAAEF,KAAK,CAACE,IAAI;IAChBP,cAAc;IACdQ,gBAAgB,EAAE,CAAC,CAACH,KAAK,CAACE,IAAI,CAACD,YAAY;IAC3CG,eAAe,EAAE,CAACJ,KAAK,CAACE,IAAI,CAACG,MAAM;IACnCX,aAAa;IACbF,aAAa;IACbC,OAAO;IACPa,IAAI,EAAE;MACJC,IAAI,EAAEP,KAAK,CAACM,IAAI,CAACC,IAAI;MACrBC,QAAQ,EAAEZ,gBAAgB;MAC1Ba,GAAG,EAAEZ,WAAW;MAChBa,SAAS,EAAEV,KAAK,CAACM,IAAI,CAACI;IACxB;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useRownd as useReactRownd } from '@supertokens/rownd-react';
|
|
2
|
+
function toWebSignInOptions(opts) {
|
|
3
|
+
if (!opts) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
const method = opts.method === 'guest' ? 'anonymous' : opts.method;
|
|
7
|
+
return {
|
|
8
|
+
...opts,
|
|
9
|
+
method,
|
|
10
|
+
post_login_redirect: opts.postSignInRedirect
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function useRownd() {
|
|
14
|
+
const {
|
|
15
|
+
requestSignIn,
|
|
16
|
+
signOut,
|
|
17
|
+
getAccessToken,
|
|
18
|
+
is_authenticated,
|
|
19
|
+
is_initializing,
|
|
20
|
+
auth,
|
|
21
|
+
access_token,
|
|
22
|
+
user,
|
|
23
|
+
manageAccount,
|
|
24
|
+
setUser,
|
|
25
|
+
setUserValue
|
|
26
|
+
} = useReactRownd();
|
|
27
|
+
return {
|
|
28
|
+
access_token,
|
|
29
|
+
auth: {
|
|
30
|
+
access_token,
|
|
31
|
+
app_id: auth.app_id || null,
|
|
32
|
+
is_verified_user: auth.is_verified_user,
|
|
33
|
+
auth_level: auth.auth_level
|
|
34
|
+
},
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
getAccessToken,
|
|
37
|
+
is_authenticated,
|
|
38
|
+
is_initializing,
|
|
39
|
+
manageAccount,
|
|
40
|
+
requestSignIn: opts => requestSignIn(toWebSignInOptions(opts)),
|
|
41
|
+
signOut,
|
|
42
|
+
user: {
|
|
43
|
+
data: user.data,
|
|
44
|
+
setValue: setUserValue,
|
|
45
|
+
set: setUser,
|
|
46
|
+
isLoading: Boolean(user.isLoading ?? user.is_loading)
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=rownd.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRownd","useReactRownd","toWebSignInOptions","opts","undefined","method","post_login_redirect","postSignInRedirect","requestSignIn","signOut","getAccessToken","is_authenticated","is_initializing","auth","access_token","user","manageAccount","setUser","setUserValue","app_id","is_verified_user","auth_level","data","setValue","set","isLoading","Boolean","is_loading"],"sources":["rownd.web.ts"],"sourcesContent":["import { useRownd as useReactRownd } from '@supertokens/rownd-react';\nimport type { TRowndContext } from './rownd';\nimport type { RequestSignIn } from '../types';\n\nfunction toWebSignInOptions(opts?: RequestSignIn) {\n if (!opts) {\n return undefined;\n }\n\n const method = opts.method === 'guest' ? 'anonymous' : opts.method;\n\n return {\n ...opts,\n method,\n post_login_redirect: opts.postSignInRedirect,\n };\n}\n\nexport function useRownd(): TRowndContext {\n const {\n requestSignIn,\n signOut,\n getAccessToken,\n is_authenticated,\n is_initializing,\n auth,\n access_token,\n user,\n manageAccount,\n setUser,\n setUserValue,\n } = useReactRownd() as any;\n\n return {\n access_token,\n auth: {\n access_token,\n app_id: auth.app_id || null,\n is_verified_user: auth.is_verified_user,\n auth_level: auth.auth_level,\n },\n // @ts-ignore\n getAccessToken,\n is_authenticated,\n is_initializing,\n manageAccount,\n requestSignIn: (opts) => requestSignIn(toWebSignInOptions(opts)),\n signOut,\n user: {\n data: user.data,\n setValue: setUserValue,\n set: setUser,\n isLoading: Boolean(user.isLoading ?? user.is_loading),\n },\n };\n}\n"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,aAAa,QAAQ,0BAA0B;AAIpE,SAASC,kBAAkBA,CAACC,IAAoB,EAAE;EAChD,IAAI,CAACA,IAAI,EAAE;IACT,OAAOC,SAAS;EAClB;EAEA,MAAMC,MAAM,GAAGF,IAAI,CAACE,MAAM,KAAK,OAAO,GAAG,WAAW,GAAGF,IAAI,CAACE,MAAM;EAElE,OAAO;IACL,GAAGF,IAAI;IACPE,MAAM;IACNC,mBAAmB,EAAEH,IAAI,CAACI;EAC5B,CAAC;AACH;AAEA,OAAO,SAASP,QAAQA,CAAA,EAAkB;EACxC,MAAM;IACJQ,aAAa;IACbC,OAAO;IACPC,cAAc;IACdC,gBAAgB;IAChBC,eAAe;IACfC,IAAI;IACJC,YAAY;IACZC,IAAI;IACJC,aAAa;IACbC,OAAO;IACPC;EACF,CAAC,GAAGjB,aAAa,CAAC,CAAQ;EAE1B,OAAO;IACLa,YAAY;IACZD,IAAI,EAAE;MACJC,YAAY;MACZK,MAAM,EAAEN,IAAI,CAACM,MAAM,IAAI,IAAI;MAC3BC,gBAAgB,EAAEP,IAAI,CAACO,gBAAgB;MACvCC,UAAU,EAAER,IAAI,CAACQ;IACnB,CAAC;IACD;IACAX,cAAc;IACdC,gBAAgB;IAChBC,eAAe;IACfI,aAAa;IACbR,aAAa,EAAGL,IAAI,IAAKK,aAAa,CAACN,kBAAkB,CAACC,IAAI,CAAC,CAAC;IAChEM,OAAO;IACPM,IAAI,EAAE;MACJO,IAAI,EAAEP,IAAI,CAACO,IAAI;MACfC,QAAQ,EAAEL,YAAY;MACtBM,GAAG,EAAEP,OAAO;MACZQ,SAAS,EAAEC,OAAO,CAACX,IAAI,CAACU,SAAS,IAAIV,IAAI,CAACY,UAAU;IACtD;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RowndProvider } from './components/GlobalContext';
|
|
2
|
+
import { useRownd } from './hooks/rownd';
|
|
3
|
+
import RequireSignIn from './components/RequireSignIn';
|
|
4
|
+
import SignedIn from './components/SignedIn';
|
|
5
|
+
import SignedOut from './components/SignedOut';
|
|
6
|
+
export { RowndProvider, useRownd, RequireSignIn, SignedIn, SignedOut };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RowndProvider","useRownd","RequireSignIn","SignedIn","SignedOut"],"sources":["index.tsx"],"sourcesContent":["import { RowndProvider } from './components/GlobalContext';\nimport { useRownd } from './hooks/rownd';\nimport RequireSignIn from './components/RequireSignIn';\nimport SignedIn from './components/SignedIn';\nimport SignedOut from './components/SignedOut';\n\nexport { RowndProvider, useRownd, RequireSignIn, SignedIn, SignedOut };\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,QAAQ,QAAQ,eAAe;AACxC,OAAOC,aAAa,MAAM,4BAA4B;AACtD,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,SAAS,MAAM,wBAAwB;AAE9C,SAASJ,aAAa,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ActionType } from '../constants/action';
|
|
2
|
+
export const initialRowndState = {
|
|
3
|
+
// is_initializing: false,
|
|
4
|
+
user: {
|
|
5
|
+
data: {
|
|
6
|
+
email: null
|
|
7
|
+
},
|
|
8
|
+
isLoading: false
|
|
9
|
+
// meta: {}
|
|
10
|
+
},
|
|
11
|
+
auth: {
|
|
12
|
+
access_token: null,
|
|
13
|
+
refresh_token: null,
|
|
14
|
+
app_id: null
|
|
15
|
+
},
|
|
16
|
+
app: {
|
|
17
|
+
schema: null,
|
|
18
|
+
config: null
|
|
19
|
+
}
|
|
20
|
+
// is_saving_user_data: false,
|
|
21
|
+
// config,
|
|
22
|
+
};
|
|
23
|
+
export function rowndReducer(state, action) {
|
|
24
|
+
var _action$payload, _action$payload2, _action$payload3, _user$data;
|
|
25
|
+
let newState;
|
|
26
|
+
switch (action.type) {
|
|
27
|
+
case ActionType.UPDATE_STATE:
|
|
28
|
+
const user = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.user) || {};
|
|
29
|
+
const auth = ((_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : _action$payload2.auth) || {};
|
|
30
|
+
const appConfig = ((_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : _action$payload3.appConfig) || {};
|
|
31
|
+
newState = {
|
|
32
|
+
user: {
|
|
33
|
+
data: {
|
|
34
|
+
...user.data,
|
|
35
|
+
email: (_user$data = user.data) === null || _user$data === void 0 ? void 0 : _user$data.email
|
|
36
|
+
},
|
|
37
|
+
isLoading: Boolean(user.isLoading ?? user.is_loading)
|
|
38
|
+
// meta: {}
|
|
39
|
+
},
|
|
40
|
+
auth: {
|
|
41
|
+
access_token: auth.access_token ?? null,
|
|
42
|
+
refresh_token: auth.refresh_token ?? null,
|
|
43
|
+
app_id: appConfig.id || auth.app_id || null,
|
|
44
|
+
is_verified_user: auth.is_verified_user,
|
|
45
|
+
auth_level: auth.auth_level ?? user.auth_level ?? null
|
|
46
|
+
},
|
|
47
|
+
app: {
|
|
48
|
+
schema: appConfig.schema ?? null,
|
|
49
|
+
config: null
|
|
50
|
+
}
|
|
51
|
+
// is_saving_user_data: false,
|
|
52
|
+
// config
|
|
53
|
+
};
|
|
54
|
+
return newState;
|
|
55
|
+
default:
|
|
56
|
+
newState = state;
|
|
57
|
+
return newState;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=rowndReducer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActionType","initialRowndState","user","data","email","isLoading","auth","access_token","refresh_token","app_id","app","schema","config","rowndReducer","state","action","_action$payload","_action$payload2","_action$payload3","_user$data","newState","type","UPDATE_STATE","payload","appConfig","Boolean","is_loading","id","is_verified_user","auth_level"],"sources":["rowndReducer.ts"],"sourcesContent":["import type { GlobalState } from '../components/GlobalContext.types';\nimport { ActionType, TAction } from '../constants/action';\n\nexport const initialRowndState: GlobalState = {\n // is_initializing: false,\n user: {\n data: {\n email: null,\n },\n isLoading: false,\n // meta: {}\n },\n auth: {\n access_token: null,\n refresh_token: null,\n app_id: null,\n },\n app: {\n schema: null,\n config: null,\n },\n // is_saving_user_data: false,\n // config,\n};\n\nexport function rowndReducer(state: GlobalState, action: TAction): GlobalState {\n let newState: GlobalState;\n\n switch (action.type) {\n case ActionType.UPDATE_STATE:\n const user = action.payload?.user || {};\n const auth = action.payload?.auth || {};\n const appConfig = action.payload?.appConfig || {};\n\n newState = {\n user: {\n data: {\n ...user.data,\n email: user.data?.email,\n },\n isLoading: Boolean(user.isLoading ?? user.is_loading),\n // meta: {}\n },\n auth: {\n access_token: auth.access_token ?? null,\n refresh_token: auth.refresh_token ?? null,\n app_id: appConfig.id || auth.app_id || null,\n is_verified_user: auth.is_verified_user,\n auth_level: auth.auth_level ?? user.auth_level ?? null,\n },\n app: {\n schema: appConfig.schema ?? null,\n config: null,\n },\n // is_saving_user_data: false,\n // config\n };\n return newState;\n default:\n newState = state;\n return newState;\n }\n}\n"],"mappings":"AACA,SAASA,UAAU,QAAiB,qBAAqB;AAEzD,OAAO,MAAMC,iBAA8B,GAAG;EAC5C;EACAC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,KAAK,EAAE;IACT,CAAC;IACDC,SAAS,EAAE;IACX;EACF,CAAC;EACDC,IAAI,EAAE;IACJC,YAAY,EAAE,IAAI;IAClBC,aAAa,EAAE,IAAI;IACnBC,MAAM,EAAE;EACV,CAAC;EACDC,GAAG,EAAE;IACHC,MAAM,EAAE,IAAI;IACZC,MAAM,EAAE;EACV;EACA;EACA;AACF,CAAC;AAED,OAAO,SAASC,YAAYA,CAACC,KAAkB,EAAEC,MAAe,EAAe;EAAA,IAAAC,eAAA,EAAAC,gBAAA,EAAAC,gBAAA,EAAAC,UAAA;EAC7E,IAAIC,QAAqB;EAEzB,QAAQL,MAAM,CAACM,IAAI;IACjB,KAAKrB,UAAU,CAACsB,YAAY;MAC1B,MAAMpB,IAAI,GAAG,EAAAc,eAAA,GAAAD,MAAM,CAACQ,OAAO,cAAAP,eAAA,uBAAdA,eAAA,CAAgBd,IAAI,KAAI,CAAC,CAAC;MACvC,MAAMI,IAAI,GAAG,EAAAW,gBAAA,GAAAF,MAAM,CAACQ,OAAO,cAAAN,gBAAA,uBAAdA,gBAAA,CAAgBX,IAAI,KAAI,CAAC,CAAC;MACvC,MAAMkB,SAAS,GAAG,EAAAN,gBAAA,GAAAH,MAAM,CAACQ,OAAO,cAAAL,gBAAA,uBAAdA,gBAAA,CAAgBM,SAAS,KAAI,CAAC,CAAC;MAEjDJ,QAAQ,GAAG;QACTlB,IAAI,EAAE;UACJC,IAAI,EAAE;YACJ,GAAGD,IAAI,CAACC,IAAI;YACZC,KAAK,GAAAe,UAAA,GAAEjB,IAAI,CAACC,IAAI,cAAAgB,UAAA,uBAATA,UAAA,CAAWf;UACpB,CAAC;UACDC,SAAS,EAAEoB,OAAO,CAACvB,IAAI,CAACG,SAAS,IAAIH,IAAI,CAACwB,UAAU;UACpD;QACF,CAAC;QACDpB,IAAI,EAAE;UACJC,YAAY,EAAED,IAAI,CAACC,YAAY,IAAI,IAAI;UACvCC,aAAa,EAAEF,IAAI,CAACE,aAAa,IAAI,IAAI;UACzCC,MAAM,EAAEe,SAAS,CAACG,EAAE,IAAIrB,IAAI,CAACG,MAAM,IAAI,IAAI;UAC3CmB,gBAAgB,EAAEtB,IAAI,CAACsB,gBAAgB;UACvCC,UAAU,EAAEvB,IAAI,CAACuB,UAAU,IAAI3B,IAAI,CAAC2B,UAAU,IAAI;QACpD,CAAC;QACDnB,GAAG,EAAE;UACHC,MAAM,EAAEa,SAAS,CAACb,MAAM,IAAI,IAAI;UAChCC,MAAM,EAAE;QACV;QACA;QACA;MACF,CAAC;MACD,OAAOQ,QAAQ;IACjB;MACEA,QAAQ,GAAGN,KAAK;MAChB,OAAOM,QAAQ;EACnB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type SuperTokensConfig = {\n appInfo: {\n appName?: string;\n apiDomain: string;\n apiBasePath?: string;\n };\n};\n\nexport type RowndProviderConfig = {\n appKey: string;\n supertokens: SuperTokensConfig;\n hubUrlOverride?: string;\n deepLinkScheme?: string;\n};\n\nexport type RequestSignInMethods =\n | 'default'\n | 'email'\n | 'phone'\n | 'google'\n | 'apple'\n | 'anonymous'\n | 'guest';\n\nexport type RequestSignInIntent = 'sign_in' | 'sign_up';\n\nexport type RequestSignIn = {\n method?: RequestSignInMethods;\n postSignInRedirect?: string;\n intent?: RequestSignInIntent;\n prevent_closing?: boolean;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["config.ts"],"sourcesContent":["import type { RowndProviderConfig } from '../types';\n\nexport type IConfig = RowndProviderConfig;\n\nexport interface Customizations {\n sheetBackgroundHexColor?: string;\n sheetCornerBorderRadius?: string;\n loadingAnimation?: string;\n}\n"],"mappings":"","ignoreList":[]}
|