merchi_sdk_js 0.0.55 → 0.0.57

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_js",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "type": "module",
5
5
  "main": "src/merchi.js",
6
6
  "module": "src/merchi.js",
@@ -2,7 +2,7 @@ import { addPropertyTo, serialise, create, enumerateFiles,
2
2
  fromJson } from './model.js';
3
3
  import { MerchiFile } from './merchi_file.js';
4
4
  import { Product } from './product.js';
5
- import { DraftTemplate } from './draft_template.js';
5
+ import { DraftPreviewLayer } from './draft_preview_layer.js';
6
6
 
7
7
  export function DraftPreview() {
8
8
  this.resource = '/draft_previews';
@@ -16,7 +16,7 @@ export function DraftPreview() {
16
16
  addPropertyTo(this, 'date');
17
17
  addPropertyTo(this, 'height');
18
18
  addPropertyTo(this, 'width');
19
- addPropertyTo(this, 'draftTemplates', DraftTemplate);
19
+ addPropertyTo(this, 'draftPreviewLayers', DraftPreviewLayer);
20
20
 
21
21
  this.create = function (options) {
22
22
  var data = serialise(this),
@@ -0,0 +1,29 @@
1
+ import { addPropertyTo, serialise, create, enumerateFiles,
2
+ fromJson } from './model.js';
3
+ import { DraftPreview } from './draft_preview.js';
4
+ import { DraftTemplate } from './draft_template.js';
5
+
6
+ export function DraftPreviewLayer() {
7
+ this.resource = '/draft_previews';
8
+ this.json = 'draftPreview';
9
+
10
+ addPropertyTo(this, 'id');
11
+ addPropertyTo(this, 'layerName');
12
+ addPropertyTo(this, 'draftPreview', DraftPreview);
13
+ addPropertyTo(this, 'draftTemplate', DraftTemplate);
14
+
15
+ this.create = function (options) {
16
+ var data = serialise(this),
17
+ self = this;
18
+ function handleResponse(result) {
19
+ options.success(fromJson(self, result[self.json]));
20
+ }
21
+ create({resource: this.resource,
22
+ parameters: data[0],
23
+ files: enumerateFiles(data[1]),
24
+ success: handleResponse,
25
+ as_domain: options.as_domain,
26
+ error: options.error,
27
+ embed: options.embed});
28
+ };
29
+ }
@@ -5,6 +5,7 @@ import { Product } from './product.js';
5
5
  import { MerchiFile } from './merchi_file.js';
6
6
  import { VariationFieldsOption } from './variation_fields_option.js';
7
7
  import { VariationField } from './variation_field.js';
8
+ import { DraftPreviewLayer } from './draft_preview_layer.js';
8
9
 
9
10
  export function DraftTemplate() {
10
11
  this.resource = '/draft_comments';
@@ -19,10 +20,10 @@ export function DraftTemplate() {
19
20
  addPropertyTo(this, 'editedByVariationFields', VariationField);
20
21
  addPropertyTo(this, 'date');
21
22
  addPropertyTo(this, 'name');
22
- addPropertyTo(this, 'layerName');
23
23
  addPropertyTo(this, 'description');
24
24
  addPropertyTo(this, 'height');
25
25
  addPropertyTo(this, 'width');
26
+ addPropertyTo(this, 'draftPreviewLayer', DraftPreviewLayer);
26
27
 
27
28
  this.create = function (options) {
28
29
  var data = serialise(this),
package/src/merchi.js CHANGED
@@ -38,6 +38,7 @@ import { DomainTag, DomainTags } from './domain_tag.js';
38
38
  import { DomainInvitation } from './domain_invitation.js';
39
39
  import { Draft, Drafts } from './draft.js';
40
40
  import { DraftPreview } from './draft_preview.js';
41
+ import { DraftPreviewLayer } from './draft_preview_layer.js';
41
42
  import { DraftTemplate } from './draft_template.js';
42
43
  import { DraftComment } from './draft_comment.js';
43
44
  import { EnrolledDomain, EnrolledDomains } from './enrolled_domain.js';
@@ -915,6 +916,7 @@ export function merchi(backendUri, websocketUri) {
915
916
  'drafts': new Drafts(),
916
917
  'DraftComment': DraftComment,
917
918
  'DraftPreview': DraftPreview,
919
+ 'DraftPreviewLayer': DraftPreviewLayer,
918
920
  'DraftTemplate': DraftTemplate,
919
921
  'ExchangeRate': ExchangeRate,
920
922
  'exchangeRates': new ExchangeRates(),
package/src/product.js CHANGED
@@ -23,6 +23,7 @@ import { User } from './user.js';
23
23
  import { Job } from './job.js';
24
24
  import { SeoDomainPage } from './seo_domain_page.js';
25
25
  import { InternalTag } from './internal_tag.js';
26
+ import { DraftPreview } from './draft_preview.js';
26
27
 
27
28
  export function Product() {
28
29
  this.resource = '/products';
@@ -108,6 +109,7 @@ export function Product() {
108
109
  addPropertyTo(this, 'taxType', CountryTax);
109
110
  addPropertyTo(this, 'defaultJob', Job);
110
111
  addPropertyTo(this, 'supplyChainRequestJobs', Job);
112
+ addPropertyTo(this, 'draftPreviews', DraftPreview);
111
113
  addPropertyTo(this, 'draftTemplates', DraftTemplate);
112
114
  addPropertyTo(this, 'shipmentMethods', ShipmentMethod);
113
115
  addPropertyTo(this, 'seoDomainPages', SeoDomainPage);