@capillarytech/creatives-library 7.12.53 → 7.12.54
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/package.json +1 -1
- package/v2Components/CapWhatsappCTA/index.js +21 -0
- package/v2Components/CapWhatsappCTA/index.scss +5 -0
- package/v2Components/CapWhatsappCTA/messages.js +8 -2
- package/v2Containers/Whatsapp/index.js +4 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +24 -0
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@ import whatsappMsg from '../../v2Containers/Whatsapp/messages';
|
|
|
21
21
|
import messages from './messages';
|
|
22
22
|
import './index.scss';
|
|
23
23
|
import { isUrl } from '../../v2Containers/Line/Container/Wrapper/utils';
|
|
24
|
+
import TagList from '../../v2Containers/TagList';
|
|
24
25
|
import {
|
|
25
26
|
CTA_OPTIONS,
|
|
26
27
|
BTN_MAX_LENGTH,
|
|
@@ -46,6 +47,10 @@ export const CapWhatsappCTA = (props) => {
|
|
|
46
47
|
deleteHandler,
|
|
47
48
|
isEditFlow,
|
|
48
49
|
hostName,
|
|
50
|
+
isFullMode,
|
|
51
|
+
tags = [],
|
|
52
|
+
injectedTags = {},
|
|
53
|
+
selectedOfferDetails = [],
|
|
49
54
|
} = props;
|
|
50
55
|
const { formatMessage } = intl;
|
|
51
56
|
const validVarRegex = /{{(1)}}/g;
|
|
@@ -75,6 +80,10 @@ export const CapWhatsappCTA = (props) => {
|
|
|
75
80
|
</CapHeading>
|
|
76
81
|
);
|
|
77
82
|
|
|
83
|
+
const onTagSelect = (data, index, url) => {
|
|
84
|
+
updateHelper('url', url.replace('{{1}}', `{{${data}}}`), index);
|
|
85
|
+
};
|
|
86
|
+
|
|
78
87
|
const onCtaTypeChange = (value, index) => {
|
|
79
88
|
let clonedCta = cloneDeep(ctaData[index]);
|
|
80
89
|
clonedCta = {
|
|
@@ -197,6 +206,7 @@ export const CapWhatsappCTA = (props) => {
|
|
|
197
206
|
cta || {};
|
|
198
207
|
if (isSaved) {
|
|
199
208
|
const ctaIsPhone = ctaType === PHONE_NUMBER;
|
|
209
|
+
const urlTypeIsDynamic = urlType === DYNAMIC_URL;
|
|
200
210
|
renderArray.push(
|
|
201
211
|
<CapRow
|
|
202
212
|
className="cap-whatsapp-saved-cta margin-t-12"
|
|
@@ -253,6 +263,17 @@ export const CapWhatsappCTA = (props) => {
|
|
|
253
263
|
</CapColumn>
|
|
254
264
|
</>
|
|
255
265
|
)}
|
|
266
|
+
{isEditFlow && !isFullMode && urlTypeIsDynamic && (
|
|
267
|
+
<TagList
|
|
268
|
+
className="whatsapp-cta-taglist"
|
|
269
|
+
label={formatMessage(messages.whatsappCtaTagListLabel)}
|
|
270
|
+
onTagSelect={(data) => onTagSelect(data, index, url)}
|
|
271
|
+
tags={tags}
|
|
272
|
+
injectedTags={injectedTags}
|
|
273
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
274
|
+
hidePopover={!url.includes('{{1}}')}
|
|
275
|
+
/>
|
|
276
|
+
)}
|
|
256
277
|
</CapRow>,
|
|
257
278
|
);
|
|
258
279
|
} else {
|
|
@@ -64,7 +64,8 @@ export default defineMessages({
|
|
|
64
64
|
},
|
|
65
65
|
ctaButtonTextTooltip: {
|
|
66
66
|
id: `${prefix}.ctaButtonTextTooltip`,
|
|
67
|
-
defaultMessage:
|
|
67
|
+
defaultMessage:
|
|
68
|
+
'Use this to name the button. We would recommend not to use special characters for the button text.',
|
|
68
69
|
},
|
|
69
70
|
ctaOptionDisabledTooltip: {
|
|
70
71
|
id: `${prefix}.ctaOptionDisabledTooltip`,
|
|
@@ -72,7 +73,8 @@ export default defineMessages({
|
|
|
72
73
|
},
|
|
73
74
|
dynamicUrlTooltip: {
|
|
74
75
|
id: `${prefix}.dynamicUrlTooltip`,
|
|
75
|
-
defaultMessage:
|
|
76
|
+
defaultMessage:
|
|
77
|
+
'Only one variable can be added to a URL. No need to add {{1}} to the end of the URL',
|
|
76
78
|
},
|
|
77
79
|
staticUrlWithVarErrorMessage: {
|
|
78
80
|
id: `${prefix}.staticUrlWithVarErrorMessage`,
|
|
@@ -90,4 +92,8 @@ export default defineMessages({
|
|
|
90
92
|
id: `${prefix}.useTwoBracketsOnly`,
|
|
91
93
|
defaultMessage: 'Use two brackets on each side to declare a variable',
|
|
92
94
|
},
|
|
95
|
+
whatsappCtaTagListLabel: {
|
|
96
|
+
id: `${prefix}.whatsappCtaTagListLabel`,
|
|
97
|
+
defaultMessage: 'Add URL label',
|
|
98
|
+
},
|
|
93
99
|
});
|
|
@@ -1309,6 +1309,10 @@ export const Whatsapp = (props) => {
|
|
|
1309
1309
|
deleteHandler={deleteHandler}
|
|
1310
1310
|
isEditFlow={isEditFlow}
|
|
1311
1311
|
hostName={host}
|
|
1312
|
+
isFullMode={isFullMode}
|
|
1313
|
+
tags={tags || []}
|
|
1314
|
+
injectedTags={injectedTags || {}}
|
|
1315
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
1312
1316
|
/>
|
|
1313
1317
|
)}
|
|
1314
1318
|
</CapRow>
|
|
@@ -56394,8 +56394,11 @@ T&C'
|
|
|
56394
56394
|
}
|
|
56395
56395
|
deleteHandler={[Function]}
|
|
56396
56396
|
hostName=""
|
|
56397
|
+
injectedTags={Object {}}
|
|
56397
56398
|
isEditFlow={true}
|
|
56399
|
+
isFullMode={true}
|
|
56398
56400
|
key=".2"
|
|
56401
|
+
tags={Array []}
|
|
56399
56402
|
updateHandler={[Function]}
|
|
56400
56403
|
>
|
|
56401
56404
|
<CapWhatsappCTA
|
|
@@ -56423,6 +56426,7 @@ T&C'
|
|
|
56423
56426
|
}
|
|
56424
56427
|
deleteHandler={[Function]}
|
|
56425
56428
|
hostName=""
|
|
56429
|
+
injectedTags={Object {}}
|
|
56426
56430
|
intl={
|
|
56427
56431
|
Object {
|
|
56428
56432
|
"defaultFormats": Object {},
|
|
@@ -58275,6 +58279,8 @@ T&C'
|
|
|
58275
58279
|
}
|
|
58276
58280
|
}
|
|
58277
58281
|
isEditFlow={true}
|
|
58282
|
+
isFullMode={true}
|
|
58283
|
+
tags={Array []}
|
|
58278
58284
|
updateHandler={[Function]}
|
|
58279
58285
|
>
|
|
58280
58286
|
<CapRow
|
|
@@ -88190,8 +88196,11 @@ T&C'
|
|
|
88190
88196
|
}
|
|
88191
88197
|
deleteHandler={[Function]}
|
|
88192
88198
|
hostName=""
|
|
88199
|
+
injectedTags={Object {}}
|
|
88193
88200
|
isEditFlow={true}
|
|
88201
|
+
isFullMode={true}
|
|
88194
88202
|
key=".2"
|
|
88203
|
+
tags={Array []}
|
|
88195
88204
|
updateHandler={[Function]}
|
|
88196
88205
|
>
|
|
88197
88206
|
<CapWhatsappCTA
|
|
@@ -88219,6 +88228,7 @@ T&C'
|
|
|
88219
88228
|
}
|
|
88220
88229
|
deleteHandler={[Function]}
|
|
88221
88230
|
hostName=""
|
|
88231
|
+
injectedTags={Object {}}
|
|
88222
88232
|
intl={
|
|
88223
88233
|
Object {
|
|
88224
88234
|
"defaultFormats": Object {},
|
|
@@ -90071,6 +90081,8 @@ T&C'
|
|
|
90071
90081
|
}
|
|
90072
90082
|
}
|
|
90073
90083
|
isEditFlow={true}
|
|
90084
|
+
isFullMode={true}
|
|
90085
|
+
tags={Array []}
|
|
90074
90086
|
updateHandler={[Function]}
|
|
90075
90087
|
>
|
|
90076
90088
|
<CapRow
|
|
@@ -103964,8 +103976,11 @@ Click {{unsubscribe}} to unsubscribe",
|
|
|
103964
103976
|
}
|
|
103965
103977
|
deleteHandler={[Function]}
|
|
103966
103978
|
hostName=""
|
|
103979
|
+
injectedTags={Object {}}
|
|
103967
103980
|
isEditFlow={true}
|
|
103981
|
+
isFullMode={false}
|
|
103968
103982
|
key=".2"
|
|
103983
|
+
tags={Array []}
|
|
103969
103984
|
updateHandler={[Function]}
|
|
103970
103985
|
>
|
|
103971
103986
|
<CapWhatsappCTA
|
|
@@ -103993,6 +104008,7 @@ Click {{unsubscribe}} to unsubscribe",
|
|
|
103993
104008
|
}
|
|
103994
104009
|
deleteHandler={[Function]}
|
|
103995
104010
|
hostName=""
|
|
104011
|
+
injectedTags={Object {}}
|
|
103996
104012
|
intl={
|
|
103997
104013
|
Object {
|
|
103998
104014
|
"defaultFormats": Object {},
|
|
@@ -105845,6 +105861,8 @@ Click {{unsubscribe}} to unsubscribe",
|
|
|
105845
105861
|
}
|
|
105846
105862
|
}
|
|
105847
105863
|
isEditFlow={true}
|
|
105864
|
+
isFullMode={false}
|
|
105865
|
+
tags={Array []}
|
|
105848
105866
|
updateHandler={[Function]}
|
|
105849
105867
|
>
|
|
105850
105868
|
<CapRow
|
|
@@ -114335,8 +114353,11 @@ exports[`Creatives Whatsapp test1/> should render edit mode in various cases 6`]
|
|
|
114335
114353
|
}
|
|
114336
114354
|
deleteHandler={[Function]}
|
|
114337
114355
|
hostName=""
|
|
114356
|
+
injectedTags={Object {}}
|
|
114338
114357
|
isEditFlow={true}
|
|
114358
|
+
isFullMode={false}
|
|
114339
114359
|
key=".2"
|
|
114360
|
+
tags={Array []}
|
|
114340
114361
|
updateHandler={[Function]}
|
|
114341
114362
|
>
|
|
114342
114363
|
<CapWhatsappCTA
|
|
@@ -114355,6 +114376,7 @@ exports[`Creatives Whatsapp test1/> should render edit mode in various cases 6`]
|
|
|
114355
114376
|
}
|
|
114356
114377
|
deleteHandler={[Function]}
|
|
114357
114378
|
hostName=""
|
|
114379
|
+
injectedTags={Object {}}
|
|
114358
114380
|
intl={
|
|
114359
114381
|
Object {
|
|
114360
114382
|
"defaultFormats": Object {},
|
|
@@ -116207,6 +116229,8 @@ exports[`Creatives Whatsapp test1/> should render edit mode in various cases 6`]
|
|
|
116207
116229
|
}
|
|
116208
116230
|
}
|
|
116209
116231
|
isEditFlow={true}
|
|
116232
|
+
isFullMode={false}
|
|
116233
|
+
tags={Array []}
|
|
116210
116234
|
updateHandler={[Function]}
|
|
116211
116235
|
>
|
|
116212
116236
|
<CapRow
|