@capillarytech/creatives-library 8.0.136 → 8.0.137-alpha.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 +189 -0
- package/package.json +1 -1
- package/services/getSchema.js +1 -1
- package/services/localStorageApi.js +1 -0
- package/tests/i18n.test.js +1 -1
- package/utils/common.js +2 -2
- package/utils/tagValidations.js +1 -1
- package/utils/tests/checkStore.test.js +1 -1
- package/utils/tests/customAuth.test.js +1 -1
- package/utils/transformerUtils.js +1 -1
- package/v2Components/CapTagList/index.js +9 -14
- package/v2Components/Carousel/style.scss +1 -1
- package/v2Components/EmailMobilePreview/index.js +2 -2
- package/v2Components/FormBuilder/index.js +2 -2
- package/v2Components/TemplatePreview/index.js +2 -1
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/FTP/index.js +1 -1
- package/v2Containers/Line/Container/Text/index.js +1 -1
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +0 -1
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +271 -0
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +189 -0
- package/v2Containers/MobilePushNew/index.scss +0 -7
- package/v2Containers/Sms/Create/index.js +2 -2
- package/v2Containers/Sms/Edit/index.js +1 -1
- package/v2Containers/TagList/index.js +1 -1
- package/v2Containers/TagList/utils.js +1 -1
- package/v2Containers/Templates/index.js +1 -1
- package/v2Containers/Templates/sagas.js +1 -1
- package/components/BreadCrumbs/index.js +0 -65
- package/components/BreadCrumbs/messages.js +0 -13
- package/components/CapTagList/index.js +0 -235
- package/components/CapTagList/messages.js +0 -45
- package/components/Card/_customCard.scss +0 -40
- package/components/Card/index.js +0 -78
- package/components/Card/tests/__snapshots__/index.test.js.snap +0 -22
- package/components/Card/tests/index.test.js +0 -20
- package/components/CardGrid/index.js +0 -71
- package/components/Ckeditor/index.js +0 -238
- package/components/Ckeditor/messages.js +0 -13
- package/components/Ckeditor/style.scss +0 -3
- package/components/Component/index.js +0 -29
- package/components/CustomPopOver/index.js +0 -81
- package/components/CustomPopOver/messages.js +0 -17
- package/components/DateFilter/index.js +0 -349
- package/components/DateFilter/messages.js +0 -57
- package/components/DateRange/index.js +0 -114
- package/components/DateRange/messages.js +0 -25
- package/components/Edmeditor/index.js +0 -65
- package/components/Edmeditor/messages.js +0 -13
- package/components/EmailPreview/_emailPreview.scss +0 -119
- package/components/EmailPreview/assets/images/iPad.svg +0 -10
- package/components/EmailPreview/assets/images/mobile.png +0 -0
- package/components/EmailPreview/index.js +0 -107
- package/components/EmailPreview/messages.js +0 -33
- package/components/Footer/index.js +0 -27
- package/components/Footer/messages.js +0 -13
- package/components/FormBuilder/_formBuilder.scss +0 -83
- package/components/FormBuilder/index.js +0 -3279
- package/components/FormBuilder/messages.js +0 -61
- package/components/Header/index.js +0 -44
- package/components/Header/messages.js +0 -29
- package/components/ImagePreview/_imagePreview.scss +0 -63
- package/components/ImagePreview/index.js +0 -52
- package/components/ImagePreview/messages.js +0 -17
- package/components/PageHeader/_pageHeader.scss +0 -22
- package/components/PageHeader/index.js +0 -37
- package/components/PageHeader/messages.js +0 -13
- package/components/Pagination/_pagination.scss +0 -5
- package/components/Pagination/index.js +0 -49
- package/components/PreviewSideBar/_previewsidebar.scss +0 -28
- package/components/PreviewSideBar/index.js +0 -152
- package/components/PreviewSideBar/messages.js +0 -41
- package/components/Sidebar/_sidebar.scss +0 -115
- package/components/Sidebar/index.js +0 -214
- package/components/Sidebar/messages.js +0 -21
- package/components/SlideBox/_slideBox.scss +0 -63
- package/components/SlideBox/index.js +0 -47
- package/components/SlideBox/tests/index.test.js +0 -103
- package/components/SmsEditor/index.js +0 -55
- package/components/SmsTest/index.js +0 -117
- package/components/SmsTest/messages.js +0 -21
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/_wechatRichmediaTemplatePrev.scss +0 -42
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/index.js +0 -141
- package/components/TemplatePreview/WechatRichmediaTemplatePreview/messages.js +0 -21
- package/components/TemplatePreview/_templatePreview.scss +0 -642
- package/components/TemplatePreview/assets/images/WECHAT_5x.png +0 -0
- package/components/TemplatePreview/assets/images/androidPushMessage.svg +0 -45
- package/components/TemplatePreview/assets/images/home-screen-android.svg +0 -21
- package/components/TemplatePreview/assets/images/home-screen-ios.svg +0 -16
- package/components/TemplatePreview/assets/images/iPhonePushMessage.svg +0 -135
- package/components/TemplatePreview/assets/images/mobile.svg +0 -24
- package/components/TemplatePreview/assets/images/sms-body.png +0 -0
- package/components/TemplatePreview/assets/images/sms-icon.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile.png +0 -0
- package/components/TemplatePreview/assets/images/sms_mobile_android.svg +0 -22
- package/components/TemplatePreview/assets/images/sms_mobile_ios.svg +0 -16
- package/components/TemplatePreview/assets/images/user-icon.svg +0 -19
- package/components/TemplatePreview/assets/images/wechat-mobile.svg +0 -78
- package/components/TemplatePreview/assets/images/wechat_mobile_android.svg +0 -20
- package/components/TemplatePreview/index.js +0 -617
- package/components/TemplatePreview/messages.js +0 -78
- package/components/Toastr/index.js +0 -60
- package/components/Toastr/messages.js +0 -13
- package/components/ToastrMessage/index.js +0 -113
- package/components/ToastrMessage/messages.js +0 -17
- package/components/TopBar/_topbar.scss +0 -46
- package/components/TopBar/assets/images/capillary_logo.png +0 -0
- package/components/TopBar/assets/images/old_capillary_logo.png +0 -0
- package/components/TopBar/index.js +0 -113
- package/components/TopBar/messages.js +0 -29
- package/containers/App/actions.js +0 -7
- package/containers/App/constants.js +0 -114
- package/containers/App/index.js +0 -52
- package/containers/App/reducer.js +0 -19
- package/containers/App/sagas.js +0 -31
- package/containers/App/selectors.js +0 -25
- package/containers/App/test/saga.test.js +0 -11
- package/containers/Assets/Gallery/_gallery.scss +0 -126
- package/containers/Assets/Gallery/actions.js +0 -37
- package/containers/Assets/Gallery/constants.js +0 -23
- package/containers/Assets/Gallery/index.js +0 -473
- package/containers/Assets/Gallery/messages.js +0 -93
- package/containers/Assets/Gallery/reducer.js +0 -81
- package/containers/Assets/Gallery/sagas.js +0 -80
- package/containers/Assets/Gallery/selectors.js +0 -25
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +0 -9
- package/containers/Assets/Gallery/tests/actions.test.js +0 -25
- package/containers/Assets/Gallery/tests/reducer.test.js +0 -96
- package/containers/Assets/Gallery/tests/saga.test.js +0 -157
- package/containers/Cap/actions.js +0 -66
- package/containers/Cap/constants.js +0 -25
- package/containers/Cap/index.js +0 -402
- package/containers/Cap/messages.js +0 -75
- package/containers/Cap/reducer.js +0 -113
- package/containers/Cap/sagas.js +0 -159
- package/containers/Cap/selectors.js +0 -75
- package/containers/Cap/tests/__snapshots__/index.test.js.snap +0 -2269
- package/containers/Cap/tests/index.test.js +0 -22
- package/containers/Cap/tests/saga.test.js +0 -284
- package/containers/Dashboard/actions.js +0 -15
- package/containers/Dashboard/constants.js +0 -7
- package/containers/Dashboard/index.js +0 -76
- package/containers/Dashboard/messages.js +0 -13
- package/containers/Dashboard/reducer.js +0 -21
- package/containers/Dashboard/sagas.js +0 -17
- package/containers/Dashboard/selectors.js +0 -25
- package/containers/Dashboard/test/saga.test.js +0 -9
- package/containers/Ebill/_ebill.scss +0 -5
- package/containers/Ebill/actions.js +0 -43
- package/containers/Ebill/constants.js +0 -20
- package/containers/Ebill/index.js +0 -1278
- package/containers/Ebill/messages.js +0 -77
- package/containers/Ebill/reducer.js +0 -72
- package/containers/Ebill/sagas.js +0 -74
- package/containers/Ebill/selectors.js +0 -25
- package/containers/Ebill/test/saga.test.js +0 -11
- package/containers/Email/_email.scss +0 -141
- package/containers/Email/actions.js +0 -81
- package/containers/Email/constants.js +0 -36
- package/containers/Email/index.js +0 -3325
- package/containers/Email/messages.js +0 -289
- package/containers/Email/reducer.js +0 -142
- package/containers/Email/sagas.js +0 -135
- package/containers/Email/selectors.js +0 -31
- package/containers/Email/test/saga.test.js +0 -671
- package/containers/LanguageProvider/actions.js +0 -17
- package/containers/LanguageProvider/constants.js +0 -8
- package/containers/LanguageProvider/index.js +0 -80
- package/containers/LanguageProvider/reducer.js +0 -30
- package/containers/LanguageProvider/selectors.js +0 -20
- package/containers/LanguageProvider/tests/actions.test.js +0 -19
- package/containers/LanguageProvider/tests/index.test.js +0 -78
- package/containers/LanguageProvider/tests/reducer.test.js +0 -20
- package/containers/LanguageProvider/tests/selectors.test.js +0 -15
- package/containers/Line/Create/_lineCreate.scss +0 -54
- package/containers/Line/Create/actions.js +0 -90
- package/containers/Line/Create/constants.js +0 -39
- package/containers/Line/Create/index.js +0 -836
- package/containers/Line/Create/messages.js +0 -189
- package/containers/Line/Create/reducer.js +0 -99
- package/containers/Line/Create/sagas.js +0 -121
- package/containers/Line/Create/selectors.js +0 -36
- package/containers/Line/Create/tests/saga.test.js +0 -202
- package/containers/Line/Edit/_lineEdit.scss +0 -35
- package/containers/Line/Edit/actions.js +0 -79
- package/containers/Line/Edit/constants.js +0 -27
- package/containers/Line/Edit/index.js +0 -1050
- package/containers/Line/Edit/messages.js +0 -177
- package/containers/Line/Edit/reducer.js +0 -83
- package/containers/Line/Edit/sagas.js +0 -80
- package/containers/Line/Edit/selectors.js +0 -29
- package/containers/Line/Edit/test/saga.test.js +0 -160
- package/containers/Login/assets/images/capillary_logo.png +0 -0
- package/containers/Login/components/LoginForm/index.js +0 -62
- package/containers/Login/components/LoginForm/messages.js +0 -33
- package/containers/Login/index.js +0 -130
- package/containers/Login/messages.js +0 -25
- package/containers/Login/selectors.js +0 -25
- package/containers/MobilePush/Create/_mobilePushCreate.scss +0 -39
- package/containers/MobilePush/Create/actions.js +0 -46
- package/containers/MobilePush/Create/constants.js +0 -23
- package/containers/MobilePush/Create/index.js +0 -2303
- package/containers/MobilePush/Create/messages.js +0 -269
- package/containers/MobilePush/Create/reducer.js +0 -70
- package/containers/MobilePush/Create/sagas.js +0 -74
- package/containers/MobilePush/Create/selectors.js +0 -28
- package/containers/MobilePush/Create/test/saga.test.js +0 -19
- package/containers/MobilePush/Edit/_mobilePushCreate.scss +0 -39
- package/containers/MobilePush/Edit/actions.js +0 -91
- package/containers/MobilePush/Edit/constants.js +0 -35
- package/containers/MobilePush/Edit/index.js +0 -2601
- package/containers/MobilePush/Edit/messages.js +0 -266
- package/containers/MobilePush/Edit/reducer.js +0 -112
- package/containers/MobilePush/Edit/sagas.js +0 -126
- package/containers/MobilePush/Edit/selectors.js +0 -29
- package/containers/MobilePush/Edit/tests/saga.test.js +0 -255
- package/containers/NotFoundPage/index.js +0 -25
- package/containers/NotFoundPage/messages.js +0 -13
- package/containers/NotFoundPage/tests/index.test.js +0 -17
- package/containers/Sms/Create/_smsCreate.scss +0 -42
- package/containers/Sms/Create/actions.js +0 -27
- package/containers/Sms/Create/constants.js +0 -16
- package/containers/Sms/Create/index.js +0 -1488
- package/containers/Sms/Create/messages.js +0 -109
- package/containers/Sms/Create/reducer.js +0 -41
- package/containers/Sms/Create/sagas.js +0 -40
- package/containers/Sms/Create/selectors.js +0 -28
- package/containers/Sms/Create/test/saga.test.js +0 -11
- package/containers/Sms/Edit/actions.js +0 -40
- package/containers/Sms/Edit/constants.js +0 -17
- package/containers/Sms/Edit/index.js +0 -1472
- package/containers/Sms/Edit/messages.js +0 -105
- package/containers/Sms/Edit/reducer.js +0 -50
- package/containers/Sms/Edit/sagas.js +0 -60
- package/containers/Sms/Edit/selectors.js +0 -32
- package/containers/Sms/Edit/test/saga.test.js +0 -13
- package/containers/TagList/_tagList.scss +0 -8
- package/containers/TagList/actions.js +0 -15
- package/containers/TagList/constants.js +0 -32
- package/containers/TagList/index.js +0 -236
- package/containers/TagList/messages.js +0 -13
- package/containers/TagList/reducer.js +0 -23
- package/containers/TagList/sagas.js +0 -11
- package/containers/TagList/selectors.js +0 -25
- package/containers/Templates/_templates.scss +0 -333
- package/containers/Templates/actions.js +0 -103
- package/containers/Templates/constants.js +0 -60
- package/containers/Templates/index.js +0 -1756
- package/containers/Templates/messages.js +0 -337
- package/containers/Templates/reducer.js +0 -142
- package/containers/Templates/sagas.js +0 -163
- package/containers/Templates/selectors.js +0 -28
- package/containers/Templates/test/saga.test.js +0 -241
- package/containers/WeChat/MapTemplates/_mapTemplates.scss +0 -8
- package/containers/WeChat/MapTemplates/actions.js +0 -52
- package/containers/WeChat/MapTemplates/constants.js +0 -28
- package/containers/WeChat/MapTemplates/index.js +0 -1610
- package/containers/WeChat/MapTemplates/messages.js +0 -157
- package/containers/WeChat/MapTemplates/reducer.js +0 -74
- package/containers/WeChat/MapTemplates/sagas.js +0 -84
- package/containers/WeChat/MapTemplates/selectors.js +0 -25
- package/containers/WeChat/MapTemplates/test/saga.test.js +0 -155
- package/containers/WeChat/RichmediaTemplates/Create/_createRichmedia.scss +0 -57
- package/containers/WeChat/RichmediaTemplates/Create/actions.js +0 -36
- package/containers/WeChat/RichmediaTemplates/Create/constants.js +0 -15
- package/containers/WeChat/RichmediaTemplates/Create/index.js +0 -1071
- package/containers/WeChat/RichmediaTemplates/Create/messages.js +0 -165
- package/containers/WeChat/RichmediaTemplates/Create/reducer.js +0 -60
- package/containers/WeChat/RichmediaTemplates/Create/richmediaschema.js +0 -497
- package/containers/WeChat/RichmediaTemplates/Create/sagas.js +0 -51
- package/containers/WeChat/RichmediaTemplates/Create/selectors.js +0 -37
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +0 -13
- package/containers/WeChat/RichmediaTemplates/Edit/actions.js +0 -20
- package/containers/WeChat/RichmediaTemplates/Edit/constants.js +0 -10
- package/containers/WeChat/RichmediaTemplates/Edit/index.js +0 -136
- package/containers/WeChat/RichmediaTemplates/Edit/messages.js +0 -13
- package/containers/WeChat/RichmediaTemplates/Edit/reducer.js +0 -28
- package/containers/WeChat/RichmediaTemplates/Edit/sagas.js +0 -36
- package/containers/WeChat/RichmediaTemplates/Edit/selectors.js +0 -30
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +0 -12
- package/containers/WeChat/RichmediaTemplates/View/actions.js +0 -15
- package/containers/WeChat/RichmediaTemplates/View/constants.js +0 -7
- package/containers/WeChat/RichmediaTemplates/View/index.js +0 -47
- package/containers/WeChat/RichmediaTemplates/View/messages.js +0 -21
- package/containers/WeChat/RichmediaTemplates/View/reducer.js +0 -23
- package/containers/WeChat/RichmediaTemplates/View/sagas.js +0 -11
- package/containers/WeChat/RichmediaTemplates/View/selectors.js +0 -25
- package/utils/asyncInjectors.js +0 -78
- package/utils/callNativeEvent.js +0 -16
- package/utils/checkStore.js +0 -21
- package/utils/customAuthWrapper.js +0 -62
- package/utils/customConnectedAuthWrapper.js +0 -26
- package/utils/jed.js +0 -1497
- package/utils/smsCharCount.js +0 -351
|
@@ -3177,4 +3177,275 @@ describe('MediaUploaders', () => {
|
|
|
3177
3177
|
);
|
|
3178
3178
|
});
|
|
3179
3179
|
});
|
|
3180
|
+
|
|
3181
|
+
// Test cases for uncovered lines
|
|
3182
|
+
describe('Deep link null/undefined handling', () => {
|
|
3183
|
+
it('should handle null deepLink in carousel options', () => {
|
|
3184
|
+
const onCarouselDataChange = jest.fn();
|
|
3185
|
+
renderComponent({
|
|
3186
|
+
mediaType: 'CAROUSEL',
|
|
3187
|
+
carouselData: [
|
|
3188
|
+
{
|
|
3189
|
+
mediaType: 'image',
|
|
3190
|
+
imageUrl: 'test.jpg',
|
|
3191
|
+
buttons: [{
|
|
3192
|
+
actionOnClick: true,
|
|
3193
|
+
linkType: 'DEEP_LINK',
|
|
3194
|
+
deepLinkValue: '',
|
|
3195
|
+
externalLinkValue: '',
|
|
3196
|
+
}],
|
|
3197
|
+
}
|
|
3198
|
+
],
|
|
3199
|
+
onCarouselDataChange,
|
|
3200
|
+
linkProps: {
|
|
3201
|
+
deepLink: null, // This should trigger the fallback to empty array
|
|
3202
|
+
},
|
|
3203
|
+
carouselActiveTabIndex: 0,
|
|
3204
|
+
});
|
|
3205
|
+
|
|
3206
|
+
// Should render without crashing when deepLink is null
|
|
3207
|
+
expect(screen.getByTestId('cap-image-upload')).toBeInTheDocument();
|
|
3208
|
+
});
|
|
3209
|
+
|
|
3210
|
+
it('should handle undefined deepLink in carousel options', () => {
|
|
3211
|
+
const onCarouselDataChange = jest.fn();
|
|
3212
|
+
renderComponent({
|
|
3213
|
+
mediaType: 'CAROUSEL',
|
|
3214
|
+
carouselData: [
|
|
3215
|
+
{
|
|
3216
|
+
mediaType: 'image',
|
|
3217
|
+
imageUrl: 'test.jpg',
|
|
3218
|
+
buttons: [{
|
|
3219
|
+
actionOnClick: true,
|
|
3220
|
+
linkType: 'DEEP_LINK',
|
|
3221
|
+
deepLinkValue: '',
|
|
3222
|
+
externalLinkValue: '',
|
|
3223
|
+
}],
|
|
3224
|
+
}
|
|
3225
|
+
],
|
|
3226
|
+
onCarouselDataChange,
|
|
3227
|
+
linkProps: {
|
|
3228
|
+
deepLink: undefined, // This should trigger the fallback to empty array
|
|
3229
|
+
},
|
|
3230
|
+
carouselActiveTabIndex: 0,
|
|
3231
|
+
});
|
|
3232
|
+
|
|
3233
|
+
// Should render without crashing when deepLink is undefined
|
|
3234
|
+
expect(screen.getByTestId('cap-image-upload')).toBeInTheDocument();
|
|
3235
|
+
});
|
|
3236
|
+
});
|
|
3237
|
+
|
|
3238
|
+
describe('Deep link query parameter handling', () => {
|
|
3239
|
+
it('should match deep link with query parameters in carousel action render', () => {
|
|
3240
|
+
const mockDeepLink = [
|
|
3241
|
+
{ value: 'myapp://page', keys: ['param1'] }
|
|
3242
|
+
];
|
|
3243
|
+
const mockCarouselData = [{
|
|
3244
|
+
mediaType: 'image',
|
|
3245
|
+
imageUrl: 'test-image.jpg',
|
|
3246
|
+
buttons: [{
|
|
3247
|
+
actionOnClick: true,
|
|
3248
|
+
linkType: 'DEEP_LINK',
|
|
3249
|
+
deepLinkValue: 'myapp://page?param1=value1', // Has query parameters
|
|
3250
|
+
deepLinkKeys: ['param1'],
|
|
3251
|
+
externalLinkValue: '',
|
|
3252
|
+
}]
|
|
3253
|
+
}];
|
|
3254
|
+
|
|
3255
|
+
const { getByText } = render(
|
|
3256
|
+
<Provider store={mockStore}>
|
|
3257
|
+
<IntlProvider messages={messages} locale="en">
|
|
3258
|
+
<MediaUploaders
|
|
3259
|
+
mediaType="CAROUSEL"
|
|
3260
|
+
activeTab="ANDROID"
|
|
3261
|
+
imageSrc={{ androidImageSrc: '', iosImageSrc: '' }}
|
|
3262
|
+
uploadMpushAsset={jest.fn()}
|
|
3263
|
+
isFullMode={false}
|
|
3264
|
+
setUpdateMpushImageSrc={jest.fn()}
|
|
3265
|
+
updateOnMpushImageReUpload={jest.fn()}
|
|
3266
|
+
imageData={{}}
|
|
3267
|
+
videoAssetList={{}}
|
|
3268
|
+
gifAssetList={{}}
|
|
3269
|
+
setUpdateMpushVideoSrc={jest.fn()}
|
|
3270
|
+
videoDataForVideo={{}}
|
|
3271
|
+
videoDataForGif={{}}
|
|
3272
|
+
videoSrc={''}
|
|
3273
|
+
formatMessage={mockFormatMessage}
|
|
3274
|
+
linkProps={{ deepLink: mockDeepLink }}
|
|
3275
|
+
clearImageDataByMediaType={jest.fn()}
|
|
3276
|
+
carouselData={mockCarouselData}
|
|
3277
|
+
onCarouselDataChange={jest.fn()}
|
|
3278
|
+
mobilePushActions={{ clearAsset: jest.fn() }}
|
|
3279
|
+
carouselActiveTabIndex={0}
|
|
3280
|
+
setCarouselActiveTabIndex={jest.fn()}
|
|
3281
|
+
carouselLinkErrors={{}}
|
|
3282
|
+
updateCarouselLinkError={jest.fn()}
|
|
3283
|
+
/>
|
|
3284
|
+
</IntlProvider>
|
|
3285
|
+
</Provider>
|
|
3286
|
+
);
|
|
3287
|
+
|
|
3288
|
+
// Should find the base deep link and display keys
|
|
3289
|
+
expect(getByText('param1')).toBeInTheDocument();
|
|
3290
|
+
});
|
|
3291
|
+
|
|
3292
|
+
it('should match deep link with query parameters in carousel keys display', () => {
|
|
3293
|
+
const mockDeepLink = [
|
|
3294
|
+
{ value: 'myapp://home', keys: ['userId', 'sessionId'] }
|
|
3295
|
+
];
|
|
3296
|
+
const mockCarouselData = [{
|
|
3297
|
+
mediaType: 'image',
|
|
3298
|
+
imageUrl: 'test-image.jpg',
|
|
3299
|
+
buttons: [{
|
|
3300
|
+
actionOnClick: true,
|
|
3301
|
+
linkType: 'DEEP_LINK',
|
|
3302
|
+
deepLinkValue: 'myapp://home?userId=123&sessionId=abc', // Has query parameters
|
|
3303
|
+
deepLinkKeys: ['userId', 'sessionId'],
|
|
3304
|
+
externalLinkValue: '',
|
|
3305
|
+
}]
|
|
3306
|
+
}];
|
|
3307
|
+
|
|
3308
|
+
const { getByText } = render(
|
|
3309
|
+
<Provider store={mockStore}>
|
|
3310
|
+
<IntlProvider messages={messages} locale="en">
|
|
3311
|
+
<MediaUploaders
|
|
3312
|
+
mediaType="CAROUSEL"
|
|
3313
|
+
activeTab="ANDROID"
|
|
3314
|
+
imageSrc={{ androidImageSrc: '', iosImageSrc: '' }}
|
|
3315
|
+
uploadMpushAsset={jest.fn()}
|
|
3316
|
+
isFullMode={false}
|
|
3317
|
+
setUpdateMpushImageSrc={jest.fn()}
|
|
3318
|
+
updateOnMpushImageReUpload={jest.fn()}
|
|
3319
|
+
imageData={{}}
|
|
3320
|
+
videoAssetList={{}}
|
|
3321
|
+
gifAssetList={{}}
|
|
3322
|
+
setUpdateMpushVideoSrc={jest.fn()}
|
|
3323
|
+
videoDataForVideo={{}}
|
|
3324
|
+
videoDataForGif={{}}
|
|
3325
|
+
videoSrc={''}
|
|
3326
|
+
formatMessage={mockFormatMessage}
|
|
3327
|
+
linkProps={{ deepLink: mockDeepLink }}
|
|
3328
|
+
clearImageDataByMediaType={jest.fn()}
|
|
3329
|
+
carouselData={mockCarouselData}
|
|
3330
|
+
onCarouselDataChange={jest.fn()}
|
|
3331
|
+
mobilePushActions={{ clearAsset: jest.fn() }}
|
|
3332
|
+
carouselActiveTabIndex={0}
|
|
3333
|
+
setCarouselActiveTabIndex={jest.fn()}
|
|
3334
|
+
carouselLinkErrors={{}}
|
|
3335
|
+
updateCarouselLinkError={jest.fn()}
|
|
3336
|
+
/>
|
|
3337
|
+
</IntlProvider>
|
|
3338
|
+
</Provider>
|
|
3339
|
+
);
|
|
3340
|
+
|
|
3341
|
+
// Should find the base deep link and display keys
|
|
3342
|
+
expect(getByText('userId, sessionId')).toBeInTheDocument();
|
|
3343
|
+
});
|
|
3344
|
+
|
|
3345
|
+
it('should match deep link with query parameters in carousel placeholder', () => {
|
|
3346
|
+
const mockDeepLink = [
|
|
3347
|
+
{ value: 'testapp://screen', keys: ['itemId'] }
|
|
3348
|
+
];
|
|
3349
|
+
const mockCarouselData = [{
|
|
3350
|
+
mediaType: 'image',
|
|
3351
|
+
imageUrl: 'test-image.jpg',
|
|
3352
|
+
buttons: [{
|
|
3353
|
+
actionOnClick: true,
|
|
3354
|
+
linkType: 'DEEP_LINK',
|
|
3355
|
+
deepLinkValue: 'testapp://screen?itemId=456', // Has query parameters
|
|
3356
|
+
deepLinkKeys: [],
|
|
3357
|
+
externalLinkValue: '',
|
|
3358
|
+
}]
|
|
3359
|
+
}];
|
|
3360
|
+
|
|
3361
|
+
render(
|
|
3362
|
+
<Provider store={mockStore}>
|
|
3363
|
+
<IntlProvider messages={messages} locale="en">
|
|
3364
|
+
<MediaUploaders
|
|
3365
|
+
mediaType="CAROUSEL"
|
|
3366
|
+
activeTab="ANDROID"
|
|
3367
|
+
imageSrc={{ androidImageSrc: '', iosImageSrc: '' }}
|
|
3368
|
+
uploadMpushAsset={jest.fn()}
|
|
3369
|
+
isFullMode={false}
|
|
3370
|
+
setUpdateMpushImageSrc={jest.fn()}
|
|
3371
|
+
updateOnMpushImageReUpload={jest.fn()}
|
|
3372
|
+
imageData={{}}
|
|
3373
|
+
videoAssetList={{}}
|
|
3374
|
+
gifAssetList={{}}
|
|
3375
|
+
setUpdateMpushVideoSrc={jest.fn()}
|
|
3376
|
+
videoDataForVideo={{}}
|
|
3377
|
+
videoDataForGif={{}}
|
|
3378
|
+
videoSrc={''}
|
|
3379
|
+
formatMessage={mockFormatMessage}
|
|
3380
|
+
linkProps={{ deepLink: mockDeepLink }}
|
|
3381
|
+
clearImageDataByMediaType={jest.fn()}
|
|
3382
|
+
carouselData={mockCarouselData}
|
|
3383
|
+
onCarouselDataChange={jest.fn()}
|
|
3384
|
+
mobilePushActions={{ clearAsset: jest.fn() }}
|
|
3385
|
+
carouselActiveTabIndex={0}
|
|
3386
|
+
setCarouselActiveTabIndex={jest.fn()}
|
|
3387
|
+
carouselLinkErrors={{}}
|
|
3388
|
+
updateCarouselLinkError={jest.fn()}
|
|
3389
|
+
/>
|
|
3390
|
+
</IntlProvider>
|
|
3391
|
+
</Provider>
|
|
3392
|
+
);
|
|
3393
|
+
|
|
3394
|
+
// The component should render successfully and find the deep link by base value
|
|
3395
|
+
expect(screen.getByTestId('cap-image-upload')).toBeInTheDocument();
|
|
3396
|
+
});
|
|
3397
|
+
|
|
3398
|
+
it('should not match deep link when no base match exists with query parameters', () => {
|
|
3399
|
+
const mockDeepLink = [
|
|
3400
|
+
{ value: 'myapp://different', keys: ['param1'] }
|
|
3401
|
+
];
|
|
3402
|
+
const mockCarouselData = [{
|
|
3403
|
+
mediaType: 'image',
|
|
3404
|
+
imageUrl: 'test-image.jpg',
|
|
3405
|
+
buttons: [{
|
|
3406
|
+
actionOnClick: true,
|
|
3407
|
+
linkType: 'DEEP_LINK',
|
|
3408
|
+
deepLinkValue: 'myapp://nomatch?param1=value1', // Base doesn't match any deepLink
|
|
3409
|
+
deepLinkKeys: [],
|
|
3410
|
+
externalLinkValue: '',
|
|
3411
|
+
}]
|
|
3412
|
+
}];
|
|
3413
|
+
|
|
3414
|
+
render(
|
|
3415
|
+
<Provider store={mockStore}>
|
|
3416
|
+
<IntlProvider messages={messages} locale="en">
|
|
3417
|
+
<MediaUploaders
|
|
3418
|
+
mediaType="CAROUSEL"
|
|
3419
|
+
activeTab="ANDROID"
|
|
3420
|
+
imageSrc={{ androidImageSrc: '', iosImageSrc: '' }}
|
|
3421
|
+
uploadMpushAsset={jest.fn()}
|
|
3422
|
+
isFullMode={false}
|
|
3423
|
+
setUpdateMpushImageSrc={jest.fn()}
|
|
3424
|
+
updateOnMpushImageReUpload={jest.fn()}
|
|
3425
|
+
imageData={{}}
|
|
3426
|
+
videoAssetList={{}}
|
|
3427
|
+
gifAssetList={{}}
|
|
3428
|
+
setUpdateMpushVideoSrc={jest.fn()}
|
|
3429
|
+
videoDataForVideo={{}}
|
|
3430
|
+
videoDataForGif={{}}
|
|
3431
|
+
videoSrc={''}
|
|
3432
|
+
formatMessage={mockFormatMessage}
|
|
3433
|
+
linkProps={{ deepLink: mockDeepLink }}
|
|
3434
|
+
clearImageDataByMediaType={jest.fn()}
|
|
3435
|
+
carouselData={mockCarouselData}
|
|
3436
|
+
onCarouselDataChange={jest.fn()}
|
|
3437
|
+
mobilePushActions={{ clearAsset: jest.fn() }}
|
|
3438
|
+
carouselActiveTabIndex={0}
|
|
3439
|
+
setCarouselActiveTabIndex={jest.fn()}
|
|
3440
|
+
carouselLinkErrors={{}}
|
|
3441
|
+
updateCarouselLinkError={jest.fn()}
|
|
3442
|
+
/>
|
|
3443
|
+
</IntlProvider>
|
|
3444
|
+
</Provider>
|
|
3445
|
+
);
|
|
3446
|
+
|
|
3447
|
+
// Should render without crashing even when no match is found
|
|
3448
|
+
expect(screen.getByTestId('cap-image-upload')).toBeInTheDocument();
|
|
3449
|
+
});
|
|
3450
|
+
});
|
|
3180
3451
|
});
|
|
@@ -651,4 +651,193 @@ describe("PlatformContentFields", () => {
|
|
|
651
651
|
// Check that error message is displayed
|
|
652
652
|
expect(getByText('Deep link keys error message')).toBeInTheDocument();
|
|
653
653
|
});
|
|
654
|
+
|
|
655
|
+
// Test cases for uncovered lines
|
|
656
|
+
describe('Deep link null/undefined handling', () => {
|
|
657
|
+
it('should handle null deepLink in options', () => {
|
|
658
|
+
const { container } = renderComponent({
|
|
659
|
+
content: { ...defaultProps.content, actionOnClick: true, linkType: DEEP_LINK },
|
|
660
|
+
linkProps: {
|
|
661
|
+
deepLink: null, // This should trigger the fallback to empty array
|
|
662
|
+
deepLinkValue: '',
|
|
663
|
+
externalLinkValue: '',
|
|
664
|
+
},
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// Should render without crashing when deepLink is null
|
|
668
|
+
expect(container).toBeInTheDocument();
|
|
669
|
+
});
|
|
670
|
+
|
|
671
|
+
it('should handle undefined deepLink in options', () => {
|
|
672
|
+
const { container } = renderComponent({
|
|
673
|
+
content: { ...defaultProps.content, actionOnClick: true, linkType: DEEP_LINK },
|
|
674
|
+
linkProps: {
|
|
675
|
+
deepLink: undefined, // This should trigger the fallback to empty array
|
|
676
|
+
deepLinkValue: '',
|
|
677
|
+
externalLinkValue: '',
|
|
678
|
+
},
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
// Should render without crashing when deepLink is undefined
|
|
682
|
+
expect(container).toBeInTheDocument();
|
|
683
|
+
});
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
describe('Deep link query parameter handling', () => {
|
|
687
|
+
it('should match deep link with query parameters', () => {
|
|
688
|
+
const mockDeepLink = [
|
|
689
|
+
{ value: 'myapp://profile', keys: ['userId'] }
|
|
690
|
+
];
|
|
691
|
+
const mockLinkProps = {
|
|
692
|
+
deepLink: mockDeepLink,
|
|
693
|
+
deepLinkValue: 'myapp://profile?userId=123', // Has query parameters
|
|
694
|
+
deepLinkKeysValue: ['userId'],
|
|
695
|
+
externalLinkValue: '',
|
|
696
|
+
};
|
|
697
|
+
const mockContent = {
|
|
698
|
+
title: 'Test Title',
|
|
699
|
+
message: 'Test Message',
|
|
700
|
+
mediaType: 'IMAGE',
|
|
701
|
+
actionOnClick: true,
|
|
702
|
+
linkType: 'DEEP_LINK',
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
const { getByText } = render(
|
|
706
|
+
<IntlProvider locale="en">
|
|
707
|
+
<PlatformContentFields
|
|
708
|
+
deviceType="ANDROID"
|
|
709
|
+
content={mockContent}
|
|
710
|
+
errors={{}}
|
|
711
|
+
handlers={defaultProps.handlers}
|
|
712
|
+
tagListProps={defaultProps.tagListProps}
|
|
713
|
+
mediaUploaderProps={defaultProps.mediaUploaderProps}
|
|
714
|
+
ctaButtonProps={defaultProps.ctaButtonProps}
|
|
715
|
+
linkProps={mockLinkProps}
|
|
716
|
+
sameContent={false}
|
|
717
|
+
formatMessage={defaultProps.formatMessage}
|
|
718
|
+
/>
|
|
719
|
+
</IntlProvider>
|
|
720
|
+
);
|
|
721
|
+
|
|
722
|
+
// Should find the base deep link and display keys
|
|
723
|
+
expect(getByText('userId')).toBeInTheDocument();
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
it('should not match deep link when no base match exists with query parameters', () => {
|
|
727
|
+
const mockDeepLink = [
|
|
728
|
+
{ value: 'myapp://settings', keys: ['theme'] }
|
|
729
|
+
];
|
|
730
|
+
const mockLinkProps = {
|
|
731
|
+
deepLink: mockDeepLink,
|
|
732
|
+
deepLinkValue: 'myapp://nomatch?theme=dark', // Base doesn't match any deepLink
|
|
733
|
+
deepLinkKeysValue: [],
|
|
734
|
+
externalLinkValue: '',
|
|
735
|
+
};
|
|
736
|
+
const mockContent = {
|
|
737
|
+
title: 'Test Title',
|
|
738
|
+
message: 'Test Message',
|
|
739
|
+
mediaType: 'IMAGE',
|
|
740
|
+
actionOnClick: true,
|
|
741
|
+
linkType: 'DEEP_LINK',
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
const { container } = render(
|
|
745
|
+
<IntlProvider locale="en">
|
|
746
|
+
<PlatformContentFields
|
|
747
|
+
deviceType="ANDROID"
|
|
748
|
+
content={mockContent}
|
|
749
|
+
errors={{}}
|
|
750
|
+
handlers={defaultProps.handlers}
|
|
751
|
+
tagListProps={defaultProps.tagListProps}
|
|
752
|
+
mediaUploaderProps={defaultProps.mediaUploaderProps}
|
|
753
|
+
ctaButtonProps={defaultProps.ctaButtonProps}
|
|
754
|
+
linkProps={mockLinkProps}
|
|
755
|
+
sameContent={false}
|
|
756
|
+
formatMessage={defaultProps.formatMessage}
|
|
757
|
+
/>
|
|
758
|
+
</IntlProvider>
|
|
759
|
+
);
|
|
760
|
+
|
|
761
|
+
// Should render without crashing even when no match is found
|
|
762
|
+
expect(container).toBeInTheDocument();
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
it('should handle multiple query parameters in deep link value', () => {
|
|
766
|
+
const mockDeepLink = [
|
|
767
|
+
{ value: 'testapp://dashboard', keys: ['category', 'filter'] }
|
|
768
|
+
];
|
|
769
|
+
const mockLinkProps = {
|
|
770
|
+
deepLink: mockDeepLink,
|
|
771
|
+
deepLinkValue: 'testapp://dashboard?category=news&filter=recent', // Multiple query parameters
|
|
772
|
+
deepLinkKeysValue: ['category', 'filter'],
|
|
773
|
+
externalLinkValue: '',
|
|
774
|
+
};
|
|
775
|
+
const mockContent = {
|
|
776
|
+
title: 'Test Title',
|
|
777
|
+
message: 'Test Message',
|
|
778
|
+
mediaType: 'IMAGE',
|
|
779
|
+
actionOnClick: true,
|
|
780
|
+
linkType: 'DEEP_LINK',
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
const { getByText } = render(
|
|
784
|
+
<IntlProvider locale="en">
|
|
785
|
+
<PlatformContentFields
|
|
786
|
+
deviceType="ANDROID"
|
|
787
|
+
content={mockContent}
|
|
788
|
+
errors={{}}
|
|
789
|
+
handlers={defaultProps.handlers}
|
|
790
|
+
tagListProps={defaultProps.tagListProps}
|
|
791
|
+
mediaUploaderProps={defaultProps.mediaUploaderProps}
|
|
792
|
+
ctaButtonProps={defaultProps.ctaButtonProps}
|
|
793
|
+
linkProps={mockLinkProps}
|
|
794
|
+
sameContent={false}
|
|
795
|
+
formatMessage={defaultProps.formatMessage}
|
|
796
|
+
/>
|
|
797
|
+
</IntlProvider>
|
|
798
|
+
);
|
|
799
|
+
|
|
800
|
+
// Should find the base deep link and display keys
|
|
801
|
+
expect(getByText('category, filter')).toBeInTheDocument();
|
|
802
|
+
});
|
|
803
|
+
|
|
804
|
+
it('should handle empty query parameters in deep link value', () => {
|
|
805
|
+
const mockDeepLink = [
|
|
806
|
+
{ value: 'myapp://search', keys: ['query'] }
|
|
807
|
+
];
|
|
808
|
+
const mockLinkProps = {
|
|
809
|
+
deepLink: mockDeepLink,
|
|
810
|
+
deepLinkValue: 'myapp://search?', // Empty query parameters
|
|
811
|
+
deepLinkKeysValue: ['query'],
|
|
812
|
+
externalLinkValue: '',
|
|
813
|
+
};
|
|
814
|
+
const mockContent = {
|
|
815
|
+
title: 'Test Title',
|
|
816
|
+
message: 'Test Message',
|
|
817
|
+
mediaType: 'IMAGE',
|
|
818
|
+
actionOnClick: true,
|
|
819
|
+
linkType: 'DEEP_LINK',
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
const { getByText } = render(
|
|
823
|
+
<IntlProvider locale="en">
|
|
824
|
+
<PlatformContentFields
|
|
825
|
+
deviceType="ANDROID"
|
|
826
|
+
content={mockContent}
|
|
827
|
+
errors={{}}
|
|
828
|
+
handlers={defaultProps.handlers}
|
|
829
|
+
tagListProps={defaultProps.tagListProps}
|
|
830
|
+
mediaUploaderProps={defaultProps.mediaUploaderProps}
|
|
831
|
+
ctaButtonProps={defaultProps.ctaButtonProps}
|
|
832
|
+
linkProps={mockLinkProps}
|
|
833
|
+
sameContent={false}
|
|
834
|
+
formatMessage={defaultProps.formatMessage}
|
|
835
|
+
/>
|
|
836
|
+
</IntlProvider>
|
|
837
|
+
);
|
|
838
|
+
|
|
839
|
+
// Should find the base deep link and display keys
|
|
840
|
+
expect(getByText('query')).toBeInTheDocument();
|
|
841
|
+
});
|
|
842
|
+
});
|
|
654
843
|
});
|
|
@@ -34,9 +34,6 @@
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.platform-header {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: space-between;
|
|
40
37
|
margin-bottom: $CAP_SPACE_24;
|
|
41
38
|
}
|
|
42
39
|
|
|
@@ -44,10 +41,6 @@
|
|
|
44
41
|
flex: 1;
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
// .platform-header {
|
|
48
|
-
// margin-left: 24px;
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
44
|
.tab-label {
|
|
52
45
|
display: flex;
|
|
53
46
|
align-items: center;
|
|
@@ -18,13 +18,13 @@ import './_smsCreate.scss';
|
|
|
18
18
|
import FormBuilder from '../../../v2Components/FormBuilder';
|
|
19
19
|
import * as actions from './actions';
|
|
20
20
|
import messages from './messages';
|
|
21
|
-
import * as charCount from '../../../
|
|
21
|
+
import * as charCount from '../../../legacy/smsCharCount';
|
|
22
22
|
import {checkUnicode, updateCharCount} from '../../../utils/smsCharCountV2';
|
|
23
23
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
24
24
|
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
25
25
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
26
26
|
import {SMS} from '../../CreativesContainer/constants';
|
|
27
|
-
// import callNativeEvent from '../../../
|
|
27
|
+
// import callNativeEvent from '../../../legacy/callNativeEvent';
|
|
28
28
|
import {showError} from '../commonMethods';
|
|
29
29
|
import withCreatives from '../../../hoc/withCreatives';
|
|
30
30
|
import { GA } from '@capillarytech/cap-ui-utils';
|
|
@@ -24,7 +24,7 @@ import messages from './messages';
|
|
|
24
24
|
import {getMessageObject} from '../../../utils/messageUtils';
|
|
25
25
|
import { gtmPush } from '../../../utils/gtmTrackers';
|
|
26
26
|
import * as creativesContainerActions from '../../CreativesContainer/actions';
|
|
27
|
-
// import callNativeEvent from '../../../
|
|
27
|
+
// import callNativeEvent from '../../../legacy/callNativeEvent';
|
|
28
28
|
import {showError} from '../commonMethods';
|
|
29
29
|
import withCreatives from '../../../hoc/withCreatives';
|
|
30
30
|
import { EDIT, TRACK_EDIT_SMS } from '../../App/constants';
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from '../../utils/common';
|
|
29
29
|
import {
|
|
30
30
|
GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS, BADGES_ENROLL, BADGES_ISSUE,
|
|
31
|
-
} from '../../
|
|
31
|
+
} from '../../constants/unified';
|
|
32
32
|
|
|
33
33
|
const {TreeNode} = Tree;
|
|
34
34
|
|
|
@@ -104,7 +104,7 @@ import {
|
|
|
104
104
|
CREATE,
|
|
105
105
|
} from '../App/constants';
|
|
106
106
|
import {MAX_WHATSAPP_TEMPLATES, WARNING_WHATSAPP_TEMPLATES , ACCOUNT_MAPPING_ON_CHANNEL} from './constants';
|
|
107
|
-
import { COPY_OF } from '../../
|
|
107
|
+
import { COPY_OF } from '../../constants/unified';
|
|
108
108
|
import {
|
|
109
109
|
STATUS_OPTIONS,
|
|
110
110
|
CATEGORY,
|
|
@@ -6,7 +6,7 @@ import get from 'lodash/get';
|
|
|
6
6
|
import * as Api from '../../services/api';
|
|
7
7
|
import * as types from './constants';
|
|
8
8
|
import { saveCdnConfigs, removeAllCdnLocalStorageItems } from '../../utils/cdnTransformation';
|
|
9
|
-
import { COPY_OF } from '../../
|
|
9
|
+
import { COPY_OF } from '../../constants/unified';
|
|
10
10
|
import { ZALO_TEMPLATE_INFO_REQUEST } from '../Zalo/constants';
|
|
11
11
|
import { getTemplateInfoById } from '../Zalo/saga';
|
|
12
12
|
import { watchCreateTemplate } from '../MobilePushNew/sagas';
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
// import styled from 'styled-components';
|
|
4
|
-
import { Link } from 'react-router';
|
|
5
|
-
import _ from 'lodash';
|
|
6
|
-
|
|
7
|
-
class BreadCrumbs extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props);
|
|
10
|
-
this.prepareBreadcrumbElement = this.prepareBreadcrumbElement.bind(this);
|
|
11
|
-
this.disabledBreadcrumb = this.disabledBreadcrumb.bind(this);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
disabledBreadcrumb(e, location) {
|
|
15
|
-
if (location.disabled) {
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
prepareBreadcrumbElement() {
|
|
21
|
-
const breadcrumbs = [];
|
|
22
|
-
_.forEach(this.props.locations, (location) => {
|
|
23
|
-
const titleText = (typeof location.text === 'string') ? location.text : location.text.props.defaultMessage;
|
|
24
|
-
const element = (
|
|
25
|
-
<Link
|
|
26
|
-
to={location.url}
|
|
27
|
-
key={titleText}
|
|
28
|
-
title={titleText}
|
|
29
|
-
onClick={(e) => this.disabledBreadcrumb(e, location)}
|
|
30
|
-
>
|
|
31
|
-
<span
|
|
32
|
-
className={location.disabled ? 'disabled-breadcrumb' : 'active-breadcrumb'}
|
|
33
|
-
disabled={location.disabled}
|
|
34
|
-
> {location.text}
|
|
35
|
-
</span>
|
|
36
|
-
</Link>
|
|
37
|
-
);
|
|
38
|
-
if (breadcrumbs.length !== 0) {
|
|
39
|
-
breadcrumbs.push(
|
|
40
|
-
<span
|
|
41
|
-
key={`${titleText}separator`}
|
|
42
|
-
> {this.props.separator ? this.props.separator : ' / '}
|
|
43
|
-
</span>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
breadcrumbs.push(element);
|
|
47
|
-
});
|
|
48
|
-
return breadcrumbs;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
render() {
|
|
52
|
-
return (
|
|
53
|
-
<div className="breadcrumbs-wrapper">
|
|
54
|
-
{this.prepareBreadcrumbElement()}
|
|
55
|
-
</div>
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
BreadCrumbs.propTypes = {
|
|
61
|
-
locations: PropTypes.array.isRequired,
|
|
62
|
-
separator: PropTypes.string,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export default BreadCrumbs;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* BreadCrumbs Messages
|
|
3
|
-
*
|
|
4
|
-
* This contains all the text for the BreadCrumbs component.
|
|
5
|
-
*/
|
|
6
|
-
import { defineMessages } from 'react-intl';
|
|
7
|
-
|
|
8
|
-
export default defineMessages({
|
|
9
|
-
header: {
|
|
10
|
-
id: 'creatives.components.BreadCrumbs.header',
|
|
11
|
-
defaultMessage: 'This is the BreadCrumbs component !',
|
|
12
|
-
},
|
|
13
|
-
});
|