@startbahn/startrail-sdk-js 1.31.0-beta.2 → 1.31.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/startrail-sdk.js +200 -138
- package/package.json +1 -1
package/dist/startrail-sdk.js
CHANGED
|
@@ -131033,17 +131033,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
131033
131033
|
});
|
|
131034
131034
|
};
|
|
131035
131035
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
131036
|
-
exports.getCallabckUrl = void 0;
|
|
131037
131036
|
/* eslint-disable no-unused-vars */
|
|
131038
131037
|
const util_1 = __webpack_require__(/*! ./util */ "./src/configContext/util.ts");
|
|
131039
|
-
const util_2 = __webpack_require__(/*! ../util */ "./src/util.ts");
|
|
131040
131038
|
const constant_1 = __webpack_require__(/*! ../constant */ "./src/constant.ts");
|
|
131041
|
-
const
|
|
131039
|
+
const torusSocialLogin_1 = __webpack_require__(/*! ./torusSocialLogin */ "./src/configContext/torusSocialLogin.ts");
|
|
131042
131040
|
/**
|
|
131043
131041
|
* Config properties for torus-embed init()
|
|
131044
131042
|
*/
|
|
131045
131043
|
const torusConfig = (config) => {
|
|
131046
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
131044
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
131047
131045
|
return {
|
|
131048
131046
|
buildEnv: config.network.torusEnv,
|
|
131049
131047
|
skipTKey: true,
|
|
@@ -131065,6 +131063,7 @@ const torusConfig = (config) => {
|
|
|
131065
131063
|
}
|
|
131066
131064
|
},
|
|
131067
131065
|
defaultLanguage: config.lang,
|
|
131066
|
+
// FIXME: this is a bug on Torus. They set the logoLight for light background on passwordless email other way around.
|
|
131068
131067
|
logoDark: ((_a = config === null || config === void 0 ? void 0 : config.customUi) === null || _a === void 0 ? void 0 : _a.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
|
|
131069
131068
|
logoLight: ((_b = config === null || config === void 0 ? void 0 : config.customUi) === null || _b === void 0 ? void 0 : _b.logoWhiteUrl) || ((_c = config === null || config === void 0 ? void 0 : config.customUi) === null || _c === void 0 ? void 0 : _c.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).white,
|
|
131070
131069
|
topupHide: true,
|
|
@@ -131080,119 +131079,48 @@ const torusConfig = (config) => {
|
|
|
131080
131079
|
disclaimerHide: true,
|
|
131081
131080
|
customTranslations: formatConfigForTorusUI(config) // Most properties for UI customization are here.
|
|
131082
131081
|
},
|
|
131083
|
-
|
|
131082
|
+
// These settings matters only for the modal, not anything to do with individual login process
|
|
131083
|
+
loginConfig: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, torusSocialLogin_1.getModalConfigByLoginProviders(config.loginProvider, 'apple')), torusSocialLogin_1.getModalConfigByLoginProviders(config.loginProvider, 'facebook')), torusSocialLogin_1.getModalConfigByLoginProviders(config.loginProvider, 'google')), torusSocialLogin_1.getModalConfigByLoginProviders(config.loginProvider, 'twitter')), torusSocialLogin_1.getModalConfigByLoginProviders(config.loginProvider, 'email_passwordless')), torusSocialLogin_1.getCustomLoginConfig(config)), {
|
|
131084
|
+
// Deactivating Social Login
|
|
131084
131085
|
discord: {
|
|
131085
131086
|
showOnModal: false
|
|
131086
|
-
},
|
|
131087
|
-
'discord-lrc': {
|
|
131088
|
-
showOnModal: false
|
|
131089
|
-
},
|
|
131090
|
-
facebook: {
|
|
131091
|
-
showOnModal: false
|
|
131092
|
-
},
|
|
131093
|
-
'facebook-lrc': {
|
|
131094
|
-
showOnModal: false
|
|
131095
|
-
},
|
|
131096
|
-
// Deactivate Google logo only for user coming from Auth0 signup mail verification to encourage Auth0 login under the name of better UX
|
|
131097
|
-
google: {
|
|
131098
|
-
showOnModal: config.loginProvider.google
|
|
131099
|
-
},
|
|
131100
|
-
'google-lrc': {
|
|
131101
|
-
showOnModal: config.loginProvider.google
|
|
131102
|
-
},
|
|
131103
|
-
reddit: {
|
|
131104
|
-
showOnModal: false
|
|
131105
|
-
},
|
|
131106
|
-
'reddit-lrc': {
|
|
131107
|
-
showOnModal: false
|
|
131108
|
-
},
|
|
131109
|
-
'torus-auth0-apple': {
|
|
131110
|
-
showOnModal: false
|
|
131111
|
-
},
|
|
131112
|
-
'torus-auth0-apple-lrc': {
|
|
131113
|
-
showOnModal: false
|
|
131114
|
-
},
|
|
131115
|
-
'torus-auth0-email-passwordless': {
|
|
131116
|
-
showOnModal: false
|
|
131117
|
-
},
|
|
131118
|
-
'torus-auth0-email-passwordless-lrc': {
|
|
131087
|
+
}, 'discord-lrc': {
|
|
131119
131088
|
showOnModal: false
|
|
131120
|
-
},
|
|
131121
|
-
'torus-auth0-github': {
|
|
131089
|
+
}, reddit: {
|
|
131122
131090
|
showOnModal: false
|
|
131123
|
-
},
|
|
131124
|
-
'torus-auth0-github-lrc': {
|
|
131091
|
+
}, 'reddit-lrc': {
|
|
131125
131092
|
showOnModal: false
|
|
131126
|
-
},
|
|
131127
|
-
|
|
131093
|
+
},
|
|
131094
|
+
// Intentionally deactivate defatul Torus because we are using custom LINE to get user Email
|
|
131095
|
+
'torus-auth0-line': {
|
|
131128
131096
|
showOnModal: false
|
|
131129
|
-
},
|
|
131130
|
-
'torus-auth0-kakao-lrc': {
|
|
131097
|
+
}, 'torus-auth0-line-lrc': {
|
|
131131
131098
|
showOnModal: false
|
|
131132
|
-
},
|
|
131133
|
-
'torus-auth0-line': {
|
|
131099
|
+
}, 'torus-auth0-github': {
|
|
131134
131100
|
showOnModal: false
|
|
131135
|
-
},
|
|
131136
|
-
'torus-auth0-line-lrc': {
|
|
131101
|
+
}, 'torus-auth0-github-lrc': {
|
|
131137
131102
|
showOnModal: false
|
|
131138
|
-
},
|
|
131139
|
-
'torus-auth0-linkedin': {
|
|
131103
|
+
}, 'torus-auth0-kakao': {
|
|
131140
131104
|
showOnModal: false
|
|
131141
|
-
},
|
|
131142
|
-
'torus-auth0-linkedin-lrc': {
|
|
131105
|
+
}, 'torus-auth0-kakao-lrc': {
|
|
131143
131106
|
showOnModal: false
|
|
131144
|
-
},
|
|
131145
|
-
'torus-auth0-twitter': {
|
|
131107
|
+
}, 'torus-auth0-linkedin': {
|
|
131146
131108
|
showOnModal: false
|
|
131147
|
-
},
|
|
131148
|
-
'torus-auth0-twitter-lrc': {
|
|
131109
|
+
}, 'torus-auth0-linkedin-lrc': {
|
|
131149
131110
|
showOnModal: false
|
|
131150
|
-
},
|
|
131151
|
-
'torus-auth0-weibo': {
|
|
131111
|
+
}, 'torus-auth0-weibo': {
|
|
131152
131112
|
showOnModal: false
|
|
131153
|
-
},
|
|
131154
|
-
'torus-auth0-weibo-lrc': {
|
|
131113
|
+
}, 'torus-auth0-weibo-lrc': {
|
|
131155
131114
|
showOnModal: false
|
|
131156
|
-
},
|
|
131157
|
-
twitch: {
|
|
131115
|
+
}, twitch: {
|
|
131158
131116
|
showOnModal: false
|
|
131159
|
-
},
|
|
131160
|
-
'twitch-lrc': {
|
|
131117
|
+
}, 'twitch-lrc': {
|
|
131161
131118
|
showOnModal: false
|
|
131162
|
-
},
|
|
131163
|
-
'torus-auth0-wechat': {
|
|
131119
|
+
}, 'torus-auth0-wechat': {
|
|
131164
131120
|
showOnModal: false
|
|
131165
|
-
},
|
|
131166
|
-
'torus-auth0-wechat-lrc': {
|
|
131121
|
+
}, 'torus-auth0-wechat-lrc': {
|
|
131167
131122
|
showOnModal: false
|
|
131168
|
-
}
|
|
131169
|
-
[config.auth0TorusConfigKey]: {
|
|
131170
|
-
name: 'email',
|
|
131171
|
-
typeOfLogin: 'email_password',
|
|
131172
|
-
description: 'login.buttonText',
|
|
131173
|
-
clientId: config.auth0ClientId,
|
|
131174
|
-
logoHover: ((_v = config === null || config === void 0 ? void 0 : config.customUi) === null || _v === void 0 ? void 0 : _v.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
|
|
131175
|
-
logoLight: ((_w = config === null || config === void 0 ? void 0 : config.customUi) === null || _w === void 0 ? void 0 : _w.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).white,
|
|
131176
|
-
logoDark: ((_x = config === null || config === void 0 ? void 0 : config.customUi) === null || _x === void 0 ? void 0 : _x.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
|
|
131177
|
-
showOnModal: config.loginProvider.emailPassword,
|
|
131178
|
-
priority: 1,
|
|
131179
|
-
mainOption: false,
|
|
131180
|
-
showOnMobile: true,
|
|
131181
|
-
showOnDesktop: true,
|
|
131182
|
-
jwtParameters: {
|
|
131183
|
-
disable_signup: !config.authAction.signup,
|
|
131184
|
-
disable_login: !config.authAction.login,
|
|
131185
|
-
domain: config.auth0Domain,
|
|
131186
|
-
callback_url: config.callbackUrl || exports.getCallabckUrl(),
|
|
131187
|
-
contactUrl: ((_y = config === null || config === void 0 ? void 0 : config.customUi) === null || _y === void 0 ? void 0 : _y.contactUrl) || constant_1.CONTACT_EMAIL,
|
|
131188
|
-
serviceName: ((_z = config === null || config === void 0 ? void 0 : config.customUi) === null || _z === void 0 ? void 0 : _z.serviceName) || constant_1.APP,
|
|
131189
|
-
logoURL: ((_0 = config.customUi) === null || _0 === void 0 ? void 0 : _0.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
|
|
131190
|
-
titleSignup: ((_4 = (_3 = (_2 = (_1 = config.customUi) === null || _1 === void 0 ? void 0 : _1.words) === null || _2 === void 0 ? void 0 : _2[config.lang]) === null || _3 === void 0 ? void 0 : _3.emailAuthPopup) === null || _4 === void 0 ? void 0 : _4['titleSignup']) || constant_1.EMAIL_PASSWORD_POPUP_LABEL.SIGNUP[config.lang],
|
|
131191
|
-
titleLogin: ((_8 = (_7 = (_6 = (_5 = config.customUi) === null || _5 === void 0 ? void 0 : _5.words) === null || _6 === void 0 ? void 0 : _6[config.lang]) === null || _7 === void 0 ? void 0 : _7.emailAuthPopup) === null || _8 === void 0 ? void 0 : _8['titleLogin']) || constant_1.EMAIL_PASSWORD_POPUP_LABEL.LOGIN[config.lang],
|
|
131192
|
-
ui_locales: config.lang
|
|
131193
|
-
}
|
|
131194
|
-
}
|
|
131195
|
-
}
|
|
131123
|
+
} })
|
|
131196
131124
|
};
|
|
131197
131125
|
};
|
|
131198
131126
|
const serviceName = (config) => {
|
|
@@ -131249,16 +131177,6 @@ const formatConfigForTorusUI = (config) => {
|
|
|
131249
131177
|
}
|
|
131250
131178
|
return customUi;
|
|
131251
131179
|
};
|
|
131252
|
-
/**
|
|
131253
|
-
* For backward-compatibility
|
|
131254
|
-
*/
|
|
131255
|
-
exports.getCallabckUrl = () => {
|
|
131256
|
-
const url = new URL(globalThis.location.href);
|
|
131257
|
-
const callback = url.searchParams.get('callback');
|
|
131258
|
-
if (!callback)
|
|
131259
|
-
return '';
|
|
131260
|
-
return util_2.checkCallbackUrl(callback) ? callback : '';
|
|
131261
|
-
};
|
|
131262
131180
|
class TorusConfigContext {
|
|
131263
131181
|
/**
|
|
131264
131182
|
* Store preConfig so that data passed for overwriting is always through
|
|
@@ -131276,7 +131194,7 @@ class TorusConfigContext {
|
|
|
131276
131194
|
// with rest of the data kept as it is.
|
|
131277
131195
|
return Object.assign(Object.assign(Object.assign({}, this.torusContextConfig.preConfig), Object.assign(Object.assign({}, config), { lang: config.lang })), {
|
|
131278
131196
|
network: this.network(this.torusContextConfig.config.buildEnv, config === null || config === void 0 ? void 0 : config.rpcEndpoint),
|
|
131279
|
-
loginProvider:
|
|
131197
|
+
loginProvider: config === null || config === void 0 ? void 0 : config.loginProvider,
|
|
131280
131198
|
conditionalWords: this.convertWordsByAuthProvider(config)
|
|
131281
131199
|
});
|
|
131282
131200
|
};
|
|
@@ -131288,7 +131206,7 @@ class TorusConfigContext {
|
|
|
131288
131206
|
auth0TorusConfigKey: (config === null || config === void 0 ? void 0 : config.auth0TorusConfigKey) || constant_1.AUTH0_TORUS_CONFIG_KEY,
|
|
131289
131207
|
auth0Domain: (config === null || config === void 0 ? void 0 : config.auth0Domain) || constant_1.AUTH0_DOMAIN,
|
|
131290
131208
|
lang: ((config === null || config === void 0 ? void 0 : config.lang) !== constant_1.LANG.JP ? constant_1.LANG.EN : constant_1.LANG.JP),
|
|
131291
|
-
loginProvider:
|
|
131209
|
+
loginProvider: config === null || config === void 0 ? void 0 : config.loginProvider,
|
|
131292
131210
|
network: this.network(config === null || config === void 0 ? void 0 : config.env, config === null || config === void 0 ? void 0 : config.rpcEndpoint),
|
|
131293
131211
|
callbackUrl: (config === null || config === void 0 ? void 0 : config.callbackUrl) || null,
|
|
131294
131212
|
withModal: (config === null || config === void 0 ? void 0 : config.withModal) || false,
|
|
@@ -131332,21 +131250,12 @@ class TorusConfigContext {
|
|
|
131332
131250
|
return this.torusContextConfig.config;
|
|
131333
131251
|
}
|
|
131334
131252
|
/**
|
|
131335
|
-
*
|
|
131253
|
+
* Set login config for direct login without modal
|
|
131336
131254
|
*/
|
|
131337
|
-
|
|
131338
|
-
|
|
131339
|
-
|
|
131340
|
-
|
|
131341
|
-
const torusEnv = this.torusContextConfig.preConfig.network.torusEnv;
|
|
131342
|
-
if (torusEnv && torusEnv !== 'production')
|
|
131343
|
-
suffix = `-lrc`;
|
|
131344
|
-
if (this.torusContextConfig.preConfig.loginProvider.google) {
|
|
131345
|
-
return { verifier: `google${suffix}` };
|
|
131346
|
-
}
|
|
131347
|
-
else if (this.torusContextConfig.preConfig.loginProvider.emailPassword) {
|
|
131348
|
-
return { verifier: this.torusContextConfig.preConfig.auth0TorusConfigKey };
|
|
131349
|
-
}
|
|
131255
|
+
getDirectLoginConfig() {
|
|
131256
|
+
const preConfig = this.torusContextConfig.preConfig;
|
|
131257
|
+
const verifier = torusSocialLogin_1.getVerifierByLoginProvider(preConfig.loginProvider, preConfig.network.appEnv, preConfig.withModal, preConfig.auth0TorusConfigKey);
|
|
131258
|
+
return verifier ? { verifier } : {};
|
|
131350
131259
|
}
|
|
131351
131260
|
network(env, rpcEndpoint) {
|
|
131352
131261
|
const blockchainNetwork = (envKey) => {
|
|
@@ -131359,42 +131268,35 @@ class TorusConfigContext {
|
|
|
131359
131268
|
case 'staging':
|
|
131360
131269
|
return {
|
|
131361
131270
|
torusEnv: 'production',
|
|
131271
|
+
appEnv: 'STG',
|
|
131362
131272
|
ethereumNetwork: blockchainNetwork('DEV')
|
|
131363
131273
|
};
|
|
131364
131274
|
case 'lrc':
|
|
131365
131275
|
return {
|
|
131366
131276
|
torusEnv: 'lrc',
|
|
131277
|
+
appEnv: 'DEV',
|
|
131367
131278
|
ethereumNetwork: blockchainNetwork('DEV')
|
|
131368
131279
|
};
|
|
131369
131280
|
case 'beta':
|
|
131370
131281
|
return {
|
|
131371
131282
|
torusEnv: 'beta',
|
|
131283
|
+
appEnv: 'DEV',
|
|
131372
131284
|
ethereumNetwork: blockchainNetwork('DEV')
|
|
131373
131285
|
};
|
|
131374
131286
|
case 'local':
|
|
131375
131287
|
return {
|
|
131376
131288
|
torusEnv: 'beta',
|
|
131289
|
+
appEnv: 'DEV',
|
|
131377
131290
|
ethereumNetwork: blockchainNetwork('LOCAL')
|
|
131378
131291
|
};
|
|
131379
131292
|
default:
|
|
131380
131293
|
return {
|
|
131381
131294
|
torusEnv: 'production',
|
|
131295
|
+
appEnv: 'PROD',
|
|
131382
131296
|
ethereumNetwork: blockchainNetwork('PROD')
|
|
131383
131297
|
};
|
|
131384
131298
|
}
|
|
131385
131299
|
}
|
|
131386
|
-
/**
|
|
131387
|
-
* Bundle login provider status
|
|
131388
|
-
*/
|
|
131389
|
-
setLoginProvider(config) {
|
|
131390
|
-
if ((config === null || config === void 0 ? void 0 : config.loginProvider) === 'email_password') {
|
|
131391
|
-
return { google: false, emailPassword: true };
|
|
131392
|
-
}
|
|
131393
|
-
else if ((config === null || config === void 0 ? void 0 : config.loginProvider) === 'google') {
|
|
131394
|
-
return { google: true, emailPassword: false };
|
|
131395
|
-
}
|
|
131396
|
-
return { google: true, emailPassword: true };
|
|
131397
|
-
}
|
|
131398
131300
|
/**
|
|
131399
131301
|
* Some wording is determined by users' action
|
|
131400
131302
|
*/
|
|
@@ -131426,6 +131328,127 @@ class TorusConfigContext {
|
|
|
131426
131328
|
exports.default = TorusConfigContext;
|
|
131427
131329
|
|
|
131428
131330
|
|
|
131331
|
+
/***/ }),
|
|
131332
|
+
|
|
131333
|
+
/***/ "./src/configContext/torusSocialLogin.ts":
|
|
131334
|
+
/*!***********************************************!*\
|
|
131335
|
+
!*** ./src/configContext/torusSocialLogin.ts ***!
|
|
131336
|
+
\***********************************************/
|
|
131337
|
+
/*! no static exports found */
|
|
131338
|
+
/*! all exports used */
|
|
131339
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
131340
|
+
|
|
131341
|
+
"use strict";
|
|
131342
|
+
|
|
131343
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
131344
|
+
exports.getCallabckUrl = exports.getVerifierByLoginProvider = exports.getCustomLoginConfig = exports.getModalConfigByLoginProviders = void 0;
|
|
131345
|
+
const constant_1 = __webpack_require__(/*! ../constant */ "./src/constant.ts");
|
|
131346
|
+
const error_1 = __webpack_require__(/*! ../error */ "./src/error.ts");
|
|
131347
|
+
const util_1 = __webpack_require__(/*! ../util */ "./src/util.ts");
|
|
131348
|
+
const globalThis = __webpack_require__(/*! globalthis */ "./node_modules/globalthis/index.js")();
|
|
131349
|
+
/**
|
|
131350
|
+
* When a specific social login unselected, show all optioins on modal.
|
|
131351
|
+
* Else, show only selected social login on modal.
|
|
131352
|
+
*/
|
|
131353
|
+
exports.getModalConfigByLoginProviders = (selected, loginProviderToAssign) => {
|
|
131354
|
+
const isShow = selected === undefined || selected === loginProviderToAssign;
|
|
131355
|
+
return {
|
|
131356
|
+
[constant_1.TORUS_VERIFIERS[loginProviderToAssign].PROD]: { showOnModal: isShow },
|
|
131357
|
+
[constant_1.TORUS_VERIFIERS[loginProviderToAssign].DEV]: { showOnModal: isShow }
|
|
131358
|
+
};
|
|
131359
|
+
};
|
|
131360
|
+
/**
|
|
131361
|
+
* Config in integration with custom Auth0.
|
|
131362
|
+
* User data is stored in your Auth0 DB.
|
|
131363
|
+
*/
|
|
131364
|
+
exports.getCustomLoginConfig = (config) => {
|
|
131365
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
131366
|
+
const baseConf = {
|
|
131367
|
+
line: {
|
|
131368
|
+
typeOfLogin: 'line',
|
|
131369
|
+
clientId: config.auth0ClientId,
|
|
131370
|
+
jwtParameters: {
|
|
131371
|
+
domain: config.auth0Domain
|
|
131372
|
+
},
|
|
131373
|
+
showOnModal: true,
|
|
131374
|
+
showOnMobile: false,
|
|
131375
|
+
showOnDesktop: true
|
|
131376
|
+
},
|
|
131377
|
+
emailPassword: {
|
|
131378
|
+
name: 'email',
|
|
131379
|
+
typeOfLogin: 'email_password',
|
|
131380
|
+
description: 'login.buttonText',
|
|
131381
|
+
clientId: config.auth0ClientId,
|
|
131382
|
+
logoHover: ((_a = config === null || config === void 0 ? void 0 : config.customUi) === null || _a === void 0 ? void 0 : _a.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
|
|
131383
|
+
logoLight: ((_b = config === null || config === void 0 ? void 0 : config.customUi) === null || _b === void 0 ? void 0 : _b.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).white,
|
|
131384
|
+
logoDark: ((_c = config === null || config === void 0 ? void 0 : config.customUi) === null || _c === void 0 ? void 0 : _c.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
|
|
131385
|
+
showOnModal: true,
|
|
131386
|
+
priority: 1,
|
|
131387
|
+
mainOption: false,
|
|
131388
|
+
showOnMobile: true,
|
|
131389
|
+
showOnDesktop: true,
|
|
131390
|
+
jwtParameters: {
|
|
131391
|
+
disable_signup: !config.authAction.signup,
|
|
131392
|
+
disable_login: !config.authAction.login,
|
|
131393
|
+
domain: config.auth0Domain,
|
|
131394
|
+
callback_url: config.callbackUrl || exports.getCallabckUrl(),
|
|
131395
|
+
contactUrl: ((_d = config === null || config === void 0 ? void 0 : config.customUi) === null || _d === void 0 ? void 0 : _d.contactUrl) || constant_1.CONTACT_EMAIL,
|
|
131396
|
+
serviceName: ((_e = config === null || config === void 0 ? void 0 : config.customUi) === null || _e === void 0 ? void 0 : _e.serviceName) || constant_1.APP,
|
|
131397
|
+
logoURL: ((_f = config.customUi) === null || _f === void 0 ? void 0 : _f.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
|
|
131398
|
+
titleSignup: ((_k = (_j = (_h = (_g = config.customUi) === null || _g === void 0 ? void 0 : _g.words) === null || _h === void 0 ? void 0 : _h[config.lang]) === null || _j === void 0 ? void 0 : _j.emailAuthPopup) === null || _k === void 0 ? void 0 : _k['titleSignup']) || constant_1.EMAIL_PASSWORD_POPUP_LABEL.SIGNUP[config.lang],
|
|
131399
|
+
titleLogin: ((_p = (_o = (_m = (_l = config.customUi) === null || _l === void 0 ? void 0 : _l.words) === null || _m === void 0 ? void 0 : _m[config.lang]) === null || _o === void 0 ? void 0 : _o.emailAuthPopup) === null || _p === void 0 ? void 0 : _p['titleLogin']) || constant_1.EMAIL_PASSWORD_POPUP_LABEL.LOGIN[config.lang],
|
|
131400
|
+
ui_locales: config.lang
|
|
131401
|
+
}
|
|
131402
|
+
}
|
|
131403
|
+
};
|
|
131404
|
+
switch (config.loginProvider) {
|
|
131405
|
+
case 'line':
|
|
131406
|
+
return {
|
|
131407
|
+
[constant_1.TORUS_AUTH0_CUSTOM_VERIFIERS.line[config.network.appEnv]]: Object.assign({}, baseConf.line)
|
|
131408
|
+
};
|
|
131409
|
+
case 'email_password':
|
|
131410
|
+
return {
|
|
131411
|
+
[config.auth0TorusConfigKey]: Object.assign({}, baseConf.emailPassword)
|
|
131412
|
+
};
|
|
131413
|
+
default:
|
|
131414
|
+
return {
|
|
131415
|
+
[constant_1.TORUS_AUTH0_CUSTOM_VERIFIERS.line[config.network.appEnv]]: Object.assign(Object.assign({}, baseConf.line), { showOnModal: config.loginProvider === undefined }),
|
|
131416
|
+
[config.auth0TorusConfigKey]: Object.assign(Object.assign({}, baseConf.emailPassword), { showOnModal: config.loginProvider === undefined })
|
|
131417
|
+
};
|
|
131418
|
+
}
|
|
131419
|
+
};
|
|
131420
|
+
exports.getVerifierByLoginProvider = (loginProvider, env, withModal, authConfigKey) => {
|
|
131421
|
+
// NOTE: email_passwordless always need modal
|
|
131422
|
+
if (withModal || loginProvider === 'email_passwordless')
|
|
131423
|
+
return null;
|
|
131424
|
+
switch (loginProvider) {
|
|
131425
|
+
case undefined:
|
|
131426
|
+
return null;
|
|
131427
|
+
case 'email_password':
|
|
131428
|
+
if (env !== 'PROD' && !authConfigKey)
|
|
131429
|
+
throw new error_1.CustomError(Error('authConfigKey should be assigned for email password')).sdk();
|
|
131430
|
+
return env === 'PROD' ? constant_1.TORUS_VERIFIERS[loginProvider].PROD : authConfigKey;
|
|
131431
|
+
case 'line':
|
|
131432
|
+
return constant_1.TORUS_AUTH0_CUSTOM_VERIFIERS.line[env];
|
|
131433
|
+
default:
|
|
131434
|
+
if (!Object.keys(constant_1.TORUS_VERIFIERS).includes(loginProvider)) {
|
|
131435
|
+
throw new error_1.CustomError(Error(`${loginProvider} is not supported`)).sdk();
|
|
131436
|
+
}
|
|
131437
|
+
return constant_1.TORUS_VERIFIERS[loginProvider][env];
|
|
131438
|
+
}
|
|
131439
|
+
};
|
|
131440
|
+
/**
|
|
131441
|
+
* For backward-compatibility
|
|
131442
|
+
*/
|
|
131443
|
+
exports.getCallabckUrl = () => {
|
|
131444
|
+
const url = new URL(globalThis.location.href);
|
|
131445
|
+
const callback = url.searchParams.get('callback');
|
|
131446
|
+
if (!callback)
|
|
131447
|
+
return '';
|
|
131448
|
+
return util_1.checkCallbackUrl(callback) ? callback : '';
|
|
131449
|
+
};
|
|
131450
|
+
|
|
131451
|
+
|
|
131429
131452
|
/***/ }),
|
|
131430
131453
|
|
|
131431
131454
|
/***/ "./src/configContext/util.ts":
|
|
@@ -131525,7 +131548,7 @@ exports.findEnvByChainId = (chainId) => {
|
|
|
131525
131548
|
"use strict";
|
|
131526
131549
|
|
|
131527
131550
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
131528
|
-
exports.StartrailSdkErrorCodeEnum = exports.PRIVACY_POLICY_LINK = exports.TERMS_OF_CONDITION_LINK = exports.STARTRAIL_ENV = exports.STARTRAIL_API = exports.LOGO_URL = exports.LANG = exports.ETHEREUM_NETWORK = exports.RPC_URLS = exports.ERROR_STATUS_CODE = exports.ERROR_MESSAGE = exports.ERROR_FROM = exports.EMAIL_PASSWORD_POPUP_LABEL = exports.EMAIL_BUTTON = exports.DEFAULT_WORD = exports.CONTACT_EMAIL = exports.COMPRESSION_ALGORITHM = exports.AUTH0_TORUS_CONFIG_KEY = exports.AUTH0_DOMAIN = exports.AUTH0_DEFAULT_TAB = exports.AUTH0_CLIENT_ID = exports.AUTH_LABEL = exports.APP = void 0;
|
|
131551
|
+
exports.TORUS_AUTH0_CUSTOM_VERIFIERS = exports.TORUS_VERIFIERS = exports.StartrailSdkErrorCodeEnum = exports.PRIVACY_POLICY_LINK = exports.TERMS_OF_CONDITION_LINK = exports.STARTRAIL_ENV = exports.STARTRAIL_API = exports.LOGO_URL = exports.LANG = exports.ETHEREUM_NETWORK = exports.RPC_URLS = exports.ERROR_STATUS_CODE = exports.ERROR_MESSAGE = exports.ERROR_FROM = exports.EMAIL_PASSWORD_POPUP_LABEL = exports.EMAIL_BUTTON = exports.DEFAULT_WORD = exports.CONTACT_EMAIL = exports.COMPRESSION_ALGORITHM = exports.AUTH0_TORUS_CONFIG_KEY = exports.AUTH0_DOMAIN = exports.AUTH0_DEFAULT_TAB = exports.AUTH0_CLIENT_ID = exports.AUTH_LABEL = exports.APP = void 0;
|
|
131529
131552
|
exports.APP = 'Startrail';
|
|
131530
131553
|
exports.AUTH_LABEL = {
|
|
131531
131554
|
SIGNUP: {
|
|
@@ -131705,6 +131728,45 @@ var StartrailSdkErrorCodeEnum;
|
|
|
131705
131728
|
StartrailSdkErrorCodeEnum["WALLET_USER_REJECT_WALLET_REQUEST"] = "WALLET_USER_REJECT_WALLET_REQUEST";
|
|
131706
131729
|
StartrailSdkErrorCodeEnum["METADATA_VALIDATION_FAILED"] = "METADATA_VALIDATION_FAILED";
|
|
131707
131730
|
})(StartrailSdkErrorCodeEnum = exports.StartrailSdkErrorCodeEnum || (exports.StartrailSdkErrorCodeEnum = {}));
|
|
131731
|
+
exports.TORUS_VERIFIERS = {
|
|
131732
|
+
google: {
|
|
131733
|
+
PROD: 'google',
|
|
131734
|
+
STG: 'google',
|
|
131735
|
+
DEV: 'google-lrc'
|
|
131736
|
+
},
|
|
131737
|
+
facebook: {
|
|
131738
|
+
PROD: 'facebook',
|
|
131739
|
+
STG: 'facebook',
|
|
131740
|
+
DEV: 'facebook-lrc'
|
|
131741
|
+
},
|
|
131742
|
+
apple: {
|
|
131743
|
+
PROD: 'torus-auth0-apple',
|
|
131744
|
+
STG: 'torus-auth0-apple',
|
|
131745
|
+
DEV: 'torus-auth0-apple-lrc'
|
|
131746
|
+
},
|
|
131747
|
+
twitter: {
|
|
131748
|
+
PROD: 'torus-auth0-twitter',
|
|
131749
|
+
STG: 'torus-auth0-twitter',
|
|
131750
|
+
DEV: 'torus-auth0-twitter-lrc'
|
|
131751
|
+
},
|
|
131752
|
+
email_passwordless: {
|
|
131753
|
+
PROD: 'torus-auth0-email-passwordless',
|
|
131754
|
+
STG: 'torus-auth0-email-passwordless',
|
|
131755
|
+
DEV: 'torus-auth0-email-passwordless-lrc'
|
|
131756
|
+
},
|
|
131757
|
+
email_password: {
|
|
131758
|
+
PROD: exports.AUTH0_TORUS_CONFIG_KEY,
|
|
131759
|
+
STG: '',
|
|
131760
|
+
DEV: '' // Should be passed from the caller
|
|
131761
|
+
}
|
|
131762
|
+
};
|
|
131763
|
+
exports.TORUS_AUTH0_CUSTOM_VERIFIERS = {
|
|
131764
|
+
line: {
|
|
131765
|
+
PROD: 'startrail-auth0-line',
|
|
131766
|
+
STG: 'startrail-auth0-line-staging',
|
|
131767
|
+
DEV: 'startrail-auth0-line-qa'
|
|
131768
|
+
}
|
|
131769
|
+
};
|
|
131708
131770
|
|
|
131709
131771
|
|
|
131710
131772
|
/***/ }),
|
|
@@ -133438,7 +133500,7 @@ class Torus extends base_1.default {
|
|
|
133438
133500
|
}
|
|
133439
133501
|
this.provider = this.torusSDK.provider;
|
|
133440
133502
|
try {
|
|
133441
|
-
return yield this.torusSDK.login(this.configContext.
|
|
133503
|
+
return yield this.torusSDK.login(this.configContext.getDirectLoginConfig());
|
|
133442
133504
|
}
|
|
133443
133505
|
catch (e) {
|
|
133444
133506
|
throw new error_1.CustomError(e).torus();
|