@wix/stores 1.0.0

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.
Files changed (55) hide show
  1. package/build/cjs/index.d.ts +2 -0
  2. package/build/cjs/index.js +25 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/src/stores-poc-v1-collection.http.d.ts +4 -0
  5. package/build/cjs/src/stores-poc-v1-collection.http.js +53 -0
  6. package/build/cjs/src/stores-poc-v1-collection.http.js.map +1 -0
  7. package/build/cjs/src/stores-poc-v1-collection.public.d.ts +6 -0
  8. package/build/cjs/src/stores-poc-v1-collection.public.js +20 -0
  9. package/build/cjs/src/stores-poc-v1-collection.public.js.map +1 -0
  10. package/build/cjs/src/stores-poc-v1-collection.types.d.ts +148 -0
  11. package/build/cjs/src/stores-poc-v1-collection.types.js +18 -0
  12. package/build/cjs/src/stores-poc-v1-collection.types.js.map +1 -0
  13. package/build/cjs/src/stores-poc-v1-collection.universal.d.ts +210 -0
  14. package/build/cjs/src/stores-poc-v1-collection.universal.js +161 -0
  15. package/build/cjs/src/stores-poc-v1-collection.universal.js.map +1 -0
  16. package/build/cjs/src/stores-poc-v1-product.http.d.ts +4 -0
  17. package/build/cjs/src/stores-poc-v1-product.http.js +96 -0
  18. package/build/cjs/src/stores-poc-v1-product.http.js.map +1 -0
  19. package/build/cjs/src/stores-poc-v1-product.public.d.ts +6 -0
  20. package/build/cjs/src/stores-poc-v1-product.public.js +25 -0
  21. package/build/cjs/src/stores-poc-v1-product.public.js.map +1 -0
  22. package/build/cjs/src/stores-poc-v1-product.types.d.ts +476 -0
  23. package/build/cjs/src/stores-poc-v1-product.types.js +69 -0
  24. package/build/cjs/src/stores-poc-v1-product.types.js.map +1 -0
  25. package/build/cjs/src/stores-poc-v1-product.universal.d.ts +550 -0
  26. package/build/cjs/src/stores-poc-v1-product.universal.js +212 -0
  27. package/build/cjs/src/stores-poc-v1-product.universal.js.map +1 -0
  28. package/build/es/index.d.ts +2 -0
  29. package/build/es/index.js +3 -0
  30. package/build/es/index.js.map +1 -0
  31. package/build/es/src/stores-poc-v1-collection.http.d.ts +4 -0
  32. package/build/es/src/stores-poc-v1-collection.http.js +48 -0
  33. package/build/es/src/stores-poc-v1-collection.http.js.map +1 -0
  34. package/build/es/src/stores-poc-v1-collection.public.d.ts +6 -0
  35. package/build/es/src/stores-poc-v1-collection.public.js +13 -0
  36. package/build/es/src/stores-poc-v1-collection.public.js.map +1 -0
  37. package/build/es/src/stores-poc-v1-collection.types.d.ts +148 -0
  38. package/build/es/src/stores-poc-v1-collection.types.js +15 -0
  39. package/build/es/src/stores-poc-v1-collection.types.js.map +1 -0
  40. package/build/es/src/stores-poc-v1-collection.universal.d.ts +210 -0
  41. package/build/es/src/stores-poc-v1-collection.universal.js +137 -0
  42. package/build/es/src/stores-poc-v1-collection.universal.js.map +1 -0
  43. package/build/es/src/stores-poc-v1-product.http.d.ts +4 -0
  44. package/build/es/src/stores-poc-v1-product.http.js +91 -0
  45. package/build/es/src/stores-poc-v1-product.http.js.map +1 -0
  46. package/build/es/src/stores-poc-v1-product.public.d.ts +6 -0
  47. package/build/es/src/stores-poc-v1-product.public.js +13 -0
  48. package/build/es/src/stores-poc-v1-product.public.js.map +1 -0
  49. package/build/es/src/stores-poc-v1-product.types.d.ts +476 -0
  50. package/build/es/src/stores-poc-v1-product.types.js +66 -0
  51. package/build/es/src/stores-poc-v1-product.types.js.map +1 -0
  52. package/build/es/src/stores-poc-v1-product.universal.d.ts +550 -0
  53. package/build/es/src/stores-poc-v1-product.universal.js +188 -0
  54. package/build/es/src/stores-poc-v1-product.universal.js.map +1 -0
  55. package/package.json +37 -0
@@ -0,0 +1,2 @@
1
+ export * as collections from './src/stores-poc-v1-collection.public';
2
+ export * as products from './src/stores-poc-v1-product.public';
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.products = exports.collections = void 0;
23
+ exports.collections = __importStar(require("./src/stores-poc-v1-collection.public"));
24
+ exports.products = __importStar(require("./src/stores-poc-v1-product.public"));
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qFAAqE;AACrE,+EAA+D"}
@@ -0,0 +1,4 @@
1
+ import { RequestOptionsFactory } from '@wix/sdk-types';
2
+ import { GetCollectionRequest, GetCollectionResponse, QueryCollectionsRequest, QueryCollectionsResponse } from './stores-poc-v1-collection.types';
3
+ export declare function getCollection(payload: GetCollectionRequest): RequestOptionsFactory<GetCollectionResponse>;
4
+ export declare function queryCollections(payload: QueryCollectionsRequest): RequestOptionsFactory<QueryCollectionsResponse>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.queryCollections = exports.getCollection = void 0;
4
+ const metro_runtime_1 = require("@wix/metro-runtime");
5
+ const ambassador_1 = require("@wix/metro-runtime/ambassador");
6
+ const metro_runtime_2 = require("@wix/metro-runtime");
7
+ const _getCollectionRequest = {};
8
+ const _getCollectionResponse = {};
9
+ const _queryCollectionsRequest = {};
10
+ const _queryCollectionsResponse = {};
11
+ function resolveWixCoreservicesMetroinspectorV1CollectionsPocCollectionsPocServiceUrl(opts) {
12
+ const domainToMappings = {};
13
+ return metro_runtime_2.resolveUrl(Object.assign(opts, { domainToMappings }));
14
+ }
15
+ function getCollection(payload) {
16
+ const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_getCollectionRequest, {});
17
+ const { fromJSON: fromRes } = ambassador_1.serializer(_getCollectionResponse, {});
18
+ function __getCollection({ host }) {
19
+ const serializedData = toReq(payload);
20
+ const metadata = {
21
+ method: 'GET',
22
+ url: resolveWixCoreservicesMetroinspectorV1CollectionsPocCollectionsPocServiceUrl({
23
+ protoPath: '/v1/collections/{collectionId}',
24
+ data: serializedData,
25
+ host,
26
+ }),
27
+ params: metro_runtime_1.toURLSearchParams(serializedData),
28
+ transformResponse: fromRes,
29
+ };
30
+ return metadata;
31
+ }
32
+ __getCollection.fromReq = fromReq;
33
+ return __getCollection;
34
+ }
35
+ exports.getCollection = getCollection;
36
+ function queryCollections(payload) {
37
+ const { toJSON: toReq, fromJSON: fromReq } = ambassador_1.serializer(_queryCollectionsRequest, {});
38
+ const { fromJSON: fromRes } = ambassador_1.serializer(_queryCollectionsResponse, {});
39
+ function __queryCollections({ host }) {
40
+ const serializedData = toReq(payload);
41
+ const metadata = {
42
+ method: 'POST',
43
+ url: resolveWixCoreservicesMetroinspectorV1CollectionsPocCollectionsPocServiceUrl({ protoPath: '/v1/collections/query', data: serializedData, host }),
44
+ data: serializedData,
45
+ transformResponse: fromRes,
46
+ };
47
+ return metadata;
48
+ }
49
+ __queryCollections.fromReq = fromReq;
50
+ return __queryCollections;
51
+ }
52
+ exports.queryCollections = queryCollections;
53
+ //# sourceMappingURL=stores-poc-v1-collection.http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stores-poc-v1-collection.http.js","sourceRoot":"","sources":["../../../src/stores-poc-v1-collection.http.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AACvD,8DAA2D;AAC3D,sDAAgD;AAUhD,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC,SAAS,4EAA4E,CACnF,IAA8C;IAE9C,MAAM,gBAAgB,GAAG,EAAE,CAAC;IAE5B,OAAO,0BAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,aAAa,CAC3B,OAA6B;IAE7B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,uBAAU,CACrD,qBAAqB,EACrB,EAAE,CACH,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,uBAAU,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;IAErE,SAAS,eAAe,CAAC,EAAE,IAAI,EAAO;QACpC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG;YACf,MAAM,EAAE,KAAY;YACpB,GAAG,EAAE,4EAA4E,CAC/E;gBACE,SAAS,EAAE,gCAAgC;gBAC3C,IAAI,EAAE,cAAc;gBACpB,IAAI;aACL,CACF;YACD,MAAM,EAAE,iCAAiB,CAAC,cAAc,CAAC;YACzC,iBAAiB,EAAE,OAAO;SAC3B,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,eAAe,CAAC,OAAO,GAAG,OAAO,CAAC;IAElC,OAAO,eAAe,CAAC;AACzB,CAAC;AA9BD,sCA8BC;AAED,SAAgB,gBAAgB,CAC9B,OAAgC;IAEhC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,uBAAU,CACrD,wBAAwB,EACxB,EAAE,CACH,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,uBAAU,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;IAExE,SAAS,kBAAkB,CAAC,EAAE,IAAI,EAAO;QACvC,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG;YACf,MAAM,EAAE,MAAa;YACrB,GAAG,EAAE,4EAA4E,CAC/E,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CACnE;YACD,IAAI,EAAE,cAAc;YACpB,iBAAiB,EAAE,OAAO;SAC3B,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,kBAAkB,CAAC,OAAO,GAAG,OAAO,CAAC;IAErC,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AA1BD,4CA0BC"}
@@ -0,0 +1,6 @@
1
+ import { HttpClient } from '@wix/sdk-types';
2
+ import { GetCollectionOptions } from './stores-poc-v1-collection.universal';
3
+ export declare function getCollection(httpClient: HttpClient): (collectionId: string, options?: GetCollectionOptions | undefined) => Promise<import("./stores-poc-v1-collection.universal").Collection>;
4
+ export declare function queryCollections(httpClient: HttpClient): () => import("./stores-poc-v1-collection.universal").CollectionsQueryBuilder;
5
+ export { MediaItemType, SortOrder } from './stores-poc-v1-collection.universal';
6
+ export { Collection, Media, MediaItem, MediaItemItemOneOf, MediaItemUrlAndSize, MediaItemVideo, GetCollectionRequest, GetCollectionResponse, QueryCollectionsRequest, PlatformQuery, PlatformQueryPagingMethodOneOf, Sorting, PlatformPaging, QueryCollectionsResponse, PlatformPagingMetadata, Cursors, GetCollectionOptions, CollectionsQueryResult, CollectionsQueryBuilder, } from './stores-poc-v1-collection.universal';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SortOrder = exports.MediaItemType = exports.queryCollections = exports.getCollection = void 0;
4
+ const stores_poc_v1_collection_universal_1 = require("./stores-poc-v1-collection.universal");
5
+ function getCollection(httpClient) {
6
+ return (collectionId, options) => stores_poc_v1_collection_universal_1.getCollection(collectionId, options,
7
+ // @ts-ignore
8
+ { httpClient });
9
+ }
10
+ exports.getCollection = getCollection;
11
+ function queryCollections(httpClient) {
12
+ return () => stores_poc_v1_collection_universal_1.queryCollections(
13
+ // @ts-ignore
14
+ { httpClient });
15
+ }
16
+ exports.queryCollections = queryCollections;
17
+ var stores_poc_v1_collection_universal_2 = require("./stores-poc-v1-collection.universal");
18
+ Object.defineProperty(exports, "MediaItemType", { enumerable: true, get: function () { return stores_poc_v1_collection_universal_2.MediaItemType; } });
19
+ Object.defineProperty(exports, "SortOrder", { enumerable: true, get: function () { return stores_poc_v1_collection_universal_2.SortOrder; } });
20
+ //# sourceMappingURL=stores-poc-v1-collection.public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stores-poc-v1-collection.public.js","sourceRoot":"","sources":["../../../src/stores-poc-v1-collection.public.ts"],"names":[],"mappings":";;;AACA,6FAI8C;AAE9C,SAAgB,aAAa,CAAC,UAAsB;IAClD,OAAO,CAAC,YAAoB,EAAE,OAA8B,EAAE,EAAE,CAC9D,kDAAsB,CACpB,YAAY,EACZ,OAAO;IACP,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AARD,sCAQC;AAED,SAAgB,gBAAgB,CAAC,UAAsB;IACrD,OAAO,GAAG,EAAE,CACV,qDAAyB;IACvB,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AAND,4CAMC;AAED,2FAAgF;AAAvE,mIAAA,aAAa,OAAA;AAAE,+HAAA,SAAS,OAAA"}
@@ -0,0 +1,148 @@
1
+ export interface Collection {
2
+ /**
3
+ * Collection ID (generated automatically by the catalog)
4
+ * @readonly
5
+ */
6
+ id?: string | null;
7
+ /** Collection name */
8
+ name?: string | null;
9
+ /**
10
+ * Media items (images, videos etc) associated with this collection. Read only.
11
+ * @readonly
12
+ */
13
+ media?: Media;
14
+ /**
15
+ * Number of products in the collection. Read only.
16
+ * @readonly
17
+ */
18
+ numberOfProducts?: number;
19
+ /** Collection description. The description length without HTML must not exceed 2000 characters (10K includes HTML) */
20
+ description?: string | null;
21
+ /** Collection slug */
22
+ slug?: string | null;
23
+ /** Collection visibility. Only impacts dynamic pages, no impact on static pages */
24
+ visible?: boolean | null;
25
+ }
26
+ export interface Media {
27
+ /** Primary media (image, video etc) associated with this product. */
28
+ mainMedia?: MediaItem;
29
+ /** Media (images, videos etc) associated with this product. */
30
+ items?: MediaItem[];
31
+ }
32
+ export interface MediaItem extends MediaItemItemOneOf {
33
+ /** Media item thumbnail details. */
34
+ thumbnail?: MediaItemUrlAndSize;
35
+ /** Media item type (image, video, etc.). */
36
+ mediaType?: MediaItemType;
37
+ /** Media item title. */
38
+ title?: string;
39
+ /** Media ID (for example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`). */
40
+ id?: string;
41
+ /** Image data (URL, size). */
42
+ image?: MediaItemUrlAndSize;
43
+ /** Video data (URL, size). */
44
+ video?: MediaItemVideo;
45
+ }
46
+ /** @oneof */
47
+ export interface MediaItemItemOneOf {
48
+ /** Image data (URL, size). */
49
+ image?: MediaItemUrlAndSize;
50
+ /** Video data (URL, size). */
51
+ video?: MediaItemVideo;
52
+ }
53
+ export interface MediaItemUrlAndSize {
54
+ /** Media item URL. */
55
+ url?: string;
56
+ /** Media item width. */
57
+ width?: number;
58
+ /** Media item height. */
59
+ height?: number;
60
+ /** Media format (mp4, png, etc.). */
61
+ format?: string | null;
62
+ /** Alt text. This text will be shown in case the image is not available. */
63
+ altText?: string | null;
64
+ }
65
+ export declare enum MediaItemType {
66
+ unspecified_media_item_type = "unspecified_media_item_type",
67
+ image = "image",
68
+ video = "video",
69
+ audio = "audio",
70
+ document = "document",
71
+ zip = "zip"
72
+ }
73
+ export interface MediaItemVideo {
74
+ /** Data (URL, size) about each resolution for which this video is available. */
75
+ files?: MediaItemUrlAndSize[];
76
+ /** ID of an image taken from the video. Used primarily for Wix Search indexing. For example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`. */
77
+ stillFrameMediaId?: string;
78
+ }
79
+ export interface GetCollectionRequest {
80
+ /** Requested collection ID. */
81
+ collectionId: string;
82
+ /**
83
+ * Whether to return the `collection.numberOfProducts` field in the response.
84
+ * Defaults to false, in which case the value of `collection.numberOfProducts` will be 0.
85
+ */
86
+ includeNumberOfProducts?: boolean;
87
+ /** Include description in response. When False, description will be null */
88
+ includeDescription?: boolean;
89
+ }
90
+ export interface GetCollectionResponse {
91
+ collection?: Collection;
92
+ }
93
+ export interface QueryCollectionsRequest {
94
+ query?: PlatformQuery;
95
+ /** Whether number of products should be included in the response. */
96
+ includeNumberOfProducts?: boolean;
97
+ /** Include description in response. When False, description will be null */
98
+ includeDescription?: boolean;
99
+ }
100
+ export interface PlatformQuery extends PlatformQueryPagingMethodOneOf {
101
+ /** Filter object. */
102
+ filter?: Record<string, any> | null;
103
+ /** Sorting options. For example, `[{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]`. */
104
+ sort?: Sorting[];
105
+ /** Pointer to page of results using offset. Cannot be used together with `cursorPaging`. */
106
+ paging?: PlatformPaging;
107
+ }
108
+ /** @oneof */
109
+ export interface PlatformQueryPagingMethodOneOf {
110
+ /** Pointer to page of results using offset. Cannot be used together with `cursorPaging`. */
111
+ paging?: PlatformPaging;
112
+ }
113
+ export interface Sorting {
114
+ /** Name of the field to sort by. */
115
+ fieldName?: string;
116
+ /** Sort order. */
117
+ order?: SortOrder;
118
+ }
119
+ export declare enum SortOrder {
120
+ ASC = "ASC",
121
+ DESC = "DESC"
122
+ }
123
+ export interface PlatformPaging {
124
+ /** Number of items to load. */
125
+ limit?: number | null;
126
+ /** Number of items to skip in the current sort order. */
127
+ offset?: number | null;
128
+ }
129
+ export interface QueryCollectionsResponse {
130
+ collections?: Collection[];
131
+ metadata?: PlatformPagingMetadata;
132
+ }
133
+ export interface PlatformPagingMetadata {
134
+ /** The number of items returned in this response. */
135
+ count?: number | null;
136
+ /** The offset which was requested. Returned if offset paging was used. */
137
+ offset?: number | null;
138
+ /** The total number of items that match the query. Returned if offset paging was used. */
139
+ total?: number | null;
140
+ /** Cursors to navigate through result pages. Returned if cursor paging was used. */
141
+ cursors?: Cursors;
142
+ }
143
+ export interface Cursors {
144
+ /** Cursor pointing to next page in the list of results. */
145
+ next?: string | null;
146
+ /** Cursor pointing to previous page in the list of results. */
147
+ prev?: string | null;
148
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SortOrder = exports.MediaItemType = void 0;
4
+ var MediaItemType;
5
+ (function (MediaItemType) {
6
+ MediaItemType["unspecified_media_item_type"] = "unspecified_media_item_type";
7
+ MediaItemType["image"] = "image";
8
+ MediaItemType["video"] = "video";
9
+ MediaItemType["audio"] = "audio";
10
+ MediaItemType["document"] = "document";
11
+ MediaItemType["zip"] = "zip";
12
+ })(MediaItemType = exports.MediaItemType || (exports.MediaItemType = {}));
13
+ var SortOrder;
14
+ (function (SortOrder) {
15
+ SortOrder["ASC"] = "ASC";
16
+ SortOrder["DESC"] = "DESC";
17
+ })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
18
+ //# sourceMappingURL=stores-poc-v1-collection.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stores-poc-v1-collection.types.js","sourceRoot":"","sources":["../../../src/stores-poc-v1-collection.types.ts"],"names":[],"mappings":";;;AAqEA,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,4EAA2D,CAAA;IAC3D,gCAAe,CAAA;IACf,gCAAe,CAAA;IACf,gCAAe,CAAA;IACf,sCAAqB,CAAA;IACrB,4BAAW,CAAA;AACb,CAAC,EAPW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAOxB;AAuDD,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGpB"}
@@ -0,0 +1,210 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ export interface Collection {
8
+ /**
9
+ * Collection ID (generated automatically by the catalog)
10
+ * @readonly
11
+ */
12
+ _id?: string | null;
13
+ /** Collection name */
14
+ name?: string | null;
15
+ /**
16
+ * Media items (images, videos etc) associated with this collection. Read only.
17
+ * @readonly
18
+ */
19
+ media?: Media;
20
+ /**
21
+ * Number of products in the collection. Read only.
22
+ * @readonly
23
+ */
24
+ numberOfProducts?: number;
25
+ /** Collection description. The description length without HTML must not exceed 2000 characters (10K includes HTML) */
26
+ description?: string | null;
27
+ /** Collection slug */
28
+ slug?: string | null;
29
+ /** Collection visibility. Only impacts dynamic pages, no impact on static pages */
30
+ visible?: boolean | null;
31
+ }
32
+ export interface Media {
33
+ /** Primary media (image, video etc) associated with this product. */
34
+ mainMedia?: MediaItem;
35
+ /** Media (images, videos etc) associated with this product. */
36
+ items?: MediaItem[];
37
+ }
38
+ export interface MediaItem extends MediaItemItemOneOf {
39
+ /** Media item thumbnail details. */
40
+ thumbnail?: MediaItemUrlAndSize;
41
+ /** Media item type (image, video, etc.). */
42
+ mediaType?: MediaItemType;
43
+ /** Media item title. */
44
+ title?: string;
45
+ /** Media ID (for example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`). */
46
+ _id?: string;
47
+ /** Image data (URL, size). */
48
+ image?: MediaItemUrlAndSize;
49
+ /** Video data (URL, size). */
50
+ video?: MediaItemVideo;
51
+ }
52
+ /** @oneof */
53
+ export interface MediaItemItemOneOf {
54
+ /** Image data (URL, size). */
55
+ image?: MediaItemUrlAndSize;
56
+ /** Video data (URL, size). */
57
+ video?: MediaItemVideo;
58
+ }
59
+ export interface MediaItemUrlAndSize {
60
+ /** Media item URL. */
61
+ url?: string;
62
+ /** Media item width. */
63
+ width?: number;
64
+ /** Media item height. */
65
+ height?: number;
66
+ /** Media format (mp4, png, etc.). */
67
+ format?: string | null;
68
+ /** Alt text. This text will be shown in case the image is not available. */
69
+ altText?: string | null;
70
+ }
71
+ export declare enum MediaItemType {
72
+ unspecified_media_item_type = "unspecified_media_item_type",
73
+ image = "image",
74
+ video = "video",
75
+ audio = "audio",
76
+ document = "document",
77
+ zip = "zip"
78
+ }
79
+ export interface MediaItemVideo {
80
+ /** Data (URL, size) about each resolution for which this video is available. */
81
+ files?: MediaItemUrlAndSize[];
82
+ /** ID of an image taken from the video. Used primarily for Wix Search indexing. For example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`. */
83
+ stillFrameMediaId?: string;
84
+ }
85
+ export interface GetCollectionRequest {
86
+ /** Requested collection ID. */
87
+ collectionId: string;
88
+ /**
89
+ * Whether to return the `collection.numberOfProducts` field in the response.
90
+ * Defaults to false, in which case the value of `collection.numberOfProducts` will be 0.
91
+ */
92
+ includeNumberOfProducts?: boolean;
93
+ /** Include description in response. When False, description will be null */
94
+ includeDescription?: boolean;
95
+ }
96
+ export interface GetCollectionResponse {
97
+ collection?: Collection;
98
+ }
99
+ export interface QueryCollectionsRequest {
100
+ query?: PlatformQuery;
101
+ /** Whether number of products should be included in the response. */
102
+ includeNumberOfProducts?: boolean;
103
+ /** Include description in response. When False, description will be null */
104
+ includeDescription?: boolean;
105
+ }
106
+ export interface PlatformQuery extends PlatformQueryPagingMethodOneOf {
107
+ /** Filter object. */
108
+ filter?: Record<string, any> | null;
109
+ /** Sorting options. For example, `[{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]`. */
110
+ sort?: Sorting[];
111
+ /** Pointer to page of results using offset. Cannot be used together with `cursorPaging`. */
112
+ paging?: PlatformPaging;
113
+ }
114
+ /** @oneof */
115
+ export interface PlatformQueryPagingMethodOneOf {
116
+ /** Pointer to page of results using offset. Cannot be used together with `cursorPaging`. */
117
+ paging?: PlatformPaging;
118
+ }
119
+ export interface Sorting {
120
+ /** Name of the field to sort by. */
121
+ fieldName?: string;
122
+ /** Sort order. */
123
+ order?: SortOrder;
124
+ }
125
+ export declare enum SortOrder {
126
+ ASC = "ASC",
127
+ DESC = "DESC"
128
+ }
129
+ export interface PlatformPaging {
130
+ /** Number of items to load. */
131
+ limit?: number | null;
132
+ /** Number of items to skip in the current sort order. */
133
+ offset?: number | null;
134
+ }
135
+ export interface QueryCollectionsResponse {
136
+ collections?: Collection[];
137
+ metadata?: PlatformPagingMetadata;
138
+ }
139
+ export interface PlatformPagingMetadata {
140
+ /** The number of items returned in this response. */
141
+ count?: number | null;
142
+ /** The offset which was requested. Returned if offset paging was used. */
143
+ offset?: number | null;
144
+ /** The total number of items that match the query. Returned if offset paging was used. */
145
+ total?: number | null;
146
+ /** Cursors to navigate through result pages. Returned if cursor paging was used. */
147
+ cursors?: Cursors;
148
+ }
149
+ export interface Cursors {
150
+ /** Cursor pointing to next page in the list of results. */
151
+ next?: string | null;
152
+ /** Cursor pointing to previous page in the list of results. */
153
+ prev?: string | null;
154
+ }
155
+ /** @param collectionId - Requested collection ID.
156
+ * @public
157
+ * @requiredField collectionId
158
+ */
159
+ export declare function getCollection(collectionId: string, options?: GetCollectionOptions): Promise<Collection>;
160
+ export interface GetCollectionOptions {
161
+ /**
162
+ * Whether to return the `collection.numberOfProducts` field in the response.
163
+ * Defaults to false, in which case the value of `collection.numberOfProducts` will be 0.
164
+ */
165
+ includeNumberOfProducts?: boolean;
166
+ /** Include description in response. When False, description will be null */
167
+ includeDescription?: boolean;
168
+ }
169
+ /** @public */
170
+ export declare function queryCollections(): CollectionsQueryBuilder;
171
+ interface QueryCursorResult {
172
+ hasNext: () => boolean;
173
+ hasPrev: () => boolean;
174
+ length: number;
175
+ pageSize: number;
176
+ }
177
+ export interface CollectionsQueryResult extends QueryCursorResult {
178
+ items: Collection[];
179
+ query: CollectionsQueryBuilder;
180
+ next: () => Promise<CollectionsQueryResult>;
181
+ prev: () => Promise<CollectionsQueryResult>;
182
+ }
183
+ export interface CollectionsQueryBuilder {
184
+ /** @param propertyName - Property whose value is compared with `value`.
185
+ * @param value - Value to compare against.
186
+ */
187
+ eq: (propertyName: string, value: any) => CollectionsQueryBuilder;
188
+ /** @param propertyName - Property whose value is compared with `value`.
189
+ * @param value - Value to compare against.
190
+ */
191
+ ne: (propertyName: string, value: any) => CollectionsQueryBuilder;
192
+ /** @param propertyName - Property whose value is compared with `string`.
193
+ * @param string - String to compare against. Case-insensitive.
194
+ */
195
+ startsWith: (propertyName: string, value: string) => CollectionsQueryBuilder;
196
+ /** @param propertyName - Property whose value is compared with `values`.
197
+ * @param values - List of values to compare against.
198
+ */
199
+ hasSome: (propertyName: string, value: any[]) => CollectionsQueryBuilder;
200
+ in: (propertyName: string, value: any) => CollectionsQueryBuilder;
201
+ exists: (propertyName: string, value: boolean) => CollectionsQueryBuilder;
202
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
203
+ ascending: (...propertyNames: string[]) => CollectionsQueryBuilder;
204
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */
205
+ descending: (...propertyNames: string[]) => CollectionsQueryBuilder;
206
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */
207
+ limit: (limit: number) => CollectionsQueryBuilder;
208
+ find: () => Promise<CollectionsQueryResult>;
209
+ }
210
+ export {};
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.queryCollections = exports.getCollection = exports.SortOrder = exports.MediaItemType = exports.__debug = void 0;
32
+ const velo_1 = require("@wix/metro-runtime/velo");
33
+ const ambassadorWixStoresPocV1Collection = __importStar(require("./stores-poc-v1-collection.http"));
34
+ // @ts-ignore
35
+ const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper");
36
+ let __verbose = false;
37
+ function __log(...args) {
38
+ __verbose && console.log(...args);
39
+ }
40
+ function __inspect(obj) {
41
+ return obj;
42
+ }
43
+ exports.__debug = {
44
+ verboseLogging: {
45
+ on: () => (__verbose = true),
46
+ off: () => (__verbose = false),
47
+ },
48
+ };
49
+ const _toVeloEntity = '$';
50
+ const _fromVeloEntity = '$';
51
+ var MediaItemType;
52
+ (function (MediaItemType) {
53
+ MediaItemType["unspecified_media_item_type"] = "unspecified_media_item_type";
54
+ MediaItemType["image"] = "image";
55
+ MediaItemType["video"] = "video";
56
+ MediaItemType["audio"] = "audio";
57
+ MediaItemType["document"] = "document";
58
+ MediaItemType["zip"] = "zip";
59
+ })(MediaItemType = exports.MediaItemType || (exports.MediaItemType = {}));
60
+ var SortOrder;
61
+ (function (SortOrder) {
62
+ SortOrder["ASC"] = "ASC";
63
+ SortOrder["DESC"] = "DESC";
64
+ })(SortOrder = exports.SortOrder || (exports.SortOrder = {}));
65
+ const _getCollectionRequest = {};
66
+ const _getCollectionResponse = {};
67
+ const _queryCollectionsRequest = {};
68
+ const _queryCollectionsResponse = {};
69
+ /** @param collectionId - Requested collection ID.
70
+ * @public
71
+ * @requiredField collectionId
72
+ */
73
+ function getCollection(collectionId, options) {
74
+ return __awaiter(this, arguments, void 0, function* () {
75
+ const requestTransformation = {
76
+ collectionId: '$[0]',
77
+ includeNumberOfProducts: '$[1].includeNumberOfProducts',
78
+ includeDescription: '$[1].includeDescription',
79
+ };
80
+ const responseTransformation = '$.collection';
81
+ // @ts-ignore
82
+ const httpClient = arguments[2].httpClient;
83
+ const { toAmbassadorRequest } = velo_1.serializer({
84
+ rootSchema: _getCollectionRequest,
85
+ depSchemas: {},
86
+ fqdnTransformation: {
87
+ paths: [],
88
+ transformation: _fromVeloEntity,
89
+ },
90
+ customTransformation: requestTransformation,
91
+ });
92
+ const { fromJSON } = velo_1.serializer({
93
+ rootSchema: _getCollectionResponse,
94
+ depSchemas: {},
95
+ fqdnTransformation: {
96
+ paths: [...['collection']],
97
+ transformation: _toVeloEntity,
98
+ },
99
+ customTransformation: responseTransformation,
100
+ });
101
+ const payload = toAmbassadorRequest([collectionId, options]);
102
+ const reqOpts = ambassadorWixStoresPocV1Collection.getCollection(payload);
103
+ __log(`"GetCollection" sending request with: ${__inspect(reqOpts)}`);
104
+ try {
105
+ const { data } = yield httpClient.request(reqOpts);
106
+ return fromJSON(data);
107
+ }
108
+ catch (err) {
109
+ const transformedError = velo_1.transformError(err, requestTransformation, [
110
+ 'collectionId',
111
+ 'options',
112
+ ]);
113
+ throw transformedError;
114
+ }
115
+ });
116
+ }
117
+ exports.getCollection = getCollection;
118
+ /** @public */
119
+ function queryCollections() {
120
+ const requestTransformation = { '*': '$[1]', query: '$[0]' };
121
+ const responseTransformation = {
122
+ items: '$.collections',
123
+ pagingMetadata: '$.metadata',
124
+ };
125
+ // @ts-ignore
126
+ const httpClient = arguments[0].httpClient;
127
+ const { toAmbassadorRequest } = velo_1.serializer({
128
+ rootSchema: _queryCollectionsRequest,
129
+ depSchemas: {},
130
+ fqdnTransformation: {
131
+ paths: [],
132
+ transformation: _fromVeloEntity,
133
+ },
134
+ customTransformation: requestTransformation,
135
+ });
136
+ const { fromJSON } = velo_1.serializer({
137
+ rootSchema: _queryCollectionsResponse,
138
+ depSchemas: {},
139
+ fqdnTransformation: {
140
+ paths: [...['Array#collections']],
141
+ transformation: _toVeloEntity,
142
+ },
143
+ customTransformation: responseTransformation,
144
+ });
145
+ return motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder({
146
+ func: (payload) => {
147
+ const reqOpts = ambassadorWixStoresPocV1Collection.queryCollections(payload);
148
+ return httpClient.request(reqOpts);
149
+ },
150
+ requestTransformer: (...args) => toAmbassadorRequest(args),
151
+ responseTransformer: ({ data }) => fromJSON(data),
152
+ errorTransformer: (err) => {
153
+ const transformedError = velo_1.transformError(err, requestTransformation);
154
+ throw transformedError;
155
+ },
156
+ pagingMethod: 'CURSOR',
157
+ transformationPaths: velo_1.resolveQueryFieldsTransformationPaths(_toVeloEntity),
158
+ })({ cursorWithEmptyFilterAndSort: true });
159
+ }
160
+ exports.queryCollections = queryCollections;
161
+ //# sourceMappingURL=stores-poc-v1-collection.universal.js.map