@capillarytech/creatives-library 8.0.123 → 8.0.124
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/containers/App/constants.js +1 -0
- package/package.json +1 -1
- package/services/api.js +1 -1
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +8 -3
- package/tests/integration/TemplateCreation/api-response.js +5 -0
- package/tests/integration/TemplateCreation/msw-handler.js +42 -63
- package/utils/common.js +7 -0
- package/utils/commonUtils.js +2 -6
- package/utils/createPayload.js +240 -0
- package/utils/tests/createPayload.test.js +761 -0
- package/v2Components/CapDeviceContent/index.js +1 -0
- package/v2Components/CapImageUpload/index.js +51 -45
- package/v2Components/CapInAppCTA/index.js +1 -0
- package/v2Components/CapMpushCTA/constants.js +25 -0
- package/v2Components/CapMpushCTA/index.js +332 -0
- package/v2Components/CapMpushCTA/index.scss +95 -0
- package/v2Components/CapMpushCTA/messages.js +89 -0
- package/v2Components/CapTagList/index.js +177 -120
- package/v2Components/CapVideoUpload/constants.js +3 -0
- package/v2Components/CapVideoUpload/index.js +167 -110
- package/v2Components/CapVideoUpload/messages.js +16 -0
- package/v2Components/ErrorInfoNote/style.scss +1 -0
- package/v2Components/MobilePushPreviewV2/index.js +37 -5
- package/v2Components/TemplatePreview/_templatePreview.scss +114 -72
- package/v2Components/TemplatePreview/assets/images/Android _ With date and time.svg +29 -0
- package/v2Components/TemplatePreview/assets/images/android.svg +9 -0
- package/v2Components/TemplatePreview/assets/images/iOS _ With date and time.svg +26 -0
- package/v2Components/TemplatePreview/assets/images/ios.svg +9 -0
- package/v2Components/TemplatePreview/index.js +178 -50
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -8
- package/v2Containers/CreativesContainer/index.js +194 -138
- package/v2Containers/InApp/constants.js +1 -1
- package/v2Containers/InApp/index.js +13 -13
- package/v2Containers/MobilePush/Create/index.js +1 -0
- package/v2Containers/MobilePushNew/actions.js +116 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +170 -0
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +686 -0
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +279 -0
- package/v2Containers/MobilePushNew/components/index.js +5 -0
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +779 -0
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +2114 -0
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +343 -0
- package/v2Containers/MobilePushNew/constants.js +115 -0
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1299 -0
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +1223 -0
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +246 -0
- package/v2Containers/MobilePushNew/hooks/useUpload.js +709 -0
- package/v2Containers/MobilePushNew/index.js +1960 -0
- package/v2Containers/MobilePushNew/index.scss +308 -0
- package/v2Containers/MobilePushNew/messages.js +226 -0
- package/v2Containers/MobilePushNew/reducer.js +160 -0
- package/v2Containers/MobilePushNew/sagas.js +198 -0
- package/v2Containers/MobilePushNew/selectors.js +55 -0
- package/v2Containers/MobilePushNew/tests/reducer.test.js +741 -0
- package/v2Containers/MobilePushNew/tests/sagas.test.js +863 -0
- package/v2Containers/MobilePushNew/tests/selectors.test.js +425 -0
- package/v2Containers/MobilePushNew/tests/utils.test.js +322 -0
- package/v2Containers/MobilePushNew/utils.js +33 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +5 -5
- package/v2Containers/TagList/index.js +56 -10
- package/v2Containers/Templates/_templates.scss +101 -1
- package/v2Containers/Templates/index.js +147 -35
- package/v2Containers/Templates/messages.js +8 -0
- package/v2Containers/Templates/sagas.js +2 -0
- package/v2Containers/Whatsapp/constants.js +1 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
@import '~@capillarytech/cap-ui-library/styles/_variables';
|
|
2
|
+
|
|
3
|
+
.header-row {
|
|
4
|
+
margin-bottom: $CAP_SPACE_24;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.content-row {
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: $CAP_SPACE_32;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mobile-push-content {
|
|
13
|
+
gap: $CAP_SPACE_24;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.preview-section {
|
|
17
|
+
background: #fff;
|
|
18
|
+
border-radius: $CAP_SPACE_08;
|
|
19
|
+
padding: $CAP_SPACE_24;
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: flex-start;
|
|
23
|
+
min-height: 37.5rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.form-section {
|
|
27
|
+
padding: $CAP_SPACE_24;
|
|
28
|
+
background: #fff;
|
|
29
|
+
border-radius: $CAP_SPACE_08;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.creative-name-section {
|
|
33
|
+
margin-bottom: $CAP_SPACE_24;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.platform-header {
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
margin-bottom: $CAP_SPACE_24;
|
|
41
|
+
border-bottom: 1px solid #e0e0e0;
|
|
42
|
+
padding-bottom: $CAP_SPACE_16;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.platform-header .platform-tabs {
|
|
46
|
+
flex: 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// .platform-header {
|
|
50
|
+
// margin-left: 24px;
|
|
51
|
+
// }
|
|
52
|
+
|
|
53
|
+
.tab-label {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
gap: 8px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.android-icon,
|
|
60
|
+
.ios-icon {
|
|
61
|
+
width: $CAP_SPACE_20;
|
|
62
|
+
height: $CAP_SPACE_20;
|
|
63
|
+
background-size: contain;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.same-content-checkbox {
|
|
67
|
+
position: absolute;
|
|
68
|
+
right: 0;
|
|
69
|
+
margin-top: $CAP_SPACE_12;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.input-section {
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: column;
|
|
75
|
+
gap: $CAP_SPACE_24;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.input-group {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
gap: $CAP_SPACE_16;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.creatives-mpush-title,
|
|
85
|
+
.creatives-mpush-message {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
gap: $CAP_SPACE_08;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.mpush-title-main,
|
|
92
|
+
.mpush-message-main {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
justify-content: space-between;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.mpush-title,
|
|
99
|
+
.mpush-message,
|
|
100
|
+
.mpush-media-type {
|
|
101
|
+
font-weight: 500;
|
|
102
|
+
color: #333;
|
|
103
|
+
margin: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.add-labels,
|
|
107
|
+
#add-primary-button,
|
|
108
|
+
#add-secondary-button {
|
|
109
|
+
color: #1890ff;
|
|
110
|
+
font-size: 14px;
|
|
111
|
+
background: none;
|
|
112
|
+
border: none;
|
|
113
|
+
padding: 0;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
margin-top: 5px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.add-labels:hover,
|
|
121
|
+
#add-primary-button:hover,
|
|
122
|
+
#add-secondary-button:hover {
|
|
123
|
+
color: #40a9ff;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.button-form {
|
|
127
|
+
margin-top: $CAP_SPACE_16;
|
|
128
|
+
padding: $CAP_SPACE_16;
|
|
129
|
+
border: 1px solid #e8e8e8;
|
|
130
|
+
border-radius: $CAP_SPACE_04;
|
|
131
|
+
background: #fafafa;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.button-form .cap-input,
|
|
135
|
+
.button-form .cap-select {
|
|
136
|
+
margin-bottom: $CAP_SPACE_16;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.button-form .button-actions {
|
|
140
|
+
display: flex;
|
|
141
|
+
gap: $CAP_SPACE_08;
|
|
142
|
+
justify-content: flex-end;
|
|
143
|
+
margin-top: $CAP_SPACE_24;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.optional-text {
|
|
147
|
+
color: #8c8c8c;
|
|
148
|
+
font-size: 14px;
|
|
149
|
+
margin-left: $CAP_SPACE_08;
|
|
150
|
+
font-weight: normal;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.action-description {
|
|
154
|
+
color: #8c8c8c;
|
|
155
|
+
font-size: 14px;
|
|
156
|
+
margin-top: $CAP_SPACE_04;
|
|
157
|
+
margin-bottom: $CAP_SPACE_16;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.buttons-heading {
|
|
161
|
+
margin-bottom: $CAP_SPACE_12;
|
|
162
|
+
margin-top: $CAP_SPACE_16;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.helper-text {
|
|
166
|
+
color: #8c8c8c;
|
|
167
|
+
font-size: 14px;
|
|
168
|
+
margin-top: $CAP_SPACE_08;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.button-group {
|
|
172
|
+
display: flex;
|
|
173
|
+
gap: $CAP_SPACE_16;
|
|
174
|
+
margin-top: $CAP_SPACE_32;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.phone-time {
|
|
178
|
+
text-align: center;
|
|
179
|
+
font-size: 14px;
|
|
180
|
+
color: #333;
|
|
181
|
+
margin-bottom: $CAP_SPACE_16;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.notification-preview {
|
|
185
|
+
background: #f8f8f8;
|
|
186
|
+
padding: $CAP_SPACE_16;
|
|
187
|
+
border-radius: $CAP_SPACE_08;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.notification-title {
|
|
191
|
+
font-weight: 500;
|
|
192
|
+
margin-bottom: $CAP_SPACE_08;
|
|
193
|
+
color: #333;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.notification-body {
|
|
197
|
+
color: #666;
|
|
198
|
+
font-size: 14px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.mpush-actions-main {
|
|
202
|
+
display: flex;
|
|
203
|
+
margin-bottom: 0.9375rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.optional-text {
|
|
207
|
+
padding-top: $CAP_SPACE_03;
|
|
208
|
+
padding-left: 0.625rem;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.action-on-click-checkbox {
|
|
212
|
+
margin-left: -3px;
|
|
213
|
+
margin-top: $CAP_SPACE_02;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.action-description {
|
|
217
|
+
margin-left: 2.438rem;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
#add-primary-btn-heading #add-secondary-btn-heading {
|
|
221
|
+
font-weight: 500;
|
|
222
|
+
color: #1890ff;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* Carousel Styles */
|
|
226
|
+
.carousel-media-selection {
|
|
227
|
+
display: flex;
|
|
228
|
+
align-items: center;
|
|
229
|
+
.carousel-media-selection-heading {
|
|
230
|
+
margin-right: 20px;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.carousel-radio-wrapper {
|
|
235
|
+
padding-top: 24px;
|
|
236
|
+
padding-bottom: 16px;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.mobile-push-carousel-tab {
|
|
240
|
+
max-width: 39.063rem;
|
|
241
|
+
.ant-tabs-extra-content {
|
|
242
|
+
padding: 0;
|
|
243
|
+
line-height: normal;
|
|
244
|
+
.add-carousel-content-button {
|
|
245
|
+
padding: 0.642rem 0px;
|
|
246
|
+
margin: 0;
|
|
247
|
+
}
|
|
248
|
+
.cap-divider-v2{
|
|
249
|
+
height: 1.5rem;
|
|
250
|
+
margin-bottom: 0.499rem;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
.ant-tabs-tabpane {
|
|
254
|
+
min-height: unset;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.mobile-push-carousel-card {
|
|
259
|
+
.ant-card-head {
|
|
260
|
+
border-bottom: none;
|
|
261
|
+
}
|
|
262
|
+
.ant-card-body {
|
|
263
|
+
padding-top: 0px;
|
|
264
|
+
}
|
|
265
|
+
.ant-card-head-wrapper {
|
|
266
|
+
.ant-card-extra {
|
|
267
|
+
.cap-button-v2 {
|
|
268
|
+
padding: 0px;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.mobile-push-carousel-message-heading {
|
|
275
|
+
margin-top: 24px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.mobile-push-media-radio>label.ant-radio-wrapper {
|
|
279
|
+
margin-right: 50px;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.mobile-push-create-template-message-input-wrapper {
|
|
283
|
+
position: relative;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.cap-custom-image-upload {
|
|
287
|
+
.dragger-button.re-upload {
|
|
288
|
+
top: -175px;
|
|
289
|
+
position: relative;
|
|
290
|
+
left: 525px;
|
|
291
|
+
color: #666;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.cap-custom-video-upload {
|
|
296
|
+
padding-top: 20px;
|
|
297
|
+
.dragger-button.re-upload {
|
|
298
|
+
top: -175px;
|
|
299
|
+
position: relative;
|
|
300
|
+
left: 525px;
|
|
301
|
+
color: #666;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.note-message-container {
|
|
306
|
+
display: flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
|
|
3
|
+
const scope = 'creatives.containersV2.MobilePushNew';
|
|
4
|
+
|
|
5
|
+
export default defineMessages({
|
|
6
|
+
imageErrorMessage: {
|
|
7
|
+
id: `${scope}.imageErrorMessage`,
|
|
8
|
+
defaultMessage: 'Please upload the image with allowed file extension, size, dimension and aspect ratio',
|
|
9
|
+
},
|
|
10
|
+
saveTemplate: {
|
|
11
|
+
id: `${scope}.saveTemplate`,
|
|
12
|
+
defaultMessage: 'Save Template',
|
|
13
|
+
},
|
|
14
|
+
creativeName: {
|
|
15
|
+
id: `${scope}.creativeName`,
|
|
16
|
+
defaultMessage: 'Creative name',
|
|
17
|
+
},
|
|
18
|
+
creativeNamePlaceholder: {
|
|
19
|
+
id: `${scope}.creativeNamePlaceholder`,
|
|
20
|
+
defaultMessage: 'Enter creative name',
|
|
21
|
+
},
|
|
22
|
+
android: {
|
|
23
|
+
id: `${scope}.android`,
|
|
24
|
+
defaultMessage: 'Android',
|
|
25
|
+
},
|
|
26
|
+
ios: {
|
|
27
|
+
id: `${scope}.ios`,
|
|
28
|
+
defaultMessage: 'iOS',
|
|
29
|
+
},
|
|
30
|
+
title: {
|
|
31
|
+
id: `${scope}.title`,
|
|
32
|
+
defaultMessage: 'Title',
|
|
33
|
+
},
|
|
34
|
+
titlePlaceholder: {
|
|
35
|
+
id: `${scope}.titlePlaceholder`,
|
|
36
|
+
defaultMessage: 'Enter title',
|
|
37
|
+
},
|
|
38
|
+
addLabels: {
|
|
39
|
+
id: `${scope}.addLabels`,
|
|
40
|
+
defaultMessage: 'Add labels',
|
|
41
|
+
},
|
|
42
|
+
message: {
|
|
43
|
+
id: `${scope}.message`,
|
|
44
|
+
defaultMessage: 'Message',
|
|
45
|
+
},
|
|
46
|
+
messagePlaceholder: {
|
|
47
|
+
id: `${scope}.contentPlaceholder`,
|
|
48
|
+
defaultMessage: 'Enter message',
|
|
49
|
+
},
|
|
50
|
+
mediaType: {
|
|
51
|
+
id: `${scope}.mediaType`,
|
|
52
|
+
defaultMessage: 'Media type',
|
|
53
|
+
},
|
|
54
|
+
buttonsAndLinks: {
|
|
55
|
+
id: `${scope}.buttonsAndLinks`,
|
|
56
|
+
defaultMessage: 'Buttons and links',
|
|
57
|
+
},
|
|
58
|
+
optionalText: {
|
|
59
|
+
id: `${scope}.optionalText`,
|
|
60
|
+
defaultMessage: '(Optional)',
|
|
61
|
+
},
|
|
62
|
+
actionOnClick: {
|
|
63
|
+
id: `${scope}.actionOnClick`,
|
|
64
|
+
defaultMessage: 'Action on click of notification body',
|
|
65
|
+
},
|
|
66
|
+
helperText: {
|
|
67
|
+
id: `${scope}.helperText`,
|
|
68
|
+
defaultMessage: 'Define where the users will redirect when they click on the body of the push notification',
|
|
69
|
+
},
|
|
70
|
+
done: {
|
|
71
|
+
id: `${scope}.done`,
|
|
72
|
+
defaultMessage: 'Done',
|
|
73
|
+
},
|
|
74
|
+
previewAndTest: {
|
|
75
|
+
id: `${scope}.previewAndTest`,
|
|
76
|
+
defaultMessage: 'Preview and Test',
|
|
77
|
+
},
|
|
78
|
+
addPrimaryButton: {
|
|
79
|
+
id: `${scope}.addPrimaryButton`,
|
|
80
|
+
defaultMessage: 'Add primary button',
|
|
81
|
+
},
|
|
82
|
+
emptyTemplateDescErrorMessage: {
|
|
83
|
+
id: `${scope}.emptyTemplateDescErrorMessage`,
|
|
84
|
+
defaultMessage: 'Template message cannot be empty',
|
|
85
|
+
},
|
|
86
|
+
selectMediaType: {
|
|
87
|
+
id: `${scope}.selectMediaType`,
|
|
88
|
+
defaultMessage: 'None',
|
|
89
|
+
},
|
|
90
|
+
actionOnClickBody: {
|
|
91
|
+
id: `${scope}.actionOnClickBody`,
|
|
92
|
+
defaultMessage: 'Action on click of notification body',
|
|
93
|
+
},
|
|
94
|
+
actionDescription: {
|
|
95
|
+
id: `${scope}.actionDescription`,
|
|
96
|
+
defaultMessage: 'Define where the users will redirect when they click on the body of the push notification',
|
|
97
|
+
},
|
|
98
|
+
buttons: {
|
|
99
|
+
id: `${scope}.buttons`,
|
|
100
|
+
defaultMessage: 'Buttons',
|
|
101
|
+
},
|
|
102
|
+
linkType: {
|
|
103
|
+
id: 'app.containers.MobilePushNew.linkType',
|
|
104
|
+
defaultMessage: 'Link Type',
|
|
105
|
+
},
|
|
106
|
+
selectDeepLink: {
|
|
107
|
+
id: `${scope}.selectDeepLink`,
|
|
108
|
+
defaultMessage: 'Select deep link',
|
|
109
|
+
},
|
|
110
|
+
deepLink: {
|
|
111
|
+
id: 'app.containers.MobilePushNew.deepLink',
|
|
112
|
+
defaultMessage: 'Deep Link',
|
|
113
|
+
},
|
|
114
|
+
externalLink: {
|
|
115
|
+
id: 'app.containers.MobilePushNew.externalLink',
|
|
116
|
+
defaultMessage: 'External Link',
|
|
117
|
+
},
|
|
118
|
+
enterExternalLink: {
|
|
119
|
+
id: `${scope}.enterExternalLink`,
|
|
120
|
+
defaultMessage: 'Enter external link',
|
|
121
|
+
},
|
|
122
|
+
invalidUrl: {
|
|
123
|
+
id: `${scope}.invalidUrl`,
|
|
124
|
+
defaultMessage: 'Please enter a valid URL',
|
|
125
|
+
},
|
|
126
|
+
invalidButtonText: {
|
|
127
|
+
id: `${scope}.invalidButtonText`,
|
|
128
|
+
defaultMessage: 'Button text cannot be empty or contain only whitespace',
|
|
129
|
+
},
|
|
130
|
+
addSecondaryButton: {
|
|
131
|
+
id: `${scope}.addSecondaryButton`,
|
|
132
|
+
defaultMessage: 'Add secondary button',
|
|
133
|
+
},
|
|
134
|
+
videoErrorMessage: {
|
|
135
|
+
id: `${scope}.videoErrorMessage`,
|
|
136
|
+
defaultMessage: 'Please upload the video with allowed file extension, size, dimension and aspect ratio',
|
|
137
|
+
},
|
|
138
|
+
gifErrorMessage: {
|
|
139
|
+
id: `${scope}.gifErrorMessage`,
|
|
140
|
+
defaultMessage: 'Please upload the gif with allowed file extension, size, dimension and aspect ratio',
|
|
141
|
+
},
|
|
142
|
+
primaryButtonText: {
|
|
143
|
+
id: `${scope}.primaryButtonText`,
|
|
144
|
+
defaultMessage: 'Primary button text',
|
|
145
|
+
},
|
|
146
|
+
secondaryButtonText: {
|
|
147
|
+
id: `${scope}.secondaryButtonText`,
|
|
148
|
+
defaultMessage: 'Secondary button text',
|
|
149
|
+
},
|
|
150
|
+
enterButtonText: {
|
|
151
|
+
id: `${scope}.enterButtonText`,
|
|
152
|
+
defaultMessage: 'Enter button text',
|
|
153
|
+
},
|
|
154
|
+
ctaSaveDisabled: {
|
|
155
|
+
id: `${scope}.ctaSaveDisabled`,
|
|
156
|
+
defaultMessage: 'Please complete the above fields to enable button',
|
|
157
|
+
},
|
|
158
|
+
actionLink: {
|
|
159
|
+
id: `${scope}.actionLink`,
|
|
160
|
+
defaultMessage: 'Action Link',
|
|
161
|
+
},
|
|
162
|
+
emptyTemplateErrorMessage: {
|
|
163
|
+
id: `${scope}.emptyTemplateErrorMessage`,
|
|
164
|
+
defaultMessage: 'Template name cannot be empty',
|
|
165
|
+
},
|
|
166
|
+
messageCreateSuccess: {
|
|
167
|
+
id: `${scope}.messageCreateSuccess`,
|
|
168
|
+
defaultMessage: 'Mobile push template created successfully',
|
|
169
|
+
},
|
|
170
|
+
messageEditSuccess: {
|
|
171
|
+
id: `${scope}.messageEditSuccess`,
|
|
172
|
+
defaultMessage: 'Mobile push template updated successfully',
|
|
173
|
+
},
|
|
174
|
+
somethingWentWrong: {
|
|
175
|
+
id: `${scope}.somethingWentWrong`,
|
|
176
|
+
defaultMessage: 'Something went wrong!!',
|
|
177
|
+
},
|
|
178
|
+
validationLoadingMessage: {
|
|
179
|
+
id: `${scope}.validationLoadingMessage`,
|
|
180
|
+
defaultMessage: 'Please wait while we validate the template',
|
|
181
|
+
},
|
|
182
|
+
androidValidationError: {
|
|
183
|
+
id: `${scope}.androidValidationError`,
|
|
184
|
+
defaultMessage: 'Please fill in title and message for Android',
|
|
185
|
+
},
|
|
186
|
+
iosValidationError: {
|
|
187
|
+
id: `${scope}.iosValidationError`,
|
|
188
|
+
defaultMessage: 'Please fill in title and message for iOS',
|
|
189
|
+
},
|
|
190
|
+
carouselMediaType: {
|
|
191
|
+
id: `${scope}.carouselMediaType`,
|
|
192
|
+
defaultMessage: 'Carousel media Type',
|
|
193
|
+
},
|
|
194
|
+
mediaImage: {
|
|
195
|
+
id: `${scope}.mediaImage`,
|
|
196
|
+
defaultMessage: 'Image',
|
|
197
|
+
},
|
|
198
|
+
mediaVideo: {
|
|
199
|
+
id: `${scope}.mediaVideo`,
|
|
200
|
+
defaultMessage: 'Video',
|
|
201
|
+
},
|
|
202
|
+
card: {
|
|
203
|
+
id: `${scope}.card`,
|
|
204
|
+
defaultMessage: 'Card',
|
|
205
|
+
},
|
|
206
|
+
addCard: {
|
|
207
|
+
id: `${scope}.addCard`,
|
|
208
|
+
defaultMessage: 'Add Card',
|
|
209
|
+
},
|
|
210
|
+
templateCreateSuccess: {
|
|
211
|
+
id: `${scope}.templateCreateSuccess`,
|
|
212
|
+
defaultMessage: 'Mobile push template created successfully',
|
|
213
|
+
},
|
|
214
|
+
templateUpdateSuccess: {
|
|
215
|
+
id: `${scope}.templateUpdateSuccess`,
|
|
216
|
+
defaultMessage: 'Mobile push template updated successfully',
|
|
217
|
+
},
|
|
218
|
+
sameContentForBothChannels: {
|
|
219
|
+
id: `${scope}.sameContentForBothChannels`,
|
|
220
|
+
defaultMessage: 'Same content for both channels',
|
|
221
|
+
},
|
|
222
|
+
sameContentNote: {
|
|
223
|
+
id: `${scope}.sameContentNote`,
|
|
224
|
+
defaultMessage: 'Edits in one tab are automatically synced to other',
|
|
225
|
+
},
|
|
226
|
+
});
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Create & Edit reducer
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { fromJS } from "immutable";
|
|
8
|
+
import * as types from "./constants";
|
|
9
|
+
|
|
10
|
+
const initialState = fromJS({
|
|
11
|
+
createTemplateInProgress: false,
|
|
12
|
+
response: {},
|
|
13
|
+
editTemplateInProgress: false,
|
|
14
|
+
editResponse: {},
|
|
15
|
+
getTemplateDetailsInProgress: false,
|
|
16
|
+
templateDetails: {},
|
|
17
|
+
createTemplateErrorMessage: "",
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export function mobilePushReducer(state = initialState, action) {
|
|
21
|
+
// Handle null or undefined action
|
|
22
|
+
if (!action || typeof action !== 'object') {
|
|
23
|
+
return state;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
switch (action.type) {
|
|
27
|
+
case types.DEFAULT_ACTION:
|
|
28
|
+
return state;
|
|
29
|
+
case types.CREATE_TEMPLATE_REQUEST:
|
|
30
|
+
return state
|
|
31
|
+
.set("createTemplateInProgress", true)
|
|
32
|
+
.set("createTemplateError", false)
|
|
33
|
+
.set("createTemplateErrorMessage", fromJS(""));
|
|
34
|
+
case types.CREATE_TEMPLATE_SUCCESS:
|
|
35
|
+
return state
|
|
36
|
+
.set("createTemplateInProgress", false)
|
|
37
|
+
.set("response", action.data)
|
|
38
|
+
.set(
|
|
39
|
+
"createTemplateError",
|
|
40
|
+
action.statusCode !== undefined && action.statusCode > 300
|
|
41
|
+
);
|
|
42
|
+
case types.CREATE_TEMPLATE_FAILURE:
|
|
43
|
+
return state
|
|
44
|
+
.set("createTemplateInProgress", false)
|
|
45
|
+
.set("createTemplateError", true)
|
|
46
|
+
.set("createTemplateErrorMessage", fromJS(action.error));
|
|
47
|
+
case types.CLEAR_CREATE_RESPONSE_REQUEST:
|
|
48
|
+
return state.set("response", {});
|
|
49
|
+
case types.UPLOAD_ASSET_REQUEST:
|
|
50
|
+
return state.set("uploadAssetSuccess", false).set("assetUploading", true);
|
|
51
|
+
case types.UPLOAD_ASSET_SUCCESS:
|
|
52
|
+
return state
|
|
53
|
+
.set(
|
|
54
|
+
"uploadAssetSuccess",
|
|
55
|
+
action.statusCode !== undefined
|
|
56
|
+
&& action.statusCode !== ""
|
|
57
|
+
&& action.statusCode < 300
|
|
58
|
+
)
|
|
59
|
+
.set("assetUploading", false)
|
|
60
|
+
.set(action.index !== undefined ? `uploadedAssetData${action.index}` : "uploadedAssetData", action.data);
|
|
61
|
+
case types.UPLOAD_ASSET_FAILURE:
|
|
62
|
+
return state
|
|
63
|
+
.set("uploadAssetSuccess", false)
|
|
64
|
+
.set("assetUploading", false);
|
|
65
|
+
case types.CLEAR_ASSET:
|
|
66
|
+
return action.index !== undefined
|
|
67
|
+
? state.delete(`uploadedAssetData${action.index}`)
|
|
68
|
+
: state.delete("uploadedAssetData");
|
|
69
|
+
case types.GET_IOS_CTAS:
|
|
70
|
+
return state.set("getIosCtasSucccess", false).set("iosCtasLoading", true);
|
|
71
|
+
case types.GET_IOS_CTAS_SUCCESS:
|
|
72
|
+
return state
|
|
73
|
+
.set(
|
|
74
|
+
"getIosCtasSucccess",
|
|
75
|
+
action.statusCode !== undefined
|
|
76
|
+
&& action.statusCode !== ""
|
|
77
|
+
&& action.statusCode < 300
|
|
78
|
+
)
|
|
79
|
+
.set("iosCtasLoading", false)
|
|
80
|
+
.set("iosCtasData", action.data);
|
|
81
|
+
case types.GET_IOS_CTAS_FAILURE:
|
|
82
|
+
return state
|
|
83
|
+
.set("getIosCtasSucccess", false)
|
|
84
|
+
.set("iosCtasLoading", false);
|
|
85
|
+
case types.RESET_STORE:
|
|
86
|
+
return state
|
|
87
|
+
.delete("uploadedAssetData")
|
|
88
|
+
.delete("uploadedAssetData0")
|
|
89
|
+
.delete("uploadedAssetData1")
|
|
90
|
+
.delete("iosCtasData");
|
|
91
|
+
case types.EDIT_TEMPLATE_REQUEST:
|
|
92
|
+
return state
|
|
93
|
+
.set("editTemplateInProgress", true)
|
|
94
|
+
.set("editTemplateError", false)
|
|
95
|
+
.set("editTemplateErrorMessage", fromJS(""));
|
|
96
|
+
case types.EDIT_TEMPLATE_SUCCESS:
|
|
97
|
+
return state
|
|
98
|
+
.set("editTemplateInProgress", false)
|
|
99
|
+
.set("editResponse", action.data)
|
|
100
|
+
.set(
|
|
101
|
+
"editTemplateError",
|
|
102
|
+
action.statusCode !== undefined && action.statusCode > 300
|
|
103
|
+
)
|
|
104
|
+
.set("editTemplateErrorMessage", fromJS(action.errorMsg));
|
|
105
|
+
case types.EDIT_TEMPLATE_FAILURE:
|
|
106
|
+
return state
|
|
107
|
+
.set("editTemplateInProgress", false)
|
|
108
|
+
.set("editTemplateError", true)
|
|
109
|
+
.set("editTemplateErrorMessage", fromJS(action.errorMsg));
|
|
110
|
+
case types.GET_TEMPLATE_DETAILS_REQUEST:
|
|
111
|
+
return state.set("getTemplateDetailsInProgress", true);
|
|
112
|
+
case types.GET_TEMPLATE_DETAILS_SUCCESS:
|
|
113
|
+
case types.SET_SELECTED_TEMPLATE:
|
|
114
|
+
return state
|
|
115
|
+
.set("getTemplateDetailsInProgress", false)
|
|
116
|
+
.set("templateDetails", action.data);
|
|
117
|
+
case types.GET_TEMPLATE_DETAILS_FAILURE:
|
|
118
|
+
return state.set("getTemplateDetailsInProgress", false);
|
|
119
|
+
case types.CLEAR_EDIT_RESPONSE_REQUEST:
|
|
120
|
+
return state.set("editResponse", {});
|
|
121
|
+
case types.CLEAR_DATA:
|
|
122
|
+
return state
|
|
123
|
+
.delete("uploadedAssetData")
|
|
124
|
+
.delete("uploadedAssetData0")
|
|
125
|
+
.delete("uploadedAssetData1")
|
|
126
|
+
.delete("metaEntities")
|
|
127
|
+
.delete("templateDetails")
|
|
128
|
+
.delete("iosCtasData");
|
|
129
|
+
case types.GET_WECRM_ACCOUNTS_REQUEST:
|
|
130
|
+
return state
|
|
131
|
+
.set("fetchingWeCrmAccounts", true)
|
|
132
|
+
.set("weCrmAccountFetchingError", false);
|
|
133
|
+
case types.GET_WECRM_ACCOUNTS_SUCCESS:
|
|
134
|
+
return state
|
|
135
|
+
.set("fetchingWeCrmAccounts", false)
|
|
136
|
+
.set("weCrmAccounts", fromJS(action.data));
|
|
137
|
+
case types.GET_WECRM_ACCOUNTS_FAILURE:
|
|
138
|
+
return state
|
|
139
|
+
.set("fetchingWeCrmAccounts", false)
|
|
140
|
+
.set("weCrmAccountFetchingError", true);
|
|
141
|
+
case types.SET_WECHAT_ACCOUNT:
|
|
142
|
+
return state
|
|
143
|
+
.set("selectedWeChatAccount", fromJS(action.weChatAccount))
|
|
144
|
+
.delete("mobilepushTemplates");
|
|
145
|
+
case types.GET_MOBILEPUSH_TEMPLATES_LIST_REQUEST:
|
|
146
|
+
return state.set("fetchingDefaultTemplates", true);
|
|
147
|
+
case types.GET_MOBILEPUSH_TEMPLATES_LIST_SUCCESS:
|
|
148
|
+
return state
|
|
149
|
+
.set("fetchingDefaultTemplates", false)
|
|
150
|
+
.set("mobilepushTemplates", fromJS(action.data));
|
|
151
|
+
case types.GET_MOBILEPUSH_TEMPLATES_LIST_FAILURE:
|
|
152
|
+
return state
|
|
153
|
+
.set("fetchingDefaultTemplates", false)
|
|
154
|
+
.set("errorFetchingDefaultTempalte", true);
|
|
155
|
+
default:
|
|
156
|
+
return state;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export default mobilePushReducer;
|