merchi_sdk_ts 1.6.16 → 1.7.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 (48) hide show
  1. package/dist/entities/company.js +68 -4
  2. package/dist/entities/company_invoice_settings.js +4 -4
  3. package/dist/entities/company_invoice_settings_version.js +2 -2
  4. package/dist/entities/domain_chat_settings.js +48 -0
  5. package/dist/entities/draft_comment.js +9 -1
  6. package/dist/entities/draft_template.js +12 -0
  7. package/dist/entities/invoice.js +3 -14
  8. package/dist/entities/invoice_template_version.js +1 -1
  9. package/dist/entities/job.js +4 -0
  10. package/dist/entities/notification.test.js +15 -0
  11. package/dist/entities/product.test.js +2 -0
  12. package/dist/entities/support_conversation.js +20 -0
  13. package/dist/entities/support_message.js +4 -0
  14. package/dist/entities/user.js +4 -0
  15. package/dist/entity.js +10 -0
  16. package/dist/index.js +4 -5
  17. package/dist/merchi.js +6 -8
  18. package/package.json +1 -1
  19. package/src/entities/agent_skill.test.ts +13 -0
  20. package/src/entities/agent_skill.ts +99 -0
  21. package/src/entities/agent_skill_approval.ts +26 -0
  22. package/src/entities/agent_skill_version.ts +64 -0
  23. package/src/entities/company.ts +51 -4
  24. package/src/entities/domain_chat_settings.test.ts +16 -0
  25. package/src/entities/domain_chat_settings.ts +37 -0
  26. package/src/entities/draft_comment.ts +7 -1
  27. package/src/entities/draft_template.ts +17 -0
  28. package/src/entities/invoice.ts +2 -13
  29. package/src/entities/job.ts +3 -0
  30. package/src/entities/notification.test.ts +17 -0
  31. package/src/entities/product.test.ts +2 -0
  32. package/src/entities/support_conversation.ts +17 -0
  33. package/src/entities/support_message.ts +3 -0
  34. package/src/entities/user.ts +4 -0
  35. package/src/entity.ts +15 -0
  36. package/src/index.ts +6 -8
  37. package/src/merchi.ts +9 -12
  38. package/coverage/lcov-report/base.css +0 -224
  39. package/coverage/lcov-report/block-navigation.js +0 -87
  40. package/coverage/lcov-report/favicon.png +0 -0
  41. package/coverage/lcov-report/prettify.css +0 -1
  42. package/coverage/lcov-report/prettify.js +0 -2
  43. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  44. package/coverage/lcov-report/sorter.js +0 -196
  45. package/src/entities/company_invoice_settings.ts +0 -43
  46. package/src/entities/company_invoice_settings_version.ts +0 -30
  47. package/src/entities/invoice_template.ts +0 -26
  48. package/src/entities/invoice_template_version.ts +0 -20
@@ -118,6 +118,74 @@ var Company = /** @class */ (function (_super) {
118
118
  Company.property({ type: String }),
119
119
  __metadata("design:type", String)
120
120
  ], Company.prototype, "unltdAiApiSecretKey", void 0);
121
+ __decorate([
122
+ Company.property({ type: String }),
123
+ __metadata("design:type", String)
124
+ ], Company.prototype, "australiaPostApiKey", void 0);
125
+ __decorate([
126
+ Company.property({ type: String }),
127
+ __metadata("design:type", String)
128
+ ], Company.prototype, "australiaPostPassword", void 0);
129
+ __decorate([
130
+ Company.property({ type: String }),
131
+ __metadata("design:type", String)
132
+ ], Company.prototype, "startrackApiKey", void 0);
133
+ __decorate([
134
+ Company.property({ type: String }),
135
+ __metadata("design:type", String)
136
+ ], Company.prototype, "startrackPassword", void 0);
137
+ __decorate([
138
+ Company.property({ type: String }),
139
+ __metadata("design:type", String)
140
+ ], Company.prototype, "dhlApiKey", void 0);
141
+ __decorate([
142
+ Company.property({ type: String }),
143
+ __metadata("design:type", String)
144
+ ], Company.prototype, "dhlApiSecret", void 0);
145
+ __decorate([
146
+ Company.property({ type: String }),
147
+ __metadata("design:type", String)
148
+ ], Company.prototype, "fedexApiKey", void 0);
149
+ __decorate([
150
+ Company.property({ type: String }),
151
+ __metadata("design:type", String)
152
+ ], Company.prototype, "fedexApiSecret", void 0);
153
+ __decorate([
154
+ Company.property({ type: String }),
155
+ __metadata("design:type", String)
156
+ ], Company.prototype, "upsClientId", void 0);
157
+ __decorate([
158
+ Company.property({ type: String }),
159
+ __metadata("design:type", String)
160
+ ], Company.prototype, "upsClientSecret", void 0);
161
+ __decorate([
162
+ Company.property({ type: String }),
163
+ __metadata("design:type", String)
164
+ ], Company.prototype, "uspsApiKey", void 0);
165
+ __decorate([
166
+ Company.property({ type: String }),
167
+ __metadata("design:type", String)
168
+ ], Company.prototype, "tntApiKey", void 0);
169
+ __decorate([
170
+ Company.property({ type: String }),
171
+ __metadata("design:type", String)
172
+ ], Company.prototype, "tntApiSecret", void 0);
173
+ __decorate([
174
+ Company.property({ type: String }),
175
+ __metadata("design:type", String)
176
+ ], Company.prototype, "aramexAccountNumber", void 0);
177
+ __decorate([
178
+ Company.property({ type: String }),
179
+ __metadata("design:type", String)
180
+ ], Company.prototype, "aramexApiKey", void 0);
181
+ __decorate([
182
+ Company.property({ type: String }),
183
+ __metadata("design:type", String)
184
+ ], Company.prototype, "aramexApiSecret", void 0);
185
+ __decorate([
186
+ Company.property({ type: String }),
187
+ __metadata("design:type", String)
188
+ ], Company.prototype, "nzPostApiKey", void 0);
121
189
  __decorate([
122
190
  Company.property({ type: String }),
123
191
  __metadata("design:type", String)
@@ -366,10 +434,6 @@ var Company = /** @class */ (function (_super) {
366
434
  Company.property({ arrayType: 'Invoice' }),
367
435
  __metadata("design:type", Array)
368
436
  ], Company.prototype, "subscriptionInvoices", void 0);
369
- __decorate([
370
- Company.property({ type: 'CompanyInvoiceSettings' }),
371
- __metadata("design:type", Object)
372
- ], Company.prototype, "invoiceSettings", void 0);
373
437
  __decorate([
374
438
  Company.property({ arrayType: 'Address' }),
375
439
  __metadata("design:type", Array)
@@ -44,11 +44,11 @@ var CompanyInvoiceSettings = /** @class */ (function (_super) {
44
44
  __metadata("design:type", Object)
45
45
  ], CompanyInvoiceSettings.prototype, "selectedTemplate", void 0);
46
46
  __decorate([
47
- CompanyInvoiceSettings.property(),
47
+ CompanyInvoiceSettings.property({ type: Object }),
48
48
  __metadata("design:type", Object)
49
49
  ], CompanyInvoiceSettings.prototype, "themeOverrides", void 0);
50
50
  __decorate([
51
- CompanyInvoiceSettings.property(),
51
+ CompanyInvoiceSettings.property({ type: Object }),
52
52
  __metadata("design:type", Object)
53
53
  ], CompanyInvoiceSettings.prototype, "blockOverrides", void 0);
54
54
  __decorate([
@@ -56,11 +56,11 @@ var CompanyInvoiceSettings = /** @class */ (function (_super) {
56
56
  __metadata("design:type", String)
57
57
  ], CompanyInvoiceSettings.prototype, "customCss", void 0);
58
58
  __decorate([
59
- CompanyInvoiceSettings.property(),
59
+ CompanyInvoiceSettings.property({ type: Object }),
60
60
  __metadata("design:type", Object)
61
61
  ], CompanyInvoiceSettings.prototype, "draftThemeOverrides", void 0);
62
62
  __decorate([
63
- CompanyInvoiceSettings.property(),
63
+ CompanyInvoiceSettings.property({ type: Object }),
64
64
  __metadata("design:type", Object)
65
65
  ], CompanyInvoiceSettings.prototype, "draftBlockOverrides", void 0);
66
66
  __decorate([
@@ -44,11 +44,11 @@ var CompanyInvoiceSettingsVersion = /** @class */ (function (_super) {
44
44
  __metadata("design:type", Object)
45
45
  ], CompanyInvoiceSettingsVersion.prototype, "template", void 0);
46
46
  __decorate([
47
- CompanyInvoiceSettingsVersion.property(),
47
+ CompanyInvoiceSettingsVersion.property({ type: Object }),
48
48
  __metadata("design:type", Object)
49
49
  ], CompanyInvoiceSettingsVersion.prototype, "themeOverrides", void 0);
50
50
  __decorate([
51
- CompanyInvoiceSettingsVersion.property(),
51
+ CompanyInvoiceSettingsVersion.property({ type: Object }),
52
52
  __metadata("design:type", Object)
53
53
  ], CompanyInvoiceSettingsVersion.prototype, "blockOverrides", void 0);
54
54
  __decorate([
@@ -77,10 +77,58 @@ var DomainChatSettings = /** @class */ (function (_super) {
77
77
  DomainChatSettings.property(),
78
78
  __metadata("design:type", Boolean)
79
79
  ], DomainChatSettings.prototype, "notifyEmailNewMessage", void 0);
80
+ __decorate([
81
+ DomainChatSettings.property(),
82
+ __metadata("design:type", Object)
83
+ ], DomainChatSettings.prototype, "telegramChatId", void 0);
84
+ __decorate([
85
+ DomainChatSettings.property({ arrayType: 'User' }),
86
+ __metadata("design:type", Array)
87
+ ], DomainChatSettings.prototype, "assignedUsers", void 0);
80
88
  __decorate([
81
89
  DomainChatSettings.property(),
82
90
  __metadata("design:type", Boolean)
83
91
  ], DomainChatSettings.prototype, "requireGuestContact", void 0);
92
+ __decorate([
93
+ DomainChatSettings.property(),
94
+ __metadata("design:type", Boolean)
95
+ ], DomainChatSettings.prototype, "embedTestMode", void 0);
96
+ __decorate([
97
+ DomainChatSettings.property(),
98
+ __metadata("design:type", Object)
99
+ ], DomainChatSettings.prototype, "autoOpenDelay", void 0);
100
+ __decorate([
101
+ DomainChatSettings.property(),
102
+ __metadata("design:type", Object)
103
+ ], DomainChatSettings.prototype, "autoOpenMessage", void 0);
104
+ __decorate([
105
+ DomainChatSettings.property(),
106
+ __metadata("design:type", Object)
107
+ ], DomainChatSettings.prototype, "autoOpenMode", void 0);
108
+ __decorate([
109
+ DomainChatSettings.property(),
110
+ __metadata("design:type", Boolean)
111
+ ], DomainChatSettings.prototype, "aiFallbackEnabled", void 0);
112
+ __decorate([
113
+ DomainChatSettings.property(),
114
+ __metadata("design:type", Object)
115
+ ], DomainChatSettings.prototype, "aiFallbackScope", void 0);
116
+ __decorate([
117
+ DomainChatSettings.property(),
118
+ __metadata("design:type", Object)
119
+ ], DomainChatSettings.prototype, "aiDisclosureMode", void 0);
120
+ __decorate([
121
+ DomainChatSettings.property(),
122
+ __metadata("design:type", Object)
123
+ ], DomainChatSettings.prototype, "aiMaxRepliesPerConversation", void 0);
124
+ __decorate([
125
+ DomainChatSettings.property(),
126
+ __metadata("design:type", Number)
127
+ ], DomainChatSettings.prototype, "aiCooldownSeconds", void 0);
128
+ __decorate([
129
+ DomainChatSettings.property(),
130
+ __metadata("design:type", Object)
131
+ ], DomainChatSettings.prototype, "aiEscalationMessage", void 0);
84
132
  return DomainChatSettings;
85
133
  }(Entity));
86
134
  export { DomainChatSettings };
@@ -46,6 +46,10 @@ var DraftComment = /** @class */ (function (_super) {
46
46
  DraftComment.property({ type: Date }),
47
47
  __metadata("design:type", Object)
48
48
  ], DraftComment.prototype, "date", void 0);
49
+ __decorate([
50
+ DraftComment.property({ type: Date }),
51
+ __metadata("design:type", Object)
52
+ ], DraftComment.prototype, "lastEditedTime", void 0);
49
53
  __decorate([
50
54
  DraftComment.property(),
51
55
  __metadata("design:type", Number)
@@ -71,7 +75,11 @@ var DraftComment = /** @class */ (function (_super) {
71
75
  __metadata("design:type", User)
72
76
  ], DraftComment.prototype, "user", void 0);
73
77
  __decorate([
74
- DraftComment.property({ arrayType: "MerchiFile" }),
78
+ DraftComment.property(),
79
+ __metadata("design:type", User)
80
+ ], DraftComment.prototype, "lastEditedBy", void 0);
81
+ __decorate([
82
+ DraftComment.property({ arrayType: 'MerchiFile' }),
75
83
  __metadata("design:type", Array)
76
84
  ], DraftComment.prototype, "files", void 0);
77
85
  __decorate([
@@ -90,6 +90,18 @@ var DraftTemplate = /** @class */ (function (_super) {
90
90
  DraftTemplate.property({ arrayType: 'DraftPreviewLayer' }),
91
91
  __metadata("design:type", Array)
92
92
  ], DraftTemplate.prototype, "draftPreviewLayers", void 0);
93
+ __decorate([
94
+ DraftTemplate.property(),
95
+ __metadata("design:type", Object)
96
+ ], DraftTemplate.prototype, "customisationMap", void 0);
97
+ __decorate([
98
+ DraftTemplate.property(),
99
+ __metadata("design:type", Object)
100
+ ], DraftTemplate.prototype, "customisationMapSource", void 0);
101
+ __decorate([
102
+ DraftTemplate.property(),
103
+ __metadata("design:type", Object)
104
+ ], DraftTemplate.prototype, "customisationMapFileId", void 0);
93
105
  return DraftTemplate;
94
106
  }(Entity));
95
107
  export { DraftTemplate };
@@ -24,6 +24,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
24
24
  };
25
25
  import { Address } from './address.js';
26
26
  import { Cart } from './cart.js';
27
+ import { Company } from './company.js';
27
28
  import { Domain } from './domain.js';
28
29
  import { EmailAddress } from './email_address.js';
29
30
  import { Entity } from '../entity.js';
@@ -162,10 +163,6 @@ var Invoice = /** @class */ (function (_super) {
162
163
  Invoice.property({ embeddedByDefault: false }),
163
164
  __metadata("design:type", Boolean)
164
165
  ], Invoice.prototype, "isCompletelyPaid", void 0);
165
- __decorate([
166
- Invoice.property({ embeddedByDefault: false }),
167
- __metadata("design:type", String)
168
- ], Invoice.prototype, "rendererUsed", void 0);
169
166
  __decorate([
170
167
  Invoice.property({ type: User }),
171
168
  __metadata("design:type", Object)
@@ -179,11 +176,11 @@ var Invoice = /** @class */ (function (_super) {
179
176
  __metadata("design:type", User)
180
177
  ], Invoice.prototype, "client", void 0);
181
178
  __decorate([
182
- Invoice.property({ type: 'Company' }),
179
+ Invoice.property({ type: Company }),
183
180
  __metadata("design:type", Object)
184
181
  ], Invoice.prototype, "clientCompany", void 0);
185
182
  __decorate([
186
- Invoice.property({ arrayType: 'Company' }),
183
+ Company.property({ arrayType: 'Company' }),
187
184
  __metadata("design:type", Array)
188
185
  ], Invoice.prototype, "subscriptionCompanies", void 0);
189
186
  __decorate([
@@ -206,14 +203,6 @@ var Invoice = /** @class */ (function (_super) {
206
203
  Invoice.property({ type: MerchiFile }),
207
204
  __metadata("design:type", Object)
208
205
  ], Invoice.prototype, "receipt", void 0);
209
- __decorate([
210
- Invoice.property({ type: 'InvoiceTemplateVersion' }),
211
- __metadata("design:type", Object)
212
- ], Invoice.prototype, "templateVersion", void 0);
213
- __decorate([
214
- Invoice.property({ type: 'CompanyInvoiceSettingsVersion' }),
215
- __metadata("design:type", Object)
216
- ], Invoice.prototype, "settingsVersion", void 0);
217
206
  __decorate([
218
207
  Invoice.property({ type: PhoneNumber }),
219
208
  __metadata("design:type", Object)
@@ -40,7 +40,7 @@ var InvoiceTemplateVersion = /** @class */ (function (_super) {
40
40
  __metadata("design:type", Object)
41
41
  ], InvoiceTemplateVersion.prototype, "template", void 0);
42
42
  __decorate([
43
- InvoiceTemplateVersion.property(),
43
+ InvoiceTemplateVersion.property({ type: Object }),
44
44
  __metadata("design:type", Object)
45
45
  ], InvoiceTemplateVersion.prototype, "blocksJson", void 0);
46
46
  __decorate([
@@ -234,6 +234,10 @@ var Job = /** @class */ (function (_super) {
234
234
  Job.property(),
235
235
  __metadata("design:type", Date)
236
236
  ], Job.prototype, "updated", void 0);
237
+ __decorate([
238
+ Job.property(),
239
+ __metadata("design:type", Object)
240
+ ], Job.prototype, "dateLastActioned", void 0);
237
241
  __decorate([
238
242
  Job.property(),
239
243
  __metadata("design:type", Date)
@@ -1,6 +1,21 @@
1
1
  import { Merchi } from '../merchi.js';
2
+ import { setup, mockFetch } from '../test_util.js';
3
+ setup();
2
4
  test('can make Notification', function () {
3
5
  var merchi = new Merchi();
4
6
  var notification = new merchi.Notification();
5
7
  expect(notification).toBeTruthy();
6
8
  });
9
+ test('can list notifications with notificationSender filter', function () {
10
+ var merchi = new Merchi();
11
+ var fetch = mockFetch(true, {
12
+ 'notifications': [],
13
+ 'available': 0,
14
+ 'count': 0
15
+ }, 200);
16
+ var options = { notificationSender: 123 };
17
+ return merchi.Notification.list(options).then(function () {
18
+ var query = fetch.mock.calls[0][1]['query'];
19
+ expect(query).toContainEqual(['notification_sender', '123']);
20
+ });
21
+ });
@@ -280,6 +280,7 @@ test('can list products with options set', function () {
280
280
  publicOnly: false,
281
281
  q: 'example',
282
282
  receiverId: 86,
283
+ userAsReceiver: 97,
283
284
  relatedAssignment: 1,
284
285
  relatedComponent: 1,
285
286
  relatedDraft: 1,
@@ -371,6 +372,7 @@ test('can list products with options set', function () {
371
372
  ['public_only', 'false'],
372
373
  ['q', 'example'],
373
374
  ['receiver_id', '86'],
375
+ ['user_as_receiver', '97'],
374
376
  ['related_assignment', '1'],
375
377
  ['related_component', '1'],
376
378
  ['related_draft', '1'],
@@ -73,14 +73,34 @@ var SupportConversation = /** @class */ (function (_super) {
73
73
  SupportConversation.property({ type: String }),
74
74
  __metadata("design:type", Object)
75
75
  ], SupportConversation.prototype, "clientFingerprint", void 0);
76
+ __decorate([
77
+ SupportConversation.property({ type: String }),
78
+ __metadata("design:type", Object)
79
+ ], SupportConversation.prototype, "name", void 0);
80
+ __decorate([
81
+ SupportConversation.property({ type: String }),
82
+ __metadata("design:type", Object)
83
+ ], SupportConversation.prototype, "notes", void 0);
76
84
  __decorate([
77
85
  SupportConversation.property({ type: User }),
78
86
  __metadata("design:type", Object)
79
87
  ], SupportConversation.prototype, "user", void 0);
88
+ __decorate([
89
+ SupportConversation.property({ type: User }),
90
+ __metadata("design:type", Object)
91
+ ], SupportConversation.prototype, "assignedUser", void 0);
92
+ __decorate([
93
+ SupportConversation.property({ type: Boolean }),
94
+ __metadata("design:type", Boolean)
95
+ ], SupportConversation.prototype, "aiAutoReply", void 0);
80
96
  __decorate([
81
97
  SupportConversation.property({ arrayType: 'SupportMessage' }),
82
98
  __metadata("design:type", Array)
83
99
  ], SupportConversation.prototype, "messages", void 0);
100
+ __decorate([
101
+ SupportConversation.property(),
102
+ __metadata("design:type", Number)
103
+ ], SupportConversation.prototype, "messagesCount", void 0);
84
104
  return SupportConversation;
85
105
  }(Entity));
86
106
  export { SupportConversation };
@@ -57,6 +57,10 @@ var SupportMessage = /** @class */ (function (_super) {
57
57
  SupportMessage.property({ type: Date }),
58
58
  __metadata("design:type", Object)
59
59
  ], SupportMessage.prototype, "creationDate", void 0);
60
+ __decorate([
61
+ SupportMessage.property({ type: Boolean }),
62
+ __metadata("design:type", Boolean)
63
+ ], SupportMessage.prototype, "isAiReply", void 0);
60
64
  return SupportMessage;
61
65
  }(Entity));
62
66
  export { SupportMessage };
@@ -187,6 +187,10 @@ var User = /** @class */ (function (_super) {
187
187
  User.property({ arrayType: 'InternalTag' }),
188
188
  __metadata("design:type", Array)
189
189
  ], User.prototype, "internalTags", void 0);
190
+ __decorate([
191
+ User.property({ arrayType: 'DomainTag' }),
192
+ __metadata("design:type", Array)
193
+ ], User.prototype, "tags", void 0);
190
194
  __decorate([
191
195
  User.property({ arrayType: 'Domain' }),
192
196
  __metadata("design:type", Array)
package/dist/entity.js CHANGED
@@ -629,6 +629,9 @@ var Entity = /** @class */ (function () {
629
629
  if (options.tab !== undefined) {
630
630
  fetchOptions.query.push(['tab', options.tab]);
631
631
  }
632
+ if (options.trackingNumber !== undefined) {
633
+ fetchOptions.query.push(['tracking_number', options.trackingNumber]);
634
+ }
632
635
  if (options.as !== undefined) {
633
636
  fetchOptions.query.push(['as', options.as]);
634
637
  }
@@ -773,6 +776,10 @@ var Entity = /** @class */ (function () {
773
776
  fetchOptions.query.push(['notification_recipient',
774
777
  options.notificationRecipient.toString()]);
775
778
  }
779
+ if (options.notificationSender !== undefined) {
780
+ fetchOptions.query.push(['notification_sender',
781
+ options.notificationSender.toString()]);
782
+ }
776
783
  if (options.notificationJob !== undefined) {
777
784
  fetchOptions.query.push(['notification_job',
778
785
  options.notificationJob.toString()]);
@@ -801,6 +808,9 @@ var Entity = /** @class */ (function () {
801
808
  if (options.receiverId !== undefined) {
802
809
  fetchOptions.query.push(['receiver_id', options.receiverId.toString()]);
803
810
  }
811
+ if (options.userAsReceiver !== undefined) {
812
+ fetchOptions.query.push(['user_as_receiver', options.userAsReceiver.toString()]);
813
+ }
804
814
  if (options.companyCustomerId !== undefined) {
805
815
  fetchOptions.query.push(['company_customer_id', options.companyCustomerId.toString()]);
806
816
  }
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { Address } from './entities/address.js';
2
2
  import { AgentConversation } from './entities/agent_conversation.js';
3
+ import { AgentSkill } from './entities/agent_skill.js';
4
+ import { AgentSkillVersion } from './entities/agent_skill_version.js';
5
+ import { AgentSkillApproval } from './entities/agent_skill_approval.js';
3
6
  import { DomainChatSettings } from './entities/domain_chat_settings.js';
4
7
  import { SupportConversation } from './entities/support_conversation.js';
5
8
  import { SupportMessage } from './entities/support_message.js';
@@ -12,8 +15,6 @@ import { CartShipmentGroup } from './entities/cart_shipment_group.js';
12
15
  import { CartShipmentQuote } from './entities/cart_shipment_quote.js';
13
16
  import { Category } from './entities/category.js';
14
17
  import { Company } from './entities/company.js';
15
- import { CompanyInvoiceSettings } from './entities/company_invoice_settings.js';
16
- import { CompanyInvoiceSettingsVersion } from './entities/company_invoice_settings_version.js';
17
18
  import { CompanyInvitation } from './entities/company_invitation.js';
18
19
  import { Component } from './entities/component.js';
19
20
  import { ComponentTag } from './entities/component_tag.js';
@@ -36,8 +37,6 @@ import { InternalTag } from './entities/internal_tag.js';
36
37
  import { Inventory } from './entities/inventory.js';
37
38
  import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
38
39
  import { Invoice } from './entities/invoice.js';
39
- import { InvoiceTemplate } from './entities/invoice_template.js';
40
- import { InvoiceTemplateVersion } from './entities/invoice_template_version.js';
41
40
  import { Item } from './entities/item.js';
42
41
  import { Job } from './entities/job.js';
43
42
  import { JobComment } from './entities/job_comment.js';
@@ -82,4 +81,4 @@ import * as constants from './constants/index.js';
82
81
  import * as request from './request.js';
83
82
  import * as util from './util/index.js';
84
83
  import { toastNotifications } from './toasts.js';
85
- export { constants, request, util, toastNotifications, Address, AgentConversation, DomainChatSettings, SupportConversation, SupportMessage, Assignment, AutomaticPaymentRelationship, Bank, Cart, CartItem, CartShipmentGroup, CartShipmentQuote, Category, Company, CompanyInvoiceSettings, CompanyInvoiceSettingsVersion, CompanyInvitation, Component, ComponentTag, ComponentVersion, CountryTax, Discount, DiscountGroup, Domain, DomainInvitation, DomainTag, Draft, DraftComment, DraftTemplate, EmailAddress, EmailCounter, EnrolledDomain, Entity, ExchangeRate, InternalTag, Inventory, InventoryUnitVariation, Invoice, InvoiceTemplate, InvoiceTemplateVersion, Item, Job, JobComment, MatchingInventory, Menu, MenuItem, Merchi, MerchiFile, Notification, Page, Payment, PaymentDevice, PhoneNumber, Product, ProductionComment, Quote, QuoteItem, Reminder, apiFetch, apiFetchWithProgress, Session, Shipment, ShipmentItem, ShipmentItemFulfillment, ShipmentMethod, ShipmentMethodVariation, ShortUrl, SubscriptionPlan, SupplyDomain, SystemRole, Theme, ThemeCssSetting, User, UserCompany, Variation, VariationField, VariationFieldsOption, VariationOption, VariationsGroup, generateUUID, getCookie };
84
+ export { constants, request, util, toastNotifications, Address, AgentConversation, AgentSkill, AgentSkillVersion, AgentSkillApproval, DomainChatSettings, SupportConversation, SupportMessage, Assignment, AutomaticPaymentRelationship, Bank, Cart, CartItem, CartShipmentGroup, CartShipmentQuote, Category, Company, CompanyInvitation, Component, ComponentTag, ComponentVersion, CountryTax, Discount, DiscountGroup, Domain, DomainInvitation, DomainTag, Draft, DraftComment, DraftTemplate, EmailAddress, EmailCounter, EnrolledDomain, Entity, ExchangeRate, InternalTag, Inventory, InventoryUnitVariation, Invoice, Item, Job, JobComment, MatchingInventory, Menu, MenuItem, Merchi, MerchiFile, Notification, Page, Payment, PaymentDevice, PhoneNumber, Product, ProductionComment, Quote, QuoteItem, Reminder, apiFetch, apiFetchWithProgress, Session, Shipment, ShipmentItem, ShipmentItemFulfillment, ShipmentMethod, ShipmentMethodVariation, ShortUrl, SubscriptionPlan, SupplyDomain, SystemRole, Theme, ThemeCssSetting, User, UserCompany, Variation, VariationField, VariationFieldsOption, VariationOption, VariationsGroup, generateUUID, getCookie };
package/dist/merchi.js CHANGED
@@ -26,8 +26,6 @@ import { InventoryGroup } from './entities/inventory_group.js';
26
26
  import { QuoteItem } from './entities/quote_item.js';
27
27
  import { Category } from './entities/category.js';
28
28
  import { Invoice } from './entities/invoice.js';
29
- import { InvoiceTemplate } from './entities/invoice_template.js';
30
- import { InvoiceTemplateVersion } from './entities/invoice_template_version.js';
31
29
  import { UserCompany } from './entities/user_company.js';
32
30
  import { InventoryUnitVariation } from './entities/inventory_unit_variation.js';
33
31
  import { VariationFieldsOption } from './entities/variation_fields_option.js';
@@ -63,8 +61,6 @@ import { Discount } from './entities/discount.js';
63
61
  import { DiscountGroup } from './entities/discount_group.js';
64
62
  import { User } from './entities/user.js';
65
63
  import { Company } from './entities/company.js';
66
- import { CompanyInvoiceSettings } from './entities/company_invoice_settings.js';
67
- import { CompanyInvoiceSettingsVersion } from './entities/company_invoice_settings_version.js';
68
64
  import { ComponentTag } from './entities/component_tag.js';
69
65
  import { EnrolledDomain } from './entities/enrolled_domain.js';
70
66
  import { CountryTax } from './entities/country_tax.js';
@@ -82,6 +78,9 @@ import { Variation } from './entities/variation.js';
82
78
  import { CartItem } from './entities/cart_item.js';
83
79
  import { Address } from './entities/address.js';
84
80
  import { AgentConversation } from './entities/agent_conversation.js';
81
+ import { AgentSkill } from './entities/agent_skill.js';
82
+ import { AgentSkillVersion } from './entities/agent_skill_version.js';
83
+ import { AgentSkillApproval } from './entities/agent_skill_approval.js';
85
84
  import { DomainChatSettings } from './entities/domain_chat_settings.js';
86
85
  import { SupportConversation } from './entities/support_conversation.js';
87
86
  import { SupportMessage } from './entities/support_message.js';
@@ -229,10 +228,6 @@ var Merchi = /** @class */ (function () {
229
228
  this.Domain = this.setupClass(Domain);
230
229
  this.ExchangeRate = this.setupClass(ExchangeRate);
231
230
  this.Invoice = this.setupClass(Invoice);
232
- this.InvoiceTemplate = this.setupClass(InvoiceTemplate);
233
- this.InvoiceTemplateVersion = this.setupClass(InvoiceTemplateVersion);
234
- this.CompanyInvoiceSettings = this.setupClass(CompanyInvoiceSettings);
235
- this.CompanyInvoiceSettingsVersion = this.setupClass(CompanyInvoiceSettingsVersion);
236
231
  this.Job = this.setupClass(Job);
237
232
  this.ComponentTag = this.setupClass(ComponentTag);
238
233
  this.Category = this.setupClass(Category);
@@ -264,6 +259,9 @@ var Merchi = /** @class */ (function () {
264
259
  this.VariationFieldsOption = this.setupClass(VariationFieldsOption);
265
260
  this.Address = this.setupClass(Address);
266
261
  this.AgentConversation = this.setupClass(AgentConversation);
262
+ this.AgentSkill = this.setupClass(AgentSkill);
263
+ this.AgentSkillVersion = this.setupClass(AgentSkillVersion);
264
+ this.AgentSkillApproval = this.setupClass(AgentSkillApproval);
267
265
  this.DomainChatSettings = this.setupClass(DomainChatSettings);
268
266
  this.SupportConversation = this.setupClass(SupportConversation);
269
267
  this.SupportMessage = this.setupClass(SupportMessage);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_ts",
3
- "version": "1.6.16",
3
+ "version": "1.7.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:merchisdk/merchi_sdk_ts.git",
@@ -0,0 +1,13 @@
1
+ import { Merchi } from '../merchi.js';
2
+
3
+ test('can make AgentSkill', () => {
4
+ const merchi = new Merchi();
5
+ const agentSkill = new merchi.AgentSkill();
6
+ expect(agentSkill).toBeTruthy();
7
+ });
8
+
9
+ test('can make AgentSkillVersion', () => {
10
+ const merchi = new Merchi();
11
+ const version = new merchi.AgentSkillVersion();
12
+ expect(version).toBeTruthy();
13
+ });
@@ -0,0 +1,99 @@
1
+ import { Entity } from '../entity.js';
2
+ import { RequestOptions } from '../request.js';
3
+ import { AgentSkillVersion } from './agent_skill_version.js';
4
+ import { Category } from './category.js';
5
+ import { Domain } from './domain.js';
6
+ import { Product } from './product.js';
7
+
8
+ interface CreateDraftOptions {
9
+ contentMd?: string;
10
+ }
11
+
12
+ export class AgentSkill extends Entity {
13
+ protected static resourceName = 'agent_skills';
14
+ protected static singularName = 'agentSkill';
15
+ protected static pluralName = 'agentSkills';
16
+ protected static primaryKey = 'id';
17
+
18
+ @AgentSkill.property()
19
+ public id?: string;
20
+
21
+ @AgentSkill.property()
22
+ public slug?: string;
23
+
24
+ @AgentSkill.property()
25
+ public title?: string;
26
+
27
+ @AgentSkill.property()
28
+ public scope?: 'global' | 'domain' | 'domain_category' | 'domain_product';
29
+
30
+ @AgentSkill.property({ type: Domain })
31
+ public domain?: Domain | null;
32
+
33
+ @AgentSkill.property({ type: Category })
34
+ public category?: Category | null;
35
+
36
+ @AgentSkill.property({ type: Product })
37
+ public product?: Product | null;
38
+
39
+ @AgentSkill.property()
40
+ public description?: string | null;
41
+
42
+ @AgentSkill.property()
43
+ public priority?: number;
44
+
45
+ @AgentSkill.property({ type: Date })
46
+ public createdAt?: Date | null;
47
+
48
+ @AgentSkill.property({ type: Date })
49
+ public disabledAt?: Date | null;
50
+
51
+ @AgentSkill.property()
52
+ public currentDraftVersionId?: string | null;
53
+
54
+ @AgentSkill.property()
55
+ public currentPublishedVersionId?: string | null;
56
+
57
+ @AgentSkill.property({ arrayType: 'AgentSkillVersion' })
58
+ public versions?: AgentSkillVersion[];
59
+
60
+ public createDraftVersion = (options?: CreateDraftOptions) => {
61
+ const resource = `/agent_skills/${this.id}/versions/`;
62
+ const fetchOptions: RequestOptions = { method: 'POST' };
63
+ if (options && options.contentMd) {
64
+ const body = new FormData();
65
+ body.set('contentMd', options.contentMd);
66
+ fetchOptions.body = body;
67
+ }
68
+ return this.merchi.authenticatedFetch(resource, fetchOptions).then((data: any) => {
69
+ const version = new this.merchi.AgentSkillVersion();
70
+ version.fromJson(data.agentSkillVersion);
71
+ this.currentDraftVersionId = version.id;
72
+ return version;
73
+ });
74
+ };
75
+
76
+ public disable = () => {
77
+ const resource = `/agent_skills/${this.id}/disable/`;
78
+ const fetchOptions: RequestOptions = { method: 'POST' };
79
+ return this.merchi.authenticatedFetch(resource, fetchOptions).then((data: any) => {
80
+ this.fromJson(data.agentSkill);
81
+ return this;
82
+ });
83
+ };
84
+
85
+ public enable = () => {
86
+ const resource = `/agent_skills/${this.id}/enable/`;
87
+ const fetchOptions: RequestOptions = { method: 'POST' };
88
+ return this.merchi.authenticatedFetch(resource, fetchOptions).then((data: any) => {
89
+ this.fromJson(data.agentSkill);
90
+ return this;
91
+ });
92
+ };
93
+
94
+ public getVersionDiff = (versionId: string) => {
95
+ const resource = `/agent_skills/${this.id}/versions/${versionId}/diff/`;
96
+ const fetchOptions: RequestOptions = { method: 'GET' };
97
+ return this.merchi.authenticatedFetch(resource, fetchOptions);
98
+ };
99
+ }