@merchi/sdk 1.42.36 → 1.42.37
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.
- package/dist/entities/product.d.ts +2 -0
- package/dist/entities/product.js +4 -0
- package/dist/entities/product_preview_model.d.ts +14 -0
- package/dist/entities/product_preview_model.js +56 -0
- package/dist/entities/product_preview_model.test.d.ts +1 -0
- package/dist/entities/product_preview_model.test.js +8 -0
- package/dist/entities/product_preview_surface.d.ts +14 -0
- package/dist/entities/product_preview_surface.js +60 -0
- package/dist/merchi.d.ts +4 -0
- package/dist/merchi.js +4 -0
- package/package.json +1 -1
- package/src/entities/product.ts +4 -0
- package/src/entities/product_preview_model.test.ts +9 -0
- package/src/entities/product_preview_model.ts +25 -0
- package/src/entities/product_preview_surface.ts +27 -0
- package/src/merchi.ts +10 -0
|
@@ -8,6 +8,7 @@ import { Domain } from './domain.js';
|
|
|
8
8
|
import { DomainTag } from './domain_tag.js';
|
|
9
9
|
import { DraftPreview } from './draft_preview.js';
|
|
10
10
|
import { DraftTemplate } from './draft_template.js';
|
|
11
|
+
import { ProductPreviewModel } from './product_preview_model.js';
|
|
11
12
|
import { Entity } from '../entity.js';
|
|
12
13
|
import { MerchiFile } from './file.js';
|
|
13
14
|
import { Reminder } from './reminder.js';
|
|
@@ -137,6 +138,7 @@ export declare class Product extends Entity {
|
|
|
137
138
|
suppliers?: User[];
|
|
138
139
|
draftTemplates?: DraftTemplate[];
|
|
139
140
|
draftPreviews?: DraftPreview[];
|
|
141
|
+
previewModels?: ProductPreviewModel[];
|
|
140
142
|
duplicate: () => Promise<Product>;
|
|
141
143
|
primaryImage: () => MerchiFile | null;
|
|
142
144
|
hasGroupVariationFields: () => boolean;
|
package/dist/entities/product.js
CHANGED
|
@@ -626,6 +626,10 @@ var Product = /** @class */ (function (_super) {
|
|
|
626
626
|
Product.property({ arrayType: 'DraftPreview' }),
|
|
627
627
|
__metadata("design:type", Array)
|
|
628
628
|
], Product.prototype, "draftPreviews", void 0);
|
|
629
|
+
__decorate([
|
|
630
|
+
Product.property({ arrayType: 'ProductPreviewModel' }),
|
|
631
|
+
__metadata("design:type", Array)
|
|
632
|
+
], Product.prototype, "previewModels", void 0);
|
|
629
633
|
return Product;
|
|
630
634
|
}(Entity));
|
|
631
635
|
export { Product };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Entity } from '../entity.js';
|
|
2
|
+
import type { MerchiFile } from './file.js';
|
|
3
|
+
import type { Product } from './product.js';
|
|
4
|
+
import type { ProductPreviewSurface } from './product_preview_surface.js';
|
|
5
|
+
export declare class ProductPreviewModel extends Entity {
|
|
6
|
+
protected static resourceName: string;
|
|
7
|
+
protected static singularName: string;
|
|
8
|
+
protected static pluralName: string;
|
|
9
|
+
id?: number;
|
|
10
|
+
name?: string | null;
|
|
11
|
+
file?: MerchiFile;
|
|
12
|
+
product?: Product;
|
|
13
|
+
previewSurfaces?: ProductPreviewSurface[];
|
|
14
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
import { Entity } from '../entity.js';
|
|
26
|
+
var ProductPreviewModel = /** @class */ (function (_super) {
|
|
27
|
+
__extends(ProductPreviewModel, _super);
|
|
28
|
+
function ProductPreviewModel() {
|
|
29
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
}
|
|
31
|
+
ProductPreviewModel.resourceName = 'product_preview_models';
|
|
32
|
+
ProductPreviewModel.singularName = 'productPreviewModel';
|
|
33
|
+
ProductPreviewModel.pluralName = 'previewModels';
|
|
34
|
+
__decorate([
|
|
35
|
+
ProductPreviewModel.property(),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], ProductPreviewModel.prototype, "id", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
ProductPreviewModel.property({ type: String }),
|
|
40
|
+
__metadata("design:type", Object)
|
|
41
|
+
], ProductPreviewModel.prototype, "name", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
ProductPreviewModel.property({ type: 'MerchiFile' }),
|
|
44
|
+
__metadata("design:type", Function)
|
|
45
|
+
], ProductPreviewModel.prototype, "file", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
ProductPreviewModel.property({ type: 'Product' }),
|
|
48
|
+
__metadata("design:type", Function)
|
|
49
|
+
], ProductPreviewModel.prototype, "product", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
ProductPreviewModel.property({ arrayType: 'ProductPreviewSurface' }),
|
|
52
|
+
__metadata("design:type", Array)
|
|
53
|
+
], ProductPreviewModel.prototype, "previewSurfaces", void 0);
|
|
54
|
+
return ProductPreviewModel;
|
|
55
|
+
}(Entity));
|
|
56
|
+
export { ProductPreviewModel };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Merchi } from '../merchi.js';
|
|
2
|
+
test('can make ProductPreviewModel', function () {
|
|
3
|
+
var merchi = new Merchi();
|
|
4
|
+
var model = new merchi.ProductPreviewModel();
|
|
5
|
+
expect(model).toBeTruthy();
|
|
6
|
+
var surface = new merchi.ProductPreviewSurface();
|
|
7
|
+
expect(surface).toBeTruthy();
|
|
8
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DraftTemplate } from './draft_template.js';
|
|
2
|
+
import { Entity } from '../entity.js';
|
|
3
|
+
import type { ProductPreviewModel } from './product_preview_model.js';
|
|
4
|
+
export declare class ProductPreviewSurface extends Entity {
|
|
5
|
+
protected static resourceName: string;
|
|
6
|
+
protected static singularName: string;
|
|
7
|
+
protected static pluralName: string;
|
|
8
|
+
id?: number;
|
|
9
|
+
materialName?: string;
|
|
10
|
+
role?: string;
|
|
11
|
+
regionIndex?: number;
|
|
12
|
+
previewModel?: ProductPreviewModel;
|
|
13
|
+
draftTemplate?: DraftTemplate | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
17
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
18
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
19
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21
|
+
};
|
|
22
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
23
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
24
|
+
};
|
|
25
|
+
import { Entity } from '../entity.js';
|
|
26
|
+
var ProductPreviewSurface = /** @class */ (function (_super) {
|
|
27
|
+
__extends(ProductPreviewSurface, _super);
|
|
28
|
+
function ProductPreviewSurface() {
|
|
29
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
}
|
|
31
|
+
ProductPreviewSurface.resourceName = 'product_preview_surfaces';
|
|
32
|
+
ProductPreviewSurface.singularName = 'productPreviewSurface';
|
|
33
|
+
ProductPreviewSurface.pluralName = 'previewSurfaces';
|
|
34
|
+
__decorate([
|
|
35
|
+
ProductPreviewSurface.property(),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], ProductPreviewSurface.prototype, "id", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
ProductPreviewSurface.property({ type: String }),
|
|
40
|
+
__metadata("design:type", String)
|
|
41
|
+
], ProductPreviewSurface.prototype, "materialName", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
ProductPreviewSurface.property({ type: String }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], ProductPreviewSurface.prototype, "role", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
ProductPreviewSurface.property({ type: Number }),
|
|
48
|
+
__metadata("design:type", Number)
|
|
49
|
+
], ProductPreviewSurface.prototype, "regionIndex", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
ProductPreviewSurface.property({ type: 'ProductPreviewModel' }),
|
|
52
|
+
__metadata("design:type", Function)
|
|
53
|
+
], ProductPreviewSurface.prototype, "previewModel", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
ProductPreviewSurface.property({ type: 'DraftTemplate' }),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], ProductPreviewSurface.prototype, "draftTemplate", void 0);
|
|
58
|
+
return ProductPreviewSurface;
|
|
59
|
+
}(Entity));
|
|
60
|
+
export { ProductPreviewSurface };
|
package/dist/merchi.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ import { Draft } from './entities/draft.js';
|
|
|
50
50
|
import { DraftPreview } from './entities/draft_preview.js';
|
|
51
51
|
import { DraftPreviewLayer } from './entities/draft_preview_layer.js';
|
|
52
52
|
import { DraftTemplate } from './entities/draft_template.js';
|
|
53
|
+
import { ProductPreviewModel } from './entities/product_preview_model.js';
|
|
54
|
+
import { ProductPreviewSurface } from './entities/product_preview_surface.js';
|
|
53
55
|
import { Discount } from './entities/discount.js';
|
|
54
56
|
import { DiscountGroup } from './entities/discount_group.js';
|
|
55
57
|
import { User } from './entities/user.js';
|
|
@@ -125,6 +127,8 @@ export declare class Merchi {
|
|
|
125
127
|
DraftPreview: typeof DraftPreview;
|
|
126
128
|
DraftPreviewLayer: typeof DraftPreviewLayer;
|
|
127
129
|
DraftTemplate: typeof DraftTemplate;
|
|
130
|
+
ProductPreviewModel: typeof ProductPreviewModel;
|
|
131
|
+
ProductPreviewSurface: typeof ProductPreviewSurface;
|
|
128
132
|
VariationFieldsOption: typeof VariationFieldsOption;
|
|
129
133
|
Category: typeof Category;
|
|
130
134
|
MerchiFile: typeof MerchiFile;
|
package/dist/merchi.js
CHANGED
|
@@ -60,6 +60,8 @@ import { Draft } from './entities/draft.js';
|
|
|
60
60
|
import { DraftPreview } from './entities/draft_preview.js';
|
|
61
61
|
import { DraftPreviewLayer } from './entities/draft_preview_layer.js';
|
|
62
62
|
import { DraftTemplate } from './entities/draft_template.js';
|
|
63
|
+
import { ProductPreviewModel } from './entities/product_preview_model.js';
|
|
64
|
+
import { ProductPreviewSurface } from './entities/product_preview_surface.js';
|
|
63
65
|
import { Discount } from './entities/discount.js';
|
|
64
66
|
import { DiscountGroup } from './entities/discount_group.js';
|
|
65
67
|
import { User } from './entities/user.js';
|
|
@@ -241,6 +243,8 @@ var Merchi = /** @class */ (function () {
|
|
|
241
243
|
this.DraftPreview = this.setupClass(DraftPreview);
|
|
242
244
|
this.DraftPreviewLayer = this.setupClass(DraftPreviewLayer);
|
|
243
245
|
this.DraftTemplate = this.setupClass(DraftTemplate);
|
|
246
|
+
this.ProductPreviewModel = this.setupClass(ProductPreviewModel);
|
|
247
|
+
this.ProductPreviewSurface = this.setupClass(ProductPreviewSurface);
|
|
244
248
|
this.VariationsGroup = this.setupClass(VariationsGroup);
|
|
245
249
|
this.EnrolledDomain = this.setupClass(EnrolledDomain);
|
|
246
250
|
this.CompanyInvitation = this.setupClass(CompanyInvitation);
|
package/package.json
CHANGED
package/src/entities/product.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Domain } from './domain.js';
|
|
|
9
9
|
import { DomainTag } from './domain_tag.js';
|
|
10
10
|
import { DraftPreview } from './draft_preview.js';
|
|
11
11
|
import { DraftTemplate } from './draft_template.js';
|
|
12
|
+
import { ProductPreviewModel } from './product_preview_model.js';
|
|
12
13
|
import { Entity } from '../entity.js';
|
|
13
14
|
import { MerchiFile } from './file.js';
|
|
14
15
|
import { Reminder } from './reminder.js';
|
|
@@ -368,6 +369,9 @@ export class Product extends Entity {
|
|
|
368
369
|
@Product.property({arrayType: 'DraftPreview'})
|
|
369
370
|
public draftPreviews?: DraftPreview[];
|
|
370
371
|
|
|
372
|
+
@Product.property({arrayType: 'ProductPreviewModel'})
|
|
373
|
+
public previewModels?: ProductPreviewModel[];
|
|
374
|
+
|
|
371
375
|
public duplicate = () => {
|
|
372
376
|
/* create a clone of this product on the backend, returning it. */
|
|
373
377
|
const constructor = this.constructor as typeof Product;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Merchi } from '../merchi.js';
|
|
2
|
+
|
|
3
|
+
test('can make ProductPreviewModel', () => {
|
|
4
|
+
const merchi = new Merchi();
|
|
5
|
+
const model = new merchi.ProductPreviewModel();
|
|
6
|
+
expect(model).toBeTruthy();
|
|
7
|
+
const surface = new merchi.ProductPreviewSurface();
|
|
8
|
+
expect(surface).toBeTruthy();
|
|
9
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Entity } from '../entity.js';
|
|
2
|
+
import type { MerchiFile } from './file.js';
|
|
3
|
+
import type { Product } from './product.js';
|
|
4
|
+
import type { ProductPreviewSurface } from './product_preview_surface.js';
|
|
5
|
+
|
|
6
|
+
export class ProductPreviewModel extends Entity {
|
|
7
|
+
protected static resourceName = 'product_preview_models';
|
|
8
|
+
protected static singularName = 'productPreviewModel';
|
|
9
|
+
protected static pluralName = 'previewModels';
|
|
10
|
+
|
|
11
|
+
@ProductPreviewModel.property()
|
|
12
|
+
public id?: number;
|
|
13
|
+
|
|
14
|
+
@ProductPreviewModel.property({type: String})
|
|
15
|
+
public name?: string | null;
|
|
16
|
+
|
|
17
|
+
@ProductPreviewModel.property({type: 'MerchiFile'})
|
|
18
|
+
public file?: MerchiFile;
|
|
19
|
+
|
|
20
|
+
@ProductPreviewModel.property({type: 'Product'})
|
|
21
|
+
public product?: Product;
|
|
22
|
+
|
|
23
|
+
@ProductPreviewModel.property({arrayType: 'ProductPreviewSurface'})
|
|
24
|
+
public previewSurfaces?: ProductPreviewSurface[];
|
|
25
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DraftTemplate } from './draft_template.js';
|
|
2
|
+
import { Entity } from '../entity.js';
|
|
3
|
+
import type { ProductPreviewModel } from './product_preview_model.js';
|
|
4
|
+
|
|
5
|
+
export class ProductPreviewSurface extends Entity {
|
|
6
|
+
protected static resourceName = 'product_preview_surfaces';
|
|
7
|
+
protected static singularName = 'productPreviewSurface';
|
|
8
|
+
protected static pluralName = 'previewSurfaces';
|
|
9
|
+
|
|
10
|
+
@ProductPreviewSurface.property()
|
|
11
|
+
public id?: number;
|
|
12
|
+
|
|
13
|
+
@ProductPreviewSurface.property({type: String})
|
|
14
|
+
public materialName?: string;
|
|
15
|
+
|
|
16
|
+
@ProductPreviewSurface.property({type: String})
|
|
17
|
+
public role?: string;
|
|
18
|
+
|
|
19
|
+
@ProductPreviewSurface.property({type: Number})
|
|
20
|
+
public regionIndex?: number;
|
|
21
|
+
|
|
22
|
+
@ProductPreviewSurface.property({type: 'ProductPreviewModel'})
|
|
23
|
+
public previewModel?: ProductPreviewModel;
|
|
24
|
+
|
|
25
|
+
@ProductPreviewSurface.property({type: 'DraftTemplate'})
|
|
26
|
+
public draftTemplate?: DraftTemplate | null;
|
|
27
|
+
}
|
package/src/merchi.ts
CHANGED
|
@@ -54,6 +54,8 @@ import { Draft } from './entities/draft.js';
|
|
|
54
54
|
import { DraftPreview } from './entities/draft_preview.js';
|
|
55
55
|
import { DraftPreviewLayer } from './entities/draft_preview_layer.js';
|
|
56
56
|
import { DraftTemplate } from './entities/draft_template.js';
|
|
57
|
+
import { ProductPreviewModel } from './entities/product_preview_model.js';
|
|
58
|
+
import { ProductPreviewSurface } from './entities/product_preview_surface.js';
|
|
57
59
|
import { Discount } from './entities/discount.js';
|
|
58
60
|
import { DiscountGroup } from './entities/discount_group.js';
|
|
59
61
|
import { User } from './entities/user.js';
|
|
@@ -150,6 +152,8 @@ export class Merchi {
|
|
|
150
152
|
public DraftPreview: typeof DraftPreview;
|
|
151
153
|
public DraftPreviewLayer: typeof DraftPreviewLayer;
|
|
152
154
|
public DraftTemplate: typeof DraftTemplate;
|
|
155
|
+
public ProductPreviewModel: typeof ProductPreviewModel;
|
|
156
|
+
public ProductPreviewSurface: typeof ProductPreviewSurface;
|
|
153
157
|
public VariationFieldsOption: typeof VariationFieldsOption;
|
|
154
158
|
public Category: typeof Category;
|
|
155
159
|
public MerchiFile: typeof MerchiFile;
|
|
@@ -310,6 +314,12 @@ export class Merchi {
|
|
|
310
314
|
this.DraftPreview = this.setupClass(DraftPreview) as typeof DraftPreview;
|
|
311
315
|
this.DraftPreviewLayer = this.setupClass(DraftPreviewLayer) as typeof DraftPreviewLayer;
|
|
312
316
|
this.DraftTemplate = this.setupClass(DraftTemplate) as typeof DraftTemplate;
|
|
317
|
+
this.ProductPreviewModel = this.setupClass(
|
|
318
|
+
ProductPreviewModel
|
|
319
|
+
) as typeof ProductPreviewModel;
|
|
320
|
+
this.ProductPreviewSurface = this.setupClass(
|
|
321
|
+
ProductPreviewSurface
|
|
322
|
+
) as typeof ProductPreviewSurface;
|
|
313
323
|
this.VariationsGroup = this.setupClass(
|
|
314
324
|
VariationsGroup
|
|
315
325
|
) as typeof VariationsGroup;
|