@wix/metro 1.0.79 → 1.0.80

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.
@@ -2,5 +2,6 @@
2
2
  "sideEffects": false,
3
3
  "module": "../build/es/context.js",
4
4
  "main": "../build/cjs/context.js",
5
- "typings": "../build/cjs/context.d.ts"
5
+ "typings": "../build/cjs/context.d.ts",
6
+ "typesBundle": "../type-bundles/context.bundle.d.ts"
6
7
  }
package/meta/package.json CHANGED
@@ -2,5 +2,6 @@
2
2
  "sideEffects": false,
3
3
  "module": "../build/es/meta.js",
4
4
  "main": "../build/cjs/meta.js",
5
- "typings": "../build/cjs/meta.d.ts"
5
+ "typings": "../build/cjs/meta.d.ts",
6
+ "typesBundle": "../type-bundles/meta.bundle.d.ts"
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/metro",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -9,21 +9,27 @@
9
9
  "module": "build/es/index.js",
10
10
  "main": "build/cjs/index.js",
11
11
  "typings": "./build/cjs/index.d.ts",
12
+ "typesBundle": "./type-bundles/index.bundle.d.ts",
12
13
  "files": [
13
14
  "build",
14
15
  "frontend/package.json",
15
16
  "meta",
16
- "context"
17
+ "context",
18
+ "type-bundles"
17
19
  ],
18
20
  "dependencies": {
19
- "@wix/metro_products": "1.0.5"
21
+ "@wix/metro_products": "1.0.6"
20
22
  },
21
23
  "devDependencies": {
22
24
  "@wix/sdk": "https://cdn.dev.wixpress.com/@wix/sdk/02e8069ab2fd783e0e6a080fc7d590e76cb26ab93c8389574286305b.tar.gz",
25
+ "glob": "^10.4.1",
26
+ "rollup": "^4.18.0",
27
+ "rollup-plugin-dts": "^6.1.1",
23
28
  "typescript": "^5.3.2"
24
29
  },
25
30
  "scripts": {
26
- "build": "tsc -b tsconfig.json tsconfig.esm.json",
31
+ "build": "tsc -b tsconfig.json tsconfig.esm.json && npm run build:dts-bundles",
32
+ "build:dts-bundles": "test -f config/rollup-config.js && rollup --config config/rollup-config.js || echo 'Warning: config/rollup-config.js not found!'",
27
33
  "test": ":"
28
34
  },
29
35
  "wix": {
@@ -37,5 +43,5 @@
37
43
  "fqdn": ""
38
44
  }
39
45
  },
40
- "falconPackageHash": "136ed5ae36ef6f1f16f20a8ee7de14674e50825da7a4769c7d4a8690"
46
+ "falconPackageHash": "679ed5c0c092341d244fecd00369348a1e592f40bd2b7019176fb7bb"
41
47
  }
@@ -0,0 +1,483 @@
1
+ /** Physical address */
2
+ interface Address extends AddressStreetOneOf {
3
+ /** Street name and number. */
4
+ streetAddress?: StreetAddress;
5
+ /** Main address line, usually street and number as free text. */
6
+ addressLine1?: string | null;
7
+ /** Country code. */
8
+ country?: string | null;
9
+ /** Subdivision shorthand. Usually, a short code (2 or 3 letters) that represents a state, region, prefecture, or province. e.g. NY */
10
+ subdivision?: string | null;
11
+ /** City name. */
12
+ city?: string | null;
13
+ /** Zip/postal code. */
14
+ postalCode?: string | null;
15
+ /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */
16
+ addressLine2?: string | null;
17
+ }
18
+ /** @oneof */
19
+ interface AddressStreetOneOf {
20
+ /** Street name and number. */
21
+ streetAddress?: StreetAddress;
22
+ /** Main address line, usually street and number as free text. */
23
+ addressLine?: string | null;
24
+ }
25
+ interface StreetAddress {
26
+ /** Street number. */
27
+ number?: string;
28
+ /** Street name. */
29
+ name?: string;
30
+ }
31
+ interface PageLink {
32
+ /** The page id we want from the site */
33
+ pageId?: string;
34
+ /** Where this link should open, supports _self and _blank or any name the user chooses. _self means same page, _blank means new page. */
35
+ target?: string | null;
36
+ /** rel of link */
37
+ rel?: LinkRel[];
38
+ }
39
+ /**
40
+ * The 'rel' attribute of the link. The rel attribute defines the relationship between a linked resource and the current document.
41
+ * Further reading (also about different possible rel types): https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel
42
+ * Following are the accepted 'rel' types by Wix applications.
43
+ */
44
+ declare enum LinkRel {
45
+ /** default (not implemented) */
46
+ unknown_link_rel = "unknown_link_rel",
47
+ /** Indicates that the current document's original author or publisher does not endorse the referenced document. */
48
+ nofollow = "nofollow",
49
+ /** Instructs the browser to navigate to the target resource without granting the new browsing context access to the document that opened it. */
50
+ noopener = "noopener",
51
+ /** No Referer header will be included. Additionally, has the same effect as noopener. */
52
+ noreferrer = "noreferrer",
53
+ /** Indicates a link that resulted from advertisements or paid placements. */
54
+ sponsored = "sponsored"
55
+ }
56
+ interface Variant {
57
+ name?: string;
58
+ value?: string;
59
+ image?: string;
60
+ }
61
+ interface MyAddress {
62
+ country?: string | null;
63
+ subdivision?: string | null;
64
+ city?: string | null;
65
+ postalCode?: string | null;
66
+ streetAddress?: StreetAddress;
67
+ }
68
+ interface GetProductsStartWithResponse {
69
+ products?: Product[];
70
+ }
71
+ interface Cursors {
72
+ /** Cursor string pointing to the next page in the list of results. */
73
+ next?: string | null;
74
+ /** Cursor pointing to the previous page in the list of results. */
75
+ prev?: string | null;
76
+ }
77
+ interface BulkCreateProductsResponse {
78
+ results?: BulkProductResult[];
79
+ bulkActionMetadata?: BulkActionMetadata;
80
+ }
81
+ interface ItemMetadata {
82
+ /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */
83
+ _id?: string | null;
84
+ /** Index of the item within the request array. Allows for correlation between request and response items. */
85
+ originalIndex?: number;
86
+ /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */
87
+ success?: boolean;
88
+ /** Details about the error in case of failure. */
89
+ error?: ApplicationError;
90
+ }
91
+ interface ApplicationError {
92
+ /** Error code. */
93
+ code?: string;
94
+ /** Description of the error. */
95
+ description?: string;
96
+ /** Data related to the error. */
97
+ data?: Record<string, any> | null;
98
+ }
99
+ interface BulkProductResult {
100
+ /** Defined in wix.commons */
101
+ itemMetadata?: ItemMetadata;
102
+ /** Only exists if `returnEntity` was set to true in the request */
103
+ item?: Product;
104
+ }
105
+ interface BulkActionMetadata {
106
+ /** Number of items that were successfully processed. */
107
+ totalSuccesses?: number;
108
+ /** Number of items that couldn't be processed. */
109
+ totalFailures?: number;
110
+ /** Number of failures without details because detailed failure threshold was exceeded. */
111
+ undetailedFailures?: number;
112
+ }
113
+ interface MaskedProduct {
114
+ /** Product to be updated, may be partial */
115
+ product?: Product;
116
+ }
117
+ interface BulkUpdateProductsResponse {
118
+ results?: BulkUpdateProductsResponseBulkProductResult[];
119
+ bulkActionMetadata?: BulkActionMetadata;
120
+ }
121
+ interface BulkUpdateProductsResponseBulkProductResult {
122
+ itemMetadata?: ItemMetadata;
123
+ /** Only exists if `returnEntity` was set to true in the request */
124
+ item?: Product;
125
+ }
126
+ interface BulkDeleteProductsResponse {
127
+ results?: BulkDeleteProductsResponseBulkProductResult[];
128
+ bulkActionMetadata?: BulkActionMetadata;
129
+ }
130
+ interface BulkDeleteProductsResponseBulkProductResult {
131
+ itemMetadata?: ItemMetadata;
132
+ }
133
+ interface GetProductsStartWithResponseNonNullableFields {
134
+ products: {
135
+ _id: string;
136
+ collectionId: string;
137
+ image: string;
138
+ document: string;
139
+ video: string;
140
+ pageLink?: {
141
+ pageId: string;
142
+ rel: LinkRel[];
143
+ };
144
+ audio: string;
145
+ variants: {
146
+ name: string;
147
+ value: string;
148
+ image: string;
149
+ }[];
150
+ mainVariant?: {
151
+ name: string;
152
+ value: string;
153
+ image: string;
154
+ };
155
+ guid: string;
156
+ }[];
157
+ }
158
+ interface BulkCreateProductsResponseNonNullableFields {
159
+ results: {
160
+ itemMetadata?: {
161
+ originalIndex: number;
162
+ success: boolean;
163
+ error?: {
164
+ code: string;
165
+ description: string;
166
+ };
167
+ };
168
+ item?: {
169
+ _id: string;
170
+ collectionId: string;
171
+ image: string;
172
+ document: string;
173
+ video: string;
174
+ pageLink?: {
175
+ pageId: string;
176
+ rel: LinkRel[];
177
+ };
178
+ audio: string;
179
+ variants: {
180
+ name: string;
181
+ value: string;
182
+ image: string;
183
+ }[];
184
+ mainVariant?: {
185
+ name: string;
186
+ value: string;
187
+ image: string;
188
+ };
189
+ guid: string;
190
+ };
191
+ }[];
192
+ bulkActionMetadata?: {
193
+ totalSuccesses: number;
194
+ totalFailures: number;
195
+ undetailedFailures: number;
196
+ };
197
+ }
198
+ interface BulkUpdateProductsResponseNonNullableFields {
199
+ results: {
200
+ itemMetadata?: {
201
+ originalIndex: number;
202
+ success: boolean;
203
+ error?: {
204
+ code: string;
205
+ description: string;
206
+ };
207
+ };
208
+ item?: {
209
+ _id: string;
210
+ collectionId: string;
211
+ image: string;
212
+ document: string;
213
+ video: string;
214
+ pageLink?: {
215
+ pageId: string;
216
+ rel: LinkRel[];
217
+ };
218
+ audio: string;
219
+ variants: {
220
+ name: string;
221
+ value: string;
222
+ image: string;
223
+ }[];
224
+ mainVariant?: {
225
+ name: string;
226
+ value: string;
227
+ image: string;
228
+ };
229
+ guid: string;
230
+ };
231
+ }[];
232
+ bulkActionMetadata?: {
233
+ totalSuccesses: number;
234
+ totalFailures: number;
235
+ undetailedFailures: number;
236
+ };
237
+ }
238
+ interface BulkDeleteProductsResponseNonNullableFields {
239
+ results: {
240
+ itemMetadata?: {
241
+ originalIndex: number;
242
+ success: boolean;
243
+ error?: {
244
+ code: string;
245
+ description: string;
246
+ };
247
+ };
248
+ }[];
249
+ bulkActionMetadata?: {
250
+ totalSuccesses: number;
251
+ totalFailures: number;
252
+ undetailedFailures: number;
253
+ };
254
+ }
255
+ interface Product {
256
+ _id: string;
257
+ name: string | null;
258
+ collectionId: string;
259
+ _createdDate: Date;
260
+ modifiedDate: Date;
261
+ image: string;
262
+ address: Address;
263
+ document: string;
264
+ video: string;
265
+ pageLink: PageLink;
266
+ audio: string;
267
+ color: string | null;
268
+ localDate: string | null;
269
+ localTime: string | null;
270
+ localDateTime: string | null;
271
+ variants: Variant[];
272
+ mainVariant: Variant;
273
+ customAddress: MyAddress;
274
+ guid: string;
275
+ }
276
+ interface CreateProductOptions {
277
+ product?: Product;
278
+ }
279
+ interface UpdateProductOptions {
280
+ product?: Product;
281
+ }
282
+ interface GetProductsStartWithOptions {
283
+ addressLine2?: string | null;
284
+ }
285
+ interface QueryProductsOptions {
286
+ /** Whether variants should be included in the response. */
287
+ includeVariants?: boolean | undefined;
288
+ /** Whether hidden products should be included in the response. Requires permissions to manage products. */
289
+ includeHiddenProducts?: boolean | undefined;
290
+ /** Whether merchant specific data should be included in the response. Requires permissions to manage products. */
291
+ includeMerchantSpecificData?: boolean | undefined;
292
+ }
293
+ interface QueryCursorResult {
294
+ cursors: Cursors;
295
+ hasNext: () => boolean;
296
+ hasPrev: () => boolean;
297
+ length: number;
298
+ pageSize: number;
299
+ }
300
+ interface ProductsQueryResult extends QueryCursorResult {
301
+ items: Product[];
302
+ query: ProductsQueryBuilder;
303
+ next: () => Promise<ProductsQueryResult>;
304
+ prev: () => Promise<ProductsQueryResult>;
305
+ }
306
+ interface ProductsQueryBuilder {
307
+ /** @param propertyName - Property whose value is compared with `value`.
308
+ * @param value - Value to compare against.
309
+ * @documentationMaturity preview
310
+ */
311
+ eq: (propertyName: 'title' | 'collectionId' | 'guid', value: any) => ProductsQueryBuilder;
312
+ /** @param propertyName - Property whose value is compared with `value`.
313
+ * @param value - Value to compare against.
314
+ * @documentationMaturity preview
315
+ */
316
+ ne: (propertyName: 'title' | 'guid', value: any) => ProductsQueryBuilder;
317
+ /** @param propertyName - Property whose value is compared with `string`.
318
+ * @param string - String to compare against. Case-insensitive.
319
+ * @documentationMaturity preview
320
+ */
321
+ startsWith: (propertyName: 'title' | 'guid', value: string) => ProductsQueryBuilder;
322
+ /** @param propertyName - Property whose value is compared with `values`.
323
+ * @param values - List of values to compare against.
324
+ * @documentationMaturity preview
325
+ */
326
+ hasSome: (propertyName: 'title' | 'guid', value: any[]) => ProductsQueryBuilder;
327
+ /** @documentationMaturity preview */
328
+ in: (propertyName: 'title' | 'guid', value: any) => ProductsQueryBuilder;
329
+ /** @documentationMaturity preview */
330
+ exists: (propertyName: 'title' | 'guid', value: boolean) => ProductsQueryBuilder;
331
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
332
+ * @documentationMaturity preview
333
+ */
334
+ ascending: (...propertyNames: Array<'title' | 'collectionId' | 'guid'>) => ProductsQueryBuilder;
335
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
336
+ * @documentationMaturity preview
337
+ */
338
+ descending: (...propertyNames: Array<'title' | 'collectionId' | 'guid'>) => ProductsQueryBuilder;
339
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
340
+ * @documentationMaturity preview
341
+ */
342
+ limit: (limit: number) => ProductsQueryBuilder;
343
+ /** @param cursor - A pointer to specific record
344
+ * @documentationMaturity preview
345
+ */
346
+ skipTo: (cursor: string) => ProductsQueryBuilder;
347
+ /** @documentationMaturity preview */
348
+ find: () => Promise<ProductsQueryResult>;
349
+ }
350
+ interface BulkCreateProductsOptions {
351
+ /** set to `true` if you wish to receive back the created products in the response */
352
+ returnEntity?: boolean;
353
+ }
354
+ interface BulkUpdateProductsOptions {
355
+ /** set to `true` if you wish to receive back the updated products in the response */
356
+ returnEntity?: boolean;
357
+ }
358
+
359
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
360
+ interface HttpClient {
361
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
362
+ }
363
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
364
+ type HttpResponse<T = any> = {
365
+ data: T;
366
+ status: number;
367
+ statusText: string;
368
+ headers: any;
369
+ request?: any;
370
+ };
371
+ type RequestOptions<_TResponse = any, Data = any> = {
372
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
373
+ url: string;
374
+ data?: Data;
375
+ params?: URLSearchParams;
376
+ } & APIMetadata;
377
+ type APIMetadata = {
378
+ methodFqn?: string;
379
+ entityFqdn?: string;
380
+ packageName?: string;
381
+ };
382
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
383
+
384
+ declare function createProduct$1(httpClient: HttpClient): (options?: CreateProductOptions) => Promise<Product & {
385
+ _id: string;
386
+ collectionId: string;
387
+ image: string;
388
+ document: string;
389
+ video: string;
390
+ pageLink?: {
391
+ pageId: string;
392
+ rel: LinkRel[];
393
+ } | undefined;
394
+ audio: string;
395
+ variants: {
396
+ name: string;
397
+ value: string;
398
+ image: string;
399
+ }[];
400
+ mainVariant?: {
401
+ name: string;
402
+ value: string;
403
+ image: string;
404
+ } | undefined;
405
+ guid: string;
406
+ }>;
407
+ declare function deleteProduct$1(httpClient: HttpClient): (productId: string) => Promise<void>;
408
+ declare function updateProduct$1(httpClient: HttpClient): (productId: string, options?: UpdateProductOptions) => Promise<Product & {
409
+ _id: string;
410
+ collectionId: string;
411
+ image: string;
412
+ document: string;
413
+ video: string;
414
+ pageLink?: {
415
+ pageId: string;
416
+ rel: LinkRel[];
417
+ } | undefined;
418
+ audio: string;
419
+ variants: {
420
+ name: string;
421
+ value: string;
422
+ image: string;
423
+ }[];
424
+ mainVariant?: {
425
+ name: string;
426
+ value: string;
427
+ image: string;
428
+ } | undefined;
429
+ guid: string;
430
+ }>;
431
+ declare function getProduct$1(httpClient: HttpClient): (productId: string) => Promise<Product & {
432
+ _id: string;
433
+ collectionId: string;
434
+ image: string;
435
+ document: string;
436
+ video: string;
437
+ pageLink?: {
438
+ pageId: string;
439
+ rel: LinkRel[];
440
+ } | undefined;
441
+ audio: string;
442
+ variants: {
443
+ name: string;
444
+ value: string;
445
+ image: string;
446
+ }[];
447
+ mainVariant?: {
448
+ name: string;
449
+ value: string;
450
+ image: string;
451
+ } | undefined;
452
+ guid: string;
453
+ }>;
454
+ declare function getProductsStartWith$1(httpClient: HttpClient): (title: string, options?: GetProductsStartWithOptions) => Promise<GetProductsStartWithResponse & GetProductsStartWithResponseNonNullableFields>;
455
+ declare function queryProducts$1(httpClient: HttpClient): (options?: QueryProductsOptions) => ProductsQueryBuilder;
456
+ declare function bulkCreateProducts$1(httpClient: HttpClient): (products: Product[], options?: BulkCreateProductsOptions) => Promise<BulkCreateProductsResponse & BulkCreateProductsResponseNonNullableFields>;
457
+ declare function bulkUpdateProducts$1(httpClient: HttpClient): (products: MaskedProduct[], options?: BulkUpdateProductsOptions) => Promise<BulkUpdateProductsResponse & BulkUpdateProductsResponseNonNullableFields>;
458
+ declare function bulkDeleteProducts$1(httpClient: HttpClient): (productIds: string[]) => Promise<BulkDeleteProductsResponse & BulkDeleteProductsResponseNonNullableFields>;
459
+
460
+ declare const createProduct: BuildRESTFunction<typeof createProduct$1>;
461
+ declare const deleteProduct: BuildRESTFunction<typeof deleteProduct$1>;
462
+ declare const updateProduct: BuildRESTFunction<typeof updateProduct$1>;
463
+ declare const getProduct: BuildRESTFunction<typeof getProduct$1>;
464
+ declare const getProductsStartWith: BuildRESTFunction<typeof getProductsStartWith$1>;
465
+ declare const queryProducts: BuildRESTFunction<typeof queryProducts$1>;
466
+ declare const bulkCreateProducts: BuildRESTFunction<typeof bulkCreateProducts$1>;
467
+ declare const bulkUpdateProducts: BuildRESTFunction<typeof bulkUpdateProducts$1>;
468
+ declare const bulkDeleteProducts: BuildRESTFunction<typeof bulkDeleteProducts$1>;
469
+
470
+ declare const context_bulkCreateProducts: typeof bulkCreateProducts;
471
+ declare const context_bulkDeleteProducts: typeof bulkDeleteProducts;
472
+ declare const context_bulkUpdateProducts: typeof bulkUpdateProducts;
473
+ declare const context_createProduct: typeof createProduct;
474
+ declare const context_deleteProduct: typeof deleteProduct;
475
+ declare const context_getProduct: typeof getProduct;
476
+ declare const context_getProductsStartWith: typeof getProductsStartWith;
477
+ declare const context_queryProducts: typeof queryProducts;
478
+ declare const context_updateProduct: typeof updateProduct;
479
+ declare namespace context {
480
+ export { context_bulkCreateProducts as bulkCreateProducts, context_bulkDeleteProducts as bulkDeleteProducts, context_bulkUpdateProducts as bulkUpdateProducts, context_createProduct as createProduct, context_deleteProduct as deleteProduct, context_getProduct as getProduct, context_getProductsStartWith as getProductsStartWith, context_queryProducts as queryProducts, context_updateProduct as updateProduct };
481
+ }
482
+
483
+ export { context as products };