merchi_sdk_ts 1.41.0 → 1.43.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.
@@ -136,6 +136,46 @@ var Cart = /** @class */ (function (_super) {
136
136
  Cart.property(),
137
137
  __metadata("design:type", Boolean)
138
138
  ], Cart.prototype, "sendWhatsapp", void 0);
139
+ __decorate([
140
+ Cart.property(),
141
+ __metadata("design:type", Boolean)
142
+ ], Cart.prototype, "isTest", void 0);
143
+ __decorate([
144
+ Cart.property({ type: String }),
145
+ __metadata("design:type", Object)
146
+ ], Cart.prototype, "sourceChannel", void 0);
147
+ __decorate([
148
+ Cart.property({ type: String }),
149
+ __metadata("design:type", Object)
150
+ ], Cart.prototype, "utmSource", void 0);
151
+ __decorate([
152
+ Cart.property({ type: String }),
153
+ __metadata("design:type", Object)
154
+ ], Cart.prototype, "utmMedium", void 0);
155
+ __decorate([
156
+ Cart.property({ type: String }),
157
+ __metadata("design:type", Object)
158
+ ], Cart.prototype, "utmCampaign", void 0);
159
+ __decorate([
160
+ Cart.property({ type: String }),
161
+ __metadata("design:type", Object)
162
+ ], Cart.prototype, "utmContent", void 0);
163
+ __decorate([
164
+ Cart.property({ type: String }),
165
+ __metadata("design:type", Object)
166
+ ], Cart.prototype, "utmTerm", void 0);
167
+ __decorate([
168
+ Cart.property({ type: String }),
169
+ __metadata("design:type", Object)
170
+ ], Cart.prototype, "sourceClickId", void 0);
171
+ __decorate([
172
+ Cart.property({ type: String }),
173
+ __metadata("design:type", Object)
174
+ ], Cart.prototype, "sourceLanding", void 0);
175
+ __decorate([
176
+ Cart.property({ type: String }),
177
+ __metadata("design:type", Object)
178
+ ], Cart.prototype, "sourceReferrer", void 0);
139
179
  __decorate([
140
180
  Cart.property({ type: 'User' }),
141
181
  __metadata("design:type", Object)
@@ -49,3 +49,24 @@ test('preserves server payment engine hint', function () {
49
49
  entity.fromJson({ id: 1, stripePaymentEngine: 'wallet' });
50
50
  expect(entity.toJson()).toMatchObject({ stripePaymentEngine: 'wallet' });
51
51
  });
52
+ test('preserves isTest', function () {
53
+ var merchi = new Merchi();
54
+ var entity = new merchi.Cart();
55
+ entity.fromJson({ id: 1, isTest: true });
56
+ expect(entity.toJson()).toMatchObject({ isTest: true });
57
+ });
58
+ test('preserves source attribution', function () {
59
+ var merchi = new Merchi();
60
+ var entity = new merchi.Cart();
61
+ entity.fromJson({
62
+ id: 1,
63
+ sourceChannel: 'meta',
64
+ utmSource: 'facebook',
65
+ sourceClickId: 'IwAR',
66
+ });
67
+ expect(entity.toJson()).toMatchObject({
68
+ sourceChannel: 'meta',
69
+ utmSource: 'facebook',
70
+ sourceClickId: 'IwAR',
71
+ });
72
+ });
@@ -119,6 +119,10 @@ var Invoice = /** @class */ (function (_super) {
119
119
  Invoice.property({ type: Boolean }),
120
120
  __metadata("design:type", Object)
121
121
  ], Invoice.prototype, "unpaid", void 0);
122
+ __decorate([
123
+ Invoice.property({ type: Boolean }),
124
+ __metadata("design:type", Object)
125
+ ], Invoice.prototype, "isTest", void 0);
122
126
  __decorate([
123
127
  Invoice.property(),
124
128
  __metadata("design:type", String)
@@ -374,6 +374,42 @@ var Job = /** @class */ (function (_super) {
374
374
  Job.property(),
375
375
  __metadata("design:type", String)
376
376
  ], Job.prototype, "clientOrigin", void 0);
377
+ __decorate([
378
+ Job.property({ type: String }),
379
+ __metadata("design:type", Object)
380
+ ], Job.prototype, "sourceChannel", void 0);
381
+ __decorate([
382
+ Job.property({ type: String }),
383
+ __metadata("design:type", Object)
384
+ ], Job.prototype, "utmSource", void 0);
385
+ __decorate([
386
+ Job.property({ type: String }),
387
+ __metadata("design:type", Object)
388
+ ], Job.prototype, "utmMedium", void 0);
389
+ __decorate([
390
+ Job.property({ type: String }),
391
+ __metadata("design:type", Object)
392
+ ], Job.prototype, "utmCampaign", void 0);
393
+ __decorate([
394
+ Job.property({ type: String }),
395
+ __metadata("design:type", Object)
396
+ ], Job.prototype, "utmContent", void 0);
397
+ __decorate([
398
+ Job.property({ type: String }),
399
+ __metadata("design:type", Object)
400
+ ], Job.prototype, "utmTerm", void 0);
401
+ __decorate([
402
+ Job.property({ type: String }),
403
+ __metadata("design:type", Object)
404
+ ], Job.prototype, "sourceClickId", void 0);
405
+ __decorate([
406
+ Job.property({ type: String }),
407
+ __metadata("design:type", Object)
408
+ ], Job.prototype, "sourceLanding", void 0);
409
+ __decorate([
410
+ Job.property({ type: String }),
411
+ __metadata("design:type", Object)
412
+ ], Job.prototype, "sourceReferrer", void 0);
377
413
  __decorate([
378
414
  Job.property({ type: User }),
379
415
  __metadata("design:type", Object)
@@ -514,6 +550,10 @@ var Job = /** @class */ (function (_super) {
514
550
  Job.property(),
515
551
  __metadata("design:type", Boolean)
516
552
  ], Job.prototype, "isNewClient", void 0);
553
+ __decorate([
554
+ Job.property(),
555
+ __metadata("design:type", Boolean)
556
+ ], Job.prototype, "isTest", void 0);
517
557
  return Job;
518
558
  }(Entity));
519
559
  export { Job };
@@ -7,6 +7,31 @@ test('can make Job', function () {
7
7
  var job = new merchi.Job();
8
8
  expect(job).toBeTruthy();
9
9
  });
10
+ test('preserves isTest', function () {
11
+ var merchi = new Merchi();
12
+ var job = new merchi.Job();
13
+ job.fromJson({ id: 1, isTest: true });
14
+ expect(job.toJson()).toMatchObject({ isTest: true });
15
+ });
16
+ test('preserves source attribution', function () {
17
+ var merchi = new Merchi();
18
+ var job = new merchi.Job();
19
+ job.fromJson({
20
+ id: 1,
21
+ sourceChannel: 'google_ads',
22
+ utmSource: 'google',
23
+ utmMedium: 'cpc',
24
+ utmCampaign: 'wristbands',
25
+ sourceClickId: 'EAIa',
26
+ });
27
+ expect(job.toJson()).toMatchObject({
28
+ sourceChannel: 'google_ads',
29
+ utmSource: 'google',
30
+ utmMedium: 'cpc',
31
+ utmCampaign: 'wristbands',
32
+ sourceClickId: 'EAIa',
33
+ });
34
+ });
10
35
  test('Job deadline serialised to milliseconds in form data', function () {
11
36
  var merchi = new Merchi();
12
37
  var job = new merchi.Job();
package/dist/entity.js CHANGED
@@ -688,6 +688,12 @@ var Entity = /** @class */ (function () {
688
688
  if (options.isDraft !== undefined) {
689
689
  fetchOptions.query.push(['is_draft', options.isDraft.toString()]);
690
690
  }
691
+ if (options.isTest !== undefined) {
692
+ fetchOptions.query.push(['is_test', options.isTest.toString()]);
693
+ }
694
+ if (options.sourceChannel !== undefined) {
695
+ fetchOptions.query.push(['source_channel', options.sourceChannel.toString()]);
696
+ }
691
697
  if (options.managedOnly !== undefined) {
692
698
  fetchOptions.query.push(['managed_only',
693
699
  options.managedOnly.toString()]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merchi_sdk_ts",
3
- "version": "1.41.0",
3
+ "version": "1.43.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:merchisdk/merchi_sdk_ts.git",
@@ -55,3 +55,26 @@ test('preserves server payment engine hint', () => {
55
55
  entity.fromJson({ id: 1, stripePaymentEngine: 'wallet' });
56
56
  expect(entity.toJson()).toMatchObject({ stripePaymentEngine: 'wallet' });
57
57
  });
58
+
59
+ test('preserves isTest', () => {
60
+ const merchi = new Merchi();
61
+ const entity = new merchi.Cart();
62
+ entity.fromJson({ id: 1, isTest: true });
63
+ expect(entity.toJson()).toMatchObject({ isTest: true });
64
+ });
65
+
66
+ test('preserves source attribution', () => {
67
+ const merchi = new Merchi();
68
+ const entity = new merchi.Cart();
69
+ entity.fromJson({
70
+ id: 1,
71
+ sourceChannel: 'meta',
72
+ utmSource: 'facebook',
73
+ sourceClickId: 'IwAR',
74
+ });
75
+ expect(entity.toJson()).toMatchObject({
76
+ sourceChannel: 'meta',
77
+ utmSource: 'facebook',
78
+ sourceClickId: 'IwAR',
79
+ });
80
+ });
@@ -64,6 +64,36 @@ export class Cart extends Entity {
64
64
  @Cart.property()
65
65
  public sendWhatsapp?: boolean;
66
66
 
67
+ @Cart.property()
68
+ public isTest?: boolean;
69
+
70
+ @Cart.property({type: String})
71
+ public sourceChannel?: string | null;
72
+
73
+ @Cart.property({type: String})
74
+ public utmSource?: string | null;
75
+
76
+ @Cart.property({type: String})
77
+ public utmMedium?: string | null;
78
+
79
+ @Cart.property({type: String})
80
+ public utmCampaign?: string | null;
81
+
82
+ @Cart.property({type: String})
83
+ public utmContent?: string | null;
84
+
85
+ @Cart.property({type: String})
86
+ public utmTerm?: string | null;
87
+
88
+ @Cart.property({type: String})
89
+ public sourceClickId?: string | null;
90
+
91
+ @Cart.property({type: String})
92
+ public sourceLanding?: string | null;
93
+
94
+ @Cart.property({type: String})
95
+ public sourceReferrer?: string | null;
96
+
67
97
  @Cart.property({type: 'User'})
68
98
  public client?: User | null;
69
99
 
@@ -82,6 +82,9 @@ export class Invoice extends Entity {
82
82
  @Invoice.property({type: Boolean})
83
83
  public unpaid?: boolean | null;
84
84
 
85
+ @Invoice.property({type: Boolean})
86
+ public isTest?: boolean | null;
87
+
85
88
  @Invoice.property()
86
89
  public currency?: string;
87
90
 
@@ -10,6 +10,33 @@ test('can make Job', () => {
10
10
  expect(job).toBeTruthy();
11
11
  });
12
12
 
13
+ test('preserves isTest', () => {
14
+ const merchi = new Merchi();
15
+ const job = new merchi.Job();
16
+ job.fromJson({ id: 1, isTest: true });
17
+ expect(job.toJson()).toMatchObject({ isTest: true });
18
+ });
19
+
20
+ test('preserves source attribution', () => {
21
+ const merchi = new Merchi();
22
+ const job = new merchi.Job();
23
+ job.fromJson({
24
+ id: 1,
25
+ sourceChannel: 'google_ads',
26
+ utmSource: 'google',
27
+ utmMedium: 'cpc',
28
+ utmCampaign: 'wristbands',
29
+ sourceClickId: 'EAIa',
30
+ });
31
+ expect(job.toJson()).toMatchObject({
32
+ sourceChannel: 'google_ads',
33
+ utmSource: 'google',
34
+ utmMedium: 'cpc',
35
+ utmCampaign: 'wristbands',
36
+ sourceClickId: 'EAIa',
37
+ });
38
+ });
39
+
13
40
  test('Job deadline serialised to milliseconds in form data', () => {
14
41
  const merchi = new Merchi();
15
42
  const job = new merchi.Job();
@@ -249,6 +249,33 @@ export class Job extends Entity {
249
249
  @Job.property()
250
250
  public clientOrigin?: string;
251
251
 
252
+ @Job.property({type: String})
253
+ public sourceChannel?: string | null;
254
+
255
+ @Job.property({type: String})
256
+ public utmSource?: string | null;
257
+
258
+ @Job.property({type: String})
259
+ public utmMedium?: string | null;
260
+
261
+ @Job.property({type: String})
262
+ public utmCampaign?: string | null;
263
+
264
+ @Job.property({type: String})
265
+ public utmContent?: string | null;
266
+
267
+ @Job.property({type: String})
268
+ public utmTerm?: string | null;
269
+
270
+ @Job.property({type: String})
271
+ public sourceClickId?: string | null;
272
+
273
+ @Job.property({type: String})
274
+ public sourceLanding?: string | null;
275
+
276
+ @Job.property({type: String})
277
+ public sourceReferrer?: string | null;
278
+
252
279
  @Job.property({type: User})
253
280
  public manager?: User | null;
254
281
 
@@ -354,6 +381,9 @@ export class Job extends Entity {
354
381
  @Job.property()
355
382
  public isNewClient?: boolean;
356
383
 
384
+ @Job.property()
385
+ public isTest?: boolean;
386
+
357
387
  public getQuote = () => {
358
388
  const resource = '/specialised-order-estimate/';
359
389
  const data = this.toFormData({excludeOld: false});
package/src/entity.ts CHANGED
@@ -130,6 +130,8 @@ interface ListOptions {
130
130
  productTypes?: ProductType[];
131
131
  publicOnly?: boolean;
132
132
  isDraft?: boolean;
133
+ isTest?: boolean;
134
+ sourceChannel?: string;
133
135
  q?: string;
134
136
  receiverId?: number;
135
137
  userAsReceiver?: number;
@@ -498,6 +500,12 @@ export class Entity {
498
500
  if (options.isDraft !== undefined) {
499
501
  fetchOptions.query.push(['is_draft', options.isDraft.toString()]);
500
502
  }
503
+ if (options.isTest !== undefined) {
504
+ fetchOptions.query.push(['is_test', options.isTest.toString()]);
505
+ }
506
+ if (options.sourceChannel !== undefined) {
507
+ fetchOptions.query.push(['source_channel', options.sourceChannel.toString()]);
508
+ }
501
509
  if (options.managedOnly !== undefined) {
502
510
  fetchOptions.query.push(['managed_only',
503
511
  options.managedOnly.toString()]);