@ikas/api-client 0.0.1-canary.16 → 0.0.1-canary.17

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 +1,2 @@
1
1
  export * from './webhook-validate';
2
+ export * from './product-utils';
@@ -11,4 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./webhook-validate"), exports);
14
+ __exportStar(require("./product-utils"), exports);
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,kDAAgC"}
@@ -0,0 +1,2 @@
1
+ export declare function getImageSrc(size: 180 | 360 | 540 | 720 | 900 | 1080 | 1296 | 1512 | 1728 | 1950 | 2560 | 3840 | undefined, merchantId: string, imageId: string): string;
2
+ export declare function getBarcodeSkuText(barcodeList?: string[] | null, sku?: string | null): string | undefined;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBarcodeSkuText = exports.getImageSrc = void 0;
4
+ function getImageSrc(size, merchantId, imageId) {
5
+ if (size === void 0) { size = 180; }
6
+ return "".concat(process.env.REACT_APP_IMAGES_URL || process.env.NEXT_PUBLIC_IMAGES_URL || 'https://cdn.myikas.com/', "images/").concat(merchantId, "/").concat(imageId, "/image_").concat(size, ".webp");
7
+ }
8
+ exports.getImageSrc = getImageSrc;
9
+ function getBarcodeSkuText(barcodeList, sku) {
10
+ if ((barcodeList === null || barcodeList === void 0 ? void 0 : barcodeList.length) || sku)
11
+ return "".concat(barcodeList && barcodeList.length ? barcodeList[0] : '-', " / ").concat(sku || '-');
12
+ return;
13
+ }
14
+ exports.getBarcodeSkuText = getBarcodeSkuText;
15
+ //# sourceMappingURL=product-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-utils.js","sourceRoot":"","sources":["../../src/helpers/product-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CACzB,IAAwF,EACxF,UAAkB,EAClB,OAAe;IAFf,qBAAA,EAAA,UAAwF;IAIxF,OAAO,UACL,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,yBAAyB,oBAC3F,UAAU,cAAI,OAAO,oBAAU,IAAI,UAAO,CAAC;AACvD,CAAC;AARD,kCAQC;AAED,SAAgB,iBAAiB,CAAC,WAA6B,EAAE,GAAmB;IAClF,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,KAAI,GAAG;QAAE,OAAO,UAAG,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAM,GAAG,IAAI,GAAG,CAAE,CAAC;IACrH,OAAO;AACT,CAAC;AAHD,8CAGC"}
@@ -1 +1,2 @@
1
1
  export * from './webhook';
2
+ export * from './search-product';
@@ -11,4 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./webhook"), exports);
14
+ __exportStar(require("./search-product"), exports);
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,mDAAiC"}
@@ -0,0 +1 @@
1
+ export * from './models';
@@ -0,0 +1,14 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./models"), exports);
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/search-product/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB"}
@@ -0,0 +1,174 @@
1
+ export interface ISearchProduct {
2
+ id: string;
3
+ createdAt?: Date;
4
+ updatedAt?: Date;
5
+ deleted: boolean;
6
+ name: string;
7
+ description?: string | null;
8
+ weight?: number | null;
9
+ type: string;
10
+ productVariantTypes: ISearchProductVariantType[];
11
+ categories?: ISearchCategory[] | null;
12
+ variants: ISearchVariant[];
13
+ attributes?: ISearchProductAttributeValue[] | null;
14
+ tags?: ISearchProductTag[] | null;
15
+ brand?: ISearchProductBrand | null;
16
+ metaData?: ISearchHTMLMetaData | null;
17
+ salesChannelIds?: string[] | null;
18
+ shortDescription?: string | null;
19
+ }
20
+ interface ISearchVariantType {
21
+ id: string;
22
+ name: string;
23
+ selectionType: string;
24
+ values: ISearchVariantValue[];
25
+ }
26
+ interface ISearchProductVariantType {
27
+ order: number;
28
+ variantType: ISearchVariantType;
29
+ variantValueIds: string[];
30
+ }
31
+ interface ISearchVariant {
32
+ id: string;
33
+ deleted: boolean;
34
+ sku?: string | null;
35
+ barcodeList?: string[] | null;
36
+ weight?: number | null;
37
+ isActive: boolean;
38
+ variantValues?: ISearchVariationValueRelation[] | null;
39
+ attributes?: ISearchProductAttributeValue[] | null;
40
+ images?: ISearchProductImage[] | null;
41
+ prices?: ISearchProductPrice[];
42
+ stocks: ISearchProductStockLocation[];
43
+ }
44
+ interface ISearchProductPrice {
45
+ sellPrice: number;
46
+ discountPrice: number | null;
47
+ buyPrice: number | null;
48
+ currency: string | null;
49
+ priceListId?: string | null;
50
+ }
51
+ interface ISearchProductImage {
52
+ order: number;
53
+ isMain: boolean;
54
+ id: string;
55
+ }
56
+ interface ISearchVariationValueRelation {
57
+ variantTypeId: string;
58
+ variantValueId: string;
59
+ }
60
+ interface ISearchVariantValue {
61
+ id: string;
62
+ name: string;
63
+ thumbnailImageId?: string | null;
64
+ colorCode?: string;
65
+ }
66
+ interface ISearchProductAttributeOption {
67
+ id: string;
68
+ name: string;
69
+ }
70
+ export interface ISearchProductAttributeTableCellData {
71
+ id: string;
72
+ name: string;
73
+ }
74
+ export interface ISearchProductAttributeTableTemplate {
75
+ columns: ISearchProductAttributeTableCellData[];
76
+ rows: ISearchProductAttributeTableCellData[];
77
+ }
78
+ interface ISearchProductAttribute {
79
+ id: string;
80
+ name: string;
81
+ type: string;
82
+ tableTemplate?: ISearchProductAttributeTableTemplate | null;
83
+ }
84
+ interface ISearchProductAttributeValue {
85
+ value?: string | number | Date | boolean | null;
86
+ productAttribute?: ISearchProductAttribute | null;
87
+ productAttributeOption?: ISearchProductAttributeOption | null;
88
+ }
89
+ interface ISearchHTMLMetaData {
90
+ slug: string;
91
+ pageTitle?: string | null;
92
+ description?: string | null;
93
+ redirectTo?: string | null;
94
+ metadataOverrides?: ISearchHTMLMetaDataOverride[] | null;
95
+ }
96
+ interface ISearchHTMLMetaDataOverride {
97
+ pageTitle: string;
98
+ description: string;
99
+ language?: string | null;
100
+ storefrontId?: string | null;
101
+ storefrontRegionId?: string | null;
102
+ }
103
+ interface ISearchCategoryPath {
104
+ id: string;
105
+ name: string;
106
+ slug?: string | null;
107
+ }
108
+ interface ISearchCategory {
109
+ id: string;
110
+ name: string;
111
+ path: ISearchCategoryPath[];
112
+ slug?: string | null;
113
+ }
114
+ interface ISearchProductTag {
115
+ id: string;
116
+ name: string;
117
+ }
118
+ interface ISearchProductBrand {
119
+ id: string;
120
+ name: string;
121
+ slug?: string | null;
122
+ }
123
+ export interface ISearchProductStockLocation {
124
+ stockCount: number;
125
+ stockLocationId: string;
126
+ }
127
+ export interface IVariantVariantValues {
128
+ order: number;
129
+ variantTypeId: string;
130
+ variantValueId: string;
131
+ variantTypeName: string;
132
+ variantValueName: string;
133
+ }
134
+ export declare class SearchVariant implements ISearchVariant {
135
+ id: string;
136
+ deleted: boolean;
137
+ sku?: string | null;
138
+ barcodeList?: string[] | null;
139
+ weight?: number | null;
140
+ isActive: boolean;
141
+ variantValues?: ISearchVariationValueRelation[] | null;
142
+ attributes?: ISearchProductAttributeValue[] | null;
143
+ images?: ISearchProductImage[] | null;
144
+ prices?: ISearchProductPrice[];
145
+ stocks: ISearchProductStockLocation[];
146
+ productVariantTypes: ISearchProductVariantType[];
147
+ merchantId: string;
148
+ constructor(data: ISearchVariant, productVariantTypes: ISearchProductVariantType[], merchantId: string);
149
+ get $variantValues(): IVariantVariantValues[];
150
+ get barcodeSkuText(): string | undefined;
151
+ getImageSrcList(size?: 180 | 360 | 540 | 720 | 900 | 1080 | 1296 | 1512 | 1728 | 1950 | 2560 | 3840): string[] | undefined;
152
+ }
153
+ export declare class SearchProduct implements ISearchProduct {
154
+ id: string;
155
+ createdAt?: Date;
156
+ updatedAt?: Date;
157
+ deleted: boolean;
158
+ name: string;
159
+ description?: string | null;
160
+ weight?: number | null;
161
+ type: string;
162
+ productVariantTypes: ISearchProductVariantType[];
163
+ categories?: ISearchCategory[] | null;
164
+ variants: SearchVariant[];
165
+ attributes?: ISearchProductAttributeValue[] | null;
166
+ tags?: ISearchProductTag[] | null;
167
+ brand?: ISearchProductBrand | null;
168
+ metaData?: ISearchHTMLMetaData | null;
169
+ salesChannelIds?: string[] | null;
170
+ shortDescription?: string | null;
171
+ merchantId: string;
172
+ constructor(data: ISearchProduct, merchantId: string);
173
+ }
174
+ export {};
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchProduct = exports.SearchVariant = void 0;
4
+ var product_utils_1 = require("../../helpers/product-utils");
5
+ var SearchVariant = /** @class */ (function () {
6
+ function SearchVariant(data, productVariantTypes, merchantId) {
7
+ this.id = data.id;
8
+ this.deleted = data.deleted;
9
+ this.sku = data.sku;
10
+ this.barcodeList = data.barcodeList;
11
+ this.weight = data.weight;
12
+ this.isActive = data.isActive;
13
+ this.variantValues = data.variantValues;
14
+ this.attributes = data.attributes;
15
+ this.images = data.images;
16
+ this.prices = data.prices;
17
+ this.stocks = data.stocks;
18
+ this.productVariantTypes = productVariantTypes;
19
+ this.merchantId = merchantId;
20
+ }
21
+ Object.defineProperty(SearchVariant.prototype, "$variantValues", {
22
+ get: function () {
23
+ var _this = this;
24
+ return this.productVariantTypes
25
+ .map(function (pvt) {
26
+ var _a;
27
+ var vv = (_a = _this.variantValues) === null || _a === void 0 ? void 0 : _a.find(function (vv) { return vv.variantTypeId == pvt.variantType.id; });
28
+ if (vv) {
29
+ var foundVariantValue = pvt.variantType.values.find(function (v) { return vv.variantValueId == v.id; });
30
+ if (foundVariantValue) {
31
+ return {
32
+ order: pvt.order,
33
+ variantTypeId: pvt.variantType.id,
34
+ variantValueId: foundVariantValue.id,
35
+ variantTypeName: pvt.variantType.name,
36
+ variantValueName: foundVariantValue.name,
37
+ };
38
+ }
39
+ }
40
+ return undefined;
41
+ })
42
+ .filter(function (o) { return !!o; });
43
+ },
44
+ enumerable: false,
45
+ configurable: true
46
+ });
47
+ Object.defineProperty(SearchVariant.prototype, "barcodeSkuText", {
48
+ get: function () {
49
+ return (0, product_utils_1.getBarcodeSkuText)(this.barcodeList, this.sku);
50
+ },
51
+ enumerable: false,
52
+ configurable: true
53
+ });
54
+ SearchVariant.prototype.getImageSrcList = function (size) {
55
+ var _this = this;
56
+ var _a;
57
+ if (size === void 0) { size = 180; }
58
+ return (_a = this.images) === null || _a === void 0 ? void 0 : _a.map(function (i) { return (0, product_utils_1.getImageSrc)(size, _this.merchantId, i.id); });
59
+ };
60
+ return SearchVariant;
61
+ }());
62
+ exports.SearchVariant = SearchVariant;
63
+ var SearchProduct = /** @class */ (function () {
64
+ function SearchProduct(data, merchantId) {
65
+ var _this = this;
66
+ this.id = data.id;
67
+ this.createdAt = data.createdAt;
68
+ this.updatedAt = data.updatedAt;
69
+ this.deleted = data.deleted;
70
+ this.name = data.name;
71
+ this.description = data.description;
72
+ this.weight = data.weight;
73
+ this.type = data.type;
74
+ this.productVariantTypes = data.productVariantTypes;
75
+ this.categories = data.categories;
76
+ this.variants = data.variants.map(function (v) { return new SearchVariant(v, _this.productVariantTypes, merchantId); });
77
+ this.attributes = data.attributes;
78
+ this.tags = data.tags;
79
+ this.brand = data.brand;
80
+ this.metaData = data.metaData;
81
+ this.salesChannelIds = data.salesChannelIds;
82
+ this.merchantId = merchantId;
83
+ }
84
+ return SearchProduct;
85
+ }());
86
+ exports.SearchProduct = SearchProduct;
87
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/models/search-product/models.ts"],"names":[],"mappings":";;;AAAA,6DAA2E;AAsK3E;IAeE,uBAAY,IAAoB,EAAE,mBAAgD,EAAE,UAAkB;QACpG,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC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C,EAAE,KAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EAA1D,CAA0D,CAAC,CAAC;QACrG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IACH,oBAAC;AAAD,CAAC,AAvCD,IAuCC;AAvCY,sCAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/api-client",
3
- "version": "0.0.1-canary.16",
3
+ "version": "0.0.1-canary.17",
4
4
  "description": "ikas public node api client for store apps and private apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",