@thunderid/javascript 1.11.0 → 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 (37) hide show
  1. package/dist/api/auth/executeEmbeddedSelfFlow.d.ts +57 -0
  2. package/dist/api/auth/executeEmbeddedSelfFlow.d.ts.map +1 -0
  3. package/dist/cjs/index.cjs +355 -5
  4. package/dist/constants/AttributeVerificationConstants.d.ts +13 -0
  5. package/dist/constants/AttributeVerificationConstants.d.ts.map +1 -0
  6. package/dist/edge/index.js +349 -6
  7. package/dist/i18n/models/i18n.d.ts +14 -0
  8. package/dist/i18n/models/i18n.d.ts.map +1 -1
  9. package/dist/i18n/translations/en-US.d.ts.map +1 -1
  10. package/dist/i18n/translations/fr-FR.d.ts.map +1 -1
  11. package/dist/i18n/translations/hi-IN.d.ts.map +1 -1
  12. package/dist/i18n/translations/ja-JP.d.ts.map +1 -1
  13. package/dist/i18n/translations/pt-BR.d.ts.map +1 -1
  14. package/dist/i18n/translations/pt-PT.d.ts.map +1 -1
  15. package/dist/i18n/translations/si-LK.d.ts.map +1 -1
  16. package/dist/i18n/translations/ta-IN.d.ts.map +1 -1
  17. package/dist/i18n/translations/te-IN.d.ts.map +1 -1
  18. package/dist/index.d.ts +12 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +349 -6
  21. package/dist/models/embedded-flow.d.ts +3 -0
  22. package/dist/models/embedded-flow.d.ts.map +1 -1
  23. package/dist/models/embedded-self-flow.d.ts +75 -0
  24. package/dist/models/embedded-self-flow.d.ts.map +1 -0
  25. package/dist/models/extensions/components.d.ts +1 -1
  26. package/dist/models/extensions/components.d.ts.map +1 -1
  27. package/dist/models/user.d.ts +9 -0
  28. package/dist/models/user.d.ts.map +1 -1
  29. package/dist/utils/getFlowStepComponents.d.ts +26 -0
  30. package/dist/utils/getFlowStepComponents.d.ts.map +1 -0
  31. package/dist/utils/getVerifiedAttributes.d.ts +14 -0
  32. package/dist/utils/getVerifiedAttributes.d.ts.map +1 -0
  33. package/dist/utils/isVerifiableAttribute.d.ts +22 -0
  34. package/dist/utils/isVerifiableAttribute.d.ts.map +1 -0
  35. package/dist/utils/parseSelfFlowRequest.d.ts +24 -0
  36. package/dist/utils/parseSelfFlowRequest.d.ts.map +1 -0
  37. package/package.json +1 -1
@@ -0,0 +1,57 @@
1
+ import { EmbeddedSelfFlowRequest, EmbeddedSelfFlowResponse } from '../../models/embedded-self-flow';
2
+ /**
3
+ * Configuration for the executeEmbeddedSelfFlow request.
4
+ */
5
+ export interface ExecuteEmbeddedSelfFlowConfig extends Omit<RequestInit, 'method' | 'body'> {
6
+ /**
7
+ * The base path of the API endpoint.
8
+ */
9
+ baseUrl?: string;
10
+ /**
11
+ * Optional custom fetcher function. If not provided, native fetch is used, which sends no
12
+ * access token; framework SDKs pass a fetcher that attaches the signed-in user's token.
13
+ */
14
+ fetcher?: (url: string, config: RequestInit) => Promise<Response>;
15
+ /**
16
+ * The step to execute: an initiating request or a continuation.
17
+ */
18
+ payload: EmbeddedSelfFlowRequest;
19
+ /**
20
+ * The absolute flow execution endpoint.
21
+ */
22
+ url?: string;
23
+ }
24
+ /**
25
+ * Executes one step of a `SELF` flow, an operation the signed-in user performs on their own
26
+ * account, such as verifying their email address. A new execution names the flow by its handle; the
27
+ * server takes the user from the access token on that first request and keeps it for the execution.
28
+ *
29
+ * @param config - Configuration object with URL, payload, fetcher and optional request config.
30
+ * @returns A promise that resolves with the flow step.
31
+ * @throws ThunderIDAPIError when the input is invalid or the request fails, coded
32
+ * `executeEmbeddedSelfFlow-` plus `ValidationError-001` (invalid `url` or `baseUrl`), `ValidationError-002`
33
+ * (no payload), `ValidationError-003` (a new flow without a handle), `ResponseError-001` (the server refused, with
34
+ * its status) or `NetworkError-001` (no response, or an unreadable one).
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const step = await executeEmbeddedSelfFlow({
39
+ * baseUrl: 'https://localhost:8090',
40
+ * payload: {
41
+ * flowType: 'SELF',
42
+ * handle: 'default-self-attribute-verification-flow',
43
+ * inputs: {attribute: 'email'},
44
+ * },
45
+ * fetcher: authenticatedFetcher,
46
+ * });
47
+ *
48
+ * await executeEmbeddedSelfFlow({
49
+ * baseUrl: 'https://localhost:8090',
50
+ * payload: {executionId: step.executionId, action: 'verify', inputs: {otp: '123456'}},
51
+ * fetcher: authenticatedFetcher,
52
+ * });
53
+ * ```
54
+ */
55
+ declare const executeEmbeddedSelfFlow: ({ url, baseUrl, payload, fetcher, ...requestConfig }: ExecuteEmbeddedSelfFlowConfig) => Promise<EmbeddedSelfFlowResponse>;
56
+ export default executeEmbeddedSelfFlow;
57
+ //# sourceMappingURL=executeEmbeddedSelfFlow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeEmbeddedSelfFlow.d.ts","sourceRoot":"","sources":["../../../src/api/auth/executeEmbeddedSelfFlow.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,uBAAuB,EAAE,wBAAwB,EAAC,MAAM,iCAAiC,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzF;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClE;;OAEG;IACH,OAAO,EAAE,uBAAuB,CAAC;IACjC;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,uBAAuB,GAAU,sDAMpC,6BAA6B,KAAG,OAAO,CAAC,wBAAwB,CA+ElE,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
@@ -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 */
@@ -1427,6 +1430,73 @@ const executeEmbeddedUserOnboardingFlow = async ({ url, baseUrl, payload,...requ
1427
1430
  };
1428
1431
  var executeEmbeddedUserOnboardingFlow_default = executeEmbeddedUserOnboardingFlow;
1429
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
+
1430
1500
  //#endregion
1431
1501
  //#region src/api/auth/getFlowMeta.ts
1432
1502
  /**
@@ -7167,6 +7237,21 @@ const SelectConstants = {
7167
7237
  };
7168
7238
  var SelectConstants_default = SelectConstants;
7169
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
+
7170
7255
  //#endregion
7171
7256
  //#region src/errors/ThunderIDRuntimeError.ts
7172
7257
  /**
@@ -7253,6 +7338,29 @@ let EmbeddedRecoveryFlowType = /* @__PURE__ */ function(EmbeddedRecoveryFlowType
7253
7338
  return EmbeddedRecoveryFlowType$1;
7254
7339
  }({});
7255
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
+
7256
7364
  //#endregion
7257
7365
  //#region src/models/flow-meta.ts
7258
7366
  /**
@@ -7934,7 +8042,7 @@ const fail = (code, message) => {
7934
8042
  throw new InvalidLogoutTokenError(code, message);
7935
8043
  };
7936
8044
  const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
7937
- const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
8045
+ const isNonEmptyString$1 = (value) => typeof value === "string" && value.length > 0;
7938
8046
  /**
7939
8047
  * Checks the header and claims of a back-channel logout token, per OpenID Connect Back-Channel
7940
8048
  * Logout 1.0 section 2.6. It does not verify the signature: the caller does that with the server's
@@ -7956,15 +8064,15 @@ const validateLogoutTokenClaims = (header, payload, options) => {
7956
8064
  if (!isRecord(events) || !isRecord(events[BackchannelLogoutConstants_default.EVENT])) return fail("JS-LOGOUT_TOKEN-VLTC-IV05", "The back-channel logout event is missing.");
7957
8065
  if (payload["iss"] !== options.issuer) return fail("JS-LOGOUT_TOKEN-VLTC-IV06", "The issuer does not match.");
7958
8066
  const audiences = Array.isArray(payload["aud"]) ? payload["aud"] : [payload["aud"]];
7959
- 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.");
7960
8068
  const now = options.now ?? Math.floor(Date.now() / 1e3);
7961
8069
  const tolerance = options.clockTolerance ?? BackchannelLogoutConstants_default.DEFAULT_CLOCK_TOLERANCE_SECONDS;
7962
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.");
7963
8071
  if (typeof payload["exp"] !== "number" || payload["exp"] <= now - tolerance) return fail("JS-LOGOUT_TOKEN-VLTC-IV09", "The token has expired.");
7964
- if ("sid" in payload && !isNonEmptyString(payload["sid"])) return fail("JS-LOGOUT_TOKEN-VLTC-IV10", "The session identifier is not valid.");
7965
- 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.");
7966
8074
  if (!("sid" in payload) && !("sub" in payload)) return fail("JS-LOGOUT_TOKEN-VLTC-IV11", "The token names neither a session nor a subject.");
7967
- 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.");
7968
8076
  return payload;
7969
8077
  };
7970
8078
  var validateLogoutTokenClaims_default = validateLogoutTokenClaims;
@@ -10263,6 +10371,88 @@ const generateFlattenedUserProfile = (meResponse, _processedSchemas) => {
10263
10371
  };
10264
10372
  var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
10265
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
+
10266
10456
  //#endregion
10267
10457
  //#region src/utils/getRedirectBasedSignUpUrl.ts
10268
10458
  /**
@@ -11023,6 +11213,47 @@ const parseSelectPageQuery = (raw, { allowFilter = false } = {}) => {
11023
11213
  };
11024
11214
  var parseSelectPageQuery_default = parseSelectPageQuery;
11025
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
+
11026
11257
  //#endregion
11027
11258
  //#region src/i18n/translations/en-US.ts
11028
11259
  const en_US = {
@@ -11113,6 +11344,20 @@ const en_US = {
11113
11344
  "passkey.register.description": "Create a passkey to securely sign in to your account without a password.",
11114
11345
  "user.profile.heading": "Profile",
11115
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.",
11116
11361
  "user.change_password.heading": "Change {credential}",
11117
11362
  "user.change_password.new.label": "New {credential}",
11118
11363
  "user.change_password.new.placeholder": "Enter your new {credentialLower}",
@@ -11462,6 +11707,20 @@ const fr_FR = {
11462
11707
  "passkey.register.description": "Créez une clé d'accès pour vous connecter en toute sécurité à votre compte sans mot de passe.",
11463
11708
  "user.profile.heading": "Profil",
11464
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.",
11465
11724
  "user.change_password.heading": "Modifier {credential}",
11466
11725
  "user.change_password.new.label": "Nouveau {credential}",
11467
11726
  "user.change_password.new.placeholder": "Entrez votre nouveau {credentialLower}",
@@ -11811,6 +12070,20 @@ const te_IN = {
11811
12070
  "passkey.register.description": "పాస్‌వర్డ్ లేకుండా మీ ఖాతాలోకి సురక్షితంగా సైన్ ఇన్ చేయడానికి Passkey ని సృష్టించండి.",
11812
12071
  "user.profile.heading": "ప్రొఫైల్",
11813
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": "ధృవీకరణ విఫలమైంది. దయచేసి మళ్లీ ప్రయత్నించండి.",
11814
12087
  "user.change_password.heading": "{credential} మార్చండి",
11815
12088
  "user.change_password.new.label": "కొత్త {credential}",
11816
12089
  "user.change_password.new.placeholder": "మీ కొత్త {credentialLower} నమోదు చేయండి",
@@ -12160,6 +12433,20 @@ const hi_IN = {
12160
12433
  "passkey.register.description": "बिना पासवर्ड के अपने खाते में सुरक्षित रूप से साइन इन करने के लिए एक Passkey बनाएं।",
12161
12434
  "user.profile.heading": "प्रोफ़ाइल",
12162
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": "सत्यापन विफल रहा। कृपया पुनः प्रयास करें।",
12163
12450
  "user.change_password.heading": "{credential} बदलें",
12164
12451
  "user.change_password.new.label": "नया {credential}",
12165
12452
  "user.change_password.new.placeholder": "अपना नया {credentialLower} दर्ज करें",
@@ -12509,6 +12796,20 @@ const pt_BR = {
12509
12796
  "passkey.register.description": "Crie uma passkey para entrar em sua conta com segurança sem uma senha.",
12510
12797
  "user.profile.heading": "Perfil",
12511
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.",
12512
12813
  "user.change_password.heading": "Alterar {credential}",
12513
12814
  "user.change_password.new.label": "Novo {credential}",
12514
12815
  "user.change_password.new.placeholder": "Digite seu novo {credentialLower}",
@@ -12858,6 +13159,20 @@ const pt_PT = {
12858
13159
  "passkey.register.description": "Crie uma passkey para iniciar sessão na sua conta com segurança sem palavra-passe.",
12859
13160
  "user.profile.heading": "Perfil",
12860
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.",
12861
13176
  "user.change_password.heading": "Alterar {credential}",
12862
13177
  "user.change_password.new.label": "Novo {credential}",
12863
13178
  "user.change_password.new.placeholder": "Introduza o seu novo {credentialLower}",
@@ -13207,6 +13522,20 @@ const ta_IN = {
13207
13522
  "passkey.register.description": "கடவுச்சொல் இல்லாமல் பாதுகாப்பாக உள்நுழைய ஒரு passkey-ஐ உருவாக்கவும்.",
13208
13523
  "user.profile.heading": "சுயவிவரம்",
13209
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": "சரிபார்ப்பு தோல்வியடைந்தது. மீண்டும் முயற்சிக்கவும்.",
13210
13539
  "user.change_password.heading": "{credential} மாற்றவும்",
13211
13540
  "user.change_password.new.label": "புதிய {credential}",
13212
13541
  "user.change_password.new.placeholder": "உங்கள் புதிய {credentialLower}-ஐ உள்ளிடவும்",
@@ -13556,6 +13885,20 @@ const si_LK = {
13556
13885
  "passkey.register.description": "මුරපදයක් නොමැතිව ඔබේ ගිණුමට ආරක්ෂිතව ඇතුල් වීමට passkey එකක් සාදන්න.",
13557
13886
  "user.profile.heading": "පැතිකඩ",
13558
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": "සත්‍යාපනය අසාර්ථක විය. කරුණාකර නැවත උත්සාහ කරන්න.",
13559
13902
  "user.change_password.heading": "{credential} වෙනස් කරන්න",
13560
13903
  "user.change_password.new.label": "නව {credential}",
13561
13904
  "user.change_password.new.placeholder": "ඔබේ නව {credentialLower} ඇතුළත් කරන්න",
@@ -14904,6 +15247,7 @@ exports.AdministrationModes = AdministrationConstants_default;
14904
15247
  exports.AgentQueryKeys = AgentQueryKeys_default;
14905
15248
  exports.ApplicationNativeAuthenticationConstants = ApplicationNativeAuthenticationConstants_default;
14906
15249
  exports.ApplicationQueryKeys = ApplicationQueryKeys_default;
15250
+ exports.AttributeVerificationConstants = AttributeVerificationConstants_default;
14907
15251
  exports.AuthFlowSelectConstants = AuthFlowSelectConstants_default;
14908
15252
  exports.AuthenticationHelper = AuthenticationHelper_default;
14909
15253
  exports.BackchannelLogoutConstants = BackchannelLogoutConstants_default;
@@ -14923,6 +15267,7 @@ exports.EmbeddedFlowTextVariant = EmbeddedFlowTextVariant;
14923
15267
  exports.EmbeddedFlowType = EmbeddedFlowType;
14924
15268
  exports.EmbeddedRecoveryFlowStatus = EmbeddedRecoveryFlowStatus;
14925
15269
  exports.EmbeddedRecoveryFlowType = EmbeddedRecoveryFlowType;
15270
+ exports.EmbeddedSelfFlowStatus = EmbeddedSelfFlowStatus;
14926
15271
  exports.EmbeddedSignInFlowStatus = EmbeddedSignInFlowStatus;
14927
15272
  exports.EmbeddedSignInFlowType = EmbeddedSignInFlowType;
14928
15273
  exports.EmbeddedSignUpFlowStatus = EmbeddedSignUpFlowStatus;
@@ -15037,6 +15382,7 @@ exports.evaluateValidationRule = evaluateValidationRule_default;
15037
15382
  exports.executeAdministrationFlow = executeAdministrationFlow_default;
15038
15383
  exports.executeEmbeddedDeviceGrantFlow = executeEmbeddedDeviceGrantFlow_default;
15039
15384
  exports.executeEmbeddedRecoveryFlow = executeEmbeddedRecoveryFlow_default;
15385
+ exports.executeEmbeddedSelfFlow = executeEmbeddedSelfFlow_default;
15040
15386
  exports.executeEmbeddedSignInFlow = executeEmbeddedSignInFlow_default;
15041
15387
  exports.executeEmbeddedSignUpFlow = executeEmbeddedSignUpFlow_default;
15042
15388
  exports.executeEmbeddedUserOnboardingFlow = executeEmbeddedUserOnboardingFlow_default;
@@ -15083,6 +15429,7 @@ exports.getDesignThemeUsages = getDesignThemeUsages_default;
15083
15429
  exports.getDesignThemes = getDesignThemes_default;
15084
15430
  exports.getFlow = getFlow_default;
15085
15431
  exports.getFlowMeta = getFlowMeta_default;
15432
+ exports.getFlowStepComponents = getFlowStepComponents_default;
15086
15433
  exports.getFlowUsages = getFlowUsages_default;
15087
15434
  exports.getFlowVersion = getFlowVersion_default;
15088
15435
  exports.getFlowVersions = getFlowVersions_default;
@@ -15143,6 +15490,7 @@ exports.getUsersMeMeta = getUsersMeMeta_default;
15143
15490
  exports.getVariable = getVariable_default;
15144
15491
  exports.getVariables = getVariables_default;
15145
15492
  exports.getVendorPrefix = getVendorPrefix_default;
15493
+ exports.getVerifiedAttributes = getVerifiedAttributes_default;
15146
15494
  exports.hasPermission = hasPermission_default;
15147
15495
  exports.hasUnresolvedTranslationParams = hasUnresolvedTranslationParams;
15148
15496
  exports.importConfiguration = importConfiguration_default;
@@ -15153,6 +15501,7 @@ exports.isEmojiUri = isEmojiUri_default;
15153
15501
  exports.isEmpty = isEmpty_default;
15154
15502
  exports.isRecognizedBaseUrlPattern = isRecognizedBaseUrlPattern_default;
15155
15503
  exports.isRetryableError = isRetryableError_default;
15504
+ exports.isVerifiableAttribute = isVerifiableAttribute_default;
15156
15505
  exports.loadPageWithRetryAndLog = loadPageWithRetryAndLog_default;
15157
15506
  exports.loadUntilOptionsGrow = loadUntilOptionsGrow_default;
15158
15507
  exports.logResourceFailure = logResourceFailure;
@@ -15166,6 +15515,7 @@ exports.normalizeTranslations = normalizeTranslations_default;
15166
15515
  exports.parseKeyValuePairs = parseKeyValuePairs_default;
15167
15516
  exports.parseRedirectUris = parseRedirectUris_default;
15168
15517
  exports.parseSelectPageQuery = parseSelectPageQuery_default;
15518
+ exports.parseSelfFlowRequest = parseSelfFlowRequest_default;
15169
15519
  exports.previewCimdDocument = previewCimdDocument_default;
15170
15520
  exports.processOpenIDScopes = processOpenIDScopes_default;
15171
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"}