@capillarytech/creatives-library 9.0.47 → 9.0.49-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 +1 -0
- package/package.json +1 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/SmsPreviewContent.js +21 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberCarouselPreviewCards.js +127 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/ViberPreviewContent.js +106 -15
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +144 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_viberCarouselPreviewCards.scss +133 -0
- package/v2Components/CommonTestAndPreview/constants.js +2 -0
- package/v2Components/CommonTestAndPreview/index.js +240 -26
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/SmsPreviewContent.test.js +32 -0
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/ViberPreviewContent.test.js +364 -0
- package/v2Components/CommonTestAndPreview/tests/utils.test.js +49 -0
- package/v2Components/CommonTestAndPreview/utils.js +20 -0
- package/v2Components/SmsFallback/constants.js +19 -0
- package/v2Components/SmsFallback/index.js +0 -3
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/dltVarTypes.js +88 -0
- package/v2Containers/SmsTrai/Edit/index.js +198 -92
- package/v2Containers/SmsTrai/Edit/index.scss +117 -1
- package/v2Containers/SmsTrai/Edit/messages.js +40 -0
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +21164 -4559
- package/v2Containers/SmsTrai/Edit/tests/dltVarTypes.test.js +100 -0
- package/v2Containers/Templates/_templates.scss +202 -1
- package/v2Containers/Templates/index.js +210 -42
- package/v2Containers/Templates/messages.js +12 -0
- package/v2Containers/Viber/constants.js +21 -0
- package/v2Containers/Viber/index.js +711 -43
- package/v2Containers/Viber/index.scss +175 -0
- package/v2Containers/Viber/messages.js +121 -0
- package/v2Containers/Viber/tests/index.test.js +80 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DLT_VAR_TYPE_KEYS,
|
|
3
|
+
DLT_VAR_TYPE_META,
|
|
4
|
+
DLT_LEGACY_VAR_TOKEN,
|
|
5
|
+
DLT_LEGACY_VAR_REGEX,
|
|
6
|
+
ANY_DLT_HASH_TOKEN_PROBE_REGEX,
|
|
7
|
+
isAnyDltVarToken,
|
|
8
|
+
getDltVarTypeKey,
|
|
9
|
+
getDltVarTypeMeta,
|
|
10
|
+
getDltVarCharLimit,
|
|
11
|
+
} from '../dltVarTypes';
|
|
12
|
+
|
|
13
|
+
describe('dltVarTypes', () => {
|
|
14
|
+
it('exposes the six DLT types with short + long syntax + char limit', () => {
|
|
15
|
+
expect(DLT_VAR_TYPE_KEYS).toEqual([
|
|
16
|
+
'numeric', 'alphanumeric', 'url', 'urlott', 'cbn', 'email',
|
|
17
|
+
]);
|
|
18
|
+
DLT_VAR_TYPE_KEYS.forEach((key) => {
|
|
19
|
+
const meta = DLT_VAR_TYPE_META[key];
|
|
20
|
+
expect(meta.short).toMatch(/^\{#[^#]+#\}$/);
|
|
21
|
+
expect(meta.long).toMatch(/^\{#[^#]+#\}$/);
|
|
22
|
+
expect(typeof meta.charLimit).toBe('number');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('isAnyDltVarToken', () => {
|
|
27
|
+
it('accepts short and long DLT token forms', () => {
|
|
28
|
+
expect(isAnyDltVarToken('{#num#}')).toBe(true);
|
|
29
|
+
expect(isAnyDltVarToken('{#numeric#}')).toBe(true);
|
|
30
|
+
expect(isAnyDltVarToken('{#var#}')).toBe(true);
|
|
31
|
+
expect(isAnyDltVarToken('{# alp #}')).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('rejects non-DLT strings and non-strings', () => {
|
|
35
|
+
expect(isAnyDltVarToken('{{mustache}}')).toBe(false);
|
|
36
|
+
expect(isAnyDltVarToken('plain text')).toBe(false);
|
|
37
|
+
expect(isAnyDltVarToken('')).toBe(false);
|
|
38
|
+
expect(isAnyDltVarToken(null)).toBe(false);
|
|
39
|
+
expect(isAnyDltVarToken(undefined)).toBe(false);
|
|
40
|
+
expect(isAnyDltVarToken(42)).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('getDltVarTypeKey', () => {
|
|
45
|
+
it('resolves short and long spellings + legacy {#var#} to a type key', () => {
|
|
46
|
+
expect(getDltVarTypeKey('{#num#}')).toBe('numeric');
|
|
47
|
+
expect(getDltVarTypeKey('{#numeric#}')).toBe('numeric');
|
|
48
|
+
expect(getDltVarTypeKey('{#ALP#}')).toBe('alphanumeric');
|
|
49
|
+
expect(getDltVarTypeKey('{# url #}')).toBe('url');
|
|
50
|
+
expect(getDltVarTypeKey(DLT_LEGACY_VAR_TOKEN)).toBe('alphanumeric');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('returns null for unknown / non-string tokens', () => {
|
|
54
|
+
expect(getDltVarTypeKey('{#foobar#}')).toBe(null);
|
|
55
|
+
expect(getDltVarTypeKey('')).toBe(null);
|
|
56
|
+
expect(getDltVarTypeKey(null)).toBe(null);
|
|
57
|
+
expect(getDltVarTypeKey(undefined)).toBe(null);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
describe('getDltVarTypeMeta', () => {
|
|
62
|
+
it('returns the full meta object for a valid token', () => {
|
|
63
|
+
const meta = getDltVarTypeMeta('{#url#}');
|
|
64
|
+
expect(meta.charLimit).toBe(120);
|
|
65
|
+
expect(meta.placeholderKey).toBe('dltVarPlaceholderUrl');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('returns null for an unknown token', () => {
|
|
69
|
+
expect(getDltVarTypeMeta('{#nope#}')).toBe(null);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('getDltVarCharLimit', () => {
|
|
74
|
+
it('returns the type-specific char limit for known tokens', () => {
|
|
75
|
+
expect(getDltVarCharLimit('{#num#}')).toBe(40);
|
|
76
|
+
expect(getDltVarCharLimit('{#url#}')).toBe(120);
|
|
77
|
+
expect(getDltVarCharLimit('{#cbn#}')).toBe(14);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('falls back to the supplied default when the token is unknown', () => {
|
|
81
|
+
expect(getDltVarCharLimit('{#nope#}', 40)).toBe(40);
|
|
82
|
+
expect(getDltVarCharLimit('{#nope#}', 99)).toBe(99);
|
|
83
|
+
expect(getDltVarCharLimit(null)).toBe(40);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('exported regexes', () => {
|
|
88
|
+
it('DLT_LEGACY_VAR_REGEX matches only the legacy generic token', () => {
|
|
89
|
+
expect(DLT_LEGACY_VAR_REGEX.test('body {#var#} tail')).toBe(true);
|
|
90
|
+
expect(DLT_LEGACY_VAR_REGEX.test('body {#VAR#} tail')).toBe(true);
|
|
91
|
+
expect(DLT_LEGACY_VAR_REGEX.test('body {#num#} tail')).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('ANY_DLT_HASH_TOKEN_PROBE_REGEX detects any hash token safely across calls', () => {
|
|
95
|
+
expect(ANY_DLT_HASH_TOKEN_PROBE_REGEX.test('hi {#alp#} there')).toBe(true);
|
|
96
|
+
expect(ANY_DLT_HASH_TOKEN_PROBE_REGEX.test('hi {#url#} again')).toBe(true);
|
|
97
|
+
expect(ANY_DLT_HASH_TOKEN_PROBE_REGEX.test('plain')).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -160,7 +160,6 @@
|
|
|
160
160
|
line-clamp: 3;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
&.no-image .ant-card-meta {
|
|
@@ -168,6 +167,44 @@
|
|
|
168
167
|
word-wrap: break-word;
|
|
169
168
|
}
|
|
170
169
|
}
|
|
170
|
+
|
|
171
|
+
&.viber-carousel-static {
|
|
172
|
+
height: auto;
|
|
173
|
+
min-height: 21.125rem;
|
|
174
|
+
overflow: visible;
|
|
175
|
+
|
|
176
|
+
.ant-card-body {
|
|
177
|
+
height: auto;
|
|
178
|
+
overflow: visible;
|
|
179
|
+
padding-bottom: $CAP_SPACE_12;
|
|
180
|
+
|
|
181
|
+
.ant-card-meta,
|
|
182
|
+
.ant-card-meta-detail,
|
|
183
|
+
.ant-card-meta-description {
|
|
184
|
+
height: auto;
|
|
185
|
+
max-height: none;
|
|
186
|
+
overflow: visible;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.truncate-text-viber {
|
|
190
|
+
.ant-card-meta-description {
|
|
191
|
+
display: block;
|
|
192
|
+
overflow: visible;
|
|
193
|
+
max-height: none;
|
|
194
|
+
-webkit-box-orient: unset;
|
|
195
|
+
-webkit-line-clamp: unset;
|
|
196
|
+
line-clamp: unset;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.content,
|
|
201
|
+
.cards,
|
|
202
|
+
.card {
|
|
203
|
+
overflow: visible;
|
|
204
|
+
height: auto;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
171
208
|
|
|
172
209
|
|
|
173
210
|
&.carousel-img-section {
|
|
@@ -1222,6 +1259,147 @@
|
|
|
1222
1259
|
max-height: 11rem;
|
|
1223
1260
|
margin-bottom: $CAP_SPACE_04;
|
|
1224
1261
|
}
|
|
1262
|
+
|
|
1263
|
+
/* Listing carousel preview: always grow with content so title + buttons stay visible for any image */
|
|
1264
|
+
.cap-custom-card.ant-card.VIBER.viber-carousel-static {
|
|
1265
|
+
height: auto;
|
|
1266
|
+
min-height: 21.125rem;
|
|
1267
|
+
overflow: visible;
|
|
1268
|
+
|
|
1269
|
+
> .ant-card-body {
|
|
1270
|
+
height: auto;
|
|
1271
|
+
max-height: none;
|
|
1272
|
+
overflow: visible;
|
|
1273
|
+
padding-bottom: $CAP_SPACE_12;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
.ant-card-meta,
|
|
1277
|
+
.ant-card-meta-detail,
|
|
1278
|
+
.ant-card-meta-description,
|
|
1279
|
+
.truncate-text-viber,
|
|
1280
|
+
.truncate-text-viber .ant-card-meta-description {
|
|
1281
|
+
height: auto;
|
|
1282
|
+
max-height: none;
|
|
1283
|
+
overflow: visible;
|
|
1284
|
+
display: block;
|
|
1285
|
+
-webkit-line-clamp: unset;
|
|
1286
|
+
line-clamp: unset;
|
|
1287
|
+
-webkit-box-orient: unset;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
.viber-carousel-static {
|
|
1292
|
+
.content {
|
|
1293
|
+
width: 100%;
|
|
1294
|
+
overflow: visible;
|
|
1295
|
+
display: flex;
|
|
1296
|
+
flex-direction: column;
|
|
1297
|
+
height: auto;
|
|
1298
|
+
|
|
1299
|
+
.message-box {
|
|
1300
|
+
width: 100%;
|
|
1301
|
+
height: auto;
|
|
1302
|
+
border-radius: $CAP_SPACE_04;
|
|
1303
|
+
background: $CAP_WHITE;
|
|
1304
|
+
margin-bottom: $CAP_SPACE_08;
|
|
1305
|
+
display: flex;
|
|
1306
|
+
align-items: flex-start;
|
|
1307
|
+
|
|
1308
|
+
.message {
|
|
1309
|
+
display: -webkit-box;
|
|
1310
|
+
width: 100%;
|
|
1311
|
+
color: $CAP_G01;
|
|
1312
|
+
line-height: 1.3;
|
|
1313
|
+
overflow: hidden;
|
|
1314
|
+
text-overflow: ellipsis;
|
|
1315
|
+
-webkit-line-clamp: 2;
|
|
1316
|
+
line-clamp: 2;
|
|
1317
|
+
-webkit-box-orient: vertical;
|
|
1318
|
+
white-space: normal;
|
|
1319
|
+
word-break: break-word;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
.cards {
|
|
1324
|
+
display: flex;
|
|
1325
|
+
gap: $CAP_SPACE_08;
|
|
1326
|
+
overflow: visible;
|
|
1327
|
+
width: 100%;
|
|
1328
|
+
height: auto;
|
|
1329
|
+
|
|
1330
|
+
.card {
|
|
1331
|
+
flex: 1;
|
|
1332
|
+
min-width: 0;
|
|
1333
|
+
width: 100%;
|
|
1334
|
+
background: $CAP_WHITE;
|
|
1335
|
+
border-radius: $CAP_SPACE_04;
|
|
1336
|
+
overflow: visible;
|
|
1337
|
+
display: flex;
|
|
1338
|
+
flex-direction: column;
|
|
1339
|
+
height: auto;
|
|
1340
|
+
|
|
1341
|
+
.image {
|
|
1342
|
+
width: 100%;
|
|
1343
|
+
max-height: 11rem;
|
|
1344
|
+
margin-bottom: $CAP_SPACE_04;
|
|
1345
|
+
border-radius: $CAP_SPACE_04;
|
|
1346
|
+
display: block;
|
|
1347
|
+
flex-shrink: 0;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
.image-placeholder {
|
|
1351
|
+
width: 100%;
|
|
1352
|
+
height: 7.143rem;
|
|
1353
|
+
border-radius: $CAP_SPACE_04;
|
|
1354
|
+
background: $CAP_G07;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
.text {
|
|
1358
|
+
display: -webkit-box;
|
|
1359
|
+
color: $CAP_G01;
|
|
1360
|
+
margin: $CAP_SPACE_04 0;
|
|
1361
|
+
line-height: 1.3;
|
|
1362
|
+
overflow: hidden;
|
|
1363
|
+
text-overflow: ellipsis;
|
|
1364
|
+
white-space: normal;
|
|
1365
|
+
-webkit-line-clamp: 2;
|
|
1366
|
+
line-clamp: 2;
|
|
1367
|
+
-webkit-box-orient: vertical;
|
|
1368
|
+
flex-shrink: 0;
|
|
1369
|
+
width: 100%;
|
|
1370
|
+
visibility: visible;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
.buttons {
|
|
1374
|
+
display: flex;
|
|
1375
|
+
flex-direction: column;
|
|
1376
|
+
gap: $CAP_SPACE_04;
|
|
1377
|
+
flex-shrink: 0;
|
|
1378
|
+
width: 100%;
|
|
1379
|
+
visibility: visible;
|
|
1380
|
+
|
|
1381
|
+
.button {
|
|
1382
|
+
display: block;
|
|
1383
|
+
min-height: 1.5rem;
|
|
1384
|
+
border-radius: $CAP_SPACE_12;
|
|
1385
|
+
background: $CAP_PURPLE01;
|
|
1386
|
+
color: $CAP_WHITE;
|
|
1387
|
+
text-align: center;
|
|
1388
|
+
padding: 0.179rem $CAP_SPACE_08;
|
|
1389
|
+
white-space: normal;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
.button-secondary {
|
|
1393
|
+
color: $CAP_PURPLE01;
|
|
1394
|
+
background: transparent;
|
|
1395
|
+
border: none;
|
|
1396
|
+
box-shadow: none;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1225
1403
|
.whatsapp-doc {
|
|
1226
1404
|
width: 100%;
|
|
1227
1405
|
max-height: 123px;
|
|
@@ -1480,6 +1658,29 @@
|
|
|
1480
1658
|
cursor: not-allowed;
|
|
1481
1659
|
}
|
|
1482
1660
|
|
|
1661
|
+
.sms-service-explicit-retired-banner.ant-alert {
|
|
1662
|
+
margin: 0 $CAP_SPACE_16 $CAP_SPACE_16 $CAP_SPACE_16;
|
|
1663
|
+
padding: $CAP_SPACE_08 $CAP_SPACE_12;
|
|
1664
|
+
align-items: center;
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
.sms-template-category-tag {
|
|
1668
|
+
margin-bottom: $CAP_SPACE_12;
|
|
1669
|
+
padding: 0 $CAP_SPACE_12;
|
|
1670
|
+
border-radius: 62.5rem;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
.sms-template-legacy-warning.ant-alert {
|
|
1675
|
+
margin-top: $CAP_SPACE_12;
|
|
1676
|
+
|
|
1677
|
+
.ant-alert-title,
|
|
1678
|
+
.ant-alert-title span {
|
|
1679
|
+
font-weight: 400;
|
|
1680
|
+
white-space: normal;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1483
1684
|
.template-action-dropdown {
|
|
1484
1685
|
min-width: 14.286rem !important;
|
|
1485
1686
|
.template-action-menu {
|