@capillarytech/creatives-library 8.0.286 → 8.0.287-alpha.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/constants/unified.js +0 -1
- package/initialState.js +0 -2
- package/package.json +1 -1
- package/utils/common.js +5 -8
- package/utils/commonUtils.js +2 -83
- package/utils/tagValidations.js +84 -222
- package/utils/tests/commonUtil.test.js +147 -118
- package/utils/tests/tagValidations.test.js +280 -358
- package/v2Components/ErrorInfoNote/index.js +2 -5
- package/v2Components/FormBuilder/index.js +64 -158
- package/v2Components/FormBuilder/messages.js +0 -8
- package/v2Components/HtmlEditor/HTMLEditor.js +0 -5
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +0 -15
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +1 -2
- package/v2Containers/Cap/mockData.js +0 -14
- package/v2Containers/Cap/reducer.js +3 -55
- package/v2Containers/Cap/tests/reducer.test.js +0 -102
- package/v2Containers/CreativesContainer/index.js +0 -1
- package/v2Containers/Email/index.js +1 -5
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +10 -62
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +12 -115
- package/v2Containers/FTP/index.js +2 -51
- package/v2Containers/FTP/messages.js +0 -4
- package/v2Containers/InApp/index.js +1 -96
- package/v2Containers/InApp/tests/index.test.js +17 -6
- package/v2Containers/InappAdvance/index.js +2 -103
- package/v2Containers/Line/Container/Text/index.js +0 -1
- package/v2Containers/MobilePushNew/index.js +2 -33
- package/v2Containers/Rcs/index.js +12 -37
- package/v2Containers/SmsTrai/Create/index.scss +1 -1
- package/v2Containers/SmsTrai/Edit/index.js +6 -47
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +6 -6
- package/v2Containers/Viber/index.js +0 -1
- package/v2Containers/Viber/index.scss +1 -1
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +1 -3
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -7
- package/v2Containers/WebPush/Create/index.js +2 -2
- package/v2Containers/WebPush/Create/utils/validation.js +18 -9
- package/v2Containers/WebPush/Create/utils/validation.test.js +0 -24
- package/v2Containers/Whatsapp/index.js +9 -17
- package/v2Containers/Zalo/index.js +3 -11
|
@@ -20,13 +20,17 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
20
20
|
somethingWentWrong: { id: "wrong" },
|
|
21
21
|
unsupportedTagsValidationError: { id: "unsupported" }
|
|
22
22
|
};
|
|
23
|
-
const tagLookupMap = { foo: true };
|
|
24
23
|
const eventContextTags = [{ tagName: "bar" }];
|
|
25
24
|
const onError = jest.fn();
|
|
26
25
|
const onSuccess = jest.fn();
|
|
27
26
|
|
|
28
27
|
beforeEach(() => {
|
|
29
28
|
jest.clearAllMocks();
|
|
29
|
+
formatMessage.mockImplementation((msg, vars) =>
|
|
30
|
+
vars && vars.unsupportedTags != null
|
|
31
|
+
? `${msg?.id}:${vars.unsupportedTags}`
|
|
32
|
+
: (msg?.id ?? "unsupported")
|
|
33
|
+
);
|
|
30
34
|
});
|
|
31
35
|
|
|
32
36
|
it("calls onError for empty content", async () => {
|
|
@@ -39,11 +43,10 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
39
43
|
messages,
|
|
40
44
|
onError,
|
|
41
45
|
onSuccess,
|
|
42
|
-
tagLookupMap,
|
|
43
46
|
eventContextTags
|
|
44
47
|
});
|
|
45
48
|
expect(onError).toHaveBeenCalledWith({
|
|
46
|
-
standardErrors: [
|
|
49
|
+
standardErrors: ["empty"],
|
|
47
50
|
liquidErrors: [],
|
|
48
51
|
tabType: undefined
|
|
49
52
|
});
|
|
@@ -58,7 +61,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
58
61
|
getLiquidTags,
|
|
59
62
|
formatMessage,
|
|
60
63
|
messages,
|
|
61
|
-
tagLookupMap,
|
|
62
64
|
eventContextTags
|
|
63
65
|
});
|
|
64
66
|
expect(onError).not.toHaveBeenCalled();
|
|
@@ -75,7 +77,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
75
77
|
messages,
|
|
76
78
|
onError,
|
|
77
79
|
onSuccess,
|
|
78
|
-
tagLookupMap,
|
|
79
80
|
eventContextTags
|
|
80
81
|
});
|
|
81
82
|
expect(onError).toHaveBeenCalledWith({
|
|
@@ -86,9 +87,15 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
86
87
|
expect(onSuccess).not.toHaveBeenCalled();
|
|
87
88
|
});
|
|
88
89
|
|
|
89
|
-
it("calls onError
|
|
90
|
+
it("calls onError when API returns success but response.errors has validation errors (e.g. unsupported tag)", async () => {
|
|
90
91
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
91
|
-
cb({
|
|
92
|
+
cb({
|
|
93
|
+
askAiraResponse: {
|
|
94
|
+
errors: [{ message: "Unsupported tag: custom_tag" }],
|
|
95
|
+
data: []
|
|
96
|
+
},
|
|
97
|
+
isError: false
|
|
98
|
+
})
|
|
92
99
|
);
|
|
93
100
|
await validateLiquidTemplateContent("foo", {
|
|
94
101
|
getLiquidTags,
|
|
@@ -96,18 +103,33 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
96
103
|
messages,
|
|
97
104
|
onError,
|
|
98
105
|
onSuccess,
|
|
99
|
-
tagLookupMap,
|
|
100
106
|
eventContextTags
|
|
101
107
|
});
|
|
102
108
|
expect(onError).toHaveBeenCalledWith({
|
|
103
109
|
standardErrors: [],
|
|
104
|
-
liquidErrors: [
|
|
110
|
+
liquidErrors: ["Unsupported tag: custom_tag"],
|
|
105
111
|
tabType: undefined
|
|
106
112
|
});
|
|
107
113
|
expect(onSuccess).not.toHaveBeenCalled();
|
|
108
114
|
});
|
|
109
115
|
|
|
110
|
-
it("calls onSuccess
|
|
116
|
+
it("calls onSuccess when API returns no errors and a single extracted tag (extracted tags are not validated)", async () => {
|
|
117
|
+
const getLiquidTags = jest.fn((content, cb) =>
|
|
118
|
+
cb({ askAiraResponse: { errors: [], data: [{ name: "foo" }] }, isError: false })
|
|
119
|
+
);
|
|
120
|
+
await validateLiquidTemplateContent("foo", {
|
|
121
|
+
getLiquidTags,
|
|
122
|
+
formatMessage,
|
|
123
|
+
messages,
|
|
124
|
+
onError,
|
|
125
|
+
onSuccess,
|
|
126
|
+
eventContextTags
|
|
127
|
+
});
|
|
128
|
+
expect(onSuccess).toHaveBeenCalledWith("foo", undefined);
|
|
129
|
+
expect(onError).not.toHaveBeenCalled();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("calls onSuccess for valid content when API returns multiple extracted tags but no errors", async () => {
|
|
111
133
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
112
134
|
cb({ askAiraResponse: { errors: [], data: [{ name: "foo" }, { name: "bar" }] }, isError: false })
|
|
113
135
|
);
|
|
@@ -117,7 +139,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
117
139
|
messages,
|
|
118
140
|
onError,
|
|
119
141
|
onSuccess,
|
|
120
|
-
tagLookupMap,
|
|
121
142
|
eventContextTags
|
|
122
143
|
});
|
|
123
144
|
expect(onSuccess).toHaveBeenCalledWith("foo", undefined);
|
|
@@ -133,7 +154,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
133
154
|
messages,
|
|
134
155
|
onError,
|
|
135
156
|
onSuccess,
|
|
136
|
-
tagLookupMap,
|
|
137
157
|
eventContextTags,
|
|
138
158
|
skipTags
|
|
139
159
|
});
|
|
@@ -151,7 +171,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
151
171
|
messages,
|
|
152
172
|
onError,
|
|
153
173
|
onSuccess,
|
|
154
|
-
tagLookupMap,
|
|
155
174
|
eventContextTags,
|
|
156
175
|
skipTags
|
|
157
176
|
});
|
|
@@ -169,7 +188,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
169
188
|
messages,
|
|
170
189
|
onError,
|
|
171
190
|
onSuccess,
|
|
172
|
-
tagLookupMap,
|
|
173
191
|
eventContextTags,
|
|
174
192
|
skipTags
|
|
175
193
|
});
|
|
@@ -187,7 +205,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
187
205
|
messages,
|
|
188
206
|
onError,
|
|
189
207
|
onSuccess,
|
|
190
|
-
tagLookupMap,
|
|
191
208
|
eventContextTags,
|
|
192
209
|
skipTags
|
|
193
210
|
});
|
|
@@ -205,7 +222,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
205
222
|
messages,
|
|
206
223
|
onError,
|
|
207
224
|
onSuccess,
|
|
208
|
-
tagLookupMap,
|
|
209
225
|
eventContextTags,
|
|
210
226
|
skipTags
|
|
211
227
|
});
|
|
@@ -223,7 +239,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
223
239
|
messages,
|
|
224
240
|
onError,
|
|
225
241
|
onSuccess,
|
|
226
|
-
tagLookupMap,
|
|
227
242
|
eventContextTags,
|
|
228
243
|
skipTags
|
|
229
244
|
});
|
|
@@ -241,7 +256,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
241
256
|
messages,
|
|
242
257
|
onError,
|
|
243
258
|
onSuccess,
|
|
244
|
-
tagLookupMap,
|
|
245
259
|
eventContextTags,
|
|
246
260
|
skipTags
|
|
247
261
|
});
|
|
@@ -259,7 +273,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
259
273
|
messages,
|
|
260
274
|
onError,
|
|
261
275
|
onSuccess,
|
|
262
|
-
tagLookupMap,
|
|
263
276
|
eventContextTags,
|
|
264
277
|
skipTags
|
|
265
278
|
});
|
|
@@ -277,7 +290,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
277
290
|
};
|
|
278
291
|
const onError = jest.fn();
|
|
279
292
|
const onSuccess = jest.fn();
|
|
280
|
-
const tagLookupMap = {};
|
|
281
293
|
const eventContextTags = [];
|
|
282
294
|
await validateLiquidTemplateContent('', {
|
|
283
295
|
getLiquidTags,
|
|
@@ -285,7 +297,6 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
285
297
|
messages,
|
|
286
298
|
onError,
|
|
287
299
|
onSuccess,
|
|
288
|
-
tagLookupMap,
|
|
289
300
|
eventContextTags,
|
|
290
301
|
});
|
|
291
302
|
expect(formatMessage).toHaveBeenCalledWith(messages.emailBodyEmptyError);
|
|
@@ -297,7 +308,7 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
297
308
|
expect(onSuccess).not.toHaveBeenCalled();
|
|
298
309
|
});
|
|
299
310
|
|
|
300
|
-
it("
|
|
311
|
+
it("calls onSuccess when API returns extracted tags from {% for %} template but no errors (extracted tags are not validated)", async () => {
|
|
301
312
|
const content = '{% for item in order.items %} Hello {% endfor %}';
|
|
302
313
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
303
314
|
cb({ askAiraResponse: { errors: [], data: [{ name: "order.items" }] }, isError: false })
|
|
@@ -308,15 +319,13 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
308
319
|
messages,
|
|
309
320
|
onError,
|
|
310
321
|
onSuccess,
|
|
311
|
-
tagLookupMap,
|
|
312
322
|
eventContextTags
|
|
313
323
|
});
|
|
314
|
-
// order.items appears in {% %} syntax, so it should be skipped and validation should pass
|
|
315
324
|
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
316
325
|
expect(onError).not.toHaveBeenCalled();
|
|
317
326
|
});
|
|
318
327
|
|
|
319
|
-
it("
|
|
328
|
+
it("calls onSuccess when API returns extracted tags in {% %} blocks but no errors", async () => {
|
|
320
329
|
const content = '{% for item in order.items %} {{ item.name }} - {{ item.quantity }} {% endfor %}';
|
|
321
330
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
322
331
|
cb({ askAiraResponse: { errors: [], data: [{ name: "item.name" }, { name: "item.quantity" }] }, isError: false })
|
|
@@ -327,15 +336,13 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
327
336
|
messages,
|
|
328
337
|
onError,
|
|
329
338
|
onSuccess,
|
|
330
|
-
tagLookupMap,
|
|
331
339
|
eventContextTags
|
|
332
340
|
});
|
|
333
|
-
// item.name and item.quantity appear inside {% for %} block, so they should be skipped
|
|
334
341
|
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
335
342
|
expect(onError).not.toHaveBeenCalled();
|
|
336
343
|
});
|
|
337
344
|
|
|
338
|
-
it("
|
|
345
|
+
it("calls onSuccess when API returns extracted tags not in content but no errors", async () => {
|
|
339
346
|
const content = 'Some content without the tag';
|
|
340
347
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
341
348
|
cb({ askAiraResponse: { errors: [], data: [{ name: "extractedTag" }] }, isError: false })
|
|
@@ -346,19 +353,13 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
346
353
|
messages,
|
|
347
354
|
onError,
|
|
348
355
|
onSuccess,
|
|
349
|
-
tagLookupMap,
|
|
350
356
|
eventContextTags
|
|
351
357
|
});
|
|
352
|
-
|
|
353
|
-
expect(onError).
|
|
354
|
-
standardErrors: [],
|
|
355
|
-
liquidErrors: [undefined],
|
|
356
|
-
tabType: undefined
|
|
357
|
-
});
|
|
358
|
-
expect(onSuccess).not.toHaveBeenCalled();
|
|
358
|
+
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
359
|
+
expect(onError).not.toHaveBeenCalled();
|
|
359
360
|
});
|
|
360
361
|
|
|
361
|
-
it("
|
|
362
|
+
it("calls onSuccess when API returns tags outside {% %} but no errors", async () => {
|
|
362
363
|
const content = '{{ outsideTag }} {% for item in order.items %} {{ item.name }} {% endfor %}';
|
|
363
364
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
364
365
|
cb({ askAiraResponse: { errors: [], data: [{ name: "outsideTag" }, { name: "item.name" }] }, isError: false })
|
|
@@ -369,20 +370,70 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
369
370
|
messages,
|
|
370
371
|
onError,
|
|
371
372
|
onSuccess,
|
|
372
|
-
tagLookupMap,
|
|
373
373
|
eventContextTags
|
|
374
374
|
});
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
375
|
+
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
376
|
+
expect(onError).not.toHaveBeenCalled();
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
it("calls onSuccess when API returns tag in {{ }} and no errors", async () => {
|
|
380
|
+
const content = 'Hello {{ unsupportedTag }} world';
|
|
381
|
+
const getLiquidTags = jest.fn((content, cb) =>
|
|
382
|
+
cb({ askAiraResponse: { errors: [], data: [{ name: "unsupportedTag" }] }, isError: false })
|
|
383
|
+
);
|
|
384
|
+
await validateLiquidTemplateContent(content, {
|
|
385
|
+
getLiquidTags,
|
|
386
|
+
formatMessage,
|
|
387
|
+
messages,
|
|
388
|
+
onError,
|
|
389
|
+
onSuccess,
|
|
390
|
+
eventContextTags
|
|
381
391
|
});
|
|
382
|
-
expect(onSuccess).
|
|
392
|
+
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
393
|
+
expect(onError).not.toHaveBeenCalled();
|
|
383
394
|
});
|
|
384
395
|
|
|
385
|
-
it("
|
|
396
|
+
it("calls onSuccess when API returns tag with spacing variants and no errors", async () => {
|
|
397
|
+
const content = '{{ tag}} and {{tag }} and {{ tag }}';
|
|
398
|
+
const getLiquidTags = jest.fn((content, cb) =>
|
|
399
|
+
cb({
|
|
400
|
+
askAiraResponse: {
|
|
401
|
+
errors: [],
|
|
402
|
+
data: [{ name: "tag" }]
|
|
403
|
+
},
|
|
404
|
+
isError: false
|
|
405
|
+
})
|
|
406
|
+
);
|
|
407
|
+
await validateLiquidTemplateContent(content, {
|
|
408
|
+
getLiquidTags,
|
|
409
|
+
formatMessage,
|
|
410
|
+
messages,
|
|
411
|
+
onError,
|
|
412
|
+
onSuccess,
|
|
413
|
+
eventContextTags
|
|
414
|
+
});
|
|
415
|
+
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
416
|
+
expect(onError).not.toHaveBeenCalled();
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
it("calls onSuccess when API returns tag inside {% %} blocks but no errors", async () => {
|
|
420
|
+
const content = '{% for x in some.unsupported %} {{ x }} {% endfor %}';
|
|
421
|
+
const getLiquidTags = jest.fn((content, cb) =>
|
|
422
|
+
cb({ askAiraResponse: { errors: [], data: [{ name: "some.unsupported" }] }, isError: false })
|
|
423
|
+
);
|
|
424
|
+
await validateLiquidTemplateContent(content, {
|
|
425
|
+
getLiquidTags,
|
|
426
|
+
formatMessage,
|
|
427
|
+
messages,
|
|
428
|
+
onError,
|
|
429
|
+
onSuccess,
|
|
430
|
+
eventContextTags
|
|
431
|
+
});
|
|
432
|
+
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
433
|
+
expect(onError).not.toHaveBeenCalled();
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
it("calls onSuccess when API returns tags with dots in {% %} syntax but no errors", async () => {
|
|
386
437
|
const content = '{% assign myVar = order.items %} Some text';
|
|
387
438
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
388
439
|
cb({ askAiraResponse: { errors: [], data: [{ name: "order.items" }] }, isError: false })
|
|
@@ -393,10 +444,8 @@ describe("validateLiquidTemplateContent", () => {
|
|
|
393
444
|
messages,
|
|
394
445
|
onError,
|
|
395
446
|
onSuccess,
|
|
396
|
-
tagLookupMap,
|
|
397
447
|
eventContextTags
|
|
398
448
|
});
|
|
399
|
-
// order.items appears in {% %} syntax, so it should be skipped
|
|
400
449
|
expect(onSuccess).toHaveBeenCalledWith(content, undefined);
|
|
401
450
|
expect(onError).not.toHaveBeenCalled();
|
|
402
451
|
});
|
|
@@ -451,7 +500,6 @@ describe("validateMobilePushContent", () => {
|
|
|
451
500
|
somethingWentWrong: { id: "wrong" },
|
|
452
501
|
unsupportedTagsValidationError: { id: "unsupported" }
|
|
453
502
|
};
|
|
454
|
-
const tagLookupMap = { foo: true };
|
|
455
503
|
const eventContextTags = [{ tagName: "foo" }];
|
|
456
504
|
const onError = jest.fn();
|
|
457
505
|
const onSuccess = jest.fn();
|
|
@@ -460,7 +508,7 @@ describe("validateMobilePushContent", () => {
|
|
|
460
508
|
jest.clearAllMocks();
|
|
461
509
|
});
|
|
462
510
|
|
|
463
|
-
it("calls onError for empty formData", async () => {
|
|
511
|
+
it("calls onError for empty formData (validateMobilePushContent)", async () => {
|
|
464
512
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
465
513
|
cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
|
|
466
514
|
);
|
|
@@ -469,18 +517,17 @@ describe("validateMobilePushContent", () => {
|
|
|
469
517
|
{
|
|
470
518
|
getLiquidTags,
|
|
471
519
|
formatMessage,
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
eventContextTags,
|
|
520
|
+
messages,
|
|
521
|
+
onError,
|
|
522
|
+
onSuccess,
|
|
523
|
+
eventContextTags,
|
|
477
524
|
currentTab: 1
|
|
478
525
|
}
|
|
479
526
|
);
|
|
480
527
|
expect(onError).toHaveBeenCalled();
|
|
481
528
|
});
|
|
482
529
|
|
|
483
|
-
it("calls onSuccess for valid android and ios content", async () => {
|
|
530
|
+
it("calls onSuccess for valid android and ios content (validateMobilePushContent)", async () => {
|
|
484
531
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
485
532
|
cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
|
|
486
533
|
);
|
|
@@ -491,7 +538,6 @@ describe("validateMobilePushContent", () => {
|
|
|
491
538
|
messages,
|
|
492
539
|
onError,
|
|
493
540
|
onSuccess,
|
|
494
|
-
tagLookupMap,
|
|
495
541
|
eventContextTags,
|
|
496
542
|
currentTab: 1
|
|
497
543
|
});
|
|
@@ -509,7 +555,6 @@ describe("validateMobilePushContent", () => {
|
|
|
509
555
|
messages,
|
|
510
556
|
onError,
|
|
511
557
|
onSuccess,
|
|
512
|
-
tagLookupMap,
|
|
513
558
|
eventContextTags,
|
|
514
559
|
currentTab: 1
|
|
515
560
|
});
|
|
@@ -527,7 +572,6 @@ describe("validateMobilePushContent", () => {
|
|
|
527
572
|
messages,
|
|
528
573
|
onError,
|
|
529
574
|
onSuccess,
|
|
530
|
-
tagLookupMap,
|
|
531
575
|
eventContextTags,
|
|
532
576
|
currentTab: 2
|
|
533
577
|
});
|
|
@@ -545,7 +589,6 @@ describe("validateMobilePushContent", () => {
|
|
|
545
589
|
messages,
|
|
546
590
|
onError,
|
|
547
591
|
onSuccess,
|
|
548
|
-
tagLookupMap,
|
|
549
592
|
eventContextTags
|
|
550
593
|
});
|
|
551
594
|
expect(onSuccess).toHaveBeenCalledWith(JSON.stringify(formData[0]), "android");
|
|
@@ -562,7 +605,6 @@ describe("validateMobilePushContent", () => {
|
|
|
562
605
|
messages,
|
|
563
606
|
onError,
|
|
564
607
|
onSuccess,
|
|
565
|
-
tagLookupMap,
|
|
566
608
|
eventContextTags
|
|
567
609
|
});
|
|
568
610
|
expect(onSuccess).toHaveBeenCalledWith("null", "android");
|
|
@@ -575,11 +617,10 @@ describe("validateMobilePushContent", () => {
|
|
|
575
617
|
{
|
|
576
618
|
getLiquidTags,
|
|
577
619
|
formatMessage,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
eventContextTags,
|
|
620
|
+
messages,
|
|
621
|
+
onError,
|
|
622
|
+
onSuccess,
|
|
623
|
+
eventContextTags,
|
|
583
624
|
currentTab: 1,
|
|
584
625
|
},
|
|
585
626
|
);
|
|
@@ -593,11 +634,10 @@ describe("validateMobilePushContent", () => {
|
|
|
593
634
|
{
|
|
594
635
|
getLiquidTags,
|
|
595
636
|
formatMessage,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
eventContextTags,
|
|
637
|
+
messages,
|
|
638
|
+
onError,
|
|
639
|
+
onSuccess,
|
|
640
|
+
eventContextTags,
|
|
601
641
|
currentTab: 1,
|
|
602
642
|
},
|
|
603
643
|
);
|
|
@@ -611,11 +651,10 @@ describe("validateMobilePushContent", () => {
|
|
|
611
651
|
{
|
|
612
652
|
getLiquidTags,
|
|
613
653
|
formatMessage,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
eventContextTags,
|
|
654
|
+
messages,
|
|
655
|
+
onError,
|
|
656
|
+
onSuccess,
|
|
657
|
+
eventContextTags,
|
|
619
658
|
currentTab: 1,
|
|
620
659
|
},
|
|
621
660
|
);
|
|
@@ -629,11 +668,10 @@ describe("validateMobilePushContent", () => {
|
|
|
629
668
|
{
|
|
630
669
|
getLiquidTags,
|
|
631
670
|
formatMessage,
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
eventContextTags,
|
|
671
|
+
messages,
|
|
672
|
+
onError,
|
|
673
|
+
onSuccess,
|
|
674
|
+
eventContextTags,
|
|
637
675
|
currentTab: 1,
|
|
638
676
|
},
|
|
639
677
|
);
|
|
@@ -647,11 +685,10 @@ describe("validateMobilePushContent", () => {
|
|
|
647
685
|
{
|
|
648
686
|
getLiquidTags,
|
|
649
687
|
formatMessage,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
eventContextTags,
|
|
688
|
+
messages,
|
|
689
|
+
onError,
|
|
690
|
+
onSuccess,
|
|
691
|
+
eventContextTags,
|
|
655
692
|
},
|
|
656
693
|
);
|
|
657
694
|
expect(onError).toHaveBeenCalled();
|
|
@@ -664,11 +701,10 @@ describe("validateMobilePushContent", () => {
|
|
|
664
701
|
{
|
|
665
702
|
getLiquidTags,
|
|
666
703
|
formatMessage,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
eventContextTags,
|
|
704
|
+
messages,
|
|
705
|
+
onError,
|
|
706
|
+
onSuccess,
|
|
707
|
+
eventContextTags,
|
|
672
708
|
},
|
|
673
709
|
);
|
|
674
710
|
expect(onError).toHaveBeenCalled();
|
|
@@ -681,11 +717,10 @@ describe("validateMobilePushContent", () => {
|
|
|
681
717
|
{
|
|
682
718
|
getLiquidTags,
|
|
683
719
|
formatMessage,
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
eventContextTags,
|
|
720
|
+
messages,
|
|
721
|
+
onError,
|
|
722
|
+
onSuccess,
|
|
723
|
+
eventContextTags,
|
|
689
724
|
},
|
|
690
725
|
);
|
|
691
726
|
expect(onError).toHaveBeenCalled();
|
|
@@ -698,11 +733,10 @@ describe("validateMobilePushContent", () => {
|
|
|
698
733
|
{
|
|
699
734
|
getLiquidTags,
|
|
700
735
|
formatMessage,
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
eventContextTags,
|
|
736
|
+
messages,
|
|
737
|
+
onError,
|
|
738
|
+
onSuccess,
|
|
739
|
+
eventContextTags,
|
|
706
740
|
},
|
|
707
741
|
);
|
|
708
742
|
expect(onError).toHaveBeenCalled();
|
|
@@ -715,11 +749,10 @@ describe("validateMobilePushContent", () => {
|
|
|
715
749
|
{
|
|
716
750
|
getLiquidTags,
|
|
717
751
|
formatMessage,
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
eventContextTags,
|
|
752
|
+
messages,
|
|
753
|
+
onError,
|
|
754
|
+
onSuccess,
|
|
755
|
+
eventContextTags,
|
|
723
756
|
},
|
|
724
757
|
);
|
|
725
758
|
expect(onError).toHaveBeenCalled();
|
|
@@ -733,7 +766,6 @@ describe("validateInAppContent", () => {
|
|
|
733
766
|
somethingWentWrong: { id: "wrong" },
|
|
734
767
|
unsupportedTagsValidationError: { id: "unsupported" }
|
|
735
768
|
};
|
|
736
|
-
const tagLookupMap = { foo: true };
|
|
737
769
|
const eventContextTags = [{ tagName: "foo" }];
|
|
738
770
|
const onError = jest.fn();
|
|
739
771
|
const onSuccess = jest.fn();
|
|
@@ -742,7 +774,7 @@ describe("validateInAppContent", () => {
|
|
|
742
774
|
jest.clearAllMocks();
|
|
743
775
|
});
|
|
744
776
|
|
|
745
|
-
it("calls onError for empty formData", async () => {
|
|
777
|
+
it("calls onError for empty formData (validateInAppContent)", async () => {
|
|
746
778
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
747
779
|
cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
|
|
748
780
|
);
|
|
@@ -751,17 +783,16 @@ describe("validateInAppContent", () => {
|
|
|
751
783
|
{
|
|
752
784
|
getLiquidTags,
|
|
753
785
|
formatMessage,
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
eventContextTags,
|
|
786
|
+
messages,
|
|
787
|
+
onError,
|
|
788
|
+
onSuccess,
|
|
789
|
+
eventContextTags,
|
|
759
790
|
}
|
|
760
791
|
);
|
|
761
792
|
expect(onError).toHaveBeenCalled();
|
|
762
793
|
});
|
|
763
794
|
|
|
764
|
-
it("calls onSuccess for valid android and ios content", async () => {
|
|
795
|
+
it("calls onSuccess for valid android and ios content (validateInAppContent)", async () => {
|
|
765
796
|
const getLiquidTags = jest.fn((content, cb) =>
|
|
766
797
|
cb({ askAiraResponse: { errors: [], data: [] }, isError: false })
|
|
767
798
|
);
|
|
@@ -781,7 +812,6 @@ describe("validateInAppContent", () => {
|
|
|
781
812
|
messages,
|
|
782
813
|
onError,
|
|
783
814
|
onSuccess,
|
|
784
|
-
tagLookupMap,
|
|
785
815
|
eventContextTags,
|
|
786
816
|
singleTab: ANDROID,
|
|
787
817
|
});
|
|
@@ -808,7 +838,6 @@ describe("validateInAppContent", () => {
|
|
|
808
838
|
messages,
|
|
809
839
|
onError,
|
|
810
840
|
onSuccess,
|
|
811
|
-
tagLookupMap,
|
|
812
841
|
eventContextTags,
|
|
813
842
|
singleTab: IOS,
|
|
814
843
|
});
|
|
@@ -835,11 +864,11 @@ describe("getChannelData", () => {
|
|
|
835
864
|
expect(getChannelData("SMS", formData)).toBe("Hi Test");
|
|
836
865
|
});
|
|
837
866
|
|
|
838
|
-
it("returns string with undefineds for SMS
|
|
867
|
+
it("returns string with undefineds for SMS when base and template-name are empty or undefined", () => {
|
|
839
868
|
const formData = { base: {}, "template-name": undefined };
|
|
840
869
|
expect(getChannelData("SMS", formData)).toBe("undefined undefined");
|
|
841
870
|
});
|
|
842
|
-
it("returns string with undefineds for SMS
|
|
871
|
+
it("returns string with undefineds for SMS when formData is empty string", () => {
|
|
843
872
|
expect(getChannelData("SMS", "")).toBe("undefined undefined");
|
|
844
873
|
});
|
|
845
874
|
|