@capillarytech/creatives-library 9.0.28 → 9.0.29-alpha.1
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 +29 -0
- package/global-styles.js +1 -1
- package/package.json +1 -1
- package/services/tests/api.test.js +35 -20
- package/utils/commonUtils.js +22 -1
- package/utils/rcsPayloadUtils.js +102 -0
- package/utils/templateVarUtils.js +198 -0
- package/utils/tests/rcsPayloadUtils.test.js +295 -0
- package/utils/tests/templateVarUtils.test.js +204 -0
- package/v2Components/CapActionButton/constants.js +21 -1
- package/v2Components/CapActionButton/index.js +260 -144
- package/v2Components/CapActionButton/index.scss +245 -14
- package/v2Components/CapActionButton/messages.js +32 -3
- package/v2Components/CapActionButton/tests/index.test.js +74 -19
- package/v2Components/CapImageUpload/index.js +2 -2
- package/v2Components/CapTagList/index.js +9 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -48
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +214 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +83 -9
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +58 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +10 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +186 -22
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +381 -80
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +155 -8
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +11 -0
- package/v2Components/CommonTestAndPreview/constants.js +35 -2
- package/v2Components/CommonTestAndPreview/index.js +770 -231
- package/v2Components/CommonTestAndPreview/messages.js +45 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +25 -6
- package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +1 -0
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +412 -257
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +337 -63
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
- package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +8 -1
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +108 -15
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +281 -283
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +133 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +31 -24
- package/v2Components/CommonTestAndPreview/tests/utils.test.js +151 -0
- package/v2Components/CommonTestAndPreview/utils.js +84 -0
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +91 -0
- package/v2Components/SmsFallback/constants.js +94 -0
- package/v2Components/SmsFallback/index.js +958 -0
- package/v2Components/SmsFallback/index.scss +266 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +120 -0
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +208 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +309 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +471 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TemplatePreview/_templatePreview.scss +45 -25
- package/v2Components/TemplatePreview/constants.js +2 -0
- package/v2Components/TemplatePreview/index.js +147 -32
- package/v2Components/TemplatePreview/tests/index.test.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
- package/v2Components/TestAndPreviewSlidebox/index.js +13 -1
- package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +4 -1
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +4 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +27 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +37 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +14 -5
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +36 -5
- package/v2Containers/CreativesContainer/constants.js +11 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +77 -0
- package/v2Containers/CreativesContainer/index.js +328 -106
- package/v2Containers/CreativesContainer/index.scss +102 -1
- package/v2Containers/CreativesContainer/tests/CreativesSlideBoxWrapper.test.js +58 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.smsDltPreview.test.js +73 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +37 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +103 -34
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +193 -15
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +88 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +549 -57
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -15
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Email/index.js +3 -63
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +4 -9
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/Rcs/carouselUtils.js +224 -0
- package/v2Containers/Rcs/components/CarouselCard.js +317 -0
- package/v2Containers/Rcs/components/CarouselCardButtons.js +113 -0
- package/v2Containers/Rcs/components/CarouselCardMedia.js +136 -0
- package/v2Containers/Rcs/components/CarouselCharacterCount.js +31 -0
- package/v2Containers/Rcs/components/CarouselDimensionSelection.js +80 -0
- package/v2Containers/Rcs/constants.js +132 -16
- package/v2Containers/Rcs/index.js +1808 -949
- package/v2Containers/Rcs/index.scss +443 -8
- package/v2Containers/Rcs/messages.js +45 -22
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +484 -0
- package/v2Containers/Rcs/tests/CarouselCard.test.js +464 -0
- package/v2Containers/Rcs/tests/CarouselCardButtons.test.js +211 -0
- package/v2Containers/Rcs/tests/CarouselCardMedia.test.js +160 -0
- package/v2Containers/Rcs/tests/CarouselCharacterCount.test.js +50 -0
- package/v2Containers/Rcs/tests/CarouselDimensionSelection.test.js +119 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +74176 -39409
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +10 -74
- package/v2Containers/Rcs/tests/carouselUtils.test.js +916 -0
- package/v2Containers/Rcs/tests/index.test.js +219 -40
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +873 -0
- package/v2Containers/Rcs/tests/utils.test.js +682 -30
- package/v2Containers/Rcs/utils.js +514 -12
- package/v2Containers/Sms/Create/index.js +115 -48
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +678 -169
- package/v2Containers/SmsTrai/Edit/index.scss +126 -0
- package/v2Containers/SmsTrai/Edit/messages.js +14 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +5615 -3014
- package/v2Containers/SmsWrapper/index.js +37 -8
- package/v2Containers/TagList/index.js +5 -0
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +196 -12
- package/v2Containers/Templates/actions.js +11 -0
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +131 -59
- package/v2Containers/Templates/sagas.js +57 -13
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +129 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1060 -1015
- package/v2Containers/Templates/tests/sagas.test.js +199 -16
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/v2Containers/TemplatesV2/index.js +88 -25
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
- package/v2Containers/Whatsapp/index.js +3 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`Test SlideBoxContent container campaign message, add creative click rcs 1`] = `
|
|
4
|
-
<
|
|
4
|
+
<CreativesSlideBoxWrapper
|
|
5
5
|
className="add-creatives-section creatives-library-mode "
|
|
6
6
|
shouldApplyFooterMargin={false}
|
|
7
7
|
slideBoxWrapperMargin={0}
|
|
@@ -20,6 +20,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
20
20
|
inAppEditorType={null}
|
|
21
21
|
isAnonymousType={false}
|
|
22
22
|
isTestAndPreviewMode={false}
|
|
23
|
+
localTemplatesConfig={Object {}}
|
|
23
24
|
loyaltyMetaData={
|
|
24
25
|
Object {
|
|
25
26
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -60,7 +61,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
templateStep="modeSelection"
|
|
63
|
-
waitEventContextTags={Object {}}
|
|
64
64
|
weChatMaptemplateStep={0}
|
|
65
65
|
weChatTemplateType=""
|
|
66
66
|
/>
|
|
@@ -83,6 +83,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
83
83
|
}
|
|
84
84
|
templateNameRenderProp={[Function]}
|
|
85
85
|
templateStep="modeSelection"
|
|
86
|
+
useLocalTemplates={false}
|
|
86
87
|
weChatMaptemplateStep={0}
|
|
87
88
|
weChatTemplateType=""
|
|
88
89
|
/>
|
|
@@ -90,11 +91,11 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
90
91
|
show={true}
|
|
91
92
|
size="size-xl"
|
|
92
93
|
/>
|
|
93
|
-
</
|
|
94
|
+
</CreativesSlideBoxWrapper>
|
|
94
95
|
`;
|
|
95
96
|
|
|
96
97
|
exports[`Test SlideBoxContent container campaign message, add creative click whatsapp 1`] = `
|
|
97
|
-
<
|
|
98
|
+
<CreativesSlideBoxWrapper
|
|
98
99
|
className="add-creatives-section creatives-library-mode "
|
|
99
100
|
shouldApplyFooterMargin={false}
|
|
100
101
|
slideBoxWrapperMargin={0}
|
|
@@ -113,6 +114,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
113
114
|
inAppEditorType={null}
|
|
114
115
|
isAnonymousType={false}
|
|
115
116
|
isTestAndPreviewMode={false}
|
|
117
|
+
localTemplatesConfig={Object {}}
|
|
116
118
|
loyaltyMetaData={
|
|
117
119
|
Object {
|
|
118
120
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -153,7 +155,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
templateStep="modeSelection"
|
|
156
|
-
waitEventContextTags={Object {}}
|
|
157
158
|
weChatMaptemplateStep={0}
|
|
158
159
|
weChatTemplateType=""
|
|
159
160
|
/>
|
|
@@ -176,6 +177,7 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
176
177
|
}
|
|
177
178
|
templateNameRenderProp={[Function]}
|
|
178
179
|
templateStep="modeSelection"
|
|
180
|
+
useLocalTemplates={false}
|
|
179
181
|
weChatMaptemplateStep={0}
|
|
180
182
|
weChatTemplateType=""
|
|
181
183
|
/>
|
|
@@ -183,11 +185,11 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
183
185
|
show={true}
|
|
184
186
|
size="size-xl"
|
|
185
187
|
/>
|
|
186
|
-
</
|
|
188
|
+
</CreativesSlideBoxWrapper>
|
|
187
189
|
`;
|
|
188
190
|
|
|
189
191
|
exports[`Test SlideBoxContent container campaign message, whatsapp edit all data 1`] = `
|
|
190
|
-
<
|
|
192
|
+
<CreativesSlideBoxWrapper
|
|
191
193
|
className="add-creatives-section creatives-library-mode "
|
|
192
194
|
shouldApplyFooterMargin={false}
|
|
193
195
|
slideBoxWrapperMargin={0}
|
|
@@ -206,6 +208,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
206
208
|
inAppEditorType={null}
|
|
207
209
|
isAnonymousType={false}
|
|
208
210
|
isTestAndPreviewMode={false}
|
|
211
|
+
localTemplatesConfig={Object {}}
|
|
209
212
|
loyaltyMetaData={
|
|
210
213
|
Object {
|
|
211
214
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -241,7 +244,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
241
244
|
showTestAndPreviewSlidebox={false}
|
|
242
245
|
slidBoxContent="editTemplate"
|
|
243
246
|
templateStep="modeSelection"
|
|
244
|
-
waitEventContextTags={Object {}}
|
|
245
247
|
weChatMaptemplateStep={0}
|
|
246
248
|
weChatTemplateType=""
|
|
247
249
|
/>
|
|
@@ -312,6 +314,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
312
314
|
slidBoxContent="editTemplate"
|
|
313
315
|
templateNameRenderProp={[Function]}
|
|
314
316
|
templateStep="modeSelection"
|
|
317
|
+
useLocalTemplates={false}
|
|
315
318
|
weChatMaptemplateStep={0}
|
|
316
319
|
weChatTemplateType=""
|
|
317
320
|
/>
|
|
@@ -319,11 +322,11 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
319
322
|
show={false}
|
|
320
323
|
size="size-xl"
|
|
321
324
|
/>
|
|
322
|
-
</
|
|
325
|
+
</CreativesSlideBoxWrapper>
|
|
323
326
|
`;
|
|
324
327
|
|
|
325
328
|
exports[`Test SlideBoxContent container campaign message, whatsapp edit min data 1`] = `
|
|
326
|
-
<
|
|
329
|
+
<CreativesSlideBoxWrapper
|
|
327
330
|
className="add-creatives-section creatives-library-mode "
|
|
328
331
|
shouldApplyFooterMargin={false}
|
|
329
332
|
slideBoxWrapperMargin={0}
|
|
@@ -342,6 +345,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
342
345
|
inAppEditorType={null}
|
|
343
346
|
isAnonymousType={false}
|
|
344
347
|
isTestAndPreviewMode={false}
|
|
348
|
+
localTemplatesConfig={Object {}}
|
|
345
349
|
loyaltyMetaData={
|
|
346
350
|
Object {
|
|
347
351
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -377,7 +381,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
377
381
|
showTestAndPreviewSlidebox={false}
|
|
378
382
|
slidBoxContent="editTemplate"
|
|
379
383
|
templateStep="modeSelection"
|
|
380
|
-
waitEventContextTags={Object {}}
|
|
381
384
|
weChatMaptemplateStep={0}
|
|
382
385
|
weChatTemplateType=""
|
|
383
386
|
/>
|
|
@@ -448,6 +451,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
448
451
|
slidBoxContent="editTemplate"
|
|
449
452
|
templateNameRenderProp={[Function]}
|
|
450
453
|
templateStep="modeSelection"
|
|
454
|
+
useLocalTemplates={false}
|
|
451
455
|
weChatMaptemplateStep={0}
|
|
452
456
|
weChatTemplateType=""
|
|
453
457
|
/>
|
|
@@ -455,11 +459,11 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
455
459
|
show={false}
|
|
456
460
|
size="size-xl"
|
|
457
461
|
/>
|
|
458
|
-
</
|
|
462
|
+
</CreativesSlideBoxWrapper>
|
|
459
463
|
`;
|
|
460
464
|
|
|
461
465
|
exports[`Test SlideBoxContent container it should clear the url, on channel change from new whatsapp to another 1`] = `
|
|
462
|
-
<
|
|
466
|
+
<CreativesSlideBoxWrapper
|
|
463
467
|
className="add-creatives-section creatives-library-mode "
|
|
464
468
|
shouldApplyFooterMargin={false}
|
|
465
469
|
slideBoxWrapperMargin={0}
|
|
@@ -478,6 +482,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
478
482
|
inAppEditorType={null}
|
|
479
483
|
isAnonymousType={false}
|
|
480
484
|
isTestAndPreviewMode={false}
|
|
485
|
+
localTemplatesConfig={Object {}}
|
|
481
486
|
loyaltyMetaData={
|
|
482
487
|
Object {
|
|
483
488
|
"actionName": "SEND_COMMUNICATION_ACTION",
|
|
@@ -513,7 +518,6 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
513
518
|
showTestAndPreviewSlidebox={false}
|
|
514
519
|
slidBoxContent="editTemplate"
|
|
515
520
|
templateStep="modeSelection"
|
|
516
|
-
waitEventContextTags={Object {}}
|
|
517
521
|
weChatMaptemplateStep={0}
|
|
518
522
|
weChatTemplateType=""
|
|
519
523
|
/>
|
|
@@ -584,6 +588,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
584
588
|
slidBoxContent="editTemplate"
|
|
585
589
|
templateNameRenderProp={[Function]}
|
|
586
590
|
templateStep="modeSelection"
|
|
591
|
+
useLocalTemplates={false}
|
|
587
592
|
weChatMaptemplateStep={0}
|
|
588
593
|
weChatTemplateType=""
|
|
589
594
|
/>
|
|
@@ -591,5 +596,5 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
591
596
|
show={false}
|
|
592
597
|
size="size-xl"
|
|
593
598
|
/>
|
|
594
|
-
</
|
|
599
|
+
</CreativesSlideBoxWrapper>
|
|
595
600
|
`;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CAP_SPACE_32,
|
|
3
|
+
CAP_SPACE_56,
|
|
4
|
+
CAP_SPACE_64,
|
|
5
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
6
|
+
import {
|
|
7
|
+
isDeepEmpty,
|
|
8
|
+
getSlideBoxWrapperMarginFromLiquidErrors,
|
|
9
|
+
computeLiquidFooterUpdateFromFormBuilder,
|
|
10
|
+
} from '../embeddedSlideboxUtils';
|
|
11
|
+
import { ANDROID, IOS, MOBILE_PUSH, LIQUID_ERROR_MSG, STANDARD_ERROR_MSG } from '../constants';
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// isDeepEmpty
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
describe('isDeepEmpty', () => {
|
|
18
|
+
it('returns true for null', () => {
|
|
19
|
+
expect(isDeepEmpty(null)).toBe(true);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('returns true for undefined', () => {
|
|
23
|
+
expect(isDeepEmpty(undefined)).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('returns true for empty string', () => {
|
|
27
|
+
expect(isDeepEmpty('')).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('returns false for non-empty string', () => {
|
|
31
|
+
expect(isDeepEmpty('hello')).toBe(false);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('returns true for empty array', () => {
|
|
35
|
+
expect(isDeepEmpty([])).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('returns false for non-empty array', () => {
|
|
39
|
+
expect(isDeepEmpty(['item'])).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('returns true for empty object', () => {
|
|
43
|
+
expect(isDeepEmpty({})).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('returns true for object where all values are deep-empty', () => {
|
|
47
|
+
expect(isDeepEmpty({ a: null, b: '', c: [] })).toBe(true);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('returns false for object with at least one non-empty value', () => {
|
|
51
|
+
expect(isDeepEmpty({ a: null, b: 'something' })).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('returns true for nested all-empty object', () => {
|
|
55
|
+
expect(isDeepEmpty({ a: { b: null, c: [] } })).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('returns false for nested object with a non-empty leaf', () => {
|
|
59
|
+
expect(isDeepEmpty({ a: { b: 'value' } })).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('returns false for a number (non-null, non-string, non-array, non-object)', () => {
|
|
63
|
+
expect(isDeepEmpty(0)).toBe(false);
|
|
64
|
+
expect(isDeepEmpty(42)).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('returns false for a boolean false', () => {
|
|
68
|
+
expect(isDeepEmpty(false)).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// getSlideBoxWrapperMarginFromLiquidErrors
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
describe('getSlideBoxWrapperMarginFromLiquidErrors', () => {
|
|
77
|
+
it('returns 0 when liquidErrorMessage is null', () => {
|
|
78
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors(null)).toBe(0);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('returns 0 when liquidErrorMessage is undefined', () => {
|
|
82
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors(undefined)).toBe(0);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('returns 0 when both error arrays are empty', () => {
|
|
86
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
87
|
+
STANDARD_ERROR_MSG: [],
|
|
88
|
+
LIQUID_ERROR_MSG: [],
|
|
89
|
+
})).toBe(0);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('returns 0 when neither error array is present', () => {
|
|
93
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({})).toBe(0);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('returns CAP_SPACE_64 when both STANDARD and LIQUID errors are present', () => {
|
|
97
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
98
|
+
STANDARD_ERROR_MSG: ['std error'],
|
|
99
|
+
LIQUID_ERROR_MSG: ['liquid error'],
|
|
100
|
+
})).toBe(CAP_SPACE_64);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('returns CAP_SPACE_56 when only LIQUID errors are present', () => {
|
|
104
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
105
|
+
STANDARD_ERROR_MSG: [],
|
|
106
|
+
LIQUID_ERROR_MSG: ['liquid error'],
|
|
107
|
+
})).toBe(CAP_SPACE_56);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('returns CAP_SPACE_32 when only STANDARD errors are present', () => {
|
|
111
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
112
|
+
STANDARD_ERROR_MSG: ['std error'],
|
|
113
|
+
LIQUID_ERROR_MSG: [],
|
|
114
|
+
})).toBe(CAP_SPACE_32);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('returns CAP_SPACE_56 when LIQUID has multiple errors and STANDARD is absent', () => {
|
|
118
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
119
|
+
LIQUID_ERROR_MSG: ['err1', 'err2'],
|
|
120
|
+
})).toBe(CAP_SPACE_56);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('returns CAP_SPACE_32 when STANDARD has multiple errors and LIQUID is absent', () => {
|
|
124
|
+
expect(getSlideBoxWrapperMarginFromLiquidErrors({
|
|
125
|
+
STANDARD_ERROR_MSG: ['err1', 'err2'],
|
|
126
|
+
})).toBe(CAP_SPACE_32);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// computeLiquidFooterUpdateFromFormBuilder
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
|
|
134
|
+
describe('computeLiquidFooterUpdateFromFormBuilder', () => {
|
|
135
|
+
const noErrors = { [LIQUID_ERROR_MSG]: [], [STANDARD_ERROR_MSG]: [] };
|
|
136
|
+
const liquidOnly = { [LIQUID_ERROR_MSG]: ['liquid err'], [STANDARD_ERROR_MSG]: [] };
|
|
137
|
+
const standardOnly = { [LIQUID_ERROR_MSG]: [], [STANDARD_ERROR_MSG]: ['std err'] };
|
|
138
|
+
const bothErrors = { [LIQUID_ERROR_MSG]: ['l'], [STANDARD_ERROR_MSG]: ['s'] };
|
|
139
|
+
|
|
140
|
+
describe('normal (non-null) returns', () => {
|
|
141
|
+
it('returns isLiquidValidationError=false when no errors', () => {
|
|
142
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
143
|
+
previousIsLiquidValidationError: false,
|
|
144
|
+
currentChannelUpper: 'SMS',
|
|
145
|
+
});
|
|
146
|
+
expect(result).not.toBeNull();
|
|
147
|
+
expect(result.isLiquidValidationError).toBe(false);
|
|
148
|
+
expect(result.liquidErrorMessage).toEqual(noErrors);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('sets isLiquidValidationError=true when liquid errors present', () => {
|
|
152
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(liquidOnly, 1, {
|
|
153
|
+
previousIsLiquidValidationError: false,
|
|
154
|
+
currentChannelUpper: 'SMS',
|
|
155
|
+
});
|
|
156
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('sets isLiquidValidationError=true when standard errors present', () => {
|
|
160
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(standardOnly, 1, {
|
|
161
|
+
previousIsLiquidValidationError: false,
|
|
162
|
+
currentChannelUpper: 'SMS',
|
|
163
|
+
});
|
|
164
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('sets isLiquidValidationError=true when both errors present', () => {
|
|
168
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(bothErrors, 1, {
|
|
169
|
+
previousIsLiquidValidationError: false,
|
|
170
|
+
currentChannelUpper: 'SMS',
|
|
171
|
+
});
|
|
172
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('maps tab 1 to ANDROID', () => {
|
|
176
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
177
|
+
previousIsLiquidValidationError: false,
|
|
178
|
+
currentChannelUpper: 'SMS',
|
|
179
|
+
});
|
|
180
|
+
expect(result.activeFormBuilderTab).toBe(ANDROID);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('maps tab 2 to IOS', () => {
|
|
184
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 2, {
|
|
185
|
+
previousIsLiquidValidationError: false,
|
|
186
|
+
currentChannelUpper: 'SMS',
|
|
187
|
+
});
|
|
188
|
+
expect(result.activeFormBuilderTab).toBe(IOS);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('maps tab 3 (or any other tab) to null', () => {
|
|
192
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 3, {
|
|
193
|
+
previousIsLiquidValidationError: false,
|
|
194
|
+
currentChannelUpper: 'SMS',
|
|
195
|
+
});
|
|
196
|
+
expect(result.activeFormBuilderTab).toBeNull();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('maps undefined tab to null for activeFormBuilderTab', () => {
|
|
200
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, undefined, {
|
|
201
|
+
previousIsLiquidValidationError: false,
|
|
202
|
+
currentChannelUpper: 'SMS',
|
|
203
|
+
});
|
|
204
|
+
expect(result.activeFormBuilderTab).toBeNull();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('does NOT return null for Mobile Push when errors ARE present', () => {
|
|
208
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(liquidOnly, 1, {
|
|
209
|
+
previousIsLiquidValidationError: true,
|
|
210
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
211
|
+
});
|
|
212
|
+
expect(result).not.toBeNull();
|
|
213
|
+
expect(result.isLiquidValidationError).toBe(true);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it('does NOT return null for non-Mobile Push channel even with previousIsLiquidValidationError', () => {
|
|
217
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
218
|
+
previousIsLiquidValidationError: true,
|
|
219
|
+
currentChannelUpper: 'SMS',
|
|
220
|
+
});
|
|
221
|
+
expect(result).not.toBeNull();
|
|
222
|
+
expect(result.isLiquidValidationError).toBe(false);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('works without options argument (uses defaults)', () => {
|
|
226
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1);
|
|
227
|
+
expect(result).not.toBeNull();
|
|
228
|
+
expect(result.isLiquidValidationError).toBe(false);
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
describe('Mobile Push OLD clear (returns null)', () => {
|
|
233
|
+
it('returns null when no errors and previousIsLiquidValidationError is true for MOBILEPUSH', () => {
|
|
234
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
235
|
+
previousIsLiquidValidationError: true,
|
|
236
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
237
|
+
});
|
|
238
|
+
expect(result).toBeNull();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('does NOT return null when previousIsLiquidValidationError is false for MOBILEPUSH', () => {
|
|
242
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(noErrors, 1, {
|
|
243
|
+
previousIsLiquidValidationError: false,
|
|
244
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
245
|
+
});
|
|
246
|
+
expect(result).not.toBeNull();
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('does NOT return null when only standard errors cleared but liquid error remains for MOBILEPUSH', () => {
|
|
250
|
+
const result = computeLiquidFooterUpdateFromFormBuilder(liquidOnly, 1, {
|
|
251
|
+
previousIsLiquidValidationError: true,
|
|
252
|
+
currentChannelUpper: MOBILE_PUSH,
|
|
253
|
+
});
|
|
254
|
+
// hasLiquid = true → condition !hasLiquid is false → does not return null
|
|
255
|
+
expect(result).not.toBeNull();
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
});
|
|
@@ -173,19 +173,35 @@ describe('Test SlideBoxContent container', () => {
|
|
|
173
173
|
expect(getCreativesData).toHaveBeenCalledWith({ channel: 'RCS' });
|
|
174
174
|
});
|
|
175
175
|
|
|
176
|
-
it('RCS getFormData
|
|
177
|
-
|
|
176
|
+
it('RCS getFormData mirrors smsFallBackContent onto templateData for library round-trip', async () => {
|
|
177
|
+
renderedComponent = shallowWithIntl(
|
|
178
|
+
<Creatives
|
|
179
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
180
|
+
Templates={rcsTemplates}
|
|
181
|
+
channel="RCS"
|
|
182
|
+
slidBoxContent="editTemplate"
|
|
183
|
+
templateData={rcsEditTemplateData}
|
|
184
|
+
handleCloseCreatives={handleCloseCreatives}
|
|
185
|
+
getCreativesData={getCreativesData}
|
|
186
|
+
isFullMode={false}
|
|
187
|
+
templateActions={{
|
|
188
|
+
getCdnTransformationConfig,
|
|
189
|
+
}}
|
|
190
|
+
/>,
|
|
191
|
+
);
|
|
178
192
|
renderedComponent.instance().onEditTemplate();
|
|
179
193
|
|
|
180
194
|
const mockValue = {
|
|
195
|
+
validity: true,
|
|
181
196
|
value: {
|
|
182
197
|
name: 'rcs_creative_name',
|
|
198
|
+
type: 'RCS',
|
|
183
199
|
versions: {
|
|
184
200
|
base: {
|
|
185
201
|
content: {
|
|
186
202
|
RCS: {
|
|
187
203
|
rcsContent: { contentType: 'RICHCARD', cardType: 'STANDALONE', cardSettings: {}, cardContent: [{}] },
|
|
188
|
-
smsFallBackContent: { message: '
|
|
204
|
+
smsFallBackContent: { message: 'fallback-body' },
|
|
189
205
|
},
|
|
190
206
|
},
|
|
191
207
|
},
|
|
@@ -193,16 +209,62 @@ describe('Test SlideBoxContent container', () => {
|
|
|
193
209
|
},
|
|
194
210
|
};
|
|
195
211
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
.props()
|
|
199
|
-
.content.props.getFormData(mockValue);
|
|
212
|
+
// Call getFormData on the container instance — shallow CapSlideBox `content` shape can differ across wrappers
|
|
213
|
+
renderedComponent.instance().getFormData(mockValue);
|
|
200
214
|
await tick();
|
|
201
215
|
|
|
202
216
|
const instance = renderedComponent.instance();
|
|
203
217
|
expect(instance.state.templateData).toBeDefined();
|
|
204
|
-
|
|
205
|
-
|
|
218
|
+
expect(instance.state.templateData.smsFallBackContent).toEqual({ message: 'fallback-body' });
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('RCS getFormData mirrors rcsCardVarMapped onto templateData for campaign reopen', async () => {
|
|
222
|
+
renderedComponent = shallowWithIntl(
|
|
223
|
+
<Creatives
|
|
224
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
225
|
+
Templates={rcsTemplates}
|
|
226
|
+
channel="RCS"
|
|
227
|
+
slidBoxContent="editTemplate"
|
|
228
|
+
templateData={rcsEditTemplateData}
|
|
229
|
+
handleCloseCreatives={handleCloseCreatives}
|
|
230
|
+
getCreativesData={getCreativesData}
|
|
231
|
+
isFullMode={false}
|
|
232
|
+
templateActions={{
|
|
233
|
+
getCdnTransformationConfig,
|
|
234
|
+
}}
|
|
235
|
+
/>,
|
|
236
|
+
);
|
|
237
|
+
renderedComponent.instance().onEditTemplate();
|
|
238
|
+
|
|
239
|
+
const cardVarMapped = { 1: '[Name]', user_name: '[Name]' };
|
|
240
|
+
const mockValue = {
|
|
241
|
+
validity: true,
|
|
242
|
+
value: {
|
|
243
|
+
name: 'rcs_creative_name',
|
|
244
|
+
type: 'RCS',
|
|
245
|
+
versions: {
|
|
246
|
+
base: {
|
|
247
|
+
content: {
|
|
248
|
+
RCS: {
|
|
249
|
+
rcsContent: {
|
|
250
|
+
contentType: 'RICHCARD',
|
|
251
|
+
cardType: 'STANDALONE',
|
|
252
|
+
cardSettings: {},
|
|
253
|
+
cardContent: [{ title: 'Hi {{user_name}}', cardVarMapped }],
|
|
254
|
+
},
|
|
255
|
+
smsFallBackContent: {},
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
renderedComponent.instance().getFormData(mockValue);
|
|
264
|
+
await tick();
|
|
265
|
+
|
|
266
|
+
const instance = renderedComponent.instance();
|
|
267
|
+
expect(instance.state.templateData.rcsCardVarMapped).toEqual(cardVarMapped);
|
|
206
268
|
});
|
|
207
269
|
|
|
208
270
|
it('Text getCreatives data for rcs, data from creatives done to campaigns', async () => {
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Covers local-templates flag resolution: nested `localTemplatesConfig.useLocalTemplates`
|
|
3
|
+
* vs top-level `useLocalTemplates` (embedded consumers / SlideBoxContent).
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { shallowWithIntl } from '../../../helpers/intl-enzym-test-helpers';
|
|
7
|
+
import { Creatives } from '../index';
|
|
8
|
+
import mockdata from '../../mockdata';
|
|
9
|
+
|
|
10
|
+
const { smsTemplates, loyaltyMetaData } = mockdata;
|
|
11
|
+
|
|
12
|
+
jest.mock('../../../v2Components/FormBuilder', () => ({
|
|
13
|
+
__esModule: true,
|
|
14
|
+
default: (props) => (
|
|
15
|
+
<div className="FormBuilder-mock" {...props}>
|
|
16
|
+
FormBuilder
|
|
17
|
+
</div>
|
|
18
|
+
),
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
const baseProps = {
|
|
22
|
+
loyaltyMetaData,
|
|
23
|
+
Templates: smsTemplates,
|
|
24
|
+
channel: 'SMS',
|
|
25
|
+
creativesMode: 'create',
|
|
26
|
+
templateData: null,
|
|
27
|
+
isFullMode: true,
|
|
28
|
+
handleCloseCreatives: jest.fn(),
|
|
29
|
+
getCreativesData: jest.fn(),
|
|
30
|
+
templateActions: {
|
|
31
|
+
getCdnTransformationConfig: jest.fn(),
|
|
32
|
+
resetTemplateStoreData: jest.fn(),
|
|
33
|
+
},
|
|
34
|
+
globalActions: {
|
|
35
|
+
clearMetaEntities: jest.fn(),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
describe('CreativesContainer useLocalTemplates prop resolution', () => {
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
jest.clearAllMocks();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('initial slidebox is templates when only top-level useLocalTemplates is true', () => {
|
|
45
|
+
const wrapper = shallowWithIntl(
|
|
46
|
+
<Creatives
|
|
47
|
+
{...baseProps}
|
|
48
|
+
useLocalTemplates
|
|
49
|
+
/>,
|
|
50
|
+
);
|
|
51
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('templates');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('initial slidebox is templates when localTemplatesConfig.useLocalTemplates is true', () => {
|
|
55
|
+
const wrapper = shallowWithIntl(
|
|
56
|
+
<Creatives
|
|
57
|
+
{...baseProps}
|
|
58
|
+
localTemplatesConfig={{ useLocalTemplates: true }}
|
|
59
|
+
/>,
|
|
60
|
+
);
|
|
61
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('templates');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('does not reset template store on unmount when embedded and top-level useLocalTemplates is true', () => {
|
|
65
|
+
const wrapper = shallowWithIntl(
|
|
66
|
+
<Creatives
|
|
67
|
+
{...baseProps}
|
|
68
|
+
location={{ query: { type: 'embedded' } }}
|
|
69
|
+
useLocalTemplates
|
|
70
|
+
/>,
|
|
71
|
+
);
|
|
72
|
+
wrapper.unmount();
|
|
73
|
+
expect(baseProps.templateActions.resetTemplateStoreData).not.toHaveBeenCalled();
|
|
74
|
+
expect(baseProps.globalActions.clearMetaEntities).toHaveBeenCalled();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('resets template store on unmount when embedded and local templates are not used', () => {
|
|
78
|
+
const wrapper = shallowWithIntl(
|
|
79
|
+
<Creatives
|
|
80
|
+
{...baseProps}
|
|
81
|
+
location={{ query: { type: 'embedded' } }}
|
|
82
|
+
useLocalTemplates={false}
|
|
83
|
+
/>,
|
|
84
|
+
);
|
|
85
|
+
wrapper.unmount();
|
|
86
|
+
expect(baseProps.templateActions.resetTemplateStoreData).toHaveBeenCalled();
|
|
87
|
+
expect(baseProps.globalActions.clearMetaEntities).toHaveBeenCalled();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('prefers nested localTemplatesConfig.useLocalTemplates=false over top-level true (not local list mode)', () => {
|
|
91
|
+
const wrapper = shallowWithIntl(
|
|
92
|
+
<Creatives
|
|
93
|
+
{...baseProps}
|
|
94
|
+
localTemplatesConfig={{ useLocalTemplates: false }}
|
|
95
|
+
useLocalTemplates
|
|
96
|
+
/>,
|
|
97
|
+
);
|
|
98
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('createTemplate');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('uses top-level useLocalTemplates when localTemplatesConfig omits the flag', () => {
|
|
102
|
+
const wrapper = shallowWithIntl(
|
|
103
|
+
<Creatives
|
|
104
|
+
{...baseProps}
|
|
105
|
+
localTemplatesConfig={{}}
|
|
106
|
+
useLocalTemplates
|
|
107
|
+
/>,
|
|
108
|
+
);
|
|
109
|
+
expect(wrapper.instance().state.slidBoxContent).toBe('templates');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('resets template store when nested useLocalTemplates is false even if top-level is true', () => {
|
|
113
|
+
const wrapper = shallowWithIntl(
|
|
114
|
+
<Creatives
|
|
115
|
+
{...baseProps}
|
|
116
|
+
location={{ query: { type: 'embedded' } }}
|
|
117
|
+
localTemplatesConfig={{ useLocalTemplates: false }}
|
|
118
|
+
useLocalTemplates
|
|
119
|
+
/>,
|
|
120
|
+
);
|
|
121
|
+
wrapper.unmount();
|
|
122
|
+
expect(baseProps.templateActions.resetTemplateStoreData).toHaveBeenCalled();
|
|
123
|
+
expect(baseProps.globalActions.clearMetaEntities).toHaveBeenCalled();
|
|
124
|
+
});
|
|
125
|
+
});
|