@startbahn/startrail-sdk-js 1.31.0-beta.3 → 1.31.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/README.md CHANGED
@@ -63,7 +63,8 @@ const startrail = new Startrail(params)
63
63
  - `customUi`: Customising UI. If no parameters are set, default values are applied.
64
64
  - `logoUrl`: Applied to all logos in Startrail-sdk-js
65
65
  - `serviceName`: Applied to all service name in Startrail-sdk-js
66
- - `contactUrl`: Applied to the contact email in signup Email verification email
66
+ - `contactUrl`: Applied to the contact email in signup Email
67
+ - `verificationEmailTitle`: Applied to the title of the verification email when you select email_password
67
68
  - `words`: See more details in Example section
68
69
  - `logoWhiteUrl`: Applied to all white logos on black background in Startrail-sdk-js
69
70
  - `callbackUrl` (optional): Callback URL to redirect to from E-Mail template for signup verification
@@ -91,6 +92,7 @@ sdk = new Startrail({
91
92
  logoUrl: 'https://sample.com/logo',
92
93
  logoWhiteUrl: 'https://sample.com/white-logo',
93
94
  serviceName: 'your service',
95
+ verificationEmailTitle: 'your title',
94
96
  contactUrl: 'contact@startrail.io',
95
97
  words: {
96
98
  en: {
@@ -1391,7 +1391,7 @@ class NullCoder extends _abstract_coder__WEBPACK_IMPORTED_MODULE_0__[/* Coder */
1391
1391
  "use strict";
1392
1392
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NumberCoder; });
1393
1393
  /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/bignumber/lib.esm/index.js");
1394
- /* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js");
1394
+ /* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/index.js");
1395
1395
  /* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js");
1396
1396
 
1397
1397
 
@@ -3933,6 +3933,110 @@ function joinSignature(signature) {
3933
3933
  }
3934
3934
 
3935
3935
 
3936
+ /***/ }),
3937
+
3938
+ /***/ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/addresses.js":
3939
+ /*!****************************************************************************************************!*\
3940
+ !*** ./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/addresses.js ***!
3941
+ \****************************************************************************************************/
3942
+ /*! exports provided: AddressZero */
3943
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3944
+
3945
+ "use strict";
3946
+ /* unused harmony export AddressZero */
3947
+ const AddressZero = "0x0000000000000000000000000000000000000000";
3948
+ //# sourceMappingURL=addresses.js.map
3949
+
3950
+ /***/ }),
3951
+
3952
+ /***/ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/bignumbers.js":
3953
+ /*!*****************************************************************************************************!*\
3954
+ !*** ./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/bignumbers.js ***!
3955
+ \*****************************************************************************************************/
3956
+ /*! exports provided: NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256 */
3957
+ /*! exports used: MaxUint256, NegativeOne, One, Zero */
3958
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3959
+
3960
+ "use strict";
3961
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NegativeOne; });
3962
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return Zero; });
3963
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return One; });
3964
+ /* unused harmony export Two */
3965
+ /* unused harmony export WeiPerEther */
3966
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MaxUint256; });
3967
+ /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/bignumber/lib.esm/index.js");
3968
+
3969
+ const NegativeOne = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[/* BigNumber */ "a"].from(-1));
3970
+ const Zero = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[/* BigNumber */ "a"].from(0));
3971
+ const One = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[/* BigNumber */ "a"].from(1));
3972
+ const Two = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[/* BigNumber */ "a"].from(2));
3973
+ const WeiPerEther = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[/* BigNumber */ "a"].from("1000000000000000000"));
3974
+ const MaxUint256 = ( /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__[/* BigNumber */ "a"].from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
3975
+
3976
+ //# sourceMappingURL=bignumbers.js.map
3977
+
3978
+ /***/ }),
3979
+
3980
+ /***/ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/hashes.js":
3981
+ /*!*************************************************************************************************!*\
3982
+ !*** ./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/hashes.js ***!
3983
+ \*************************************************************************************************/
3984
+ /*! exports provided: HashZero */
3985
+ /*! exports used: HashZero */
3986
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3987
+
3988
+ "use strict";
3989
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HashZero; });
3990
+ const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
3991
+ //# sourceMappingURL=hashes.js.map
3992
+
3993
+ /***/ }),
3994
+
3995
+ /***/ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/index.js":
3996
+ /*!************************************************************************************************!*\
3997
+ !*** ./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/index.js ***!
3998
+ \************************************************************************************************/
3999
+ /*! exports provided: AddressZero, NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256, HashZero, EtherSymbol */
4000
+ /*! exports used: HashZero, MaxUint256, NegativeOne, One, Zero */
4001
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4002
+
4003
+ "use strict";
4004
+ /* harmony import */ var _addresses__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addresses */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/addresses.js");
4005
+ /* harmony import */ var _bignumbers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bignumbers */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/bignumbers.js");
4006
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["b"]; });
4007
+
4008
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "e", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["d"]; });
4009
+
4010
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "d", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["c"]; });
4011
+
4012
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["a"]; });
4013
+
4014
+ /* harmony import */ var _hashes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hashes */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/hashes.js");
4015
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _hashes__WEBPACK_IMPORTED_MODULE_2__["a"]; });
4016
+
4017
+ /* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./strings */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/strings.js");
4018
+
4019
+
4020
+
4021
+
4022
+
4023
+ //# sourceMappingURL=index.js.map
4024
+
4025
+ /***/ }),
4026
+
4027
+ /***/ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/strings.js":
4028
+ /*!**************************************************************************************************!*\
4029
+ !*** ./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/strings.js ***!
4030
+ \**************************************************************************************************/
4031
+ /*! exports provided: EtherSymbol */
4032
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4033
+
4034
+ "use strict";
4035
+ /* unused harmony export EtherSymbol */
4036
+ // NFKC (composed) // (decomposed)
4037
+ const EtherSymbol = "\u039e"; // "\uD835\uDF63";
4038
+ //# sourceMappingURL=strings.js.map
4039
+
3936
4040
  /***/ }),
3937
4041
 
3938
4042
  /***/ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/logger/lib.esm/_version.js":
@@ -4426,7 +4530,7 @@ const version = "strings/5.0.1";
4426
4530
  "use strict";
4427
4531
  /* unused harmony export formatBytes32String */
4428
4532
  /* unused harmony export parseBytes32String */
4429
- /* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js");
4533
+ /* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/constants/lib.esm/index.js");
4430
4534
  /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/bytes/lib.esm/index.js");
4431
4535
  /* harmony import */ var _utf8__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utf8 */ "./node_modules/@ethersproject/abi/node_modules/@ethersproject/strings/lib.esm/utf8.js");
4432
4536
 
@@ -11286,19 +11390,19 @@ function joinSignature(signature) {
11286
11390
  !*** ./node_modules/@ethersproject/constants/lib.esm/index.js ***!
11287
11391
  \****************************************************************/
11288
11392
  /*! exports provided: AddressZero, HashZero, EtherSymbol, NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256 */
11289
- /*! exports used: HashZero, MaxUint256, NegativeOne, One, Zero */
11393
+ /*! exports used: HashZero, Zero */
11290
11394
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
11291
11395
 
11292
11396
  "use strict";
11293
11397
  /* unused harmony export AddressZero */
11294
11398
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HashZero; });
11295
11399
  /* unused harmony export EtherSymbol */
11296
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NegativeOne; });
11297
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return Zero; });
11298
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return One; });
11400
+ /* unused harmony export NegativeOne */
11401
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Zero; });
11402
+ /* unused harmony export One */
11299
11403
  /* unused harmony export Two */
11300
11404
  /* unused harmony export WeiPerEther */
11301
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MaxUint256; });
11405
+ /* unused harmony export MaxUint256 */
11302
11406
  /* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/constants/node_modules/@ethersproject/bignumber/lib.esm/index.js");
11303
11407
 
11304
11408
 
@@ -16439,7 +16543,7 @@ __webpack_require__.r(__webpack_exports__);
16439
16543
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return toUtf8String; });
16440
16544
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return toUtf8CodePoints; });
16441
16545
  /* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js");
16442
- /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/strings/node_modules/@ethersproject/logger/lib.esm/index.js");
16546
+ /* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js");
16443
16547
  /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/strings/lib.esm/_version.js");
16444
16548
 
16445
16549
 
@@ -16791,392 +16895,6 @@ const EtherSymbol = "\u039e"; // "\uD835\uDF63";
16791
16895
 
16792
16896
  /***/ }),
16793
16897
 
16794
- /***/ "./node_modules/@ethersproject/strings/node_modules/@ethersproject/logger/lib.esm/_version.js":
16795
- /*!****************************************************************************************************!*\
16796
- !*** ./node_modules/@ethersproject/strings/node_modules/@ethersproject/logger/lib.esm/_version.js ***!
16797
- \****************************************************************************************************/
16798
- /*! exports provided: version */
16799
- /*! exports used: version */
16800
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
16801
-
16802
- "use strict";
16803
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return version; });
16804
- const version = "logger/5.7.0";
16805
- //# sourceMappingURL=_version.js.map
16806
-
16807
- /***/ }),
16808
-
16809
- /***/ "./node_modules/@ethersproject/strings/node_modules/@ethersproject/logger/lib.esm/index.js":
16810
- /*!*************************************************************************************************!*\
16811
- !*** ./node_modules/@ethersproject/strings/node_modules/@ethersproject/logger/lib.esm/index.js ***!
16812
- \*************************************************************************************************/
16813
- /*! exports provided: LogLevel, ErrorCode, Logger */
16814
- /*! exports used: Logger */
16815
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
16816
-
16817
- "use strict";
16818
- /* unused harmony export LogLevel */
16819
- /* unused harmony export ErrorCode */
16820
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Logger; });
16821
- /* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/strings/node_modules/@ethersproject/logger/lib.esm/_version.js");
16822
-
16823
- let _permanentCensorErrors = false;
16824
- let _censorErrors = false;
16825
- const LogLevels = { debug: 1, "default": 2, info: 2, warning: 3, error: 4, off: 5 };
16826
- let _logLevel = LogLevels["default"];
16827
-
16828
- let _globalLogger = null;
16829
- function _checkNormalize() {
16830
- try {
16831
- const missing = [];
16832
- // Make sure all forms of normalization are supported
16833
- ["NFD", "NFC", "NFKD", "NFKC"].forEach((form) => {
16834
- try {
16835
- if ("test".normalize(form) !== "test") {
16836
- throw new Error("bad normalize");
16837
- }
16838
- ;
16839
- }
16840
- catch (error) {
16841
- missing.push(form);
16842
- }
16843
- });
16844
- if (missing.length) {
16845
- throw new Error("missing " + missing.join(", "));
16846
- }
16847
- if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) {
16848
- throw new Error("broken implementation");
16849
- }
16850
- }
16851
- catch (error) {
16852
- return error.message;
16853
- }
16854
- return null;
16855
- }
16856
- const _normalizeError = _checkNormalize();
16857
- var LogLevel;
16858
- (function (LogLevel) {
16859
- LogLevel["DEBUG"] = "DEBUG";
16860
- LogLevel["INFO"] = "INFO";
16861
- LogLevel["WARNING"] = "WARNING";
16862
- LogLevel["ERROR"] = "ERROR";
16863
- LogLevel["OFF"] = "OFF";
16864
- })(LogLevel || (LogLevel = {}));
16865
- var ErrorCode;
16866
- (function (ErrorCode) {
16867
- ///////////////////
16868
- // Generic Errors
16869
- // Unknown Error
16870
- ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
16871
- // Not Implemented
16872
- ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED";
16873
- // Unsupported Operation
16874
- // - operation
16875
- ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION";
16876
- // Network Error (i.e. Ethereum Network, such as an invalid chain ID)
16877
- // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown)
16878
- ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR";
16879
- // Some sort of bad response from the server
16880
- ErrorCode["SERVER_ERROR"] = "SERVER_ERROR";
16881
- // Timeout
16882
- ErrorCode["TIMEOUT"] = "TIMEOUT";
16883
- ///////////////////
16884
- // Operational Errors
16885
- // Buffer Overrun
16886
- ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN";
16887
- // Numeric Fault
16888
- // - operation: the operation being executed
16889
- // - fault: the reason this faulted
16890
- ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT";
16891
- ///////////////////
16892
- // Argument Errors
16893
- // Missing new operator to an object
16894
- // - name: The name of the class
16895
- ErrorCode["MISSING_NEW"] = "MISSING_NEW";
16896
- // Invalid argument (e.g. value is incompatible with type) to a function:
16897
- // - argument: The argument name that was invalid
16898
- // - value: The value of the argument
16899
- ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT";
16900
- // Missing argument to a function:
16901
- // - count: The number of arguments received
16902
- // - expectedCount: The number of arguments expected
16903
- ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT";
16904
- // Too many arguments
16905
- // - count: The number of arguments received
16906
- // - expectedCount: The number of arguments expected
16907
- ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT";
16908
- ///////////////////
16909
- // Blockchain Errors
16910
- // Call exception
16911
- // - transaction: the transaction
16912
- // - address?: the contract address
16913
- // - args?: The arguments passed into the function
16914
- // - method?: The Solidity method signature
16915
- // - errorSignature?: The EIP848 error signature
16916
- // - errorArgs?: The EIP848 error parameters
16917
- // - reason: The reason (only for EIP848 "Error(string)")
16918
- ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION";
16919
- // Insufficient funds (< value + gasLimit * gasPrice)
16920
- // - transaction: the transaction attempted
16921
- ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS";
16922
- // Nonce has already been used
16923
- // - transaction: the transaction attempted
16924
- ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED";
16925
- // The replacement fee for the transaction is too low
16926
- // - transaction: the transaction attempted
16927
- ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED";
16928
- // The gas limit could not be estimated
16929
- // - transaction: the transaction passed to estimateGas
16930
- ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT";
16931
- // The transaction was replaced by one with a higher gas price
16932
- // - reason: "cancelled", "replaced" or "repriced"
16933
- // - cancelled: true if reason == "cancelled" or reason == "replaced")
16934
- // - hash: original transaction hash
16935
- // - replacement: the full TransactionsResponse for the replacement
16936
- // - receipt: the receipt of the replacement
16937
- ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED";
16938
- ///////////////////
16939
- // Interaction Errors
16940
- // The user rejected the action, such as signing a message or sending
16941
- // a transaction
16942
- ErrorCode["ACTION_REJECTED"] = "ACTION_REJECTED";
16943
- })(ErrorCode || (ErrorCode = {}));
16944
- ;
16945
- const HEX = "0123456789abcdef";
16946
- class Logger {
16947
- constructor(version) {
16948
- Object.defineProperty(this, "version", {
16949
- enumerable: true,
16950
- value: version,
16951
- writable: false
16952
- });
16953
- }
16954
- _log(logLevel, args) {
16955
- const level = logLevel.toLowerCase();
16956
- if (LogLevels[level] == null) {
16957
- this.throwArgumentError("invalid log level name", "logLevel", logLevel);
16958
- }
16959
- if (_logLevel > LogLevels[level]) {
16960
- return;
16961
- }
16962
- console.log.apply(console, args);
16963
- }
16964
- debug(...args) {
16965
- this._log(Logger.levels.DEBUG, args);
16966
- }
16967
- info(...args) {
16968
- this._log(Logger.levels.INFO, args);
16969
- }
16970
- warn(...args) {
16971
- this._log(Logger.levels.WARNING, args);
16972
- }
16973
- makeError(message, code, params) {
16974
- // Errors are being censored
16975
- if (_censorErrors) {
16976
- return this.makeError("censored error", code, {});
16977
- }
16978
- if (!code) {
16979
- code = Logger.errors.UNKNOWN_ERROR;
16980
- }
16981
- if (!params) {
16982
- params = {};
16983
- }
16984
- const messageDetails = [];
16985
- Object.keys(params).forEach((key) => {
16986
- const value = params[key];
16987
- try {
16988
- if (value instanceof Uint8Array) {
16989
- let hex = "";
16990
- for (let i = 0; i < value.length; i++) {
16991
- hex += HEX[value[i] >> 4];
16992
- hex += HEX[value[i] & 0x0f];
16993
- }
16994
- messageDetails.push(key + "=Uint8Array(0x" + hex + ")");
16995
- }
16996
- else {
16997
- messageDetails.push(key + "=" + JSON.stringify(value));
16998
- }
16999
- }
17000
- catch (error) {
17001
- messageDetails.push(key + "=" + JSON.stringify(params[key].toString()));
17002
- }
17003
- });
17004
- messageDetails.push(`code=${code}`);
17005
- messageDetails.push(`version=${this.version}`);
17006
- const reason = message;
17007
- let url = "";
17008
- switch (code) {
17009
- case ErrorCode.NUMERIC_FAULT: {
17010
- url = "NUMERIC_FAULT";
17011
- const fault = message;
17012
- switch (fault) {
17013
- case "overflow":
17014
- case "underflow":
17015
- case "division-by-zero":
17016
- url += "-" + fault;
17017
- break;
17018
- case "negative-power":
17019
- case "negative-width":
17020
- url += "-unsupported";
17021
- break;
17022
- case "unbound-bitwise-result":
17023
- url += "-unbound-result";
17024
- break;
17025
- }
17026
- break;
17027
- }
17028
- case ErrorCode.CALL_EXCEPTION:
17029
- case ErrorCode.INSUFFICIENT_FUNDS:
17030
- case ErrorCode.MISSING_NEW:
17031
- case ErrorCode.NONCE_EXPIRED:
17032
- case ErrorCode.REPLACEMENT_UNDERPRICED:
17033
- case ErrorCode.TRANSACTION_REPLACED:
17034
- case ErrorCode.UNPREDICTABLE_GAS_LIMIT:
17035
- url = code;
17036
- break;
17037
- }
17038
- if (url) {
17039
- message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]";
17040
- }
17041
- if (messageDetails.length) {
17042
- message += " (" + messageDetails.join(", ") + ")";
17043
- }
17044
- // @TODO: Any??
17045
- const error = new Error(message);
17046
- error.reason = reason;
17047
- error.code = code;
17048
- Object.keys(params).forEach(function (key) {
17049
- error[key] = params[key];
17050
- });
17051
- return error;
17052
- }
17053
- throwError(message, code, params) {
17054
- throw this.makeError(message, code, params);
17055
- }
17056
- throwArgumentError(message, name, value) {
17057
- return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {
17058
- argument: name,
17059
- value: value
17060
- });
17061
- }
17062
- assert(condition, message, code, params) {
17063
- if (!!condition) {
17064
- return;
17065
- }
17066
- this.throwError(message, code, params);
17067
- }
17068
- assertArgument(condition, message, name, value) {
17069
- if (!!condition) {
17070
- return;
17071
- }
17072
- this.throwArgumentError(message, name, value);
17073
- }
17074
- checkNormalize(message) {
17075
- if (message == null) {
17076
- message = "platform missing String.prototype.normalize";
17077
- }
17078
- if (_normalizeError) {
17079
- this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, {
17080
- operation: "String.prototype.normalize", form: _normalizeError
17081
- });
17082
- }
17083
- }
17084
- checkSafeUint53(value, message) {
17085
- if (typeof (value) !== "number") {
17086
- return;
17087
- }
17088
- if (message == null) {
17089
- message = "value not safe";
17090
- }
17091
- if (value < 0 || value >= 0x1fffffffffffff) {
17092
- this.throwError(message, Logger.errors.NUMERIC_FAULT, {
17093
- operation: "checkSafeInteger",
17094
- fault: "out-of-safe-range",
17095
- value: value
17096
- });
17097
- }
17098
- if (value % 1) {
17099
- this.throwError(message, Logger.errors.NUMERIC_FAULT, {
17100
- operation: "checkSafeInteger",
17101
- fault: "non-integer",
17102
- value: value
17103
- });
17104
- }
17105
- }
17106
- checkArgumentCount(count, expectedCount, message) {
17107
- if (message) {
17108
- message = ": " + message;
17109
- }
17110
- else {
17111
- message = "";
17112
- }
17113
- if (count < expectedCount) {
17114
- this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, {
17115
- count: count,
17116
- expectedCount: expectedCount
17117
- });
17118
- }
17119
- if (count > expectedCount) {
17120
- this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, {
17121
- count: count,
17122
- expectedCount: expectedCount
17123
- });
17124
- }
17125
- }
17126
- checkNew(target, kind) {
17127
- if (target === Object || target == null) {
17128
- this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
17129
- }
17130
- }
17131
- checkAbstract(target, kind) {
17132
- if (target === kind) {
17133
- this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" });
17134
- }
17135
- else if (target === Object || target == null) {
17136
- this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
17137
- }
17138
- }
17139
- static globalLogger() {
17140
- if (!_globalLogger) {
17141
- _globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__[/* version */ "a"]);
17142
- }
17143
- return _globalLogger;
17144
- }
17145
- static setCensorship(censorship, permanent) {
17146
- if (!censorship && permanent) {
17147
- this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, {
17148
- operation: "setCensorship"
17149
- });
17150
- }
17151
- if (_permanentCensorErrors) {
17152
- if (!censorship) {
17153
- return;
17154
- }
17155
- this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, {
17156
- operation: "setCensorship"
17157
- });
17158
- }
17159
- _censorErrors = !!censorship;
17160
- _permanentCensorErrors = !!permanent;
17161
- }
17162
- static setLogLevel(logLevel) {
17163
- const level = LogLevels[logLevel.toLowerCase()];
17164
- if (level == null) {
17165
- Logger.globalLogger().warn("invalid log level - " + logLevel);
17166
- return;
17167
- }
17168
- _logLevel = level;
17169
- }
17170
- static from(version) {
17171
- return new Logger(version);
17172
- }
17173
- }
17174
- Logger.errors = ErrorCode;
17175
- Logger.levels = LogLevel;
17176
- //# sourceMappingURL=index.js.map
17177
-
17178
- /***/ }),
17179
-
17180
16898
  /***/ "./node_modules/@metamask/detect-provider/dist/index.js":
17181
16899
  /*!**************************************************************!*\
17182
16900
  !*** ./node_modules/@metamask/detect-provider/dist/index.js ***!
@@ -116558,7 +116276,7 @@ function handleAddress(value) {
116558
116276
  }
116559
116277
  function handleNumber(value) {
116560
116278
  if (value === "0x") {
116561
- return _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__[/* Zero */ "e"];
116279
+ return _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__[/* Zero */ "b"];
116562
116280
  }
116563
116281
  return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__[/* BigNumber */ "a"].from(value);
116564
116282
  }
@@ -131045,13 +130763,13 @@ const torusConfig = (config) => {
131045
130763
  return {
131046
130764
  buildEnv: config.network.torusEnv,
131047
130765
  skipTKey: true,
131048
- enabledVerifiers: {
131049
- facebook: false,
131050
- reddit: false,
131051
- twitch: false,
131052
- discord: false
131053
- },
131054
- enableLogging: false,
130766
+ // enabledVerifiers: {
130767
+ // facebook: false,
130768
+ // reddit: false,
130769
+ // twitch: false,
130770
+ // discord: false
130771
+ // },
130772
+ enableLogging: true,
131055
130773
  network: config.network.ethereumNetwork,
131056
130774
  showTorusButton: false,
131057
130775
  whiteLabel: {
@@ -131079,9 +130797,9 @@ const torusConfig = (config) => {
131079
130797
  disclaimerHide: true,
131080
130798
  customTranslations: formatConfigForTorusUI(config) // Most properties for UI customization are here.
131081
130799
  },
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
130800
+ // showOnModal is set to show social login on modal
130801
+ loginConfig: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, torusSocialLogin_1.getModalConfigByLoginProviders('apple', config.loginProvider)[config.network.appEnv]), torusSocialLogin_1.getModalConfigByLoginProviders('facebook', config.loginProvider)[config.network.appEnv]), torusSocialLogin_1.getModalConfigByLoginProviders('google', config.loginProvider)[config.network.appEnv]), torusSocialLogin_1.getModalConfigByLoginProviders('twitter', config.loginProvider)[config.network.appEnv]), torusSocialLogin_1.getModalConfigByLoginProviders('email_passwordless', config.loginProvider)[config.network.appEnv]), torusSocialLogin_1.getCustomLoginConfig(config)), {
130802
+ // Deactivating default Social Login. or else it will show on modal
131085
130803
  discord: {
131086
130804
  showOnModal: false
131087
130805
  }, 'discord-lrc': {
@@ -131194,7 +130912,7 @@ class TorusConfigContext {
131194
130912
  // with rest of the data kept as it is.
131195
130913
  return Object.assign(Object.assign(Object.assign({}, this.torusContextConfig.preConfig), Object.assign(Object.assign({}, config), { lang: config.lang })), {
131196
130914
  network: this.network(this.torusContextConfig.config.buildEnv, config === null || config === void 0 ? void 0 : config.rpcEndpoint),
131197
- loginProvider: config === null || config === void 0 ? void 0 : config.loginProvider,
130915
+ loginProvider: torusSocialLogin_1.restructureLoginConfig(config === null || config === void 0 ? void 0 : config.loginProvider),
131198
130916
  conditionalWords: this.convertWordsByAuthProvider(config)
131199
130917
  });
131200
130918
  };
@@ -131202,14 +130920,14 @@ class TorusConfigContext {
131202
130920
  return {
131203
130921
  apiPath: (config === null || config === void 0 ? void 0 : config.apiPath) || constant_1.STARTRAIL_API,
131204
130922
  authAction: (config === null || config === void 0 ? void 0 : config.authAction) || constant_1.AUTH0_DEFAULT_TAB,
131205
- auth0ClientId: (config === null || config === void 0 ? void 0 : config.auth0ClientId) || constant_1.AUTH0_CLIENT_ID,
131206
- auth0TorusConfigKey: (config === null || config === void 0 ? void 0 : config.auth0TorusConfigKey) || constant_1.AUTH0_TORUS_CONFIG_KEY,
131207
- auth0Domain: (config === null || config === void 0 ? void 0 : config.auth0Domain) || constant_1.AUTH0_DOMAIN,
130923
+ auth0ClientId: (config === null || config === void 0 ? void 0 : config.auth0ClientId) || constant_1.AUTH0_CLIENT_IDS[this.adaptTorusEnvToAppEnv(config === null || config === void 0 ? void 0 : config.env)],
130924
+ auth0TorusConfigKey: (config === null || config === void 0 ? void 0 : config.auth0TorusConfigKey) || constant_1.AUTH0_TORUS_CONFIG_KEYS[this.adaptTorusEnvToAppEnv(config === null || config === void 0 ? void 0 : config.env)],
130925
+ auth0Domain: (config === null || config === void 0 ? void 0 : config.auth0Domain) || constant_1.AUTH0_DOMAINS[this.adaptTorusEnvToAppEnv(config === null || config === void 0 ? void 0 : config.env)],
131208
130926
  lang: ((config === null || config === void 0 ? void 0 : config.lang) !== constant_1.LANG.JP ? constant_1.LANG.EN : constant_1.LANG.JP),
131209
- loginProvider: config === null || config === void 0 ? void 0 : config.loginProvider,
130927
+ loginProvider: torusSocialLogin_1.restructureLoginConfig(config === null || config === void 0 ? void 0 : config.loginProvider),
131210
130928
  network: this.network(config === null || config === void 0 ? void 0 : config.env, config === null || config === void 0 ? void 0 : config.rpcEndpoint),
131211
130929
  callbackUrl: (config === null || config === void 0 ? void 0 : config.callbackUrl) || null,
131212
- withModal: (config === null || config === void 0 ? void 0 : config.withModal) || false,
130930
+ withModal: typeof (config === null || config === void 0 ? void 0 : config.withModal) === 'boolean' ? config === null || config === void 0 ? void 0 : config.withModal : true,
131213
130931
  conditionalWords: this.convertWordsByAuthProvider(config),
131214
130932
  customUi: config === null || config === void 0 ? void 0 : config.customUi
131215
130933
  };
@@ -131254,7 +130972,7 @@ class TorusConfigContext {
131254
130972
  */
131255
130973
  getDirectLoginConfig() {
131256
130974
  const preConfig = this.torusContextConfig.preConfig;
131257
- const verifier = torusSocialLogin_1.getVerifierByLoginProvider(preConfig.loginProvider, preConfig.network.appEnv, preConfig.withModal, preConfig.auth0TorusConfigKey);
130975
+ const verifier = torusSocialLogin_1.getVerifierByLoginProvider(preConfig.network.appEnv, preConfig.withModal, preConfig.loginProvider, preConfig.auth0TorusConfigKey);
131258
130976
  return verifier ? { verifier } : {};
131259
130977
  }
131260
130978
  network(env, rpcEndpoint) {
@@ -131268,31 +130986,31 @@ class TorusConfigContext {
131268
130986
  case 'staging':
131269
130987
  return {
131270
130988
  torusEnv: 'production',
131271
- appEnv: 'STG',
130989
+ appEnv: this.adaptTorusEnvToAppEnv(env),
131272
130990
  ethereumNetwork: blockchainNetwork('DEV')
131273
130991
  };
131274
130992
  case 'lrc':
131275
130993
  return {
131276
130994
  torusEnv: 'lrc',
131277
- appEnv: 'DEV',
130995
+ appEnv: this.adaptTorusEnvToAppEnv(env),
131278
130996
  ethereumNetwork: blockchainNetwork('DEV')
131279
130997
  };
131280
130998
  case 'beta':
131281
130999
  return {
131282
131000
  torusEnv: 'beta',
131283
- appEnv: 'DEV',
131001
+ appEnv: this.adaptTorusEnvToAppEnv(env),
131284
131002
  ethereumNetwork: blockchainNetwork('DEV')
131285
131003
  };
131286
131004
  case 'local':
131287
131005
  return {
131288
131006
  torusEnv: 'beta',
131289
- appEnv: 'DEV',
131007
+ appEnv: this.adaptTorusEnvToAppEnv(env),
131290
131008
  ethereumNetwork: blockchainNetwork('LOCAL')
131291
131009
  };
131292
131010
  default:
131293
131011
  return {
131294
131012
  torusEnv: 'production',
131295
- appEnv: 'PROD',
131013
+ appEnv: this.adaptTorusEnvToAppEnv(),
131296
131014
  ethereumNetwork: blockchainNetwork('PROD')
131297
131015
  };
131298
131016
  }
@@ -131301,13 +131019,14 @@ class TorusConfigContext {
131301
131019
  * Some wording is determined by users' action
131302
131020
  */
131303
131021
  convertWordsByAuthProvider(config) {
131022
+ var _a;
131304
131023
  /**
131305
131024
  * Application title should be prefixed only in English with Email login condition
131306
131025
  * (Google logo is automatially attached by torus-website with Gmail login)
131307
131026
  */
131308
131027
  const subtitle = {
131309
131028
  ja: `${serviceName(config)}${constant_1.DEFAULT_WORD.dappLogin.subtitle.ja}`,
131310
- en: `${constant_1.DEFAULT_WORD.dappLogin.subtitle.en}${(config === null || config === void 0 ? void 0 : config.loginProvider) === 'email_password' ? ' ' + serviceName(config) : ''}`
131029
+ en: `${constant_1.DEFAULT_WORD.dappLogin.subtitle.en}${((_a = config === null || config === void 0 ? void 0 : config.loginProvider) === null || _a === void 0 ? void 0 : _a.includes('email_password')) ? ' ' + serviceName(config) : ''}`
131311
131030
  };
131312
131031
  switch (true) {
131313
131032
  case isSignup(config): // Signup
@@ -131324,6 +131043,20 @@ class TorusConfigContext {
131324
131043
  };
131325
131044
  }
131326
131045
  }
131046
+ adaptTorusEnvToAppEnv(env) {
131047
+ switch (env) {
131048
+ case 'production':
131049
+ return 'PROD';
131050
+ case 'staging':
131051
+ return 'STG';
131052
+ case 'lrc':
131053
+ return 'DEV';
131054
+ case 'beta':
131055
+ return 'DEV';
131056
+ default:
131057
+ return 'PROD';
131058
+ }
131059
+ }
131327
131060
  }
131328
131061
  exports.default = TorusConfigContext;
131329
131062
 
@@ -131341,20 +131074,28 @@ exports.default = TorusConfigContext;
131341
131074
  "use strict";
131342
131075
 
131343
131076
  Object.defineProperty(exports, "__esModule", { value: true });
131344
- exports.getCallabckUrl = exports.getVerifierByLoginProvider = exports.getCustomLoginConfig = exports.getModalConfigByLoginProviders = void 0;
131077
+ exports.getCallabckUrl = exports.restructureLoginConfig = exports.getVerifierByLoginProvider = exports.getCustomLoginConfig = exports.getModalConfigByLoginProviders = exports.allAllowedVerifiers = void 0;
131345
131078
  const constant_1 = __webpack_require__(/*! ../constant */ "./src/constant.ts");
131346
131079
  const error_1 = __webpack_require__(/*! ../error */ "./src/error.ts");
131347
131080
  const util_1 = __webpack_require__(/*! ../util */ "./src/util.ts");
131348
131081
  const globalThis = __webpack_require__(/*! globalthis */ "./node_modules/globalthis/index.js")();
131082
+ exports.allAllowedVerifiers = ['google', 'line', 'facebook', 'twitter', 'apple', 'email_passwordless', 'email_password'];
131083
+ const verifiersDisplayedAsSubmain = ['email_passwordless', 'email_password'];
131349
131084
  /**
131350
- * When a specific social login unselected, show all optioins on modal.
131351
- * Else, show only selected social login on modal.
131085
+ * When a specific social logins unselected, show all optioins on modal.
131086
+ * Else, show only selected social logins on modal.
131352
131087
  */
131353
- exports.getModalConfigByLoginProviders = (selected, loginProviderToAssign) => {
131354
- const isShow = selected === undefined || selected === loginProviderToAssign;
131088
+ exports.getModalConfigByLoginProviders = (verifier, configVerifiers) => {
131355
131089
  return {
131356
- [constant_1.TORUS_VERIFIERS[loginProviderToAssign].PROD]: { showOnModal: isShow },
131357
- [constant_1.TORUS_VERIFIERS[loginProviderToAssign].DEV]: { showOnModal: isShow }
131090
+ PROD: {
131091
+ [constant_1.TORUS_VERIFIERS[verifier].PROD]: configVerifiers[verifier]
131092
+ },
131093
+ STG: {
131094
+ [constant_1.TORUS_VERIFIERS[verifier].PROD]: configVerifiers[verifier]
131095
+ },
131096
+ DEV: {
131097
+ [constant_1.TORUS_VERIFIERS[verifier].DEV]: configVerifiers[verifier]
131098
+ }
131358
131099
  };
131359
131100
  };
131360
131101
  /**
@@ -131362,81 +131103,89 @@ exports.getModalConfigByLoginProviders = (selected, loginProviderToAssign) => {
131362
131103
  * User data is stored in your Auth0 DB.
131363
131104
  */
131364
131105
  exports.getCustomLoginConfig = (config) => {
131365
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
131106
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
131366
131107
  const baseConf = {
131367
- line: {
131368
- typeOfLogin: 'line',
131369
- clientId: config.auth0ClientId,
131370
- jwtParameters: {
131108
+ line: Object.assign({ typeOfLogin: 'line', clientId: config.auth0ClientId, jwtParameters: {
131109
+ prompt: 'select_account',
131371
131110
  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: {
131111
+ } }, config.loginProvider.line),
131112
+ emailPassword: Object.assign(Object.assign({ name: 'email', typeOfLogin: 'email_password', description: 'login.buttonText', clientId: config.auth0ClientId, 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, 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, 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 }, config.loginProvider.email_password), { jwtParameters: {
131391
131113
  disable_signup: !config.authAction.signup,
131392
131114
  disable_login: !config.authAction.login,
131393
131115
  domain: config.auth0Domain,
131394
131116
  callback_url: config.callbackUrl || exports.getCallabckUrl(),
131395
131117
  contactUrl: ((_d = config === null || config === void 0 ? void 0 : config.customUi) === null || _d === void 0 ? void 0 : _d.contactUrl) || constant_1.CONTACT_EMAIL,
131396
131118
  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],
131119
+ verificationEmailTitle: (_f = config === null || config === void 0 ? void 0 : config.customUi) === null || _f === void 0 ? void 0 : _f.verificationEmailTitle,
131120
+ logoURL: ((_g = config.customUi) === null || _g === void 0 ? void 0 : _g.logoUrl) || constant_1.LOGO_URL(constant_1.STARTRAIL_ENV.PROD).black,
131121
+ titleSignup: ((_l = (_k = (_j = (_h = config.customUi) === null || _h === void 0 ? void 0 : _h.words) === null || _j === void 0 ? void 0 : _j[config.lang]) === null || _k === void 0 ? void 0 : _k.emailAuthPopup) === null || _l === void 0 ? void 0 : _l['titleSignup']) || constant_1.EMAIL_PASSWORD_POPUP_LABEL.SIGNUP[config.lang],
131122
+ titleLogin: ((_q = (_p = (_o = (_m = config.customUi) === null || _m === void 0 ? void 0 : _m.words) === null || _o === void 0 ? void 0 : _o[config.lang]) === null || _p === void 0 ? void 0 : _p.emailAuthPopup) === null || _q === void 0 ? void 0 : _q['titleLogin']) || constant_1.EMAIL_PASSWORD_POPUP_LABEL.LOGIN[config.lang],
131400
131123
  ui_locales: config.lang
131401
- }
131402
- }
131124
+ } })
131125
+ };
131126
+ return {
131127
+ [constant_1.TORUS_AUTH0_CUSTOM_VERIFIERS.line[config.network.appEnv]]: baseConf.line,
131128
+ [config.auth0TorusConfigKey]: baseConf.emailPassword
131403
131129
  };
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
131130
  };
131420
- exports.getVerifierByLoginProvider = (loginProvider, env, withModal, authConfigKey) => {
131421
- // NOTE: email_passwordless always need modal
131422
- if (withModal || loginProvider === 'email_passwordless')
131131
+ /**
131132
+ * Verifier that is used for direct login without modal.
131133
+ */
131134
+ exports.getVerifierByLoginProvider = (env, withModal, loginProvider, authConfigKey) => {
131135
+ if (withModal)
131423
131136
  return null;
131424
- switch (loginProvider) {
131425
- case undefined:
131137
+ // Always use first index of array when withModal is false
131138
+ const verifier = Object.keys(loginProvider).filter(key => loginProvider[key].showOnModal)[0];
131139
+ switch (verifier) {
131140
+ // NOTE: email_passwordless always need modal
131141
+ case 'email_passwordless':
131426
131142
  return null;
131427
131143
  case 'email_password':
131428
- if (env !== 'PROD' && !authConfigKey)
131144
+ if (env === 'DEV' && !authConfigKey)
131429
131145
  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;
131146
+ return env === 'DEV' ? authConfigKey : constant_1.TORUS_VERIFIERS.email_password[env];
131431
131147
  case 'line':
131432
131148
  return constant_1.TORUS_AUTH0_CUSTOM_VERIFIERS.line[env];
131433
131149
  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];
131150
+ return constant_1.TORUS_VERIFIERS[verifier][env];
131438
131151
  }
131439
131152
  };
131153
+ /**
131154
+ * Arrange the layout of login providers in modal.
131155
+ * if it is true, login providers are positioned in the upper layout of modal.
131156
+ * Note: email_passwordless is restricted to alaways be lower layout by Torus library.
131157
+ */
131158
+ const isShowInUpperLayoutInModal = (target, selectedVerifiers) => {
131159
+ const shouldPositionedAsMain = !verifiersDisplayedAsSubmain.includes(target);
131160
+ const isPasswordlessAndEmailpasswordExist = () => {
131161
+ return verifiersDisplayedAsSubmain.every((verifier) => selectedVerifiers.includes(verifier));
131162
+ };
131163
+ return shouldPositionedAsMain || (target === 'email_password' && isPasswordlessAndEmailpasswordExist());
131164
+ };
131165
+ /**
131166
+ * To absorb irregularity such as
131167
+ * verifiers is undefined or empty array, priority number
131168
+ * and isShowAsMainOption for some verifiers
131169
+ */
131170
+ exports.restructureLoginConfig = (verifiers = []) => {
131171
+ const uniqueVerifiersSet = new Set(verifiers);
131172
+ const hasVerifiers = uniqueVerifiersSet.size > 0;
131173
+ const selectedVerifiers = hasVerifiers
131174
+ ? [...verifiers, ...exports.allAllowedVerifiers.filter(item => !uniqueVerifiersSet.has(item))]
131175
+ : exports.allAllowedVerifiers;
131176
+ const conf = {};
131177
+ for (let i = 0; i < selectedVerifiers.length; i++) {
131178
+ const isShow = !hasVerifiers || uniqueVerifiersSet.has(selectedVerifiers[i]);
131179
+ conf[selectedVerifiers[i]] = {
131180
+ priority: i + 1,
131181
+ showOnModal: isShow,
131182
+ showOnMobile: isShow,
131183
+ showOnDesktop: isShow,
131184
+ mainOption: isShowInUpperLayoutInModal(selectedVerifiers[i], hasVerifiers ? verifiers : selectedVerifiers)
131185
+ };
131186
+ }
131187
+ return conf;
131188
+ };
131440
131189
  /**
131441
131190
  * For backward-compatibility
131442
131191
  */
@@ -131548,7 +131297,7 @@ exports.findEnvByChainId = (chainId) => {
131548
131297
  "use strict";
131549
131298
 
131550
131299
  Object.defineProperty(exports, "__esModule", { value: true });
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;
131300
+ 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_DEFAULT_TAB = exports.AUTH0_TORUS_CONFIG_KEYS = exports.AUTH0_DOMAINS = exports.AUTH0_CLIENT_IDS = exports.AUTH_LABEL = exports.APP = void 0;
131552
131301
  exports.APP = 'Startrail';
131553
131302
  exports.AUTH_LABEL = {
131554
131303
  SIGNUP: {
@@ -131560,10 +131309,22 @@ exports.AUTH_LABEL = {
131560
131309
  EN: 'Login'
131561
131310
  }
131562
131311
  };
131563
- exports.AUTH0_CLIENT_ID = 'o2GR8rwXJ0ni4cifcPrkO2olJG5Kafis';
131312
+ exports.AUTH0_CLIENT_IDS = {
131313
+ PROD: 'o2GR8rwXJ0ni4cifcPrkO2olJG5Kafis',
131314
+ STG: 'bjLPkbje34kWs4p5jM58q0kIW21KnuiH',
131315
+ DEV: 'F1NCHy8cV6UfZPTHUwELJZWU2zPsI7Gt'
131316
+ };
131317
+ exports.AUTH0_DOMAINS = {
131318
+ PROD: 'https://auth0.startrail.io',
131319
+ STG: 'https://startrail-staging.jp.auth0.com',
131320
+ DEV: 'https://torusstartrail.au.auth0.com'
131321
+ };
131322
+ exports.AUTH0_TORUS_CONFIG_KEYS = {
131323
+ PROD: 'startrail-auth0-email-password',
131324
+ STG: 'startrail-auth0-staging',
131325
+ DEV: 'startrail-auth0-email-password-qa'
131326
+ };
131564
131327
  exports.AUTH0_DEFAULT_TAB = { login: true, signup: true };
131565
- exports.AUTH0_DOMAIN = 'https://auth0.startrail.io';
131566
- exports.AUTH0_TORUS_CONFIG_KEY = 'startrail-auth0-email-password';
131567
131328
  exports.COMPRESSION_ALGORITHM = 'gzip';
131568
131329
  exports.CONTACT_EMAIL = 'contact@startrail.io';
131569
131330
  exports.DEFAULT_WORD = {
@@ -131755,8 +131516,8 @@ exports.TORUS_VERIFIERS = {
131755
131516
  DEV: 'torus-auth0-email-passwordless-lrc'
131756
131517
  },
131757
131518
  email_password: {
131758
- PROD: exports.AUTH0_TORUS_CONFIG_KEY,
131759
- STG: '',
131519
+ PROD: exports.AUTH0_TORUS_CONFIG_KEYS.PROD,
131520
+ STG: exports.AUTH0_TORUS_CONFIG_KEYS.STG,
131760
131521
  DEV: '' // Should be passed from the caller
131761
131522
  }
131762
131523
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startbahn/startrail-sdk-js",
3
- "version": "1.31.0-beta.3",
3
+ "version": "1.31.0",
4
4
  "description": "Startrail Api for JS SDK",
5
5
  "main": "dist/startrail-sdk.js",
6
6
  "unpkg": "dist/startrail-sdk.js",
@@ -155,6 +155,7 @@ declare module '@startbahn/startrail-sdk-js/types' {
155
155
  contactUrl?: string;
156
156
  words?: CustomMultiLangConfig;
157
157
  logoWhiteUrl?: string;
158
+ verificationEmailTitle?: string;
158
159
  }
159
160
  export type CustomMultiLangConfig = {
160
161
  [lang in Language]: CustomWords;
@@ -253,6 +254,16 @@ declare module '@startbahn/startrail-sdk-js/types' {
253
254
  }
254
255
  export type Language = 'ja' | 'en';
255
256
  export type LoginProvider = 'google' | 'email_password' | 'facebook' | 'twitter' | 'line' | 'apple' | 'email_passwordless';
257
+ export type TLoginProviders = LoginProvider[];
258
+ export type TConfByLoginProviders = {
259
+ [K in LoginProvider]: {
260
+ showOnMobile: boolean;
261
+ showOnDesktop: boolean;
262
+ showOnModal: boolean;
263
+ mainOption: boolean;
264
+ priority: number;
265
+ };
266
+ };
256
267
  export type TTorusNativeVerifier = Exclude<LoginProvider, 'line'>;
257
268
  export type TTorusAuth0CustomVerifier = Extract<LoginProvider, 'line'>;
258
269
  export type TAppEnv = 'PROD' | 'STG' | 'DEV';
@@ -277,7 +288,7 @@ declare module '@startbahn/startrail-sdk-js/types' {
277
288
  export interface OverwriteStartrailSDKConfig {
278
289
  authAction?: AuthAction;
279
290
  lang?: string;
280
- loginProvider?: LoginProvider;
291
+ loginProvider?: TLoginProviders;
281
292
  }
282
293
  export interface PreTorusConfig {
283
294
  apiPath: string;
@@ -286,7 +297,7 @@ declare module '@startbahn/startrail-sdk-js/types' {
286
297
  auth0Domain: string;
287
298
  auth0TorusConfigKey: string;
288
299
  lang: Language;
289
- loginProvider: LoginProvider | undefined;
300
+ loginProvider: TConfByLoginProviders;
290
301
  conditionalWords: WordsDeterminedByCondition;
291
302
  customUi: CustomUi | undefined;
292
303
  network: {
@@ -341,7 +352,7 @@ declare module '@startbahn/startrail-sdk-js/types' {
341
352
  auth0TorusConfigKey?: string;
342
353
  customUi?: CustomUi;
343
354
  lang?: string;
344
- loginProvider?: LoginProvider;
355
+ loginProvider?: TLoginProviders;
345
356
  callbackUrl?: string;
346
357
  withModal?: boolean;
347
358
  }
@@ -886,13 +897,25 @@ declare module '@startbahn/startrail-sdk-js/constant' {
886
897
  EN: string;
887
898
  };
888
899
  };
889
- export const AUTH0_CLIENT_ID = "o2GR8rwXJ0ni4cifcPrkO2olJG5Kafis";
900
+ export const AUTH0_CLIENT_IDS: {
901
+ PROD: string;
902
+ STG: string;
903
+ DEV: string;
904
+ };
905
+ export const AUTH0_DOMAINS: {
906
+ PROD: string;
907
+ STG: string;
908
+ DEV: string;
909
+ };
910
+ export const AUTH0_TORUS_CONFIG_KEYS: {
911
+ PROD: string;
912
+ STG: string;
913
+ DEV: string;
914
+ };
890
915
  export const AUTH0_DEFAULT_TAB: {
891
916
  login: boolean;
892
917
  signup: boolean;
893
918
  };
894
- export const AUTH0_DOMAIN = "https://auth0.startrail.io";
895
- export const AUTH0_TORUS_CONFIG_KEY = "startrail-auth0-email-password";
896
919
  export const COMPRESSION_ALGORITHM = "gzip";
897
920
  export const CONTACT_EMAIL = "contact@startrail.io";
898
921
  export const DEFAULT_WORD: {