{"version":3,"sources":["../../../src/captcharator-v1-captcha-entity-captcha.http.ts","../../../src/captcharator-v1-captcha-entity-captcha.meta.ts"],"sourcesContent":["import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressViCaptcharatorCaptchaServiceUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'api._api_base_domain_': [\n      {\n        srcPath: '/captcharator-web',\n        destPath: '',\n      },\n    ],\n    'api._base_domain_': [\n      {\n        srcPath: '/_api/captcharator',\n        destPath: '',\n      },\n    ],\n    'www._base_domain_': [\n      {\n        srcPath: '/_api/captcharator',\n        destPath: '',\n      },\n      {\n        srcPath: '/_api/captcharator-web',\n        destPath: '/api',\n      },\n      {\n        srcPath: '/_api/captcha',\n        destPath: '/api',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/_api/captcha',\n        destPath: '/api',\n      },\n      {\n        srcPath: '/_api/captcharator',\n        destPath: '',\n      },\n      {\n        srcPath: '/_api/captcharator-web',\n        destPath: '/api',\n      },\n    ],\n    'www.wixapis.com': [\n      {\n        srcPath: '/captcharator/api/v1/authorize',\n        destPath: '/api/v1/authorize',\n      },\n    ],\n    _: [\n      {\n        srcPath: '/captcharator/api/v1/authorize',\n        destPath: '/api/v1/authorize',\n      },\n    ],\n    '*.dev.wix-code.com': [\n      {\n        srcPath: '/captcharator/api/v1/authorize',\n        destPath: '/api/v1/authorize',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_captcha_captcha';\n\n/**\n * Authorizes a CAPTCHA token.\n *\n * Following CAPTCHA verification on the client side, you must authorize the generated CAPTCHA\n * token in the backend.\n *\n * `Authorize` checks if the token is valid, making sure it was not tampered with or timed out.\n *\n * If you're developing a Wix site or Blocks app, call this method when working with the\n * [Wix reCAPTCHA](https://dev.wix.com/docs/velo/api-reference/$w/captcha/introduction) element.\n *\n * If CAPTCHA token authorization fails, the method returns an error message containing a status code.\n * The following table lists the possible HTTP error status codes, based on\n * [RFC 2616](https://datatracker.ietf.org/doc/html/rfc2616#section-10):\n *\n *\n * | Status Code | Name | Description |\n * |---|---|---|\n * | 400 | Bad Request | The request could not be understood by the server. This could occur for a number of reasons, such as: <ul> <li>The request was sent without a token.</li> <li>The token is invalid.</li> <li>The token has timed out.</li> </ul> |\n * | 401 | Unauthenticated | No user identity found in passed request. |\n * | 500 | Internal Server Error | The server encountered an unexpected condition, such as a missing or invalid private CAPTCHA key. |\n * | 503 | Unavailable | The service is unavailable due to one of the following: <ul> <li>Throttled error: Server overload due to more than the allowed requests in a given time frame.</li> <li>Request failed: No response following 10 retries with a 1-second interval.</li> </ul> |\n */\nexport function authorize(payload: object): RequestOptionsFactory<any> {\n  function __authorize({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.captcharator.v1.captcha_entity',\n      method: 'POST' as any,\n      methodFqn: 'com.wixpress.vi.captcharator.CaptchaService.authorize',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveComWixpressViCaptcharatorCaptchaServiceUrl({\n        protoPath: '/api/v1/authorize',\n        data: payload,\n        host,\n      }),\n      data: payload,\n    };\n\n    return metadata;\n  }\n\n  return __authorize;\n}\n","import * as ambassadorWixCaptcharatorV1CaptchaEntity from './captcharator-v1-captcha-entity-captcha.http.js';\nimport * as ambassadorWixCaptcharatorV1CaptchaEntityTypes from './captcharator-v1-captcha-entity-captcha.types.js';\nimport * as ambassadorWixCaptcharatorV1CaptchaEntityUniversalTypes from './captcharator-v1-captcha-entity-captcha.universal.js';\n\nexport type __PublicMethodMetaInfo<\n  K = string,\n  M = unknown,\n  T = unknown,\n  S = unknown,\n  Q = unknown,\n  R = unknown\n> = {\n  getUrl: (context: any) => string;\n  httpMethod: K;\n  path: string;\n  pathParams: M;\n  __requestType: T;\n  __originalRequestType: S;\n  __responseType: Q;\n  __originalResponseType: R;\n};\n\nexport function authorize(): __PublicMethodMetaInfo<\n  'POST',\n  {},\n  ambassadorWixCaptcharatorV1CaptchaEntityUniversalTypes.CaptchaRequest,\n  ambassadorWixCaptcharatorV1CaptchaEntityTypes.CaptchaRequest,\n  ambassadorWixCaptcharatorV1CaptchaEntityUniversalTypes.CaptchaResponse,\n  ambassadorWixCaptcharatorV1CaptchaEntityTypes.CaptchaResponse\n> {\n  const payload = {} as any;\n\n  const getRequestOptions =\n    ambassadorWixCaptcharatorV1CaptchaEntity.authorize(payload);\n\n  const getUrl = (context: any): string => {\n    const { url } = getRequestOptions(context);\n    return url!;\n  };\n\n  return {\n    getUrl,\n    httpMethod: 'POST',\n    path: '/api/v1/authorize',\n    pathParams: {},\n    __requestType: null as any,\n    __originalRequestType: null as any,\n    __responseType: null as any,\n    __originalResponseType: null as any,\n  };\n}\n\nexport {\n  CaptchaEntity as CaptchaEntityOriginal,\n  CaptchaRequest as CaptchaRequestOriginal,\n  CaptchaResponse as CaptchaResponseOriginal,\n  Errors as ErrorsOriginal,\n  AssessmentResponse as AssessmentResponseOriginal,\n} from './captcharator-v1-captcha-entity-captcha.types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAI3B,SAAS,kDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,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