@wix/auto_sdk_loyalty_imports 1.0.16 → 1.0.18

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, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
- import { C as CreateLoyaltyImportOptions, a as CreateLoyaltyImportResponse, L as LoyaltyImport, G as GetErrorFileDownloadUrlResponse, E as ExecuteLoyaltyImportOptions, b as ExecuteLoyaltyImportResponse, c as CreateLoyaltyImportFileUrlResponse, d as LoyaltyImportsQueryBuilder, e as LoyaltyImportCreatedEnvelope } from './loyalty-imports-v1-loyalty-import-imports.universal-BLTSZYoC.js';
3
- export { K as ActionEvent, V as BaseEventMetadata, f as ColumnName, p as CreateLoyaltyImportFileUrlRequest, k as CreateLoyaltyImportRequest, t as CursorPaging, v as CursorPagingMetadata, q as CursorQuery, r as CursorQueryPagingMethodOneOf, w as Cursors, D as DeleteLoyaltyImportRequest, x as DeleteLoyaltyImportResponse, y as DomainEvent, z as DomainEventBodyOneOf, M as Empty, A as EntityCreatedEvent, J as EntityDeletedEvent, B as EntityUpdatedEvent, X as EventMetadata, o as ExecuteLoyaltyImportRequest, g as FileHeader, F as FileMetadata, n as GetErrorFileDownloadUrlRequest, l as GetLoyaltyImportRequest, m as GetLoyaltyImportResponse, h as HeaderMapping, H as HeaderMappingInfo, T as IdentificationData, U as IdentificationDataIdOneOf, N as ImportFinished, j as ImportResult, I as ImportStatus, Y as LoyaltyImportsQueryResult, O as MessageEnvelope, P as ParseResult, Q as QueryLoyaltyImportsRequest, u as QueryLoyaltyImportsResponse, R as RestoreInfo, i as SampleDataRow, S as SortOrder, s as Sorting, W as WebhookIdentityType } from './loyalty-imports-v1-loyalty-import-imports.universal-BLTSZYoC.js';
2
+ import { CreateLoyaltyImportOptions, CreateLoyaltyImportResponse, LoyaltyImport, GetErrorFileDownloadUrlResponse, ExecuteLoyaltyImportOptions, ExecuteLoyaltyImportResponse, CreateLoyaltyImportFileUrlResponse, LoyaltyImportsQueryBuilder, LoyaltyImportCreatedEnvelope } from './index.typings.js';
3
+ export { ActionEvent, BaseEventMetadata, ColumnName, CreateLoyaltyImportFileUrlRequest, CreateLoyaltyImportRequest, CursorPaging, CursorPagingMetadata, CursorQuery, CursorQueryPagingMethodOneOf, Cursors, DeleteLoyaltyImportRequest, DeleteLoyaltyImportResponse, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, ExecuteLoyaltyImportRequest, FileHeader, FileMetadata, GetErrorFileDownloadUrlRequest, GetLoyaltyImportRequest, GetLoyaltyImportResponse, HeaderMapping, HeaderMappingInfo, IdentificationData, IdentificationDataIdOneOf, ImportFinished, ImportResult, ImportStatus, LoyaltyImportsQueryResult, MessageEnvelope, ParseResult, QueryLoyaltyImportsRequest, QueryLoyaltyImportsResponse, RestoreInfo, SampleDataRow, SortOrder, Sorting, WebhookIdentityType } from './index.typings.js';
4
4
 
5
5
  declare function createLoyaltyImport$1(httpClient: HttpClient): CreateLoyaltyImportSignature;
6
6
  interface CreateLoyaltyImportSignature {
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  /**
2
4
  * An Import object is a batch import of loyalty points for existing customers.
3
5
  * You can use Loyalty Imports to import loyalty points from 3rd-party providers or update existing customer point balances.
@@ -517,16 +519,109 @@ interface LoyaltyImportCreatedEnvelope {
517
519
  entity: LoyaltyImport;
518
520
  metadata: EventMetadata;
519
521
  }
522
+ /**
523
+ * Triggered when a loyalty import is created.
524
+ * @webhook
525
+ * @eventType wix.loyalty.imports.v1.loyalty_import_created
526
+ * @serviceIdentifier wix.loyalty.imports.v1.LoyaltyImports
527
+ * @slug created
528
+ */
529
+ declare function onLoyaltyImportCreated(handler: (event: LoyaltyImportCreatedEnvelope) => void | Promise<void>): void;
530
+ type LoyaltyImportNonNullablePaths = `status` | `fileMetadata.url` | `fileMetadata.header.values` | `fileMetadata.headerMappingInfo.headerMappings` | `fileMetadata.headerMappingInfo.headerMappings.${number}.columnName` | `fileMetadata.headerMappingInfo.headerMappings.${number}.columnIndex` | `fileMetadata.sampleDataRows` | `importResult.errorFileExists`;
531
+ /**
532
+ * Creates an import object based on an uploaded file.
533
+ *
534
+ * Call this method after uploading your file to the URL obtained from `createLoyaltyImportFileUrl()`.
535
+ * @param fileUrl - URL of the file to import.
536
+ * @public
537
+ * @requiredField fileUrl
538
+ * @permissionId LOYALTY.MANAGE_IMPORTS
539
+ * @applicableIdentity APP
540
+ * @fqn wix.loyalty.imports.v1.LoyaltyImports.CreateLoyaltyImport
541
+ */
542
+ declare function createLoyaltyImport(fileUrl: string, options?: CreateLoyaltyImportOptions): Promise<NonNullablePaths<CreateLoyaltyImportResponse, {
543
+ [P in LoyaltyImportNonNullablePaths]: `loyaltyImport.${P}`;
544
+ }[LoyaltyImportNonNullablePaths]>>;
520
545
  interface CreateLoyaltyImportOptions {
521
546
  /** Name of the file to import. */
522
547
  fileName?: string | null;
523
548
  /** Size of the file to import, in bytes. */
524
549
  fileSize?: number | null;
525
550
  }
551
+ /**
552
+ * Retrieves a loyalty import.
553
+ * @param loyaltyImportId - Loyalty import ID.
554
+ * @public
555
+ * @requiredField loyaltyImportId
556
+ * @permissionId LOYALTY.MANAGE_IMPORTS
557
+ * @applicableIdentity APP
558
+ * @returns Retrieved loyalty import.
559
+ * @fqn wix.loyalty.imports.v1.LoyaltyImports.GetLoyaltyImport
560
+ */
561
+ declare function getLoyaltyImport(loyaltyImportId: string): Promise<NonNullablePaths<LoyaltyImport, LoyaltyImportNonNullablePaths>>;
562
+ /**
563
+ * Retrieves the download URL for the error file of a failed loyalty import.
564
+ *
565
+ * If an import fails, the `importResult.errorFileExists` field in the `LoyaltyImport` object is set to `true`.
566
+ *
567
+ * Use this method to get the URL of the error file, which contains details about which items couldn't be imported and why.
568
+ * @param loyaltyImportId - Loyalty import ID.
569
+ * @public
570
+ * @requiredField loyaltyImportId
571
+ * @permissionId LOYALTY.MANAGE_IMPORTS
572
+ * @applicableIdentity APP
573
+ * @fqn wix.loyalty.imports.v1.LoyaltyImports.GetErrorFileDownloadUrl
574
+ */
575
+ declare function getErrorFileDownloadUrl(loyaltyImportId: string): Promise<GetErrorFileDownloadUrlResponse>;
576
+ /**
577
+ * Starts the actual import process for a loyalty import.
578
+ *
579
+ * Call this method after the loyalty import object reaches the `PARSED` status.
580
+ * @param loyaltyImportId - Loyalty import ID.
581
+ * @public
582
+ * @requiredField loyaltyImportId
583
+ * @permissionId LOYALTY.MANAGE_IMPORTS
584
+ * @applicableIdentity APP
585
+ * @fqn wix.loyalty.imports.v1.LoyaltyImports.ExecuteLoyaltyImport
586
+ */
587
+ declare function executeLoyaltyImport(loyaltyImportId: string, options?: ExecuteLoyaltyImportOptions): Promise<NonNullablePaths<ExecuteLoyaltyImportResponse, {
588
+ [P in LoyaltyImportNonNullablePaths]: `loyaltyImport.${P}`;
589
+ }[LoyaltyImportNonNullablePaths]>>;
526
590
  interface ExecuteLoyaltyImportOptions {
527
591
  /** Header mapping information for the import file. */
528
592
  headerMappingInfo?: HeaderMappingInfo;
529
593
  }
594
+ /**
595
+ * Creates a URL for uploading a loyalty import file.
596
+ *
597
+ * This method is the first step in the loyalty import process. It returns a file path and an upload URL, which you'll use in subsequent steps of the import process.
598
+ * @public
599
+ * @permissionId LOYALTY.MANAGE_IMPORTS
600
+ * @applicableIdentity APP
601
+ * @fqn wix.loyalty.imports.v1.LoyaltyImports.CreateLoyaltyImportFileUrl
602
+ */
603
+ declare function createLoyaltyImportFileUrl(): Promise<CreateLoyaltyImportFileUrlResponse>;
604
+ /**
605
+ * Creates a query to retrieve a list of loyalty imports.
606
+ *
607
+ * The `queryLoyaltyImports()` function builds a query to retrieve a list of imports and returns a `LoyaltyImportsQueryBuilder` object.
608
+ *
609
+ * The returned object contains the query definition, which is typically used to run the query using the `find()` function.
610
+ *
611
+ * You can refine the query by chaining `LoyaltyImportsQueryBuilder` functions onto the query. `LoyaltyImportsQueryBuilder` functions enable you to sort, filter, and control the results `queryLoyaltyImports()` returns.
612
+ *
613
+ * `queryLoyaltyImports()` runs with these `LoyaltyImportsQueryBuilder` defaults, which you can override:
614
+ *
615
+ * - `limit(50)`
616
+ * - `descending("_createdDate")`
617
+ *
618
+ * The functions that are chained to `queryLoyaltyImports()` are applied in the order they're called. For example, if you apply ascending('status') and then descending('_createdDate'), the results are sorted first by the status, and then, if there are multiple results with the same status, the items are sorted by the created date.
619
+ * @public
620
+ * @permissionId LOYALTY.MANAGE_IMPORTS
621
+ * @applicableIdentity APP
622
+ * @fqn wix.loyalty.imports.v1.LoyaltyImports.QueryLoyaltyImports
623
+ */
624
+ declare function queryLoyaltyImports(): LoyaltyImportsQueryBuilder;
530
625
  interface QueryCursorResult {
531
626
  cursors: Cursors;
532
627
  hasNext: () => boolean;
@@ -582,4 +677,4 @@ interface LoyaltyImportsQueryBuilder {
582
677
  find: () => Promise<LoyaltyImportsQueryResult>;
583
678
  }
584
679
 
585
- export { type EntityCreatedEvent as A, type EntityUpdatedEvent as B, type CreateLoyaltyImportOptions as C, type DeleteLoyaltyImportRequest as D, type ExecuteLoyaltyImportOptions as E, type FileMetadata as F, type GetErrorFileDownloadUrlResponse as G, type HeaderMappingInfo as H, ImportStatus as I, type EntityDeletedEvent as J, type ActionEvent as K, type LoyaltyImport as L, type Empty as M, type ImportFinished as N, type MessageEnvelope as O, type ParseResult as P, type QueryLoyaltyImportsRequest as Q, type RestoreInfo as R, SortOrder as S, type IdentificationData as T, type IdentificationDataIdOneOf as U, type BaseEventMetadata as V, WebhookIdentityType as W, type EventMetadata as X, type LoyaltyImportsQueryResult as Y, type CreateLoyaltyImportResponse as a, type ExecuteLoyaltyImportResponse as b, type CreateLoyaltyImportFileUrlResponse as c, type LoyaltyImportsQueryBuilder as d, type LoyaltyImportCreatedEnvelope as e, ColumnName as f, type FileHeader as g, type HeaderMapping as h, type SampleDataRow as i, type ImportResult as j, type CreateLoyaltyImportRequest as k, type GetLoyaltyImportRequest as l, type GetLoyaltyImportResponse as m, type GetErrorFileDownloadUrlRequest as n, type ExecuteLoyaltyImportRequest as o, type CreateLoyaltyImportFileUrlRequest as p, type CursorQuery as q, type CursorQueryPagingMethodOneOf as r, type Sorting as s, type CursorPaging as t, type QueryLoyaltyImportsResponse as u, type CursorPagingMetadata as v, type Cursors as w, type DeleteLoyaltyImportResponse as x, type DomainEvent as y, type DomainEventBodyOneOf as z };
680
+ export { type ActionEvent, type BaseEventMetadata, ColumnName, type ColumnNameWithLiterals, type CreateLoyaltyImportFileUrlRequest, type CreateLoyaltyImportFileUrlResponse, type CreateLoyaltyImportOptions, type CreateLoyaltyImportRequest, type CreateLoyaltyImportResponse, type CursorPaging, type CursorPagingMetadata, type CursorQuery, type CursorQueryPagingMethodOneOf, type Cursors, type DeleteLoyaltyImportRequest, type DeleteLoyaltyImportResponse, type DomainEvent, type DomainEventBodyOneOf, type Empty, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type ExecuteLoyaltyImportOptions, type ExecuteLoyaltyImportRequest, type ExecuteLoyaltyImportResponse, type FileHeader, type FileMetadata, type GetErrorFileDownloadUrlRequest, type GetErrorFileDownloadUrlResponse, type GetLoyaltyImportRequest, type GetLoyaltyImportResponse, type HeaderMapping, type HeaderMappingInfo, type IdentificationData, type IdentificationDataIdOneOf, type ImportFinished, type ImportResult, ImportStatus, type ImportStatusWithLiterals, type LoyaltyImport, type LoyaltyImportCreatedEnvelope, type LoyaltyImportsQueryBuilder, type LoyaltyImportsQueryResult, type MessageEnvelope, type ParseResult, type QueryLoyaltyImportsRequest, type QueryLoyaltyImportsResponse, type RestoreInfo, type SampleDataRow, SortOrder, type SortOrderWithLiterals, type Sorting, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, createLoyaltyImport, createLoyaltyImportFileUrl, executeLoyaltyImport, getErrorFileDownloadUrl, getLoyaltyImport, onLoyaltyImportCreated, queryLoyaltyImports };
@@ -0,0 +1,472 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.typings.ts
21
+ var index_typings_exports = {};
22
+ __export(index_typings_exports, {
23
+ ColumnName: () => ColumnName,
24
+ ImportStatus: () => ImportStatus,
25
+ SortOrder: () => SortOrder,
26
+ WebhookIdentityType: () => WebhookIdentityType,
27
+ createLoyaltyImport: () => createLoyaltyImport2,
28
+ createLoyaltyImportFileUrl: () => createLoyaltyImportFileUrl2,
29
+ executeLoyaltyImport: () => executeLoyaltyImport2,
30
+ getErrorFileDownloadUrl: () => getErrorFileDownloadUrl2,
31
+ getLoyaltyImport: () => getLoyaltyImport2,
32
+ queryLoyaltyImports: () => queryLoyaltyImports2
33
+ });
34
+ module.exports = __toCommonJS(index_typings_exports);
35
+
36
+ // src/loyalty-imports-v1-loyalty-import-imports.universal.ts
37
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
38
+ var import_query_builder = require("@wix/sdk-runtime/query-builder");
39
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
40
+
41
+ // src/loyalty-imports-v1-loyalty-import-imports.http.ts
42
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
43
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
44
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
45
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
46
+ function resolveWixLoyaltyImportsV1LoyaltyImportsUrl(opts) {
47
+ const domainToMappings = {
48
+ "manage._base_domain_": [
49
+ {
50
+ srcPath: "/loyalty-imports",
51
+ destPath: ""
52
+ },
53
+ {
54
+ srcPath: "/_api/loyalty-imports",
55
+ destPath: "/api"
56
+ }
57
+ ],
58
+ "bo._base_domain_": [
59
+ {
60
+ srcPath: "/loyalty-imports",
61
+ destPath: ""
62
+ }
63
+ ],
64
+ "wixbo.ai": [
65
+ {
66
+ srcPath: "/loyalty-imports",
67
+ destPath: ""
68
+ }
69
+ ],
70
+ "wix-bo.com": [
71
+ {
72
+ srcPath: "/loyalty-imports",
73
+ destPath: ""
74
+ }
75
+ ],
76
+ "api._api_base_domain_": [
77
+ {
78
+ srcPath: "/loyalty-imports",
79
+ destPath: ""
80
+ }
81
+ ],
82
+ "www.wixapis.com": [
83
+ {
84
+ srcPath: "/_api/loyalty-imports",
85
+ destPath: ""
86
+ }
87
+ ],
88
+ _: [
89
+ {
90
+ srcPath: "/_api/loyalty-imports",
91
+ destPath: ""
92
+ }
93
+ ],
94
+ "*.dev.wix-code.com": [
95
+ {
96
+ srcPath: "/_api/loyalty-imports",
97
+ destPath: ""
98
+ }
99
+ ]
100
+ };
101
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
102
+ }
103
+ var PACKAGE_NAME = "@wix/auto_sdk_loyalty_imports";
104
+ function createLoyaltyImport(payload) {
105
+ function __createLoyaltyImport({ host }) {
106
+ const metadata = {
107
+ entityFqdn: "wix.loyalty.imports.v1.loyalty_import",
108
+ method: "POST",
109
+ methodFqn: "wix.loyalty.imports.v1.LoyaltyImports.CreateLoyaltyImport",
110
+ packageName: PACKAGE_NAME,
111
+ url: resolveWixLoyaltyImportsV1LoyaltyImportsUrl({
112
+ protoPath: "/v1/loyalty-imports",
113
+ data: payload,
114
+ host
115
+ }),
116
+ data: payload,
117
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
118
+ {
119
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
120
+ paths: [
121
+ { path: "loyaltyImport.createdDate" },
122
+ { path: "loyaltyImport.updatedDate" }
123
+ ]
124
+ }
125
+ ])
126
+ };
127
+ return metadata;
128
+ }
129
+ return __createLoyaltyImport;
130
+ }
131
+ function getLoyaltyImport(payload) {
132
+ function __getLoyaltyImport({ host }) {
133
+ const metadata = {
134
+ entityFqdn: "wix.loyalty.imports.v1.loyalty_import",
135
+ method: "GET",
136
+ methodFqn: "wix.loyalty.imports.v1.LoyaltyImports.GetLoyaltyImport",
137
+ packageName: PACKAGE_NAME,
138
+ url: resolveWixLoyaltyImportsV1LoyaltyImportsUrl({
139
+ protoPath: "/v1/loyalty-imports",
140
+ data: payload,
141
+ host
142
+ }),
143
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
144
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
145
+ {
146
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
147
+ paths: [
148
+ { path: "loyaltyImport.createdDate" },
149
+ { path: "loyaltyImport.updatedDate" }
150
+ ]
151
+ }
152
+ ])
153
+ };
154
+ return metadata;
155
+ }
156
+ return __getLoyaltyImport;
157
+ }
158
+ function getErrorFileDownloadUrl(payload) {
159
+ function __getErrorFileDownloadUrl({ host }) {
160
+ const metadata = {
161
+ entityFqdn: "wix.loyalty.imports.v1.loyalty_import",
162
+ method: "GET",
163
+ methodFqn: "wix.loyalty.imports.v1.LoyaltyImports.GetErrorFileDownloadUrl",
164
+ packageName: PACKAGE_NAME,
165
+ url: resolveWixLoyaltyImportsV1LoyaltyImportsUrl({
166
+ protoPath: "/v1/loyalty-imports/error-file-download-url",
167
+ data: payload,
168
+ host
169
+ }),
170
+ params: (0, import_rest_modules.toURLSearchParams)(payload)
171
+ };
172
+ return metadata;
173
+ }
174
+ return __getErrorFileDownloadUrl;
175
+ }
176
+ function executeLoyaltyImport(payload) {
177
+ function __executeLoyaltyImport({ host }) {
178
+ const metadata = {
179
+ entityFqdn: "wix.loyalty.imports.v1.loyalty_import",
180
+ method: "POST",
181
+ methodFqn: "wix.loyalty.imports.v1.LoyaltyImports.ExecuteLoyaltyImport",
182
+ packageName: PACKAGE_NAME,
183
+ url: resolveWixLoyaltyImportsV1LoyaltyImportsUrl({
184
+ protoPath: "/v1/loyalty-imports/execute",
185
+ data: payload,
186
+ host
187
+ }),
188
+ data: payload,
189
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
190
+ {
191
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
192
+ paths: [
193
+ { path: "loyaltyImport.createdDate" },
194
+ { path: "loyaltyImport.updatedDate" }
195
+ ]
196
+ }
197
+ ])
198
+ };
199
+ return metadata;
200
+ }
201
+ return __executeLoyaltyImport;
202
+ }
203
+ function createLoyaltyImportFileUrl(payload) {
204
+ function __createLoyaltyImportFileUrl({ host }) {
205
+ const metadata = {
206
+ entityFqdn: "wix.loyalty.imports.v1.loyalty_import",
207
+ method: "POST",
208
+ methodFqn: "wix.loyalty.imports.v1.LoyaltyImports.CreateLoyaltyImportFileUrl",
209
+ packageName: PACKAGE_NAME,
210
+ url: resolveWixLoyaltyImportsV1LoyaltyImportsUrl({
211
+ protoPath: "/v1/loyalty-imports/wixmp-upload-url",
212
+ data: payload,
213
+ host
214
+ }),
215
+ data: payload
216
+ };
217
+ return metadata;
218
+ }
219
+ return __createLoyaltyImportFileUrl;
220
+ }
221
+ function queryLoyaltyImports(payload) {
222
+ function __queryLoyaltyImports({ host }) {
223
+ const metadata = {
224
+ entityFqdn: "wix.loyalty.imports.v1.loyalty_import",
225
+ method: "POST",
226
+ methodFqn: "wix.loyalty.imports.v1.LoyaltyImports.QueryLoyaltyImports",
227
+ packageName: PACKAGE_NAME,
228
+ url: resolveWixLoyaltyImportsV1LoyaltyImportsUrl({
229
+ protoPath: "/v1/loyalty-imports/query",
230
+ data: payload,
231
+ host
232
+ }),
233
+ data: payload,
234
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
235
+ {
236
+ transformFn: import_timestamp.transformRESTTimestampToSDKTimestamp,
237
+ paths: [
238
+ { path: "loyaltyImports.createdDate" },
239
+ { path: "loyaltyImports.updatedDate" }
240
+ ]
241
+ }
242
+ ])
243
+ };
244
+ return metadata;
245
+ }
246
+ return __queryLoyaltyImports;
247
+ }
248
+
249
+ // src/loyalty-imports-v1-loyalty-import-imports.universal.ts
250
+ var import_transform_paths2 = require("@wix/sdk-runtime/transformations/transform-paths");
251
+ var ImportStatus = /* @__PURE__ */ ((ImportStatus2) => {
252
+ ImportStatus2["UNKNOWN"] = "UNKNOWN";
253
+ ImportStatus2["INITIATED"] = "INITIATED";
254
+ ImportStatus2["PARSING"] = "PARSING";
255
+ ImportStatus2["PARSED"] = "PARSED";
256
+ ImportStatus2["IMPORTING"] = "IMPORTING";
257
+ ImportStatus2["IMPORTED"] = "IMPORTED";
258
+ ImportStatus2["FAILED"] = "FAILED";
259
+ return ImportStatus2;
260
+ })(ImportStatus || {});
261
+ var ColumnName = /* @__PURE__ */ ((ColumnName2) => {
262
+ ColumnName2["EMAIL"] = "EMAIL";
263
+ ColumnName2["POINTS"] = "POINTS";
264
+ return ColumnName2;
265
+ })(ColumnName || {});
266
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
267
+ SortOrder2["ASC"] = "ASC";
268
+ SortOrder2["DESC"] = "DESC";
269
+ return SortOrder2;
270
+ })(SortOrder || {});
271
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
272
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
273
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
274
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
275
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
276
+ WebhookIdentityType2["APP"] = "APP";
277
+ return WebhookIdentityType2;
278
+ })(WebhookIdentityType || {});
279
+ async function createLoyaltyImport2(fileUrl, options) {
280
+ const { httpClient, sideEffects } = arguments[2];
281
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
282
+ fileUrl,
283
+ fileName: options?.fileName,
284
+ fileSize: options?.fileSize
285
+ });
286
+ const reqOpts = createLoyaltyImport(payload);
287
+ sideEffects?.onSiteCall?.();
288
+ try {
289
+ const result = await httpClient.request(reqOpts);
290
+ sideEffects?.onSuccess?.(result);
291
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
292
+ } catch (err) {
293
+ const transformedError = (0, import_transform_error.transformError)(
294
+ err,
295
+ {
296
+ spreadPathsToArguments: {},
297
+ explicitPathsToArguments: {
298
+ fileUrl: "$[0]",
299
+ fileName: "$[1].fileName",
300
+ fileSize: "$[1].fileSize"
301
+ },
302
+ singleArgumentUnchanged: false
303
+ },
304
+ ["fileUrl", "options"]
305
+ );
306
+ sideEffects?.onError?.(err);
307
+ throw transformedError;
308
+ }
309
+ }
310
+ async function getLoyaltyImport2(loyaltyImportId) {
311
+ const { httpClient, sideEffects } = arguments[1];
312
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
313
+ loyaltyImportId
314
+ });
315
+ const reqOpts = getLoyaltyImport(payload);
316
+ sideEffects?.onSiteCall?.();
317
+ try {
318
+ const result = await httpClient.request(reqOpts);
319
+ sideEffects?.onSuccess?.(result);
320
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data)?.loyaltyImport;
321
+ } catch (err) {
322
+ const transformedError = (0, import_transform_error.transformError)(
323
+ err,
324
+ {
325
+ spreadPathsToArguments: {},
326
+ explicitPathsToArguments: { loyaltyImportId: "$[0]" },
327
+ singleArgumentUnchanged: false
328
+ },
329
+ ["loyaltyImportId"]
330
+ );
331
+ sideEffects?.onError?.(err);
332
+ throw transformedError;
333
+ }
334
+ }
335
+ async function getErrorFileDownloadUrl2(loyaltyImportId) {
336
+ const { httpClient, sideEffects } = arguments[1];
337
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
338
+ loyaltyImportId
339
+ });
340
+ const reqOpts = getErrorFileDownloadUrl(payload);
341
+ sideEffects?.onSiteCall?.();
342
+ try {
343
+ const result = await httpClient.request(reqOpts);
344
+ sideEffects?.onSuccess?.(result);
345
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
346
+ } catch (err) {
347
+ const transformedError = (0, import_transform_error.transformError)(
348
+ err,
349
+ {
350
+ spreadPathsToArguments: {},
351
+ explicitPathsToArguments: { loyaltyImportId: "$[0]" },
352
+ singleArgumentUnchanged: false
353
+ },
354
+ ["loyaltyImportId"]
355
+ );
356
+ sideEffects?.onError?.(err);
357
+ throw transformedError;
358
+ }
359
+ }
360
+ async function executeLoyaltyImport2(loyaltyImportId, options) {
361
+ const { httpClient, sideEffects } = arguments[2];
362
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
363
+ loyaltyImportId,
364
+ headerMappingInfo: options?.headerMappingInfo
365
+ });
366
+ const reqOpts = executeLoyaltyImport(payload);
367
+ sideEffects?.onSiteCall?.();
368
+ try {
369
+ const result = await httpClient.request(reqOpts);
370
+ sideEffects?.onSuccess?.(result);
371
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
372
+ } catch (err) {
373
+ const transformedError = (0, import_transform_error.transformError)(
374
+ err,
375
+ {
376
+ spreadPathsToArguments: {},
377
+ explicitPathsToArguments: {
378
+ loyaltyImportId: "$[0]",
379
+ headerMappingInfo: "$[1].headerMappingInfo"
380
+ },
381
+ singleArgumentUnchanged: false
382
+ },
383
+ ["loyaltyImportId", "options"]
384
+ );
385
+ sideEffects?.onError?.(err);
386
+ throw transformedError;
387
+ }
388
+ }
389
+ async function createLoyaltyImportFileUrl2() {
390
+ const { httpClient, sideEffects } = arguments[0];
391
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
392
+ const reqOpts = createLoyaltyImportFileUrl(
393
+ payload
394
+ );
395
+ sideEffects?.onSiteCall?.();
396
+ try {
397
+ const result = await httpClient.request(reqOpts);
398
+ sideEffects?.onSuccess?.(result);
399
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
400
+ } catch (err) {
401
+ const transformedError = (0, import_transform_error.transformError)(
402
+ err,
403
+ {
404
+ spreadPathsToArguments: {},
405
+ explicitPathsToArguments: {},
406
+ singleArgumentUnchanged: false
407
+ },
408
+ []
409
+ );
410
+ sideEffects?.onError?.(err);
411
+ throw transformedError;
412
+ }
413
+ }
414
+ function queryLoyaltyImports2() {
415
+ const { httpClient, sideEffects } = arguments[0];
416
+ return (0, import_query_builder.queryBuilder)({
417
+ func: async (payload) => {
418
+ const reqOpts = queryLoyaltyImports(payload);
419
+ sideEffects?.onSiteCall?.();
420
+ try {
421
+ const result = await httpClient.request(reqOpts);
422
+ sideEffects?.onSuccess?.(result);
423
+ return result;
424
+ } catch (err) {
425
+ sideEffects?.onError?.(err);
426
+ throw err;
427
+ }
428
+ },
429
+ requestTransformer: (query) => {
430
+ const args = [query, {}];
431
+ return (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
432
+ ...args?.[1],
433
+ query: args?.[0]
434
+ });
435
+ },
436
+ responseTransformer: ({
437
+ data
438
+ }) => {
439
+ const transformedData = (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(
440
+ (0, import_transform_paths2.transformPaths)(data, [])
441
+ );
442
+ return {
443
+ items: transformedData?.loyaltyImports,
444
+ pagingMetadata: transformedData?.pagingMetadata
445
+ };
446
+ },
447
+ errorTransformer: (err) => {
448
+ const transformedError = (0, import_transform_error.transformError)(err, {
449
+ spreadPathsToArguments: {},
450
+ explicitPathsToArguments: { query: "$[0]" },
451
+ singleArgumentUnchanged: false
452
+ });
453
+ throw transformedError;
454
+ },
455
+ pagingMethod: "CURSOR",
456
+ transformationPaths: {}
457
+ });
458
+ }
459
+ // Annotate the CommonJS export names for ESM import in node:
460
+ 0 && (module.exports = {
461
+ ColumnName,
462
+ ImportStatus,
463
+ SortOrder,
464
+ WebhookIdentityType,
465
+ createLoyaltyImport,
466
+ createLoyaltyImportFileUrl,
467
+ executeLoyaltyImport,
468
+ getErrorFileDownloadUrl,
469
+ getLoyaltyImport,
470
+ queryLoyaltyImports
471
+ });
472
+ //# sourceMappingURL=index.typings.js.map