@capillarytech/creatives-library 9.1.8-alpha.sprint-cap-214249.38 → 9.2.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 +4 -0
- package/index.js +13 -0
- package/package.json +1 -1
- package/services/getSchema.js +4 -1
- package/services/tests/getSchema.test.js +2 -2
- package/translations/en.json +1 -0
- package/translations/ja-JP.json +1 -0
- package/translations/zh.json +1 -0
- package/utils/common.js +6 -0
- package/utils/createMobilePushPayload.js +33 -47
- package/utils/tagValidations.js +35 -4
- package/utils/templateVarUtils.js +49 -0
- package/utils/tests/createMobilePushPayload.test.js +8 -102
- package/utils/tests/tagValidations.test.js +48 -0
- package/utils/tests/templateVarUtils.test.js +89 -0
- package/v2Components/CapMpushCTA/index.js +9 -10
- package/v2Components/CapMpushCTA/index.scss +3 -29
- package/v2Components/CapTagList/TagFallbackPanel.js +124 -0
- package/v2Components/CapTagList/constants.js +5 -0
- package/v2Components/CapTagList/index.js +46 -7
- package/v2Components/CapTagList/messages.js +44 -0
- package/v2Components/CapTagList/style.scss +113 -1
- package/v2Components/CapTagList/tests/TagFallback.test.js +222 -0
- package/v2Components/CapTagList/utils.js +17 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/MobilePushPreviewContent.js +13 -26
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +1 -13
- package/v2Components/CommonTestAndPreview/constants.js +3 -2
- package/v2Components/CommonTestAndPreview/index.js +62 -62
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/MobilePushPreviewContent.test.js +5 -79
- package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -86
- package/v2Components/CommonTestAndPreview/tests/utils.test.js +102 -0
- package/v2Components/CommonTestAndPreview/utils.js +42 -3
- package/v2Components/FormBuilder/Classic.js +24 -14
- package/v2Components/FormBuilder/Functional/channels/mobilepush/config.js +1 -0
- package/v2Components/FormBuilder/Functional/channels/mobilepush/getEditorErrorDescriptor.js +1 -1
- package/v2Components/FormBuilder/Functional/channels/mobilepush/tests/validate.test.js +57 -0
- package/v2Components/FormBuilder/Functional/channels/mobilepush/validate.js +4 -4
- package/v2Components/FormBuilder/Functional/channels/sms/getEditorErrorDescriptor.js +3 -0
- package/v2Components/FormBuilder/Functional/channels/sms/tests/getEditorErrorDescriptor.test.js +5 -0
- package/v2Components/FormBuilder/Functional/channels/sms/tests/validate.test.js +6 -0
- package/v2Components/FormBuilder/Functional/channels/sms/validate.js +3 -1
- package/v2Components/FormBuilder/Functional/renderers/mpushRenderers.js +3 -0
- package/v2Components/FormBuilder/Functional/tests/manual.typingPerf.test.js +135 -0
- package/v2Components/FormBuilder/Functional/tests/mpush.crossFlowParity.test.js +1 -1
- package/v2Components/FormBuilder/Functional/tests/mpush.ctaFlows.parity.test.js +320 -0
- package/v2Components/FormBuilder/Functional/tests/mpush.editContainer.parity.test.js +148 -0
- package/v2Components/FormBuilder/Functional/tests/mpush.libraryValidity.parity.test.js +152 -0
- package/v2Components/FormBuilder/Functional/tests/mpush.shellEvents.test.js +1 -1
- package/v2Components/FormBuilder/Functional/tests/mpush.singlePlatform.test.js +1 -1
- package/v2Components/FormBuilder/Functional/tests/mpushRenderers.test.js +22 -0
- package/v2Components/FormBuilder/tests/mpush.characterization.test.js +2 -2
- package/v2Components/TemplatePreview/_templatePreview.scss +2 -12
- package/v2Components/TemplatePreview/index.js +17 -30
- package/v2Components/TemplatePreview/tests/index.test.js +0 -61
- package/v2Containers/Cap/index.js +3 -0
- package/v2Containers/Cap/messages.js +4 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +151 -70
- package/v2Containers/CreativesContainer/index.js +6 -3
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -29
- package/v2Containers/InApp/index.js +4 -1
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Text/index.js +3 -1
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +16 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +18 -0
- package/v2Containers/MobilePush/Create/_mobilePushCreate.scss +70 -0
- package/v2Containers/MobilePush/Create/actions.js +52 -0
- package/v2Containers/MobilePush/Create/constants.js +26 -0
- package/v2Containers/MobilePush/Create/index.js +2149 -0
- package/v2Containers/MobilePush/Create/messages.js +349 -0
- package/v2Containers/MobilePush/Create/reducer.js +72 -0
- package/v2Containers/MobilePush/Create/sagas.js +79 -0
- package/v2Containers/MobilePush/Create/selectors.js +29 -0
- package/v2Containers/MobilePush/Create/test/contentValidity.test.js +154 -0
- package/v2Containers/MobilePush/Create/test/saga.test.js +19 -0
- package/v2Containers/MobilePush/Create/test/stayOpenOnSave.test.js +80 -0
- package/v2Containers/MobilePush/Edit/_mobilePushCreate.scss +65 -0
- package/v2Containers/MobilePush/Edit/actions.js +94 -0
- package/v2Containers/MobilePush/Edit/constants.js +37 -0
- package/v2Containers/MobilePush/Edit/index.js +2407 -0
- package/v2Containers/MobilePush/Edit/messages.js +341 -0
- package/v2Containers/MobilePush/Edit/reducer.js +113 -0
- package/v2Containers/MobilePush/Edit/sagas.js +113 -0
- package/v2Containers/MobilePush/Edit/selectors.js +33 -0
- package/v2Containers/MobilePush/Edit/test/contentValidity.test.js +149 -0
- package/v2Containers/MobilePush/Edit/test/saga.test.js +255 -0
- package/v2Containers/MobilePush/Edit/test/stayOpenOnSave.test.js +60 -0
- package/v2Containers/MobilePush/commonMethods.js +333 -0
- package/v2Containers/MobilePush/eventsMap.js +130 -0
- package/v2Containers/MobilePush/tests/commonMethods.test.js +401 -0
- package/v2Containers/MobilePushNew/components/CtaButtons.js +47 -52
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +192 -207
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +121 -116
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +208 -30
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +72 -316
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +16 -45
- package/v2Containers/MobilePushNew/constants.js +0 -5
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +1 -63
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -52
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +1 -38
- package/v2Containers/MobilePushNew/hooks/useUpload.js +39 -29
- package/v2Containers/MobilePushNew/index.js +192 -454
- package/v2Containers/MobilePushNew/index.scss +4 -188
- package/v2Containers/MobilePushNew/messages.js +6 -86
- package/v2Containers/MobilePushNew/tests/index.test.js +1 -450
- package/v2Containers/MobilePushNew/tests/utils.test.js +0 -25
- package/v2Containers/MobilePushNew/utils.js +0 -8
- package/v2Containers/MobilepushWrapper/_mobilepushWrapper.scss +22 -0
- package/v2Containers/MobilepushWrapper/index.js +178 -0
- package/v2Containers/MobilepushWrapper/messages.js +29 -0
- package/v2Containers/Rcs/index.js +8 -1
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +59 -0
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/SmsTrai/Edit/index.js +17 -7
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +42 -0
- package/v2Containers/Templates/_templates.scss +2 -10
- package/v2Containers/Templates/index.js +90 -84
- package/v2Containers/Templates/tests/index.test.js +0 -68
- package/v2Containers/Viber/index.js +3 -1
- package/v2Containers/WebPush/Create/utils/validation.js +6 -0
- package/v2Containers/WebPush/Create/utils/validation.test.js +50 -0
- package/v2Containers/Whatsapp/index.js +9 -5
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Zalo/index.js +4 -1
- package/v2Components/CapMpushCTA/tests/index.test.js +0 -89
- /package/{v2Components/FormBuilder/Functional/tests/fixtures/mpushInitialSchema.js → v2Containers/MobilePush/initialSchema.js} +0 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Create Messages
|
|
3
|
+
*
|
|
4
|
+
* This contains all the text for the Create component.
|
|
5
|
+
*/
|
|
6
|
+
import { defineMessages } from 'react-intl';
|
|
7
|
+
|
|
8
|
+
export default defineMessages({
|
|
9
|
+
"imageUploadLabel": {
|
|
10
|
+
id: 'creatives.containersV2.MobilePush.Create.ImageUploadLabel',
|
|
11
|
+
defaultMessage: 'Upload image',
|
|
12
|
+
},
|
|
13
|
+
"Enter template name*": {
|
|
14
|
+
id: 'creatives.containersV2.MobilePush.Create.enterTemplateNameImportant',
|
|
15
|
+
defaultMessage: 'Enter template name*',
|
|
16
|
+
},
|
|
17
|
+
"Enter template name": {
|
|
18
|
+
id: 'creatives.containersV2.MobilePush.Create.enterTemplateName',
|
|
19
|
+
defaultMessage: 'Enter template name',
|
|
20
|
+
},
|
|
21
|
+
"Template name cannot be empty": {
|
|
22
|
+
id: 'creatives.containersV2.MobilePush.Create.templateCantEmpty',
|
|
23
|
+
defaultMessage: 'Template name cannot be empty',
|
|
24
|
+
},
|
|
25
|
+
"Discard Changes": {
|
|
26
|
+
id: 'creatives.containersV2.MobilePush.Create.discardChanges',
|
|
27
|
+
defaultMessage: 'Discard changes',
|
|
28
|
+
},
|
|
29
|
+
"Cancel": {
|
|
30
|
+
id: 'creatives.containersV2.MobilePush.Create.cancel',
|
|
31
|
+
defaultMessage: 'Cancel',
|
|
32
|
+
},
|
|
33
|
+
"Save": {
|
|
34
|
+
id: 'creatives.containersV2.MobilePush.Create.save',
|
|
35
|
+
defaultMessage: 'Save',
|
|
36
|
+
},
|
|
37
|
+
"Select Mobilepush Account": {
|
|
38
|
+
id: 'creatives.containersV2.MobilePush.Create.selectMobilePushAccount',
|
|
39
|
+
defaultMessage: 'Select mobilepush account',
|
|
40
|
+
},
|
|
41
|
+
"Account Id": {
|
|
42
|
+
id: 'creatives.containersV2.MobilePush.Create.accountId',
|
|
43
|
+
defaultMessage: 'Account id',
|
|
44
|
+
},
|
|
45
|
+
"Select Mobilepush Template": {
|
|
46
|
+
id: 'creatives.containersV2.MobilePush.Create.selectMobilePushTemplate',
|
|
47
|
+
defaultMessage: 'Select mobilepush template',
|
|
48
|
+
},
|
|
49
|
+
"Template": {
|
|
50
|
+
id: 'creatives.containersV2.MobilePush.Create.template',
|
|
51
|
+
defaultMessage: 'Template',
|
|
52
|
+
},
|
|
53
|
+
"Android": {
|
|
54
|
+
id: 'creatives.containersV2.MobilePush.Create.Android',
|
|
55
|
+
defaultMessage: 'Android',
|
|
56
|
+
},
|
|
57
|
+
"Copy Title and Content From IOS": {
|
|
58
|
+
id: 'creatives.containersV2.MobilePush.Create.copyFromIos',
|
|
59
|
+
defaultMessage: 'Copy Title and Content From IOS',
|
|
60
|
+
},
|
|
61
|
+
"Title*": {
|
|
62
|
+
id: 'creatives.containersV2.MobilePush.Create.titleLabel',
|
|
63
|
+
defaultMessage: 'Title*',
|
|
64
|
+
},
|
|
65
|
+
"Title": {
|
|
66
|
+
id: 'creatives.containersV2.MobilePush.Create.title',
|
|
67
|
+
defaultMessage: 'Title',
|
|
68
|
+
},
|
|
69
|
+
"Please input message title name.": {
|
|
70
|
+
id: 'creatives.containersV2.MobilePush.Create.titleNameInvalid',
|
|
71
|
+
defaultMessage: 'Please enter the message title',
|
|
72
|
+
},
|
|
73
|
+
"Template message has unsupported/missing tags!": {
|
|
74
|
+
id: 'creatives.containersV2.MobilePush.Create.messageHasUnsupportedTag',
|
|
75
|
+
defaultMessage: 'Please check the message content for unsupported/missing tags',
|
|
76
|
+
},
|
|
77
|
+
"Tags": {
|
|
78
|
+
id: 'creatives.containersV2.MobilePush.Create.Tags',
|
|
79
|
+
defaultMessage: 'Tags',
|
|
80
|
+
},
|
|
81
|
+
"Message*": {
|
|
82
|
+
id: 'creatives.containersV2.MobilePush.Create.messageLabel',
|
|
83
|
+
defaultMessage: 'Message*',
|
|
84
|
+
},
|
|
85
|
+
"Message": {
|
|
86
|
+
id: 'creatives.containersV2.MobilePush.Create.message',
|
|
87
|
+
defaultMessage: 'Message',
|
|
88
|
+
},
|
|
89
|
+
"Please input mobile push template content.": {
|
|
90
|
+
id: 'creatives.containersV2.MobilePush.Create.inputMobilePushTemplateContent',
|
|
91
|
+
defaultMessage: 'Please enter the message content',
|
|
92
|
+
},
|
|
93
|
+
"addPrimaryCTA": {
|
|
94
|
+
id: 'creatives.containersV2.MobilePush.Create.addPrimaryCTA',
|
|
95
|
+
defaultMessage: 'Add primary CTA',
|
|
96
|
+
},
|
|
97
|
+
"addSecondaryCTA": {
|
|
98
|
+
id: 'creatives.containersV2.MobilePush.Create.addSecondaryCTA',
|
|
99
|
+
defaultMessage: 'Add secondary CTA',
|
|
100
|
+
},
|
|
101
|
+
"iOS": {
|
|
102
|
+
id: 'creatives.containersV2.MobilePush.Create.iOS',
|
|
103
|
+
defaultMessage: 'iOS',
|
|
104
|
+
},
|
|
105
|
+
"Copy Title and Content From Android": {
|
|
106
|
+
id: 'creatives.containersV2.MobilePush.Create.copyFromAndroid',
|
|
107
|
+
defaultMessage: 'Copy Title and Content From Android',
|
|
108
|
+
},
|
|
109
|
+
"Template title has unsupported/missing tags.": {
|
|
110
|
+
id: 'creatives.containersV2.MobilePush.Create.titleHasUnsupportedTag',
|
|
111
|
+
defaultMessage: 'Please check the message content for unsupported/missing tags',
|
|
112
|
+
},
|
|
113
|
+
"Template name cannot be empty.": {
|
|
114
|
+
id: 'creatives.containersV2.MobilePush.Create.templateNameNotEmpty',
|
|
115
|
+
defaultMessage: 'Please provide a template name ',
|
|
116
|
+
},
|
|
117
|
+
"Message title has unsupported/missing tags!": {
|
|
118
|
+
id: 'creatives.containersV2.MobilePush.Create.messageTitleWithUnsupportedTag',
|
|
119
|
+
defaultMessage: 'Please check the message content for unsupported/missing tags',
|
|
120
|
+
},
|
|
121
|
+
"Image": {
|
|
122
|
+
id: 'creatives.containersV2.MobilePush.Create.Image',
|
|
123
|
+
defaultMessage: 'Image',
|
|
124
|
+
},
|
|
125
|
+
"Max file size acceptable is 5mb": {
|
|
126
|
+
id: 'creatives.containersV2.MobilePush.Create.maxUploadFileSize',
|
|
127
|
+
defaultMessage: 'Max file size acceptable is 5mb',
|
|
128
|
+
},
|
|
129
|
+
"Please upload Image": {
|
|
130
|
+
id: 'creatives.containersV2.MobilePush.Create.pleaseUploadImage',
|
|
131
|
+
defaultMessage: 'Please upload image',
|
|
132
|
+
},
|
|
133
|
+
"Upload Image": {
|
|
134
|
+
id: 'creatives.containersV2.MobilePush.Create.uploadImage',
|
|
135
|
+
defaultMessage: 'Upload image',
|
|
136
|
+
},
|
|
137
|
+
"messageCreateSuccess": {
|
|
138
|
+
id: 'creatives.containersV2.MobilePush.Create.templateCreatedSuccessfully',
|
|
139
|
+
defaultMessage: 'Mobile push template created successfully',
|
|
140
|
+
},
|
|
141
|
+
"somethingWentWrong": {
|
|
142
|
+
id: 'creatives.containersV2.MobilePush.Create.somethingWentWrong',
|
|
143
|
+
defaultMessage: 'Something went wrong!!',
|
|
144
|
+
},
|
|
145
|
+
"externalLink": {
|
|
146
|
+
id: 'creatives.containersV2.MobilePush.Create.externalLink',
|
|
147
|
+
defaultMessage: 'External link',
|
|
148
|
+
},
|
|
149
|
+
"External Link cannot be empty": {
|
|
150
|
+
id: 'creatives.containersV2.MobilePush.Create.externalLinkCantEmpty',
|
|
151
|
+
defaultMessage: 'External link cannot be empty',
|
|
152
|
+
},
|
|
153
|
+
"invalidExternalLink": {
|
|
154
|
+
id: 'creatives.containersV2.MobilePush.Create.invalidExternalLink',
|
|
155
|
+
defaultMessage: 'External link cannot be empty / invalid url',
|
|
156
|
+
},
|
|
157
|
+
"Do you really want to go back? All your temporary changes will be lost!": {
|
|
158
|
+
id: 'creatives.containersV2.MobilePush.Create.goBackConfirmation',
|
|
159
|
+
defaultMessage: "Going back will discard all the changes you've made. Continue?",
|
|
160
|
+
},
|
|
161
|
+
"Secondary CTA": {
|
|
162
|
+
id: 'creatives.containersV2.MobilePush.Create.secondaryCTA',
|
|
163
|
+
defaultMessage: 'Secondary CTA',
|
|
164
|
+
},
|
|
165
|
+
"nameAndDescription": {
|
|
166
|
+
id: 'creatives.containersV2.MobilePush.Create.nameAndDescription',
|
|
167
|
+
defaultMessage: 'Name and description',
|
|
168
|
+
},
|
|
169
|
+
"button1": {
|
|
170
|
+
id: 'creatives.containersV2.MobilePush.Create.button1',
|
|
171
|
+
defaultMessage: 'Button 1',
|
|
172
|
+
},
|
|
173
|
+
"button2": {
|
|
174
|
+
id: 'creatives.containersV2.MobilePush.Create.button2',
|
|
175
|
+
defaultMessage: 'Button 2',
|
|
176
|
+
},
|
|
177
|
+
"addAnotherCTA": {
|
|
178
|
+
id: 'creatives.containersV2.MobilePush.Create.addAnotherCTA',
|
|
179
|
+
defaultMessage: 'Add another CTA',
|
|
180
|
+
},
|
|
181
|
+
"selectLinkType": {
|
|
182
|
+
id: 'creatives.containersV2.MobilePush.Create.selectLinkType',
|
|
183
|
+
defaultMessage: 'Please select link type',
|
|
184
|
+
},
|
|
185
|
+
"Primary CTA": {
|
|
186
|
+
id: 'creatives.containersV2.MobilePush.Create.primaryCTA',
|
|
187
|
+
defaultMessage: 'Primary CTA',
|
|
188
|
+
},
|
|
189
|
+
"enterCTALabel": {
|
|
190
|
+
id: 'creatives.containersV2.MobilePush.Create.enterCTALabel',
|
|
191
|
+
defaultMessage: 'Enter CTA label here',
|
|
192
|
+
},
|
|
193
|
+
"ctaLabelCantEmpty": {
|
|
194
|
+
id: 'creatives.containersV2.MobilePush.Create.ctaLabelCantEmpty',
|
|
195
|
+
defaultMessage: 'CTA label cannot be empty.',
|
|
196
|
+
},
|
|
197
|
+
"selectDeeplink": {
|
|
198
|
+
id: 'creatives.containersV2.MobilePush.Create.selectDeeplink',
|
|
199
|
+
defaultMessage: 'Select deeplink',
|
|
200
|
+
},
|
|
201
|
+
"selectADeeplink": {
|
|
202
|
+
id: 'creatives.containersV2.MobilePush.Create.selectADeeplink',
|
|
203
|
+
defaultMessage: 'Select a deeplink',
|
|
204
|
+
},
|
|
205
|
+
"File size cannot be more than 5mb": {
|
|
206
|
+
id: 'creatives.containersV2.MobilePush.Create.uploadFileSizeError',
|
|
207
|
+
defaultMessage: 'File size cannot be more than 5mb',
|
|
208
|
+
},
|
|
209
|
+
"valueCantEmpty": {
|
|
210
|
+
id: 'creatives.containersV2.MobilePush.Create.valueCantEmpty',
|
|
211
|
+
defaultMessage: 'Value cannot be empty.',
|
|
212
|
+
},
|
|
213
|
+
"deleteSecondCTAFirst": {
|
|
214
|
+
id: 'creatives.containersV2.MobilePush.Create.deleteSecondCTAFirst',
|
|
215
|
+
defaultMessage: 'Please delete second secondary cta first',
|
|
216
|
+
},
|
|
217
|
+
"Uploading Image...": {
|
|
218
|
+
id: 'creatives.containersV2.MobilePush.Create.uploadingImage',
|
|
219
|
+
defaultMessage: 'Uploading image...',
|
|
220
|
+
},
|
|
221
|
+
"Campaigns": {
|
|
222
|
+
id: 'creatives.containersV2.MobilePush.Create.Campaigns',
|
|
223
|
+
defaultMessage: 'Campaigns',
|
|
224
|
+
},
|
|
225
|
+
"Creatives": {
|
|
226
|
+
id: 'creatives.containersV2.MobilePush.Create.Creatives',
|
|
227
|
+
defaultMessage: 'Creatives',
|
|
228
|
+
},
|
|
229
|
+
"Mobile Push": {
|
|
230
|
+
id: 'creatives.containersV2.MobilePush.Create.mobilePush',
|
|
231
|
+
defaultMessage: 'Mobile Push',
|
|
232
|
+
},
|
|
233
|
+
"selectActionButton": {
|
|
234
|
+
id: 'creatives.containersV2.MobilePush.Create.selectActionButton',
|
|
235
|
+
defaultMessage: 'Select action buttons',
|
|
236
|
+
},
|
|
237
|
+
"uploadImageSizeErrorTitle": {
|
|
238
|
+
id: 'creatives.containersV2.MobilePush.Create.uploadImageSizeErrorTitle',
|
|
239
|
+
defaultMessage: 'File size error',
|
|
240
|
+
},
|
|
241
|
+
"uploadImageSizeErrorDescription": {
|
|
242
|
+
id: 'creatives.containersV2.MobilePush.Create.uploadImageSizeErrorDescription',
|
|
243
|
+
defaultMessage: 'File size cannot be more than 5mb',
|
|
244
|
+
},
|
|
245
|
+
"validationError": {
|
|
246
|
+
id: 'creatives.containersV2.MobilePush.Create.validationError',
|
|
247
|
+
defaultMessage: 'Validation error',
|
|
248
|
+
},
|
|
249
|
+
"invalidIosMessage": {
|
|
250
|
+
id: 'creatives.containersV2.MobilePush.Create.invalidIosMessage',
|
|
251
|
+
defaultMessage: 'Validation failed for IOS',
|
|
252
|
+
},
|
|
253
|
+
"invalidAndroidMessage": {
|
|
254
|
+
id: 'creatives.containersV2.MobilePush.Create.invalidAndroidMessage',
|
|
255
|
+
defaultMessage: 'Validation failed for android',
|
|
256
|
+
},
|
|
257
|
+
"invalidTags": {
|
|
258
|
+
id: 'creatives.containersV2.MobilePush.Create.invalidTags',
|
|
259
|
+
defaultMessage: 'Invalid tags',
|
|
260
|
+
},
|
|
261
|
+
"alertMessage": {
|
|
262
|
+
id: 'creatives.containersV2.MobilePush.Create.alertMessage',
|
|
263
|
+
defaultMessage: 'Alert',
|
|
264
|
+
},
|
|
265
|
+
"templateNotConfigured": {
|
|
266
|
+
id: 'creatives.containersV2.MobilePush.Create.templateNotConfigured',
|
|
267
|
+
defaultMessage: 'template not configured,',
|
|
268
|
+
},
|
|
269
|
+
"androidNotConfigured": {
|
|
270
|
+
id: 'creatives.containersV2.MobilePush.Create.androidNotConfigured',
|
|
271
|
+
defaultMessage: 'Android template is not configured. Save without Android template',
|
|
272
|
+
},
|
|
273
|
+
"iosNotConfigured": {
|
|
274
|
+
id: 'creatives.containersV2.MobilePush.Create.iosNotConfigured',
|
|
275
|
+
defaultMessage: 'IOS template is not configured, Save without IOS template',
|
|
276
|
+
},
|
|
277
|
+
"goBackTemporaryChangesLost": {
|
|
278
|
+
id: 'creatives.containersV2.MobilePush.Create.goBackTemporaryChangesLost',
|
|
279
|
+
defaultMessage: 'Do you really want to go back? All your temporary changes will be lost!',
|
|
280
|
+
},
|
|
281
|
+
"cantCopyEmptyFieldValues": {
|
|
282
|
+
id: 'creatives.containersV2.MobilePush.Create.cantCopyEmptyFieldValues',
|
|
283
|
+
defaultMessage: 'Cannot copy empty field values.',
|
|
284
|
+
},
|
|
285
|
+
"pleaseInput": {
|
|
286
|
+
id: 'creatives.containersV2.MobilePush.Create.pleaseInput',
|
|
287
|
+
defaultMessage: 'Please input',
|
|
288
|
+
},
|
|
289
|
+
"here": {
|
|
290
|
+
id: 'creatives.containersV2.MobilePush.Create.here',
|
|
291
|
+
defaultMessage: 'here .',
|
|
292
|
+
},
|
|
293
|
+
"change": {
|
|
294
|
+
id: 'creatives.containersV2.MobilePush.Create.change',
|
|
295
|
+
defaultMessage: 'change',
|
|
296
|
+
},
|
|
297
|
+
"Add labels": {
|
|
298
|
+
id: 'creatives.containersV2.addLabels',
|
|
299
|
+
defaultMessage: 'Add labels',
|
|
300
|
+
},
|
|
301
|
+
"Cover Image": {
|
|
302
|
+
id: `creatives.containersV2.MobilePush.Create.coverImage`,
|
|
303
|
+
defaultMessage: 'Cover image',
|
|
304
|
+
},
|
|
305
|
+
"Maximum file size acceptable is 5 MB": {
|
|
306
|
+
id: 'creatives.containersV2.MobilePush.Create.coverImageDescription',
|
|
307
|
+
defaultMessage: 'Maximum file size acceptable is 5 MB',
|
|
308
|
+
},
|
|
309
|
+
"Add action link to content": {
|
|
310
|
+
id: 'creatives.containersV2.MobilePush.Create.addActionLinkToContent',
|
|
311
|
+
defaultMessage: 'Add action link to content',
|
|
312
|
+
},
|
|
313
|
+
"Add a hyperlink of the page which customer will be directed to": {
|
|
314
|
+
id: 'creatives.containersV2.MobilePush.Create.addActionLinkToContentDescription',
|
|
315
|
+
defaultMessage: 'Add a hyperlink of the page which customer will be directed to',
|
|
316
|
+
},
|
|
317
|
+
"aPageWithMobileApp": {
|
|
318
|
+
id: 'creatives.containersV2.MobilePush.Create.aPageWithMobileApp',
|
|
319
|
+
defaultMessage: 'A page within mobile app',
|
|
320
|
+
},
|
|
321
|
+
"anExternalWebPage": {
|
|
322
|
+
id: 'creatives.containersV2.MobilePush.Create.anExternalWebPage',
|
|
323
|
+
defaultMessage: 'An external web page',
|
|
324
|
+
},
|
|
325
|
+
"Add primary button to notification": {
|
|
326
|
+
id: 'creatives.containersV2.MobilePush.Create.addPrimaryButtonToNotification',
|
|
327
|
+
defaultMessage: 'Add primary button to notification',
|
|
328
|
+
},
|
|
329
|
+
"Button label": {
|
|
330
|
+
id: 'creatives.containersV2.MobilePush.Create.buttonLabel',
|
|
331
|
+
defaultMessage: 'Button label',
|
|
332
|
+
},
|
|
333
|
+
"Add secondary button to notification": {
|
|
334
|
+
id: 'creatives.containersV2.MobilePush.Create.addSecondaryButtonToNotification',
|
|
335
|
+
defaultMessage: 'Add secondary button to notification',
|
|
336
|
+
},
|
|
337
|
+
"Add action buttons to notification": {
|
|
338
|
+
id: 'creatives.containersV2.MobilePush.Create.addActionButtonsToNotification',
|
|
339
|
+
defaultMessage: 'Add action buttons to notification',
|
|
340
|
+
},
|
|
341
|
+
"This section is being revamped. Till then it will remain disabled.": {
|
|
342
|
+
id: 'creatives.containersV2.MobilePush.Create.thisSectionDisabledHoverText',
|
|
343
|
+
defaultMessage: 'This section is being revamped. Till then it will remain disabled.',
|
|
344
|
+
},
|
|
345
|
+
"personalizationTokensErrorMessage": {
|
|
346
|
+
id: 'creatives.containersV2.MobilePush.Create.personalizationTokensErrorMessage',
|
|
347
|
+
defaultMessage: 'Personalization tags are not supported for anonymous customers, please remove the tags.',
|
|
348
|
+
},
|
|
349
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Create 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
|
+
});
|
|
14
|
+
|
|
15
|
+
function createReducer(state = initialState, action) {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case types.DEFAULT_ACTION:
|
|
18
|
+
return state;
|
|
19
|
+
case types.CREATE_TEMPLATE_REQUEST:
|
|
20
|
+
return state
|
|
21
|
+
.set('createTemplateInProgress', true)
|
|
22
|
+
.set('createTemplateError', false)
|
|
23
|
+
.set('createTemplateErrorMessage', fromJS(""));
|
|
24
|
+
case types.CREATE_TEMPLATE_SUCCESS:
|
|
25
|
+
return state.set('createTemplateInProgress', false)
|
|
26
|
+
.set('response', action.data)
|
|
27
|
+
.set('createTemplateError', (action.statusCode !== undefined && action.statusCode > 300))
|
|
28
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
29
|
+
case types.CREATE_TEMPLATE_FAILURE:
|
|
30
|
+
return state
|
|
31
|
+
.set('createTemplateInProgress', false)
|
|
32
|
+
.set('createTemplateError', true)
|
|
33
|
+
.set('createTemplateErrorMessage', fromJS(action.errorMsg));
|
|
34
|
+
case types.CLEAR_CREATE_RESPONSE_REQUEST:
|
|
35
|
+
return state.set('response', {});
|
|
36
|
+
case types.UPLOAD_ASSET_REQUEST:
|
|
37
|
+
return state
|
|
38
|
+
.set('uploadAssetSuccess', false)
|
|
39
|
+
.set('assetUploading', true);
|
|
40
|
+
case types.UPLOAD_ASSET_SUCCESS:
|
|
41
|
+
return state
|
|
42
|
+
.set('uploadAssetSuccess', (action.statusCode !== undefined && action.statusCode !== '' && action.statusCode < 300))
|
|
43
|
+
.set('assetUploading', false)
|
|
44
|
+
.set('uploadedAssetData', action.data);
|
|
45
|
+
case types.UPLOAD_ASSET_FAILURE:
|
|
46
|
+
return state
|
|
47
|
+
.set('uploadAssetSuccess', false)
|
|
48
|
+
.set('assetUploading', false);
|
|
49
|
+
case types.CLEAR_ASSET:
|
|
50
|
+
return state
|
|
51
|
+
.delete('uploadedAssetData');
|
|
52
|
+
case types.GET_IOS_CTAS:
|
|
53
|
+
return state
|
|
54
|
+
.set("getIosCtasSucccess", false)
|
|
55
|
+
.set("iosCtasLoading", true);
|
|
56
|
+
case types.GET_IOS_CTAS_SUCCESS:
|
|
57
|
+
return state
|
|
58
|
+
.set('getIosCtasSucccess', (action.statusCode !== undefined && action.statusCode !== '' && action.statusCode < 300))
|
|
59
|
+
.set('iosCtasLoading', false)
|
|
60
|
+
.set('iosCtasData', action.data);
|
|
61
|
+
case types.GET_IOS_CTAS_FAILURE:
|
|
62
|
+
return state
|
|
63
|
+
.set('getIosCtasSucccess', false)
|
|
64
|
+
.set('iosCtasLoading', false);
|
|
65
|
+
case types.RESET_STORE:
|
|
66
|
+
return state.delete('uploadedAssetData').delete('iosCtasData');
|
|
67
|
+
default:
|
|
68
|
+
return state;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default createReducer;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
call, put, takeLatest, all,
|
|
3
|
+
} from 'redux-saga/effects';
|
|
4
|
+
// import { schema, normalize } from 'normalizr';
|
|
5
|
+
import * as Api from '../../../services/api';
|
|
6
|
+
import * as types from './constants';
|
|
7
|
+
|
|
8
|
+
// Individual exports for testing
|
|
9
|
+
export function* createTemplate(template) {
|
|
10
|
+
let errorMsg;
|
|
11
|
+
try {
|
|
12
|
+
|
|
13
|
+
const result = yield call(Api.createMobilePushTemplate, template);
|
|
14
|
+
if (result.message) {
|
|
15
|
+
errorMsg = result.message;
|
|
16
|
+
if(result.status.code>=400){
|
|
17
|
+
throw errorMsg;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (template.callback) {
|
|
21
|
+
yield call(template.callback, result.response);
|
|
22
|
+
}
|
|
23
|
+
yield put({ type: types.CREATE_TEMPLATE_SUCCESS, data: result.response, statusCode: result.status ? result.status.code : '', errorMsg });
|
|
24
|
+
} catch (error) {
|
|
25
|
+
yield put({ type: types.CREATE_TEMPLATE_FAILURE, error, errorMsg });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function* uploadAsset(file, assetType, fileParams) {
|
|
29
|
+
try {
|
|
30
|
+
const result = yield call(Api.uploadFile, file, assetType, fileParams);
|
|
31
|
+
yield put({ type: types.UPLOAD_ASSET_SUCCESS, data: result.response.asset, statusCode: result.status ? result.status.code : '' });
|
|
32
|
+
} catch (error) {
|
|
33
|
+
yield put({ type: types.UPLOAD_ASSET_FAILURE, error });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function* getIosCtas(licenseCode) {
|
|
37
|
+
try {
|
|
38
|
+
const result = yield call(Api.getIosCtas, licenseCode);
|
|
39
|
+
yield put({ type: types.GET_IOS_CTAS_SUCCESS, data: result.response.metaEntities.data, statusCode: result.status ? result.status.code : '' });
|
|
40
|
+
} catch (error) {
|
|
41
|
+
yield put({ type: types.GET_IOS_CTAS_FAILURE, error });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function* watchCreateTemplate() {
|
|
46
|
+
|
|
47
|
+
yield takeLatest(types.CREATE_TEMPLATE_REQUEST, createTemplate);
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
function* watchUploadAsset() {
|
|
52
|
+
yield takeLatest(types.UPLOAD_ASSET_REQUEST, uploadAsset);
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
function* watchGetIosCtas() {
|
|
57
|
+
yield takeLatest(types.GET_IOS_CTAS, getIosCtas);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
// All sagas to be loaded
|
|
62
|
+
export default [
|
|
63
|
+
watchCreateTemplate,
|
|
64
|
+
watchUploadAsset,
|
|
65
|
+
watchGetIosCtas,
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
export function* v2MobilePushCreateSagas() {
|
|
69
|
+
yield all([
|
|
70
|
+
watchCreateTemplate(),
|
|
71
|
+
]);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function* v2MobilePushWatchDuplicateTemplateSaga() {
|
|
75
|
+
yield all([
|
|
76
|
+
watchGetIosCtas(),
|
|
77
|
+
watchUploadAsset(),
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createSelector } from 'reselect';
|
|
2
|
+
import { fromJS } from 'immutable';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Direct selector to the create state domain
|
|
6
|
+
*/
|
|
7
|
+
const selectPushMessageCreateDomain = () => (state) => state.get('mobileCreate') || fromJS({});
|
|
8
|
+
/**
|
|
9
|
+
* Other specific selectors
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Default selector used by Create
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const makeSelectCreate = () => createSelector(
|
|
18
|
+
selectPushMessageCreateDomain(),
|
|
19
|
+
(substate) => substate.toJS()
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const makeSelectCreateResponse = () => createSelector(
|
|
23
|
+
selectPushMessageCreateDomain(), (dimensionState) => dimensionState.get('response')
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const makeSelectIosCta = () => createSelector(makeSelectCreate(), (create) => create.getIosCtasSucccess && create.iosCtasData );
|
|
27
|
+
export {
|
|
28
|
+
makeSelectCreate, makeSelectCreateResponse, makeSelectIosCta,
|
|
29
|
+
};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { cloneDeep } from 'lodash';
|
|
4
|
+
import { Create } from '../index';
|
|
5
|
+
import { response as mpushSchemaResponse } from '../../initialSchema';
|
|
6
|
+
|
|
7
|
+
// Shallow-render the plain class (bypassing the withCreatives/Redux/saga HOC) so this test
|
|
8
|
+
// only exercises the componentDidUpdate → onContentValidityChange wiring in isolation.
|
|
9
|
+
// Mirrors app/v2Containers/Sms/Create/index.js's own reporting and
|
|
10
|
+
// app/v2Containers/MobilePush/Edit/test/contentValidity.test.js.
|
|
11
|
+
|
|
12
|
+
const baseProps = () => ({
|
|
13
|
+
actions: {},
|
|
14
|
+
globalActions: {
|
|
15
|
+
fetchSchemaForEntity: jest.fn(),
|
|
16
|
+
},
|
|
17
|
+
Templates: { selectedWeChatAccount: { id: 'acc-1' } },
|
|
18
|
+
Create: {},
|
|
19
|
+
params: {},
|
|
20
|
+
location: { query: { type: 'library', module: 'default' } },
|
|
21
|
+
route: { name: 'mobilepush' },
|
|
22
|
+
router: { push: jest.fn() },
|
|
23
|
+
metaEntities: {},
|
|
24
|
+
intl: { formatMessage: (m) => (m && (m.defaultMessage || m.id)) || '' },
|
|
25
|
+
isFullMode: false,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('MobilePush/Create — onContentValidityChange reporting', () => {
|
|
29
|
+
it('reports isContentEmpty: true on mount when both Android title and message are empty', () => {
|
|
30
|
+
const onContentValidityChange = jest.fn();
|
|
31
|
+
const wrapper = shallow(<Create {...baseProps()} onContentValidityChange={onContentValidityChange} />);
|
|
32
|
+
wrapper.setState({
|
|
33
|
+
formData: { 0: { 'message-title': '', 'message-editor': '' } },
|
|
34
|
+
tabCount: 1,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
expect(onContentValidityChange).toHaveBeenCalledWith(
|
|
38
|
+
expect.objectContaining({ isContentEmpty: true }),
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('reports isContentEmpty: false once the Android message has content', () => {
|
|
43
|
+
const onContentValidityChange = jest.fn();
|
|
44
|
+
const wrapper = shallow(<Create {...baseProps()} onContentValidityChange={onContentValidityChange} />);
|
|
45
|
+
wrapper.setState({
|
|
46
|
+
formData: { 0: { 'message-title': '', 'message-editor': '' } },
|
|
47
|
+
tabCount: 1,
|
|
48
|
+
});
|
|
49
|
+
onContentValidityChange.mockClear();
|
|
50
|
+
|
|
51
|
+
wrapper.setState({
|
|
52
|
+
formData: { 0: { 'message-title': 'Hello', 'message-editor': 'World' } },
|
|
53
|
+
tabCount: 1,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
expect(onContentValidityChange).toHaveBeenCalledWith(
|
|
57
|
+
expect.objectContaining({ isContentEmpty: false }),
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('reports isContentEmpty: false when only iOS has content', () => {
|
|
62
|
+
const onContentValidityChange = jest.fn();
|
|
63
|
+
const wrapper = shallow(<Create {...baseProps()} onContentValidityChange={onContentValidityChange} />);
|
|
64
|
+
wrapper.setState({
|
|
65
|
+
formData: { 0: { 'message-title': '', 'message-editor': '' }, 1: {} },
|
|
66
|
+
tabCount: 1,
|
|
67
|
+
});
|
|
68
|
+
onContentValidityChange.mockClear();
|
|
69
|
+
|
|
70
|
+
wrapper.setState({
|
|
71
|
+
formData: { 0: { 'message-title': '', 'message-editor': '' }, 1: { 'message-title2': 'test', 'message-editor2': 'test' } },
|
|
72
|
+
tabCount: 1,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
expect(onContentValidityChange).toHaveBeenCalledWith(
|
|
76
|
+
expect.objectContaining({ isContentEmpty: false }),
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('re-reports empty when a previously entered message is cleared out', () => {
|
|
81
|
+
const onContentValidityChange = jest.fn();
|
|
82
|
+
const wrapper = shallow(<Create {...baseProps()} onContentValidityChange={onContentValidityChange} />);
|
|
83
|
+
wrapper.setState({
|
|
84
|
+
formData: { 0: { 'message-title': 'Existing', 'message-editor': 'content' } },
|
|
85
|
+
tabCount: 1,
|
|
86
|
+
});
|
|
87
|
+
onContentValidityChange.mockClear();
|
|
88
|
+
|
|
89
|
+
wrapper.setState({
|
|
90
|
+
formData: { 0: { 'message-title': '', 'message-editor': '' } },
|
|
91
|
+
tabCount: 1,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(onContentValidityChange).toHaveBeenCalledWith(
|
|
95
|
+
expect.objectContaining({ isContentEmpty: true }),
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('does not throw and does not report when onContentValidityChange is not provided', () => {
|
|
100
|
+
const wrapper = shallow(<Create {...baseProps()} />);
|
|
101
|
+
expect(() => {
|
|
102
|
+
wrapper.setState({ formData: { 0: { 'message-title': '', 'message-editor': '' } }, tabCount: 1 });
|
|
103
|
+
}).not.toThrow();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('does not dispatch again on a re-render that does not change validity (dedup guard)', () => {
|
|
107
|
+
const onContentValidityChange = jest.fn();
|
|
108
|
+
const wrapper = shallow(<Create {...baseProps()} onContentValidityChange={onContentValidityChange} />);
|
|
109
|
+
wrapper.setState({ formData: { 0: { 'message-title': '', 'message-editor': '' } }, tabCount: 1 });
|
|
110
|
+
onContentValidityChange.mockClear();
|
|
111
|
+
|
|
112
|
+
// Unrelated state change — content emptiness is unchanged.
|
|
113
|
+
wrapper.setState({ currentTab: 1 });
|
|
114
|
+
|
|
115
|
+
expect(onContentValidityChange).not.toHaveBeenCalled();
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('MobilePush/Create — shared layout schema', () => {
|
|
120
|
+
it('hides Android on its own schema copy, leaving the store layout untouched', () => {
|
|
121
|
+
const storeSchema = cloneDeep(mpushSchemaResponse.metaEntities[0].definition.textSchema);
|
|
122
|
+
const standaloneSectionCount = storeSchema.standalone.sections.length;
|
|
123
|
+
const wrapper = shallow(<Create
|
|
124
|
+
{...baseProps()}
|
|
125
|
+
params={{ mode: 'text' }}
|
|
126
|
+
Templates={{ selectedWeChatAccount: { id: 669, configs: { android: '0', ios: '1' } } }}
|
|
127
|
+
/>);
|
|
128
|
+
wrapper.instance().injectEvents = jest.fn();
|
|
129
|
+
wrapper.setProps({ metaEntities: { layouts: [{ definition: { textSchema: storeSchema } }], tags: {} } });
|
|
130
|
+
|
|
131
|
+
const [ownSchema] = wrapper.instance().injectEvents.mock.calls[0];
|
|
132
|
+
expect(ownSchema).not.toBe(storeSchema);
|
|
133
|
+
expect(ownSchema.containers[0].panes[0].isSupported).toBe(false);
|
|
134
|
+
expect(wrapper.state('currentTab')).toBe(2);
|
|
135
|
+
expect(storeSchema.containers[0].panes[0].isSupported).toBe(true);
|
|
136
|
+
expect(storeSchema.standalone.sections).toHaveLength(standaloneSectionCount);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('uses its own copy of the image schema in image mode', () => {
|
|
140
|
+
const storeSchema = cloneDeep(mpushSchemaResponse.metaEntities[0].definition.imageSchema);
|
|
141
|
+
const wrapper = shallow(<Create
|
|
142
|
+
{...baseProps()}
|
|
143
|
+
params={{ mode: 'image' }}
|
|
144
|
+
Templates={{ selectedWeChatAccount: { id: 703, configs: { android: '1', ios: '1' } } }}
|
|
145
|
+
/>);
|
|
146
|
+
wrapper.instance().injectEvents = jest.fn();
|
|
147
|
+
wrapper.setProps({ metaEntities: { layouts: [{ definition: { imageSchema: storeSchema } }], tags: {} } });
|
|
148
|
+
|
|
149
|
+
const [ownSchema] = wrapper.instance().injectEvents.mock.calls[0];
|
|
150
|
+
expect(ownSchema).not.toBe(storeSchema);
|
|
151
|
+
expect(ownSchema.containers[0].panes[0].isSupported).not.toBe(false);
|
|
152
|
+
expect(ownSchema.containers[0].panes[1].isSupported).not.toBe(false);
|
|
153
|
+
});
|
|
154
|
+
});
|