@getpara/core-sdk 2.25.0 → 3.0.0-alpha.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.
Files changed (35) hide show
  1. package/dist/cjs/ParaCore.js +16 -9
  2. package/dist/cjs/constants.js +1 -1
  3. package/dist/cjs/services/AuthService.js +2 -2
  4. package/dist/cjs/services/LoginFlowService.js +24 -13
  5. package/dist/cjs/services/PollingService.js +3 -3
  6. package/dist/cjs/services/PortalUrlService.js +50 -43
  7. package/dist/cjs/services/SessionManagementService.js +3 -3
  8. package/dist/cjs/services/SignupFlowService.js +18 -3
  9. package/dist/cjs/services/VerificationFlowService.js +9 -4
  10. package/dist/cjs/state/CoreStateManager.js +37 -17
  11. package/dist/cjs/state/machines/authStateMachine.js +9 -0
  12. package/dist/esm/ParaCore.js +16 -9
  13. package/dist/esm/constants.js +1 -1
  14. package/dist/esm/services/AuthService.js +2 -2
  15. package/dist/esm/services/LoginFlowService.js +24 -13
  16. package/dist/esm/services/PollingService.js +3 -3
  17. package/dist/esm/services/PortalUrlService.js +50 -43
  18. package/dist/esm/services/SessionManagementService.js +3 -3
  19. package/dist/esm/services/SignupFlowService.js +18 -3
  20. package/dist/esm/services/VerificationFlowService.js +9 -4
  21. package/dist/esm/state/CoreStateManager.js +37 -17
  22. package/dist/esm/state/machines/authStateMachine.js +9 -0
  23. package/dist/types/ParaCore.d.ts +8 -6
  24. package/dist/types/services/types/AuthServiceTypes.d.ts +4 -1
  25. package/dist/types/services/types/PortalUrlServiceTypes.d.ts +9 -5
  26. package/dist/types/state/machines/authStateMachine.d.ts +106 -1
  27. package/dist/types/state/machines/coreStateMachine.d.ts +646 -16
  28. package/dist/types/state/types/auth.d.ts +2 -1
  29. package/dist/types/state/types/core.d.ts +11 -1
  30. package/dist/types/types/authState.d.ts +25 -0
  31. package/dist/types/types/config.d.ts +3 -2
  32. package/dist/types/types/coreApi.d.ts +3 -1
  33. package/dist/types/types/serviceInterfaces.d.ts +3 -3
  34. package/dist/types/types/util.d.ts +14 -1
  35. package/package.json +3 -3
@@ -557,6 +557,7 @@ const _ParaCore = class _ParaCore {
557
557
  authPhase: state.authStatePhase,
558
558
  walletPhase: state.walletStatePhase,
559
559
  authStateInfo: state.authStateInfo,
560
+ selectedOAuthMethod: state.selectedOAuthMethod,
560
561
  error: state.error,
561
562
  isReady: state.isReady
562
563
  };
@@ -610,10 +611,11 @@ const _ParaCore = class _ParaCore {
610
611
  authPhase: state.authStatePhase,
611
612
  walletPhase: state.walletStatePhase,
612
613
  authStateInfo: state.authStateInfo,
614
+ selectedOAuthMethod: state.selectedOAuthMethod,
613
615
  error: state.error,
614
616
  isReady: state.isReady
615
617
  };
616
- if (!lastSnapshot || lastSnapshot.corePhase !== currentSnapshot.corePhase || lastSnapshot.authPhase !== currentSnapshot.authPhase || lastSnapshot.walletPhase !== currentSnapshot.walletPhase || lastSnapshot.error !== currentSnapshot.error || lastSnapshot.isReady !== currentSnapshot.isReady) {
618
+ if (!lastSnapshot || lastSnapshot.corePhase !== currentSnapshot.corePhase || lastSnapshot.authPhase !== currentSnapshot.authPhase || lastSnapshot.walletPhase !== currentSnapshot.walletPhase || lastSnapshot.selectedOAuthMethod !== currentSnapshot.selectedOAuthMethod || lastSnapshot.error !== currentSnapshot.error || lastSnapshot.isReady !== currentSnapshot.isReady) {
617
619
  lastSnapshot = currentSnapshot;
618
620
  callback(currentSnapshot);
619
621
  }
@@ -1864,10 +1866,10 @@ const _ParaCore = class _ParaCore {
1864
1866
  getSwitchWalletsUrl() {
1865
1867
  return __async(this, null, function* () {
1866
1868
  const authMethods = yield this.supportedUserAuthMethods();
1867
- const url = yield this.constructPortalUrl("switchWallets", {
1869
+ const result = yield this.constructPortalUrl("switchWallets", {
1868
1870
  useLegacyUrl: authMethods.has(import_user_management_client.AuthMethod.PASSKEY)
1869
1871
  });
1870
- return url;
1872
+ return result.url;
1871
1873
  });
1872
1874
  }
1873
1875
  /**
@@ -2136,22 +2138,24 @@ const _ParaCore = class _ParaCore {
2136
2138
  getTransactionReviewUrl(transactionId, timeoutMs) {
2137
2139
  return __async(this, null, function* () {
2138
2140
  const authMethods = yield this.supportedUserAuthMethods();
2139
- return this.constructPortalUrl("txReview", {
2141
+ const result = yield this.constructPortalUrl("txReview", {
2140
2142
  pathId: transactionId,
2141
2143
  useLegacyUrl: authMethods.has(import_user_management_client.AuthMethod.PASSKEY),
2142
2144
  params: {
2143
2145
  timeoutMs: timeoutMs == null ? void 0 : timeoutMs.toString()
2144
2146
  }
2145
2147
  });
2148
+ return result.url;
2146
2149
  });
2147
2150
  }
2148
2151
  getOnRampTransactionUrl(_0) {
2149
2152
  return __async(this, arguments, function* ({
2150
2153
  purchaseId
2151
2154
  }) {
2152
- return this.constructPortalUrl("onRamp", {
2155
+ const result = yield this.constructPortalUrl("onRamp", {
2153
2156
  pathId: purchaseId
2154
2157
  });
2158
+ return result.url;
2155
2159
  });
2156
2160
  }
2157
2161
  getWalletBalance(params) {
@@ -2657,12 +2661,13 @@ const _ParaCore = class _ParaCore {
2657
2661
  * @param {Object} opts the options object
2658
2662
  * @param {String} opts.auth - the user auth to sign up or log in with, in the form ` { email: string } | { phone: `+${number}` } `
2659
2663
  * @param {boolean} opts.useShortUrls - whether to shorten the generated portal URLs
2660
- * @param {Theme} opts.portalTheme the Para Portal theme to apply to the password creation URL, if other than the default theme
2664
+ * @param {PortalTheme} opts.portalTheme the Para Portal theme to apply to the password creation URL, if other than the default theme
2661
2665
  * @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
2662
2666
  */
2663
2667
  getLoginUrl(params) {
2664
2668
  return __async(this, null, function* () {
2665
- return yield __privateGet(this, _portalUrlService).getLoginUrl(params);
2669
+ const result = yield __privateGet(this, _portalUrlService).getLoginUrl(params);
2670
+ return result.url;
2666
2671
  });
2667
2672
  }
2668
2673
  prepareLogin() {
@@ -2818,7 +2823,8 @@ const _ParaCore = class _ParaCore {
2818
2823
  sendLoginCode() {
2819
2824
  return __async(this, null, function* () {
2820
2825
  const { userId } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2821
- this.setUserId(userId);
2826
+ yield this.setUserId(userId);
2827
+ return { userId };
2822
2828
  });
2823
2829
  }
2824
2830
  exportPrivateKey() {
@@ -2844,10 +2850,11 @@ const _ParaCore = class _ParaCore {
2844
2850
  this.popupWindow = yield this.platformUtils.openPopup("about:blank", { type: import_types.PopupType.EXPORT_PRIVATE_KEY });
2845
2851
  }
2846
2852
  const authMethods = yield this.supportedUserAuthMethods();
2847
- const exportPrivateKeyUrl = yield this.constructPortalUrl("exportPrivateKey", {
2853
+ const exportPrivateKeyResult = yield this.constructPortalUrl("exportPrivateKey", {
2848
2854
  pathId: walletId,
2849
2855
  useLegacyUrl: authMethods.has(import_user_management_client.AuthMethod.PASSKEY)
2850
2856
  });
2857
+ const exportPrivateKeyUrl = exportPrivateKeyResult.url;
2851
2858
  if (args.shouldOpenPopup) {
2852
2859
  this.popupWindow.location.href = exportPrivateKeyUrl;
2853
2860
  }
@@ -46,7 +46,7 @@ __export(constants_exports, {
46
46
  TRANSACTION_REVIEW_TIMEOUT_MS: () => TRANSACTION_REVIEW_TIMEOUT_MS
47
47
  });
48
48
  module.exports = __toCommonJS(constants_exports);
49
- const PARA_CORE_VERSION = "2.25.0";
49
+ const PARA_CORE_VERSION = "3.0.0-alpha.0";
50
50
  const PREFIX = "@CAPSULE/";
51
51
  const PARA_PREFIX = "@PARA/";
52
52
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -668,7 +668,7 @@ class AuthService {
668
668
  }
669
669
  }
670
670
  const { sessionId } = yield __privateGet(this, _sessionManagementService).touchSession();
671
- const url = (isForNewDevice || urlType) && (yield __privateGet(this, _portalUrlService).constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
671
+ const result = (isForNewDevice || urlType) && (yield __privateGet(this, _portalUrlService).constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
672
672
  isForNewDevice,
673
673
  pathId: credentialId,
674
674
  portalTheme,
@@ -678,7 +678,7 @@ class AuthService {
678
678
  addNewCredentialPasskeyId: passkeyId,
679
679
  addNewCredentialPasswordId: passwordId
680
680
  }));
681
- return __spreadValues({ credentialId }, url ? { url } : {});
681
+ return __spreadValues({ credentialId }, result ? { url: result.url, fullUrl: result.fullUrl } : {});
682
682
  });
683
683
  this.addCredential = (_0) => __async(this, [_0], function* ({ authMethod }) {
684
684
  if (authMethod === "PASSKEY" && !(yield __privateGet(this, _paraCoreInterface).isPasskeySupported())) {
@@ -90,16 +90,19 @@ class LoginFlowService extends import_BaseAuthFlowService.BaseAuthFlowService {
90
90
  const isPasskeyPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PASSKEY) && !this.paraCoreInterface.isNativePasskey;
91
91
  const isPasswordPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PASSWORD) && hasPasswordWithoutPIN;
92
92
  const isPINPossible = loginAuthMethods.includes(import_user_management_client.AuthMethod.PIN);
93
- return __spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, authState), {
93
+ const result = __spreadProps(__spreadValues({}, authState), {
94
94
  isPasskeySupported,
95
95
  loginAuthMethods
96
- }), isPasskeyPossible ? {
97
- passkeyUrl: yield this.services.portalUrlService.getLoginUrl({
96
+ });
97
+ if (isPasskeyPossible) {
98
+ const passkeyResult = yield this.services.portalUrlService.getLoginUrl({
98
99
  sessionId: sessionLookupId,
99
100
  shorten,
100
101
  portalTheme
101
- }),
102
- passkeyKnownDeviceUrl: yield this.services.portalUrlService.constructPortalUrl("loginAuth", {
102
+ });
103
+ result.passkeyUrl = passkeyResult.url;
104
+ result.passkeyFullUrl = passkeyResult.fullUrl;
105
+ const knownDeviceResult = yield this.services.portalUrlService.constructPortalUrl("loginAuth", {
103
106
  sessionId: sessionLookupId,
104
107
  newDevice: {
105
108
  sessionId: sessionLookupId,
@@ -107,22 +110,30 @@ class LoginFlowService extends import_BaseAuthFlowService.BaseAuthFlowService {
107
110
  },
108
111
  shorten,
109
112
  portalTheme
110
- })
111
- } : {}), isPasswordPossible ? {
112
- passwordUrl: yield this.services.portalUrlService.constructPortalUrl("loginPassword", {
113
+ });
114
+ result.passkeyKnownDeviceUrl = knownDeviceResult.url;
115
+ }
116
+ if (isPasswordPossible) {
117
+ const passwordResult = yield this.services.portalUrlService.constructPortalUrl("loginPassword", {
113
118
  sessionId: sessionLookupId,
114
119
  shorten,
115
120
  portalTheme,
116
121
  params: { isEmbedded: `${!serverAuthState.isWalletSelectionNeeded}` }
117
- })
118
- } : {}), isPINPossible ? {
119
- pinUrl: yield this.services.portalUrlService.constructPortalUrl("loginPIN", {
122
+ });
123
+ result.passwordUrl = passwordResult.url;
124
+ result.passwordFullUrl = passwordResult.fullUrl;
125
+ }
126
+ if (isPINPossible) {
127
+ const pinResult = yield this.services.portalUrlService.constructPortalUrl("loginPIN", {
120
128
  sessionId: sessionLookupId,
121
129
  shorten,
122
130
  portalTheme,
123
131
  params: { isEmbedded: `${!serverAuthState.isWalletSelectionNeeded}` }
124
- })
125
- } : {});
132
+ });
133
+ result.pinUrl = pinResult.url;
134
+ result.pinFullUrl = pinResult.fullUrl;
135
+ }
136
+ return result;
126
137
  });
127
138
  this.waitForLogin = (params) => __async(this, null, function* () {
128
139
  this.stateManager.send({
@@ -243,15 +243,15 @@ class PollingService {
243
243
  yield __privateGet(this, _openOAuthPopup).call(this);
244
244
  }
245
245
  yield __privateGet(this, _authService).prepareLogin();
246
- const oAuthUrl = yield __privateGet(this, _portalUrlService).constructPortalUrl(config.portalUrlType, {
246
+ const oAuthResult = yield __privateGet(this, _portalUrlService).constructPortalUrl(config.portalUrlType, {
247
247
  portalTheme,
248
248
  shorten: useShortUrls,
249
249
  appScheme
250
250
  });
251
251
  if (onOAuthUrl) {
252
- onOAuthUrl(oAuthUrl);
252
+ onOAuthUrl(oAuthResult.url, oAuthResult.fullUrl);
253
253
  } else if (!!__privateGet(this, _paraCoreInterface).popupWindow) {
254
- __privateGet(this, _paraCoreInterface).popupWindow.location.href = oAuthUrl;
254
+ __privateGet(this, _paraCoreInterface).popupWindow.location.href = oAuthResult.url;
255
255
  onOAuthPopup(__privateGet(this, _paraCoreInterface).popupWindow);
256
256
  }
257
257
  return new Promise((resolve, reject) => {
@@ -111,7 +111,7 @@ class PortalUrlService {
111
111
  return __privateGet(this, _paraCoreInterface).ctx.portalUrlOverride || (yield this.getPartnerURL()) || (0, import_url.getPortalBaseURL)(__privateGet(this, _paraCoreInterface).ctx, false, false, isLegacy);
112
112
  });
113
113
  this.constructPortalUrl = (_0, ..._1) => __async(this, [_0, ..._1], function* (type, opts = {}) {
114
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
114
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
115
115
  const [
116
116
  isCreate,
117
117
  isLogin,
@@ -156,82 +156,83 @@ class PortalUrlService {
156
156
  }
157
157
  const shouldUseLegacyPortalUrl = opts.useLegacyUrl || !!opts.addNewCredentialPasskeyId || type === "loginAuth";
158
158
  const base = type === "onRamp" || isTelegramLogin ? __privateGet(this, _paraCoreInterface).ctx.portalUrlOverride || (0, import_url.getPortalBaseURL)(__privateGet(this, _paraCoreInterface).ctx, isTelegramLogin, false, shouldUseLegacyPortalUrl) : yield this.getPortalURL(shouldUseLegacyPortalUrl);
159
+ const userId = __privateGet(this, _authService).userId;
159
160
  let path;
160
161
  switch (type) {
162
+ case "createAuth": {
163
+ path = `/v2/create/${userId}/passkey/${opts.pathId}`;
164
+ break;
165
+ }
161
166
  case "createPassword": {
162
- path = `/web/users/${__privateGet(this, _authService).userId}/passwords/${opts.pathId}`;
167
+ path = `/v2/create/${userId}/password/${opts.pathId}`;
163
168
  break;
164
169
  }
165
170
  case "createPIN": {
166
- path = `/web/users/${__privateGet(this, _authService).userId}/pin/${opts.pathId}`;
171
+ path = `/v2/create/${userId}/pin/${opts.pathId}`;
167
172
  break;
168
173
  }
169
- case "createAuth": {
170
- path = `/web/users/${__privateGet(this, _authService).userId}/biometrics/${opts.pathId}`;
174
+ case "loginAuth": {
175
+ path = "/v2/login/passkey";
171
176
  break;
172
177
  }
173
178
  case "loginPassword": {
174
- path = "/web/passwords/login";
175
- break;
176
- }
177
- case "loginAuth": {
178
- path = "/web/biometrics/login";
179
+ path = "/v2/login/password";
179
180
  break;
180
181
  }
181
182
  case "loginPIN": {
182
- path = "/web/pin/login";
183
+ path = "/v2/login/pin";
183
184
  break;
184
185
  }
185
- case "txReview": {
186
- path = `/web/users/${__privateGet(this, _authService).userId}/transaction-review/${opts.pathId}`;
186
+ case "loginOTP": {
187
+ path = "/v2/login/otp";
187
188
  break;
188
189
  }
189
- case "onRamp": {
190
- path = `/web/users/${__privateGet(this, _authService).userId}/on-ramp-transaction/v2/${opts.pathId}`;
190
+ case "telegramLogin": {
191
+ path = "/v2/login/telegram";
191
192
  break;
192
193
  }
193
194
  case "telegramLoginVerify": {
194
- path = `/auth/telegram/verify`;
195
+ path = "/v2/login/telegram/verify";
195
196
  break;
196
197
  }
197
- case "telegramLogin": {
198
- path = `/auth/telegram`;
198
+ case "loginFarcaster": {
199
+ path = "/v2/login/farcaster";
199
200
  break;
200
201
  }
201
202
  case "oAuth": {
202
- path = `/auth/${opts.oAuthMethod.toLowerCase()}`;
203
+ path = `/v2/login/${opts.oAuthMethod.toLowerCase()}`;
203
204
  break;
204
205
  }
205
206
  case "oAuthCallback": {
206
- path = `/auth/${opts.oAuthMethod.toLowerCase()}/callback`;
207
+ path = `/v2/login/${opts.oAuthMethod.toLowerCase()}/callback`;
207
208
  break;
208
209
  }
209
- case "loginOTP": {
210
- path = "/auth/otp";
211
- break;
212
- }
213
- case "loginFarcaster": {
214
- path = "/auth/farcaster";
210
+ case "loginExternalWallet": {
211
+ path = "/v2/login/external-wallet";
215
212
  break;
216
213
  }
217
- case "switchWallets": {
218
- path = `/auth/wallets`;
214
+ case "txReview": {
215
+ path = `/v2/wallet/${userId}/transaction/${opts.pathId}`;
219
216
  break;
220
217
  }
221
- case "addNewCredential": {
222
- path = "/auth/add-new-credential";
218
+ case "onRamp": {
219
+ path = `/v2/wallet/${userId}/on-ramp/${opts.pathId}`;
223
220
  break;
224
221
  }
225
222
  case "exportPrivateKey": {
226
- path = `/web/users/${__privateGet(this, _authService).userId}/private-key/${opts.pathId}`;
223
+ path = `/v2/wallet/${userId}/export-key/${opts.pathId}`;
227
224
  break;
228
225
  }
229
- case "loginExternalWallet": {
230
- path = "/auth/external-wallet";
226
+ case "switchWallets": {
227
+ path = "/v2/wallet/switch";
231
228
  break;
232
229
  }
233
230
  case "connectExternalWallet": {
234
- path = "/auth/connect-external-wallet";
231
+ path = "/v2/wallet/connect-external";
232
+ break;
233
+ }
234
+ case "addNewCredential": {
235
+ path = "/v2/account/add-credential";
235
236
  break;
236
237
  }
237
238
  default: {
@@ -254,15 +255,19 @@ class PortalUrlService {
254
255
  };
255
256
  const params = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
256
257
  apiKey: __privateGet(this, _paraCoreInterface).ctx.apiKey,
257
- origin: typeof window !== "undefined" ? window.location.origin : void 0,
258
258
  partnerId: partner == null ? void 0 : partner.id
259
259
  }, typeof window !== "undefined" && ((_b = window.location) == null ? void 0 : _b.origin) ? { origin: window.location.origin } : {}), {
260
260
  portalFont: ((_c = opts.portalTheme) == null ? void 0 : _c.font) || ((_d = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _d.font) || (partner == null ? void 0 : partner.font),
261
261
  portalBorderRadius: ((_e = opts.portalTheme) == null ? void 0 : _e.borderRadius) || ((_f = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _f.borderRadius),
262
262
  portalThemeMode: ((_g = opts.portalTheme) == null ? void 0 : _g.mode) || ((_h = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _h.mode) || (partner == null ? void 0 : partner.themeMode),
263
- portalAccentColor: ((_i = opts.portalTheme) == null ? void 0 : _i.accentColor) || ((_j = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _j.accentColor) || (partner == null ? void 0 : partner.accentColor),
264
- portalForegroundColor: ((_k = opts.portalTheme) == null ? void 0 : _k.foregroundColor) || ((_l = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _l.foregroundColor) || (partner == null ? void 0 : partner.foregroundColor),
265
- portalBackgroundColor: ((_m = opts.portalTheme) == null ? void 0 : _m.backgroundColor) || ((_n = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _n.backgroundColor) || (partner == null ? void 0 : partner.backgroundColor) || __privateGet(this, _paraCoreInterface).portalBackgroundColor,
263
+ portalForegroundMixRatio: (_l = (_k = (_i = opts.portalTheme) == null ? void 0 : _i.foregroundMixRatio) != null ? _k : (_j = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _j.foregroundMixRatio) == null ? void 0 : _l.toString(),
264
+ portalCssOverrides: (() => {
265
+ var _a2, _b2, _c2;
266
+ const overrides = (_c2 = (_a2 = opts.portalTheme) == null ? void 0 : _a2.cssOverrides) != null ? _c2 : (_b2 = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _b2.cssOverrides;
267
+ return overrides ? JSON.stringify(overrides) : void 0;
268
+ })(),
269
+ portalForegroundColor: ((_m = opts.portalTheme) == null ? void 0 : _m.accentColor) || ((_n = opts.portalTheme) == null ? void 0 : _n.foregroundColor) || ((_o = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _o.accentColor) || ((_p = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _p.foregroundColor) || (partner == null ? void 0 : partner.accentColor) || (partner == null ? void 0 : partner.foregroundColor),
270
+ portalBackgroundColor: ((_q = opts.portalTheme) == null ? void 0 : _q.backgroundColor) || ((_r = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _r.backgroundColor) || (partner == null ? void 0 : partner.backgroundColor) || __privateGet(this, _paraCoreInterface).portalBackgroundColor,
266
271
  portalPrimaryButtonColor: __privateGet(this, _paraCoreInterface).portalPrimaryButtonColor,
267
272
  portalTextColor: __privateGet(this, _paraCoreInterface).portalTextColor,
268
273
  portalPrimaryButtonTextColor: __privateGet(this, _paraCoreInterface).portalPrimaryButtonTextColor,
@@ -292,11 +297,12 @@ class PortalUrlService {
292
297
  }), isExportPrivateKey || isTxReview ? {
293
298
  sessionId: thisDevice.sessionId
294
299
  } : {});
295
- const url = (0, import_url.constructUrl)({ base, path, params });
300
+ const fullUrl = (0, import_url.constructUrl)({ base, path, params });
296
301
  if (opts.shorten) {
297
- return yield (0, import_url.shortenUrl)(__privateGet(this, _paraCoreInterface).ctx, url, shouldUseLegacyPortalUrl);
302
+ const shortUrl = yield (0, import_url.shortenUrl)(__privateGet(this, _paraCoreInterface).ctx, fullUrl, shouldUseLegacyPortalUrl);
303
+ return { url: shortUrl, fullUrl };
298
304
  }
299
- return url;
305
+ return { url: fullUrl, fullUrl };
300
306
  });
301
307
  this.getLoginUrl = (_0) => __async(this, [_0], function* ({ authMethod = "PASSKEY", shorten = false, portalTheme, sessionId }) {
302
308
  if (!sessionId) {
@@ -336,7 +342,8 @@ class PortalUrlService {
336
342
  }) {
337
343
  const sessionLookupId = _sessionLookupId != null ? _sessionLookupId : yield __privateGet(this, _authService).prepareLogin();
338
344
  if (!accountLinkInProgress && !__privateGet(this, _paraCoreInterface).isPortal()) {
339
- return yield this.constructPortalUrl("oAuth", { sessionId: sessionLookupId, oAuthMethod: method, appScheme });
345
+ const result = yield this.constructPortalUrl("oAuth", { sessionId: sessionLookupId, oAuthMethod: method, appScheme });
346
+ return result.url;
340
347
  }
341
348
  const [portalSessionLookupId, callback] = yield Promise.all([
342
349
  __privateGet(this, _paraCoreInterface).isPortal() ? __privateGet(this, _sessionManagementService).touchSession(true).then((s) => s.sessionLookupId) : Promise.resolve(void 0),
@@ -352,7 +359,7 @@ class PortalUrlService {
352
359
  params: portalCallbackParams,
353
360
  // Build callback for legacy portal if needed
354
361
  useLegacyUrl: typeof window !== "undefined" ? window.location.host.includes("usecapsule") : false
355
- })) : Promise.resolve(false)
362
+ })).then((r) => r.url) : Promise.resolve(false)
356
363
  ]);
357
364
  return (0, import_url.constructUrl)({
358
365
  base: (0, import_userManagementClient.getBaseOAuthUrl)(__privateGet(this, _paraCoreInterface).ctx.env),
@@ -223,13 +223,13 @@ class SessionManagementService {
223
223
  if (!__privateGet(this, _paraCoreInterface).loginEncryptionKeyPair) {
224
224
  yield __privateGet(this, _paraCoreInterface).setLoginEncryptionKeyPair();
225
225
  }
226
- const link = yield __privateGet(this, _portalUrlService).getLoginUrl({
226
+ const result = yield __privateGet(this, _portalUrlService).getLoginUrl({
227
227
  sessionId
228
228
  });
229
229
  if (shouldOpenPopup) {
230
- yield __privateGet(this, _paraCoreInterface).platformUtils.openPopup(link);
230
+ yield __privateGet(this, _paraCoreInterface).platformUtils.openPopup(result.url);
231
231
  }
232
- return link;
232
+ return result.url;
233
233
  });
234
234
  this.keepSessionAlive = () => __async(this, null, function* () {
235
235
  try {
@@ -96,29 +96,44 @@ class SignupFlowService extends import_BaseAuthFlowService.BaseAuthFlowService {
96
96
  signupAuthMethods
97
97
  });
98
98
  if (isPasskey) {
99
- const { url: passkeyUrl, credentialId: passkeyId } = yield this.services.authService.getNewCredentialAndUrl({
99
+ const {
100
+ url: passkeyUrl,
101
+ fullUrl: passkeyFullUrl,
102
+ credentialId: passkeyId
103
+ } = yield this.services.authService.getNewCredentialAndUrl({
100
104
  authMethod: "PASSKEY",
101
105
  shorten
102
106
  });
103
107
  if (passkeyUrl) signupState.passkeyUrl = passkeyUrl;
108
+ if (passkeyFullUrl) signupState.passkeyFullUrl = passkeyFullUrl;
104
109
  signupState.passkeyId = passkeyId;
105
110
  }
106
111
  if (isPassword) {
107
- const { url: passwordUrl, credentialId: passwordId } = yield this.services.authService.getNewCredentialAndUrl({
112
+ const {
113
+ url: passwordUrl,
114
+ fullUrl: passwordFullUrl,
115
+ credentialId: passwordId
116
+ } = yield this.services.authService.getNewCredentialAndUrl({
108
117
  authMethod: "PASSWORD",
109
118
  portalTheme,
110
119
  shorten
111
120
  });
112
121
  signupState.passwordUrl = passwordUrl;
122
+ if (passwordFullUrl) signupState.passwordFullUrl = passwordFullUrl;
113
123
  signupState.passwordId = passwordId;
114
124
  }
115
125
  if (isPIN) {
116
- const { url: pinUrl, credentialId: pinId } = yield this.services.authService.getNewCredentialAndUrl({
126
+ const {
127
+ url: pinUrl,
128
+ fullUrl: pinFullUrl,
129
+ credentialId: pinId
130
+ } = yield this.services.authService.getNewCredentialAndUrl({
117
131
  authMethod: "PIN",
118
132
  portalTheme,
119
133
  shorten
120
134
  });
121
135
  signupState.pinUrl = pinUrl;
136
+ if (pinFullUrl) signupState.pinFullUrl = pinFullUrl;
122
137
  signupState.pinId = pinId;
123
138
  }
124
139
  return signupState;
@@ -86,14 +86,19 @@ class VerificationFlowService extends import_BaseAuthFlowService.BaseAuthFlowSer
86
86
  this.services.authService.isEnclaveUser = isSLOPossible;
87
87
  yield this.paraCoreInterface.localStorageSetItem(import_constants.LOCAL_STORAGE_IS_ENCLAVE_USER, JSON.stringify(isSLOPossible));
88
88
  const isExternalWalletFullAuth = (_a = serverAuthState.externalWallet) == null ? void 0 : _a.withFullParaAuth;
89
- return __spreadValues(__spreadValues({}, serverAuthState), isSLOPossible || isExternalWalletFullAuth ? {
90
- loginUrl: yield this.services.portalUrlService.getLoginUrl({
89
+ let loginUrl;
90
+ let loginFullUrl;
91
+ if (isSLOPossible || isExternalWalletFullAuth) {
92
+ const result = yield this.services.portalUrlService.getLoginUrl({
91
93
  authMethod: import_user_management_client.AuthMethod.BASIC_LOGIN,
92
94
  sessionId: sessionLookupId,
93
95
  shorten,
94
96
  portalTheme
95
- })
96
- } : {});
97
+ });
98
+ loginUrl = result.url;
99
+ loginFullUrl = result.fullUrl;
100
+ }
101
+ return __spreadValues(__spreadValues({}, serverAuthState), loginUrl ? { loginUrl, loginFullUrl } : {});
97
102
  });
98
103
  this.performVerifyNewAccount = (params) => __async(this, null, function* () {
99
104
  this.services.authService.assertIsAuthSet(["email", "phone"]);
@@ -115,7 +115,7 @@ const _CoreStateManager = class _CoreStateManager {
115
115
  * Extracts all data needed by UI consumers from authStateResult.
116
116
  */
117
117
  computeAuthStateInfo(authContext, walletContext) {
118
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I;
119
119
  const defaultAuthStateInfo = {
120
120
  userId: null,
121
121
  isPasskeySupported: false,
@@ -124,11 +124,15 @@ const _CoreStateManager = class _CoreStateManager {
124
124
  hasPassword: false,
125
125
  hasPin: false,
126
126
  passkeyUrl: null,
127
+ passkeyFullUrl: null,
127
128
  passkeyKnownDeviceUrl: null,
128
129
  passwordUrl: null,
129
130
  pinUrl: null,
131
+ passwordFullUrl: null,
132
+ pinFullUrl: null,
130
133
  passkeyId: null,
131
134
  verificationUrl: null,
135
+ verificationFullUrl: null,
132
136
  externalWalletVerification: null,
133
137
  recoverySecret: null,
134
138
  isNewUser: false
@@ -158,10 +162,14 @@ const _CoreStateManager = class _CoreStateManager {
158
162
  let hasPin = false;
159
163
  let isPasskeySupported = false;
160
164
  let passkeyUrl = null;
165
+ let passkeyFullUrl = null;
161
166
  let passkeyKnownDeviceUrl = null;
162
167
  let passwordUrl = null;
163
168
  let pinUrl = null;
169
+ let passwordFullUrl = null;
170
+ let pinFullUrl = null;
164
171
  let verificationUrl = null;
172
+ let verificationFullUrl = null;
165
173
  let passkeyHints = null;
166
174
  let passkeyId = null;
167
175
  if (stage === "login") {
@@ -172,24 +180,31 @@ const _CoreStateManager = class _CoreStateManager {
172
180
  hasPin = authMethods.includes("PIN");
173
181
  isPasskeySupported = (_k = loginState.isPasskeySupported) != null ? _k : false;
174
182
  passkeyUrl = (_l = loginState.passkeyUrl) != null ? _l : null;
175
- passkeyKnownDeviceUrl = (_m = loginState.passkeyKnownDeviceUrl) != null ? _m : null;
176
- passwordUrl = (_n = loginState.passwordUrl) != null ? _n : null;
177
- pinUrl = (_o = loginState.pinUrl) != null ? _o : null;
178
- passkeyHints = (_p = loginState.biometricHints) != null ? _p : null;
183
+ passkeyFullUrl = (_m = loginState.passkeyFullUrl) != null ? _m : null;
184
+ passkeyKnownDeviceUrl = (_n = loginState.passkeyKnownDeviceUrl) != null ? _n : null;
185
+ passwordUrl = (_o = loginState.passwordUrl) != null ? _o : null;
186
+ pinUrl = (_p = loginState.pinUrl) != null ? _p : null;
187
+ passwordFullUrl = (_q = loginState.passwordFullUrl) != null ? _q : null;
188
+ pinFullUrl = (_r = loginState.pinFullUrl) != null ? _r : null;
189
+ passkeyHints = (_s = loginState.biometricHints) != null ? _s : null;
179
190
  } else if (stage === "signup") {
180
191
  const signupState = authStateResult;
181
- const authMethods = (_q = signupState.signupAuthMethods) != null ? _q : [];
192
+ const authMethods = (_t = signupState.signupAuthMethods) != null ? _t : [];
182
193
  hasPasskey = authMethods.includes("PASSKEY");
183
194
  hasPassword = authMethods.includes("PASSWORD");
184
195
  hasPin = authMethods.includes("PIN");
185
- isPasskeySupported = (_r = signupState.isPasskeySupported) != null ? _r : false;
186
- passkeyUrl = (_s = signupState.passkeyUrl) != null ? _s : null;
187
- passwordUrl = (_t = signupState.passwordUrl) != null ? _t : null;
188
- pinUrl = (_u = signupState.pinUrl) != null ? _u : null;
189
- passkeyId = (_v = signupState.passkeyId) != null ? _v : null;
196
+ isPasskeySupported = (_u = signupState.isPasskeySupported) != null ? _u : false;
197
+ passkeyUrl = (_v = signupState.passkeyUrl) != null ? _v : null;
198
+ passkeyFullUrl = (_w = signupState.passkeyFullUrl) != null ? _w : null;
199
+ passwordUrl = (_x = signupState.passwordUrl) != null ? _x : null;
200
+ pinUrl = (_y = signupState.pinUrl) != null ? _y : null;
201
+ passwordFullUrl = (_z = signupState.passwordFullUrl) != null ? _z : null;
202
+ pinFullUrl = (_A = signupState.pinFullUrl) != null ? _A : null;
203
+ passkeyId = (_B = signupState.passkeyId) != null ? _B : null;
190
204
  } else if (stage === "verify") {
191
205
  const verifyState = authStateResult;
192
- verificationUrl = (_w = verifyState.loginUrl) != null ? _w : null;
206
+ verificationUrl = (_C = verifyState.loginUrl) != null ? _C : null;
207
+ verificationFullUrl = (_D = verifyState.loginFullUrl) != null ? _D : null;
193
208
  }
194
209
  return {
195
210
  userId,
@@ -199,15 +214,19 @@ const _CoreStateManager = class _CoreStateManager {
199
214
  hasPassword,
200
215
  hasPin,
201
216
  passkeyUrl,
217
+ passkeyFullUrl,
202
218
  passkeyKnownDeviceUrl,
203
219
  passwordUrl,
204
220
  pinUrl,
221
+ passwordFullUrl,
222
+ pinFullUrl,
205
223
  passkeyId,
206
224
  verificationUrl,
225
+ verificationFullUrl,
207
226
  externalWalletVerification: externalWalletVerification ? {
208
- signatureVerificationMessage: (_x = externalWalletVerification.signatureVerificationMessage) != null ? _x : "",
209
- walletAddress: (_z = (_y = externalWalletVerification.externalWallet) == null ? void 0 : _y.address) != null ? _z : "",
210
- walletType: (_B = (_A = externalWalletVerification.externalWallet) == null ? void 0 : _A.type) != null ? _B : ""
227
+ signatureVerificationMessage: (_E = externalWalletVerification.signatureVerificationMessage) != null ? _E : "",
228
+ walletAddress: (_G = (_F = externalWalletVerification.externalWallet) == null ? void 0 : _F.address) != null ? _G : "",
229
+ walletType: (_I = (_H = externalWalletVerification.externalWallet) == null ? void 0 : _H.type) != null ? _I : ""
211
230
  } : null,
212
231
  recoverySecret,
213
232
  isNewUser
@@ -237,6 +256,7 @@ const _CoreStateManager = class _CoreStateManager {
237
256
  newWalletsResult: (walletMachineState == null ? void 0 : walletMachineState.context.newWalletsResult) || null,
238
257
  externalWalletSignVerification: (authMachineState == null ? void 0 : authMachineState.context.externalWalletSignVerification) || null,
239
258
  isNewUser: (authMachineState == null ? void 0 : authMachineState.context.isNewUser) || false,
259
+ selectedOAuthMethod: (authMachineState == null ? void 0 : authMachineState.context.selectedOAuthMethod) || null,
240
260
  // Wallet process
241
261
  guestWallets: (walletMachineState == null ? void 0 : walletMachineState.context.guestWallets) || null
242
262
  };
@@ -264,11 +284,11 @@ const _CoreStateManager = class _CoreStateManager {
264
284
  }
265
285
  statesEqual(state1, state2) {
266
286
  var _a, _b;
267
- return state1.phase === state2.phase && state1.authStatePhase === state2.authStatePhase && state1.walletStatePhase === state2.walletStatePhase && state1.isLoading === state2.isLoading && state1.isReady === state2.isReady && state1.isNewUser === state2.isNewUser && state1.needsWallet === state2.needsWallet && ((_a = state1.error) == null ? void 0 : _a.message) === ((_b = state2.error) == null ? void 0 : _b.message) && state1.authStateResult === state2.authStateResult && state1.newWalletsResult === state2.newWalletsResult && state1.guestWallets === state2.guestWallets && state1.externalWalletSignVerification === state2.externalWalletSignVerification && this.authStateInfoEqual(state1.authStateInfo, state2.authStateInfo);
287
+ return state1.phase === state2.phase && state1.authStatePhase === state2.authStatePhase && state1.walletStatePhase === state2.walletStatePhase && state1.isLoading === state2.isLoading && state1.isReady === state2.isReady && state1.isNewUser === state2.isNewUser && state1.needsWallet === state2.needsWallet && ((_a = state1.error) == null ? void 0 : _a.message) === ((_b = state2.error) == null ? void 0 : _b.message) && state1.authStateResult === state2.authStateResult && state1.newWalletsResult === state2.newWalletsResult && state1.guestWallets === state2.guestWallets && state1.externalWalletSignVerification === state2.externalWalletSignVerification && state1.selectedOAuthMethod === state2.selectedOAuthMethod && this.authStateInfoEqual(state1.authStateInfo, state2.authStateInfo);
268
288
  }
269
289
  authStateInfoEqual(a, b) {
270
290
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
271
- return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
291
+ return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyFullUrl === b.passkeyFullUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.passwordFullUrl === b.passwordFullUrl && a.pinUrl === b.pinUrl && a.pinFullUrl === b.pinFullUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.verificationFullUrl === b.verificationFullUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
272
292
  (hint, i) => hint.useragent === b.passkeyHints[i].useragent && hint.aaguid === b.passkeyHints[i].aaguid
273
293
  );
274
294
  }