@capillarytech/creatives-library 8.0.340-beta.0.10 → 8.0.340-beta.0.11
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/CommonTestAndPreview/UnifiedPreview/PreviewHeader.js +16 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/WebPushPreviewContent.js +169 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +54 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +53 -7
- package/v2Components/CommonTestAndPreview/constants.js +2 -0
- package/v2Components/CommonTestAndPreview/index.js +51 -2
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/PreviewHeader.test.js +163 -0
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/WebPushPreviewContent.test.js +522 -0
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +255 -0
- package/v2Components/CommonTestAndPreview/tests/constants.test.js +2 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +194 -0
- package/v2Components/FormBuilder/index.js +162 -52
- package/v2Components/TestAndPreviewSlidebox/index.js +2 -2
- package/v2Containers/App/constants.js +3 -0
- package/v2Containers/App/tests/constants.test.js +61 -0
- package/v2Containers/CreativesContainer/index.js +60 -24
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +24 -36
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +6 -9
- package/v2Containers/Templates/index.js +72 -2
- package/v2Containers/Templates/tests/webpush.test.js +375 -0
- package/v2Containers/WebPush/Create/index.js +91 -8
- package/v2Containers/WebPush/Create/index.scss +9 -0
- package/v2Containers/WebPush/Create/tests/getTemplateContent.test.js +348 -0
- package/v2Containers/WebPush/Create/tests/testAndPreviewIntegration.test.js +325 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +68 -102
|
@@ -7222,18 +7222,17 @@ new message content.",
|
|
|
7222
7222
|
>
|
|
7223
7223
|
<CapRow
|
|
7224
7224
|
className="preview-content-container preview-content-container-no-header"
|
|
7225
|
-
useLegacy={true}
|
|
7226
7225
|
>
|
|
7227
7226
|
<Row
|
|
7228
7227
|
align="top"
|
|
7229
|
-
className="cap-row-v2
|
|
7228
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
7230
7229
|
gutter={0}
|
|
7231
7230
|
justify="start"
|
|
7232
7231
|
style={Object {}}
|
|
7233
7232
|
wrap={true}
|
|
7234
7233
|
>
|
|
7235
7234
|
<div
|
|
7236
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
7235
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
7237
7236
|
style={
|
|
7238
7237
|
Object {
|
|
7239
7238
|
"rowGap": undefined,
|
|
@@ -20306,18 +20305,17 @@ new message content.",
|
|
|
20306
20305
|
>
|
|
20307
20306
|
<CapRow
|
|
20308
20307
|
className="preview-content-container preview-content-container-no-header"
|
|
20309
|
-
useLegacy={true}
|
|
20310
20308
|
>
|
|
20311
20309
|
<Row
|
|
20312
20310
|
align="top"
|
|
20313
|
-
className="cap-row-v2
|
|
20311
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
20314
20312
|
gutter={0}
|
|
20315
20313
|
justify="start"
|
|
20316
20314
|
style={Object {}}
|
|
20317
20315
|
wrap={true}
|
|
20318
20316
|
>
|
|
20319
20317
|
<div
|
|
20320
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
20318
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
20321
20319
|
style={
|
|
20322
20320
|
Object {
|
|
20323
20321
|
"rowGap": undefined,
|
|
@@ -33738,18 +33736,17 @@ new message content.",
|
|
|
33738
33736
|
>
|
|
33739
33737
|
<CapRow
|
|
33740
33738
|
className="preview-content-container preview-content-container-no-header"
|
|
33741
|
-
useLegacy={true}
|
|
33742
33739
|
>
|
|
33743
33740
|
<Row
|
|
33744
33741
|
align="top"
|
|
33745
|
-
className="cap-row-v2
|
|
33742
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
33746
33743
|
gutter={0}
|
|
33747
33744
|
justify="start"
|
|
33748
33745
|
style={Object {}}
|
|
33749
33746
|
wrap={true}
|
|
33750
33747
|
>
|
|
33751
33748
|
<div
|
|
33752
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
33749
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
33753
33750
|
style={
|
|
33754
33751
|
Object {
|
|
33755
33752
|
"rowGap": undefined,
|
|
@@ -47710,18 +47707,17 @@ new message content.",
|
|
|
47710
47707
|
>
|
|
47711
47708
|
<CapRow
|
|
47712
47709
|
className="preview-content-container preview-content-container-no-header"
|
|
47713
|
-
useLegacy={true}
|
|
47714
47710
|
>
|
|
47715
47711
|
<Row
|
|
47716
47712
|
align="top"
|
|
47717
|
-
className="cap-row-v2
|
|
47713
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
47718
47714
|
gutter={0}
|
|
47719
47715
|
justify="start"
|
|
47720
47716
|
style={Object {}}
|
|
47721
47717
|
wrap={true}
|
|
47722
47718
|
>
|
|
47723
47719
|
<div
|
|
47724
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
47720
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
47725
47721
|
style={
|
|
47726
47722
|
Object {
|
|
47727
47723
|
"rowGap": undefined,
|
|
@@ -61152,18 +61148,17 @@ new message content.",
|
|
|
61152
61148
|
>
|
|
61153
61149
|
<CapRow
|
|
61154
61150
|
className="preview-content-container preview-content-container-no-header"
|
|
61155
|
-
useLegacy={true}
|
|
61156
61151
|
>
|
|
61157
61152
|
<Row
|
|
61158
61153
|
align="top"
|
|
61159
|
-
className="cap-row-v2
|
|
61154
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
61160
61155
|
gutter={0}
|
|
61161
61156
|
justify="start"
|
|
61162
61157
|
style={Object {}}
|
|
61163
61158
|
wrap={true}
|
|
61164
61159
|
>
|
|
61165
61160
|
<div
|
|
61166
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
61161
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
61167
61162
|
style={
|
|
61168
61163
|
Object {
|
|
61169
61164
|
"rowGap": undefined,
|
|
@@ -77208,18 +77203,17 @@ new message content.",
|
|
|
77208
77203
|
>
|
|
77209
77204
|
<CapRow
|
|
77210
77205
|
className="preview-content-container preview-content-container-no-header"
|
|
77211
|
-
useLegacy={true}
|
|
77212
77206
|
>
|
|
77213
77207
|
<Row
|
|
77214
77208
|
align="top"
|
|
77215
|
-
className="cap-row-v2
|
|
77209
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
77216
77210
|
gutter={0}
|
|
77217
77211
|
justify="start"
|
|
77218
77212
|
style={Object {}}
|
|
77219
77213
|
wrap={true}
|
|
77220
77214
|
>
|
|
77221
77215
|
<div
|
|
77222
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
77216
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
77223
77217
|
style={
|
|
77224
77218
|
Object {
|
|
77225
77219
|
"rowGap": undefined,
|
|
@@ -94058,18 +94052,17 @@ new message content.",
|
|
|
94058
94052
|
>
|
|
94059
94053
|
<CapRow
|
|
94060
94054
|
className="preview-content-container preview-content-container-no-header"
|
|
94061
|
-
useLegacy={true}
|
|
94062
94055
|
>
|
|
94063
94056
|
<Row
|
|
94064
94057
|
align="top"
|
|
94065
|
-
className="cap-row-v2
|
|
94058
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
94066
94059
|
gutter={0}
|
|
94067
94060
|
justify="start"
|
|
94068
94061
|
style={Object {}}
|
|
94069
94062
|
wrap={true}
|
|
94070
94063
|
>
|
|
94071
94064
|
<div
|
|
94072
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
94065
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
94073
94066
|
style={
|
|
94074
94067
|
Object {
|
|
94075
94068
|
"rowGap": undefined,
|
|
@@ -110606,18 +110599,17 @@ new message content.",
|
|
|
110606
110599
|
>
|
|
110607
110600
|
<CapRow
|
|
110608
110601
|
className="preview-content-container preview-content-container-no-header"
|
|
110609
|
-
useLegacy={true}
|
|
110610
110602
|
>
|
|
110611
110603
|
<Row
|
|
110612
110604
|
align="top"
|
|
110613
|
-
className="cap-row-v2
|
|
110605
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
110614
110606
|
gutter={0}
|
|
110615
110607
|
justify="start"
|
|
110616
110608
|
style={Object {}}
|
|
110617
110609
|
wrap={true}
|
|
110618
110610
|
>
|
|
110619
110611
|
<div
|
|
110620
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
110612
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
110621
110613
|
style={
|
|
110622
110614
|
Object {
|
|
110623
110615
|
"rowGap": undefined,
|
|
@@ -125004,18 +124996,17 @@ new message content.",
|
|
|
125004
124996
|
>
|
|
125005
124997
|
<CapRow
|
|
125006
124998
|
className="preview-content-container preview-content-container-no-header"
|
|
125007
|
-
useLegacy={true}
|
|
125008
124999
|
>
|
|
125009
125000
|
<Row
|
|
125010
125001
|
align="top"
|
|
125011
|
-
className="cap-row-v2
|
|
125002
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
125012
125003
|
gutter={0}
|
|
125013
125004
|
justify="start"
|
|
125014
125005
|
style={Object {}}
|
|
125015
125006
|
wrap={true}
|
|
125016
125007
|
>
|
|
125017
125008
|
<div
|
|
125018
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
125009
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
125019
125010
|
style={
|
|
125020
125011
|
Object {
|
|
125021
125012
|
"rowGap": undefined,
|
|
@@ -138088,18 +138079,17 @@ new message content.",
|
|
|
138088
138079
|
>
|
|
138089
138080
|
<CapRow
|
|
138090
138081
|
className="preview-content-container preview-content-container-no-header"
|
|
138091
|
-
useLegacy={true}
|
|
138092
138082
|
>
|
|
138093
138083
|
<Row
|
|
138094
138084
|
align="top"
|
|
138095
|
-
className="cap-row-v2
|
|
138085
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
138096
138086
|
gutter={0}
|
|
138097
138087
|
justify="start"
|
|
138098
138088
|
style={Object {}}
|
|
138099
138089
|
wrap={true}
|
|
138100
138090
|
>
|
|
138101
138091
|
<div
|
|
138102
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
138092
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
138103
138093
|
style={
|
|
138104
138094
|
Object {
|
|
138105
138095
|
"rowGap": undefined,
|
|
@@ -151172,18 +151162,17 @@ new message content.",
|
|
|
151172
151162
|
>
|
|
151173
151163
|
<CapRow
|
|
151174
151164
|
className="preview-content-container preview-content-container-no-header"
|
|
151175
|
-
useLegacy={true}
|
|
151176
151165
|
>
|
|
151177
151166
|
<Row
|
|
151178
151167
|
align="top"
|
|
151179
|
-
className="cap-row-v2
|
|
151168
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
151180
151169
|
gutter={0}
|
|
151181
151170
|
justify="start"
|
|
151182
151171
|
style={Object {}}
|
|
151183
151172
|
wrap={true}
|
|
151184
151173
|
>
|
|
151185
151174
|
<div
|
|
151186
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
151175
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
151187
151176
|
style={
|
|
151188
151177
|
Object {
|
|
151189
151178
|
"rowGap": undefined,
|
|
@@ -163148,18 +163137,17 @@ new message content.",
|
|
|
163148
163137
|
>
|
|
163149
163138
|
<CapRow
|
|
163150
163139
|
className="preview-content-container preview-content-container-no-header"
|
|
163151
|
-
useLegacy={true}
|
|
163152
163140
|
>
|
|
163153
163141
|
<Row
|
|
163154
163142
|
align="top"
|
|
163155
|
-
className="cap-row-v2
|
|
163143
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
163156
163144
|
gutter={0}
|
|
163157
163145
|
justify="start"
|
|
163158
163146
|
style={Object {}}
|
|
163159
163147
|
wrap={true}
|
|
163160
163148
|
>
|
|
163161
163149
|
<div
|
|
163162
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
163150
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
163163
163151
|
style={
|
|
163164
163152
|
Object {
|
|
163165
163153
|
"rowGap": undefined,
|
|
@@ -5283,18 +5283,17 @@ FREE GIFTS-
|
|
|
5283
5283
|
>
|
|
5284
5284
|
<CapRow
|
|
5285
5285
|
className="preview-content-container preview-content-container-no-header"
|
|
5286
|
-
useLegacy={true}
|
|
5287
5286
|
>
|
|
5288
5287
|
<Row
|
|
5289
5288
|
align="top"
|
|
5290
|
-
className="cap-row-v2
|
|
5289
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
5291
5290
|
gutter={0}
|
|
5292
5291
|
justify="start"
|
|
5293
5292
|
style={Object {}}
|
|
5294
5293
|
wrap={true}
|
|
5295
5294
|
>
|
|
5296
5295
|
<div
|
|
5297
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
5296
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
5298
5297
|
style={
|
|
5299
5298
|
Object {
|
|
5300
5299
|
"rowGap": undefined,
|
|
@@ -17197,18 +17196,17 @@ FREE GIFTS-
|
|
|
17197
17196
|
>
|
|
17198
17197
|
<CapRow
|
|
17199
17198
|
className="preview-content-container preview-content-container-no-header"
|
|
17200
|
-
useLegacy={true}
|
|
17201
17199
|
>
|
|
17202
17200
|
<Row
|
|
17203
17201
|
align="top"
|
|
17204
|
-
className="cap-row-v2
|
|
17202
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
17205
17203
|
gutter={0}
|
|
17206
17204
|
justify="start"
|
|
17207
17205
|
style={Object {}}
|
|
17208
17206
|
wrap={true}
|
|
17209
17207
|
>
|
|
17210
17208
|
<div
|
|
17211
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
17209
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
17212
17210
|
style={
|
|
17213
17211
|
Object {
|
|
17214
17212
|
"rowGap": undefined,
|
|
@@ -28937,18 +28935,17 @@ FREE GIFTS-
|
|
|
28937
28935
|
>
|
|
28938
28936
|
<CapRow
|
|
28939
28937
|
className="preview-content-container preview-content-container-no-header"
|
|
28940
|
-
useLegacy={true}
|
|
28941
28938
|
>
|
|
28942
28939
|
<Row
|
|
28943
28940
|
align="top"
|
|
28944
|
-
className="cap-row-v2
|
|
28941
|
+
className="cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header"
|
|
28945
28942
|
gutter={0}
|
|
28946
28943
|
justify="start"
|
|
28947
28944
|
style={Object {}}
|
|
28948
28945
|
wrap={true}
|
|
28949
28946
|
>
|
|
28950
28947
|
<div
|
|
28951
|
-
className="ant-row ant-row-start ant-row-top cap-row-v2
|
|
28948
|
+
className="ant-row ant-row-start ant-row-top cap-row-v2 cap-row-antdv6-guard cap-row-vertical preview-content-container preview-content-container-no-header css-dev-only-do-not-override-dbp7pc css-var-root"
|
|
28952
28949
|
style={
|
|
28953
28950
|
Object {
|
|
28954
28951
|
"rowGap": undefined,
|
|
@@ -105,6 +105,9 @@ import {
|
|
|
105
105
|
VIBER as VIBER_CHANNEL,
|
|
106
106
|
FACEBOOK as FACEBOOK_CHANNEL,
|
|
107
107
|
CREATE,
|
|
108
|
+
EXTERNAL_URL,
|
|
109
|
+
URL,
|
|
110
|
+
SITE_URL,
|
|
108
111
|
} from '../App/constants';
|
|
109
112
|
import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES , ACCOUNT_MAPPING_ON_CHANNEL, noFilteredWhatsappZaloTemplatesTitle, noFilteredWhatsappZaloTemplatesDesc, noApprovedWhatsappZaloTemplatesTitle, noApprovedWhatsappTemplatesDesc, zaloDescIllustration, noApprovedRcsTemplatesTitle, noApprovedRcsTemplatesDesc, ARCHIVE_STATUS_ACTIVE, ARCHIVE_STATUS_ARCHIVED, ARCHIVE_REFRESH_TYPE_ARCHIVE, ARCHIVE_REFRESH_TYPE_UNARCHIVE} from './constants';
|
|
110
113
|
import { COPY_OF, EMBEDDED } from '../../constants/unified';
|
|
@@ -1402,6 +1405,73 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1402
1405
|
};
|
|
1403
1406
|
}
|
|
1404
1407
|
|
|
1408
|
+
case WEBPUSH: {
|
|
1409
|
+
// WebPush content is stored in creatives format (brandIcon, onClickAction, ctas)
|
|
1410
|
+
// Must be transformed to campaign/test-message format matching getTemplateContent() in WebPush/Create/index.js
|
|
1411
|
+
const webpushContent = get(baseContent, 'content.webpush', {});
|
|
1412
|
+
const {
|
|
1413
|
+
title = '',
|
|
1414
|
+
message = '',
|
|
1415
|
+
brandIcon,
|
|
1416
|
+
iconImageUrl: existingIconImageUrl,
|
|
1417
|
+
onClickAction,
|
|
1418
|
+
cta: existingCta,
|
|
1419
|
+
image,
|
|
1420
|
+
ctas: rawCtas,
|
|
1421
|
+
expandableDetails: existingExpandable,
|
|
1422
|
+
} = webpushContent;
|
|
1423
|
+
const accountId = get(template, 'definition.accountId', null);
|
|
1424
|
+
const templateName = template?.name || '';
|
|
1425
|
+
|
|
1426
|
+
// iconImageUrl stored as brandIcon in creatives format
|
|
1427
|
+
const iconImageUrl = brandIcon || existingIconImageUrl || undefined;
|
|
1428
|
+
|
|
1429
|
+
// cta stored as onClickAction in creatives format (type: URL|SITE_URL, url)
|
|
1430
|
+
// or already as cta in campaign format (type: EXTERNAL_URL|SITE_URL, actionLink)
|
|
1431
|
+
let cta = null;
|
|
1432
|
+
if (onClickAction) {
|
|
1433
|
+
const ctaType = onClickAction.type === URL ? EXTERNAL_URL : (onClickAction.type || SITE_URL);
|
|
1434
|
+
cta = { type: ctaType, actionLink: onClickAction.url || '' };
|
|
1435
|
+
} else if (existingCta) {
|
|
1436
|
+
cta = { type: existingCta.type || EXTERNAL_URL, actionLink: existingCta.actionLink || '' };
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
// expandableDetails: image → media[], ctas[] → mapped ctas
|
|
1440
|
+
let expandableDetails = null;
|
|
1441
|
+
const hasImage = !!image;
|
|
1442
|
+
const hasCtas = Array.isArray(rawCtas) && rawCtas.length > 0;
|
|
1443
|
+
if (hasImage || hasCtas) {
|
|
1444
|
+
expandableDetails = {
|
|
1445
|
+
media: hasImage ? [{ url: image, type: IMAGE }] : [],
|
|
1446
|
+
ctas: hasCtas ? rawCtas.map((ctaItem) => ({
|
|
1447
|
+
type: ctaItem?.type === URL ? EXTERNAL_URL : (ctaItem?.type || EXTERNAL_URL),
|
|
1448
|
+
action: ctaItem?.action || '',
|
|
1449
|
+
title: ctaItem?.actionText || ctaItem?.title || '',
|
|
1450
|
+
actionLink: ctaItem?.actionLink || '',
|
|
1451
|
+
})) : [],
|
|
1452
|
+
};
|
|
1453
|
+
} else if (existingExpandable) {
|
|
1454
|
+
expandableDetails = {
|
|
1455
|
+
media: existingExpandable?.media || [],
|
|
1456
|
+
ctas: existingExpandable?.ctas || [],
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
return {
|
|
1461
|
+
channel: WEBPUSH,
|
|
1462
|
+
accountId,
|
|
1463
|
+
content: {
|
|
1464
|
+
title,
|
|
1465
|
+
message,
|
|
1466
|
+
...(iconImageUrl ? { iconImageUrl } : {}),
|
|
1467
|
+
...(cta ? { cta } : {}),
|
|
1468
|
+
...(expandableDetails ? { expandableDetails } : {}),
|
|
1469
|
+
},
|
|
1470
|
+
messageSubject: templateName || title,
|
|
1471
|
+
offers: [],
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1405
1475
|
default:
|
|
1406
1476
|
console.warn(`Unsupported channel for content extraction: ${channelUpper}`);
|
|
1407
1477
|
return null;
|
|
@@ -1414,7 +1484,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1414
1484
|
* @returns {Boolean} - True if channel supports Test and Preview
|
|
1415
1485
|
*/
|
|
1416
1486
|
isTestAndPreviewSupported = () => {
|
|
1417
|
-
const supportedChannels = [EMAIL, SMS, INAPP, MOBILE_PUSH, VIBER, ZALO];
|
|
1487
|
+
const supportedChannels = [EMAIL, SMS, INAPP, MOBILE_PUSH, VIBER, ZALO, WEBPUSH];
|
|
1418
1488
|
return supportedChannels.includes(this.state.channel.toUpperCase());
|
|
1419
1489
|
}
|
|
1420
1490
|
|
|
@@ -1974,7 +2044,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1974
2044
|
// Show preview icon only for channels that don't support Test and Preview
|
|
1975
2045
|
(() => {
|
|
1976
2046
|
// Channels that have Test and Preview integrated
|
|
1977
|
-
const testAndPreviewChannels = [EMAIL, SMS, WHATSAPP, RCS, INAPP, MOBILE_PUSH, VIBER, ZALO];
|
|
2047
|
+
const testAndPreviewChannels = [EMAIL, SMS, WHATSAPP, RCS, INAPP, MOBILE_PUSH, VIBER, ZALO, WEBPUSH];
|
|
1978
2048
|
const isTestAndPreviewSupported = testAndPreviewChannels.includes(currentChannel.toUpperCase());
|
|
1979
2049
|
|
|
1980
2050
|
// Don't show preview icon if channel supports Test and Preview
|