{"version":3,"sources":["../../src/settings-v1-site-currency-site-settings.universal.ts","../../src/settings-v1-site-currency-site-settings.http.ts","../../src/settings-v1-site-currency-site-settings.public.ts","../../src/settings-v1-site-currency-site-settings.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n  renameKeysFromSDKRequestToRESTRequest,\n  renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixSettingsV1SiteCurrency from './settings-v1-site-currency-site-settings.http.js';\n\n/**\n * A currency that can be displayed on a site.\n * Site currencies control which currencies visitors can view prices in.\n * When a currency is enabled for a site, prices are automatically converted from their original currency using up-to-date exchange rates.\n */\nexport interface SiteCurrency {\n  /**\n   * Three-letter currency code, in [ISO-4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes) format.\n   * @maxLength 3\n   * @format CURRENCY\n   */\n  code?: string;\n}\n\nexport interface SetCurrenciesRequest {\n  /**\n   * List of currencies to enable for the site.\n   * This list replaces any previously configured currencies.\n   * Pass an empty array to disable currency conversion.\n   * @maxSize 156\n   */\n  currencies?: SiteCurrency[];\n}\n\nexport interface SetCurrenciesResponse {}\n\nexport interface GetCurrenciesRequest {}\n\nexport interface GetCurrenciesResponse {\n  /** List of currencies currently enabled for the site. */\n  currencies?: SiteCurrency[];\n}\n\nexport interface SetCheckoutCurrenciesRequest {\n  /**\n   * The new checkout currency list\n   * @maxSize 156\n   */\n  currencies?: SiteCurrency[];\n}\n\nexport interface SetCheckoutCurrenciesResponse {}\n\nexport interface GetCheckoutCurrenciesRequest {}\n\nexport interface GetCheckoutCurrenciesResponse {\n  /** Currencies supported in checkout */\n  currencies?: SiteCurrency[];\n}\n\n/**\n * Sets the list of currencies that can be displayed on the site.\n *\n * When you set currencies for a site, visitors can view prices in any of these currencies.\n * Prices are automatically converted using up-to-date exchange rates.\n * The supplied list completely replaces the previous currency list.\n *\n * To disable currency conversion entirely, pass an empty array.\n * @public\n * @permissionId CURRENCY_CONVERTER.MODIFY_SITE_CURRENCIES\n * @applicableIdentity APP\n * @fqn com.wixpress.currency.site.settings.api.v1.SiteCurrencySettings.SetCurrencies\n */\nexport async function setCurrencies(\n  options?: SetCurrenciesOptions\n): Promise<void> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[1] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({\n    currencies: options?.currencies,\n  });\n\n  const reqOpts = ambassadorWixSettingsV1SiteCurrency.setCurrencies(payload);\n\n  sideEffects?.onSiteCall?.();\n  try {\n    const result = await httpClient.request(reqOpts);\n    sideEffects?.onSuccess?.(result);\n  } catch (err: any) {\n    const transformedError = sdkTransformError(\n      err,\n      {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: { currencies: '$[0].currencies' },\n        singleArgumentUnchanged: false,\n      },\n      ['options']\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n\nexport interface SetCurrenciesOptions {\n  /**\n   * List of currencies to enable for the site.\n   * This list replaces any previously configured currencies.\n   * Pass an empty array to disable currency conversion.\n   * @maxSize 156\n   */\n  currencies?: SiteCurrency[];\n}\n\n/**\n * Retrieves the list of currencies that can be displayed on the site.\n *\n * Returns all currencies that are currently enabled for the site.\n * Visitors can view prices in any of these currencies.\n * @public\n * @permissionId CURRENCY_CONVERTER.READ_SITE_CURRENCIES\n * @applicableIdentity APP\n * @fqn com.wixpress.currency.site.settings.api.v1.SiteCurrencySettings.GetCurrencies\n */\nexport async function getCurrencies(): Promise<\n  NonNullablePaths<\n    GetCurrenciesResponse,\n    `currencies` | `currencies.${number}.code`,\n    4\n  >\n> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[0] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n  const reqOpts = ambassadorWixSettingsV1SiteCurrency.getCurrencies(payload);\n\n  sideEffects?.onSiteCall?.();\n  try {\n    const result = await httpClient.request(reqOpts);\n    sideEffects?.onSuccess?.(result);\n\n    return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n  } catch (err: any) {\n    const transformedError = sdkTransformError(\n      err,\n      {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: {},\n        singleArgumentUnchanged: false,\n      },\n      []\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressCurrencySiteSettingsApiV1SiteCurrencySettingsUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'api._api_base_domain_': [\n      {\n        srcPath: '/_api/currency-site-settings',\n        destPath: '',\n      },\n    ],\n    'currency-converter.wixapps.net': [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    _: [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    'editor._base_domain_': [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    'blocks._base_domain_': [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    'create.editorx': [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    '*.dev.wix-code.com': [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    'www._base_domain_': [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/_api/currency-converter-settings',\n        destPath: '',\n      },\n    ],\n    'www.wixapis.com': [\n      {\n        srcPath: '/settings/v1/currencies/site',\n        destPath: '/v1/currencies/site',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_currency-converter_site-settings';\n\n/**\n * Sets the list of currencies that can be displayed on the site.\n *\n * When you set currencies for a site, visitors can view prices in any of these currencies.\n * Prices are automatically converted using up-to-date exchange rates.\n * The supplied list completely replaces the previous currency list.\n *\n * To disable currency conversion entirely, pass an empty array.\n */\nexport function setCurrencies(payload: object): RequestOptionsFactory<any> {\n  function __setCurrencies({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.settings.v1.site_currency',\n      method: 'PUT' as any,\n      methodFqn:\n        'com.wixpress.currency.site.settings.api.v1.SiteCurrencySettings.SetCurrencies',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveComWixpressCurrencySiteSettingsApiV1SiteCurrencySettingsUrl({\n        protoPath: '/v1/currencies/site',\n        data: payload,\n        host,\n      }),\n      data: payload,\n    };\n\n    return metadata;\n  }\n\n  return __setCurrencies;\n}\n\n/**\n * Retrieves the list of currencies that can be displayed on the site.\n *\n * Returns all currencies that are currently enabled for the site.\n * Visitors can view prices in any of these currencies.\n */\nexport function getCurrencies(payload: object): RequestOptionsFactory<any> {\n  function __getCurrencies({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.settings.v1.site_currency',\n      method: 'GET' as any,\n      methodFqn:\n        'com.wixpress.currency.site.settings.api.v1.SiteCurrencySettings.GetCurrencies',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveComWixpressCurrencySiteSettingsApiV1SiteCurrencySettingsUrl({\n        protoPath: '/v1/currencies/site',\n        data: payload,\n        host,\n      }),\n      params: toURLSearchParams(payload),\n    };\n\n    return metadata;\n  }\n\n  return __getCurrencies;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n  GetCurrenciesResponse,\n  SetCurrenciesOptions,\n  getCurrencies as universalGetCurrencies,\n  setCurrencies as universalSetCurrencies,\n} from './settings-v1-site-currency-site-settings.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/currency-converter' };\n\nexport function setCurrencies(httpClient: HttpClient): SetCurrenciesSignature {\n  return (options?: SetCurrenciesOptions) =>\n    universalSetCurrencies(\n      options,\n      // @ts-ignore\n      { httpClient }\n    );\n}\n\ninterface SetCurrenciesSignature {\n  /**\n   * Sets the list of currencies that can be displayed on the site.\n   *\n   * When you set currencies for a site, visitors can view prices in any of these currencies.\n   * Prices are automatically converted using up-to-date exchange rates.\n   * The supplied list completely replaces the previous currency list.\n   *\n   * To disable currency conversion entirely, pass an empty array.\n   */\n  (options?: SetCurrenciesOptions): Promise<void>;\n}\n\nexport function getCurrencies(httpClient: HttpClient): GetCurrenciesSignature {\n  return () =>\n    universalGetCurrencies(\n      // @ts-ignore\n      { httpClient }\n    );\n}\n\ninterface GetCurrenciesSignature {\n  /**\n   * Retrieves the list of currencies that can be displayed on the site.\n   *\n   * Returns all currencies that are currently enabled for the site.\n   * Visitors can view prices in any of these currencies.\n   */\n  (): Promise<\n    NonNullablePaths<\n      GetCurrenciesResponse,\n      `currencies` | `currencies.${number}.code`,\n      4\n    >\n  >;\n}\n\nexport {\n  GetCheckoutCurrenciesRequest,\n  GetCheckoutCurrenciesResponse,\n  GetCurrenciesRequest,\n  GetCurrenciesResponse,\n  SetCheckoutCurrenciesRequest,\n  SetCheckoutCurrenciesResponse,\n  SetCurrenciesOptions,\n  SetCurrenciesRequest,\n  SetCurrenciesResponse,\n  SiteCurrency,\n} from './settings-v1-site-currency-site-settings.universal.js';\n","import {\n  setCurrencies as publicSetCurrencies,\n  getCurrencies as publicGetCurrencies,\n} from './settings-v1-site-currency-site-settings.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const setCurrencies: MaybeContext<\n  BuildRESTFunction<typeof publicSetCurrencies> & typeof publicSetCurrencies\n> = /*#__PURE__*/ createRESTModule(publicSetCurrencies);\nexport const getCurrencies: MaybeContext<\n  BuildRESTFunction<typeof publicGetCurrencies> & typeof publicGetCurrencies\n> = /*#__PURE__*/ createRESTModule(publicGetCurrencies);\n\nexport {\n  SiteCurrency,\n  SetCurrenciesRequest,\n  SetCurrenciesResponse,\n  GetCurrenciesRequest,\n  GetCurrenciesResponse,\n  SetCheckoutCurrenciesRequest,\n  SetCheckoutCurrenciesResponse,\n  GetCheckoutCurrenciesRequest,\n  GetCheckoutCurrenciesResponse,\n  SetCurrenciesOptions,\n} from './settings-v1-site-currency-site-settings.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,mEACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kCAAkC;AAAA,MAChC;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,kBAAkB;AAAA,MAChB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,I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