@thunderid/javascript 1.10.3 → 1.12.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 (40) hide show
  1. package/dist/api/auth/executeEmbeddedDeviceGrantFlow.d.ts.map +1 -1
  2. package/dist/api/auth/executeEmbeddedSelfFlow.d.ts +57 -0
  3. package/dist/api/auth/executeEmbeddedSelfFlow.d.ts.map +1 -0
  4. package/dist/cjs/index.cjs +414 -6
  5. package/dist/constants/AttributeVerificationConstants.d.ts +13 -0
  6. package/dist/constants/AttributeVerificationConstants.d.ts.map +1 -0
  7. package/dist/edge/index.js +407 -7
  8. package/dist/i18n/models/i18n.d.ts +14 -0
  9. package/dist/i18n/models/i18n.d.ts.map +1 -1
  10. package/dist/i18n/translations/en-US.d.ts.map +1 -1
  11. package/dist/i18n/translations/fr-FR.d.ts.map +1 -1
  12. package/dist/i18n/translations/hi-IN.d.ts.map +1 -1
  13. package/dist/i18n/translations/ja-JP.d.ts.map +1 -1
  14. package/dist/i18n/translations/pt-BR.d.ts.map +1 -1
  15. package/dist/i18n/translations/pt-PT.d.ts.map +1 -1
  16. package/dist/i18n/translations/si-LK.d.ts.map +1 -1
  17. package/dist/i18n/translations/ta-IN.d.ts.map +1 -1
  18. package/dist/i18n/translations/te-IN.d.ts.map +1 -1
  19. package/dist/index.d.ts +14 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +407 -7
  22. package/dist/models/embedded-flow.d.ts +3 -0
  23. package/dist/models/embedded-flow.d.ts.map +1 -1
  24. package/dist/models/embedded-self-flow.d.ts +75 -0
  25. package/dist/models/embedded-self-flow.d.ts.map +1 -0
  26. package/dist/models/extensions/components.d.ts +1 -1
  27. package/dist/models/extensions/components.d.ts.map +1 -1
  28. package/dist/models/user.d.ts +9 -0
  29. package/dist/models/user.d.ts.map +1 -1
  30. package/dist/utils/compileConsentDecisions.d.ts +14 -0
  31. package/dist/utils/compileConsentDecisions.d.ts.map +1 -0
  32. package/dist/utils/getFlowStepComponents.d.ts +26 -0
  33. package/dist/utils/getFlowStepComponents.d.ts.map +1 -0
  34. package/dist/utils/getVerifiedAttributes.d.ts +14 -0
  35. package/dist/utils/getVerifiedAttributes.d.ts.map +1 -0
  36. package/dist/utils/isVerifiableAttribute.d.ts +22 -0
  37. package/dist/utils/isVerifiableAttribute.d.ts.map +1 -0
  38. package/dist/utils/parseSelfFlowRequest.d.ts +24 -0
  39. package/dist/utils/parseSelfFlowRequest.d.ts.map +1 -0
  40. package/package.json +1 -1
@@ -888,6 +888,7 @@ let EmbeddedFlowType = /* @__PURE__ */ function(EmbeddedFlowType$1) {
888
888
  EmbeddedFlowType$1["DeviceGrant"] = "DEVICE_GRANT";
889
889
  EmbeddedFlowType$1["Recovery"] = "RECOVERY";
890
890
  EmbeddedFlowType$1["Registration"] = "REGISTRATION";
891
+ EmbeddedFlowType$1["Self"] = "SELF";
891
892
  EmbeddedFlowType$1["UserOnboarding"] = "USER_ONBOARDING";
892
893
  return EmbeddedFlowType$1;
893
894
  }({});
@@ -944,6 +945,8 @@ let EmbeddedFlowComponentType = /* @__PURE__ */ function(EmbeddedFlowComponentTy
944
945
  EmbeddedFlowComponentType$1["PasswordInput"] = "PASSWORD_INPUT";
945
946
  /** Phone number input field with country code support */
946
947
  EmbeddedFlowComponentType$1["PhoneInput"] = "PHONE_INPUT";
948
+ /** Resend action that asks the server to send a new code, without submitting the step's inputs */
949
+ EmbeddedFlowComponentType$1["Resend"] = "RESEND";
947
950
  /** Rich text display component that renders formatted HTML content */
948
951
  EmbeddedFlowComponentType$1["RichText"] = "RICH_TEXT";
949
952
  /** Select/dropdown input component for single choice selection */
@@ -1113,7 +1116,33 @@ const executeEmbeddedDeviceGrantFlow = async ({ baseUrl, payload, url,...request
1113
1116
  },
1114
1117
  method: requestConfig.method ?? "POST"
1115
1118
  });
1116
- if (!response.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedDeviceGrantFlow-FlowError-001", "javascript", response.status, response.statusText);
1119
+ if (!response.ok) {
1120
+ const errorText = await response.text();
1121
+ let errorResponse;
1122
+ try {
1123
+ const parsed = JSON.parse(errorText);
1124
+ if (typeof parsed === "object" && parsed !== null) errorResponse = parsed;
1125
+ } catch {}
1126
+ const errorData = errorResponse?.["data"];
1127
+ const additionalData$1 = typeof errorData === "object" && errorData !== null ? errorData["additionalData"] : void 0;
1128
+ const errorAssertion = errorResponse?.["errorAssertion"];
1129
+ const authId$1 = typeof additionalData$1 === "object" && additionalData$1 !== null ? additionalData$1["authId"] : void 0;
1130
+ const callbackType$1 = typeof additionalData$1 === "object" && additionalData$1 !== null ? additionalData$1["callbackType"] : void 0;
1131
+ if (typeof errorAssertion === "string" && typeof authId$1 === "string" && typeof callbackType$1 === "string" && errorResponse) {
1132
+ const redirectUri = (await postAuthCallback(callbackUrl, {
1133
+ assertion: errorAssertion,
1134
+ authId: authId$1,
1135
+ type: callbackType$1
1136
+ }, requestConfig.headers, true))["redirect_uri"];
1137
+ return {
1138
+ ...errorResponse,
1139
+ errorAssertion,
1140
+ flowStatus: EmbeddedSignInFlowStatus.Error,
1141
+ ...typeof redirectUri === "string" ? { redirectUrl: redirectUri } : {}
1142
+ };
1143
+ }
1144
+ throw new ThunderIDAPIError(errorText, "executeEmbeddedDeviceGrantFlow-FlowError-001", "javascript", response.status, response.statusText);
1145
+ }
1117
1146
  const flowResponse = await response.json();
1118
1147
  const additionalData = flowResponse.data?.additionalData;
1119
1148
  const authId = additionalData?.["authId"];
@@ -1401,6 +1430,73 @@ const executeEmbeddedUserOnboardingFlow = async ({ url, baseUrl, payload,...requ
1401
1430
  };
1402
1431
  var executeEmbeddedUserOnboardingFlow_default = executeEmbeddedUserOnboardingFlow;
1403
1432
 
1433
+ //#endregion
1434
+ //#region src/api/auth/executeEmbeddedSelfFlow.ts
1435
+ /**
1436
+ * Executes one step of a `SELF` flow, an operation the signed-in user performs on their own
1437
+ * account, such as verifying their email address. A new execution names the flow by its handle; the
1438
+ * server takes the user from the access token on that first request and keeps it for the execution.
1439
+ *
1440
+ * @param config - Configuration object with URL, payload, fetcher and optional request config.
1441
+ * @returns A promise that resolves with the flow step.
1442
+ * @throws ThunderIDAPIError when the input is invalid or the request fails, coded
1443
+ * `executeEmbeddedSelfFlow-` plus `ValidationError-001` (invalid `url` or `baseUrl`), `ValidationError-002`
1444
+ * (no payload), `ValidationError-003` (a new flow without a handle), `ResponseError-001` (the server refused, with
1445
+ * its status) or `NetworkError-001` (no response, or an unreadable one).
1446
+ *
1447
+ * @example
1448
+ * ```typescript
1449
+ * const step = await executeEmbeddedSelfFlow({
1450
+ * baseUrl: 'https://localhost:8090',
1451
+ * payload: {
1452
+ * flowType: 'SELF',
1453
+ * handle: 'default-self-attribute-verification-flow',
1454
+ * inputs: {attribute: 'email'},
1455
+ * },
1456
+ * fetcher: authenticatedFetcher,
1457
+ * });
1458
+ *
1459
+ * await executeEmbeddedSelfFlow({
1460
+ * baseUrl: 'https://localhost:8090',
1461
+ * payload: {executionId: step.executionId, action: 'verify', inputs: {otp: '123456'}},
1462
+ * fetcher: authenticatedFetcher,
1463
+ * });
1464
+ * ```
1465
+ */
1466
+ const executeEmbeddedSelfFlow = async ({ url, baseUrl, payload, fetcher,...requestConfig }) => {
1467
+ try {
1468
+ new URL(url ?? baseUrl);
1469
+ } catch (error$1) {
1470
+ throw new ThunderIDAPIError(`Invalid URL provided. ${error$1 instanceof Error ? error$1.message : String(error$1)}`, "executeEmbeddedSelfFlow-ValidationError-001", "javascript", 400, "The provided `url` or `baseUrl` path does not adhere to the URL schema.");
1471
+ }
1472
+ if (!payload) throw new ThunderIDAPIError("SELF flow payload is required", "executeEmbeddedSelfFlow-ValidationError-002", "javascript", 400, "If a SELF flow payload is not provided, the request cannot be constructed correctly.");
1473
+ if (!payload.executionId && !payload.handle) throw new ThunderIDAPIError("The flow handle is required", "executeEmbeddedSelfFlow-ValidationError-003", "javascript", 400, "A new SELF flow must name the flow to start by its handle.");
1474
+ const fetchFn = fetcher ?? fetch;
1475
+ const resolvedUrl = url ?? `${baseUrl}/flow/execute`;
1476
+ const requestInit = {
1477
+ ...requestConfig,
1478
+ body: JSON.stringify({
1479
+ ...payload,
1480
+ verbose: true
1481
+ }),
1482
+ headers: {
1483
+ ...requestConfig.headers,
1484
+ Accept: "application/json",
1485
+ "Content-Type": "application/json"
1486
+ },
1487
+ method: "POST"
1488
+ };
1489
+ try {
1490
+ const response = await fetchFn(resolvedUrl, requestInit);
1491
+ if (!response?.ok) throw new ThunderIDAPIError(await response.text(), "executeEmbeddedSelfFlow-ResponseError-001", "javascript", response.status, response.statusText, "SELF flow request failed");
1492
+ return await response.json();
1493
+ } catch (error$1) {
1494
+ if (error$1 instanceof ThunderIDAPIError) throw error$1;
1495
+ throw new ThunderIDAPIError(`Network or parsing error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`, "executeEmbeddedSelfFlow-NetworkError-001", "javascript", 0, "Network Error");
1496
+ }
1497
+ };
1498
+ var executeEmbeddedSelfFlow_default = executeEmbeddedSelfFlow;
1499
+
1404
1500
  //#endregion
1405
1501
  //#region src/api/auth/getFlowMeta.ts
1406
1502
  /**
@@ -7141,6 +7237,21 @@ const SelectConstants = {
7141
7237
  };
7142
7238
  var SelectConstants_default = SelectConstants;
7143
7239
 
7240
+ //#endregion
7241
+ //#region src/constants/AttributeVerificationConstants.ts
7242
+ /**
7243
+ * Wire names and eligibility rules for self user attribute verification.
7244
+ */
7245
+ const AttributeVerificationConstants = {
7246
+ ATTRIBUTE_INPUT: "attribute",
7247
+ DEFAULT_FLOW_HANDLE: "default-self-attribute-verification-flow",
7248
+ MASKED_DESTINATION_KEY: "maskedDestination",
7249
+ VERIFIABLE_ATTRIBUTE_TYPES: ["email", "mobile"],
7250
+ VERIFIED_ATTRIBUTES_KEY: "verifiedAttributes",
7251
+ VERIFY_AFTER_SAVE_ATTRIBUTE_TYPES: ["email"]
7252
+ };
7253
+ var AttributeVerificationConstants_default = AttributeVerificationConstants;
7254
+
7144
7255
  //#endregion
7145
7256
  //#region src/errors/ThunderIDRuntimeError.ts
7146
7257
  /**
@@ -7227,6 +7338,29 @@ let EmbeddedRecoveryFlowType = /* @__PURE__ */ function(EmbeddedRecoveryFlowType
7227
7338
  return EmbeddedRecoveryFlowType$1;
7228
7339
  }({});
7229
7340
 
7341
+ //#endregion
7342
+ //#region src/models/embedded-self-flow.ts
7343
+ /**
7344
+ * Status of a `SELF` flow step.
7345
+ *
7346
+ * @experimental Part of the new ThunderID API
7347
+ */
7348
+ let EmbeddedSelfFlowStatus = /* @__PURE__ */ function(EmbeddedSelfFlowStatus$1) {
7349
+ /**
7350
+ * The flow completed, for example a verification was recorded.
7351
+ */
7352
+ EmbeddedSelfFlowStatus$1["Complete"] = "COMPLETE";
7353
+ /**
7354
+ * The server refused the operation.
7355
+ */
7356
+ EmbeddedSelfFlowStatus$1["Error"] = "ERROR";
7357
+ /**
7358
+ * The flow needs more input, such as the emailed code.
7359
+ */
7360
+ EmbeddedSelfFlowStatus$1["Incomplete"] = "INCOMPLETE";
7361
+ return EmbeddedSelfFlowStatus$1;
7362
+ }({});
7363
+
7230
7364
  //#endregion
7231
7365
  //#region src/models/flow-meta.ts
7232
7366
  /**
@@ -7908,7 +8042,7 @@ const fail = (code, message) => {
7908
8042
  throw new InvalidLogoutTokenError(code, message);
7909
8043
  };
7910
8044
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
7911
- const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
8045
+ const isNonEmptyString$1 = (value) => typeof value === "string" && value.length > 0;
7912
8046
  /**
7913
8047
  * Checks the header and claims of a back-channel logout token, per OpenID Connect Back-Channel
7914
8048
  * Logout 1.0 section 2.6. It does not verify the signature: the caller does that with the server's
@@ -7930,15 +8064,15 @@ const validateLogoutTokenClaims = (header, payload, options) => {
7930
8064
  if (!isRecord(events) || !isRecord(events[BackchannelLogoutConstants_default.EVENT])) return fail("JS-LOGOUT_TOKEN-VLTC-IV05", "The back-channel logout event is missing.");
7931
8065
  if (payload["iss"] !== options.issuer) return fail("JS-LOGOUT_TOKEN-VLTC-IV06", "The issuer does not match.");
7932
8066
  const audiences = Array.isArray(payload["aud"]) ? payload["aud"] : [payload["aud"]];
7933
- if (!isNonEmptyString(options.clientId) || !audiences.includes(options.clientId)) return fail("JS-LOGOUT_TOKEN-VLTC-IV07", "The audience does not include this client.");
8067
+ if (!isNonEmptyString$1(options.clientId) || !audiences.includes(options.clientId)) return fail("JS-LOGOUT_TOKEN-VLTC-IV07", "The audience does not include this client.");
7934
8068
  const now = options.now ?? Math.floor(Date.now() / 1e3);
7935
8069
  const tolerance = options.clockTolerance ?? BackchannelLogoutConstants_default.DEFAULT_CLOCK_TOLERANCE_SECONDS;
7936
8070
  if (typeof payload["iat"] !== "number" || payload["iat"] > now + tolerance) return fail("JS-LOGOUT_TOKEN-VLTC-IV08", "The issued-at time is missing or in the future.");
7937
8071
  if (typeof payload["exp"] !== "number" || payload["exp"] <= now - tolerance) return fail("JS-LOGOUT_TOKEN-VLTC-IV09", "The token has expired.");
7938
- if ("sid" in payload && !isNonEmptyString(payload["sid"])) return fail("JS-LOGOUT_TOKEN-VLTC-IV10", "The session identifier is not valid.");
7939
- if ("sub" in payload && !isNonEmptyString(payload["sub"])) return fail("JS-LOGOUT_TOKEN-VLTC-IV10", "The subject is not valid.");
8072
+ if ("sid" in payload && !isNonEmptyString$1(payload["sid"])) return fail("JS-LOGOUT_TOKEN-VLTC-IV10", "The session identifier is not valid.");
8073
+ if ("sub" in payload && !isNonEmptyString$1(payload["sub"])) return fail("JS-LOGOUT_TOKEN-VLTC-IV10", "The subject is not valid.");
7940
8074
  if (!("sid" in payload) && !("sub" in payload)) return fail("JS-LOGOUT_TOKEN-VLTC-IV11", "The token names neither a session nor a subject.");
7941
- if (!isNonEmptyString(payload["jti"])) return fail("JS-LOGOUT_TOKEN-VLTC-IV12", "The token identifier is missing.");
8075
+ if (!isNonEmptyString$1(payload["jti"])) return fail("JS-LOGOUT_TOKEN-VLTC-IV12", "The token identifier is missing.");
7942
8076
  return payload;
7943
8077
  };
7944
8078
  var validateLogoutTokenClaims_default = validateLogoutTokenClaims;
@@ -10237,6 +10371,88 @@ const generateFlattenedUserProfile = (meResponse, _processedSchemas) => {
10237
10371
  };
10238
10372
  var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
10239
10373
 
10374
+ //#endregion
10375
+ //#region src/utils/getFlowStepComponents.ts
10376
+ const INPUT_TYPES = [
10377
+ EmbeddedFlowComponentType.TextInput,
10378
+ EmbeddedFlowComponentType.PasswordInput,
10379
+ EmbeddedFlowComponentType.EmailInput,
10380
+ EmbeddedFlowComponentType.PhoneInput,
10381
+ EmbeddedFlowComponentType.OtpInput,
10382
+ EmbeddedFlowComponentType.Select,
10383
+ EmbeddedFlowComponentType.DateInput
10384
+ ];
10385
+ const ACTION_TYPES = [EmbeddedFlowComponentType.Action, EmbeddedFlowComponentType.Resend];
10386
+ /**
10387
+ * Collects the inputs and actions of a flow step, nested components included, in document order.
10388
+ *
10389
+ * @param components - The step's components.
10390
+ * @returns The step's inputs, actions and resend action.
10391
+ * @example
10392
+ * ```typescript
10393
+ * const {actions, inputs} = getFlowStepComponents(response.data.components);
10394
+ * const isAwaitingLink = inputs.length === 0 && actions.length === 0;
10395
+ * ```
10396
+ */
10397
+ const getFlowStepComponents = (components, step = {
10398
+ actions: [],
10399
+ inputs: []
10400
+ }) => {
10401
+ components.forEach((component) => {
10402
+ if (INPUT_TYPES.includes(component.type)) step.inputs.push(component);
10403
+ if (ACTION_TYPES.includes(component.type)) step.actions.push(component);
10404
+ if (component.type === EmbeddedFlowComponentType.Resend && !step.resend) step.resend = component;
10405
+ if (Array.isArray(component.components)) getFlowStepComponents(component.components, step);
10406
+ });
10407
+ return step;
10408
+ };
10409
+ var getFlowStepComponents_default = getFlowStepComponents;
10410
+
10411
+ //#endregion
10412
+ //#region src/utils/getVerifiedAttributes.ts
10413
+ /**
10414
+ * Returns the verified attributes of a `/users/me` profile, keyed by attribute name.
10415
+ *
10416
+ * A profile without the field, from a server that does not report verification, leaves every status
10417
+ * unknown, so the result is `undefined` rather than an empty record that would read as unverified.
10418
+ *
10419
+ * @param user - The profile to read.
10420
+ * @returns The verified attributes, an empty object when none is verified, or `undefined` when the
10421
+ * profile does not report them.
10422
+ */
10423
+ const getVerifiedAttributes = (user) => {
10424
+ const value = user?.[AttributeVerificationConstants_default.VERIFIED_ATTRIBUTES_KEY];
10425
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
10426
+ };
10427
+ var getVerifiedAttributes_default = getVerifiedAttributes;
10428
+
10429
+ //#endregion
10430
+ //#region src/utils/isVerifiableAttribute.ts
10431
+ /**
10432
+ * Whether the signed-in user can verify the given attribute: a top-level, single-valued property of
10433
+ * type `email` or `mobile` in the user type schema from `GET /users/me/meta`.
10434
+ *
10435
+ * Schema keys are top-level properties, and a multi-valued property has type `array`, so both are
10436
+ * settled by the property's own type. An absent schema, or one without the attribute, leaves the
10437
+ * type unknown and resolves to `false`, so no verification is started on missing information.
10438
+ *
10439
+ * @param userSchema - The user type schema resolved by the provider, keyed by attribute.
10440
+ * @param attribute - The attribute to check (e.g. `email`).
10441
+ * @returns `true` only when the schema declares `attribute` with a verifiable type.
10442
+ * @example
10443
+ * ```typescript
10444
+ * if (!isVerifiableAttribute(userSchema, 'given_name')) {
10445
+ * return null;
10446
+ * }
10447
+ * ```
10448
+ */
10449
+ const isVerifiableAttribute = (userSchema, attribute) => {
10450
+ if (!userSchema || !attribute || !Object.prototype.hasOwnProperty.call(userSchema, attribute)) return false;
10451
+ const type = userSchema[attribute]?.type;
10452
+ return typeof type === "string" && AttributeVerificationConstants_default.VERIFIABLE_ATTRIBUTE_TYPES.includes(type.toLowerCase());
10453
+ };
10454
+ var isVerifiableAttribute_default = isVerifiableAttribute;
10455
+
10240
10456
  //#endregion
10241
10457
  //#region src/utils/getRedirectBasedSignUpUrl.ts
10242
10458
  /**
@@ -10381,6 +10597,37 @@ const getConsentElementDecision = (purposeId, element, approved, inputs) => {
10381
10597
  };
10382
10598
  var getConsentElementDecision_default = getConsentElementDecision;
10383
10599
 
10600
+ //#endregion
10601
+ //#region src/utils/compileConsentDecisions.ts
10602
+ /**
10603
+ * Compiles consent form state into the flow API's `consent_decisions` input and removes
10604
+ * temporary SDK-only consent fields. The caller determines approval/denial from its action.
10605
+ */
10606
+ const compileConsentDecisions = (inputs, purposes, options) => {
10607
+ const processedInputs = { ...inputs };
10608
+ if (purposes) {
10609
+ const { approved, reason } = options;
10610
+ const decisions = {
10611
+ approved,
10612
+ ...reason ? { reason } : {},
10613
+ purposes: purposes.map((purpose) => ({
10614
+ approved,
10615
+ elements: [...(purpose.essential ?? []).map((element) => ({
10616
+ approved,
10617
+ name: element.name
10618
+ })), ...(purpose.optional ?? []).map((element) => getConsentElementDecision_default(purpose.purposeId, element, approved && processedInputs[`__consent_opt__${purpose.purposeId}__${element.name}`] === "true", processedInputs))],
10619
+ ...purpose.purposeName ? { purposeName: purpose.purposeName } : {}
10620
+ }))
10621
+ };
10622
+ processedInputs["consent_decisions"] = JSON.stringify(decisions);
10623
+ }
10624
+ Object.keys(processedInputs).forEach((key) => {
10625
+ if (key.startsWith("__consent_opt__") || key.startsWith(CONSENT_MODIFIED_KEY_PREFIX) || key.startsWith(CONSENT_INVALID_KEY_PREFIX)) delete processedInputs[key];
10626
+ });
10627
+ return processedInputs;
10628
+ };
10629
+ var compileConsentDecisions_default = compileConsentDecisions;
10630
+
10384
10631
  //#endregion
10385
10632
  //#region src/utils/isEmpty.ts
10386
10633
  /**
@@ -10966,6 +11213,47 @@ const parseSelectPageQuery = (raw, { allowFilter = false } = {}) => {
10966
11213
  };
10967
11214
  var parseSelectPageQuery_default = parseSelectPageQuery;
10968
11215
 
11216
+ //#endregion
11217
+ //#region src/utils/parseSelfFlowRequest.ts
11218
+ const isNonEmptyString = (value) => typeof value === "string" && value !== "";
11219
+ const isStringRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value) && Object.values(value).every((entry) => typeof entry === "string");
11220
+ /**
11221
+ * Checks a `SELF` flow step that a browser sent to a server-side SDK, which attaches the
11222
+ * session's access token before forwarding it. Such an endpoint is public, so its types protect
11223
+ * nothing.
11224
+ *
11225
+ * Only the fields of a step are kept, so a caller cannot add a user or application identifier. A
11226
+ * request without an `executionId` starts a flow, and must name a `SELF` flow by its handle,
11227
+ * so the endpoint cannot start a flow of another type with the user's token.
11228
+ *
11229
+ * @param raw - The request body as received.
11230
+ * @returns The request to send, or the name of the first invalid field.
11231
+ */
11232
+ const parseSelfFlowRequest = (raw) => {
11233
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { invalid: "body" };
11234
+ const { action, challengeToken, executionId, flowType, handle, inputs } = raw;
11235
+ if (inputs !== void 0 && !isStringRecord(inputs)) return { invalid: "inputs" };
11236
+ if (executionId !== void 0) {
11237
+ if (!isNonEmptyString(executionId)) return { invalid: "executionId" };
11238
+ if (action !== void 0 && typeof action !== "string") return { invalid: "action" };
11239
+ if (challengeToken !== void 0 && typeof challengeToken !== "string") return { invalid: "challengeToken" };
11240
+ return { request: {
11241
+ executionId,
11242
+ ...action ? { action } : {},
11243
+ ...challengeToken ? { challengeToken } : {},
11244
+ ...inputs ? { inputs } : {}
11245
+ } };
11246
+ }
11247
+ if (flowType !== EmbeddedFlowType.Self) return { invalid: "flowType" };
11248
+ if (!isNonEmptyString(handle)) return { invalid: "handle" };
11249
+ return { request: {
11250
+ flowType: EmbeddedFlowType.Self,
11251
+ handle,
11252
+ ...inputs ? { inputs } : {}
11253
+ } };
11254
+ };
11255
+ var parseSelfFlowRequest_default = parseSelfFlowRequest;
11256
+
10969
11257
  //#endregion
10970
11258
  //#region src/i18n/translations/en-US.ts
10971
11259
  const en_US = {
@@ -11056,6 +11344,20 @@ const en_US = {
11056
11344
  "passkey.register.description": "Create a passkey to securely sign in to your account without a password.",
11057
11345
  "user.profile.heading": "Profile",
11058
11346
  "user.profile.update.generic.error": "An error occurred while updating your profile. Please try again.",
11347
+ "user.verification.status.verified": "Verified",
11348
+ "user.verification.status.unverified": "Unverified",
11349
+ "user.verification.status.verified_at": "Verified on {date}",
11350
+ "user.verification.buttons.verify.text": "Verify",
11351
+ "user.verification.buttons.cancel.text": "Cancel",
11352
+ "user.verification.buttons.close.text": "Close",
11353
+ "user.verification.buttons.done.text": "Done",
11354
+ "user.verification.heading": "Verify {attribute}",
11355
+ "user.verification.subheading": "Enter the code sent to {destination}.",
11356
+ "user.verification.subheading.generic": "Enter the code sent to you.",
11357
+ "user.verification.subheading.link": "We sent a verification link to {destination}. Open it, then select Done.",
11358
+ "user.verification.destination": "Sent to {destination}.",
11359
+ "user.verification.success": "{attribute} verified.",
11360
+ "user.verification.error": "Verification failed. Please try again.",
11059
11361
  "user.change_password.heading": "Change {credential}",
11060
11362
  "user.change_password.new.label": "New {credential}",
11061
11363
  "user.change_password.new.placeholder": "Enter your new {credentialLower}",
@@ -11405,6 +11707,20 @@ const fr_FR = {
11405
11707
  "passkey.register.description": "Créez une clé d'accès pour vous connecter en toute sécurité à votre compte sans mot de passe.",
11406
11708
  "user.profile.heading": "Profil",
11407
11709
  "user.profile.update.generic.error": "Une erreur est survenue lors de la mise à jour de votre profil. Veuillez réessayer.",
11710
+ "user.verification.status.verified": "Vérifié",
11711
+ "user.verification.status.unverified": "Non vérifié",
11712
+ "user.verification.status.verified_at": "Vérifié le {date}",
11713
+ "user.verification.buttons.verify.text": "Vérifier",
11714
+ "user.verification.buttons.cancel.text": "Annuler",
11715
+ "user.verification.buttons.close.text": "Fermer",
11716
+ "user.verification.buttons.done.text": "Terminé",
11717
+ "user.verification.heading": "Vérifier {attribute}",
11718
+ "user.verification.subheading": "Saisissez le code envoyé à {destination}.",
11719
+ "user.verification.subheading.generic": "Saisissez le code qui vous a été envoyé.",
11720
+ "user.verification.subheading.link": "Nous avons envoyé un lien de vérification à {destination}. Ouvrez-le, puis sélectionnez Terminé.",
11721
+ "user.verification.destination": "Envoyé à {destination}.",
11722
+ "user.verification.success": "Vérification de {attribute} réussie.",
11723
+ "user.verification.error": "La vérification a échoué. Veuillez réessayer.",
11408
11724
  "user.change_password.heading": "Modifier {credential}",
11409
11725
  "user.change_password.new.label": "Nouveau {credential}",
11410
11726
  "user.change_password.new.placeholder": "Entrez votre nouveau {credentialLower}",
@@ -11754,6 +12070,20 @@ const te_IN = {
11754
12070
  "passkey.register.description": "పాస్‌వర్డ్ లేకుండా మీ ఖాతాలోకి సురక్షితంగా సైన్ ఇన్ చేయడానికి Passkey ని సృష్టించండి.",
11755
12071
  "user.profile.heading": "ప్రొఫైల్",
11756
12072
  "user.profile.update.generic.error": "ప్రొఫైల్ అప్‌డేట్ చేస్తూ లోపం వచ్చింది. దయచేసి మళ్లీ ప్రయత్నించండి.",
12073
+ "user.verification.status.verified": "ధృవీకరించబడింది",
12074
+ "user.verification.status.unverified": "ధృవీకరించబడలేదు",
12075
+ "user.verification.status.verified_at": "{date}న ధృవీకరించబడింది",
12076
+ "user.verification.buttons.verify.text": "ధృవీకరించండి",
12077
+ "user.verification.buttons.cancel.text": "రద్దు చేయండి",
12078
+ "user.verification.buttons.close.text": "మూసివేయండి",
12079
+ "user.verification.buttons.done.text": "పూర్తయింది",
12080
+ "user.verification.heading": "{attribute} ధృవీకరించండి",
12081
+ "user.verification.subheading": "{destination}కు పంపిన కోడ్‌ను నమోదు చేయండి.",
12082
+ "user.verification.subheading.generic": "మీకు పంపిన కోడ్‌ను నమోదు చేయండి.",
12083
+ "user.verification.subheading.link": "{destination}కు ధృవీకరణ లింక్‌ను పంపాము. దాన్ని తెరిచి, ఆపై పూర్తయింది ఎంచుకోండి.",
12084
+ "user.verification.destination": "{destination}కు పంపబడింది.",
12085
+ "user.verification.success": "{attribute} ధృవీకరించబడింది.",
12086
+ "user.verification.error": "ధృవీకరణ విఫలమైంది. దయచేసి మళ్లీ ప్రయత్నించండి.",
11757
12087
  "user.change_password.heading": "{credential} మార్చండి",
11758
12088
  "user.change_password.new.label": "కొత్త {credential}",
11759
12089
  "user.change_password.new.placeholder": "మీ కొత్త {credentialLower} నమోదు చేయండి",
@@ -12103,6 +12433,20 @@ const hi_IN = {
12103
12433
  "passkey.register.description": "बिना पासवर्ड के अपने खाते में सुरक्षित रूप से साइन इन करने के लिए एक Passkey बनाएं।",
12104
12434
  "user.profile.heading": "प्रोफ़ाइल",
12105
12435
  "user.profile.update.generic.error": "प्रोफ़ाइल अपडेट करते समय त्रुटि हुई। कृपया पुनः प्रयास करें।",
12436
+ "user.verification.status.verified": "सत्यापित",
12437
+ "user.verification.status.unverified": "असत्यापित",
12438
+ "user.verification.status.verified_at": "{date} को सत्यापित",
12439
+ "user.verification.buttons.verify.text": "सत्यापित करें",
12440
+ "user.verification.buttons.cancel.text": "रद्द करें",
12441
+ "user.verification.buttons.close.text": "बंद करें",
12442
+ "user.verification.buttons.done.text": "पूर्ण",
12443
+ "user.verification.heading": "{attribute} सत्यापित करें",
12444
+ "user.verification.subheading": "{destination} पर भेजा गया कोड दर्ज करें।",
12445
+ "user.verification.subheading.generic": "आपको भेजा गया कोड दर्ज करें।",
12446
+ "user.verification.subheading.link": "{destination} पर एक सत्यापन लिंक भेजा गया है। उसे खोलें, फिर पूर्ण चुनें।",
12447
+ "user.verification.destination": "{destination} पर भेजा गया।",
12448
+ "user.verification.success": "{attribute} सत्यापित हो गया।",
12449
+ "user.verification.error": "सत्यापन विफल रहा। कृपया पुनः प्रयास करें।",
12106
12450
  "user.change_password.heading": "{credential} बदलें",
12107
12451
  "user.change_password.new.label": "नया {credential}",
12108
12452
  "user.change_password.new.placeholder": "अपना नया {credentialLower} दर्ज करें",
@@ -12452,6 +12796,20 @@ const pt_BR = {
12452
12796
  "passkey.register.description": "Crie uma passkey para entrar em sua conta com segurança sem uma senha.",
12453
12797
  "user.profile.heading": "Perfil",
12454
12798
  "user.profile.update.generic.error": "Ocorreu um erro ao atualizar seu perfil. Tente novamente.",
12799
+ "user.verification.status.verified": "Verificado",
12800
+ "user.verification.status.unverified": "Não verificado",
12801
+ "user.verification.status.verified_at": "Verificado em {date}",
12802
+ "user.verification.buttons.verify.text": "Verificar",
12803
+ "user.verification.buttons.cancel.text": "Cancelar",
12804
+ "user.verification.buttons.close.text": "Fechar",
12805
+ "user.verification.buttons.done.text": "Concluído",
12806
+ "user.verification.heading": "Verificar {attribute}",
12807
+ "user.verification.subheading": "Digite o código enviado para {destination}.",
12808
+ "user.verification.subheading.generic": "Digite o código enviado para você.",
12809
+ "user.verification.subheading.link": "Enviamos um link de verificação para {destination}. Abra-o e selecione Concluído.",
12810
+ "user.verification.destination": "Enviado para {destination}.",
12811
+ "user.verification.success": "Verificação de {attribute} concluída.",
12812
+ "user.verification.error": "Falha na verificação. Tente novamente.",
12455
12813
  "user.change_password.heading": "Alterar {credential}",
12456
12814
  "user.change_password.new.label": "Novo {credential}",
12457
12815
  "user.change_password.new.placeholder": "Digite seu novo {credentialLower}",
@@ -12801,6 +13159,20 @@ const pt_PT = {
12801
13159
  "passkey.register.description": "Crie uma passkey para iniciar sessão na sua conta com segurança sem palavra-passe.",
12802
13160
  "user.profile.heading": "Perfil",
12803
13161
  "user.profile.update.generic.error": "Ocorreu um erro ao actualizar o seu perfil. Tente novamente.",
13162
+ "user.verification.status.verified": "Verificado",
13163
+ "user.verification.status.unverified": "Não verificado",
13164
+ "user.verification.status.verified_at": "Verificado em {date}",
13165
+ "user.verification.buttons.verify.text": "Verificar",
13166
+ "user.verification.buttons.cancel.text": "Cancelar",
13167
+ "user.verification.buttons.close.text": "Fechar",
13168
+ "user.verification.buttons.done.text": "Concluído",
13169
+ "user.verification.heading": "Verificar {attribute}",
13170
+ "user.verification.subheading": "Introduza o código enviado para {destination}.",
13171
+ "user.verification.subheading.generic": "Introduza o código que lhe foi enviado.",
13172
+ "user.verification.subheading.link": "Enviámos uma ligação de verificação para {destination}. Abra-a e selecione Concluído.",
13173
+ "user.verification.destination": "Enviado para {destination}.",
13174
+ "user.verification.success": "Verificação de {attribute} concluída.",
13175
+ "user.verification.error": "A verificação falhou. Tente novamente.",
12804
13176
  "user.change_password.heading": "Alterar {credential}",
12805
13177
  "user.change_password.new.label": "Novo {credential}",
12806
13178
  "user.change_password.new.placeholder": "Introduza o seu novo {credentialLower}",
@@ -13150,6 +13522,20 @@ const ta_IN = {
13150
13522
  "passkey.register.description": "கடவுச்சொல் இல்லாமல் பாதுகாப்பாக உள்நுழைய ஒரு passkey-ஐ உருவாக்கவும்.",
13151
13523
  "user.profile.heading": "சுயவிவரம்",
13152
13524
  "user.profile.update.generic.error": "உங்கள் சுயவிவரத்தை புதுப்பிக்கும் போது பிழை ஏற்பட்டது. மீண்டும் முயற்சிக்கவும்.",
13525
+ "user.verification.status.verified": "சரிபார்க்கப்பட்டது",
13526
+ "user.verification.status.unverified": "சரிபார்க்கப்படவில்லை",
13527
+ "user.verification.status.verified_at": "{date} அன்று சரிபார்க்கப்பட்டது",
13528
+ "user.verification.buttons.verify.text": "சரிபார்",
13529
+ "user.verification.buttons.cancel.text": "ரத்து செய்",
13530
+ "user.verification.buttons.close.text": "மூடு",
13531
+ "user.verification.buttons.done.text": "முடிந்தது",
13532
+ "user.verification.heading": "{attribute} சரிபார்",
13533
+ "user.verification.subheading": "{destination} க்கு அனுப்பப்பட்ட குறியீட்டை உள்ளிடவும்.",
13534
+ "user.verification.subheading.generic": "உங்களுக்கு அனுப்பப்பட்ட குறியீட்டை உள்ளிடவும்.",
13535
+ "user.verification.subheading.link": "{destination} க்கு சரிபார்ப்பு இணைப்பை அனுப்பியுள்ளோம். அதைத் திறந்து, பின்னர் முடிந்தது என்பதைத் தேர்ந்தெடுக்கவும்.",
13536
+ "user.verification.destination": "{destination} க்கு அனுப்பப்பட்டது.",
13537
+ "user.verification.success": "{attribute} சரிபார்க்கப்பட்டது.",
13538
+ "user.verification.error": "சரிபார்ப்பு தோல்வியடைந்தது. மீண்டும் முயற்சிக்கவும்.",
13153
13539
  "user.change_password.heading": "{credential} மாற்றவும்",
13154
13540
  "user.change_password.new.label": "புதிய {credential}",
13155
13541
  "user.change_password.new.placeholder": "உங்கள் புதிய {credentialLower}-ஐ உள்ளிடவும்",
@@ -13499,6 +13885,20 @@ const si_LK = {
13499
13885
  "passkey.register.description": "මුරපදයක් නොමැතිව ඔබේ ගිණුමට ආරක්ෂිතව ඇතුල් වීමට passkey එකක් සාදන්න.",
13500
13886
  "user.profile.heading": "පැතිකඩ",
13501
13887
  "user.profile.update.generic.error": "ඔබේ පැතිකඩ යාවත්කාලීන කිරීමේදී දෝෂයක් ඇතිවිය.කරුණාකර නැවත උත්සාහ කරන්න",
13888
+ "user.verification.status.verified": "සත්‍යාපනය කර ඇත",
13889
+ "user.verification.status.unverified": "සත්‍යාපනය කර නැත",
13890
+ "user.verification.status.verified_at": "{date} දින සත්‍යාපනය කරන ලදී",
13891
+ "user.verification.buttons.verify.text": "සත්‍යාපනය කරන්න",
13892
+ "user.verification.buttons.cancel.text": "අවලංගු කරන්න",
13893
+ "user.verification.buttons.close.text": "වසන්න",
13894
+ "user.verification.buttons.done.text": "නිම කළා",
13895
+ "user.verification.heading": "{attribute} සත්‍යාපනය කරන්න",
13896
+ "user.verification.subheading": "{destination} වෙත යැවූ කේතය ඇතුළත් කරන්න.",
13897
+ "user.verification.subheading.generic": "ඔබට යැවූ කේතය ඇතුළත් කරන්න.",
13898
+ "user.verification.subheading.link": "{destination} වෙත සත්‍යාපන සබැඳියක් යැව්වෙමු. එය විවෘත කර, ඉන්පසු නිම කළා තෝරන්න.",
13899
+ "user.verification.destination": "{destination} වෙත යවන ලදී.",
13900
+ "user.verification.success": "{attribute} සත්‍යාපනය කරන ලදී.",
13901
+ "user.verification.error": "සත්‍යාපනය අසාර්ථක විය. කරුණාකර නැවත උත්සාහ කරන්න.",
13502
13902
  "user.change_password.heading": "{credential} වෙනස් කරන්න",
13503
13903
  "user.change_password.new.label": "නව {credential}",
13504
13904
  "user.change_password.new.placeholder": "ඔබේ නව {credentialLower} ඇතුළත් කරන්න",
@@ -14847,6 +15247,7 @@ exports.AdministrationModes = AdministrationConstants_default;
14847
15247
  exports.AgentQueryKeys = AgentQueryKeys_default;
14848
15248
  exports.ApplicationNativeAuthenticationConstants = ApplicationNativeAuthenticationConstants_default;
14849
15249
  exports.ApplicationQueryKeys = ApplicationQueryKeys_default;
15250
+ exports.AttributeVerificationConstants = AttributeVerificationConstants_default;
14850
15251
  exports.AuthFlowSelectConstants = AuthFlowSelectConstants_default;
14851
15252
  exports.AuthenticationHelper = AuthenticationHelper_default;
14852
15253
  exports.BackchannelLogoutConstants = BackchannelLogoutConstants_default;
@@ -14866,6 +15267,7 @@ exports.EmbeddedFlowTextVariant = EmbeddedFlowTextVariant;
14866
15267
  exports.EmbeddedFlowType = EmbeddedFlowType;
14867
15268
  exports.EmbeddedRecoveryFlowStatus = EmbeddedRecoveryFlowStatus;
14868
15269
  exports.EmbeddedRecoveryFlowType = EmbeddedRecoveryFlowType;
15270
+ exports.EmbeddedSelfFlowStatus = EmbeddedSelfFlowStatus;
14869
15271
  exports.EmbeddedSignInFlowStatus = EmbeddedSignInFlowStatus;
14870
15272
  exports.EmbeddedSignInFlowType = EmbeddedSignInFlowType;
14871
15273
  exports.EmbeddedSignUpFlowStatus = EmbeddedSignUpFlowStatus;
@@ -14906,6 +15308,7 @@ exports.base64urlToArrayBuffer = base64urlToArrayBuffer_default;
14906
15308
  exports.bem = bem_default;
14907
15309
  exports.buildValidatorFromRules = buildValidatorFromRules_default;
14908
15310
  exports.capPageSize = capPageSize_default;
15311
+ exports.compileConsentDecisions = compileConsentDecisions_default;
14909
15312
  exports.computeNextPageOffset = computeNextPageOffset_default;
14910
15313
  exports.configureLogger = configure;
14911
15314
  exports.countryCodeToFlagEmoji = countryCodeToFlagEmoji;
@@ -14979,6 +15382,7 @@ exports.evaluateValidationRule = evaluateValidationRule_default;
14979
15382
  exports.executeAdministrationFlow = executeAdministrationFlow_default;
14980
15383
  exports.executeEmbeddedDeviceGrantFlow = executeEmbeddedDeviceGrantFlow_default;
14981
15384
  exports.executeEmbeddedRecoveryFlow = executeEmbeddedRecoveryFlow_default;
15385
+ exports.executeEmbeddedSelfFlow = executeEmbeddedSelfFlow_default;
14982
15386
  exports.executeEmbeddedSignInFlow = executeEmbeddedSignInFlow_default;
14983
15387
  exports.executeEmbeddedSignUpFlow = executeEmbeddedSignUpFlow_default;
14984
15388
  exports.executeEmbeddedUserOnboardingFlow = executeEmbeddedUserOnboardingFlow_default;
@@ -15025,6 +15429,7 @@ exports.getDesignThemeUsages = getDesignThemeUsages_default;
15025
15429
  exports.getDesignThemes = getDesignThemes_default;
15026
15430
  exports.getFlow = getFlow_default;
15027
15431
  exports.getFlowMeta = getFlowMeta_default;
15432
+ exports.getFlowStepComponents = getFlowStepComponents_default;
15028
15433
  exports.getFlowUsages = getFlowUsages_default;
15029
15434
  exports.getFlowVersion = getFlowVersion_default;
15030
15435
  exports.getFlowVersions = getFlowVersions_default;
@@ -15085,6 +15490,7 @@ exports.getUsersMeMeta = getUsersMeMeta_default;
15085
15490
  exports.getVariable = getVariable_default;
15086
15491
  exports.getVariables = getVariables_default;
15087
15492
  exports.getVendorPrefix = getVendorPrefix_default;
15493
+ exports.getVerifiedAttributes = getVerifiedAttributes_default;
15088
15494
  exports.hasPermission = hasPermission_default;
15089
15495
  exports.hasUnresolvedTranslationParams = hasUnresolvedTranslationParams;
15090
15496
  exports.importConfiguration = importConfiguration_default;
@@ -15095,6 +15501,7 @@ exports.isEmojiUri = isEmojiUri_default;
15095
15501
  exports.isEmpty = isEmpty_default;
15096
15502
  exports.isRecognizedBaseUrlPattern = isRecognizedBaseUrlPattern_default;
15097
15503
  exports.isRetryableError = isRetryableError_default;
15504
+ exports.isVerifiableAttribute = isVerifiableAttribute_default;
15098
15505
  exports.loadPageWithRetryAndLog = loadPageWithRetryAndLog_default;
15099
15506
  exports.loadUntilOptionsGrow = loadUntilOptionsGrow_default;
15100
15507
  exports.logResourceFailure = logResourceFailure;
@@ -15108,6 +15515,7 @@ exports.normalizeTranslations = normalizeTranslations_default;
15108
15515
  exports.parseKeyValuePairs = parseKeyValuePairs_default;
15109
15516
  exports.parseRedirectUris = parseRedirectUris_default;
15110
15517
  exports.parseSelectPageQuery = parseSelectPageQuery_default;
15518
+ exports.parseSelfFlowRequest = parseSelfFlowRequest_default;
15111
15519
  exports.previewCimdDocument = previewCimdDocument_default;
15112
15520
  exports.processOpenIDScopes = processOpenIDScopes_default;
15113
15521
  exports.regenerateAgentSecret = regenerateAgentSecret_default;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Wire names and eligibility rules for self user attribute verification.
3
+ */
4
+ declare const AttributeVerificationConstants: {
5
+ ATTRIBUTE_INPUT: string;
6
+ DEFAULT_FLOW_HANDLE: string;
7
+ MASKED_DESTINATION_KEY: string;
8
+ VERIFIABLE_ATTRIBUTE_TYPES: readonly string[];
9
+ VERIFIED_ATTRIBUTES_KEY: string;
10
+ VERIFY_AFTER_SAVE_ATTRIBUTE_TYPES: readonly string[];
11
+ };
12
+ export default AttributeVerificationConstants;
13
+ //# sourceMappingURL=AttributeVerificationConstants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttributeVerificationConstants.d.ts","sourceRoot":"","sources":["../../src/constants/AttributeVerificationConstants.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,QAAA,MAAM,8BAA8B,EAAE;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0BAA0B,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,uBAAuB,EAAE,MAAM,CAAC;IAChC,iCAAiC,EAAE,SAAS,MAAM,EAAE,CAAC;CA2BtD,CAAC;AAEF,eAAe,8BAA8B,CAAC"}