merchi_sdk_js 0.0.663-google-merchant-test-b → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_js",
3
- "version": "0.0.663-google-merchant-test-b",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "main": "src/merchi.js",
6
6
  "module": "src/merchi.js",
@@ -0,0 +1,63 @@
1
+ import { generateUUID } from './uuid.js';
2
+ import { addPropertyTo, serialise, fromJson, create, enumerateFiles, getOne, getList, fromJsonList } from './model.js';
3
+ import { User } from './user.js';
4
+ import { Domain } from './domain.js';
5
+
6
+ export function AgentConversation() {
7
+ this.resource = '/agent_conversations';
8
+ this.json = 'agentConversation';
9
+ this.temporaryId = generateUUID();
10
+
11
+ addPropertyTo(this, 'archived');
12
+ addPropertyTo(this, 'id');
13
+ addPropertyTo(this, 'conversationId');
14
+ addPropertyTo(this, 'initialPrompt');
15
+ addPropertyTo(this, 'creationDate');
16
+ addPropertyTo(this, 'serviceProvider');
17
+ addPropertyTo(this, 'user', User);
18
+ addPropertyTo(this, 'domain', Domain);
19
+
20
+ this.create = function (success, error, embed, as_domain) {
21
+ var data = serialise(this),
22
+ self = this;
23
+ function handleResponse(result) {
24
+ success(fromJson(self, result[self.json]));
25
+ }
26
+ create({resource: this.resource,
27
+ parameters: data[0],
28
+ files: enumerateFiles(data[1]),
29
+ as_domain: as_domain,
30
+ success: handleResponse,
31
+ error: error,
32
+ embed: embed});
33
+ };
34
+
35
+ this.get = function (success, error, embed) {
36
+ var self = this;
37
+ function handleResponse(result) {
38
+ success(fromJson(self, result[self.json],
39
+ {makesDirty: false}));
40
+ }
41
+ getOne({resource: this.resource,
42
+ id: this.id(),
43
+ success: handleResponse,
44
+ error: error,
45
+ embed: embed});
46
+ };
47
+ }
48
+
49
+ export function AgentConversations() {
50
+ this.resource = '/agent_conversations';
51
+ this.json = 'agentConversations';
52
+ this.single = AgentConversation;
53
+
54
+ this.get = function (success, error, parameters) {
55
+ var self = this;
56
+ function handleResponse(result) {
57
+ success(fromJsonList(self, result, {makesDirty: false}));
58
+ }
59
+ getList(this.resource, handleResponse, error, parameters || {});
60
+ };
61
+ }
62
+
63
+
package/src/assignment.js CHANGED
@@ -9,6 +9,7 @@ import { Notification } from './notification.js';
9
9
  import { Quote } from './quote.js';
10
10
  import { Shipment } from './shipment.js';
11
11
  import { SupplyDomain } from './supply_domain.js';
12
+ import { Reminder } from './reminder.js';
12
13
  import { ProductionComment } from './production_comment.js';
13
14
 
14
15
  export function Assignment() {
@@ -33,6 +34,7 @@ export function Assignment() {
33
34
  addPropertyTo(this, 'supplyDomain', SupplyDomain);
34
35
  addPropertyTo(this, 'comments', ProductionComment);
35
36
  addPropertyTo(this, 'notifications', Notification);
37
+ addPropertyTo(this, 'reminders', Reminder);
36
38
 
37
39
  this.get = function (success, error, embed) {
38
40
  var self = this;
package/src/company.js CHANGED
@@ -16,6 +16,7 @@ import { ShipmentMethod } from './shipment_method.js';
16
16
  import { User } from './user.js';
17
17
  import { UserCompany } from './user_company.js';
18
18
  import { PaymentDevice } from './payment_device.js';
19
+ import { Reminder } from './reminder.js';
19
20
  import { InternalTag } from './internal_tag.js';
20
21
 
21
22
 
@@ -97,6 +98,7 @@ export function Company() {
97
98
  addPropertyTo(this, 'internalUseNotes');
98
99
  addPropertyTo(this, 'internalUseAiContext');
99
100
  addPropertyTo(this, 'internalTags', InternalTag);
101
+ addPropertyTo(this, 'reminders', Reminder);
100
102
 
101
103
  this.create = function (success, error, embed, as_domain) {
102
104
  var data = serialise(this),
package/src/domain.js CHANGED
@@ -14,6 +14,7 @@ import { SupplyDomain } from './supply_domain.js';
14
14
  import { SeoDomainPage } from './seo_domain_page.js';
15
15
  import { User, Users } from './user.js';
16
16
  import { InternalTag } from './internal_tag.js';
17
+ import { Reminder } from './reminder.js';
17
18
  import { ShipmentMethod } from './shipment_method.js';
18
19
 
19
20
  export function Domain() {
@@ -81,6 +82,7 @@ export function Domain() {
81
82
  addPropertyTo(this, 'jobsAssignees', User);
82
83
  addPropertyTo(this, 'tags', DomainTag);
83
84
  addPropertyTo(this, 'internalTags', InternalTag);
85
+ addPropertyTo(this, 'reminders', Reminder);
84
86
 
85
87
  addPropertyTo(this, 'deploymentOnline');
86
88
  addPropertyTo(this, 'deploymentInProgress');
@@ -90,6 +92,7 @@ export function Domain() {
90
92
 
91
93
  addPropertyTo(this, 'scalablePressApiKey');
92
94
  addPropertyTo(this, 'googleMerchantApiKey');
95
+ addPropertyTo(this, 'googleMerchantId');
93
96
 
94
97
  this.create = function (success, error, embed, as_domain) {
95
98
  var data = serialise(this),
package/src/draft.js CHANGED
@@ -13,7 +13,7 @@ export function Draft() {
13
13
 
14
14
  addPropertyTo(this, 'id');
15
15
  addPropertyTo(this, 'job', Job);
16
- addPropertyTo(this, 'sharedWithJob', Job);
16
+ addPropertyTo(this, 'sharedWithJobs', Job);
17
17
  addPropertyTo(this, 'designer', User);
18
18
  addPropertyTo(this, 'file', MerchiFile);
19
19
  addPropertyTo(this, 'draftTemplates', DraftTemplate);
@@ -13,3 +13,4 @@ fieldTypes.add("FIELD_INSTRUCTIONS", 8);
13
13
  fieldTypes.add("IMAGE_SELECT", 9);
14
14
  fieldTypes.add("COLOUR_PICKER", 10);
15
15
  fieldTypes.add("COLOUR_SELECT", 11);
16
+ fieldTypes.add("TURNAROUND_TIME", 12);
package/src/inventory.js CHANGED
@@ -15,7 +15,8 @@ export function Inventory() {
15
15
  addPropertyTo(this, 'name');
16
16
  addPropertyTo(this, 'notes');
17
17
  addPropertyTo(this, 'quantity');
18
- addPropertyTo(this, 'inventoryGroups', InventoryGroup)
18
+ addPropertyTo(this, 'position');
19
+ addPropertyTo(this, 'inventoryGroups', InventoryGroup);
19
20
  addPropertyTo(this, 'product', Product);
20
21
  addPropertyTo(this, 'address', Address);
21
22
  addPropertyTo(this, 'inventoryUnitVariations',
package/src/invoice.js CHANGED
@@ -16,6 +16,7 @@ import { MerchiFile } from './merchi_file.js';
16
16
  import { Quote } from './quote.js';
17
17
  import { Payment } from './payment.js';
18
18
  import { Job } from './job.js';
19
+ import { Reminder } from './reminder.js';
19
20
  import { InternalTag } from './internal_tag.js';
20
21
 
21
22
  export function Invoice() {
@@ -70,6 +71,7 @@ export function Invoice() {
70
71
  addPropertyTo(this, 'shipments', Shipment);
71
72
  addPropertyTo(this, 'shopifyOrderId');
72
73
  addPropertyTo(this, 'internalTags', InternalTag);
74
+ addPropertyTo(this, 'reminders', Reminder);
73
75
 
74
76
  this.create = function (success, error, embed, asDomain) {
75
77
  var data = serialise(this),
package/src/job.js CHANGED
@@ -29,6 +29,7 @@ import { Variation } from './variation.js';
29
29
  import { VariationsGroup } from './variations_group.js';
30
30
  import { Item } from './item.js';
31
31
  import { JobComment } from './job_comment.js';
32
+ import { Reminder } from './reminder.js';
32
33
  import { InternalTag } from './internal_tag.js';
33
34
 
34
35
 
@@ -124,6 +125,7 @@ export function Job() {
124
125
  addPropertyTo(this, 'assignments', Assignment);
125
126
  addPropertyTo(this, 'archived');
126
127
  addPropertyTo(this, 'notifications', Notification);
128
+ addPropertyTo(this, 'reminders', Reminder);
127
129
  addPropertyTo(this, 'variationsGroups', VariationsGroup);
128
130
  addPropertyTo(this, 'variations', Variation);
129
131
  addPropertyTo(this, 'jobVolume');
package/src/merchi.js CHANGED
@@ -78,7 +78,9 @@ import { VariationFieldsOption } from './variation_fields_option.js';
78
78
  import { VariationsGroup } from './variations_group.js';
79
79
  import { QuoteItem, QuoteItems } from './quote_item.js';
80
80
  import { Quotes, Quote } from './quote.js';
81
+ import { Reminder, Reminders } from './reminder.js';
81
82
  import { InternalTag, InternalTags } from './internal_tag.js';
83
+ import { AgentConversation, AgentConversations } from './agent_conversation.js';
82
84
 
83
85
  export function merchi(backendUri, websocketUri) {
84
86
  getGlobal().merchiJsonpHandlers = {};
@@ -964,6 +966,8 @@ export function merchi(backendUri, websocketUri) {
964
966
  'QuoteItems': new QuoteItems(),
965
967
  'Quote': Quote,
966
968
  'Quotes': new Quotes(),
969
+ 'Reminder': Reminder,
970
+ 'reminders': new Reminders(),
967
971
  'Assignment': Assignment,
968
972
  'Assignments': new Assignments(),
969
973
  'File': MerchiFile,
@@ -998,6 +1002,8 @@ export function merchi(backendUri, websocketUri) {
998
1002
  'GSTrate': GSTrate,
999
1003
  'Notification': Notification,
1000
1004
  'notifications': new Notifications(),
1005
+ 'AgentConversation': AgentConversation,
1006
+ 'agentConversations': new AgentConversations(),
1001
1007
  'SubscriptionPlan': SubscriptionPlan,
1002
1008
  'subscriptionPlans': new SubscriptionPlans(),
1003
1009
  'VariationField': VariationField,
package/src/model.js CHANGED
@@ -309,6 +309,12 @@ export function getList(resource, success, error, parameters, withUpdates) {
309
309
  request.query().add(
310
310
  'platform_category_id', parameters.platformCategoryId);
311
311
  }
312
+ if (notEmpty(parameters.googleMerchantCenterExported)) {
313
+ request.query().add(
314
+ 'google_merchant_center_exported',
315
+ parameters.googleMerchantCenterExported
316
+ );
317
+ }
312
318
  if (notEmpty(parameters.groupBuyForJobId)) {
313
319
  request.query().add(
314
320
  'group_buy_for_job_id', parameters.groupBuyForJobId);
@@ -500,6 +506,18 @@ export function getList(resource, success, error, parameters, withUpdates) {
500
506
  if (parameters.tagNames) {
501
507
  request.query().add('tag_names', parameters.tagNames);
502
508
  }
509
+ if (parameters.tagNames) {
510
+ request.query().add(
511
+ 'exclude_tags',
512
+ parameters.excludeTags
513
+ );
514
+ }
515
+ if (parameters.tagNames) {
516
+ request.query().add(
517
+ 'exclude_tags_internal',
518
+ parameters.excludeTagsInternal
519
+ );
520
+ }
503
521
  if (parameters.turnaroundTimeDays) {
504
522
  request.query().add(
505
523
  'turnaround_time_days',
@@ -11,6 +11,7 @@ import { DraftComment } from './draft_comment.js';
11
11
  import { JobComment } from './job_comment.js';
12
12
  import { ProductionComment } from './production_comment.js';
13
13
  import { Invoice } from './invoice.js';
14
+ import { Reminder } from './reminder.js';
14
15
 
15
16
  export function Notification() {
16
17
  this.resource = '/notifications';
@@ -39,6 +40,7 @@ export function Notification() {
39
40
  addPropertyTo(this, 'relatedDraftComment', DraftComment);
40
41
  addPropertyTo(this, 'relatedProductionComment', ProductionComment);
41
42
  addPropertyTo(this, 'relatedInvoice', Invoice);
43
+ addPropertyTo(this, 'reminders', Reminder);
42
44
 
43
45
  this.title = function () {
44
46
  if (this.subject() && this.subject() !== 'None') {
package/src/product.js CHANGED
@@ -24,6 +24,7 @@ import { Job } from './job.js';
24
24
  import { SeoDomainPage } from './seo_domain_page.js';
25
25
  import { InternalTag } from './internal_tag.js';
26
26
  import { DraftPreview } from './draft_preview.js';
27
+ import { Reminder } from './reminder.js';
27
28
 
28
29
  export function Product() {
29
30
  this.resource = '/products';
@@ -45,6 +46,7 @@ export function Product() {
45
46
  addPropertyTo(this, 'spProductId');
46
47
  addPropertyTo(this, 'shopifyProductId');
47
48
  addPropertyTo(this, 'minimum');
49
+ addPropertyTo(this, 'minimumPrice')
48
50
  addPropertyTo(this, 'minimumPerGroup');
49
51
  addPropertyTo(this, 'deliveryDaysNormal');
50
52
  addPropertyTo(this, 'unitPrice');
@@ -116,7 +118,9 @@ export function Product() {
116
118
  addPropertyTo(this, 'aiContext');
117
119
  addPropertyTo(this, 'internalUseNotes');
118
120
  addPropertyTo(this, 'internalUseAiContext');
121
+ addPropertyTo(this, 'groupsFirst');
119
122
  addPropertyTo(this, 'internalTags', InternalTag);
123
+ addPropertyTo(this, 'reminders', Reminder);
120
124
  addPropertyTo(this, 'googleMerchantCenterId');
121
125
  addPropertyTo(this, 'googleMerchantCenterTitle');
122
126
  addPropertyTo(this, 'googleMerchantCenterDescription');
@@ -0,0 +1,104 @@
1
+ import { generateUUID } from './uuid.js';
2
+ import { addPropertyTo, create, serialise, enumerateFiles, getOne, getList,
3
+ fromJson, deleteOne, fromJsonList, patchOne } from './model.js';
4
+ import { isUndefinedOrNull } from './helpers.js';
5
+ import { User } from './user.js';
6
+ import { DomainTag } from './domain_tag.js';
7
+ import { Job } from './job.js';
8
+ import { Product } from './product.js';
9
+ import { Invoice } from './invoice.js';
10
+ import { Domain } from './domain.js';
11
+ import { Company } from './company.js';
12
+ import { Shipment } from './shipment.js';
13
+ import { Assignment } from './assignment.js';
14
+ import { Notification } from './notification.js';
15
+
16
+ export function Reminder() {
17
+ this.resource = '/reminders';
18
+ this.json = 'reminder';
19
+ this.temporaryId = generateUUID();
20
+
21
+ addPropertyTo(this, 'id');
22
+ addPropertyTo(this, 'user', User);
23
+ addPropertyTo(this, 'created');
24
+ addPropertyTo(this, 'updated');
25
+ addPropertyTo(this, 'remindDate');
26
+ addPropertyTo(this, 'message');
27
+ addPropertyTo(this, 'domainTags', DomainTag);
28
+ addPropertyTo(this, 'remindUsers', User);
29
+ addPropertyTo(this, 'job', Job);
30
+ addPropertyTo(this, 'product', Product);
31
+ addPropertyTo(this, 'invoice', Invoice);
32
+ addPropertyTo(this, 'domain', Domain);
33
+ addPropertyTo(this, 'company', Company);
34
+ addPropertyTo(this, 'shipment', Shipment);
35
+ addPropertyTo(this, 'assignment', Assignment);
36
+ addPropertyTo(this, 'notifications', Notification);
37
+
38
+ this.create = function (success, error, embed, asDomain) {
39
+ var data = serialise(this),
40
+ self = this,
41
+ domain = self.domain() ? self.domain().id() : null,
42
+ domainId = isUndefinedOrNull(asDomain) ? domain : asDomain;
43
+ function handleResponse(result) {
44
+ success(fromJson(self, result[self.json]));
45
+ }
46
+ create({resource: this.resource,
47
+ parameters: data[0],
48
+ as_domain: domainId,
49
+ files: enumerateFiles(data[1]),
50
+ success: handleResponse,
51
+ error: error,
52
+ embed: embed});
53
+ };
54
+
55
+ this.get = function (success, error, embed) {
56
+ var self = this;
57
+ function handleResponse(result) {
58
+ success(fromJson(self, result[self.json],
59
+ {makesDirty: false}));
60
+ }
61
+ getOne({resource: this.resource,
62
+ id: this.id(),
63
+ success: handleResponse,
64
+ error: error,
65
+ embed: embed});
66
+ };
67
+
68
+ this.patch = function (success, error, embed, asDomain) {
69
+ var self = this,
70
+ data = serialise(this, undefined, undefined, undefined,
71
+ {excludeOld: true})[0],
72
+ domain = self.domain() ? self.domain().id() : null,
73
+ domainId = isUndefinedOrNull(asDomain) ? domain : asDomain;
74
+ function handleResponse(result) {
75
+ success(fromJson(self, result[self.json],
76
+ {makesDirty: false}));
77
+ }
78
+ patchOne({resource: this.resource,
79
+ id: this.id(),
80
+ success: handleResponse,
81
+ error: error,
82
+ as_domain: domainId,
83
+ data: data,
84
+ embed: embed});
85
+ };
86
+
87
+ this.destroy = function (success, error) {
88
+ deleteOne(this.resource + '/' + this.id(), success, error);
89
+ };
90
+ }
91
+
92
+ export function Reminders() {
93
+ this.resource = '/reminders';
94
+ this.json = 'reminders';
95
+ this.single = Reminder;
96
+
97
+ this.get = function (success, error, parameters) {
98
+ var self = this;
99
+ function handleResponse(result) {
100
+ success(fromJsonList(self, result, {makesDirty: false}));
101
+ }
102
+ getList(this.resource, handleResponse, error, parameters);
103
+ };
104
+ }
package/src/shipment.js CHANGED
@@ -13,6 +13,7 @@ import { Job } from './job.js';
13
13
  import { MerchiFile } from './merchi_file.js';
14
14
  import { ShipmentItem } from './shipment_item.js';
15
15
  import { ShipmentMethod } from './shipment_method.js';
16
+ import { Reminder } from './reminder.js';
16
17
  import { InternalTag } from './internal_tag.js';
17
18
 
18
19
  export function Shipment() {
@@ -58,6 +59,7 @@ export function Shipment() {
58
59
  addPropertyTo(this, 'shipmentItems', ShipmentItem)
59
60
  addPropertyTo(this, 'shipmentMethod', ShipmentMethod);
60
61
  addPropertyTo(this, 'internalTags', InternalTag);
62
+ addPropertyTo(this, 'reminders', Reminder);
61
63
 
62
64
  this.get = function (success, error, embed) {
63
65
  var self = this;
package/src/user.js CHANGED
@@ -15,6 +15,7 @@ import { Domain } from './domain.js';
15
15
  import { MerchiFile } from './merchi_file.js';
16
16
  import { SystemRole } from './system_role.js';
17
17
  import { UserCompany } from './user_company.js';
18
+ import { Reminder } from './reminder.js';
18
19
  import { InternalTag } from './internal_tag.js';
19
20
 
20
21
  export function User() {
@@ -34,6 +35,9 @@ export function User() {
34
35
  addPropertyTo(this, 'preferredLanguage');
35
36
  addPropertyTo(this, 'isSuperUser');
36
37
  addPropertyTo(this, 'canEdit');
38
+ addPropertyTo(this, 'jobCountAsClient');
39
+ addPropertyTo(this, 'totalInvoiceValue');
40
+ addPropertyTo(this, 'lastJobReceived');
37
41
  addPropertyTo(this, 'systemRoles', SystemRole);
38
42
  addPropertyTo(this, 'telegramUsername');
39
43
  addPropertyTo(this, 'enableCrashReports');
@@ -55,6 +59,7 @@ export function User() {
55
59
  addPropertyTo(this, 'internalUseNotes');
56
60
  addPropertyTo(this, 'internalUseAiContext');
57
61
  addPropertyTo(this, 'internalTags', InternalTag);
62
+ addPropertyTo(this, 'reminders', Reminder);
58
63
 
59
64
  this.create = function (success, error, embed, as_domain) {
60
65
  var self = this,
package/src/variation.js CHANGED
@@ -18,6 +18,7 @@ export function Variation() {
18
18
  addPropertyTo(this, 'onceOffCost');
19
19
  addPropertyTo(this, 'unitCost');
20
20
  addPropertyTo(this, 'unitCostTotal');
21
+ addPropertyTo(this, 'isVisible');
21
22
  addPropertyTo(this, 'selectableOptions', VariationOption);
22
23
  addPropertyTo(this, 'selectedOptions', VariationOption);
23
24
  addPropertyTo(this, 'variationField', VariationField);
@@ -28,6 +28,7 @@ export function VariationField() {
28
28
  addPropertyTo(this, 'variationCostDiscountGroup', DiscountGroup);
29
29
  addPropertyTo(this, 'variationUnitCost');
30
30
  addPropertyTo(this, 'variationUnitCostDiscountGroup', DiscountGroup);
31
+ addPropertyTo(this, 'selectedBy', VariationFieldsOption);
31
32
  addPropertyTo(this, 'options', VariationFieldsOption);
32
33
  addPropertyTo(this, 'defaultOptions', VariationFieldsOption);
33
34
  addPropertyTo(this, 'multipleSelect');
@@ -43,6 +44,9 @@ export function VariationField() {
43
44
  addPropertyTo(this, 'allowFilePng');
44
45
  addPropertyTo(this, 'allowFileAi');
45
46
  addPropertyTo(this, 'sellerProductEditable');
47
+ addPropertyTo(this, 'isHtml');
48
+ addPropertyTo(this, 'considerBusinessHours');
49
+ addPropertyTo(this, 'shippingTimeIncluded');
46
50
 
47
51
  this.isType = function (typeString) {
48
52
  return parseInt(this.fieldType(), 10) ===
@@ -16,7 +16,9 @@ export function VariationFieldsOption() {
16
16
  addPropertyTo(this, 'include');
17
17
  addPropertyTo(this, 'colour');
18
18
  addPropertyTo(this, 'noInventory');
19
+ addPropertyTo(this, 'deliveryDays');
19
20
  addPropertyTo(this, 'variationCost');
21
+ addPropertyTo(this, 'selectedBy', VariationFieldsOption);
20
22
  addPropertyTo(this, 'variationCostDiscountGroup', DiscountGroup);
21
23
  addPropertyTo(this, 'variationUnitCost');
22
24
  addPropertyTo(this, 'variationUnitCostDiscountGroup', DiscountGroup);
@@ -20,6 +20,8 @@ export function VariationOption() {
20
20
  addPropertyTo(this, 'unitCostTotal');
21
21
  addPropertyTo(this, 'totalCost');
22
22
  addPropertyTo(this, 'fieldName');
23
+ addPropertyTo(this, 'isVisible');
24
+ addPropertyTo(this, 'userDeadline');
23
25
  addPropertyTo(this, 'linkedFile', MerchiFile);
24
26
 
25
27
  this.copyFieldOption = function (option) {