@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
@@ -158,6 +158,7 @@ function createAuthStateMachine(paraCoreInterface) {
158
158
  shouldAutoCreateWallets: false,
159
159
  skipSessionRefreshOnSetup: false,
160
160
  isLegacy: false,
161
+ selectedOAuthMethod: null,
161
162
  retryAttempts: {},
162
163
  externalWalletInfo: void 0,
163
164
  externalWalletSignVerification: void 0
@@ -219,6 +220,7 @@ function createAuthStateMachine(paraCoreInterface) {
219
220
  shouldAutoCreateWallets: false,
220
221
  skipSessionRefreshOnSetup: false,
221
222
  isLegacy: false,
223
+ selectedOAuthMethod: null,
222
224
  retryAttempts: {}
223
225
  }),
224
226
  on: {
@@ -259,6 +261,7 @@ function createAuthStateMachine(paraCoreInterface) {
259
261
  }
260
262
  },
261
263
  unauthenticated: {
264
+ entry: [(0, import_xstate.assign)({ selectedOAuthMethod: null })],
262
265
  on: __spreadProps(__spreadValues({}, import_authStateMachine_helpers.AUTH_RESTART_TRANSITIONS), {
263
266
  INITIALIZE_GUEST_MODE: "guest_mode",
264
267
  SESSION_IMPORTED: "authenticated"
@@ -382,6 +385,12 @@ function createAuthStateMachine(paraCoreInterface) {
382
385
  };
383
386
  }
384
387
  return null;
388
+ },
389
+ selectedOAuthMethod: ({ event }) => {
390
+ if (event.type === "AUTHENTICATE_OAUTH") {
391
+ return event.data.method;
392
+ }
393
+ return null;
385
394
  }
386
395
  }),
387
396
  "setIsLegacy"
@@ -499,6 +499,7 @@ const _ParaCore = class _ParaCore {
499
499
  authPhase: state.authStatePhase,
500
500
  walletPhase: state.walletStatePhase,
501
501
  authStateInfo: state.authStateInfo,
502
+ selectedOAuthMethod: state.selectedOAuthMethod,
502
503
  error: state.error,
503
504
  isReady: state.isReady
504
505
  };
@@ -552,10 +553,11 @@ const _ParaCore = class _ParaCore {
552
553
  authPhase: state.authStatePhase,
553
554
  walletPhase: state.walletStatePhase,
554
555
  authStateInfo: state.authStateInfo,
556
+ selectedOAuthMethod: state.selectedOAuthMethod,
555
557
  error: state.error,
556
558
  isReady: state.isReady
557
559
  };
558
- if (!lastSnapshot || lastSnapshot.corePhase !== currentSnapshot.corePhase || lastSnapshot.authPhase !== currentSnapshot.authPhase || lastSnapshot.walletPhase !== currentSnapshot.walletPhase || lastSnapshot.error !== currentSnapshot.error || lastSnapshot.isReady !== currentSnapshot.isReady) {
560
+ 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) {
559
561
  lastSnapshot = currentSnapshot;
560
562
  callback(currentSnapshot);
561
563
  }
@@ -1806,10 +1808,10 @@ const _ParaCore = class _ParaCore {
1806
1808
  getSwitchWalletsUrl() {
1807
1809
  return __async(this, null, function* () {
1808
1810
  const authMethods = yield this.supportedUserAuthMethods();
1809
- const url = yield this.constructPortalUrl("switchWallets", {
1811
+ const result = yield this.constructPortalUrl("switchWallets", {
1810
1812
  useLegacyUrl: authMethods.has(AuthMethod.PASSKEY)
1811
1813
  });
1812
- return url;
1814
+ return result.url;
1813
1815
  });
1814
1816
  }
1815
1817
  /**
@@ -2078,22 +2080,24 @@ const _ParaCore = class _ParaCore {
2078
2080
  getTransactionReviewUrl(transactionId, timeoutMs) {
2079
2081
  return __async(this, null, function* () {
2080
2082
  const authMethods = yield this.supportedUserAuthMethods();
2081
- return this.constructPortalUrl("txReview", {
2083
+ const result = yield this.constructPortalUrl("txReview", {
2082
2084
  pathId: transactionId,
2083
2085
  useLegacyUrl: authMethods.has(AuthMethod.PASSKEY),
2084
2086
  params: {
2085
2087
  timeoutMs: timeoutMs == null ? void 0 : timeoutMs.toString()
2086
2088
  }
2087
2089
  });
2090
+ return result.url;
2088
2091
  });
2089
2092
  }
2090
2093
  getOnRampTransactionUrl(_0) {
2091
2094
  return __async(this, arguments, function* ({
2092
2095
  purchaseId
2093
2096
  }) {
2094
- return this.constructPortalUrl("onRamp", {
2097
+ const result = yield this.constructPortalUrl("onRamp", {
2095
2098
  pathId: purchaseId
2096
2099
  });
2100
+ return result.url;
2097
2101
  });
2098
2102
  }
2099
2103
  getWalletBalance(params) {
@@ -2599,12 +2603,13 @@ const _ParaCore = class _ParaCore {
2599
2603
  * @param {Object} opts the options object
2600
2604
  * @param {String} opts.auth - the user auth to sign up or log in with, in the form ` { email: string } | { phone: `+${number}` } `
2601
2605
  * @param {boolean} opts.useShortUrls - whether to shorten the generated portal URLs
2602
- * @param {Theme} opts.portalTheme the Para Portal theme to apply to the password creation URL, if other than the default theme
2606
+ * @param {PortalTheme} opts.portalTheme the Para Portal theme to apply to the password creation URL, if other than the default theme
2603
2607
  * @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
2604
2608
  */
2605
2609
  getLoginUrl(params) {
2606
2610
  return __async(this, null, function* () {
2607
- return yield __privateGet(this, _portalUrlService).getLoginUrl(params);
2611
+ const result = yield __privateGet(this, _portalUrlService).getLoginUrl(params);
2612
+ return result.url;
2608
2613
  });
2609
2614
  }
2610
2615
  prepareLogin() {
@@ -2760,7 +2765,8 @@ const _ParaCore = class _ParaCore {
2760
2765
  sendLoginCode() {
2761
2766
  return __async(this, null, function* () {
2762
2767
  const { userId } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2763
- this.setUserId(userId);
2768
+ yield this.setUserId(userId);
2769
+ return { userId };
2764
2770
  });
2765
2771
  }
2766
2772
  exportPrivateKey() {
@@ -2786,10 +2792,11 @@ const _ParaCore = class _ParaCore {
2786
2792
  this.popupWindow = yield this.platformUtils.openPopup("about:blank", { type: PopupType.EXPORT_PRIVATE_KEY });
2787
2793
  }
2788
2794
  const authMethods = yield this.supportedUserAuthMethods();
2789
- const exportPrivateKeyUrl = yield this.constructPortalUrl("exportPrivateKey", {
2795
+ const exportPrivateKeyResult = yield this.constructPortalUrl("exportPrivateKey", {
2790
2796
  pathId: walletId,
2791
2797
  useLegacyUrl: authMethods.has(AuthMethod.PASSKEY)
2792
2798
  });
2799
+ const exportPrivateKeyUrl = exportPrivateKeyResult.url;
2793
2800
  if (args.shouldOpenPopup) {
2794
2801
  this.popupWindow.location.href = exportPrivateKeyUrl;
2795
2802
  }
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "2.25.0";
2
+ const PARA_CORE_VERSION = "3.0.0-alpha.0";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
@@ -599,7 +599,7 @@ class AuthService {
599
599
  }
600
600
  }
601
601
  const { sessionId } = yield __privateGet(this, _sessionManagementService).touchSession();
602
- const url = (isForNewDevice || urlType) && (yield __privateGet(this, _portalUrlService).constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
602
+ const result = (isForNewDevice || urlType) && (yield __privateGet(this, _portalUrlService).constructPortalUrl(isForNewDevice ? "addNewCredential" : urlType, {
603
603
  isForNewDevice,
604
604
  pathId: credentialId,
605
605
  portalTheme,
@@ -609,7 +609,7 @@ class AuthService {
609
609
  addNewCredentialPasskeyId: passkeyId,
610
610
  addNewCredentialPasswordId: passwordId
611
611
  }));
612
- return __spreadValues({ credentialId }, url ? { url } : {});
612
+ return __spreadValues({ credentialId }, result ? { url: result.url, fullUrl: result.fullUrl } : {});
613
613
  });
614
614
  this.addCredential = (_0) => __async(this, [_0], function* ({ authMethod }) {
615
615
  if (authMethod === "PASSKEY" && !(yield __privateGet(this, _paraCoreInterface).isPasskeySupported())) {
@@ -25,16 +25,19 @@ class LoginFlowService extends BaseAuthFlowService {
25
25
  const isPasskeyPossible = loginAuthMethods.includes(AuthMethod.PASSKEY) && !this.paraCoreInterface.isNativePasskey;
26
26
  const isPasswordPossible = loginAuthMethods.includes(AuthMethod.PASSWORD) && hasPasswordWithoutPIN;
27
27
  const isPINPossible = loginAuthMethods.includes(AuthMethod.PIN);
28
- return __spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({}, authState), {
28
+ const result = __spreadProps(__spreadValues({}, authState), {
29
29
  isPasskeySupported,
30
30
  loginAuthMethods
31
- }), isPasskeyPossible ? {
32
- passkeyUrl: yield this.services.portalUrlService.getLoginUrl({
31
+ });
32
+ if (isPasskeyPossible) {
33
+ const passkeyResult = yield this.services.portalUrlService.getLoginUrl({
33
34
  sessionId: sessionLookupId,
34
35
  shorten,
35
36
  portalTheme
36
- }),
37
- passkeyKnownDeviceUrl: yield this.services.portalUrlService.constructPortalUrl("loginAuth", {
37
+ });
38
+ result.passkeyUrl = passkeyResult.url;
39
+ result.passkeyFullUrl = passkeyResult.fullUrl;
40
+ const knownDeviceResult = yield this.services.portalUrlService.constructPortalUrl("loginAuth", {
38
41
  sessionId: sessionLookupId,
39
42
  newDevice: {
40
43
  sessionId: sessionLookupId,
@@ -42,22 +45,30 @@ class LoginFlowService extends BaseAuthFlowService {
42
45
  },
43
46
  shorten,
44
47
  portalTheme
45
- })
46
- } : {}), isPasswordPossible ? {
47
- passwordUrl: yield this.services.portalUrlService.constructPortalUrl("loginPassword", {
48
+ });
49
+ result.passkeyKnownDeviceUrl = knownDeviceResult.url;
50
+ }
51
+ if (isPasswordPossible) {
52
+ const passwordResult = yield this.services.portalUrlService.constructPortalUrl("loginPassword", {
48
53
  sessionId: sessionLookupId,
49
54
  shorten,
50
55
  portalTheme,
51
56
  params: { isEmbedded: `${!serverAuthState.isWalletSelectionNeeded}` }
52
- })
53
- } : {}), isPINPossible ? {
54
- pinUrl: yield this.services.portalUrlService.constructPortalUrl("loginPIN", {
57
+ });
58
+ result.passwordUrl = passwordResult.url;
59
+ result.passwordFullUrl = passwordResult.fullUrl;
60
+ }
61
+ if (isPINPossible) {
62
+ const pinResult = yield this.services.portalUrlService.constructPortalUrl("loginPIN", {
55
63
  sessionId: sessionLookupId,
56
64
  shorten,
57
65
  portalTheme,
58
66
  params: { isEmbedded: `${!serverAuthState.isWalletSelectionNeeded}` }
59
- })
60
- } : {});
67
+ });
68
+ result.pinUrl = pinResult.url;
69
+ result.pinFullUrl = pinResult.fullUrl;
70
+ }
71
+ return result;
61
72
  });
62
73
  this.waitForLogin = (params) => __async(this, null, function* () {
63
74
  this.stateManager.send({
@@ -185,15 +185,15 @@ class PollingService {
185
185
  yield __privateGet(this, _openOAuthPopup).call(this);
186
186
  }
187
187
  yield __privateGet(this, _authService).prepareLogin();
188
- const oAuthUrl = yield __privateGet(this, _portalUrlService).constructPortalUrl(config.portalUrlType, {
188
+ const oAuthResult = yield __privateGet(this, _portalUrlService).constructPortalUrl(config.portalUrlType, {
189
189
  portalTheme,
190
190
  shorten: useShortUrls,
191
191
  appScheme
192
192
  });
193
193
  if (onOAuthUrl) {
194
- onOAuthUrl(oAuthUrl);
194
+ onOAuthUrl(oAuthResult.url, oAuthResult.fullUrl);
195
195
  } else if (!!__privateGet(this, _paraCoreInterface).popupWindow) {
196
- __privateGet(this, _paraCoreInterface).popupWindow.location.href = oAuthUrl;
196
+ __privateGet(this, _paraCoreInterface).popupWindow.location.href = oAuthResult.url;
197
197
  onOAuthPopup(__privateGet(this, _paraCoreInterface).popupWindow);
198
198
  }
199
199
  return new Promise((resolve, reject) => {
@@ -53,7 +53,7 @@ class PortalUrlService {
53
53
  return __privateGet(this, _paraCoreInterface).ctx.portalUrlOverride || (yield this.getPartnerURL()) || getPortalBaseURL(__privateGet(this, _paraCoreInterface).ctx, false, false, isLegacy);
54
54
  });
55
55
  this.constructPortalUrl = (_0, ..._1) => __async(this, [_0, ..._1], function* (type, opts = {}) {
56
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
56
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
57
57
  const [
58
58
  isCreate,
59
59
  isLogin,
@@ -98,82 +98,83 @@ class PortalUrlService {
98
98
  }
99
99
  const shouldUseLegacyPortalUrl = opts.useLegacyUrl || !!opts.addNewCredentialPasskeyId || type === "loginAuth";
100
100
  const base = type === "onRamp" || isTelegramLogin ? __privateGet(this, _paraCoreInterface).ctx.portalUrlOverride || getPortalBaseURL(__privateGet(this, _paraCoreInterface).ctx, isTelegramLogin, false, shouldUseLegacyPortalUrl) : yield this.getPortalURL(shouldUseLegacyPortalUrl);
101
+ const userId = __privateGet(this, _authService).userId;
101
102
  let path;
102
103
  switch (type) {
104
+ case "createAuth": {
105
+ path = `/v2/create/${userId}/passkey/${opts.pathId}`;
106
+ break;
107
+ }
103
108
  case "createPassword": {
104
- path = `/web/users/${__privateGet(this, _authService).userId}/passwords/${opts.pathId}`;
109
+ path = `/v2/create/${userId}/password/${opts.pathId}`;
105
110
  break;
106
111
  }
107
112
  case "createPIN": {
108
- path = `/web/users/${__privateGet(this, _authService).userId}/pin/${opts.pathId}`;
113
+ path = `/v2/create/${userId}/pin/${opts.pathId}`;
109
114
  break;
110
115
  }
111
- case "createAuth": {
112
- path = `/web/users/${__privateGet(this, _authService).userId}/biometrics/${opts.pathId}`;
116
+ case "loginAuth": {
117
+ path = "/v2/login/passkey";
113
118
  break;
114
119
  }
115
120
  case "loginPassword": {
116
- path = "/web/passwords/login";
117
- break;
118
- }
119
- case "loginAuth": {
120
- path = "/web/biometrics/login";
121
+ path = "/v2/login/password";
121
122
  break;
122
123
  }
123
124
  case "loginPIN": {
124
- path = "/web/pin/login";
125
+ path = "/v2/login/pin";
125
126
  break;
126
127
  }
127
- case "txReview": {
128
- path = `/web/users/${__privateGet(this, _authService).userId}/transaction-review/${opts.pathId}`;
128
+ case "loginOTP": {
129
+ path = "/v2/login/otp";
129
130
  break;
130
131
  }
131
- case "onRamp": {
132
- path = `/web/users/${__privateGet(this, _authService).userId}/on-ramp-transaction/v2/${opts.pathId}`;
132
+ case "telegramLogin": {
133
+ path = "/v2/login/telegram";
133
134
  break;
134
135
  }
135
136
  case "telegramLoginVerify": {
136
- path = `/auth/telegram/verify`;
137
+ path = "/v2/login/telegram/verify";
137
138
  break;
138
139
  }
139
- case "telegramLogin": {
140
- path = `/auth/telegram`;
140
+ case "loginFarcaster": {
141
+ path = "/v2/login/farcaster";
141
142
  break;
142
143
  }
143
144
  case "oAuth": {
144
- path = `/auth/${opts.oAuthMethod.toLowerCase()}`;
145
+ path = `/v2/login/${opts.oAuthMethod.toLowerCase()}`;
145
146
  break;
146
147
  }
147
148
  case "oAuthCallback": {
148
- path = `/auth/${opts.oAuthMethod.toLowerCase()}/callback`;
149
+ path = `/v2/login/${opts.oAuthMethod.toLowerCase()}/callback`;
149
150
  break;
150
151
  }
151
- case "loginOTP": {
152
- path = "/auth/otp";
153
- break;
154
- }
155
- case "loginFarcaster": {
156
- path = "/auth/farcaster";
152
+ case "loginExternalWallet": {
153
+ path = "/v2/login/external-wallet";
157
154
  break;
158
155
  }
159
- case "switchWallets": {
160
- path = `/auth/wallets`;
156
+ case "txReview": {
157
+ path = `/v2/wallet/${userId}/transaction/${opts.pathId}`;
161
158
  break;
162
159
  }
163
- case "addNewCredential": {
164
- path = "/auth/add-new-credential";
160
+ case "onRamp": {
161
+ path = `/v2/wallet/${userId}/on-ramp/${opts.pathId}`;
165
162
  break;
166
163
  }
167
164
  case "exportPrivateKey": {
168
- path = `/web/users/${__privateGet(this, _authService).userId}/private-key/${opts.pathId}`;
165
+ path = `/v2/wallet/${userId}/export-key/${opts.pathId}`;
169
166
  break;
170
167
  }
171
- case "loginExternalWallet": {
172
- path = "/auth/external-wallet";
168
+ case "switchWallets": {
169
+ path = "/v2/wallet/switch";
173
170
  break;
174
171
  }
175
172
  case "connectExternalWallet": {
176
- path = "/auth/connect-external-wallet";
173
+ path = "/v2/wallet/connect-external";
174
+ break;
175
+ }
176
+ case "addNewCredential": {
177
+ path = "/v2/account/add-credential";
177
178
  break;
178
179
  }
179
180
  default: {
@@ -196,15 +197,19 @@ class PortalUrlService {
196
197
  };
197
198
  const params = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
198
199
  apiKey: __privateGet(this, _paraCoreInterface).ctx.apiKey,
199
- origin: typeof window !== "undefined" ? window.location.origin : void 0,
200
200
  partnerId: partner == null ? void 0 : partner.id
201
201
  }, typeof window !== "undefined" && ((_b = window.location) == null ? void 0 : _b.origin) ? { origin: window.location.origin } : {}), {
202
202
  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),
203
203
  portalBorderRadius: ((_e = opts.portalTheme) == null ? void 0 : _e.borderRadius) || ((_f = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _f.borderRadius),
204
204
  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),
205
- 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),
206
- 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),
207
- 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,
205
+ 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(),
206
+ portalCssOverrides: (() => {
207
+ var _a2, _b2, _c2;
208
+ const overrides = (_c2 = (_a2 = opts.portalTheme) == null ? void 0 : _a2.cssOverrides) != null ? _c2 : (_b2 = __privateGet(this, _paraCoreInterface).portalTheme) == null ? void 0 : _b2.cssOverrides;
209
+ return overrides ? JSON.stringify(overrides) : void 0;
210
+ })(),
211
+ 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),
212
+ 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,
208
213
  portalPrimaryButtonColor: __privateGet(this, _paraCoreInterface).portalPrimaryButtonColor,
209
214
  portalTextColor: __privateGet(this, _paraCoreInterface).portalTextColor,
210
215
  portalPrimaryButtonTextColor: __privateGet(this, _paraCoreInterface).portalPrimaryButtonTextColor,
@@ -234,11 +239,12 @@ class PortalUrlService {
234
239
  }), isExportPrivateKey || isTxReview ? {
235
240
  sessionId: thisDevice.sessionId
236
241
  } : {});
237
- const url = constructUrl({ base, path, params });
242
+ const fullUrl = constructUrl({ base, path, params });
238
243
  if (opts.shorten) {
239
- return yield shortenUrl(__privateGet(this, _paraCoreInterface).ctx, url, shouldUseLegacyPortalUrl);
244
+ const shortUrl = yield shortenUrl(__privateGet(this, _paraCoreInterface).ctx, fullUrl, shouldUseLegacyPortalUrl);
245
+ return { url: shortUrl, fullUrl };
240
246
  }
241
- return url;
247
+ return { url: fullUrl, fullUrl };
242
248
  });
243
249
  this.getLoginUrl = (_0) => __async(this, [_0], function* ({ authMethod = "PASSKEY", shorten = false, portalTheme, sessionId }) {
244
250
  if (!sessionId) {
@@ -278,7 +284,8 @@ class PortalUrlService {
278
284
  }) {
279
285
  const sessionLookupId = _sessionLookupId != null ? _sessionLookupId : yield __privateGet(this, _authService).prepareLogin();
280
286
  if (!accountLinkInProgress && !__privateGet(this, _paraCoreInterface).isPortal()) {
281
- return yield this.constructPortalUrl("oAuth", { sessionId: sessionLookupId, oAuthMethod: method, appScheme });
287
+ const result = yield this.constructPortalUrl("oAuth", { sessionId: sessionLookupId, oAuthMethod: method, appScheme });
288
+ return result.url;
282
289
  }
283
290
  const [portalSessionLookupId, callback] = yield Promise.all([
284
291
  __privateGet(this, _paraCoreInterface).isPortal() ? __privateGet(this, _sessionManagementService).touchSession(true).then((s) => s.sessionLookupId) : Promise.resolve(void 0),
@@ -294,7 +301,7 @@ class PortalUrlService {
294
301
  params: portalCallbackParams,
295
302
  // Build callback for legacy portal if needed
296
303
  useLegacyUrl: typeof window !== "undefined" ? window.location.host.includes("usecapsule") : false
297
- })) : Promise.resolve(false)
304
+ })).then((r) => r.url) : Promise.resolve(false)
298
305
  ]);
299
306
  return constructUrl({
300
307
  base: getBaseOAuthUrl(__privateGet(this, _paraCoreInterface).ctx.env),
@@ -180,13 +180,13 @@ class SessionManagementService {
180
180
  if (!__privateGet(this, _paraCoreInterface).loginEncryptionKeyPair) {
181
181
  yield __privateGet(this, _paraCoreInterface).setLoginEncryptionKeyPair();
182
182
  }
183
- const link = yield __privateGet(this, _portalUrlService).getLoginUrl({
183
+ const result = yield __privateGet(this, _portalUrlService).getLoginUrl({
184
184
  sessionId
185
185
  });
186
186
  if (shouldOpenPopup) {
187
- yield __privateGet(this, _paraCoreInterface).platformUtils.openPopup(link);
187
+ yield __privateGet(this, _paraCoreInterface).platformUtils.openPopup(result.url);
188
188
  }
189
- return link;
189
+ return result.url;
190
190
  });
191
191
  this.keepSessionAlive = () => __async(this, null, function* () {
192
192
  try {
@@ -31,29 +31,44 @@ class SignupFlowService extends BaseAuthFlowService {
31
31
  signupAuthMethods
32
32
  });
33
33
  if (isPasskey) {
34
- const { url: passkeyUrl, credentialId: passkeyId } = yield this.services.authService.getNewCredentialAndUrl({
34
+ const {
35
+ url: passkeyUrl,
36
+ fullUrl: passkeyFullUrl,
37
+ credentialId: passkeyId
38
+ } = yield this.services.authService.getNewCredentialAndUrl({
35
39
  authMethod: "PASSKEY",
36
40
  shorten
37
41
  });
38
42
  if (passkeyUrl) signupState.passkeyUrl = passkeyUrl;
43
+ if (passkeyFullUrl) signupState.passkeyFullUrl = passkeyFullUrl;
39
44
  signupState.passkeyId = passkeyId;
40
45
  }
41
46
  if (isPassword) {
42
- const { url: passwordUrl, credentialId: passwordId } = yield this.services.authService.getNewCredentialAndUrl({
47
+ const {
48
+ url: passwordUrl,
49
+ fullUrl: passwordFullUrl,
50
+ credentialId: passwordId
51
+ } = yield this.services.authService.getNewCredentialAndUrl({
43
52
  authMethod: "PASSWORD",
44
53
  portalTheme,
45
54
  shorten
46
55
  });
47
56
  signupState.passwordUrl = passwordUrl;
57
+ if (passwordFullUrl) signupState.passwordFullUrl = passwordFullUrl;
48
58
  signupState.passwordId = passwordId;
49
59
  }
50
60
  if (isPIN) {
51
- const { url: pinUrl, credentialId: pinId } = yield this.services.authService.getNewCredentialAndUrl({
61
+ const {
62
+ url: pinUrl,
63
+ fullUrl: pinFullUrl,
64
+ credentialId: pinId
65
+ } = yield this.services.authService.getNewCredentialAndUrl({
52
66
  authMethod: "PIN",
53
67
  portalTheme,
54
68
  shorten
55
69
  });
56
70
  signupState.pinUrl = pinUrl;
71
+ if (pinFullUrl) signupState.pinFullUrl = pinFullUrl;
57
72
  signupState.pinId = pinId;
58
73
  }
59
74
  return signupState;
@@ -23,14 +23,19 @@ class VerificationFlowService extends BaseAuthFlowService {
23
23
  this.services.authService.isEnclaveUser = isSLOPossible;
24
24
  yield this.paraCoreInterface.localStorageSetItem(LOCAL_STORAGE_IS_ENCLAVE_USER, JSON.stringify(isSLOPossible));
25
25
  const isExternalWalletFullAuth = (_a = serverAuthState.externalWallet) == null ? void 0 : _a.withFullParaAuth;
26
- return __spreadValues(__spreadValues({}, serverAuthState), isSLOPossible || isExternalWalletFullAuth ? {
27
- loginUrl: yield this.services.portalUrlService.getLoginUrl({
26
+ let loginUrl;
27
+ let loginFullUrl;
28
+ if (isSLOPossible || isExternalWalletFullAuth) {
29
+ const result = yield this.services.portalUrlService.getLoginUrl({
28
30
  authMethod: AuthMethod.BASIC_LOGIN,
29
31
  sessionId: sessionLookupId,
30
32
  shorten,
31
33
  portalTheme
32
- })
33
- } : {});
34
+ });
35
+ loginUrl = result.url;
36
+ loginFullUrl = result.fullUrl;
37
+ }
38
+ return __spreadValues(__spreadValues({}, serverAuthState), loginUrl ? { loginUrl, loginFullUrl } : {});
34
39
  });
35
40
  this.performVerifyNewAccount = (params) => __async(this, null, function* () {
36
41
  this.services.authService.assertIsAuthSet(["email", "phone"]);