@wix/auto_sdk_ecom_order-invoices 1.0.21 → 1.0.22

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.
@@ -1,7 +1,8 @@
1
- import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
2
  import { ListInvoicesForMultipleOrdersResponse } from './index.typings.js';
3
3
  export { ActionEvent, AddInvoiceToOrderRequest, AddInvoiceToOrderResponse, ApplicationError, BulkActionMetadata, BulkGenerateInvoicesRequest, BulkGenerateInvoicesResponse, BulkInvoiceResult, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, GenerateInvoiceRequest, GenerateInvoiceResponse, GenerateInvoiceWithNumberRequest, GenerateInvoiceWithNumberResponse, GetOrderInvoiceRequest, GetOrderInvoiceResponse, IdentificationData, IdentificationDataIdOneOf, Invoice, InvoiceForOrder, InvoicesForOrder, ItemMetadata, ListInvoicesForMultipleOrdersRequest, ListInvoicesForSingleOrderRequest, ListInvoicesForSingleOrderResponse, MessageEnvelope, RestoreInfo, WebhookIdentityType } from './index.typings.js';
4
4
 
5
+ type InvoiceNonNullablePaths = `_id` | `appId`;
5
6
  declare function listInvoicesForMultipleOrders$1(httpClient: HttpClient): ListInvoicesForMultipleOrdersSignature;
6
7
  interface ListInvoicesForMultipleOrdersSignature {
7
8
  /**
@@ -11,7 +12,9 @@ interface ListInvoicesForMultipleOrdersSignature {
11
12
  * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.
12
13
  * @param - Order IDs for which to retrieve invoices.
13
14
  */
14
- (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;
15
+ (orderIds: string[]): Promise<NonNullablePaths<ListInvoicesForMultipleOrdersResponse, `invoicesForOrder` | `invoicesForOrder.${number}.orderId` | {
16
+ [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;
17
+ }[InvoiceNonNullablePaths]>>;
15
18
  }
16
19
 
17
20
  declare const listInvoicesForMultipleOrders: MaybeContext<BuildRESTFunction<typeof listInvoicesForMultipleOrders$1> & typeof listInvoicesForMultipleOrders$1>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../index.ts","../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../src/ecom-orders-v1-invoice-order-invoices.context.ts"],"sourcesContent":["export * from './src/ecom-orders-v1-invoice-order-invoices.context.js';\n","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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n GenerateInvoiceResponse & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors | undefined;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<BulkGenerateInvoicesResponse>;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (orderId: string, invoiceInfo: Invoice): Promise<AddInvoiceToOrderResponse>;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA,4BAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,qCAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,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,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAQd,SAAS,8BACd,SAC4B;AAC5B,WAAS,gCAAgC,EAAE,KAAK,GAAQ;AACtD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,6CAA6C;AAAA,QAChD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGO,SAAS,gB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ACf;AACJ;AAWO,SAASC,mBACd,YAC4B;AAC5B,SAAO,CACL,SACA,gBAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;AC1FA,IAAAC,uBAAiC;AAG1B,IAAMC,iCAGK,2DAAiBA,8BAAmC;AAE/D,IAAMC,mBAEK,2DAAiBA,gBAAqB;AAEjD,IAAMC,wBAGK,2DAAiBA,qBAA0B;AAEtD,IAAMC,qBAGK,2DAAiBA,kBAAuB;","names":["addInvoiceToOrder","bulkGenerateInvoices","generateInvoice","listInvoicesForMultipleOrders","WebhookIdentityType","listInvoicesForMultipleOrders","sdkTransformError","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","import_rest_modules","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
1
+ {"version":3,"sources":["../../index.ts","../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../src/ecom-orders-v1-invoice-order-invoices.context.ts"],"sourcesContent":["export * from './src/ecom-orders-v1-invoice-order-invoices.context.js';\n","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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n >;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-or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C,qBAGK,2DAAiBA,kBAAuB;","names":["addInvoiceToOrder","bulkGenerateInvoices","generateInvoice","listInvoicesForMultipleOrders","WebhookIdentityType","listInvoicesForMultipleOrders","sdkTransformError","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","import_rest_modules","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
@@ -1,7 +1,8 @@
1
- import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
2
  import { ListInvoicesForMultipleOrdersResponse } from './index.typings.mjs';
3
3
  export { ActionEvent, AddInvoiceToOrderRequest, AddInvoiceToOrderResponse, ApplicationError, BulkActionMetadata, BulkGenerateInvoicesRequest, BulkGenerateInvoicesResponse, BulkInvoiceResult, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, GenerateInvoiceRequest, GenerateInvoiceResponse, GenerateInvoiceWithNumberRequest, GenerateInvoiceWithNumberResponse, GetOrderInvoiceRequest, GetOrderInvoiceResponse, IdentificationData, IdentificationDataIdOneOf, Invoice, InvoiceForOrder, InvoicesForOrder, ItemMetadata, ListInvoicesForMultipleOrdersRequest, ListInvoicesForSingleOrderRequest, ListInvoicesForSingleOrderResponse, MessageEnvelope, RestoreInfo, WebhookIdentityType } from './index.typings.mjs';
4
4
 
5
+ type InvoiceNonNullablePaths = `_id` | `appId`;
5
6
  declare function listInvoicesForMultipleOrders$1(httpClient: HttpClient): ListInvoicesForMultipleOrdersSignature;
6
7
  interface ListInvoicesForMultipleOrdersSignature {
7
8
  /**
@@ -11,7 +12,9 @@ interface ListInvoicesForMultipleOrdersSignature {
11
12
  * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.
12
13
  * @param - Order IDs for which to retrieve invoices.
13
14
  */
14
- (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;
15
+ (orderIds: string[]): Promise<NonNullablePaths<ListInvoicesForMultipleOrdersResponse, `invoicesForOrder` | `invoicesForOrder.${number}.orderId` | {
16
+ [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;
17
+ }[InvoiceNonNullablePaths]>>;
15
18
  }
16
19
 
17
20
  declare const listInvoicesForMultipleOrders: MaybeContext<BuildRESTFunction<typeof listInvoicesForMultipleOrders$1> & typeof listInvoicesForMultipleOrders$1>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../src/ecom-orders-v1-invoice-order-invoices.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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n GenerateInvoiceResponse & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors | undefined;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<BulkGenerateInvoicesResponse>;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (orderId: string, invoiceInfo: Invoice): Promise<AddInvoiceToOrderResponse>;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,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,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;AAQd,SAAS,8BACd,SAC4B;AAC5B,WAAS,gCAAgC,EAAE,KAAK,GAAQ;AACtD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,6CAA6C;AAAA,QAChD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AA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ACJ;AAWO,SAASC,mBACd,YAC4B;AAC5B,SAAO,CACL,SACA,gBAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;AC1FA,SAAS,wBAAwB;AAG1B,IAAMC,iCAGK,iCAAiBA,8BAAmC;AAE/D,IAAMC,mBAEK,iCAAiBA,gBAAqB;AAEjD,IAAMC,wBAGK,iCAAiBA,qBAA0B;AAEtD,IAAMC,qBAGK,iCAAiBA,kBAAuB;","names":["WebhookIdentityType","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
1
+ {"version":3,"sources":["../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../src/ecom-orders-v1-invoice-order-invoices.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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n >;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;A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,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,EAAE,SAAS,QAAQ,aAAa,OAAO;AAAA,QACjE,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,aAAa;AAAA,IAC3B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEjlBO,SAASC,+BACd,YACwC;AACxC,SAAO,CAAC,aACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAuBO,SAASC,iBACd,YAC0B;AAC1B,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAeO,SAASC,sBACd,YAC+B;AAC/B,SAAO,CAAC,aACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAyBO,SAASC,mBACd,YAC4B;AAC5B,SAAO,CACL,SACA,gBAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnHA,SAAS,wBAAwB;AAG1B,IAAMC,iCAGK,iCAAiBA,8BAAmC;AAE/D,IAAMC,mBAEK,iCAAiBA,gBAAqB;AAEjD,IAAMC,wBAGK,iCAAiBA,qBAA0B;AAEtD,IAAMC,qBAGK,iCAAiBA,kBAAuB;","names":["WebhookIdentityType","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
@@ -1,7 +1,8 @@
1
- import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
2
  import { ListInvoicesForMultipleOrdersResponse, GenerateInvoiceResponse, GenerateInvoiceApplicationErrors, BulkGenerateInvoicesResponse, Invoice, AddInvoiceToOrderResponse } from './index.typings.js';
3
3
  export { ActionEvent, AddInvoiceToOrderRequest, ApplicationError, BulkActionMetadata, BulkGenerateInvoicesRequest, BulkInvoiceResult, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, GenerateInvoiceRequest, GenerateInvoiceWithNumberRequest, GenerateInvoiceWithNumberResponse, GetOrderInvoiceRequest, GetOrderInvoiceResponse, IdentificationData, IdentificationDataIdOneOf, InvoiceForOrder, InvoicesForOrder, ItemMetadata, ListInvoicesForMultipleOrdersRequest, ListInvoicesForSingleOrderRequest, ListInvoicesForSingleOrderResponse, MessageEnvelope, RestoreInfo, WebhookIdentityType } from './index.typings.js';
4
4
 
5
+ type InvoiceNonNullablePaths = `_id` | `appId`;
5
6
  declare function listInvoicesForMultipleOrders$1(httpClient: HttpClient): ListInvoicesForMultipleOrdersSignature;
6
7
  interface ListInvoicesForMultipleOrdersSignature {
7
8
  /**
@@ -11,7 +12,9 @@ interface ListInvoicesForMultipleOrdersSignature {
11
12
  * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.
12
13
  * @param - Order IDs for which to retrieve invoices.
13
14
  */
14
- (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;
15
+ (orderIds: string[]): Promise<NonNullablePaths<ListInvoicesForMultipleOrdersResponse, `invoicesForOrder` | `invoicesForOrder.${number}.orderId` | {
16
+ [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;
17
+ }[InvoiceNonNullablePaths]>>;
15
18
  }
16
19
  /** @internal */
17
20
  declare function generateInvoice$1(httpClient: HttpClient): GenerateInvoiceSignature;
@@ -20,8 +23,8 @@ interface GenerateInvoiceSignature {
20
23
  * Generates and adds an invoice to a specified order.
21
24
  * @param - Order ID.
22
25
  */
23
- (orderId: string): Promise<GenerateInvoiceResponse & {
24
- __applicationErrorsType?: GenerateInvoiceApplicationErrors | undefined;
26
+ (orderId: string): Promise<NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {
27
+ __applicationErrorsType?: GenerateInvoiceApplicationErrors;
25
28
  }>;
26
29
  }
27
30
  /** @internal */
@@ -31,7 +34,7 @@ interface BulkGenerateInvoicesSignature {
31
34
  * Generates and adds invoices to all specified orders.
32
35
  * @param - Order IDs.
33
36
  */
34
- (orderIds: string[]): Promise<BulkGenerateInvoicesResponse>;
37
+ (orderIds: string[]): Promise<NonNullablePaths<BulkGenerateInvoicesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `results.${number}.item.orderId` | `results.${number}.item.invoiceId` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`>>;
35
38
  }
36
39
  /** @internal */
37
40
  declare function addInvoiceToOrder$1(httpClient: HttpClient): AddInvoiceToOrderSignature;
@@ -41,7 +44,9 @@ interface AddInvoiceToOrderSignature {
41
44
  * @param - Order ID.
42
45
  * @param - Invoice info.
43
46
  */
44
- (orderId: string, invoiceInfo: Invoice): Promise<AddInvoiceToOrderResponse>;
47
+ (orderId: string, invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>): Promise<NonNullablePaths<AddInvoiceToOrderResponse, {
48
+ [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;
49
+ }[InvoiceNonNullablePaths]>>;
45
50
  }
46
51
 
47
52
  declare const listInvoicesForMultipleOrders: MaybeContext<BuildRESTFunction<typeof listInvoicesForMultipleOrders$1> & typeof listInvoicesForMultipleOrders$1>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../index.ts","../../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../../src/ecom-orders-v1-invoice-order-invoices.context.ts"],"sourcesContent":["export * from './src/ecom-orders-v1-invoice-order-invoices.context.js';\n","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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n GenerateInvoiceResponse & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors | undefined;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<BulkGenerateInvoicesResponse>;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (orderId: string, invoiceInfo: Invoice): Promise<AddInvoiceToOrderResponse>;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA,4BAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,qCAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAA2B;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,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,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,aAAO,gCAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAQd,SAAS,8BACd,SAC4B;AAC5B,WAAS,gCAAgC,EAAE,KAAK,GAAQ;AACtD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,6CAA6C;AAAA,QAChD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGO,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,KAAK,6CAA6C;AAAA,QAChD,WAAW;AAAA,QACX,MAAM;AAAA,QAC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MC,mBAEK,2DAAiBA,gBAAqB;AAEjD,IAAMC,wBAGK,2DAAiBA,qBAA0B;AAEtD,IAAMC,qBAGK,2DAAiBA,kBAAuB;","names":["addInvoiceToOrder","bulkGenerateInvoices","generateInvoice","listInvoicesForMultipleOrders","WebhookIdentityType","listInvoicesForMultipleOrders","sdkTransformError","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","import_rest_modules","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
1
+ {"version":3,"sources":["../../../index.ts","../../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../../src/ecom-orders-v1-invoice-order-invoices.context.ts"],"sourcesContent":["export * from './src/ecom-orders-v1-invoice-order-invoices.context.js';\n","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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n >;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA,4BAAAC;AAAA,EAAA,uBAAAC;AAAA,EAAA,qCAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0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AE1E,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO,uEAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAH;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,SAAS,QAAQ,aAAa,OAAO;AAAA,QACjE,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,aAAa;AAAA,IAC3B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEjlBO,SAASI,+BACd,YACwC;AACxC,SAAO,CAAC,aACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAuBO,SAASC,iBACd,YAC0B;AAC1B,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAeO,SAASC,sBACd,YAC+B;AAC/B,SAAO,CAAC,aACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAyBO,SAASC,mBACd,YAC4B;AAC5B,SAAO,CACL,SACA,gBAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnHA,IAAAC,uBAAiC;AAG1B,IAAMC,iCAGK,2DAAiBA,8BAAmC;AAE/D,IAAMC,mBAEK,2DAAiBA,gBAAqB;AAEjD,IAAMC,wBAGK,2DAAiBA,qBAA0B;AAEtD,IAAMC,qBAGK,2DAAiBA,kBAAuB;","names":["addInvoiceToOrder","bulkGenerateInvoices","generateInvoice","listInvoicesForMultipleOrders","WebhookIdentityType","listInvoicesForMultipleOrders","sdkTransformError","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","import_rest_modules","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
@@ -1,7 +1,8 @@
1
- import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
2
  import { ListInvoicesForMultipleOrdersResponse, GenerateInvoiceResponse, GenerateInvoiceApplicationErrors, BulkGenerateInvoicesResponse, Invoice, AddInvoiceToOrderResponse } from './index.typings.mjs';
3
3
  export { ActionEvent, AddInvoiceToOrderRequest, ApplicationError, BulkActionMetadata, BulkGenerateInvoicesRequest, BulkInvoiceResult, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, GenerateInvoiceRequest, GenerateInvoiceWithNumberRequest, GenerateInvoiceWithNumberResponse, GetOrderInvoiceRequest, GetOrderInvoiceResponse, IdentificationData, IdentificationDataIdOneOf, InvoiceForOrder, InvoicesForOrder, ItemMetadata, ListInvoicesForMultipleOrdersRequest, ListInvoicesForSingleOrderRequest, ListInvoicesForSingleOrderResponse, MessageEnvelope, RestoreInfo, WebhookIdentityType } from './index.typings.mjs';
4
4
 
5
+ type InvoiceNonNullablePaths = `_id` | `appId`;
5
6
  declare function listInvoicesForMultipleOrders$1(httpClient: HttpClient): ListInvoicesForMultipleOrdersSignature;
6
7
  interface ListInvoicesForMultipleOrdersSignature {
7
8
  /**
@@ -11,7 +12,9 @@ interface ListInvoicesForMultipleOrdersSignature {
11
12
  * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.
12
13
  * @param - Order IDs for which to retrieve invoices.
13
14
  */
14
- (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;
15
+ (orderIds: string[]): Promise<NonNullablePaths<ListInvoicesForMultipleOrdersResponse, `invoicesForOrder` | `invoicesForOrder.${number}.orderId` | {
16
+ [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;
17
+ }[InvoiceNonNullablePaths]>>;
15
18
  }
16
19
  /** @internal */
17
20
  declare function generateInvoice$1(httpClient: HttpClient): GenerateInvoiceSignature;
@@ -20,8 +23,8 @@ interface GenerateInvoiceSignature {
20
23
  * Generates and adds an invoice to a specified order.
21
24
  * @param - Order ID.
22
25
  */
23
- (orderId: string): Promise<GenerateInvoiceResponse & {
24
- __applicationErrorsType?: GenerateInvoiceApplicationErrors | undefined;
26
+ (orderId: string): Promise<NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {
27
+ __applicationErrorsType?: GenerateInvoiceApplicationErrors;
25
28
  }>;
26
29
  }
27
30
  /** @internal */
@@ -31,7 +34,7 @@ interface BulkGenerateInvoicesSignature {
31
34
  * Generates and adds invoices to all specified orders.
32
35
  * @param - Order IDs.
33
36
  */
34
- (orderIds: string[]): Promise<BulkGenerateInvoicesResponse>;
37
+ (orderIds: string[]): Promise<NonNullablePaths<BulkGenerateInvoicesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `results.${number}.item.orderId` | `results.${number}.item.invoiceId` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`>>;
35
38
  }
36
39
  /** @internal */
37
40
  declare function addInvoiceToOrder$1(httpClient: HttpClient): AddInvoiceToOrderSignature;
@@ -41,7 +44,9 @@ interface AddInvoiceToOrderSignature {
41
44
  * @param - Order ID.
42
45
  * @param - Invoice info.
43
46
  */
44
- (orderId: string, invoiceInfo: Invoice): Promise<AddInvoiceToOrderResponse>;
47
+ (orderId: string, invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>): Promise<NonNullablePaths<AddInvoiceToOrderResponse, {
48
+ [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;
49
+ }[InvoiceNonNullablePaths]>>;
45
50
  }
46
51
 
47
52
  declare const listInvoicesForMultipleOrders: MaybeContext<BuildRESTFunction<typeof listInvoicesForMultipleOrders$1> & typeof listInvoicesForMultipleOrders$1>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../../src/ecom-orders-v1-invoice-order-invoices.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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<ListInvoicesForMultipleOrdersResponse>;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n GenerateInvoiceResponse & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors | undefined;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<BulkGenerateInvoicesResponse>;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (orderId: string, invoiceInfo: Invoice): Promise<AddInvoiceToOrderResponse>;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,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,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;AAQd,SAAS,8BACd,SAC4B;AAC5B,WAAS,gCAAgC,EAAE,KAAK,GAAQ;AACtD,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,KAAK,6CAA6C;AAAA,QAChD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAGO,SAAS,gBAAgB,SAA6C;AAC3E,WAAS,kBAAkB,EAAE,KAAK,GAAQ;AACxC,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,KAAK,6CAA6C;AAAA,QAChD,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,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K,iCAAiBA,qBAA0B;AAEtD,IAAMC,qBAGK,iCAAiBA,kBAAuB;","names":["WebhookIdentityType","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
1
+ {"version":3,"sources":["../../../src/ecom-orders-v1-invoice-order-invoices.universal.ts","../../../src/ecom-orders-v1-invoice-order-invoices.http.ts","../../../src/ecom-orders-v1-invoice-order-invoices.public.ts","../../../src/ecom-orders-v1-invoice-order-invoices.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 ambassadorWixEcomOrdersV1Invoice from './ecom-orders-v1-invoice-order-invoices.http.js';\n\nexport interface Invoice {\n /** Invoice ID. */\n _id?: string;\n /** ID of the app that set the invoice. */\n appId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n}\n\nexport interface ListInvoicesForSingleOrderResponse {\n /** List of invoices. */\n invoices?: Invoice[];\n}\n\nexport interface ListInvoicesForMultipleOrdersRequest {\n /**\n * Order IDs for which to retrieve invoices.\n * @maxSize 100\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface ListInvoicesForMultipleOrdersResponse {\n /** List of order IDs and their associated invoices. */\n invoicesForOrder?: InvoicesForOrder[];\n}\n\nexport interface InvoicesForOrder {\n /** Order ID. */\n orderId?: string;\n /**\n * Invoices info.\n * @maxSize 300\n */\n invoicesInfo?: Invoice[];\n}\n\nexport interface GenerateInvoiceRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n}\n\nexport interface GenerateInvoiceResponse {\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkGenerateInvoicesRequest {\n /**\n * Order IDs.\n * @minSize 1\n * @maxSize 300\n * @minLength 1\n * @maxLength 100\n */\n orderIds: string[];\n}\n\nexport interface BulkGenerateInvoicesResponse {\n results?: BulkInvoiceResult[];\n bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface BulkInvoiceResult {\n itemMetadata?: ItemMetadata;\n item?: InvoiceForOrder;\n}\n\nexport interface ItemMetadata {\n /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n _id?: string | null;\n /** Index of the item within the request array. Allows for correlation between request and response items. */\n originalIndex?: number;\n /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n success?: boolean;\n /** Details about the error in case of failure. */\n error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n /** Error code. */\n code?: string;\n /** Description of the error. */\n description?: string;\n /** Data related to the error. */\n data?: Record<string, any> | null;\n}\n\nexport interface InvoiceForOrder {\n /** Order ID. */\n orderId?: string;\n /** Invoice ID. */\n invoiceId?: string;\n}\n\nexport interface BulkActionMetadata {\n /** Number of items that were successfully processed. */\n totalSuccesses?: number;\n /** Number of items that couldn't be processed. */\n totalFailures?: number;\n /** Number of failures without details because detailed failure threshold was exceeded. */\n undetailedFailures?: number;\n}\n\nexport interface AddInvoiceToOrderRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId: string;\n /** Invoice info. */\n invoiceInfo: Invoice;\n}\n\nexport interface AddInvoiceToOrderResponse {\n /** List of order invoices. */\n orderInvoices?: Invoice[];\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n _id?: string;\n /**\n * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n */\n entityFqdn?: string;\n /**\n * Event action name, placed at the top level to make it easier for users to dispatch messages.\n * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n */\n slug?: string;\n /** ID of the entity associated with the event. */\n entityId?: string;\n /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n eventTime?: Date | null;\n /**\n * Whether the event was triggered as a result of a privacy regulation application\n * (for example, GDPR).\n */\n triggeredByAnonymizeRequest?: boolean | null;\n /** If present, indicates the action that triggered the event. */\n originatedFrom?: string | null;\n /**\n * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n */\n entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n createdEvent?: EntityCreatedEvent;\n updatedEvent?: EntityUpdatedEvent;\n deletedEvent?: EntityDeletedEvent;\n actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n entity?: string;\n}\n\nexport interface RestoreInfo {\n deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n /**\n * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n */\n currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n /** Entity that was deleted. */\n deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetOrderInvoiceRequest {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface GetOrderInvoiceResponse {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /** Invoice info. */\n invoiceInfo?: Invoice;\n}\n\nexport interface GenerateInvoiceWithNumberRequest {\n /**\n * Order ID.\n * @minLength 1\n * @maxLength 100\n */\n orderId?: string;\n /**\n * @minLength 1\n * @maxLength 11\n */\n invoiceNumber?: string;\n /** Date and time the payment was created in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations) format. Defaults to current time when not provided. */\n issueDate?: Date | null;\n}\n\nexport interface GenerateInvoiceWithNumberResponse {\n /**\n * Invoice ID.\n * @minLength 1\n * @maxLength 100\n */\n invoiceId?: string;\n}\n\nexport interface MessageEnvelope {\n /**\n * App instance ID.\n * @format GUID\n */\n instanceId?: string | null;\n /**\n * Event type.\n * @maxLength 150\n */\n eventType?: string;\n /** The identification type and identity data. */\n identity?: IdentificationData;\n /** Stringify payload. */\n data?: string;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n /** @readonly */\n identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n /**\n * ID of a site visitor that has not logged in to the site.\n * @format GUID\n */\n anonymousVisitorId?: string;\n /**\n * ID of a site visitor that has logged in to the site.\n * @format GUID\n */\n memberId?: string;\n /**\n * ID of a Wix user (site owner, contributor, etc.).\n * @format GUID\n */\n wixUserId?: string;\n /**\n * ID of an app.\n * @format GUID\n */\n appId?: string;\n}\n\nexport enum WebhookIdentityType {\n UNKNOWN = 'UNKNOWN',\n ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n MEMBER = 'MEMBER',\n WIX_USER = 'WIX_USER',\n APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n | WebhookIdentityType\n | 'UNKNOWN'\n | 'ANONYMOUS_VISITOR'\n | 'MEMBER'\n | 'WIX_USER'\n | 'APP';\nexport type GenerateInvoiceApplicationErrors =\n | {\n code?: 'GENERATE_INVOICE_NOT_SUPPORTED';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVOICE_ALREADY_EXISTS';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'MISSING_CONTACT_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_EMAIL';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'INVALID_PRICE_AMOUNT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'CONTACT_NOT_FOUND';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'FAILED_TO_RETRIEVE_CONTACT';\n description?: string;\n data?: Record<string, any>;\n }\n | {\n code?: 'UNKNOWN_CURRENCY';\n description?: string;\n data?: Record<string, any>;\n };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param orderIds - Order IDs for which to retrieve invoices.\n * @public\n * @requiredField orderIds\n * @permissionId ECOM.READ_INVOICES\n * @applicableIdentity APP\n * @applicableIdentity MEMBER\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders\n */\nexport async function listInvoicesForMultipleOrders(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.listInvoicesForMultipleOrders(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderId\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice\n */\nexport async function generateInvoice(orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderId: orderId });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.generateInvoice(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: { orderId: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderId']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Generates and adds invoices to all specified orders.\n * @param orderIds - Order IDs.\n * @internal\n * @documentationMaturity preview\n * @requiredField orderIds\n * @permissionId ECOM.MODIFY_INVOICES\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices\n */\nexport async function bulkGenerateInvoices(\n orderIds: string[]\n): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({ orderIds: orderIds });\n\n const reqOpts =\n ambassadorWixEcomOrdersV1Invoice.bulkGenerateInvoices(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: { orderIds: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['orderIds']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Adds an invoice to a specified order.\n * @param orderId - Order ID.\n * @param invoiceInfo - Invoice info.\n * @internal\n * @documentationMaturity preview\n * @requiredField invoiceInfo\n * @requiredField invoiceInfo._id\n * @requiredField invoiceInfo.appId\n * @requiredField orderId\n * @permissionId ECOM.ADD_INVOICE\n * @applicableIdentity APP\n * @fqn com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder\n */\nexport async function addInvoiceToOrder(\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n orderId: orderId,\n invoiceInfo: invoiceInfo,\n });\n\n const reqOpts = ambassadorWixEcomOrdersV1Invoice.addInvoiceToOrder(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: { orderId: '$[0]', invoiceInfo: '$[1]' },\n singleArgumentUnchanged: false,\n },\n ['orderId', 'invoiceInfo']\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 resolveComWixEcomOrdersInvoicesV1InvoicesUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'www.wixapis.com': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/ecom/v1/ep-invoices',\n destPath: '/v1/invoices',\n },\n ],\n _: [\n {\n srcPath: '/v1/invoices',\n destPath: '/v1/invoices',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ecom_order-invoices';\n\n/**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n */\nexport function listInvoicesForMultipleOrders(\n payload: object\n): RequestOptionsFactory<any> {\n function __listInvoicesForMultipleOrders({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.ListInvoicesForMultipleOrders',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/list-by-ids',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __listInvoicesForMultipleOrders;\n}\n\n/** Generates and adds an invoice to a specified order. */\nexport function generateInvoice(payload: object): RequestOptionsFactory<any> {\n function __generateInvoice({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.GenerateInvoice',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __generateInvoice;\n}\n\n/** Generates and adds invoices to all specified orders. */\nexport function bulkGenerateInvoices(\n payload: object\n): RequestOptionsFactory<any> {\n function __bulkGenerateInvoices({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn:\n 'com.wix.ecom.orders.invoices.v1.Invoices.BulkGenerateInvoices',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/bulk/invoices/generate',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __bulkGenerateInvoices;\n}\n\n/** Adds an invoice to a specified order. */\nexport function addInvoiceToOrder(payload: object): RequestOptionsFactory<any> {\n function __addInvoiceToOrder({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.ecom.orders.v1.invoice',\n method: 'POST' as any,\n methodFqn: 'com.wix.ecom.orders.invoices.v1.Invoices.AddInvoiceToOrder',\n packageName: PACKAGE_NAME,\n url: resolveComWixEcomOrdersInvoicesV1InvoicesUrl({\n protoPath: '/v1/invoices/orders/{orderId}/add-invoice',\n data: payload,\n host,\n }),\n data: payload,\n };\n\n return metadata;\n }\n\n return __addInvoiceToOrder;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n AddInvoiceToOrderResponse,\n BulkGenerateInvoicesResponse,\n GenerateInvoiceApplicationErrors,\n GenerateInvoiceResponse,\n Invoice,\n ListInvoicesForMultipleOrdersResponse,\n addInvoiceToOrder as universalAddInvoiceToOrder,\n bulkGenerateInvoices as universalBulkGenerateInvoices,\n generateInvoice as universalGenerateInvoice,\n listInvoicesForMultipleOrders as universalListInvoicesForMultipleOrders,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ecom' };\n\ntype InvoiceNonNullablePaths = `_id` | `appId`;\n\nexport function listInvoicesForMultipleOrders(\n httpClient: HttpClient\n): ListInvoicesForMultipleOrdersSignature {\n return (orderIds: string[]) =>\n universalListInvoicesForMultipleOrders(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface ListInvoicesForMultipleOrdersSignature {\n /**\n * Retrieves the IDs of invoices associated with all specified orders.\n *\n *\n * The `listInvoicesForSingleOrder()` function returns a Promise that resolves when the specified order's transaction records are retrieved.\n * @param - Order IDs for which to retrieve invoices.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n ListInvoicesForMultipleOrdersResponse,\n | `invoicesForOrder`\n | `invoicesForOrder.${number}.orderId`\n | {\n [P in InvoiceNonNullablePaths]: `invoicesForOrder.${number}.invoicesInfo.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\n/** @internal */\nexport function generateInvoice(\n httpClient: HttpClient\n): GenerateInvoiceSignature {\n return (orderId: string) =>\n universalGenerateInvoice(\n orderId,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GenerateInvoiceSignature {\n /**\n * Generates and adds an invoice to a specified order.\n * @param - Order ID.\n */\n (orderId: string): Promise<\n NonNullablePaths<GenerateInvoiceResponse, `invoiceId`> & {\n __applicationErrorsType?: GenerateInvoiceApplicationErrors;\n }\n >;\n}\n\n/** @internal */\nexport function bulkGenerateInvoices(\n httpClient: HttpClient\n): BulkGenerateInvoicesSignature {\n return (orderIds: string[]) =>\n universalBulkGenerateInvoices(\n orderIds,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface BulkGenerateInvoicesSignature {\n /**\n * Generates and adds invoices to all specified orders.\n * @param - Order IDs.\n */\n (orderIds: string[]): Promise<\n NonNullablePaths<\n BulkGenerateInvoicesResponse,\n | `results`\n | `results.${number}.itemMetadata.originalIndex`\n | `results.${number}.itemMetadata.success`\n | `results.${number}.itemMetadata.error.code`\n | `results.${number}.itemMetadata.error.description`\n | `results.${number}.item.orderId`\n | `results.${number}.item.invoiceId`\n | `bulkActionMetadata.totalSuccesses`\n | `bulkActionMetadata.totalFailures`\n | `bulkActionMetadata.undetailedFailures`\n >\n >;\n}\n\n/** @internal */\nexport function addInvoiceToOrder(\n httpClient: HttpClient\n): AddInvoiceToOrderSignature {\n return (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ) =>\n universalAddInvoiceToOrder(\n orderId,\n invoiceInfo,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface AddInvoiceToOrderSignature {\n /**\n * Adds an invoice to a specified order.\n * @param - Order ID.\n * @param - Invoice info.\n */\n (\n orderId: string,\n invoiceInfo: NonNullablePaths<Invoice, `_id` | `appId`>\n ): Promise<\n NonNullablePaths<\n AddInvoiceToOrderResponse,\n {\n [P in InvoiceNonNullablePaths]: `orderInvoices.${number}.${P}`;\n }[InvoiceNonNullablePaths]\n >\n >;\n}\n\nexport {\n ActionEvent,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n ApplicationError,\n BulkActionMetadata,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n DomainEvent,\n DomainEventBodyOneOf,\n Empty,\n EntityCreatedEvent,\n EntityDeletedEvent,\n EntityUpdatedEvent,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n IdentificationData,\n IdentificationDataIdOneOf,\n Invoice,\n InvoiceForOrder,\n InvoicesForOrder,\n ItemMetadata,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n MessageEnvelope,\n RestoreInfo,\n WebhookIdentityType,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n","import {\n listInvoicesForMultipleOrders as publicListInvoicesForMultipleOrders,\n generateInvoice as publicGenerateInvoice,\n bulkGenerateInvoices as publicBulkGenerateInvoices,\n addInvoiceToOrder as publicAddInvoiceToOrder,\n} from './ecom-orders-v1-invoice-order-invoices.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const listInvoicesForMultipleOrders: MaybeContext<\n BuildRESTFunction<typeof publicListInvoicesForMultipleOrders> &\n typeof publicListInvoicesForMultipleOrders\n> = /*#__PURE__*/ createRESTModule(publicListInvoicesForMultipleOrders);\n/** @internal */\nexport const generateInvoice: MaybeContext<\n BuildRESTFunction<typeof publicGenerateInvoice> & typeof publicGenerateInvoice\n> = /*#__PURE__*/ createRESTModule(publicGenerateInvoice);\n/** @internal */\nexport const bulkGenerateInvoices: MaybeContext<\n BuildRESTFunction<typeof publicBulkGenerateInvoices> &\n typeof publicBulkGenerateInvoices\n> = /*#__PURE__*/ createRESTModule(publicBulkGenerateInvoices);\n/** @internal */\nexport const addInvoiceToOrder: MaybeContext<\n BuildRESTFunction<typeof publicAddInvoiceToOrder> &\n typeof publicAddInvoiceToOrder\n> = /*#__PURE__*/ createRESTModule(publicAddInvoiceToOrder);\n\nexport { WebhookIdentityType } from './ecom-orders-v1-invoice-order-invoices.universal.js';\nexport {\n Invoice,\n ListInvoicesForSingleOrderRequest,\n ListInvoicesForSingleOrderResponse,\n ListInvoicesForMultipleOrdersRequest,\n ListInvoicesForMultipleOrdersResponse,\n InvoicesForOrder,\n GenerateInvoiceRequest,\n GenerateInvoiceResponse,\n BulkGenerateInvoicesRequest,\n BulkGenerateInvoicesResponse,\n BulkInvoiceResult,\n ItemMetadata,\n ApplicationError,\n InvoiceForOrder,\n BulkActionMetadata,\n AddInvoiceToOrderRequest,\n AddInvoiceToOrderResponse,\n DomainEvent,\n DomainEventBodyOneOf,\n EntityCreatedEvent,\n RestoreInfo,\n EntityUpdatedEvent,\n EntityDeletedEvent,\n ActionEvent,\n Empty,\n GetOrderInvoiceRequest,\n GetOrderInvoiceResponse,\n GenerateInvoiceWithNumberRequest,\n GenerateInvoiceWithNumberResponse,\n MessageEnvelope,\n IdentificationData,\n IdentificationDataIdOneOf,\n} from './ecom-orders-v1-invoice-order-invoices.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,6CACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,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,IACF;AAAA,IACA,GAAG;AAAA,MACD;A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A,QACjE,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,WAAW,aAAa;AAAA,IAC3B;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEjlBO,SAASC,+BACd,YACwC;AACxC,SAAO,CAAC,aACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAuBO,SAASC,iBACd,YAC0B;AAC1B,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAeO,SAASC,sBACd,YAC+B;AAC/B,SAAO,CAAC,aACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;AAyBO,SAASC,mBACd,YAC4B;AAC5B,SAAO,CACL,SACA,gBAEAA;AAAA,IACE;AAAA,IACA;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACnHA,SAAS,wBAAwB;AAG1B,IAAMC,iCAGK,iCAAiBA,8BAAmC;AAE/D,IAAMC,mBAEK,iCAAiBA,gBAAqB;AAEjD,IAAMC,wBAGK,iCAAiBA,qBAA0B;AAEtD,IAAMC,qBAGK,iCAAiBA,kBAAuB;","names":["WebhookIdentityType","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder","listInvoicesForMultipleOrders","generateInvoice","bulkGenerateInvoices","addInvoiceToOrder"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/auto_sdk_ecom_order-invoices",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -49,5 +49,5 @@
49
49
  "fqdn": "wix.ecom.orders.v1.invoice"
50
50
  }
51
51
  },
52
- "falconPackageHash": "48aa3f13db56c83dda11f5788e8f320a5b98e95429525728427ab6b5"
52
+ "falconPackageHash": "cb3bd8cecb549cad8d613143d15b29d20888af10d0cd6ae0a80b639b"
53
53
  }