{"version":3,"sources":["../../../src/ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.universal.ts","../../../src/ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.http.ts","../../../src/ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.public.ts","../../../src/ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.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 ambassadorWixEcomCustomTriggerV1CustomTrigger from './ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.http.js';\n\nexport interface CustomTrigger {\n  /**\n   * Unique ID of the trigger\n   * @minLength 1\n   * @maxLength 100\n   */\n  _id?: string;\n  /**\n   * App ID of the trigger provider\n   * @format GUID\n   */\n  appId?: string;\n}\n\nexport interface GetEligibleTriggersRequest {\n  /**\n   * List of line items to check the custom triggers on\n   * @maxSize 1000\n   */\n  lineItems?: LineItem[];\n  /**\n   * List of custom triggers to check 'is eligible' on\n   * @minSize 1\n   * @maxSize 1000\n   */\n  triggers?: TriggerToFilterBy[];\n  /**\n   * Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order.\n   * @format GUID\n   */\n  purchaseFlowId?: string | null;\n  /** Shipping information. */\n  shippingInfo?: ShippingInfo;\n}\n\nexport interface LineItem {\n  /**\n   * Line item ID.\n   * @minLength 1\n   * @maxLength 100\n   */\n  _id?: string;\n  /**\n   * Item quantity in this line item.\n   * @max 100000\n   */\n  quantity?: number | null;\n  /**\n   * Catalog and item reference. Holds IDs for the item and the catalog it came from, as well as further optional info.\n   * This field may be empty in the case of a custom line item.\n   */\n  catalogReference?: CatalogReference;\n  /**\n   * Price of a single item.\n   * @decimalValue options { gte:0 }\n   */\n  price?: string;\n}\n\n/** Used for grouping line items. Sent when an item is added to a cart, checkout, or order. */\nexport interface CatalogReference {\n  /**\n   * ID of the item within the catalog it belongs to.\n   * @minLength 1\n   * @maxLength 36\n   */\n  catalogItemId?: string;\n  /**\n   * ID of the app providing the catalog.\n   *\n   * You can get your app's ID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).\n   *\n   * For items from Wix catalogs, the following values always apply:\n   * + Wix Stores: `\"215238eb-22a5-4c36-9e7b-e7c08025e04e\"`\n   * + Wix Bookings: `\"13d21c63-b5ec-5912-8397-c3a5ddb27a97\"`\n   * + Wix Restaurants: `\"9a5d83fd-8570-482e-81ab-cfa88942ee60\"`\n   * @minLength 1\n   */\n  appId?: string;\n  /**\n   * Additional item details in `key:value` pairs.\n   *\n   * Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.\n   *\n   * For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration)\n   * or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction).\n   */\n  options?: Record<string, any> | null;\n}\n\nexport interface TriggerToFilterBy {\n  /** Custom trigger */\n  customTrigger?: CustomTrigger;\n  /**\n   * Unique identifier that will return in `EligibleTrigger.identifier` to distinguish between scopes\n   * @minLength 1\n   * @maxLength 120\n   */\n  identifier?: string | null;\n}\n\nexport interface ShippingInfo {\n  /** Address (if applicable). */\n  address?: Address;\n  /**\n   * Preferred shipping option code. For example, \"usps_std_overnight\".\n   * @minLength 1\n   * @maxLength 100\n   */\n  preferredShippingOptionCode?: string | null;\n}\n\nexport interface Address {\n  /**\n   * Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format.\n   * @format COUNTRY\n   */\n  country?: string | null;\n  /**\n   * Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format.\n   * @maxLength 50\n   */\n  subdivision?: string | null;\n  /**\n   * City name.\n   * @maxLength 50\n   */\n  city?: string | null;\n}\n\nexport interface GetEligibleTriggersResponse {\n  /**\n   * A List of eligible custom triggers\n   * @maxSize 1000\n   */\n  eligibleTriggers?: EligibleTrigger[];\n}\n\nexport interface EligibleTrigger {\n  /**\n   * The ID of the custom trigger\n   * @minLength 1\n   * @maxLength 100\n   */\n  customTriggerId?: string;\n  /**\n   * The id of the application implements this custom trigger\n   * @format GUID\n   */\n  appId?: string;\n  /**\n   * Unique identifier that was assigned in `TriggerToFilterBy.identifier` to distinguish between custom triggers\n   * @minLength 1\n   * @maxLength 120\n   */\n  identifier?: string | null;\n}\n\nexport interface ListTriggersRequest {}\n\nexport interface ListTriggersResponse {\n  /**\n   * A list of all custom triggers\n   * @maxSize 1000\n   */\n  triggers?: ListTriggersResponseCustomTrigger[];\n}\n\nexport interface ListTriggersResponseCustomTrigger {\n  /**\n   * Unique ID of the custom trigger\n   * @minLength 1\n   * @maxLength 100\n   */\n  _id?: string;\n  /**\n   * App ID of the custom trigger provider\n   * @format GUID\n   */\n  appId?: string;\n  /**\n   * Custom Trigger display name\n   * @minLength 1\n   * @maxLength 200\n   */\n  name?: string;\n}\n\n/**\n * List all custom triggers that are available on a given site\n * @public\n * @documentationMaturity preview\n * @permissionId ECOM.CUSTOM_TRIGGERS_READ\n * @applicableIdentity APP\n * @fqn com.wix.ecom.custom_trigger.v1.CustomTriggersService.ListTriggers\n */\nexport async function listTriggers(): Promise<\n  NonNullablePaths<\n    ListTriggersResponse,\n    | `triggers`\n    | `triggers.${number}._id`\n    | `triggers.${number}.appId`\n    | `triggers.${number}.name`,\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 =\n    ambassadorWixEcomCustomTriggerV1CustomTrigger.listTriggers(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 { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixEcomCustomTriggerV1CustomTriggersServiceUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'api._api_base_domain_': [\n      {\n        srcPath: '/custom-triggers-service',\n        destPath: '',\n      },\n    ],\n    'www.wixapis.com': [\n      {\n        srcPath: '/ecom/v1/discount-custom-triggers',\n        destPath: '/v1/discount-custom-triggers',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/ecom/v1/discount-custom-triggers',\n        destPath: '/v1/discount-custom-triggers',\n      },\n      {\n        srcPath: '/v1/discount-custom-triggers',\n        destPath: '/v1/discount-custom-triggers',\n      },\n    ],\n    '*.dev.wix-code.com': [\n      {\n        srcPath: '/_api/custom-triggers-service',\n        destPath: '',\n      },\n    ],\n    _: [\n      {\n        srcPath: '/_api/custom-triggers-service',\n        destPath: '',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_discounts-custom-trigger';\n\n/** List all custom triggers that are available on a given site */\nexport function listTriggers(payload: object): RequestOptionsFactory<any> {\n  function __listTriggers({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.ecom.custom_trigger.v1.custom_trigger',\n      method: 'POST' as any,\n      methodFqn:\n        'com.wix.ecom.custom_trigger.v1.CustomTriggersService.ListTriggers',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveComWixEcomCustomTriggerV1CustomTriggersServiceUrl({\n        protoPath: '/v1/discount-custom-triggers/list',\n        data: payload,\n        host,\n      }),\n      data: payload,\n    };\n\n    return metadata;\n  }\n\n  return __listTriggers;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n  ListTriggersResponse,\n  listTriggers as universalListTriggers,\n} from './ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\nexport function listTriggers(httpClient: HttpClient): ListTriggersSignature {\n  return () =>\n    universalListTriggers(\n      // @ts-ignore\n      { httpClient }\n    );\n}\n\ninterface ListTriggersSignature {\n  /**\n   * List all custom triggers that are available on a given site\n   */\n  (): Promise<\n    NonNullablePaths<\n      ListTriggersResponse,\n      | `triggers`\n      | `triggers.${number}._id`\n      | `triggers.${number}.appId`\n      | `triggers.${number}.name`,\n      4\n    >\n  >;\n}\n\nexport {\n  Address,\n  CatalogReference,\n  CustomTrigger,\n  EligibleTrigger,\n  GetEligibleTriggersRequest,\n  GetEligibleTriggersResponse,\n  LineItem,\n  ListTriggersRequest,\n  ListTriggersResponse,\n  ListTriggersResponseCustomTrigger,\n  ShippingInfo,\n  TriggerToFilterBy,\n} from './ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.universal.js';\n","import { listTriggers as publicListTriggers } from './ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listTriggers: MaybeContext<\n  BuildRESTFunction<typeof publicListTriggers> & typeof publicListTriggers\n> = /*#__PURE__*/ createRESTModule(publicListTriggers);\n\nexport {\n  CustomTrigger,\n  GetEligibleTriggersRequest,\n  LineItem,\n  CatalogReference,\n  TriggerToFilterBy,\n  ShippingInfo,\n  Address,\n  GetEligibleTriggersResponse,\n  EligibleTrigger,\n  ListTriggersRequest,\n  ListTriggersResponse,\n  ListTriggersResponseCustomTrigger,\n} from './ecom-custom-trigger-v1-custom-trigger-discounts-custom-trigger.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,yDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;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,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,aAAa,SAA6C;AACxE,WAAS,eAAe,EAAE,KAAK,GAAQ;AACrC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,yDAAyD;AAAA,QAC5D,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;ADmIA,eAAsBA,gBASpB;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC,CAAC,CAAC;AAExD,QAAM,UAC0C,aAAa,OAAO;AAEpE,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,CAAC;AAAA,QAC3B,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC;AAAA,IACH;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AE7OO,SAASC,cAAa,YAA+C;AAC1E,SAAO,MACLA;AAAA;AAAA,IAEE,EAAE,WAAW;AAAA,EACf;AACJ;;;ACbA,SAAS,wBAAwB;AAG1B,IAAMC,gBAEK,iCAAiBA,aAAkB;","names":["listTriggers","listTriggers","listTriggers"]}