@stytch/vanilla-js 5.1.2 → 5.2.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/dist/b2b/index.js CHANGED
@@ -1,10 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37, _templateObject38, _templateObject39, _templateObject40, _templateObject41, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46, _templateObject47, _templateObject48, _templateObject49, _templateObject50, _templateObject51, _templateObject52, _templateObject53, _templateObject54, _templateObject55, _templateObject56, _templateObject57, _templateObject58;
4
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
7
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
4
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
9
5
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
6
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -15,6 +11,10 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
15
11
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
12
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
13
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
18
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
19
19
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
20
20
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
@@ -30,8 +30,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
30
30
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
31
31
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
32
32
  var b2b_index_headless = require('./index.headless.js');
33
- var extractErrorMessage = require('../extractErrorMessage-HJU8hrHP.js');
34
- var internal = require('../internal-Ce7wZE_S.js');
33
+ var extractErrorMessage = require('../extractErrorMessage-CzsbznyB.js');
34
+ var internal = require('../internal-Bs2p7EMm.js');
35
35
  var DEFAULT_MFA_STATE = {
36
36
  primaryInfo: null,
37
37
  isEnrolling: false,
@@ -48,6 +48,12 @@ var DEFAULT_MFA_STATE = {
48
48
  enrollment: null
49
49
  }
50
50
  };
51
+ var getAuthMethodsForMember = function getAuthMethodsForMember(authMethods, member) {
52
+ var memberHasPassword = !!(member === null || member === void 0 ? void 0 : member.member_password_id);
53
+ return memberHasPassword ? authMethods : authMethods.filter(function (method) {
54
+ return method !== 'password';
55
+ });
56
+ };
51
57
  var getEnabledMethods = function getEnabledMethods(_ref3) {
52
58
  var allMethods = _ref3.allMethods,
53
59
  orgSupportedMethods = _ref3.orgSupportedMethods,
@@ -83,9 +89,40 @@ var mfaReducer = function mfaReducer(state, action) {
83
89
  if (memberAuthenticated) {
84
90
  return Object.assign(Object.assign({}, state), {
85
91
  mfa: DEFAULT_MFA_STATE,
92
+ primary: {},
86
93
  screen: postAuthScreen
87
94
  });
88
95
  }
96
+ if (action.response.primary_required) {
97
+ var primaryAuthMethods = getAuthMethodsForMember(action.response.primary_required.allowed_auth_methods, action.response.member);
98
+ var _action$response$memb = action.response.member,
99
+ email = _action$response$memb.email_address,
100
+ emailVerified = _action$response$memb.email_address_verified;
101
+ var newBaseState = Object.assign(Object.assign({}, state), {
102
+ flowState: {
103
+ type: internal.AuthFlowType.Organization,
104
+ organization: action.response.organization
105
+ },
106
+ formState: Object.assign(Object.assign({}, state.formState), {
107
+ passwordState: {
108
+ email: email
109
+ }
110
+ }),
111
+ primary: {
112
+ primaryAuthMethods: primaryAuthMethods,
113
+ email: email,
114
+ emailVerified: emailVerified
115
+ },
116
+ screen: AppScreens$1.Main
117
+ });
118
+ if ((primaryAuthMethods === null || primaryAuthMethods === void 0 ? void 0 : primaryAuthMethods.length) === 0) {
119
+ return Object.assign(Object.assign({}, newBaseState), {
120
+ screen: AppScreens$1.Error,
121
+ errorType: ErrorType.CannotJoinOrgDueToAuthPolicy
122
+ });
123
+ }
124
+ return newBaseState;
125
+ }
89
126
  var memberEnrolledInSmsOtp = action.response.member.mfa_phone_number_verified;
90
127
  var memberEnrolledInTotp = !!action.response.member.totp_registration_id;
91
128
  var primaryInfo = {
@@ -121,12 +158,14 @@ var mfaReducer = function mfaReducer(state, action) {
121
158
  codeExpiration: smsImplicitlySent ? getSmsOtpCodeExpiration() : null
122
159
  })
123
160
  }),
161
+ primary: {},
124
162
  screen: AppScreens$1.SMSOTPEntry
125
163
  });
126
164
  }
127
165
  case internal.B2BMFAProducts.totp:
128
166
  return Object.assign(Object.assign({}, state), {
129
167
  mfa: mfaState,
168
+ primary: {},
130
169
  screen: AppScreens$1.TOTPEntry
131
170
  });
132
171
  }
@@ -152,6 +191,7 @@ var mfaReducer = function mfaReducer(state, action) {
152
191
  primaryInfo: primaryInfo,
153
192
  isEnrolling: true
154
193
  }),
194
+ primary: {},
155
195
  screen: getNextEnrollmentScreen()
156
196
  });
157
197
  }
@@ -298,6 +338,7 @@ var mfaReducer = function mfaReducer(state, action) {
298
338
  }
299
339
  };
300
340
  var reducer$1 = function reducer$1(state, action) {
341
+ var _a, _b, _c;
301
342
  switch (action.type) {
302
343
  case 'transition':
303
344
  return Object.assign(Object.assign({}, state), {
@@ -329,16 +370,51 @@ var reducer$1 = function reducer$1(state, action) {
329
370
  }
330
371
  case 'set_discovery_state':
331
372
  {
373
+ var discoveredOrganizations = action.discoveredOrganizations;
332
374
  return Object.assign(Object.assign({}, state), {
333
375
  formState: Object.assign(Object.assign({}, state.formState), {
334
376
  discoveryState: {
335
377
  email: action.email,
336
- discoveredOrganizations: action.discoveredOrganizations,
378
+ discoveredOrganizations: discoveredOrganizations,
337
379
  intermediateSessionToken: action.intermediateSessionToken
338
380
  }
339
- })
381
+ }),
382
+ screen: AppScreens$1.Discovery
340
383
  });
341
384
  }
385
+ case 'select_discovered_organization':
386
+ {
387
+ var _action$discoveredOrg = action.discoveredOrganization,
388
+ membership = _action$discoveredOrg.membership,
389
+ organization = _action$discoveredOrg.organization,
390
+ primary_required = _action$discoveredOrg.primary_required;
391
+ var email = (_b = (_a = membership.member) === null || _a === void 0 ? void 0 : _a.email_address) !== null && _b !== void 0 ? _b : state.formState.discoveryState.email;
392
+ var primaryAuthMethods = primary_required ? getAuthMethodsForMember(primary_required.allowed_auth_methods, membership.member) : undefined;
393
+ var newBaseState = Object.assign(Object.assign({}, state), {
394
+ flowState: {
395
+ type: internal.AuthFlowType.Organization,
396
+ organization: organization
397
+ },
398
+ formState: Object.assign(Object.assign({}, state.formState), {
399
+ passwordState: {
400
+ email: email
401
+ }
402
+ }),
403
+ primary: {
404
+ primaryAuthMethods: primaryAuthMethods,
405
+ email: email,
406
+ emailVerified: (_c = membership.member) === null || _c === void 0 ? void 0 : _c.email_address_verified
407
+ },
408
+ screen: AppScreens$1.Main
409
+ });
410
+ if ((primaryAuthMethods === null || primaryAuthMethods === void 0 ? void 0 : primaryAuthMethods.length) === 0) {
411
+ return Object.assign(Object.assign({}, newBaseState), {
412
+ screen: AppScreens$1.Error,
413
+ errorType: ErrorType.CannotJoinOrgDueToAuthPolicy
414
+ });
415
+ }
416
+ return newBaseState;
417
+ }
342
418
  case 'set_password_state':
343
419
  {
344
420
  return Object.assign(Object.assign({}, state), {
@@ -380,6 +456,7 @@ var ErrorType;
380
456
  ErrorType[ErrorType["Default"] = 0] = "Default";
381
457
  ErrorType[ErrorType["EmailMagicLink"] = 1] = "EmailMagicLink";
382
458
  ErrorType[ErrorType["Organization"] = 2] = "Organization";
459
+ ErrorType[ErrorType["CannotJoinOrgDueToAuthPolicy"] = 3] = "CannotJoinOrgDueToAuthPolicy";
383
460
  })(ErrorType || (ErrorType = {}));
384
461
  var DEFAULT_STATE = {
385
462
  screen: AppScreens$1.Main,
@@ -401,6 +478,7 @@ var DEFAULT_STATE = {
401
478
  organization: null
402
479
  },
403
480
  mfa: DEFAULT_MFA_STATE,
481
+ primary: {},
404
482
  errorType: ErrorType.Default
405
483
  };
406
484
  var DEFAULT_CONFIG = {
@@ -1588,11 +1666,12 @@ var ErrorSVG = function ErrorSVG() {
1588
1666
  };
1589
1667
  var ErrorHeader = extractErrorMessage.He(Text)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n text-align: center;\n"])));
1590
1668
  var ErrorScreen = function ErrorScreen() {
1669
+ var _a, _b;
1591
1670
  var _useGlobalReducer = useGlobalReducer(),
1592
1671
  _useGlobalReducer2 = _slicedToArray(_useGlobalReducer, 1),
1593
1672
  state = _useGlobalReducer2[0];
1594
1673
  var currentErrorType = state.errorType;
1595
- var ErrorTypeMap = _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.');
1674
+ 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."));
1596
1675
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
1597
1676
  direction: "column",
1598
1677
  gap: 24,
@@ -2003,7 +2082,8 @@ var SubmitButton = function SubmitButton(props) {
2003
2082
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Button, {
2004
2083
  id: 'submit',
2005
2084
  type: "submit",
2006
- disabled: buttonDisabled
2085
+ disabled: buttonDisabled,
2086
+ variant: props.variant
2007
2087
  }, props.isSubmitting ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
2008
2088
  justifyContent: "center"
2009
2089
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(CircularProgress, {
@@ -2104,8 +2184,10 @@ var MagicLinkEmailForm = function MagicLinkEmailForm() {
2104
2184
  var config = useConfig();
2105
2185
  var _extractErrorMessage$18 = extractErrorMessage.h(''),
2106
2186
  _extractErrorMessage$19 = _slicedToArray(_extractErrorMessage$18, 2),
2107
- email = _extractErrorMessage$19[0],
2108
- setEmail = _extractErrorMessage$19[1];
2187
+ emailInput = _extractErrorMessage$19[0],
2188
+ setEmailInput = _extractErrorMessage$19[1];
2189
+ var providedEmail = state.primary.email;
2190
+ var email = providedEmail || emailInput;
2109
2191
  var _useMutate2 = useMutate('stytch.magicLinks.email.loginOrSignup', function (_, _ref42) {
2110
2192
  var organization_id = _ref42.arg.organization_id;
2111
2193
  var _a, _b, _c, _d;
@@ -2152,7 +2234,11 @@ var MagicLinkEmailForm = function MagicLinkEmailForm() {
2152
2234
  };
2153
2235
  return /*#__PURE__*/extractErrorMessage.wn.createElement("form", {
2154
2236
  onSubmit: handleSubmit
2155
- }, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
2237
+ }, providedEmail ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(SubmitButton, {
2238
+ isSubmitting: isMutating,
2239
+ text: 'Email me a link',
2240
+ variant: "text"
2241
+ })) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
2156
2242
  direction: "column",
2157
2243
  gap: 8
2158
2244
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
@@ -2160,7 +2246,7 @@ var MagicLinkEmailForm = function MagicLinkEmailForm() {
2160
2246
  minHeight: 52
2161
2247
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(EmailInput, {
2162
2248
  email: email,
2163
- setEmail: setEmail
2249
+ setEmail: setEmailInput
2164
2250
  }), error && ( /*#__PURE__*/extractErrorMessage.wn.createElement(ErrorText, {
2165
2251
  errorMessage: parseErrorMessage(error, {
2166
2252
  email: email,
@@ -2169,7 +2255,7 @@ var MagicLinkEmailForm = function MagicLinkEmailForm() {
2169
2255
  }))), /*#__PURE__*/extractErrorMessage.wn.createElement(SubmitButton, {
2170
2256
  isSubmitting: isMutating,
2171
2257
  text: 'Continue with email'
2172
- })));
2258
+ }))));
2173
2259
  };
2174
2260
  var MagicLinkEmailDiscoveryForm = function MagicLinkEmailDiscoveryForm() {
2175
2261
  var _useGlobalReducer9 = useGlobalReducer(),
@@ -2651,42 +2737,6 @@ var PasswordsEmailForm = function PasswordsEmailForm() {
2651
2737
  color: "secondary"
2652
2738
  }, "Get help"))))));
2653
2739
  };
2654
- var OAuthB2BButton = function OAuthB2BButton(props) {
2655
- var stytchClient = useStytch();
2656
- var _useGlobalReducer17 = useGlobalReducer(),
2657
- _useGlobalReducer18 = _slicedToArray(_useGlobalReducer17, 1),
2658
- state = _useGlobalReducer18[0];
2659
- var onButtonClick = function onButtonClick() {
2660
- if (state.flowState.organization) {
2661
- return stytchClient.oauth[props.providerType].start({
2662
- login_redirect_url: props.loginRedirectUrl,
2663
- signup_redirect_url: props.signupRedirectUrl,
2664
- custom_scopes: props.customScopes,
2665
- organization_id: state.flowState.organization.organization_id,
2666
- provider_params: props.providerParams
2667
- });
2668
- }
2669
- return stytchClient.oauth[props.providerType].discovery.start({
2670
- discovery_redirect_url: props.discoveryRedirectUrl,
2671
- custom_scopes: props.customScopes,
2672
- provider_params: props.providerParams
2673
- });
2674
- };
2675
- return /*#__PURE__*/extractErrorMessage.wn.createElement(Button, {
2676
- id: "oauth-".concat(props.providerType),
2677
- type: "button",
2678
- onClick: onButtonClick,
2679
- variant: "outlined"
2680
- }, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
2681
- justifyContent: "center",
2682
- alignItems: "center",
2683
- gap: 4
2684
- }, props.icon, /*#__PURE__*/extractErrorMessage.wn.createElement("span", {
2685
- style: {
2686
- verticalAlign: 'middle'
2687
- }
2688
- }, "Continue with ", props.providerTypeTitle)));
2689
- };
2690
2740
  var CreateIcon = function CreateIcon(IconSvgComponent) {
2691
2741
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
2692
2742
  wrapped: true
@@ -2719,6 +2769,19 @@ var GoogleIconSvg = function GoogleIconSvg() {
2719
2769
  }));
2720
2770
  };
2721
2771
  var GoogleIcon = CreateIcon(GoogleIconSvg);
2772
+ var HubSpotIconSvg = function HubSpotIconSvg() {
2773
+ return /*#__PURE__*/extractErrorMessage.wn.createElement("svg", {
2774
+ viewBox: "0 0 18 20",
2775
+ fill: "none",
2776
+ xmlns: "http://www.w3.org/2000/svg"
2777
+ }, /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2778
+ fillRule: "evenodd",
2779
+ clipRule: "evenodd",
2780
+ d: "M13.0762 13.9514C11.6819 13.9514 10.5516 12.8329 10.5516 11.4533C10.5516 10.0735 11.6819 8.95502 13.0762 8.95502C14.4704 8.95502 15.6007 10.0735 15.6007 11.4533C15.6007 12.8329 14.4704 13.9514 13.0762 13.9514ZM13.8319 6.64368V4.42127C14.4181 4.14728 14.8287 3.56045 14.8287 2.87942V2.82812C14.8287 1.8882 14.0516 1.11919 13.1018 1.11919H13.0502C12.1004 1.11919 11.3234 1.8882 11.3234 2.82812V2.87942C11.3234 3.56045 11.7339 4.14752 12.3201 4.42151V6.64368C11.4474 6.7772 10.65 7.13342 9.9923 7.65767L3.82629 2.91106C3.86699 2.75645 3.89557 2.59727 3.89581 2.42995C3.89678 1.36561 3.0262 0.50144 1.95021 0.500001C0.8747 0.498803 0.00121242 1.36058 1.2622e-06 2.42516C-0.0012099 3.48974 0.869371 4.35391 1.94536 4.35511C2.29587 4.35559 2.62046 4.25707 2.90484 4.09694L8.97009 8.76636C8.45437 9.53681 8.15207 10.4597 8.15207 11.4533C8.15207 12.4935 8.48417 13.4557 9.04518 14.247L7.20082 16.0724C7.055 16.029 6.90385 15.9988 6.74349 15.9988C5.85959 15.9988 5.14282 16.7079 5.14282 17.5826C5.14282 18.4576 5.85959 19.1667 6.74349 19.1667C7.62764 19.1667 8.34416 18.4576 8.34416 17.5826C8.34416 17.4244 8.31364 17.2746 8.26979 17.1303L10.0943 15.3247C10.9225 15.9502 11.9539 16.326 13.0762 16.326C15.7957 16.326 18 14.1444 18 11.4533C18 9.0171 16.1915 7.00445 13.8319 6.64368Z",
2781
+ fill: "#FF7A59"
2782
+ }));
2783
+ };
2784
+ var HubSpotIcon = CreateIcon(HubSpotIconSvg);
2722
2785
  var MicrosoftIconSvg = function MicrosoftIconSvg() {
2723
2786
  return /*#__PURE__*/extractErrorMessage.wn.createElement("svg", {
2724
2787
  viewBox: "0 0 24 24",
@@ -2739,6 +2802,38 @@ var MicrosoftIconSvg = function MicrosoftIconSvg() {
2739
2802
  }));
2740
2803
  };
2741
2804
  var MicrosoftIcon = CreateIcon(MicrosoftIconSvg);
2805
+ var SlackIconSvg = function SlackIconSvg() {
2806
+ return /*#__PURE__*/extractErrorMessage.wn.createElement("svg", {
2807
+ viewBox: "0 0 24 24",
2808
+ fill: "none",
2809
+ xmlns: "http://www.w3.org/2000/svg"
2810
+ }, /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2811
+ d: "M6.78176 14.3746C6.78176 15.4153 5.9316 16.2655 4.89088 16.2655C3.85016 16.2655 3 15.4153 3 14.3746C3 13.3339 3.85016 12.4837 4.89088 12.4837H6.78176V14.3746Z",
2812
+ fill: "#E01E5A"
2813
+ }), /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2814
+ d: "M7.73462 14.3746C7.73462 13.3339 8.58478 12.4837 9.6255 12.4837C10.6662 12.4837 11.5164 13.3339 11.5164 14.3746V19.1091C11.5164 20.1498 10.6662 21 9.6255 21C8.58478 21 7.73462 20.1498 7.73462 19.1091V14.3746Z",
2815
+ fill: "#E01E5A"
2816
+ }), /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2817
+ d: "M9.6255 6.78176C8.58478 6.78176 7.73462 5.9316 7.73462 4.89088C7.73462 3.85016 8.58478 3 9.6255 3C10.6662 3 11.5164 3.85016 11.5164 4.89088V6.78176H9.6255Z",
2818
+ fill: "#36C5F0"
2819
+ }), /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2820
+ d: "M9.62541 7.73453C10.6661 7.73453 11.5163 8.58469 11.5163 9.62541C11.5163 10.6661 10.6661 11.5163 9.62541 11.5163H4.89088C3.85016 11.5163 3 10.6661 3 9.62541C3 8.58469 3.85016 7.73453 4.89088 7.73453H9.62541Z",
2821
+ fill: "#36C5F0"
2822
+ }), /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2823
+ d: "M17.2183 9.62541C17.2183 8.58469 18.0684 7.73453 19.1091 7.73453C20.1499 7.73453 21 8.58469 21 9.62541C21 10.6661 20.1499 11.5163 19.1091 11.5163H17.2183V9.62541Z",
2824
+ fill: "#2EB67D"
2825
+ }), /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2826
+ d: "M16.2654 9.62541C16.2654 10.6661 15.4152 11.5163 14.3745 11.5163C13.3338 11.5163 12.4836 10.6661 12.4836 9.62541V4.89088C12.4836 3.85016 13.3338 3 14.3745 3C15.4152 3 16.2654 3.85016 16.2654 4.89088V9.62541Z",
2827
+ fill: "#2EB67D"
2828
+ }), /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2829
+ d: "M14.3745 17.2182C15.4152 17.2182 16.2654 18.0684 16.2654 19.1091C16.2654 20.1498 15.4152 21 14.3745 21C13.3338 21 12.4836 20.1498 12.4836 19.1091V17.2182H14.3745Z",
2830
+ fill: "#ECB22E"
2831
+ }), /*#__PURE__*/extractErrorMessage.wn.createElement("path", {
2832
+ d: "M14.3745 16.2655C13.3338 16.2655 12.4836 15.4153 12.4836 14.3746C12.4836 13.3339 13.3338 12.4837 14.3745 12.4837H19.109C20.1498 12.4837 20.9999 13.3339 20.9999 14.3746C20.9999 15.4153 20.1498 16.2655 19.109 16.2655H14.3745Z",
2833
+ fill: "#ECB22E"
2834
+ }));
2835
+ };
2836
+ var SlackIcon = CreateIcon(SlackIconSvg);
2742
2837
  var getParamsFromB2BOAuthProviderConfig = function getParamsFromB2BOAuthProviderConfig(provider) {
2743
2838
  var providerType = '';
2744
2839
  var oneTap = false;
@@ -2781,6 +2876,42 @@ var useIsUnmounted = function useIsUnmounted() {
2781
2876
  }, []);
2782
2877
  return isUnmounted;
2783
2878
  };
2879
+ var OAuthB2BButton = function OAuthB2BButton(props) {
2880
+ var stytchClient = useStytch();
2881
+ var _useGlobalReducer17 = useGlobalReducer(),
2882
+ _useGlobalReducer18 = _slicedToArray(_useGlobalReducer17, 1),
2883
+ state = _useGlobalReducer18[0];
2884
+ var onButtonClick = function onButtonClick() {
2885
+ if (state.flowState.organization) {
2886
+ return stytchClient.oauth[props.providerType].start({
2887
+ login_redirect_url: props.loginRedirectUrl,
2888
+ signup_redirect_url: props.signupRedirectUrl,
2889
+ custom_scopes: props.customScopes,
2890
+ organization_id: state.flowState.organization.organization_id,
2891
+ provider_params: props.providerParams
2892
+ });
2893
+ }
2894
+ return stytchClient.oauth[props.providerType].discovery.start({
2895
+ discovery_redirect_url: props.discoveryRedirectUrl,
2896
+ custom_scopes: props.customScopes,
2897
+ provider_params: props.providerParams
2898
+ });
2899
+ };
2900
+ return /*#__PURE__*/extractErrorMessage.wn.createElement(Button, {
2901
+ id: "oauth-".concat(props.providerType),
2902
+ type: "button",
2903
+ onClick: onButtonClick,
2904
+ variant: "outlined"
2905
+ }, /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
2906
+ justifyContent: "center",
2907
+ alignItems: "center",
2908
+ gap: 4
2909
+ }, props.icon, /*#__PURE__*/extractErrorMessage.wn.createElement("span", {
2910
+ style: {
2911
+ verticalAlign: 'middle'
2912
+ }
2913
+ }, "Continue with ", props.providerTypeTitle)));
2914
+ };
2784
2915
  var OAuthErrorMessage = function OAuthErrorMessage(_ref50) {
2785
2916
  var children = _ref50.children;
2786
2917
  return /*#__PURE__*/extractErrorMessage.wn.createElement("div", {
@@ -2979,24 +3110,166 @@ var B2BGoogleOneTap = function B2BGoogleOneTap() {
2979
3110
  }
2980
3111
  return googleAuthButton;
2981
3112
  };
3113
+ var productsToAuthMethods = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, internal.B2BProducts.oauth, undefined), internal.B2BProducts.sso, 'sso'), internal.B2BProducts.emailMagicLinks, 'magic_link'), internal.B2BProducts.passwords, 'password');
3114
+ var oauthProvidersToAuthMethods = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, internal.B2BOAuthProviders.Google, 'google_oauth'), internal.B2BOAuthProviders.Microsoft, 'microsoft_oauth'), internal.B2BOAuthProviders.HubSpot, 'hubspot_oauth'), internal.B2BOAuthProviders.Slack, 'slack_oauth');
3115
+ var authMethodsToProducts = Object.entries(productsToAuthMethods).reduce(function (acc, _ref52) {
3116
+ var _ref53 = _slicedToArray(_ref52, 2),
3117
+ product = _ref53[0],
3118
+ method = _ref53[1];
3119
+ if (method) {
3120
+ acc[method] = product;
3121
+ }
3122
+ return acc;
3123
+ }, {});
3124
+ var oauthMethodsToOauthProviders = Object.entries(oauthProvidersToAuthMethods).reduce(function (acc, _ref54) {
3125
+ var _ref55 = _slicedToArray(_ref54, 2),
3126
+ provider = _ref55[0],
3127
+ method = _ref55[1];
3128
+ acc[method] = provider;
3129
+ return acc;
3130
+ }, {});
3131
+ var oauthProviderToAuthMethod = function oauthProviderToAuthMethod(provider) {
3132
+ return oauthProvidersToAuthMethods[provider];
3133
+ };
3134
+ var oauthMethodToOauthProvider = function oauthMethodToOauthProvider(authMethod) {
3135
+ return oauthMethodsToOauthProviders[authMethod];
3136
+ };
3137
+ var productToAuthMethod = function productToAuthMethod(product) {
3138
+ return productsToAuthMethods[product];
3139
+ };
3140
+ var authMethodToProduct = function authMethodToProduct(authMethod) {
3141
+ if (authMethod in oauthMethodsToOauthProviders) {
3142
+ return internal.B2BProducts.oauth;
3143
+ }
3144
+ return authMethodsToProducts[authMethod];
3145
+ };
3146
+ var allProducts = Object.keys(productsToAuthMethods);
3147
+ var allOauthProviders = Object.values(internal.B2BOAuthProviders);
3148
+ var flattenConfigToAuthMethods = function flattenConfigToAuthMethods(products, oauthProviders) {
3149
+ return products.reduce(function (acc, product) {
3150
+ if (product === internal.B2BProducts.oauth) {
3151
+ oauthProviders.forEach(function (provider) {
3152
+ var authMethod = oauthProviderToAuthMethod(typeof provider === 'string' ? provider : provider.type);
3153
+ if (authMethod) {
3154
+ acc.push(authMethod);
3155
+ }
3156
+ });
3157
+ } else {
3158
+ var authMethod = productToAuthMethod(product);
3159
+ if (authMethod) {
3160
+ acc.push(authMethod);
3161
+ }
3162
+ }
3163
+ return acc;
3164
+ }, []);
3165
+ };
3166
+ var useOAuthProviderConfigs = function useOAuthProviderConfigs() {
3167
+ var _a;
3168
+ var config = useConfig();
3169
+ return extractErrorMessage.F(function () {
3170
+ var _a;
3171
+ if (!((_a = config.oauthOptions) === null || _a === void 0 ? void 0 : _a.providers)) {
3172
+ return [];
3173
+ }
3174
+ return config.oauthOptions.providers.map(getParamsFromB2BOAuthProviderConfig);
3175
+ }, [(_a = config.oauthOptions) === null || _a === void 0 ? void 0 : _a.providers]);
3176
+ };
3177
+ var useRestrictedAuthMethods = function useRestrictedAuthMethods() {
3178
+ var _a, _b;
3179
+ var _useGlobalReducer21 = useGlobalReducer(),
3180
+ _useGlobalReducer22 = _slicedToArray(_useGlobalReducer21, 1),
3181
+ state = _useGlobalReducer22[0];
3182
+ var primaryAuthMethods = state.primary.primaryAuthMethods;
3183
+ var hasPrimaryAuthMethods = !!primaryAuthMethods;
3184
+ var restrictedAuthMethods = extractErrorMessage.F(function () {
3185
+ var _a, _b, _c;
3186
+ if (state.primary.primaryAuthMethods) {
3187
+ return new Set(state.primary.primaryAuthMethods);
3188
+ }
3189
+ if (((_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods) === 'RESTRICTED') {
3190
+ return new Set((_c = (_b = state.flowState.organization) === null || _b === void 0 ? void 0 : _b.allowed_auth_methods) !== null && _c !== void 0 ? _c : []);
3191
+ }
3192
+ }, [(_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.allowed_auth_methods, (_b = state.flowState.organization) === null || _b === void 0 ? void 0 : _b.auth_methods, state.primary.primaryAuthMethods]);
3193
+ return {
3194
+ restrictedAuthMethods: restrictedAuthMethods,
3195
+ hasPrimaryAuthMethods: hasPrimaryAuthMethods
3196
+ };
3197
+ };
3198
+ var useEffectiveAuthConfig = function useEffectiveAuthConfig() {
3199
+ var _a;
3200
+ var _useGlobalReducer23 = useGlobalReducer(),
3201
+ _useGlobalReducer24 = _slicedToArray(_useGlobalReducer23, 1),
3202
+ state = _useGlobalReducer24[0];
3203
+ var config = useConfig();
3204
+ var _useRestrictedAuthMet = useRestrictedAuthMethods(),
3205
+ restrictedAuthMethods = _useRestrictedAuthMet.restrictedAuthMethods,
3206
+ hasPrimaryAuthMethods = _useRestrictedAuthMet.hasPrimaryAuthMethods;
3207
+ var oauthProviderConfigs = useOAuthProviderConfigs();
3208
+ var flattenedConfiguredAuthMethods = extractErrorMessage.F(function () {
3209
+ return flattenConfigToAuthMethods(config.products, oauthProviderConfigs);
3210
+ }, [config.products, oauthProviderConfigs]);
3211
+ var authMethodsToShow = extractErrorMessage.F(function () {
3212
+ var _a;
3213
+ if (!restrictedAuthMethods) {
3214
+ return flattenedConfiguredAuthMethods;
3215
+ }
3216
+ var restrictedAuthMethodsInUiConfig = flattenedConfiguredAuthMethods.filter(function (authMethod) {
3217
+ return restrictedAuthMethods.has(authMethod);
3218
+ });
3219
+ if (restrictedAuthMethodsInUiConfig.length > 0 || !hasPrimaryAuthMethods) {
3220
+ return restrictedAuthMethodsInUiConfig;
3221
+ }
3222
+ if (((_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods) === 'RESTRICTED') {
3223
+ return flattenConfigToAuthMethods(allProducts, allOauthProviders).filter(function (authMethod) {
3224
+ return restrictedAuthMethods.has(authMethod);
3225
+ });
3226
+ }
3227
+ return ['magic_link'];
3228
+ }, [flattenedConfiguredAuthMethods, hasPrimaryAuthMethods, restrictedAuthMethods, (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods]);
3229
+ var products = extractErrorMessage.F(function () {
3230
+ return _toConsumableArray(new Set(authMethodsToShow.map(authMethodToProduct).filter(extractErrorMessage.isTruthy)));
3231
+ }, [authMethodsToShow]);
3232
+ var oauthProviderSettings = extractErrorMessage.F(function () {
3233
+ return authMethodsToShow.map(function (authMethod) {
3234
+ var _a;
3235
+ var provider = oauthMethodToOauthProvider(authMethod);
3236
+ if (provider) {
3237
+ return (_a = oauthProviderConfigs.find(function (oauthProvider) {
3238
+ return oauthProvider.type === provider;
3239
+ })) !== null && _a !== void 0 ? _a : provider;
3240
+ }
3241
+ }).filter(extractErrorMessage.isTruthy);
3242
+ }, [authMethodsToShow, oauthProviderConfigs]);
3243
+ return {
3244
+ products: products,
3245
+ oauthProviderSettings: oauthProviderSettings
3246
+ };
3247
+ };
2982
3248
  var getProviderInfo = function getProviderInfo(provider) {
2983
3249
  switch (provider) {
2984
3250
  case internal.B2BOAuthProviders.Google:
2985
3251
  return {
2986
3252
  providerTypeTitle: 'Google',
2987
- allowedAuthMethod: 'google_oauth',
2988
3253
  icon: /*#__PURE__*/extractErrorMessage.y(GoogleIcon, null)
2989
3254
  };
2990
3255
  case internal.B2BOAuthProviders.Microsoft:
2991
3256
  return {
2992
3257
  providerTypeTitle: 'Microsoft',
2993
- allowedAuthMethod: 'microsoft_oauth',
2994
3258
  icon: /*#__PURE__*/extractErrorMessage.y(MicrosoftIcon, null)
2995
3259
  };
3260
+ case internal.B2BOAuthProviders.HubSpot:
3261
+ return {
3262
+ providerTypeTitle: 'HubSpot',
3263
+ icon: /*#__PURE__*/extractErrorMessage.y(HubSpotIcon, null)
3264
+ };
3265
+ case internal.B2BOAuthProviders.Slack:
3266
+ return {
3267
+ providerTypeTitle: 'Slack',
3268
+ icon: /*#__PURE__*/extractErrorMessage.y(SlackIcon, null)
3269
+ };
2996
3270
  default:
2997
3271
  return {
2998
3272
  providerTypeTitle: '',
2999
- allowedAuthMethod: '',
3000
3273
  icon: /*#__PURE__*/extractErrorMessage.y(extractErrorMessage.g, null)
3001
3274
  };
3002
3275
  }
@@ -3008,57 +3281,53 @@ var getCustomScopesForProvider = function getCustomScopesForProvider(oauthProvid
3008
3281
  }
3009
3282
  return currentCustomScopes;
3010
3283
  };
3011
- var getProviderParamsForProvider = function getProviderParamsForProvider(oauthProvider, oauthOptionsProviderParams) {
3284
+ var getProviderParamsForProvider = function getProviderParamsForProvider(oauthProvider, oauthOptionsProviderParams, email) {
3012
3285
  var currentProviderParams = oauthProvider.providerParams;
3013
3286
  if (Object.keys(currentProviderParams).length == 0) {
3014
- currentProviderParams = oauthOptionsProviderParams;
3287
+ currentProviderParams = oauthOptionsProviderParams !== null && oauthOptionsProviderParams !== void 0 ? oauthOptionsProviderParams : {};
3288
+ }
3289
+ if (email && (oauthProvider.type === internal.B2BOAuthProviders.Google || oauthProvider.type === internal.B2BOAuthProviders.Microsoft) && !('login_hint' in currentProviderParams)) {
3290
+ currentProviderParams = Object.assign(Object.assign({}, currentProviderParams), {
3291
+ login_hint: email
3292
+ });
3015
3293
  }
3016
3294
  return currentProviderParams;
3017
3295
  };
3018
3296
  var OAuthButtons = function OAuthButtons() {
3019
- var _a, _b;
3297
+ var _a;
3298
+ var _useGlobalReducer25 = useGlobalReducer(),
3299
+ _useGlobalReducer26 = _slicedToArray(_useGlobalReducer25, 1),
3300
+ state = _useGlobalReducer26[0];
3301
+ var _useEffectiveAuthConf = useEffectiveAuthConfig(),
3302
+ oauthProviderSettings = _useEffectiveAuthConf.oauthProviderSettings;
3020
3303
  var config = useConfig();
3021
- var _useGlobalReducer21 = useGlobalReducer(),
3022
- _useGlobalReducer22 = _slicedToArray(_useGlobalReducer21, 1),
3023
- state = _useGlobalReducer22[0];
3024
- if (!config.oauthOptions) return /*#__PURE__*/extractErrorMessage.y(extractErrorMessage.g, null);
3025
- var _config$oauthOptions = config.oauthOptions,
3026
- providers = _config$oauthOptions.providers,
3027
- loginRedirectURL = _config$oauthOptions.loginRedirectURL,
3028
- signupRedirectURL = _config$oauthOptions.signupRedirectURL,
3029
- discoveryRedirectURL = _config$oauthOptions.discoveryRedirectURL,
3030
- customScopes = _config$oauthOptions.customScopes,
3031
- providerParams = _config$oauthOptions.providerParams;
3032
- var allowedAuthMethods = [];
3033
- if (state.flowState.organization && state.flowState.organization.auth_methods === 'RESTRICTED') {
3034
- allowedAuthMethods = (_b = (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.allowed_auth_methods) !== null && _b !== void 0 ? _b : [];
3035
- }
3036
- var mappedProviders = providers.map(function (provider) {
3304
+ var _ref56 = (_a = config.oauthOptions) !== null && _a !== void 0 ? _a : {},
3305
+ loginRedirectURL = _ref56.loginRedirectURL,
3306
+ signupRedirectURL = _ref56.signupRedirectURL,
3307
+ discoveryRedirectURL = _ref56.discoveryRedirectURL,
3308
+ customScopes = _ref56.customScopes,
3309
+ providerParams = _ref56.providerParams;
3310
+ var mappedProviders = oauthProviderSettings.map(function (provider) {
3037
3311
  var oauthProvider = getParamsFromB2BOAuthProviderConfig(provider);
3038
3312
  var _getProviderInfo = getProviderInfo(oauthProvider.type),
3039
3313
  icon = _getProviderInfo.icon,
3040
- providerTypeTitle = _getProviderInfo.providerTypeTitle,
3041
- allowedAuthMethod = _getProviderInfo.allowedAuthMethod;
3042
- if (!state.flowState.organization || state.flowState.organization.auth_methods === 'ALL_ALLOWED' || allowedAuthMethods.includes(allowedAuthMethod)) {
3043
- if (oauthProvider.oneTap) {
3044
- return /*#__PURE__*/extractErrorMessage.y(B2BGoogleOneTap, {
3045
- key: "oauth-".concat(oauthProvider.type)
3046
- });
3047
- }
3048
- return /*#__PURE__*/extractErrorMessage.y(OAuthB2BButton, {
3049
- key: "oauth-".concat(oauthProvider.type),
3050
- providerType: oauthProvider.type,
3051
- icon: icon,
3052
- providerTypeTitle: providerTypeTitle,
3053
- loginRedirectUrl: loginRedirectURL,
3054
- signupRedirectUrl: signupRedirectURL,
3055
- discoveryRedirectUrl: discoveryRedirectURL,
3056
- customScopes: getCustomScopesForProvider(oauthProvider, customScopes),
3057
- providerParams: getProviderParamsForProvider(oauthProvider, providerParams)
3314
+ providerTypeTitle = _getProviderInfo.providerTypeTitle;
3315
+ if (oauthProvider.oneTap) {
3316
+ return /*#__PURE__*/extractErrorMessage.y(B2BGoogleOneTap, {
3317
+ key: "oauth-".concat(oauthProvider.type)
3058
3318
  });
3059
3319
  }
3060
- console.error("Provider ".concat(provider, " is not an `allowed_auth_method` for this organization. Please update your organization settings."));
3061
- return null;
3320
+ return /*#__PURE__*/extractErrorMessage.y(OAuthB2BButton, {
3321
+ key: "oauth-".concat(oauthProvider.type),
3322
+ providerType: oauthProvider.type,
3323
+ icon: icon,
3324
+ providerTypeTitle: providerTypeTitle,
3325
+ loginRedirectUrl: loginRedirectURL,
3326
+ signupRedirectUrl: signupRedirectURL,
3327
+ discoveryRedirectUrl: discoveryRedirectURL,
3328
+ customScopes: getCustomScopesForProvider(oauthProvider, customScopes),
3329
+ providerParams: getProviderParamsForProvider(oauthProvider, providerParams, state.primary.email)
3330
+ });
3062
3331
  });
3063
3332
  return /*#__PURE__*/extractErrorMessage.y(Flex, {
3064
3333
  direction: "column",
@@ -3068,9 +3337,9 @@ var OAuthButtons = function OAuthButtons() {
3068
3337
  };
3069
3338
  var UsePasswordText = extractErrorMessage.He(Text)(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n font-weight: bold !important;\n cursor: pointer;\n"])));
3070
3339
  var PasswordUseButton = function PasswordUseButton() {
3071
- var _useGlobalReducer23 = useGlobalReducer(),
3072
- _useGlobalReducer24 = _slicedToArray(_useGlobalReducer23, 2),
3073
- dispatch = _useGlobalReducer24[1];
3340
+ var _useGlobalReducer27 = useGlobalReducer(),
3341
+ _useGlobalReducer28 = _slicedToArray(_useGlobalReducer27, 2),
3342
+ dispatch = _useGlobalReducer28[1];
3074
3343
  var handleUsePassword = function handleUsePassword() {
3075
3344
  dispatch({
3076
3345
  type: 'transition',
@@ -3132,9 +3401,9 @@ var generateProductComponentsOrdering = function generateProductComponentsOrderi
3132
3401
  var Container$1 = extractErrorMessage.He(Flex)(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n > * + * {\n margin-top: 24px;\n }\n"])));
3133
3402
  var LogoImage$1 = extractErrorMessage.He.img(_templateObject26 || (_templateObject26 = _taggedTemplateLiteral(["\n max-height: 50px;\n max-width: 100px;\n"])));
3134
3403
  var Header = extractErrorMessage.He(Text)(_templateObject27 || (_templateObject27 = _taggedTemplateLiteral(["\n text-align: center;\n"])));
3135
- var Logo$1 = function Logo$1(_ref52) {
3136
- var orgLogo = _ref52.orgLogo,
3137
- appLogo = _ref52.appLogo;
3404
+ var Logo$1 = function Logo$1(_ref57) {
3405
+ var orgLogo = _ref57.orgLogo,
3406
+ appLogo = _ref57.appLogo;
3138
3407
  if (orgLogo !== '' && appLogo !== '') return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null);
3139
3408
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3140
3409
  justifyContent: "center",
@@ -3145,8 +3414,8 @@ var Logo$1 = function Logo$1(_ref52) {
3145
3414
  src: appLogo
3146
3415
  }));
3147
3416
  };
3148
- var ProductComponents = function ProductComponents(_ref53) {
3149
- var components = _ref53.components;
3417
+ var ProductComponents = function ProductComponents(_ref58) {
3418
+ var components = _ref58.components;
3150
3419
  var renderedComponents = components.map(function (component) {
3151
3420
  switch (component) {
3152
3421
  case Component.MagicLinkEmailForm:
@@ -3188,28 +3457,19 @@ var ProductComponents = function ProductComponents(_ref53) {
3188
3457
  return /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null, renderedComponents);
3189
3458
  };
3190
3459
  var MainScreen = function MainScreen() {
3191
- var _a, _b, _c, _d, _e, _f, _g;
3460
+ var _a, _b, _c, _d;
3192
3461
  var _extractErrorMessage$28 = extractErrorMessage.Ze(),
3193
3462
  displayHeader = _extractErrorMessage$28.displayHeader,
3194
3463
  logo = _extractErrorMessage$28.logo;
3195
- var config = useConfig();
3196
- var _useGlobalReducer25 = useGlobalReducer(),
3197
- _useGlobalReducer26 = _slicedToArray(_useGlobalReducer25, 1),
3198
- state = _useGlobalReducer26[0];
3199
- var allowedProducts = [];
3200
- var products = config.products;
3201
- if (((_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.auth_methods) === 'RESTRICTED') {
3202
- var allowedAuthMethods = (_c = (_b = state.flowState.organization) === null || _b === void 0 ? void 0 : _b.allowed_auth_methods) !== null && _c !== void 0 ? _c : [];
3203
- allowedAuthMethods.forEach(function (authMethod) {
3204
- if (authMethod === 'sso') allowedProducts.push(internal.B2BProducts.sso);
3205
- if (authMethod === 'magic_link') allowedProducts.push(internal.B2BProducts.emailMagicLinks);
3206
- if (authMethod === 'password') allowedProducts.push(internal.B2BProducts.passwords);
3207
- if (authMethod === 'google_oauth' || authMethod === 'microsoft_oauth') allowedProducts.push(internal.B2BProducts.oauth);
3208
- });
3209
- products = products.filter(function (product) {
3210
- return allowedProducts.includes(product);
3211
- });
3212
- }
3464
+ var _useGlobalReducer29 = useGlobalReducer(),
3465
+ _useGlobalReducer30 = _slicedToArray(_useGlobalReducer29, 1),
3466
+ state = _useGlobalReducer30[0];
3467
+ var _state$primary = state.primary,
3468
+ primaryAuthMethods = _state$primary.primaryAuthMethods,
3469
+ email = _state$primary.email,
3470
+ emailVerified = _state$primary.emailVerified;
3471
+ var _useEffectiveAuthConf2 = useEffectiveAuthConfig(),
3472
+ products = _useEffectiveAuthConf2.products;
3213
3473
  var ProductComponentsOrdering = generateProductComponentsOrdering(products, state.flowState);
3214
3474
  var title;
3215
3475
  switch (state.flowState.type) {
@@ -3220,19 +3480,26 @@ var MainScreen = function MainScreen() {
3220
3480
  title = '';
3221
3481
  break;
3222
3482
  default:
3223
- title = "Continue to ".concat((_e = (_d = state.flowState.organization) === null || _d === void 0 ? void 0 : _d.organization_name) !== null && _e !== void 0 ? _e : '...');
3483
+ title = "Continue to ".concat((_b = (_a = state.flowState.organization) === null || _a === void 0 ? void 0 : _a.organization_name) !== null && _b !== void 0 ? _b : '...');
3224
3484
  break;
3225
3485
  }
3486
+ var showVerifyEmailCopy = email && emailVerified === false && primaryAuthMethods;
3226
3487
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Container$1, {
3227
3488
  direction: "column"
3228
3489
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Logo$1, {
3229
3490
  appLogo: logo.logoImageUrl,
3230
- orgLogo: (_g = (_f = state.flowState.organization) === null || _f === void 0 ? void 0 : _f.organization_logo_url) !== null && _g !== void 0 ? _g : ''
3231
- }), displayHeader && title ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3491
+ orgLogo: (_d = (_c = state.flowState.organization) === null || _c === void 0 ? void 0 : _c.organization_logo_url) !== null && _d !== void 0 ? _d : ''
3492
+ }), displayHeader && (showVerifyEmailCopy ? ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3493
+ justifyContent: "center",
3494
+ direction: "column",
3495
+ gap: 24
3496
+ }, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, {
3497
+ size: "header"
3498
+ }, "Verify your email"), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Confirm your email address with one of the following:"))) : title && ( /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3232
3499
  justifyContent: "center"
3233
3500
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Header, {
3234
3501
  size: "header"
3235
- }, title))) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(extractErrorMessage.wn.Fragment, null)), /*#__PURE__*/extractErrorMessage.wn.createElement(ProductComponents, {
3502
+ }, title)))), /*#__PURE__*/extractErrorMessage.wn.createElement(ProductComponents, {
3236
3503
  components: ProductComponentsOrdering
3237
3504
  }));
3238
3505
  };
@@ -3339,10 +3606,10 @@ var inboxLinks$1 = function inboxLinks$1(emailDomain) {
3339
3606
  var Link$1 = extractErrorMessage.He.a(_templateObject28 || (_templateObject28 = _taggedTemplateLiteral(["\n all: unset;\n cursor: pointer;\n\n &:hover {\n text-decoration: underline;\n text-decoration-color: ", ";\n }\n"])), function (props) {
3340
3607
  return props.theme.colors.primary;
3341
3608
  });
3342
- var EmailProviderLink$1 = function EmailProviderLink$1(_ref54) {
3343
- var label = _ref54.label,
3344
- href = _ref54.href,
3345
- Icon = _ref54.Icon;
3609
+ var EmailProviderLink$1 = function EmailProviderLink$1(_ref59) {
3610
+ var label = _ref59.label,
3611
+ href = _ref59.href,
3612
+ Icon = _ref59.Icon;
3346
3613
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3347
3614
  gap: 4
3348
3615
  }, Icon, /*#__PURE__*/extractErrorMessage.wn.createElement(Link$1, {
@@ -3351,10 +3618,10 @@ var EmailProviderLink$1 = function EmailProviderLink$1(_ref54) {
3351
3618
  rel: "noopener noreferrer"
3352
3619
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Open in ", label)));
3353
3620
  };
3354
- var EmailConfirmation$1 = function EmailConfirmation$1(_ref55) {
3355
- var emailDomain = _ref55.emailDomain,
3356
- reset = _ref55.reset,
3357
- email = _ref55.email;
3621
+ var EmailConfirmation$1 = function EmailConfirmation$1(_ref60) {
3622
+ var emailDomain = _ref60.emailDomain,
3623
+ reset = _ref60.reset,
3624
+ email = _ref60.email;
3358
3625
  var _inboxLinks$ = inboxLinks$1(emailDomain),
3359
3626
  GMAIL = _inboxLinks$.GMAIL,
3360
3627
  YAHOO = _inboxLinks$.YAHOO,
@@ -3400,8 +3667,8 @@ var useEmailDomain$1 = function useEmailDomain$1() {
3400
3667
  emailDomains = _extractErrorMessage$30[0],
3401
3668
  setEmailDomains = _extractErrorMessage$30[1];
3402
3669
  extractErrorMessage.p(function () {
3403
- internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref56) {
3404
- var emailDomains = _ref56.emailDomains;
3670
+ internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref61) {
3671
+ var emailDomains = _ref61.emailDomains;
3405
3672
  setEmailDomains(emailDomains);
3406
3673
  });
3407
3674
  }, [stytch]);
@@ -3414,10 +3681,10 @@ var useEmailDomain$1 = function useEmailDomain$1() {
3414
3681
  return null;
3415
3682
  };
3416
3683
  var EmailConfirmation = function EmailConfirmation() {
3417
- var _useGlobalReducer27 = useGlobalReducer(),
3418
- _useGlobalReducer28 = _slicedToArray(_useGlobalReducer27, 2),
3419
- state = _useGlobalReducer28[0],
3420
- dispatch = _useGlobalReducer28[1];
3684
+ var _useGlobalReducer31 = useGlobalReducer(),
3685
+ _useGlobalReducer32 = _slicedToArray(_useGlobalReducer31, 2),
3686
+ state = _useGlobalReducer32[0],
3687
+ dispatch = _useGlobalReducer32[1];
3421
3688
  var emailDomain = useEmailDomain$1();
3422
3689
  var reset = function reset() {
3423
3690
  dispatch({
@@ -3457,23 +3724,26 @@ var LoadingScreen = function LoadingScreen() {
3457
3724
  thickness: 8
3458
3725
  }));
3459
3726
  };
3460
- var OrganizationsContainer = extractErrorMessage.He(Flex)(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n border: ", ";\n border-radius: ", ";\n > div + div {\n border-top: ", ";\n }\n"])), function (_ref57) {
3461
- var theme = _ref57.theme;
3727
+ var isJoinViaJitType = function isJoinViaJitType(type) {
3728
+ return type === 'eligible_to_join_by_email_domain' || type === 'eligible_to_join_by_oauth_tenant';
3729
+ };
3730
+ var OrganizationsContainer = extractErrorMessage.He(Flex)(_templateObject29 || (_templateObject29 = _taggedTemplateLiteral(["\n border: ", ";\n border-radius: ", ";\n > div + div {\n border-top: ", ";\n }\n"])), function (_ref62) {
3731
+ var theme = _ref62.theme;
3462
3732
  return theme.container.border;
3463
- }, function (_ref58) {
3464
- var theme = _ref58.theme;
3733
+ }, function (_ref63) {
3734
+ var theme = _ref63.theme;
3465
3735
  return theme.container.borderRadius;
3466
- }, function (_ref59) {
3467
- var theme = _ref59.theme;
3736
+ }, function (_ref64) {
3737
+ var theme = _ref64.theme;
3468
3738
  return theme.container.border;
3469
3739
  });
3470
3740
  var OrganizationsRow = extractErrorMessage.He(Flex)(_templateObject30 || (_templateObject30 = _taggedTemplateLiteral(["\n cursor: pointer;\n"])));
3471
3741
  var LogoImage = extractErrorMessage.He.img(_templateObject31 || (_templateObject31 = _taggedTemplateLiteral(["\n height: 40px;\n width: 40px;\n border-radius: 4px;\n"])));
3472
- var LogoText = extractErrorMessage.He(Flex)(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n height: 40px;\n width: 40px;\n background-color: ", ";\n color: ", ";\n border-radius: 4px;\n\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 25px;\n"])), function (_ref60) {
3473
- var theme = _ref60.theme;
3742
+ var LogoText = extractErrorMessage.He(Flex)(_templateObject32 || (_templateObject32 = _taggedTemplateLiteral(["\n height: 40px;\n width: 40px;\n background-color: ", ";\n color: ", ";\n border-radius: 4px;\n\n font-style: normal;\n font-weight: 400;\n font-size: 18px;\n line-height: 25px;\n"])), function (_ref65) {
3743
+ var theme = _ref65.theme;
3474
3744
  return theme.buttons.primary.backgroundColor;
3475
- }, function (_ref61) {
3476
- var theme = _ref61.theme;
3745
+ }, function (_ref66) {
3746
+ var theme = _ref66.theme;
3477
3747
  return theme.buttons.primary.textColor;
3478
3748
  });
3479
3749
  var RightArrowSVG = function RightArrowSVG() {
@@ -3488,9 +3758,9 @@ var RightArrowSVG = function RightArrowSVG() {
3488
3758
  fill: "#19303D"
3489
3759
  }));
3490
3760
  };
3491
- var Logo = function Logo(_ref62) {
3492
- var name = _ref62.name,
3493
- logo = _ref62.logo;
3761
+ var Logo = function Logo(_ref67) {
3762
+ var name = _ref67.name,
3763
+ logo = _ref67.logo;
3494
3764
  if (logo !== '') {
3495
3765
  return /*#__PURE__*/extractErrorMessage.y(LogoImage, {
3496
3766
  src: logo
@@ -3501,17 +3771,17 @@ var Logo = function Logo(_ref62) {
3501
3771
  justifyContent: "center"
3502
3772
  }, name[0]);
3503
3773
  };
3504
- var ArrowText = function ArrowText(_ref63) {
3505
- var type = _ref63.type;
3506
- if (type === 'eligible_to_join_by_email_domain' || type === 'pending_member') return /*#__PURE__*/extractErrorMessage.y(Text, null, "Join");
3774
+ var ArrowText = function ArrowText(_ref68) {
3775
+ var type = _ref68.type;
3776
+ if (isJoinViaJitType(type) || type === 'pending_member') return /*#__PURE__*/extractErrorMessage.y(Text, null, "Join");
3507
3777
  if (type === 'invited_member') return /*#__PURE__*/extractErrorMessage.y(Text, null, "Accept Invite");
3508
3778
  return /*#__PURE__*/extractErrorMessage.y(extractErrorMessage.g, null);
3509
3779
  };
3510
3780
  var DiscoverNoOrganizations = function DiscoverNoOrganizations() {
3511
- var _useGlobalReducer29 = useGlobalReducer(),
3512
- _useGlobalReducer30 = _slicedToArray(_useGlobalReducer29, 2),
3513
- state = _useGlobalReducer30[0],
3514
- dispatch = _useGlobalReducer30[1];
3781
+ var _useGlobalReducer33 = useGlobalReducer(),
3782
+ _useGlobalReducer34 = _slicedToArray(_useGlobalReducer33, 2),
3783
+ state = _useGlobalReducer34[0],
3784
+ dispatch = _useGlobalReducer34[1];
3515
3785
  var stytchClient = useStytch();
3516
3786
  var config = useConfig();
3517
3787
  var _useBootstrap = useBootstrap(),
@@ -3578,16 +3848,16 @@ var shouldAllowDirectLoginToOrganization = function shouldAllowDirectLoginToOrga
3578
3848
  return org.membership.type === 'active_member';
3579
3849
  });
3580
3850
  var hasBlockingConditions = organizations.some(function (org) {
3581
- return (org.membership.type === 'pending_member' || org.membership.type === 'invited_member') && !config.ignoreInvites || org.membership.type === 'eligible_to_join_by_email_domain' && !config.ignoreJitProvisioning;
3851
+ return (org.membership.type === 'pending_member' || org.membership.type === 'invited_member') && !config.ignoreInvites || isJoinViaJitType(org.membership.type) && !config.ignoreJitProvisioning;
3582
3852
  });
3583
3853
  return activeOrganizations.length === 1 && !hasBlockingConditions ? activeOrganizations[0] : null;
3584
3854
  };
3585
3855
  var Discovery = function Discovery() {
3586
3856
  var _a;
3587
- var _useGlobalReducer31 = useGlobalReducer(),
3588
- _useGlobalReducer32 = _slicedToArray(_useGlobalReducer31, 2),
3589
- state = _useGlobalReducer32[0],
3590
- dispatch = _useGlobalReducer32[1];
3857
+ var _useGlobalReducer35 = useGlobalReducer(),
3858
+ _useGlobalReducer36 = _slicedToArray(_useGlobalReducer35, 2),
3859
+ state = _useGlobalReducer36[0],
3860
+ dispatch = _useGlobalReducer36[1];
3591
3861
  var stytchClient = useStytch();
3592
3862
  var config = useConfig();
3593
3863
  var shouldDirectLoginConfigEnabled = !!((_a = config.directLoginForSingleMembership) === null || _a === void 0 ? void 0 : _a.status);
@@ -3600,24 +3870,15 @@ var Discovery = function Discovery() {
3600
3870
  }
3601
3871
  }, [shouldDirectLoginConfigEnabled, state.formState.discoveryState.discoveredOrganizations, config.directLoginForSingleMembership]);
3602
3872
  var handleDiscoveryOrganizationStart = function handleDiscoveryOrganizationStart(discoveredOrganization) {
3603
- var _a;
3604
3873
  var organization = discoveredOrganization.organization;
3605
- var email = (_a = discoveredOrganization.membership.member) === null || _a === void 0 ? void 0 : _a.email_address;
3606
3874
  if (discoveredOrganization.primary_required) {
3607
- if (organization.allowed_auth_methods && organization.allowed_auth_methods.length === 1 && organization.allowed_auth_methods[0] === 'sso' && organization.sso_default_connection_id) {
3875
+ var allowedAuthMethods = discoveredOrganization.primary_required.allowed_auth_methods;
3876
+ if (allowedAuthMethods && allowedAuthMethods.length === 1 && allowedAuthMethods[0] === 'sso' && organization.sso_default_connection_id) {
3608
3877
  startSso(organization.sso_default_connection_id);
3609
3878
  } else {
3610
3879
  dispatch({
3611
- type: 'set_organization',
3612
- organization: organization
3613
- });
3614
- dispatch({
3615
- type: 'set_password_state',
3616
- email: email !== null && email !== void 0 ? email : ''
3617
- });
3618
- dispatch({
3619
- type: 'transition',
3620
- screen: AppScreens$1.Main
3880
+ type: 'select_discovered_organization',
3881
+ discoveredOrganization: discoveredOrganization
3621
3882
  });
3622
3883
  }
3623
3884
  } else {
@@ -3631,8 +3892,8 @@ var Discovery = function Discovery() {
3631
3892
  connection_id: connectionId
3632
3893
  });
3633
3894
  }, [stytchClient]);
3634
- var _useMutate5 = useMutate("stytch.discovery.intermediateSessions.exchange", function (_, _ref64) {
3635
- var organizationId = _ref64.arg.organizationId;
3895
+ var _useMutate5 = useMutate("stytch.discovery.intermediateSessions.exchange", function (_, _ref69) {
3896
+ var organizationId = _ref69.arg.organizationId;
3636
3897
  return stytchClient.discovery.intermediateSessions.exchange({
3637
3898
  organization_id: organizationId,
3638
3899
  session_duration_minutes: config.sessionOptions.sessionDurationMinutes
@@ -3857,9 +4118,9 @@ var StyledButton = extractErrorMessage.He.button(_templateObject33 || (_template
3857
4118
  });
3858
4119
  var MenuText = extractErrorMessage.He.div(_templateObject34 || (_templateObject34 = _taggedTemplateLiteral(["\n flex: 1 1 auto;\n"])));
3859
4120
  var ChevronContainer = extractErrorMessage.He.span(_templateObject35 || (_templateObject35 = _taggedTemplateLiteral(["\n flex: 0 0 auto;\n"])));
3860
- var MenuButton = function MenuButton(_ref65) {
3861
- var children = _ref65.children,
3862
- onClick = _ref65.onClick;
4121
+ var MenuButton = function MenuButton(_ref70) {
4122
+ var children = _ref70.children,
4123
+ onClick = _ref70.onClick;
3863
4124
  return /*#__PURE__*/extractErrorMessage.wn.createElement(StyledButton, {
3864
4125
  type: "button",
3865
4126
  onClick: onClick
@@ -3876,10 +4137,10 @@ var MFAEnrollmentSelectionScreen = function MFAEnrollmentSelectionScreen() {
3876
4137
  var _useConfig = useConfig(),
3877
4138
  mfaProductInclude = _useConfig.mfaProductInclude,
3878
4139
  mfaProductOrder = _useConfig.mfaProductOrder;
3879
- var _useGlobalReducer33 = useGlobalReducer(),
3880
- _useGlobalReducer34 = _slicedToArray(_useGlobalReducer33, 2),
3881
- state = _useGlobalReducer34[0],
3882
- dispatch = _useGlobalReducer34[1];
4140
+ var _useGlobalReducer37 = useGlobalReducer(),
4141
+ _useGlobalReducer38 = _slicedToArray(_useGlobalReducer37, 2),
4142
+ state = _useGlobalReducer38[0],
4143
+ dispatch = _useGlobalReducer38[1];
3883
4144
  var organizationMfaOptionsSupported = state.mfa.primaryInfo.organizationMfaOptionsSupported;
3884
4145
  var handleChooseMethod = function handleChooseMethod(method) {
3885
4146
  dispatch({
@@ -3918,9 +4179,9 @@ var MFAEnrollmentSelectionScreen = function MFAEnrollmentSelectionScreen() {
3918
4179
  size: "header"
3919
4180
  }, "Set up Multi-Factor Authentication"), /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Your organization requires an additional form of verification to make your account more secure."), /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3920
4181
  direction: "column"
3921
- }, displayOptions.map(function (_ref66) {
3922
- var option = _ref66.option,
3923
- label = _ref66.label;
4182
+ }, displayOptions.map(function (_ref71) {
4183
+ var option = _ref71.option,
4184
+ label = _ref71.label;
3924
4185
  return /*#__PURE__*/extractErrorMessage.wn.createElement(MenuButton, {
3925
4186
  key: option,
3926
4187
  onClick: function onClick() {
@@ -3945,10 +4206,10 @@ var inboxLinks = function inboxLinks(emailDomain) {
3945
4206
  var Link = extractErrorMessage.He.a(_templateObject36 || (_templateObject36 = _taggedTemplateLiteral(["\n all: unset;\n cursor: pointer;\n\n &:hover {\n text-decoration: underline;\n text-decoration-color: ", ";\n }\n"])), function (props) {
3946
4207
  return props.theme.colors.primary;
3947
4208
  });
3948
- var EmailProviderLink = function EmailProviderLink(_ref67) {
3949
- var label = _ref67.label,
3950
- href = _ref67.href,
3951
- Icon = _ref67.Icon;
4209
+ var EmailProviderLink = function EmailProviderLink(_ref72) {
4210
+ var label = _ref72.label,
4211
+ href = _ref72.href,
4212
+ Icon = _ref72.Icon;
3952
4213
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3953
4214
  gap: 4
3954
4215
  }, Icon, /*#__PURE__*/extractErrorMessage.wn.createElement(Link, {
@@ -3957,16 +4218,16 @@ var EmailProviderLink = function EmailProviderLink(_ref67) {
3957
4218
  rel: "noopener noreferrer"
3958
4219
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Text, null, "Open in ", label)));
3959
4220
  };
3960
- var VerifyEmailConfirmation = function VerifyEmailConfirmation(_ref68) {
3961
- var emailDomain = _ref68.emailDomain,
3962
- reset = _ref68.reset,
3963
- email = _ref68.email;
4221
+ var VerifyEmailConfirmation = function VerifyEmailConfirmation(_ref73) {
4222
+ var emailDomain = _ref73.emailDomain,
4223
+ reset = _ref73.reset,
4224
+ email = _ref73.email;
3964
4225
  var _inboxLinks = inboxLinks(emailDomain),
3965
4226
  GMAIL = _inboxLinks.GMAIL,
3966
4227
  OUTLOOK = _inboxLinks.OUTLOOK;
3967
- var _useGlobalReducer35 = useGlobalReducer(),
3968
- _useGlobalReducer36 = _slicedToArray(_useGlobalReducer35, 2),
3969
- dispatch = _useGlobalReducer36[1];
4228
+ var _useGlobalReducer39 = useGlobalReducer(),
4229
+ _useGlobalReducer40 = _slicedToArray(_useGlobalReducer39, 2),
4230
+ dispatch = _useGlobalReducer40[1];
3970
4231
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
3971
4232
  direction: "column",
3972
4233
  gap: 24
@@ -4015,8 +4276,8 @@ var useEmailDomain = function useEmailDomain() {
4015
4276
  emailDomains = _extractErrorMessage$32[0],
4016
4277
  setEmailDomains = _extractErrorMessage$32[1];
4017
4278
  extractErrorMessage.p(function () {
4018
- internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref69) {
4019
- var emailDomains = _ref69.emailDomains;
4279
+ internal.readB2BInternals(stytch).bootstrap.getAsync().then(function (_ref74) {
4280
+ var emailDomains = _ref74.emailDomains;
4020
4281
  setEmailDomains(emailDomains);
4021
4282
  });
4022
4283
  }, [stytch]);
@@ -4029,10 +4290,10 @@ var useEmailDomain = function useEmailDomain() {
4029
4290
  return null;
4030
4291
  };
4031
4292
  var PasswordResetConfirmation = function PasswordResetConfirmation() {
4032
- var _useGlobalReducer37 = useGlobalReducer(),
4033
- _useGlobalReducer38 = _slicedToArray(_useGlobalReducer37, 2),
4034
- state = _useGlobalReducer38[0],
4035
- dispatch = _useGlobalReducer38[1];
4293
+ var _useGlobalReducer41 = useGlobalReducer(),
4294
+ _useGlobalReducer42 = _slicedToArray(_useGlobalReducer41, 2),
4295
+ state = _useGlobalReducer42[0],
4296
+ dispatch = _useGlobalReducer42[1];
4036
4297
  var emailDomain = useEmailDomain();
4037
4298
  var reset = function reset() {
4038
4299
  dispatch({
@@ -4053,8 +4314,8 @@ var PasswordResetConfirmation = function PasswordResetConfirmation() {
4053
4314
  var Block = extractErrorMessage.He.div(_templateObject37 || (_templateObject37 = _taggedTemplateLiteral(["\n height: 4px;\n width: 25%;\n background-color: ", ";\n"])), function (props) {
4054
4315
  return props.$bgColor;
4055
4316
  });
4056
- var PasswordStrengthCheck = function PasswordStrengthCheck(_ref70) {
4057
- var score = _ref70.score;
4317
+ var PasswordStrengthCheck = function PasswordStrengthCheck(_ref75) {
4318
+ var score = _ref75.score;
4058
4319
  var blocks = [];
4059
4320
  switch (score) {
4060
4321
  case 0:
@@ -4155,9 +4416,9 @@ var Form = extractErrorMessage.He.form(_templateObject38 || (_templateObject38 =
4155
4416
  var PasswordResetForm = function PasswordResetForm() {
4156
4417
  var stytchClient = useStytch();
4157
4418
  var config = useConfig();
4158
- var _useGlobalReducer39 = useGlobalReducer(),
4159
- _useGlobalReducer40 = _slicedToArray(_useGlobalReducer39, 2),
4160
- dispatch = _useGlobalReducer40[1];
4419
+ var _useGlobalReducer43 = useGlobalReducer(),
4420
+ _useGlobalReducer44 = _slicedToArray(_useGlobalReducer43, 2),
4421
+ dispatch = _useGlobalReducer44[1];
4161
4422
  var onEvent = useEventCallback();
4162
4423
  var onError = useErrorCallback();
4163
4424
  var _extractErrorMessage$33 = extractErrorMessage.h(''),
@@ -4214,13 +4475,13 @@ var PasswordResetForm = function PasswordResetForm() {
4214
4475
  return internal.debounce(function (password) {
4215
4476
  return stytchClient.passwords.strengthCheck({
4216
4477
  password: password
4217
- }).then(function (_ref71) {
4218
- var score = _ref71.score,
4219
- valid_password = _ref71.valid_password,
4220
- zxcvbn_feedback = _ref71.zxcvbn_feedback,
4221
- luds_feedback = _ref71.luds_feedback,
4222
- strength_policy = _ref71.strength_policy,
4223
- breached_password = _ref71.breached_password;
4478
+ }).then(function (_ref76) {
4479
+ var score = _ref76.score,
4480
+ valid_password = _ref76.valid_password,
4481
+ zxcvbn_feedback = _ref76.zxcvbn_feedback,
4482
+ luds_feedback = _ref76.luds_feedback,
4483
+ strength_policy = _ref76.strength_policy,
4484
+ breached_password = _ref76.breached_password;
4224
4485
  setStrengthPolicy(strength_policy);
4225
4486
  setInvalidPassword(!valid_password);
4226
4487
  if (strength_policy === 'zxcvbn') {
@@ -4364,9 +4625,9 @@ var PasswordResetForm = function PasswordResetForm() {
4364
4625
  }))));
4365
4626
  };
4366
4627
  var PasswordSetNew = function PasswordSetNew() {
4367
- var _useGlobalReducer41 = useGlobalReducer(),
4368
- _useGlobalReducer42 = _slicedToArray(_useGlobalReducer41, 2),
4369
- dispatch = _useGlobalReducer42[1];
4628
+ var _useGlobalReducer45 = useGlobalReducer(),
4629
+ _useGlobalReducer46 = _slicedToArray(_useGlobalReducer45, 2),
4630
+ dispatch = _useGlobalReducer46[1];
4370
4631
  var onEvent = useEventCallback();
4371
4632
  var config = useConfig();
4372
4633
  var _usePasswordInput3 = usePasswordInput(),
@@ -4422,9 +4683,9 @@ var PasswordSetNew = function PasswordSetNew() {
4422
4683
  }, "Resend email"))));
4423
4684
  };
4424
4685
  var PasswordsForgotForm = function PasswordsForgotForm() {
4425
- var _useGlobalReducer43 = useGlobalReducer(),
4426
- _useGlobalReducer44 = _slicedToArray(_useGlobalReducer43, 2),
4427
- dispatch = _useGlobalReducer44[1];
4686
+ var _useGlobalReducer47 = useGlobalReducer(),
4687
+ _useGlobalReducer48 = _slicedToArray(_useGlobalReducer47, 2),
4688
+ dispatch = _useGlobalReducer48[1];
4428
4689
  var config = useConfig();
4429
4690
  var onEvent = useEventCallback();
4430
4691
  var passwordOptions = config.passwordOptions;
@@ -4455,8 +4716,8 @@ var PasswordsForgotForm = function PasswordsForgotForm() {
4455
4716
  case 4:
4456
4717
  setErrorMessage('');
4457
4718
  setIsSubmitting(true);
4458
- internal.readB2BInternals(stytch).searchManager.searchMember(email, organization.organization_id).then(function (_ref72) {
4459
- var member = _ref72.member;
4719
+ internal.readB2BInternals(stytch).searchManager.searchMember(email, organization.organization_id).then(function (_ref77) {
4720
+ var member = _ref77.member;
4460
4721
  var _a, _b, _c, _d;
4461
4722
  if (!(member === null || member === void 0 ? void 0 : member.member_password_id)) {
4462
4723
  handleNonMemberReset();
@@ -4536,10 +4797,10 @@ var RecoveryCodeEntryScreen = function RecoveryCodeEntryScreen() {
4536
4797
  var stytchClient = useStytch();
4537
4798
  var _useConfig2 = useConfig(),
4538
4799
  sessionDurationMinutes = _useConfig2.sessionOptions.sessionDurationMinutes;
4539
- var _useGlobalReducer45 = useGlobalReducer(),
4540
- _useGlobalReducer46 = _slicedToArray(_useGlobalReducer45, 2),
4541
- state = _useGlobalReducer46[0],
4542
- dispatch = _useGlobalReducer46[1];
4800
+ var _useGlobalReducer49 = useGlobalReducer(),
4801
+ _useGlobalReducer50 = _slicedToArray(_useGlobalReducer49, 2),
4802
+ state = _useGlobalReducer50[0],
4803
+ dispatch = _useGlobalReducer50[1];
4543
4804
  var _state$mfa$primaryInf = state.mfa.primaryInfo,
4544
4805
  memberId = _state$mfa$primaryInf.memberId,
4545
4806
  organizationId = _state$mfa$primaryInf.organizationId;
@@ -4547,12 +4808,12 @@ var RecoveryCodeEntryScreen = function RecoveryCodeEntryScreen() {
4547
4808
  _extractErrorMessage$58 = _slicedToArray(_extractErrorMessage$57, 2),
4548
4809
  recoveryCode = _extractErrorMessage$58[0],
4549
4810
  setRecoveryCode = _extractErrorMessage$58[1];
4550
- var _useMutate7 = useMutate('stytch.recoveryCodes.recover', function (_, _ref73) {
4551
- var _ref73$arg = _ref73.arg,
4552
- recoveryCode = _ref73$arg.recoveryCode,
4553
- memberId = _ref73$arg.memberId,
4554
- organizationId = _ref73$arg.organizationId,
4555
- sessionDurationMinutes = _ref73$arg.sessionDurationMinutes;
4811
+ var _useMutate7 = useMutate('stytch.recoveryCodes.recover', function (_, _ref78) {
4812
+ var _ref78$arg = _ref78.arg,
4813
+ recoveryCode = _ref78$arg.recoveryCode,
4814
+ memberId = _ref78$arg.memberId,
4815
+ organizationId = _ref78$arg.organizationId,
4816
+ sessionDurationMinutes = _ref78$arg.sessionDurationMinutes;
4556
4817
  return stytchClient.recoveryCodes.recover({
4557
4818
  recovery_code: recoveryCode,
4558
4819
  member_id: memberId,
@@ -4636,10 +4897,10 @@ var downloadFile = function downloadFile(content, filename) {
4636
4897
  URL.revokeObjectURL(url);
4637
4898
  };
4638
4899
  var RecoveryCodeSaveScreen = function RecoveryCodeSaveScreen() {
4639
- var _useGlobalReducer47 = useGlobalReducer(),
4640
- _useGlobalReducer48 = _slicedToArray(_useGlobalReducer47, 2),
4641
- state = _useGlobalReducer48[0],
4642
- dispatch = _useGlobalReducer48[1];
4900
+ var _useGlobalReducer51 = useGlobalReducer(),
4901
+ _useGlobalReducer52 = _slicedToArray(_useGlobalReducer51, 2),
4902
+ state = _useGlobalReducer52[0],
4903
+ dispatch = _useGlobalReducer52[1];
4643
4904
  var recoveryCodes = state.mfa.totp.enrollment.recoveryCodes;
4644
4905
  var handleContinue = function handleContinue() {
4645
4906
  dispatch({
@@ -4708,9 +4969,9 @@ var Select = extractErrorMessage.He.select(_templateObject41 || (_templateObject
4708
4969
  }, function (props) {
4709
4970
  return props.theme.typography.fontFamily;
4710
4971
  });
4711
- var CountrySelector = function CountrySelector(_ref74) {
4712
- var country = _ref74.country,
4713
- setCountry = _ref74.setCountry;
4972
+ var CountrySelector = function CountrySelector(_ref79) {
4973
+ var country = _ref79.country,
4974
+ setCountry = _ref79.setCountry;
4714
4975
  var countryFormatter = new Intl.DisplayNames(['en'], {
4715
4976
  type: 'region'
4716
4977
  });
@@ -4721,10 +4982,10 @@ var CountrySelector = function CountrySelector(_ref74) {
4721
4982
  onChange: function onChange(e) {
4722
4983
  setCountry(e.target.value);
4723
4984
  }
4724
- }, Object.entries(internal.COUNTRIES_LIST).map(function (_ref75) {
4725
- var _ref76 = _slicedToArray(_ref75, 2),
4726
- countryCode = _ref76[0],
4727
- countryNumber = _ref76[1];
4985
+ }, Object.entries(internal.COUNTRIES_LIST).map(function (_ref80) {
4986
+ var _ref81 = _slicedToArray(_ref80, 2),
4987
+ countryCode = _ref81[0],
4988
+ countryNumber = _ref81[1];
4728
4989
  return /*#__PURE__*/extractErrorMessage.wn.createElement("option", {
4729
4990
  key: countryCode,
4730
4991
  value: countryCode
@@ -4732,13 +4993,13 @@ var CountrySelector = function CountrySelector(_ref74) {
4732
4993
  }));
4733
4994
  };
4734
4995
  var PhoneStyledInput = extractErrorMessage.He(Input)(_templateObject42 || (_templateObject42 = _taggedTemplateLiteral(["\n flex-grow: 1;\n min-width: 100px;\n"])));
4735
- var PhoneInput = function PhoneInput(_ref77) {
4736
- var phone = _ref77.phone,
4737
- setPhone = _ref77.setPhone,
4738
- country = _ref77.country,
4739
- setCountry = _ref77.setCountry,
4740
- parsePhoneNumber = _ref77.parsePhoneNumber,
4741
- hasPasskeys = _ref77.hasPasskeys;
4996
+ var PhoneInput = function PhoneInput(_ref82) {
4997
+ var phone = _ref82.phone,
4998
+ setPhone = _ref82.setPhone,
4999
+ country = _ref82.country,
5000
+ setCountry = _ref82.setCountry,
5001
+ parsePhoneNumber = _ref82.parsePhoneNumber,
5002
+ hasPasskeys = _ref82.hasPasskeys;
4742
5003
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
4743
5004
  direction: "row",
4744
5005
  wrap: "nowrap",
@@ -4793,8 +5054,8 @@ var InvalidPhoneNumberError = /*#__PURE__*/function (_internal$StytchSDKEr) {
4793
5054
  }
4794
5055
  return _createClass(InvalidPhoneNumberError);
4795
5056
  }(internal.StytchSDKError);
4796
- var findErrorTypeFrom = function findErrorTypeFrom(_ref78) {
4797
- var error = _ref78.error;
5057
+ var findErrorTypeFrom = function findErrorTypeFrom(_ref83) {
5058
+ var error = _ref83.error;
4798
5059
  var errorType = extractErrorType(error);
4799
5060
  return !!errorType && errorType in supportedErrorTypeMap ? errorType : 'default';
4800
5061
  };
@@ -4805,10 +5066,10 @@ var supportedErrorTypeMap = {
4805
5066
  var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
4806
5067
  var _a, _b;
4807
5068
  var stytchClient = useStytch();
4808
- var _useGlobalReducer49 = useGlobalReducer(),
4809
- _useGlobalReducer50 = _slicedToArray(_useGlobalReducer49, 2),
4810
- state = _useGlobalReducer50[0],
4811
- dispatch = _useGlobalReducer50[1];
5069
+ var _useGlobalReducer53 = useGlobalReducer(),
5070
+ _useGlobalReducer54 = _slicedToArray(_useGlobalReducer53, 2),
5071
+ state = _useGlobalReducer54[0],
5072
+ dispatch = _useGlobalReducer54[1];
4812
5073
  var _state$mfa$smsOtp = state.mfa.smsOtp,
4813
5074
  isSending = _state$mfa$smsOtp.isSending,
4814
5075
  sendError = _state$mfa$smsOtp.sendError,
@@ -4834,8 +5095,8 @@ var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
4834
5095
  regionCode: countryCode
4835
5096
  });
4836
5097
  };
4837
- var _useMutate8 = useMutate('stytch.otps.sms.send', function (_, _ref79) {
4838
- var parsedNumber = _ref79.arg.parsedNumber;
5098
+ var _useMutate8 = useMutate('stytch.otps.sms.send', function (_, _ref84) {
5099
+ var parsedNumber = _ref84.arg.parsedNumber;
4839
5100
  return internal.__awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
4840
5101
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
4841
5102
  while (1) switch (_context11.prev = _context11.next) {
@@ -4934,9 +5195,9 @@ var SMSOTPEnrollScreen = function SMSOTPEnrollScreen() {
4934
5195
  disabled: !phoneNumber
4935
5196
  })));
4936
5197
  };
4937
- var InlineButton = function InlineButton(_ref80) {
4938
- var onClick = _ref80.onClick,
4939
- children = _ref80.children;
5198
+ var InlineButton = function InlineButton(_ref85) {
5199
+ var onClick = _ref85.onClick,
5200
+ children = _ref85.children;
4940
5201
  return /*#__PURE__*/extractErrorMessage.wn.createElement("button", {
4941
5202
  onClick: onClick,
4942
5203
  style: {
@@ -4948,45 +5209,45 @@ var InlineButton = function InlineButton(_ref80) {
4948
5209
  }
4949
5210
  }, children));
4950
5211
  };
4951
- var Wrapper = extractErrorMessage.He.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-rows: ", ";\n transition: grid-template-rows 0.15s ease-out;\n"])), function (_ref81) {
4952
- var isOpen = _ref81.isOpen;
5212
+ var Wrapper = extractErrorMessage.He.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteral(["\n display: grid;\n grid-template-rows: ", ";\n transition: grid-template-rows 0.15s ease-out;\n"])), function (_ref86) {
5213
+ var isOpen = _ref86.isOpen;
4953
5214
  return isOpen ? '1fr' : '0fr';
4954
5215
  });
4955
5216
  var Inner = extractErrorMessage.He.div(_templateObject44 || (_templateObject44 = _taggedTemplateLiteral(["\n overflow: hidden;\n"])));
4956
- var AnimatedContainer = function AnimatedContainer(_ref82) {
4957
- var isOpen = _ref82.isOpen,
4958
- children = _ref82.children;
5217
+ var AnimatedContainer = function AnimatedContainer(_ref87) {
5218
+ var isOpen = _ref87.isOpen,
5219
+ children = _ref87.children;
4959
5220
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Wrapper, {
4960
5221
  isOpen: isOpen
4961
5222
  }, /*#__PURE__*/extractErrorMessage.wn.createElement(Inner, null, children));
4962
5223
  };
4963
- var Container = extractErrorMessage.He.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n border-radius: 3px;\n overflow: hidden;\n"])), function (_ref83) {
4964
- var theme = _ref83.theme;
5224
+ var Container = extractErrorMessage.He.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteral(["\n height: 4px;\n background-color: ", ";\n border-radius: 3px;\n overflow: hidden;\n"])), function (_ref88) {
5225
+ var theme = _ref88.theme;
4965
5226
  return theme.colors.disabled;
4966
5227
  });
4967
5228
  var loading = extractErrorMessage.Ue(_templateObject46 || (_templateObject46 = _taggedTemplateLiteral(["\n 0% {\n transform: translateX(-100%);\n }\n 100% {\n transform: translateX(-1%);\n }\n"])));
4968
- var Progress = extractErrorMessage.He.div(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n height: 100%;\n width: 100%;\n background-color: ", ";\n animation: ", " 10s cubic-bezier(0.22, 1, 0.36, 1);\n"])), function (_ref84) {
4969
- var theme = _ref84.theme;
5229
+ var Progress = extractErrorMessage.He.div(_templateObject47 || (_templateObject47 = _taggedTemplateLiteral(["\n height: 100%;\n width: 100%;\n background-color: ", ";\n animation: ", " 10s cubic-bezier(0.22, 1, 0.36, 1);\n"])), function (_ref89) {
5230
+ var theme = _ref89.theme;
4970
5231
  return theme.colors.primary;
4971
5232
  }, loading);
4972
- var LoadingBar = function LoadingBar(_ref85) {
4973
- var isLoading = _ref85.isLoading;
5233
+ var LoadingBar = function LoadingBar(_ref90) {
5234
+ var isLoading = _ref90.isLoading;
4974
5235
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Container, null, isLoading && /*#__PURE__*/extractErrorMessage.wn.createElement(Progress, null));
4975
5236
  };
4976
5237
  var GAP = '8px';
4977
5238
  var WIDTH = '46px';
4978
5239
  var INPUT_HEIGHT = '46px';
4979
- var Digit = extractErrorMessage.He.div(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: 4px;\n align-items: center;\n display: flex;\n font-size: 18px;\n justify-content: center;\n height: ", ";\n width: ", ";\n background: ", ";\n color: ", ";\n"])), function (_ref86) {
4980
- var disabled = _ref86.disabled,
4981
- theme = _ref86.theme;
5240
+ var Digit = extractErrorMessage.He.div(_templateObject48 || (_templateObject48 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: 4px;\n align-items: center;\n display: flex;\n font-size: 18px;\n justify-content: center;\n height: ", ";\n width: ", ";\n background: ", ";\n color: ", ";\n"])), function (_ref91) {
5241
+ var disabled = _ref91.disabled,
5242
+ theme = _ref91.theme;
4982
5243
  return disabled ? theme.colors.disabled : '#ADBCC5';
4983
- }, INPUT_HEIGHT, WIDTH, function (_ref87) {
4984
- var disabled = _ref87.disabled,
4985
- theme = _ref87.theme;
5244
+ }, INPUT_HEIGHT, WIDTH, function (_ref92) {
5245
+ var disabled = _ref92.disabled,
5246
+ theme = _ref92.theme;
4986
5247
  return disabled ? theme.colors.disabled : theme.inputs.backgroundColor;
4987
- }, function (_ref88) {
4988
- var disabled = _ref88.disabled,
4989
- theme = _ref88.theme;
5248
+ }, function (_ref93) {
5249
+ var disabled = _ref93.disabled,
5250
+ theme = _ref93.theme;
4990
5251
  return disabled ? theme.colors.disabledText : theme.inputs.textColor;
4991
5252
  });
4992
5253
  var digitsContainerStyles = {
@@ -5016,20 +5277,20 @@ var invisibleInputStyles = {
5016
5277
  paddingLeft: "calc(0.5 * ".concat(WIDTH, ")"),
5017
5278
  zIndex: 10
5018
5279
  };
5019
- var DigitAtIndex = function DigitAtIndex(_ref89) {
5020
- var index = _ref89.index,
5021
- disabled = _ref89.disabled,
5022
- otp = _ref89.otp;
5280
+ var DigitAtIndex = function DigitAtIndex(_ref94) {
5281
+ var index = _ref94.index,
5282
+ disabled = _ref94.disabled,
5283
+ otp = _ref94.otp;
5023
5284
  var fill = otp ? otp[index] : '';
5024
5285
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Digit, {
5025
5286
  disabled: disabled,
5026
5287
  "data-testid": "otp-".concat(index)
5027
5288
  }, fill);
5028
5289
  };
5029
- var OTPInput = function OTPInput(_ref90) {
5030
- var otp = _ref90.otp,
5031
- setOtp = _ref90.setOtp,
5032
- disabled = _ref90.disabled;
5290
+ var OTPInput = function OTPInput(_ref95) {
5291
+ var otp = _ref95.otp,
5292
+ setOtp = _ref95.setOtp,
5293
+ disabled = _ref95.disabled;
5033
5294
  var onPasscodeChange = function onPasscodeChange(e) {
5034
5295
  if (!/^\d*$/.test(e.target.value)) {
5035
5296
  return;
@@ -5061,10 +5322,10 @@ var OTPInput = function OTPInput(_ref90) {
5061
5322
  })));
5062
5323
  };
5063
5324
  var OTP_CODE_LENGTH = 6;
5064
- var OTPControl = function OTPControl(_ref91) {
5065
- var isSubmitting = _ref91.isSubmitting,
5066
- onSubmit = _ref91.onSubmit,
5067
- errorMessage = _ref91.errorMessage;
5325
+ var OTPControl = function OTPControl(_ref96) {
5326
+ var isSubmitting = _ref96.isSubmitting,
5327
+ onSubmit = _ref96.onSubmit,
5328
+ errorMessage = _ref96.errorMessage;
5068
5329
  var _extractErrorMessage$63 = extractErrorMessage.h(''),
5069
5330
  _extractErrorMessage$64 = _slicedToArray(_extractErrorMessage$63, 2),
5070
5331
  otp = _extractErrorMessage$64[0],
@@ -5097,13 +5358,13 @@ var OTPControl = function OTPControl(_ref91) {
5097
5358
  errorMessage: errorMessage !== null && errorMessage !== void 0 ? errorMessage : ''
5098
5359
  }));
5099
5360
  };
5100
- var OTPEntry = function OTPEntry(_ref92) {
5101
- var header = _ref92.header,
5102
- helperContent = _ref92.helperContent,
5103
- instruction = _ref92.instruction,
5104
- isSubmitting = _ref92.isSubmitting,
5105
- onSubmit = _ref92.onSubmit,
5106
- errorMessage = _ref92.errorMessage;
5361
+ var OTPEntry = function OTPEntry(_ref97) {
5362
+ var header = _ref97.header,
5363
+ helperContent = _ref97.helperContent,
5364
+ instruction = _ref97.instruction,
5365
+ isSubmitting = _ref97.isSubmitting,
5366
+ onSubmit = _ref97.onSubmit,
5367
+ errorMessage = _ref97.errorMessage;
5107
5368
  return /*#__PURE__*/extractErrorMessage.wn.createElement(Flex, {
5108
5369
  direction: "column",
5109
5370
  gap: 24
@@ -5122,9 +5383,9 @@ var getSecondsRemaining = function getSecondsRemaining(expiration) {
5122
5383
  var now = new Date();
5123
5384
  return Math.ceil((expiration.getTime() - now.getTime()) / 1000);
5124
5385
  };
5125
- var ExpirationMessage = function ExpirationMessage(_ref93) {
5126
- var expiration = _ref93.expiration,
5127
- resendOTP = _ref93.resendOTP;
5386
+ var ExpirationMessage = function ExpirationMessage(_ref98) {
5387
+ var expiration = _ref98.expiration,
5388
+ resendOTP = _ref98.resendOTP;
5128
5389
  var _extractErrorMessage$65 = extractErrorMessage.h(function () {
5129
5390
  return getSecondsRemaining(expiration);
5130
5391
  }),
@@ -5152,13 +5413,13 @@ var ExpirationMessage = function ExpirationMessage(_ref93) {
5152
5413
  onClick: resendOTP
5153
5414
  }, "Resend code"));
5154
5415
  };
5155
- var SentOTPEntry = function SentOTPEntry(_ref94) {
5156
- var expiration = _ref94.expiration,
5157
- formattedDestination = _ref94.formattedDestination,
5158
- isSubmitting = _ref94.isSubmitting,
5159
- onSubmit = _ref94.onSubmit,
5160
- errorMessage = _ref94.errorMessage,
5161
- resendOTP = _ref94.resendOTP;
5416
+ var SentOTPEntry = function SentOTPEntry(_ref99) {
5417
+ var expiration = _ref99.expiration,
5418
+ formattedDestination = _ref99.formattedDestination,
5419
+ isSubmitting = _ref99.isSubmitting,
5420
+ onSubmit = _ref99.onSubmit,
5421
+ errorMessage = _ref99.errorMessage,
5422
+ resendOTP = _ref99.resendOTP;
5162
5423
  return /*#__PURE__*/extractErrorMessage.wn.createElement(OTPEntry, {
5163
5424
  header: "Enter passcode",
5164
5425
  helperContent: /*#__PURE__*/extractErrorMessage.wn.createElement(ExpirationMessage, {
@@ -5176,10 +5437,10 @@ var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
5176
5437
  var stytchClient = useStytch();
5177
5438
  var _useConfig3 = useConfig(),
5178
5439
  sessionDurationMinutes = _useConfig3.sessionOptions.sessionDurationMinutes;
5179
- var _useGlobalReducer51 = useGlobalReducer(),
5180
- _useGlobalReducer52 = _slicedToArray(_useGlobalReducer51, 2),
5181
- state = _useGlobalReducer52[0],
5182
- dispatch = _useGlobalReducer52[1];
5440
+ var _useGlobalReducer55 = useGlobalReducer(),
5441
+ _useGlobalReducer56 = _slicedToArray(_useGlobalReducer55, 2),
5442
+ state = _useGlobalReducer56[0],
5443
+ dispatch = _useGlobalReducer56[1];
5183
5444
  var _state$mfa = state.mfa,
5184
5445
  isEnrolling = _state$mfa.isEnrolling,
5185
5446
  _state$mfa$smsOtp2 = _state$mfa.smsOtp,
@@ -5191,10 +5452,10 @@ var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
5191
5452
  memberPhoneNumber = _state$mfa$primaryInf3.memberPhoneNumber,
5192
5453
  organizationId = _state$mfa$primaryInf3.organizationId,
5193
5454
  organizationMfaOptionsSupported = _state$mfa$primaryInf3.organizationMfaOptionsSupported;
5194
- var _useMutate9 = useMutate('stytch.otps.sms.send', function (_, _ref95) {
5195
- var _ref95$arg = _ref95.arg,
5196
- memberId = _ref95$arg.memberId,
5197
- organizationId = _ref95$arg.organizationId;
5455
+ var _useMutate9 = useMutate('stytch.otps.sms.send', function (_, _ref100) {
5456
+ var _ref100$arg = _ref100.arg,
5457
+ memberId = _ref100$arg.memberId,
5458
+ organizationId = _ref100$arg.organizationId;
5198
5459
  dispatch({
5199
5460
  type: 'sms_otp/send'
5200
5461
  });
@@ -5223,12 +5484,12 @@ var SMSOTPEntryScreen = function SMSOTPEntryScreen() {
5223
5484
  sendSms = _useMutate9.trigger,
5224
5485
  isSending = _useMutate9.isMutating,
5225
5486
  sendError = _useMutate9.error;
5226
- var _useMutate10 = useMutate('stytch.otps.sms.authenticate', function (_, _ref96) {
5227
- var _ref96$arg = _ref96.arg,
5228
- otp = _ref96$arg.otp,
5229
- memberId = _ref96$arg.memberId,
5230
- organizationId = _ref96$arg.organizationId,
5231
- sessionDurationMinutes = _ref96$arg.sessionDurationMinutes;
5487
+ var _useMutate10 = useMutate('stytch.otps.sms.authenticate', function (_, _ref101) {
5488
+ var _ref101$arg = _ref101.arg,
5489
+ otp = _ref101$arg.otp,
5490
+ memberId = _ref101$arg.memberId,
5491
+ organizationId = _ref101$arg.organizationId,
5492
+ sessionDurationMinutes = _ref101$arg.sessionDurationMinutes;
5232
5493
  return stytchClient.otps.sms.authenticate({
5233
5494
  code: otp,
5234
5495
  member_id: memberId,
@@ -5357,10 +5618,10 @@ var CodeContainer = extractErrorMessage.He(InsetContainer)(_templateObject50 ||
5357
5618
  var Spacer = extractErrorMessage.He.div(_templateObject51 || (_templateObject51 = _taggedTemplateLiteral(["\n flex: 0 1 24px;\n"])));
5358
5619
  var Code = extractErrorMessage.He.code(_templateObject52 || (_templateObject52 = _taggedTemplateLiteral(["\n white-space: pre-wrap;\n align-self: center;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-wrap: wrap;\n gap: 1ch;\n"])));
5359
5620
  var TOTPEnrollManualScreen = function TOTPEnrollManualScreen() {
5360
- var _useGlobalReducer53 = useGlobalReducer(),
5361
- _useGlobalReducer54 = _slicedToArray(_useGlobalReducer53, 2),
5362
- state = _useGlobalReducer54[0],
5363
- dispatch = _useGlobalReducer54[1];
5621
+ var _useGlobalReducer57 = useGlobalReducer(),
5622
+ _useGlobalReducer58 = _slicedToArray(_useGlobalReducer57, 2),
5623
+ state = _useGlobalReducer58[0],
5624
+ dispatch = _useGlobalReducer58[1];
5364
5625
  var secret = state.mfa.totp.enrollment.secret;
5365
5626
  var displaySecret = secret.toLowerCase();
5366
5627
  var secretChunked = displaySecret.split(/(.{4})/g).filter(Boolean);
@@ -5428,10 +5689,10 @@ var TOTPEnrollManualScreen = function TOTPEnrollManualScreen() {
5428
5689
  var QRCodeImg = extractErrorMessage.He.img(_templateObject53 || (_templateObject53 = _taggedTemplateLiteral(["\n margin: 0 auto;\n"])));
5429
5690
  var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
5430
5691
  var stytchClient = useStytch();
5431
- var _useGlobalReducer55 = useGlobalReducer(),
5432
- _useGlobalReducer56 = _slicedToArray(_useGlobalReducer55, 2),
5433
- state = _useGlobalReducer56[0],
5434
- dispatch = _useGlobalReducer56[1];
5692
+ var _useGlobalReducer59 = useGlobalReducer(),
5693
+ _useGlobalReducer60 = _slicedToArray(_useGlobalReducer59, 2),
5694
+ state = _useGlobalReducer60[0],
5695
+ dispatch = _useGlobalReducer60[1];
5435
5696
  var _state$mfa$totp = state.mfa.totp,
5436
5697
  createError = _state$mfa$totp.createError,
5437
5698
  enrollment = _state$mfa$totp.enrollment,
@@ -5439,10 +5700,10 @@ var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
5439
5700
  var _state$mfa$primaryInf4 = state.mfa.primaryInfo,
5440
5701
  memberId = _state$mfa$primaryInf4.memberId,
5441
5702
  organizationId = _state$mfa$primaryInf4.organizationId;
5442
- var _useMutate11 = useMutate('stytch.totp.create', function (_, _ref97) {
5443
- var _ref97$arg = _ref97.arg,
5444
- memberId = _ref97$arg.memberId,
5445
- organizationId = _ref97$arg.organizationId;
5703
+ var _useMutate11 = useMutate('stytch.totp.create', function (_, _ref102) {
5704
+ var _ref102$arg = _ref102.arg,
5705
+ memberId = _ref102$arg.memberId,
5706
+ organizationId = _ref102$arg.organizationId;
5446
5707
  dispatch({
5447
5708
  type: 'totp/create'
5448
5709
  });
@@ -5508,11 +5769,11 @@ var TOTPEnrollQRScreen = function TOTPEnrollQRScreen() {
5508
5769
  onClick: handleContinue
5509
5770
  }, "Continue"))) : ( /*#__PURE__*/extractErrorMessage.wn.createElement(LoadingScreen, null)));
5510
5771
  };
5511
- var TOTPEntry = function TOTPEntry(_ref98) {
5512
- var helperContent = _ref98.helperContent,
5513
- isSubmitting = _ref98.isSubmitting,
5514
- onSubmit = _ref98.onSubmit,
5515
- errorMessage = _ref98.errorMessage;
5772
+ var TOTPEntry = function TOTPEntry(_ref103) {
5773
+ var helperContent = _ref103.helperContent,
5774
+ isSubmitting = _ref103.isSubmitting,
5775
+ onSubmit = _ref103.onSubmit,
5776
+ errorMessage = _ref103.errorMessage;
5516
5777
  return /*#__PURE__*/extractErrorMessage.wn.createElement(OTPEntry, {
5517
5778
  header: "Enter verification code",
5518
5779
  instruction: "Enter the 6-digit code from your authenticator app.",
@@ -5526,22 +5787,22 @@ var TOTPEntryScreen = function TOTPEntryScreen() {
5526
5787
  var stytchClient = useStytch();
5527
5788
  var _useConfig4 = useConfig(),
5528
5789
  sessionDurationMinutes = _useConfig4.sessionOptions.sessionDurationMinutes;
5529
- var _useGlobalReducer57 = useGlobalReducer(),
5530
- _useGlobalReducer58 = _slicedToArray(_useGlobalReducer57, 2),
5531
- state = _useGlobalReducer58[0],
5532
- dispatch = _useGlobalReducer58[1];
5790
+ var _useGlobalReducer61 = useGlobalReducer(),
5791
+ _useGlobalReducer62 = _slicedToArray(_useGlobalReducer61, 2),
5792
+ state = _useGlobalReducer62[0],
5793
+ dispatch = _useGlobalReducer62[1];
5533
5794
  var isEnrolling = state.mfa.isEnrolling;
5534
5795
  var _state$mfa$primaryInf5 = state.mfa.primaryInfo,
5535
5796
  enrolledMfaMethods = _state$mfa$primaryInf5.enrolledMfaMethods,
5536
5797
  memberId = _state$mfa$primaryInf5.memberId,
5537
5798
  organizationId = _state$mfa$primaryInf5.organizationId,
5538
5799
  organizationMfaOptionsSupported = _state$mfa$primaryInf5.organizationMfaOptionsSupported;
5539
- var _useMutate12 = useMutate('stytch.totp.authenticate', function (_, _ref99) {
5540
- var _ref99$arg = _ref99.arg,
5541
- memberId = _ref99$arg.memberId,
5542
- organizationId = _ref99$arg.organizationId,
5543
- otp = _ref99$arg.otp,
5544
- sessionDurationMinutes = _ref99$arg.sessionDurationMinutes;
5800
+ var _useMutate12 = useMutate('stytch.totp.authenticate', function (_, _ref104) {
5801
+ var _ref104$arg = _ref104.arg,
5802
+ memberId = _ref104$arg.memberId,
5803
+ organizationId = _ref104$arg.organizationId,
5804
+ otp = _ref104$arg.otp,
5805
+ sessionDurationMinutes = _ref104$arg.sessionDurationMinutes;
5545
5806
  return stytchClient.totp.authenticate({
5546
5807
  code: otp,
5547
5808
  member_id: memberId,
@@ -5614,49 +5875,49 @@ var TOTPEntryScreen = function TOTPEntryScreen() {
5614
5875
  onClick: handleSwitchToSms
5615
5876
  }, "Text me a code instead"))));
5616
5877
  };
5617
- var MainContainer = extractErrorMessage.He.div(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n width: ", ";\n font-family: ", ";\n box-sizing: border-box;\n * {\n box-sizing: content-box;\n }\n background-color: ", ";\n border: ", ";\n border-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-bottom: ", ";\n"])), function (_ref100) {
5618
- var theme = _ref100.theme;
5878
+ var MainContainer = extractErrorMessage.He.div(_templateObject54 || (_templateObject54 = _taggedTemplateLiteral(["\n width: ", ";\n font-family: ", ";\n box-sizing: border-box;\n * {\n box-sizing: content-box;\n }\n background-color: ", ";\n border: ", ";\n border-radius: ", ";\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-bottom: ", ";\n"])), function (_ref105) {
5879
+ var theme = _ref105.theme;
5619
5880
  return theme.container.width;
5620
- }, function (_ref101) {
5621
- var theme = _ref101.theme;
5881
+ }, function (_ref106) {
5882
+ var theme = _ref106.theme;
5622
5883
  return theme.typography.fontFamily;
5623
- }, function (_ref102) {
5624
- var theme = _ref102.theme;
5884
+ }, function (_ref107) {
5885
+ var theme = _ref107.theme;
5625
5886
  return theme.container.backgroundColor;
5626
- }, function (_ref103) {
5627
- var theme = _ref103.theme;
5887
+ }, function (_ref108) {
5888
+ var theme = _ref108.theme;
5628
5889
  return theme.container.border;
5629
- }, function (_ref104) {
5630
- var theme = _ref104.theme;
5890
+ }, function (_ref109) {
5891
+ var theme = _ref109.theme;
5631
5892
  return theme.container.borderRadius;
5632
- }, function (_ref105) {
5633
- var theme = _ref105.theme,
5634
- displayWatermark = _ref105.displayWatermark;
5893
+ }, function (_ref110) {
5894
+ var theme = _ref110.theme,
5895
+ displayWatermark = _ref110.displayWatermark;
5635
5896
  return displayWatermark ? '0' : theme.container.borderRadius;
5636
- }, function (_ref106) {
5637
- var theme = _ref106.theme,
5638
- displayWatermark = _ref106.displayWatermark;
5897
+ }, function (_ref111) {
5898
+ var theme = _ref111.theme,
5899
+ displayWatermark = _ref111.displayWatermark;
5639
5900
  return displayWatermark ? '0' : theme.container.borderRadius;
5640
- }, function (_ref107) {
5641
- var theme = _ref107.theme,
5642
- displayWatermark = _ref107.displayWatermark;
5901
+ }, function (_ref112) {
5902
+ var theme = _ref112.theme,
5903
+ displayWatermark = _ref112.displayWatermark;
5643
5904
  return displayWatermark ? 'none' : theme.container.border;
5644
5905
  });
5645
5906
  var ChildrenContainer = extractErrorMessage.He.div(_templateObject55 || (_templateObject55 = _taggedTemplateLiteral(["\n padding: 24px 32px;\n"])));
5646
- var WatermarkContainer = extractErrorMessage.He.div(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n width: ", ";\n background-color: ", ";\n border: ", ";\n border-top: none;\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n overflow: hidden;\n"])), function (_ref108) {
5647
- var theme = _ref108.theme;
5907
+ var WatermarkContainer = extractErrorMessage.He.div(_templateObject56 || (_templateObject56 = _taggedTemplateLiteral(["\n box-sizing: border-box;\n width: ", ";\n background-color: ", ";\n border: ", ";\n border-top: none;\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n overflow: hidden;\n"])), function (_ref113) {
5908
+ var theme = _ref113.theme;
5648
5909
  return theme.container.width;
5649
- }, function (_ref109) {
5650
- var theme = _ref109.theme;
5910
+ }, function (_ref114) {
5911
+ var theme = _ref114.theme;
5651
5912
  return theme.container.backgroundColor;
5652
- }, function (_ref110) {
5653
- var theme = _ref110.theme;
5913
+ }, function (_ref115) {
5914
+ var theme = _ref115.theme;
5654
5915
  return theme.container.border;
5655
- }, function (_ref111) {
5656
- var theme = _ref111.theme;
5916
+ }, function (_ref116) {
5917
+ var theme = _ref116.theme;
5657
5918
  return theme.container.borderRadius;
5658
- }, function (_ref112) {
5659
- var theme = _ref112.theme;
5919
+ }, function (_ref117) {
5920
+ var theme = _ref117.theme;
5660
5921
  return theme.container.borderRadius;
5661
5922
  });
5662
5923
  var InnerContainer = extractErrorMessage.He.div(_templateObject57 || (_templateObject57 = _taggedTemplateLiteral(["\n background-color: #19303d;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 0.5;\n"])));
@@ -5678,10 +5939,10 @@ var isSupportedTokenType = function isSupportedTokenType(tokenType) {
5678
5939
  };
5679
5940
  var AppContainer$1 = function AppContainer$1() {
5680
5941
  var _ScreenComponentMap;
5681
- var _useGlobalReducer59 = useGlobalReducer(),
5682
- _useGlobalReducer60 = _slicedToArray(_useGlobalReducer59, 2),
5683
- state = _useGlobalReducer60[0],
5684
- dispatch = _useGlobalReducer60[1];
5942
+ var _useGlobalReducer63 = useGlobalReducer(),
5943
+ _useGlobalReducer64 = _slicedToArray(_useGlobalReducer63, 2),
5944
+ state = _useGlobalReducer64[0],
5945
+ dispatch = _useGlobalReducer64[1];
5685
5946
  var stytchClient = useStytch();
5686
5947
  var config = useConfig();
5687
5948
  var _extractErrorMessage$67 = extractErrorMessage.Ze(),
@@ -5701,13 +5962,9 @@ var AppContainer$1 = function AppContainer$1() {
5701
5962
  discoveredOrganizations: data.discovered_organizations,
5702
5963
  intermediateSessionToken: data.intermediate_session_token
5703
5964
  });
5704
- dispatch({
5705
- type: 'transition',
5706
- screen: AppScreens$1.Discovery
5707
- });
5708
5965
  };
5709
- var onError = function onError(_ref113) {
5710
- var errorType = _ref113.errorType;
5966
+ var onError = function onError(_ref118) {
5967
+ var errorType = _ref118.errorType;
5711
5968
  return function () {
5712
5969
  clearStytchSearchParams();
5713
5970
  dispatch({
@@ -5716,8 +5973,8 @@ var AppContainer$1 = function AppContainer$1() {
5716
5973
  });
5717
5974
  };
5718
5975
  };
5719
- var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_, _ref114) {
5720
- var token = _ref114.arg.token;
5976
+ var _useMutate13 = useMutate("stytch.magicLinks.authenticate", function (_, _ref119) {
5977
+ var token = _ref119.arg.token;
5721
5978
  return stytchClient.magicLinks.authenticate({
5722
5979
  magic_links_token: token,
5723
5980
  session_duration_minutes: config.sessionOptions.sessionDurationMinutes
@@ -5730,8 +5987,8 @@ var AppContainer$1 = function AppContainer$1() {
5730
5987
  }),
5731
5988
  stytchMagicLinkAuthenticate = _useMutate13.trigger,
5732
5989
  isMagicLinkLoading = _useMutate13.isMutating;
5733
- var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_, _ref115) {
5734
- var token = _ref115.arg.token;
5990
+ var _useMutate14 = useMutate("stytch.oauth.authenticate", function (_, _ref120) {
5991
+ var token = _ref120.arg.token;
5735
5992
  return stytchClient.oauth.authenticate({
5736
5993
  oauth_token: token,
5737
5994
  session_duration_minutes: config.sessionOptions.sessionDurationMinutes
@@ -5744,8 +6001,8 @@ var AppContainer$1 = function AppContainer$1() {
5744
6001
  }),
5745
6002
  stytchOAuthAuthenticate = _useMutate14.trigger,
5746
6003
  isOAuthLoading = _useMutate14.isMutating;
5747
- var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_, _ref116) {
5748
- var token = _ref116.arg.token;
6004
+ var _useMutate15 = useMutate("stytch.oauth.discovery.authenticate", function (_, _ref121) {
6005
+ var token = _ref121.arg.token;
5749
6006
  return stytchClient.oauth.discovery.authenticate({
5750
6007
  discovery_oauth_token: token
5751
6008
  });
@@ -5757,8 +6014,8 @@ var AppContainer$1 = function AppContainer$1() {
5757
6014
  }),
5758
6015
  stytchOAuthDiscoveryAuthenticate = _useMutate15.trigger,
5759
6016
  isDiscoveryOAuthLoading = _useMutate15.isMutating;
5760
- var _useMutate16 = useMutate("stytch.sso.authenticate", function (_, _ref117) {
5761
- var token = _ref117.arg.token;
6017
+ var _useMutate16 = useMutate("stytch.sso.authenticate", function (_, _ref122) {
6018
+ var token = _ref122.arg.token;
5762
6019
  return stytchClient.sso.authenticate({
5763
6020
  sso_token: token,
5764
6021
  session_duration_minutes: config.sessionOptions.sessionDurationMinutes
@@ -5771,8 +6028,8 @@ var AppContainer$1 = function AppContainer$1() {
5771
6028
  }),
5772
6029
  stytchSSOAuthenticate = _useMutate16.trigger,
5773
6030
  isSSOLoading = _useMutate16.isMutating;
5774
- var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_, _ref118) {
5775
- var token = _ref118.arg.token;
6031
+ var _useMutate17 = useMutate("stytch.magicLinks.discovery.authenticate", function (_, _ref123) {
6032
+ var token = _ref123.arg.token;
5776
6033
  return stytchClient.magicLinks.discovery.authenticate({
5777
6034
  discovery_magic_links_token: token
5778
6035
  });
@@ -5883,11 +6140,11 @@ var AppContainer$1 = function AppContainer$1() {
5883
6140
  src: POWERED_BY_STYTCH_IMG_URL
5884
6141
  }))))));
5885
6142
  };
5886
- var AppContainer = function AppContainer(_ref119) {
5887
- var client = _ref119.client,
5888
- styles = _ref119.styles,
5889
- callbacks = _ref119.callbacks,
5890
- config = _ref119.config;
6143
+ var AppContainer = function AppContainer(_ref124) {
6144
+ var client = _ref124.client,
6145
+ styles = _ref124.styles,
6146
+ callbacks = _ref124.callbacks,
6147
+ config = _ref124.config;
5891
6148
  var _extractErrorMessage$68 = extractErrorMessage.h(function () {
5892
6149
  var _internal$readB2BInte5 = internal.readB2BInternals(client).bootstrap.getSync(),
5893
6150
  displayWatermark = _internal$readB2BInte5.displayWatermark;
@@ -5903,8 +6160,8 @@ var AppContainer = function AppContainer(_ref119) {
5903
6160
  options: config
5904
6161
  }
5905
6162
  });
5906
- internal.readB2BInternals(client).bootstrap.getAsync().then(function (_ref120) {
5907
- var displayWatermark = _ref120.displayWatermark;
6163
+ internal.readB2BInternals(client).bootstrap.getAsync().then(function (_ref125) {
6164
+ var displayWatermark = _ref125.displayWatermark;
5908
6165
  setDisplayWatermark(displayWatermark);
5909
6166
  });
5910
6167
  }, [client]);
@@ -5941,11 +6198,11 @@ var StytchB2BUIClient = /*#__PURE__*/function (_b2b_index_headless$S) {
5941
6198
  }
5942
6199
  _createClass(StytchB2BUIClient, [{
5943
6200
  key: "mount",
5944
- value: function mount(_ref121) {
5945
- var elementId = _ref121.elementId,
5946
- styles = _ref121.styles,
5947
- callbacks = _ref121.callbacks,
5948
- config = _ref121.config;
6201
+ value: function mount(_ref126) {
6202
+ var elementId = _ref126.elementId,
6203
+ styles = _ref126.styles,
6204
+ callbacks = _ref126.callbacks,
6205
+ config = _ref126.config;
5949
6206
  var _a;
5950
6207
  var targetParentDomNode = document.querySelector(elementId);
5951
6208
  if (!targetParentDomNode) {