@wix/auto_sdk_get-paid_receipts 1.0.171 → 1.0.172

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,6 +1,6 @@
1
1
  import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
- import { Receipt, CreateReceiptApplicationErrors, ReceiptsQueryBuilder, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailOptions, SendReceiptEmailApplicationErrors, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope } from './index.typings.mjs';
3
- export { ActionEvent, AdditionalFee, AdditionalFeeTax, Address, AddressLocation, AddressStreetOneOf, BaseEventMetadata, BusinessDetails, CreateReceiptRequest, CreateReceiptResponse, CursorPaging, CursorPagingMetadata, CursorQuery, CursorQueryPagingMethodOneOf, Cursors, CustomField, CustomFields, Customer, Discount, Document, DocumentStatus, DocumentStatusWithLiterals, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, ExtendedFields, Failed, FooterCustomField, FullAddressContactDetails, GenerateReceiptDocument, GetLatestReceiptNumberRequest, GetReceiptRequest, GetReceiptResponse, IdentificationData, IdentificationDataIdOneOf, LineItem, LineItemTax, LineItemTotals, Locale, MessageEnvelope, Numbering, Payment, QueryReceiptsRequest, QueryReceiptsResponse, ReceiptDocumentHandled, ReceiptDocumentHandledResultOneOf, ReceiptDocumentProcess, ReceiptNumberingProcess, ReceiptOrderType, ReceiptOrderTypeWithLiterals, ReceiptsQueryResult, RegenerateReceiptDocumentRequest, RegenerateReceiptDocumentResponse, RegionalProperties, RequestOrigin, RequestOriginWithLiterals, RestoreInfo, SendReceiptEmailRequest, SendReceiptEmailResponse, Sent, ShippingAddressContactDetails, ShippingInfo, ShippingTax, SortOrder, SortOrderWithLiterals, Sorting, SourceReference, SourceReferenceOrderOneOf, StandardDetails, StreetAddress, Subdivision, SubdivisionType, SubdivisionTypeWithLiterals, Succeeded, Tax, Totals, UpdateExtendedFieldsRequest, UpdateReceiptRequest, UpdateReceiptResponse, VatId, VatType, VatTypeWithLiterals, WebhookIdentityType, WebhookIdentityTypeWithLiterals, WixEcom, WixPayment } from './index.typings.mjs';
2
+ import { Receipt, CreateReceiptApplicationErrors, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailOptions, SendReceiptEmailApplicationErrors, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope, ReceiptsQueryBuilder, CursorQuery, typedQueryReceipts } from './index.typings.mjs';
3
+ export { ActionEvent, AdditionalFee, AdditionalFeeTax, Address, AddressLocation, AddressStreetOneOf, BaseEventMetadata, BusinessDetails, CreateReceiptRequest, CreateReceiptResponse, CursorPaging, CursorPagingMetadata, CursorQueryPagingMethodOneOf, Cursors, CustomField, CustomFields, Customer, Discount, Document, DocumentStatus, DocumentStatusWithLiterals, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, ExtendedFields, Failed, FooterCustomField, FullAddressContactDetails, GenerateReceiptDocument, GetLatestReceiptNumberRequest, GetReceiptRequest, GetReceiptResponse, IdentificationData, IdentificationDataIdOneOf, LineItem, LineItemTax, LineItemTotals, Locale, MessageEnvelope, Numbering, Payment, QueryReceiptsRequest, QueryReceiptsResponse, ReceiptDocumentHandled, ReceiptDocumentHandledResultOneOf, ReceiptDocumentProcess, ReceiptNumberingProcess, ReceiptOrderType, ReceiptOrderTypeWithLiterals, ReceiptsQueryResult, RegenerateReceiptDocumentRequest, RegenerateReceiptDocumentResponse, RegionalProperties, RequestOrigin, RequestOriginWithLiterals, RestoreInfo, SendReceiptEmailRequest, SendReceiptEmailResponse, Sent, ShippingAddressContactDetails, ShippingInfo, ShippingTax, SortOrder, SortOrderWithLiterals, Sorting, SourceReference, SourceReferenceOrderOneOf, StandardDetails, StreetAddress, Subdivision, SubdivisionType, SubdivisionTypeWithLiterals, Succeeded, Tax, Totals, UpdateExtendedFieldsRequest, UpdateReceiptRequest, UpdateReceiptResponse, VatId, VatType, VatTypeWithLiterals, WebhookIdentityType, WebhookIdentityTypeWithLiterals, WixEcom, WixPayment } from './index.typings.mjs';
4
4
 
5
5
  declare function createReceipt$1(httpClient: HttpClient): CreateReceiptSignature;
6
6
  interface CreateReceiptSignature {
@@ -24,13 +24,6 @@ interface GetReceiptSignature {
24
24
  */
25
25
  (receiptId: string): Promise<NonNullablePaths<Receipt, `numbering.displayNumber` | `regionalProperties.locale.languageCode` | `currency` | `sourceReference.wixPaymentOrder.orderId` | `sourceReference.wixPaymentOrder.transactionId` | `sourceReference.wixEcomOrder.orderId` | `sourceReference.wixEcomOrder.transactionId` | `sourceReference.appId` | `sourceReference.externalReferenceId` | `sourceReference.receiptOrderType` | `businessDetails.address.streetAddress.number` | `businessDetails.address.streetAddress.name` | `businessDetails.address.streetAddress.apt` | `customer.contactDetails.vatId._id` | `customer.contactDetails.vatId.type` | `lineItems` | `shippingInfo.title` | `shippingInfo.priceBeforeTax` | `shippingInfo.priceAfterTax` | `shippingInfo.taxBreakdown` | `shippingInfo.taxBreakdown.${number}.name` | `shippingInfo.taxBreakdown.${number}.rate` | `shippingInfo.taxBreakdown.${number}.amount` | `additionalFees` | `additionalFees.${number}.name` | `additionalFees.${number}.priceBeforeTax` | `additionalFees.${number}.priceAfterTax` | `discounts` | `discounts.${number}.name` | `discounts.${number}.amount` | `payment.paymentMethod` | `payment.amount` | `taxBreakdown` | `taxBreakdown.${number}.name` | `taxBreakdown.${number}.rate` | `taxBreakdown.${number}.taxAmount` | `taxBreakdown.${number}.taxableAmount` | `customFields.headerCustomFields` | `customFields.headerCustomFields.${number}.value` | `customFields.businessCustomFields` | `customFields.customerCustomFields` | `customFields.footerCustomFields` | `customFields.footerCustomFields.${number}.title` | `document.status`, 5>>;
26
26
  }
27
- declare function queryReceipts$1(httpClient: HttpClient): QueryReceiptsSignature;
28
- interface QueryReceiptsSignature {
29
- /**
30
- * Retrieves a list of up to 100 receipts, given the specified filtering, paging, and sorting ([SDK](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/api-query-language) | [REST](https://dev.wix.com/api/rest/getting-started/api-query-language)).
31
- */
32
- (): ReceiptsQueryBuilder;
33
- }
34
27
  declare function regenerateReceiptDocument$1(httpClient: HttpClient): RegenerateReceiptDocumentSignature;
35
28
  interface RegenerateReceiptDocumentSignature {
36
29
  /**
@@ -83,13 +76,17 @@ declare const onReceiptCreated$1: EventDefinition<ReceiptCreatedEnvelope, "wix.r
83
76
  declare const onReceiptSent$1: EventDefinition<ReceiptSentEnvelope, "wix.receipts.v1.receipt_sent">;
84
77
  declare const onReceiptUpdated$1: EventDefinition<ReceiptUpdatedEnvelope, "wix.receipts.v1.receipt_updated">;
85
78
 
79
+ declare function customQueryReceipts(httpClient: HttpClient): {
80
+ (): ReceiptsQueryBuilder;
81
+ (query: CursorQuery): ReturnType<typeof typedQueryReceipts>;
82
+ };
86
83
  declare const createReceipt: MaybeContext<BuildRESTFunction<typeof createReceipt$1> & typeof createReceipt$1>;
87
84
  declare const getReceipt: MaybeContext<BuildRESTFunction<typeof getReceipt$1> & typeof getReceipt$1>;
88
- declare const queryReceipts: MaybeContext<BuildRESTFunction<typeof queryReceipts$1> & typeof queryReceipts$1>;
89
85
  declare const regenerateReceiptDocument: MaybeContext<BuildRESTFunction<typeof regenerateReceiptDocument$1> & typeof regenerateReceiptDocument$1>;
90
86
  declare const sendReceiptEmail: MaybeContext<BuildRESTFunction<typeof sendReceiptEmail$1> & typeof sendReceiptEmail$1>;
91
87
  declare const getLatestReceiptNumber: MaybeContext<BuildRESTFunction<typeof getLatestReceiptNumber$1> & typeof getLatestReceiptNumber$1>;
92
88
  declare const updateExtendedFields: MaybeContext<BuildRESTFunction<typeof updateExtendedFields$1> & typeof updateExtendedFields$1>;
89
+ declare const queryReceipts: MaybeContext<BuildRESTFunction<typeof customQueryReceipts> & typeof customQueryReceipts>;
93
90
  /**
94
91
  * Triggered when a receipt is created.
95
92
  */
@@ -103,4 +100,4 @@ declare const onReceiptSent: BuildEventDefinition<typeof onReceiptSent$1> & type
103
100
  */
104
101
  declare const onReceiptUpdated: BuildEventDefinition<typeof onReceiptUpdated$1> & typeof onReceiptUpdated$1;
105
102
 
106
- export { CreateReceiptApplicationErrors, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, Receipt, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope, ReceiptsQueryBuilder, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailApplicationErrors, SendReceiptEmailOptions, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, createReceipt, getLatestReceiptNumber, getReceipt, onReceiptCreated, onReceiptSent, onReceiptUpdated, queryReceipts, regenerateReceiptDocument, sendReceiptEmail, updateExtendedFields };
103
+ export { CreateReceiptApplicationErrors, CursorQuery, GetLatestReceiptNumberOptions, GetLatestReceiptNumberResponse, Receipt, ReceiptCreatedEnvelope, ReceiptSentEnvelope, ReceiptUpdatedEnvelope, ReceiptsQueryBuilder, RegenerateReceiptDocumentApplicationErrors, SendReceiptEmailApplicationErrors, SendReceiptEmailOptions, UpdateExtendedFieldsOptions, UpdateExtendedFieldsResponse, createReceipt, getLatestReceiptNumber, getReceipt, onReceiptCreated, onReceiptSent, onReceiptUpdated, queryReceipts, regenerateReceiptDocument, sendReceiptEmail, updateExtendedFields };
@@ -513,6 +513,44 @@ function queryReceipts2() {
513
513
  transformationPaths: {}
514
514
  });
515
515
  }
516
+ async function typedQueryReceipts(query) {
517
+ const { httpClient, sideEffects } = arguments[1];
518
+ const payload = renameKeysFromSDKRequestToRESTRequest({ query });
519
+ const reqOpts = queryReceipts(payload);
520
+ sideEffects?.onSiteCall?.();
521
+ try {
522
+ const result = await httpClient.request(reqOpts);
523
+ sideEffects?.onSuccess?.(result);
524
+ return renameKeysFromRESTResponseToSDKResponse(
525
+ transformPaths2(result.data, [
526
+ {
527
+ transformFn: transformRESTAddressToSDKAddress,
528
+ paths: [
529
+ { path: "receipts.businessDetails.address" },
530
+ { path: "receipts.customer.billingAddress" },
531
+ { path: "receipts.customer.shippingAddress" }
532
+ ]
533
+ },
534
+ {
535
+ transformFn: transformRESTImageToSDKImage,
536
+ paths: [{ path: "receipts.businessDetails.logo" }]
537
+ }
538
+ ])
539
+ );
540
+ } catch (err) {
541
+ const transformedError = sdkTransformError(
542
+ err,
543
+ {
544
+ spreadPathsToArguments: {},
545
+ explicitPathsToArguments: { query: "$[0]" },
546
+ singleArgumentUnchanged: false
547
+ },
548
+ ["query"]
549
+ );
550
+ sideEffects?.onError?.(err);
551
+ throw transformedError;
552
+ }
553
+ }
516
554
  async function regenerateReceiptDocument2(receiptId) {
517
555
  const { httpClient, sideEffects } = arguments[1];
518
556
  const payload = renameKeysFromSDKRequestToRESTRequest({
@@ -660,6 +698,13 @@ function queryReceipts3(httpClient) {
660
698
  { httpClient }
661
699
  );
662
700
  }
701
+ function typedQueryReceipts2(httpClient) {
702
+ return (query) => typedQueryReceipts(
703
+ query,
704
+ // @ts-ignore
705
+ { httpClient }
706
+ );
707
+ }
663
708
  function regenerateReceiptDocument3(httpClient) {
664
709
  return (receiptId) => regenerateReceiptDocument2(
665
710
  receiptId,
@@ -782,13 +827,25 @@ var onReceiptUpdated = EventDefinition(
782
827
  // src/receipts-v1-receipt-receipts.context.ts
783
828
  import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
784
829
  import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
830
+ import { createQueryOverloadRouter } from "@wix/sdk-runtime/query-method-router";
831
+ function customQueryReceipts(httpClient) {
832
+ const router = createQueryOverloadRouter({
833
+ builderQueryFunction: () => queryReceipts3(httpClient)(),
834
+ typedQueryFunction: (query) => typedQueryReceipts2(httpClient)(query),
835
+ hasOptionsParameter: false
836
+ });
837
+ function overloadedQuery(query) {
838
+ return router(...arguments);
839
+ }
840
+ return overloadedQuery;
841
+ }
785
842
  var createReceipt4 = /* @__PURE__ */ createRESTModule(createReceipt3);
786
843
  var getReceipt4 = /* @__PURE__ */ createRESTModule(getReceipt3);
787
- var queryReceipts4 = /* @__PURE__ */ createRESTModule(queryReceipts3);
788
844
  var regenerateReceiptDocument4 = /* @__PURE__ */ createRESTModule(regenerateReceiptDocument3);
789
845
  var sendReceiptEmail4 = /* @__PURE__ */ createRESTModule(sendReceiptEmail3);
790
846
  var getLatestReceiptNumber4 = /* @__PURE__ */ createRESTModule(getLatestReceiptNumber3);
791
847
  var updateExtendedFields4 = /* @__PURE__ */ createRESTModule(updateExtendedFields3);
848
+ var queryReceipts4 = /* @__PURE__ */ createRESTModule(customQueryReceipts);
792
849
  var onReceiptCreated2 = createEventModule(onReceiptCreated);
793
850
  var onReceiptSent2 = createEventModule(onReceiptSent);
794
851
  var onReceiptUpdated2 = createEventModule(onReceiptUpdated);