merchi_sdk_ts 1.42.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.
- package/dist/entities/cart.js +36 -0
- package/dist/entities/cart.test.js +15 -0
- package/dist/entities/job.js +36 -0
- package/dist/entities/job.test.js +19 -0
- package/dist/entity.js +3 -0
- package/package.json +1 -1
- package/src/entities/cart.test.ts +16 -0
- package/src/entities/cart.ts +27 -0
- package/src/entities/job.test.ts +20 -0
- package/src/entities/job.ts +27 -0
- package/src/entity.ts +4 -0
package/dist/entities/cart.js
CHANGED
|
@@ -140,6 +140,42 @@ var Cart = /** @class */ (function (_super) {
|
|
|
140
140
|
Cart.property(),
|
|
141
141
|
__metadata("design:type", Boolean)
|
|
142
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);
|
|
143
179
|
__decorate([
|
|
144
180
|
Cart.property({ type: 'User' }),
|
|
145
181
|
__metadata("design:type", Object)
|
|
@@ -55,3 +55,18 @@ test('preserves isTest', function () {
|
|
|
55
55
|
entity.fromJson({ id: 1, isTest: true });
|
|
56
56
|
expect(entity.toJson()).toMatchObject({ isTest: true });
|
|
57
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
|
+
});
|
package/dist/entities/job.js
CHANGED
|
@@ -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)
|
|
@@ -13,6 +13,25 @@ test('preserves isTest', function () {
|
|
|
13
13
|
job.fromJson({ id: 1, isTest: true });
|
|
14
14
|
expect(job.toJson()).toMatchObject({ isTest: true });
|
|
15
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
|
+
});
|
|
16
35
|
test('Job deadline serialised to milliseconds in form data', function () {
|
|
17
36
|
var merchi = new Merchi();
|
|
18
37
|
var job = new merchi.Job();
|
package/dist/entity.js
CHANGED
|
@@ -691,6 +691,9 @@ var Entity = /** @class */ (function () {
|
|
|
691
691
|
if (options.isTest !== undefined) {
|
|
692
692
|
fetchOptions.query.push(['is_test', options.isTest.toString()]);
|
|
693
693
|
}
|
|
694
|
+
if (options.sourceChannel !== undefined) {
|
|
695
|
+
fetchOptions.query.push(['source_channel', options.sourceChannel.toString()]);
|
|
696
|
+
}
|
|
694
697
|
if (options.managedOnly !== undefined) {
|
|
695
698
|
fetchOptions.query.push(['managed_only',
|
|
696
699
|
options.managedOnly.toString()]);
|
package/package.json
CHANGED
|
@@ -62,3 +62,19 @@ test('preserves isTest', () => {
|
|
|
62
62
|
entity.fromJson({ id: 1, isTest: true });
|
|
63
63
|
expect(entity.toJson()).toMatchObject({ isTest: true });
|
|
64
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
|
+
});
|
package/src/entities/cart.ts
CHANGED
|
@@ -67,6 +67,33 @@ export class Cart extends Entity {
|
|
|
67
67
|
@Cart.property()
|
|
68
68
|
public isTest?: boolean;
|
|
69
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
|
+
|
|
70
97
|
@Cart.property({type: 'User'})
|
|
71
98
|
public client?: User | null;
|
|
72
99
|
|
package/src/entities/job.test.ts
CHANGED
|
@@ -17,6 +17,26 @@ test('preserves isTest', () => {
|
|
|
17
17
|
expect(job.toJson()).toMatchObject({ isTest: true });
|
|
18
18
|
});
|
|
19
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
|
+
|
|
20
40
|
test('Job deadline serialised to milliseconds in form data', () => {
|
|
21
41
|
const merchi = new Merchi();
|
|
22
42
|
const job = new merchi.Job();
|
package/src/entities/job.ts
CHANGED
|
@@ -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
|
|
package/src/entity.ts
CHANGED
|
@@ -131,6 +131,7 @@ interface ListOptions {
|
|
|
131
131
|
publicOnly?: boolean;
|
|
132
132
|
isDraft?: boolean;
|
|
133
133
|
isTest?: boolean;
|
|
134
|
+
sourceChannel?: string;
|
|
134
135
|
q?: string;
|
|
135
136
|
receiverId?: number;
|
|
136
137
|
userAsReceiver?: number;
|
|
@@ -502,6 +503,9 @@ export class Entity {
|
|
|
502
503
|
if (options.isTest !== undefined) {
|
|
503
504
|
fetchOptions.query.push(['is_test', options.isTest.toString()]);
|
|
504
505
|
}
|
|
506
|
+
if (options.sourceChannel !== undefined) {
|
|
507
|
+
fetchOptions.query.push(['source_channel', options.sourceChannel.toString()]);
|
|
508
|
+
}
|
|
505
509
|
if (options.managedOnly !== undefined) {
|
|
506
510
|
fetchOptions.query.push(['managed_only',
|
|
507
511
|
options.managedOnly.toString()]);
|