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MAAM,QAAa,KAAK,iBACtB,GAAG,KAAK,OAAO,+BAA+B,wBAAiC,EAAS,qBACxF,CACE,KAAM,EAAS,OAGnB,OAAO,qBAAqB,OAAO,aAAa,oBAAoB,EAAK,KAC3E","file":"/npm/@vonage/verify2@1.18.3/dist/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@vonage/verify2@1.18.3/dist/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n  for (var name in all)\n    __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n  if (from && typeof from === \"object\" || typeof from === \"function\") {\n    for (let key of __getOwnPropNames(from))\n      if (!__hasOwnProp.call(to, key) && key !== except)\n        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n  }\n  return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// lib/index.ts\nvar index_exports = {};\n__export(index_exports, {\n  Channels: () => Channels,\n  EventStatus: () => EventStatus,\n  RequestStatus: () => RequestStatus,\n  RequestWorkflowStatus: () => RequestWorkflowStatus,\n  SilentAuthChannel: () => SilentAuthChannel,\n  SilentAuthStatus: () => SilentAuthStatus,\n  Verify2: () => Verify2,\n  VerifyLocale: () => VerifyLocale\n});\nmodule.exports = __toCommonJS(index_exports);\n\n// lib/enums/channels.ts\nvar Channels = /* @__PURE__ */ ((Channels2) => {\n  Channels2[\"SMS\"] = \"sms\";\n  Channels2[\"WHATSAPP\"] = \"whatsapp\";\n  Channels2[\"WHATSAPP_INTERACTIVE\"] = \"whatsapp_interactive\";\n  Channels2[\"VOICE\"] = \"voice\";\n  Channels2[\"RCS\"] = \"rcs\";\n  Channels2[\"EMAIL\"] = \"email\";\n  return Channels2;\n})(Channels || {});\nvar SilentAuthChannel = /* @__PURE__ */ ((SilentAuthChannel2) => {\n  SilentAuthChannel2[\"SILENT_AUTH\"] = \"silent_auth\";\n  return SilentAuthChannel2;\n})(SilentAuthChannel || {});\n\n// lib/enums/eventStatus.ts\nvar EventStatus = /* @__PURE__ */ ((EventStatus2) => {\n  EventStatus2[\"COMPLETED\"] = \"completed\";\n  EventStatus2[\"FAILED\"] = \"failed\";\n  EventStatus2[\"USER_REJECTED\"] = \"user_rejected\";\n  EventStatus2[\"REJECTED\"] = \"rejected\";\n  return EventStatus2;\n})(EventStatus || {});\n\n// lib/enums/requestStatus.ts\nvar RequestStatus = /* @__PURE__ */ ((RequestStatus2) => {\n  RequestStatus2[\"COMPLETED\"] = \"completed\";\n  RequestStatus2[\"FAILED\"] = \"failed\";\n  RequestStatus2[\"EXPIRED\"] = \"expired\";\n  return RequestStatus2;\n})(RequestStatus || {});\n\n// lib/enums/requestWorkflowsStatus.ts\nvar RequestWorkflowStatus = /* @__PURE__ */ ((RequestWorkflowStatus2) => {\n  RequestWorkflowStatus2[\"UNUSED\"] = \"unused\";\n  RequestWorkflowStatus2[\"COMPLETED\"] = \"completed\";\n  RequestWorkflowStatus2[\"FAILED\"] = \"failed\";\n  RequestWorkflowStatus2[\"EXPIRED\"] = \"expired\";\n  RequestWorkflowStatus2[\"USER_REJECTED\"] = \"user_rejected\";\n  return RequestWorkflowStatus2;\n})(RequestWorkflowStatus || {});\n\n// lib/enums/silentAuthStatus.ts\nvar SilentAuthStatus = /* @__PURE__ */ ((SilentAuthStatus2) => {\n  SilentAuthStatus2[\"COMPLETED\"] = \"completed\";\n  SilentAuthStatus2[\"FAILED\"] = \"failed\";\n  SilentAuthStatus2[\"USER_REJECTED\"] = \"user_rejected\";\n  SilentAuthStatus2[\"EXPIRED\"] = \"expired\";\n  SilentAuthStatus2[\"ACTION_PENDING\"] = \"action_pending\";\n  return SilentAuthStatus2;\n})(SilentAuthStatus || {});\n\n// lib/enums/verifyLocale.ts\nvar VerifyLocale = /* @__PURE__ */ ((VerifyLocale2) => {\n  VerifyLocale2[\"EN_US\"] = \"en-us\";\n  VerifyLocale2[\"EN_GB\"] = \"en-gb\";\n  VerifyLocale2[\"ES_ES\"] = \"es-es\";\n  VerifyLocale2[\"ES_MX\"] = \"es-mx\";\n  VerifyLocale2[\"ES_US\"] = \"es-us\";\n  VerifyLocale2[\"IT_IT\"] = \"it-it\";\n  VerifyLocale2[\"FR_FR\"] = \"fr-fr\";\n  VerifyLocale2[\"DE_DE\"] = \"de-de\";\n  VerifyLocale2[\"RU_RU\"] = \"ru-ru\";\n  VerifyLocale2[\"HI_IN\"] = \"hi-in\";\n  VerifyLocale2[\"PT_BR\"] = \"pt-br\";\n  VerifyLocale2[\"PT_PT\"] = \"pt-pt\";\n  VerifyLocale2[\"ID_ID\"] = \"id-id\";\n  return VerifyLocale2;\n})(VerifyLocale || {});\n\n// lib/verify2.ts\nvar import_server_client = require(\"@vonage/server-client\");\nvar Verify2 = class extends import_server_client.Client {\n  /**\n   * The authentication type used for this client (JWT).\n   */\n  authType = import_server_client.AuthenticationType.JWT;\n  /**\n   * Creates a new verification request.\n   *\n   * @param {VerificationRequestParams} params - The parameters for the\n   *  verification request.\n   * @return {Request} A `Request` object containing the request ID.\n   */\n  async newRequest(params) {\n    const resp = await this.sendPostRequest(\n      `${this.config.apiHost}/v2/verify`,\n      import_server_client.Client.transformers.snakeCaseObjectKeys(params, true)\n    );\n    return {\n      requestId: resp.data.request_id,\n      checkUrl: resp.data.check_url\n    };\n  }\n  /**\n   * Checks a verification code against a verification request.\n   * @param {string} requestId - The ID of the verification request.\n   * @param {string} code - The verification code to check.\n   * @return {string} The status of the verification code check.\n   */\n  async checkCode(requestId, code) {\n    const resp = await this.sendPostRequest(\n      `${this.config.apiHost}/v2/verify/${requestId}`,\n      {\n        code\n      }\n    );\n    return resp.data.status;\n  }\n  /**\n   * Move the request to the next workflow step, if available.\n   * @param {string} requestId - The ID of the verification request.\n   * @return {boolean} `true` if the request was successful.\n   */\n  async nextWorkflow(requestId) {\n    try {\n      await this.sendPostRequest(\n        `${this.config.apiHost}/v2/verify/${requestId}/next_workflow`\n      );\n      return true;\n    } catch (_) {\n      return false;\n    }\n  }\n  /**\n   * Cancels a verification request.\n   * @param {string} requestId - The ID of the verification request to cancel.\n   * @return {boolean} `true` if the cancellation was successful.\n   */\n  async cancel(requestId) {\n    try {\n      await this.sendDeleteRequest(\n        `${this.config.apiHost}/v2/verify/${requestId}`\n      );\n      return true;\n    } catch (_) {\n      return false;\n    }\n  }\n  /**\n   * Generator function to list all templates across multiple pages.\n   *\n   * @remarks\n   * This will continue calling the API to retrieve all templates until there are no more pages left.\n   * The function yields each template in camelCase format.\n   *\n   * @param {ListAllTemplatesParams} [params={}] - Optional filter parameters, including pagination.\n   * @yields {Template} - Yields each template object in camelCase format.\n   *\n   * @example\n   * List all templates using pagination:\n   * ```ts\n   * for await (const template of templateClient.listAllTemplates({ pageSize: 5 })) {\n   *   console.log(template.name);\n   * }\n   * ```\n   *\n   * @example\n   * List all templates without pagination:\n   * ```ts\n   * for await (const template of templateClient.listAllTemplates()) {\n   *   console.log(template.name);\n   * }\n   * ```\n   */\n  async *listAllTemplates(params = {}) {\n    let next = null;\n    params.page = params?.page || 1;\n    do {\n      const resp = await this.getTemplatePage(params);\n      yield* resp.templates || [];\n      next = resp.links?.next;\n      params.page++;\n    } while (next);\n  }\n  /**\n   * Retrieves a single page of templates based on the provided pagination parameters.\n   *\n   * @param {ListAllTemplatesParams} params - The filter parameters for pagination (e.g., page number, page size).\n   * @return {Promise<ListAllTemplatesResponse>} - A promise resolving to a page of templates.\n   *\n   * @example\n   * Get a single page of templates:\n   *\n   * ```ts\n   * const templatePage = await templateClient.getTemplatePage({\n   *   page: 1,\n   *   pageSize: 10\n   * });\n   *\n   * templatePage.templates.forEach(template => {\n   *   console.log(template.name);\n   * });\n   * ```\n   */\n  async getTemplatePage(params = {}) {\n    const resp = await this.sendGetRequest(\n      `${this.config.apiHost}/v2/verify/templates`,\n      {\n        ...params.page ? { page: params.page } : {},\n        ...params.pageSize ? { page_size: params.pageSize } : {}\n      }\n    );\n    const templates = (resp.data._embedded?.templates || []).map(\n      (template) => import_server_client.Client.transformers.camelCaseObjectKeys(template)\n    );\n    return {\n      pageSize: resp.data.page_size,\n      page: resp.data.page,\n      totalPages: resp.data.total_pages,\n      totalItems: resp.data.total_items,\n      templates,\n      links: resp.data._links\n    };\n  }\n  /**\n   * Creates a new template with the provided details.\n   *\n   * @param {Template} template - The template details to be created.\n   * @return {Promise<Template>} - A promise resolving to the created template in camelCase format.\n   *\n   * @example\n   * Create a new template:\n   * ```ts\n   * const newTemplate = await templateClient.createTemplate({\n   *   name: 'My New Template',\n   * });\n   * console.log(newTemplate.name);\n   * ```\n   */\n  async createTemplate(template) {\n    const resp = await this.sendPostRequest(\n      `${this.config.apiHost}/v2/verify/templates`,\n      {\n        name: template.name\n      }\n    );\n    return import_server_client.Client.transformers.camelCaseObjectKeys(resp.data);\n  }\n  /**\n   * Retrieves a single template by its unique identifier.\n   *\n   * @param {string} templateId - The unique identifier of the template to retrieve.\n   * @return {Promise<Template>} - A promise resolving to the retrieved template in camelCase format.\n   *\n   * @example\n   * Get a template by ID:\n   * ```ts\n   * const template = await templateClient.getTemplate('22f571c1-f41a-4db2-bba7-f23a069200c1');\n   * console.log(template.name);\n   * ```\n   */\n  async getTemplate(templateId) {\n    const resp = await this.sendGetRequest(\n      `${this.config.apiHost}/v2/verify/templates/${templateId}`\n    );\n    return import_server_client.Client.transformers.camelCaseObjectKeys(resp.data);\n  }\n  /**\n   * Deletes a template by its unique identifier.\n   *\n   * @param {string} templateId - The unique identifier of the template to delete.\n   * @return {Promise<true>} - A promise that resolves when the template is successfully deleted.\n   *\n   * @example\n   * Delete a template by ID:\n   * ```ts\n   * await templateClient.deleteTemplate('22f571c1-f41a-4db2-bba7-f23a069200c1');\n   * console.log('Template deleted successfully');\n   * ```\n   */\n  async deleteTemplate(templateId) {\n    await this.sendDeleteRequest(\n      `${this.config.apiHost}/v2/verify/templates/${templateId}`\n    );\n    return true;\n  }\n  /**\n   * Updates an existing template with the provided details.\n   *\n   * @param {Template} template - The full template object with updated details. The template must include its ID.\n   * @return {Promise<Template>} - A promise resolving to the updated template in camelCase format.\n   *\n   * @example\n   * Update a template:\n   * ```ts\n   * const updatedTemplate = await templateClient.updateTemplate({\n   *   templateId: '22f571c1-f41a-4db2-bba7-f23a069200c1',\n   *   name: 'Updated Template Name',\n   *   isDefault: false,\n   * });\n   * console.log(updatedTemplate.name);\n   * ```\n   */\n  async updateTemplate(template) {\n    if (!template.templateId) {\n      throw new Error(\"Template ID is required for updating a template\");\n    }\n    const resp = await this.sendPatchRequest(\n      `${this.config.apiHost}/v2/verify/templates/${template.templateId}`,\n      {\n        name: template.name,\n        is_default: template.isDefault || false\n      }\n    );\n    return import_server_client.Client.transformers.camelCaseObjectKeys(resp.data);\n  }\n  /**\n   * Retrieves a page of template fragments based on the provided pagination and filter parameters.\n   *\n   * @param {ListAllTemplateFragmentsQueryParams} params - The filter parameters for pagination (e.g., page number, page size, template ID).\n   * @return {Promise<ListAllTemplateFragmentsResponse>} - A promise resolving to a page of template fragments.\n   *\n   * @example\n   * Get a page of template fragments:\n   * ```ts\n   * const fragmentPage = await templateClient.getTemplateFragmentPage({\n   *   templateId: '22f571c1-f41a-4db2-bba7-f23a069200c1',\n   *   page: 1,\n   *   pageSize: 10,\n   * });\n   * fragmentPage._embedded.template_fragments.forEach(fragment => {\n   *   console.log(fragment.text);\n   * });\n   * ```\n   */\n  async getTemplateFragmentPage(params) {\n    const resp = await this.sendGetRequest(\n      `${this.config.apiHost}/v2/verify/templates/${params.templateId}/template_fragments`,\n      {\n        ...params.page ? { page: params.page } : {},\n        ...params.pageSize ? { page_size: params.pageSize } : {}\n      }\n    );\n    const fragments = (resp.data._embedded?.template_fragments || []).map(\n      (fragment) => import_server_client.Client.transformers.camelCaseObjectKeys(fragment)\n    );\n    return {\n      pageSize: resp.data.page_size,\n      page: resp.data.page,\n      totalPages: resp.data.total_pages,\n      totalItems: resp.data.total_items,\n      fragments,\n      links: resp.data._links\n    };\n  }\n  /**\n   * Generator function to list all templates across multiple pages.\n   *\n   * @remarks\n   * This will continue calling the API to retrieve all templates until there are no more pages left.\n   * The function yields each template in camelCase format.\n   *\n   * @param {ListAllTemplateFragmentsParams} [params={}] - Optional filter parameters, including pagination.\n   * @yields {TemplateFragment} - Yields each template object in camelCase format.\n   *\n   * @example\n   * List all templates using pagination:\n   * ```ts\n   * for await (const template of templateClient.listAllTemplateFragments({ pageSize: 5 })) {\n   *   console.log(template.name);\n   * }\n   * ```\n   *\n   * @example\n   * List all templates without pagination:\n   * ```ts\n   * for await (const template of templateClient.listAllTemplateFragments()) {\n   *   console.log(template.name);\n   * }\n   * ```\n   */\n  async *listAllTemplateFragments(params) {\n    let next = null;\n    params.page = params?.page || 1;\n    do {\n      const resp = await this.getTemplateFragmentPage(params);\n      yield* resp.fragments || [];\n      next = resp.links?.next;\n      params.page++;\n    } while (next);\n  }\n  /**\n   * Retrieves a single template fragment by its unique identifier.\n   *\n   * @param {string} templateId - The unique identifier of the template.\n   * @param {string} fragmentId - The unique identifier of the template fragment.\n   * @return {Promise<TemplateFragmentResponse>} - A promise resolving to the retrieved template fragment in snake_case format.\n   *\n   * @example\n   * Get a template fragment by ID:\n   * ```ts\n   * const fragment = await templateClient.getTemplateFragment('22f571c1-f41a-4db2-bba7-f23a069200c1', 'c70f446e-997a-4313-a081-60a02a31dc19');\n   * console.log(fragment.text);\n   * ```\n   */\n  async getTemplateFragment(templateId, fragmentId) {\n    const resp = await this.sendGetRequest(\n      `${this.config.apiHost}/v2/verify/templates/${templateId}/template_fragments/${fragmentId}`\n    );\n    return import_server_client.Client.transformers.camelCaseObjectKeys(resp.data, true);\n  }\n  /**\n   * Creates a new template fragment with the provided details.\n   *\n   * @param {string} templateId - The unique identifier of the template to which the fragment belongs.\n   * @param {TemplateFragment} fragment - The details of the template fragment to be created.\n   * @return {Promise<TemplateFragment>} - A promise resolving to the created template fragment in camelCase format.\n   *\n   * @example\n   * Create a new template fragment:\n   * ```ts\n   * const newFragment = await templateClient.createTemplateFragment(\n   *   '22f571c1-f41a-4db2-bba7-f23a069200c1',\n   *   {\n   *     channel: 'sms',\n   *     locale: 'en-us',\n   *     text: 'Your verification code is ${code}',\n   *   },\n   * );\n   * console.log(newFragment.text);\n   * ```\n   */\n  async createTemplateFragment(templateId, fragment) {\n    const resp = await this.sendPostRequest(\n      `${this.config.apiHost}/v2/verify/templates/${templateId}/template_fragments`,\n      {\n        channel: fragment.channel,\n        locale: fragment.locale,\n        text: fragment.text\n      }\n    );\n    return import_server_client.Client.transformers.camelCaseObjectKeys(resp.data);\n  }\n  /**\n   * Deletes a template fragment by its unique identifier.\n   *\n   * @param {string} templateId - The unique identifier of the template to delete.\n   * @param {string} fragmentId - The unique identifier of the template to delete.\n   * @return {Promise<true>} - A promise that resolves when the template is successfully deleted.\n   *\n   * @example\n   * Delete a template by ID:\n   * ```ts\n   * await templateClient.deleteTemplateFragment(\n   *   '22f571c1-f41a-4db2-bba7-f23a069200c1'\n   *   'c70f446e-997a-4313-a081-60a02a31dc19',\n   * );\n   * console.log('Template Fragment deleted successfully');\n   * ```\n   */\n  async deleteTemplateFragment(templateId, fragmentId) {\n    await this.sendDeleteRequest(\n      `${this.config.apiHost}/v2/verify/templates/${templateId}/template_fragments/${fragmentId}`\n    );\n    return true;\n  }\n  /**\n   * Updates an existing template with the provided details.\n   *\n   * @param {String} templateId - The ID of the template this fragment belongs to.\n   * @param {TemplateFragment} fragment - The full template fragment object with updated details.\n   * @return {Promise<TemplateFragment>} - A promise resolving to the updated template fragment in camelCase format.\n   *\n   * @example\n   * Update a template:\n   * ```ts\n   * const updatedTemplateFragment = await templateClient.updateTemplateFragment(\n   *  '22f571c1-f41a-4db2-bba7-f23a069200c1',\n   *   {\n   *     templateId: '22f571c1-f41a-4db2-bba7-f23a069200c1',\n   *     name: 'Updated Template Name',\n   *     isDefault: false,\n   *   }\n   * );\n   * console.log(updatedTemplateFragment.name);\n   * ```\n   */\n  async updateTemplateFragment(templateId, fragment) {\n    if (!fragment.templateFragmentId) {\n      throw new Error(\"Template Fragment ID is required for updating a template fragment\");\n    }\n    const resp = await this.sendPatchRequest(\n      `${this.config.apiHost}/v2/verify/templates/${templateId}/template_fragments/${fragment.templateFragmentId}`,\n      {\n        text: fragment.text\n      }\n    );\n    return import_server_client.Client.transformers.camelCaseObjectKeys(resp.data);\n  }\n};\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n  Channels,\n  EventStatus,\n  RequestStatus,\n  RequestWorkflowStatus,\n  SilentAuthChannel,\n  SilentAuthStatus,\n  Verify2,\n  VerifyLocale\n});\n"]}