merchi_sdk_ts 1.3.2 → 1.3.3

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.
@@ -77,6 +77,10 @@ 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", Boolean)
83
+ ], DomainChatSettings.prototype, "requireGuestContact", void 0);
80
84
  return DomainChatSettings;
81
85
  }(Entity));
82
86
  export { DomainChatSettings };
@@ -235,6 +235,7 @@ test('can list products with options set', function () {
235
235
  companyId: 91,
236
236
  companySupplierId: 100,
237
237
  componentId: 37,
238
+ conversationId: 1,
238
239
  dateFrom: new Date(0),
239
240
  dateTo: new Date(1),
240
241
  doesNotHaveAdminDomain: false,
@@ -24,6 +24,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
24
24
  };
25
25
  import { Domain } from './domain.js';
26
26
  import { Entity } from '../entity.js';
27
+ import { User } from './user.js';
27
28
  var SupportConversation = /** @class */ (function (_super) {
28
29
  __extends(SupportConversation, _super);
29
30
  function SupportConversation() {
@@ -45,15 +46,35 @@ var SupportConversation = /** @class */ (function (_super) {
45
46
  __metadata("design:type", Object)
46
47
  ], SupportConversation.prototype, "lastMessageAt", void 0);
47
48
  __decorate([
48
- SupportConversation.property(),
49
+ SupportConversation.property({ type: Date }),
50
+ __metadata("design:type", Object)
51
+ ], SupportConversation.prototype, "archivedAt", void 0);
52
+ __decorate([
53
+ SupportConversation.property({ type: Domain }),
49
54
  __metadata("design:type", Domain)
50
55
  ], SupportConversation.prototype, "domain", void 0);
51
56
  __decorate([
52
- SupportConversation.property(),
57
+ SupportConversation.property({ arrayType: 'DomainTag' }),
58
+ __metadata("design:type", Array)
59
+ ], SupportConversation.prototype, "tags", void 0);
60
+ __decorate([
61
+ SupportConversation.property({ type: String }),
53
62
  __metadata("design:type", Object)
54
63
  ], SupportConversation.prototype, "guestId", void 0);
55
64
  __decorate([
56
- SupportConversation.property(),
65
+ SupportConversation.property({ type: String }),
66
+ __metadata("design:type", Object)
67
+ ], SupportConversation.prototype, "guestContactEmail", void 0);
68
+ __decorate([
69
+ SupportConversation.property({ type: String }),
70
+ __metadata("design:type", Object)
71
+ ], SupportConversation.prototype, "guestContactName", void 0);
72
+ __decorate([
73
+ SupportConversation.property({ type: String }),
74
+ __metadata("design:type", Object)
75
+ ], SupportConversation.prototype, "clientFingerprint", void 0);
76
+ __decorate([
77
+ SupportConversation.property({ type: User }),
57
78
  __metadata("design:type", Object)
58
79
  ], SupportConversation.prototype, "user", void 0);
59
80
  __decorate([
@@ -0,0 +1,6 @@
1
+ import { Merchi } from '../merchi.js';
2
+ test('can make SupportConversation', function () {
3
+ var merchi = new Merchi();
4
+ var supportConversation = new merchi.SupportConversation();
5
+ expect(supportConversation).toBeTruthy();
6
+ });
@@ -23,6 +23,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
23
23
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
24
24
  };
25
25
  import { Entity } from '../entity.js';
26
+ import { SupportConversation } from './support_conversation.js';
27
+ import { User } from './user.js';
26
28
  var SupportMessage = /** @class */ (function (_super) {
27
29
  __extends(SupportMessage, _super);
28
30
  function SupportMessage() {
@@ -36,19 +38,19 @@ var SupportMessage = /** @class */ (function (_super) {
36
38
  __metadata("design:type", Number)
37
39
  ], SupportMessage.prototype, "id", void 0);
38
40
  __decorate([
39
- SupportMessage.property(),
40
- __metadata("design:type", Number)
41
- ], SupportMessage.prototype, "conversationId", void 0);
41
+ SupportMessage.property({ type: SupportConversation }),
42
+ __metadata("design:type", SupportConversation)
43
+ ], SupportMessage.prototype, "conversation", void 0);
42
44
  __decorate([
43
- SupportMessage.property(),
45
+ SupportMessage.property({ type: String }),
44
46
  __metadata("design:type", String)
45
47
  ], SupportMessage.prototype, "senderType", void 0);
46
48
  __decorate([
47
- SupportMessage.property(),
49
+ SupportMessage.property({ type: User }),
48
50
  __metadata("design:type", Object)
49
51
  ], SupportMessage.prototype, "user", void 0);
50
52
  __decorate([
51
- SupportMessage.property(),
53
+ SupportMessage.property({ type: String }),
52
54
  __metadata("design:type", String)
53
55
  ], SupportMessage.prototype, "content", void 0);
54
56
  __decorate([
@@ -0,0 +1,6 @@
1
+ import { Merchi } from '../merchi.js';
2
+ test('can make SupportMessage', function () {
3
+ var merchi = new Merchi();
4
+ var supportMessage = new merchi.SupportMessage();
5
+ expect(supportMessage).toBeTruthy();
6
+ });
package/dist/entity.js CHANGED
@@ -814,6 +814,10 @@ var Entity = /** @class */ (function () {
814
814
  fetchOptions.query.push(['component_id',
815
815
  options.componentId.toString()]);
816
816
  }
817
+ if (options.conversationId !== undefined) {
818
+ fetchOptions.query.push(['conversation_id',
819
+ options.conversationId.toString()]);
820
+ }
817
821
  if (options.groupBuyForJobId !== undefined) {
818
822
  fetchOptions.query.push(['group_buy_for_job_id',
819
823
  options.groupBuyForJobId.toString()]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_ts",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:merchisdk/merchi_sdk_ts.git",
@@ -39,4 +39,7 @@ export class DomainChatSettings extends Entity {
39
39
 
40
40
  @DomainChatSettings.property()
41
41
  public notifyEmailNewMessage?: boolean;
42
+
43
+ @DomainChatSettings.property()
44
+ public requireGuestContact?: boolean;
42
45
  }
@@ -259,6 +259,7 @@ test('can list products with options set', () => {
259
259
  companyId: 91,
260
260
  companySupplierId: 100,
261
261
  componentId: 37,
262
+ conversationId: 1,
262
263
  dateFrom: new Date(0),
263
264
  dateTo: new Date(1),
264
265
  doesNotHaveAdminDomain: false,
@@ -0,0 +1,7 @@
1
+ import { Merchi } from '../merchi.js';
2
+
3
+ test('can make SupportConversation', () => {
4
+ const merchi = new Merchi();
5
+ const supportConversation = new merchi.SupportConversation();
6
+ expect(supportConversation).toBeTruthy();
7
+ });
@@ -1,4 +1,5 @@
1
1
  import { Domain } from './domain.js';
2
+ import { DomainTag } from './domain_tag.js';
2
3
  import { Entity } from '../entity.js';
3
4
  import { User } from './user.js';
4
5
  import { SupportMessage } from './support_message.js';
@@ -17,13 +18,29 @@ export class SupportConversation extends Entity {
17
18
  @SupportConversation.property({ type: Date })
18
19
  public lastMessageAt?: Date | null;
19
20
 
20
- @SupportConversation.property()
21
+ @SupportConversation.property({ type: Date })
22
+ public archivedAt?: Date | null;
23
+
24
+ @SupportConversation.property({ type: Domain })
21
25
  public domain?: Domain;
22
26
 
23
- @SupportConversation.property()
27
+ @SupportConversation.property({ arrayType: 'DomainTag' })
28
+ public tags?: DomainTag[];
29
+
30
+ @SupportConversation.property({ type: String })
24
31
  public guestId?: string | null;
25
32
 
26
- @SupportConversation.property()
33
+ @SupportConversation.property({ type: String })
34
+ public guestContactEmail?: string | null;
35
+
36
+ @SupportConversation.property({ type: String })
37
+ public guestContactName?: string | null;
38
+
39
+ /** Opaque client fingerprint for repeat-visitor / spam correlation (max 512 chars). */
40
+ @SupportConversation.property({ type: String })
41
+ public clientFingerprint?: string | null;
42
+
43
+ @SupportConversation.property({ type: User })
27
44
  public user?: User | null;
28
45
 
29
46
  @SupportConversation.property({ arrayType: 'SupportMessage' })
@@ -0,0 +1,7 @@
1
+ import { Merchi } from '../merchi.js';
2
+
3
+ test('can make SupportMessage', () => {
4
+ const merchi = new Merchi();
5
+ const supportMessage = new merchi.SupportMessage();
6
+ expect(supportMessage).toBeTruthy();
7
+ });
@@ -1,4 +1,5 @@
1
1
  import { Entity } from '../entity.js';
2
+ import { SupportConversation } from './support_conversation.js';
2
3
  import { User } from './user.js';
3
4
 
4
5
  export class SupportMessage extends Entity {
@@ -9,16 +10,16 @@ export class SupportMessage extends Entity {
9
10
  @SupportMessage.property()
10
11
  public id?: number;
11
12
 
12
- @SupportMessage.property()
13
- public conversationId?: number;
13
+ @SupportMessage.property({ type: SupportConversation })
14
+ public conversation?: SupportConversation;
14
15
 
15
- @SupportMessage.property()
16
+ @SupportMessage.property({ type: String })
16
17
  public senderType?: string; // 'guest' | 'manager'
17
18
 
18
- @SupportMessage.property()
19
+ @SupportMessage.property({ type: User })
19
20
  public user?: User | null;
20
21
 
21
- @SupportMessage.property()
22
+ @SupportMessage.property({ type: String })
22
23
  public content?: string;
23
24
 
24
25
  @SupportMessage.property({ type: Date })
package/src/entity.ts CHANGED
@@ -85,6 +85,7 @@ interface ListOptions {
85
85
  companyId?: number;
86
86
  companySupplierId?: number;
87
87
  componentId?: number;
88
+ conversationId?: number;
88
89
  dateFrom?: Date;
89
90
  dateTo?: Date;
90
91
  domainRoles?: Role[];
@@ -615,6 +616,10 @@ export class Entity {
615
616
  fetchOptions.query.push(['component_id',
616
617
  options.componentId.toString()]);
617
618
  }
619
+ if (options.conversationId !== undefined) {
620
+ fetchOptions.query.push(['conversation_id',
621
+ options.conversationId.toString()]);
622
+ }
618
623
  if (options.groupBuyForJobId !== undefined) {
619
624
  fetchOptions.query.push(['group_buy_for_job_id',
620
625
  options.groupBuyForJobId.toString()]);