@stytch/vanilla-js 5.6.1 → 5.6.2
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/CHANGELOG.md +8 -0
- package/dist/b2b/index.esm.js +37 -42
- package/dist/b2b/index.headless.esm.js +4 -20
- package/dist/b2b/index.headless.js +4 -20
- package/dist/b2b/index.js +37 -42
- package/dist/index.esm.js +1 -1
- package/dist/index.headless.esm.js +4 -20
- package/dist/index.headless.js +4 -20
- package/dist/index.js +1 -1
- package/dist/ui/b2b/GlobalContextProvider.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @stytch/vanilla-js
|
|
2
2
|
|
|
3
|
+
## 5.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 37b3dcd7: Improved error message for ad_blocker_detected
|
|
8
|
+
- fd5c8b0e: Remove workaround for setting cookies in older versions of Firefox
|
|
9
|
+
- a8572550: Error messages in the StytchLogin component no longer overflows the container
|
|
10
|
+
|
|
3
11
|
## 5.6.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/b2b/index.esm.js
CHANGED
|
@@ -458,6 +458,7 @@ var ErrorType;
|
|
|
458
458
|
ErrorType[ErrorType["EmailMagicLink"] = 1] = "EmailMagicLink";
|
|
459
459
|
ErrorType[ErrorType["Organization"] = 2] = "Organization";
|
|
460
460
|
ErrorType[ErrorType["CannotJoinOrgDueToAuthPolicy"] = 3] = "CannotJoinOrgDueToAuthPolicy";
|
|
461
|
+
ErrorType[ErrorType["AdBlockerDetected"] = 4] = "AdBlockerDetected";
|
|
461
462
|
})(ErrorType || (ErrorType = {}));
|
|
462
463
|
var DEFAULT_STATE = {
|
|
463
464
|
screen: AppScreens$1.Main,
|
|
@@ -1500,7 +1501,7 @@ var ErrorScreen = function ErrorScreen() {
|
|
|
1500
1501
|
_useGlobalReducer2 = _slicedToArray(_useGlobalReducer, 1),
|
|
1501
1502
|
state = _useGlobalReducer2[0];
|
|
1502
1503
|
var currentErrorType = state.errorType;
|
|
1503
|
-
var ErrorTypeMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ErrorType.Default, 'Something went wrong. Try again later or contact your admin for help.'), ErrorType.EmailMagicLink, 'Something went wrong. Your login link may have expired, been revoked, or been used more than once. Request a new login link to try again, or contact your admin for help.'), ErrorType.Organization, 'The organization you are looking for could not be found. If you think this is a mistake, contact your admin.'), ErrorType.CannotJoinOrgDueToAuthPolicy, "Unable to join due to ".concat((_b = (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.organization_name) !== null && _b !== void 0 ? _b : 'the organization', "'s authentication policy. Please contact your admin for more information."));
|
|
1504
|
+
var ErrorTypeMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ErrorType.Default, 'Something went wrong. Try again later or contact your admin for help.'), ErrorType.EmailMagicLink, 'Something went wrong. Your login link may have expired, been revoked, or been used more than once. Request a new login link to try again, or contact your admin for help.'), ErrorType.Organization, 'The organization you are looking for could not be found. If you think this is a mistake, contact your admin.'), ErrorType.CannotJoinOrgDueToAuthPolicy, "Unable to join due to ".concat((_b = (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.organization_name) !== null && _b !== void 0 ? _b : 'the organization', "'s authentication policy. Please contact your admin for more information.")), ErrorType.AdBlockerDetected, 'The request was blocked by an Ad Blocker. Please disable your ad blocker, refresh the page, and try again.');
|
|
1504
1505
|
return /*#__PURE__*/wn.createElement(Flex, {
|
|
1505
1506
|
direction: "column",
|
|
1506
1507
|
gap: 24,
|
|
@@ -5827,81 +5828,75 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
5827
5828
|
intermediateSessionToken: data.intermediate_session_token
|
|
5828
5829
|
});
|
|
5829
5830
|
};
|
|
5830
|
-
var
|
|
5831
|
-
|
|
5832
|
-
|
|
5831
|
+
var handleStytchAPIError = function handleStytchAPIError(defaultErrorType) {
|
|
5832
|
+
return function (error) {
|
|
5833
|
+
var error_type = extractErrorType(error);
|
|
5834
|
+
var errorTypeMap = {
|
|
5835
|
+
ad_blocker_detected: ErrorType.AdBlockerDetected
|
|
5836
|
+
};
|
|
5837
|
+
var errorType = error_type && errorTypeMap[error_type] ? errorTypeMap[error_type] : defaultErrorType !== null && defaultErrorType !== void 0 ? defaultErrorType : ErrorType.Default;
|
|
5833
5838
|
clearStytchSearchParams();
|
|
5834
5839
|
dispatch({
|
|
5835
5840
|
type: 'set_error_message_and_transition',
|
|
5836
|
-
errorType: errorType
|
|
5841
|
+
errorType: errorType
|
|
5837
5842
|
});
|
|
5838
5843
|
};
|
|
5839
5844
|
};
|
|
5840
|
-
var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_,
|
|
5841
|
-
var token =
|
|
5845
|
+
var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_, _ref123) {
|
|
5846
|
+
var token = _ref123.arg.token;
|
|
5842
5847
|
return stytchClient.magicLinks.authenticate({
|
|
5843
5848
|
magic_links_token: token,
|
|
5844
5849
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
5845
5850
|
});
|
|
5846
5851
|
}, {
|
|
5847
5852
|
onSuccess: onSuccess,
|
|
5848
|
-
onError:
|
|
5849
|
-
errorType: ErrorType.EmailMagicLink
|
|
5850
|
-
})
|
|
5853
|
+
onError: handleStytchAPIError(ErrorType.EmailMagicLink)
|
|
5851
5854
|
}),
|
|
5852
5855
|
stytchMagicLinkAuthenticate = _useMutate13.trigger,
|
|
5853
5856
|
isMagicLinkLoading = _useMutate13.isMutating;
|
|
5854
|
-
var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_,
|
|
5855
|
-
var token =
|
|
5857
|
+
var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_, _ref124) {
|
|
5858
|
+
var token = _ref124.arg.token;
|
|
5856
5859
|
return stytchClient.oauth.authenticate({
|
|
5857
5860
|
oauth_token: token,
|
|
5858
5861
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
5859
5862
|
});
|
|
5860
5863
|
}, {
|
|
5861
5864
|
onSuccess: onSuccess,
|
|
5862
|
-
onError:
|
|
5863
|
-
errorType: null
|
|
5864
|
-
})
|
|
5865
|
+
onError: handleStytchAPIError()
|
|
5865
5866
|
}),
|
|
5866
5867
|
stytchOAuthAuthenticate = _useMutate14.trigger,
|
|
5867
5868
|
isOAuthLoading = _useMutate14.isMutating;
|
|
5868
|
-
var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_,
|
|
5869
|
-
var token =
|
|
5869
|
+
var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_, _ref125) {
|
|
5870
|
+
var token = _ref125.arg.token;
|
|
5870
5871
|
return stytchClient.oauth.discovery.authenticate({
|
|
5871
5872
|
discovery_oauth_token: token
|
|
5872
5873
|
});
|
|
5873
5874
|
}, {
|
|
5874
5875
|
onSuccess: onDiscoverySuccess,
|
|
5875
|
-
onError:
|
|
5876
|
-
errorType: null
|
|
5877
|
-
})
|
|
5876
|
+
onError: handleStytchAPIError()
|
|
5878
5877
|
}),
|
|
5879
5878
|
stytchOAuthDiscoveryAuthenticate = _useMutate15.trigger,
|
|
5880
5879
|
isDiscoveryOAuthLoading = _useMutate15.isMutating;
|
|
5881
|
-
var _useMutate16 = useMutate("stytch.sso.authenticate", function (_,
|
|
5882
|
-
var token =
|
|
5880
|
+
var _useMutate16 = useMutate("stytch.sso.authenticate", function (_, _ref126) {
|
|
5881
|
+
var token = _ref126.arg.token;
|
|
5883
5882
|
return stytchClient.sso.authenticate({
|
|
5884
5883
|
sso_token: token,
|
|
5885
5884
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
5886
5885
|
});
|
|
5887
5886
|
}, {
|
|
5888
5887
|
onSuccess: onSuccess,
|
|
5889
|
-
onError:
|
|
5890
|
-
errorType: null
|
|
5891
|
-
})
|
|
5888
|
+
onError: handleStytchAPIError()
|
|
5892
5889
|
}),
|
|
5893
5890
|
stytchSSOAuthenticate = _useMutate16.trigger,
|
|
5894
5891
|
isSSOLoading = _useMutate16.isMutating;
|
|
5895
|
-
var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_,
|
|
5896
|
-
var token =
|
|
5892
|
+
var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_, _ref127) {
|
|
5893
|
+
var token = _ref127.arg.token;
|
|
5897
5894
|
return stytchClient.magicLinks.discovery.authenticate({
|
|
5898
5895
|
discovery_magic_links_token: token
|
|
5899
5896
|
});
|
|
5900
5897
|
}, {
|
|
5901
5898
|
onSuccess: onDiscoverySuccess,
|
|
5902
|
-
onError:
|
|
5903
|
-
errorType: ErrorType.Default
|
|
5904
|
-
})
|
|
5899
|
+
onError: handleStytchAPIError()
|
|
5905
5900
|
}),
|
|
5906
5901
|
stytchDiscoveryAuthenticate = _useMutate17.trigger,
|
|
5907
5902
|
isDiscoveryLoading = _useMutate17.isMutating;
|
|
@@ -6004,11 +5999,11 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
6004
5999
|
src: POWERED_BY_STYTCH_IMG_URL
|
|
6005
6000
|
}))))));
|
|
6006
6001
|
};
|
|
6007
|
-
var AppContainer = function AppContainer(
|
|
6008
|
-
var client =
|
|
6009
|
-
styles =
|
|
6010
|
-
callbacks =
|
|
6011
|
-
config =
|
|
6002
|
+
var AppContainer = function AppContainer(_ref128) {
|
|
6003
|
+
var client = _ref128.client,
|
|
6004
|
+
styles = _ref128.styles,
|
|
6005
|
+
callbacks = _ref128.callbacks,
|
|
6006
|
+
config = _ref128.config;
|
|
6012
6007
|
var _h$59 = h$2(function () {
|
|
6013
6008
|
var _readB2BInternals$boo3 = readB2BInternals(client).bootstrap.getSync(),
|
|
6014
6009
|
displayWatermark = _readB2BInternals$boo3.displayWatermark;
|
|
@@ -6024,8 +6019,8 @@ var AppContainer = function AppContainer(_ref129) {
|
|
|
6024
6019
|
options: config
|
|
6025
6020
|
}
|
|
6026
6021
|
});
|
|
6027
|
-
readB2BInternals(client).bootstrap.getAsync().then(function (
|
|
6028
|
-
var displayWatermark =
|
|
6022
|
+
readB2BInternals(client).bootstrap.getAsync().then(function (_ref129) {
|
|
6023
|
+
var displayWatermark = _ref129.displayWatermark;
|
|
6029
6024
|
setDisplayWatermark(displayWatermark);
|
|
6030
6025
|
});
|
|
6031
6026
|
}, [client]);
|
|
@@ -6062,11 +6057,11 @@ var StytchB2BUIClient = /*#__PURE__*/function (_StytchB2BHeadlessCli) {
|
|
|
6062
6057
|
}
|
|
6063
6058
|
_createClass(StytchB2BUIClient, [{
|
|
6064
6059
|
key: "mount",
|
|
6065
|
-
value: function mount(
|
|
6066
|
-
var elementId =
|
|
6067
|
-
styles =
|
|
6068
|
-
callbacks =
|
|
6069
|
-
config =
|
|
6060
|
+
value: function mount(_ref130) {
|
|
6061
|
+
var elementId = _ref130.elementId,
|
|
6062
|
+
styles = _ref130.styles,
|
|
6063
|
+
callbacks = _ref130.callbacks,
|
|
6064
|
+
config = _ref130.config;
|
|
6070
6065
|
var _a;
|
|
6071
6066
|
var targetParentDomNode = document.querySelector(elementId);
|
|
6072
6067
|
if (!targetParentDomNode) {
|
|
@@ -611,21 +611,6 @@ function init(converter, defaultAttributes) {
|
|
|
611
611
|
var api = init(defaultConverter, {
|
|
612
612
|
path: '/'
|
|
613
613
|
});
|
|
614
|
-
var cookieVerificationTimeouts = new Map();
|
|
615
|
-
var cancelCookieRestoration = function cancelCookieRestoration(name) {
|
|
616
|
-
clearTimeout(cookieVerificationTimeouts.get(name));
|
|
617
|
-
};
|
|
618
|
-
var setCookiePersistently = function setCookiePersistently(name, value, options) {
|
|
619
|
-
var COOKIE_VERIFY_DELAY_MS = 10;
|
|
620
|
-
cancelCookieRestoration(name);
|
|
621
|
-
var timeoutId = setTimeout(function () {
|
|
622
|
-
if (api.get(name) === undefined) {
|
|
623
|
-
api.set(name, value, options);
|
|
624
|
-
}
|
|
625
|
-
}, COOKIE_VERIFY_DELAY_MS);
|
|
626
|
-
cookieVerificationTimeouts.set(name, timeoutId);
|
|
627
|
-
return api.set(name, value, options);
|
|
628
|
-
};
|
|
629
614
|
var STYTCH_SESSION_COOKIE = 'stytch_session';
|
|
630
615
|
var STYTCH_SESSION_JWT_COOKIE = 'stytch_session_jwt';
|
|
631
616
|
var STYTCH_INTERMEDIATE_SESSION_TOKEN_COOKIE = 'stytch_intermediate_session_token';
|
|
@@ -760,8 +745,8 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
|
|
|
760
745
|
path: this._cookiePath,
|
|
761
746
|
domain: this._domain
|
|
762
747
|
});
|
|
763
|
-
|
|
764
|
-
|
|
748
|
+
api.set(this.opaqueTokenCookieName, session_token, cookieOpts);
|
|
749
|
+
api.set(this.jwtCookieName, session_jwt, cookieOpts);
|
|
765
750
|
var alternateCookieOptions = SubscriptionDataLayer.generateCookieOpts({
|
|
766
751
|
expiresAt: (_d = (_c = state === null || state === void 0 ? void 0 : state.session) === null || _c === void 0 ? void 0 : _c.expires_at) !== null && _d !== void 0 ? _d : '',
|
|
767
752
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
@@ -791,7 +776,7 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
|
|
|
791
776
|
path: this._cookiePath,
|
|
792
777
|
domain: this._domain
|
|
793
778
|
});
|
|
794
|
-
|
|
779
|
+
api.set(this.istCookieName, IST, cookieOpts);
|
|
795
780
|
}
|
|
796
781
|
}, {
|
|
797
782
|
key: "removeSessionCookie",
|
|
@@ -822,7 +807,6 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
|
|
|
822
807
|
});
|
|
823
808
|
});
|
|
824
809
|
});
|
|
825
|
-
cookiesToRemove.forEach(cancelCookieRestoration);
|
|
826
810
|
}
|
|
827
811
|
}, {
|
|
828
812
|
key: "syncToLocalStorage",
|
|
@@ -1482,7 +1466,7 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
|
|
|
1482
1466
|
}]);
|
|
1483
1467
|
return B2BOneTapProvider;
|
|
1484
1468
|
}();
|
|
1485
|
-
var version = "5.6.
|
|
1469
|
+
var version = "5.6.2";
|
|
1486
1470
|
var NetworkClient = /*#__PURE__*/function () {
|
|
1487
1471
|
function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
|
|
1488
1472
|
_classCallCheck(this, NetworkClient);
|
|
@@ -612,21 +612,6 @@ function init(converter, defaultAttributes) {
|
|
|
612
612
|
var api = init(defaultConverter, {
|
|
613
613
|
path: '/'
|
|
614
614
|
});
|
|
615
|
-
var cookieVerificationTimeouts = new Map();
|
|
616
|
-
var cancelCookieRestoration = function cancelCookieRestoration(name) {
|
|
617
|
-
clearTimeout(cookieVerificationTimeouts.get(name));
|
|
618
|
-
};
|
|
619
|
-
var setCookiePersistently = function setCookiePersistently(name, value, options) {
|
|
620
|
-
var COOKIE_VERIFY_DELAY_MS = 10;
|
|
621
|
-
cancelCookieRestoration(name);
|
|
622
|
-
var timeoutId = setTimeout(function () {
|
|
623
|
-
if (api.get(name) === undefined) {
|
|
624
|
-
api.set(name, value, options);
|
|
625
|
-
}
|
|
626
|
-
}, COOKIE_VERIFY_DELAY_MS);
|
|
627
|
-
cookieVerificationTimeouts.set(name, timeoutId);
|
|
628
|
-
return api.set(name, value, options);
|
|
629
|
-
};
|
|
630
615
|
var STYTCH_SESSION_COOKIE = 'stytch_session';
|
|
631
616
|
var STYTCH_SESSION_JWT_COOKIE = 'stytch_session_jwt';
|
|
632
617
|
var STYTCH_INTERMEDIATE_SESSION_TOKEN_COOKIE = 'stytch_intermediate_session_token';
|
|
@@ -761,8 +746,8 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
|
|
|
761
746
|
path: this._cookiePath,
|
|
762
747
|
domain: this._domain
|
|
763
748
|
});
|
|
764
|
-
|
|
765
|
-
|
|
749
|
+
api.set(this.opaqueTokenCookieName, session_token, cookieOpts);
|
|
750
|
+
api.set(this.jwtCookieName, session_jwt, cookieOpts);
|
|
766
751
|
var alternateCookieOptions = SubscriptionDataLayer.generateCookieOpts({
|
|
767
752
|
expiresAt: (_d = (_c = state === null || state === void 0 ? void 0 : state.session) === null || _c === void 0 ? void 0 : _c.expires_at) !== null && _d !== void 0 ? _d : '',
|
|
768
753
|
availableToSubdomains: !this._cookieAvailableToSubdomains,
|
|
@@ -792,7 +777,7 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
|
|
|
792
777
|
path: this._cookiePath,
|
|
793
778
|
domain: this._domain
|
|
794
779
|
});
|
|
795
|
-
|
|
780
|
+
api.set(this.istCookieName, IST, cookieOpts);
|
|
796
781
|
}
|
|
797
782
|
}, {
|
|
798
783
|
key: "removeSessionCookie",
|
|
@@ -823,7 +808,6 @@ var SubscriptionDataLayer = /*#__PURE__*/function () {
|
|
|
823
808
|
});
|
|
824
809
|
});
|
|
825
810
|
});
|
|
826
|
-
cookiesToRemove.forEach(cancelCookieRestoration);
|
|
827
811
|
}
|
|
828
812
|
}, {
|
|
829
813
|
key: "syncToLocalStorage",
|
|
@@ -1483,7 +1467,7 @@ var B2BOneTapProvider = /*#__PURE__*/function () {
|
|
|
1483
1467
|
}]);
|
|
1484
1468
|
return B2BOneTapProvider;
|
|
1485
1469
|
}();
|
|
1486
|
-
var version = "5.6.
|
|
1470
|
+
var version = "5.6.2";
|
|
1487
1471
|
var NetworkClient = /*#__PURE__*/function () {
|
|
1488
1472
|
function NetworkClient(_publicToken, _subscriptionDataLayer, _liveAPIURL, _testAPIURL, additionalTelemetryDataFn) {
|
|
1489
1473
|
_classCallCheck(this, NetworkClient);
|
package/dist/b2b/index.js
CHANGED
|
@@ -459,6 +459,7 @@ var ErrorType;
|
|
|
459
459
|
ErrorType[ErrorType["EmailMagicLink"] = 1] = "EmailMagicLink";
|
|
460
460
|
ErrorType[ErrorType["Organization"] = 2] = "Organization";
|
|
461
461
|
ErrorType[ErrorType["CannotJoinOrgDueToAuthPolicy"] = 3] = "CannotJoinOrgDueToAuthPolicy";
|
|
462
|
+
ErrorType[ErrorType["AdBlockerDetected"] = 4] = "AdBlockerDetected";
|
|
462
463
|
})(ErrorType || (ErrorType = {}));
|
|
463
464
|
var DEFAULT_STATE = {
|
|
464
465
|
screen: AppScreens$1.Main,
|
|
@@ -1501,7 +1502,7 @@ var ErrorScreen = function ErrorScreen() {
|
|
|
1501
1502
|
_useGlobalReducer2 = _slicedToArray(_useGlobalReducer, 1),
|
|
1502
1503
|
state = _useGlobalReducer2[0];
|
|
1503
1504
|
var currentErrorType = state.errorType;
|
|
1504
|
-
var ErrorTypeMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ErrorType.Default, 'Something went wrong. Try again later or contact your admin for help.'), ErrorType.EmailMagicLink, 'Something went wrong. Your login link may have expired, been revoked, or been used more than once. Request a new login link to try again, or contact your admin for help.'), ErrorType.Organization, 'The organization you are looking for could not be found. If you think this is a mistake, contact your admin.'), ErrorType.CannotJoinOrgDueToAuthPolicy, "Unable to join due to ".concat((_b = (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.organization_name) !== null && _b !== void 0 ? _b : 'the organization', "'s authentication policy. Please contact your admin for more information."));
|
|
1505
|
+
var ErrorTypeMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ErrorType.Default, 'Something went wrong. Try again later or contact your admin for help.'), ErrorType.EmailMagicLink, 'Something went wrong. Your login link may have expired, been revoked, or been used more than once. Request a new login link to try again, or contact your admin for help.'), ErrorType.Organization, 'The organization you are looking for could not be found. If you think this is a mistake, contact your admin.'), ErrorType.CannotJoinOrgDueToAuthPolicy, "Unable to join due to ".concat((_b = (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.organization_name) !== null && _b !== void 0 ? _b : 'the organization', "'s authentication policy. Please contact your admin for more information.")), ErrorType.AdBlockerDetected, 'The request was blocked by an Ad Blocker. Please disable your ad blocker, refresh the page, and try again.');
|
|
1505
1506
|
return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
|
|
1506
1507
|
direction: "column",
|
|
1507
1508
|
gap: 24,
|
|
@@ -5828,81 +5829,75 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
5828
5829
|
intermediateSessionToken: data.intermediate_session_token
|
|
5829
5830
|
});
|
|
5830
5831
|
};
|
|
5831
|
-
var
|
|
5832
|
-
|
|
5833
|
-
|
|
5832
|
+
var handleStytchAPIError = function handleStytchAPIError(defaultErrorType) {
|
|
5833
|
+
return function (error) {
|
|
5834
|
+
var error_type = extractErrorType(error);
|
|
5835
|
+
var errorTypeMap = {
|
|
5836
|
+
ad_blocker_detected: ErrorType.AdBlockerDetected
|
|
5837
|
+
};
|
|
5838
|
+
var errorType = error_type && errorTypeMap[error_type] ? errorTypeMap[error_type] : defaultErrorType !== null && defaultErrorType !== void 0 ? defaultErrorType : ErrorType.Default;
|
|
5834
5839
|
clearStytchSearchParams();
|
|
5835
5840
|
dispatch({
|
|
5836
5841
|
type: 'set_error_message_and_transition',
|
|
5837
|
-
errorType: errorType
|
|
5842
|
+
errorType: errorType
|
|
5838
5843
|
});
|
|
5839
5844
|
};
|
|
5840
5845
|
};
|
|
5841
|
-
var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_,
|
|
5842
|
-
var token =
|
|
5846
|
+
var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_, _ref123) {
|
|
5847
|
+
var token = _ref123.arg.token;
|
|
5843
5848
|
return stytchClient.magicLinks.authenticate({
|
|
5844
5849
|
magic_links_token: token,
|
|
5845
5850
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
5846
5851
|
});
|
|
5847
5852
|
}, {
|
|
5848
5853
|
onSuccess: onSuccess,
|
|
5849
|
-
onError:
|
|
5850
|
-
errorType: ErrorType.EmailMagicLink
|
|
5851
|
-
})
|
|
5854
|
+
onError: handleStytchAPIError(ErrorType.EmailMagicLink)
|
|
5852
5855
|
}),
|
|
5853
5856
|
stytchMagicLinkAuthenticate = _useMutate13.trigger,
|
|
5854
5857
|
isMagicLinkLoading = _useMutate13.isMutating;
|
|
5855
|
-
var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_,
|
|
5856
|
-
var token =
|
|
5858
|
+
var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_, _ref124) {
|
|
5859
|
+
var token = _ref124.arg.token;
|
|
5857
5860
|
return stytchClient.oauth.authenticate({
|
|
5858
5861
|
oauth_token: token,
|
|
5859
5862
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
5860
5863
|
});
|
|
5861
5864
|
}, {
|
|
5862
5865
|
onSuccess: onSuccess,
|
|
5863
|
-
onError:
|
|
5864
|
-
errorType: null
|
|
5865
|
-
})
|
|
5866
|
+
onError: handleStytchAPIError()
|
|
5866
5867
|
}),
|
|
5867
5868
|
stytchOAuthAuthenticate = _useMutate14.trigger,
|
|
5868
5869
|
isOAuthLoading = _useMutate14.isMutating;
|
|
5869
|
-
var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_,
|
|
5870
|
-
var token =
|
|
5870
|
+
var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_, _ref125) {
|
|
5871
|
+
var token = _ref125.arg.token;
|
|
5871
5872
|
return stytchClient.oauth.discovery.authenticate({
|
|
5872
5873
|
discovery_oauth_token: token
|
|
5873
5874
|
});
|
|
5874
5875
|
}, {
|
|
5875
5876
|
onSuccess: onDiscoverySuccess,
|
|
5876
|
-
onError:
|
|
5877
|
-
errorType: null
|
|
5878
|
-
})
|
|
5877
|
+
onError: handleStytchAPIError()
|
|
5879
5878
|
}),
|
|
5880
5879
|
stytchOAuthDiscoveryAuthenticate = _useMutate15.trigger,
|
|
5881
5880
|
isDiscoveryOAuthLoading = _useMutate15.isMutating;
|
|
5882
|
-
var _useMutate16 = useMutate("stytch.sso.authenticate", function (_,
|
|
5883
|
-
var token =
|
|
5881
|
+
var _useMutate16 = useMutate("stytch.sso.authenticate", function (_, _ref126) {
|
|
5882
|
+
var token = _ref126.arg.token;
|
|
5884
5883
|
return stytchClient.sso.authenticate({
|
|
5885
5884
|
sso_token: token,
|
|
5886
5885
|
session_duration_minutes: config.sessionOptions.sessionDurationMinutes
|
|
5887
5886
|
});
|
|
5888
5887
|
}, {
|
|
5889
5888
|
onSuccess: onSuccess,
|
|
5890
|
-
onError:
|
|
5891
|
-
errorType: null
|
|
5892
|
-
})
|
|
5889
|
+
onError: handleStytchAPIError()
|
|
5893
5890
|
}),
|
|
5894
5891
|
stytchSSOAuthenticate = _useMutate16.trigger,
|
|
5895
5892
|
isSSOLoading = _useMutate16.isMutating;
|
|
5896
|
-
var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_,
|
|
5897
|
-
var token =
|
|
5893
|
+
var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_, _ref127) {
|
|
5894
|
+
var token = _ref127.arg.token;
|
|
5898
5895
|
return stytchClient.magicLinks.discovery.authenticate({
|
|
5899
5896
|
discovery_magic_links_token: token
|
|
5900
5897
|
});
|
|
5901
5898
|
}, {
|
|
5902
5899
|
onSuccess: onDiscoverySuccess,
|
|
5903
|
-
onError:
|
|
5904
|
-
errorType: ErrorType.Default
|
|
5905
|
-
})
|
|
5900
|
+
onError: handleStytchAPIError()
|
|
5906
5901
|
}),
|
|
5907
5902
|
stytchDiscoveryAuthenticate = _useMutate17.trigger,
|
|
5908
5903
|
isDiscoveryLoading = _useMutate17.isMutating;
|
|
@@ -6005,11 +6000,11 @@ var AppContainer$1 = function AppContainer$1() {
|
|
|
6005
6000
|
src: POWERED_BY_STYTCH_IMG_URL
|
|
6006
6001
|
}))))));
|
|
6007
6002
|
};
|
|
6008
|
-
var AppContainer = function AppContainer(
|
|
6009
|
-
var client =
|
|
6010
|
-
styles =
|
|
6011
|
-
callbacks =
|
|
6012
|
-
config =
|
|
6003
|
+
var AppContainer = function AppContainer(_ref128) {
|
|
6004
|
+
var client = _ref128.client,
|
|
6005
|
+
styles = _ref128.styles,
|
|
6006
|
+
callbacks = _ref128.callbacks,
|
|
6007
|
+
config = _ref128.config;
|
|
6013
6008
|
var _extractErrorMessage$70 = extractErrorMessage.h(function () {
|
|
6014
6009
|
var _internal$readB2BInte5 = internal.readB2BInternals(client).bootstrap.getSync(),
|
|
6015
6010
|
displayWatermark = _internal$readB2BInte5.displayWatermark;
|
|
@@ -6025,8 +6020,8 @@ var AppContainer = function AppContainer(_ref129) {
|
|
|
6025
6020
|
options: config
|
|
6026
6021
|
}
|
|
6027
6022
|
});
|
|
6028
|
-
internal.readB2BInternals(client).bootstrap.getAsync().then(function (
|
|
6029
|
-
var displayWatermark =
|
|
6023
|
+
internal.readB2BInternals(client).bootstrap.getAsync().then(function (_ref129) {
|
|
6024
|
+
var displayWatermark = _ref129.displayWatermark;
|
|
6030
6025
|
setDisplayWatermark(displayWatermark);
|
|
6031
6026
|
});
|
|
6032
6027
|
}, [client]);
|
|
@@ -6063,11 +6058,11 @@ var StytchB2BUIClient = /*#__PURE__*/function (_b2b_index_headless$S) {
|
|
|
6063
6058
|
}
|
|
6064
6059
|
_createClass(StytchB2BUIClient, [{
|
|
6065
6060
|
key: "mount",
|
|
6066
|
-
value: function mount(
|
|
6067
|
-
var elementId =
|
|
6068
|
-
styles =
|
|
6069
|
-
callbacks =
|
|
6070
|
-
config =
|
|
6061
|
+
value: function mount(_ref130) {
|
|
6062
|
+
var elementId = _ref130.elementId,
|
|
6063
|
+
styles = _ref130.styles,
|
|
6064
|
+
callbacks = _ref130.callbacks,
|
|
6065
|
+
config = _ref130.config;
|
|
6071
6066
|
var _a;
|
|
6072
6067
|
var targetParentDomNode = document.querySelector(elementId);
|
|
6073
6068
|
if (!targetParentDomNode) {
|