@capillarytech/creatives-library 8.0.125-alpha.6 → 8.0.126
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/config/app.js +6 -0
- package/containers/App/constants.js +0 -1
- package/containers/Email/index.js +5 -5
- package/containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +94 -1
- package/services/tests/api.test.js +191 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +3 -8
- package/tests/integration/TemplateCreation/api-response.js +0 -5
- package/tests/integration/TemplateCreation/msw-handler.js +63 -42
- package/utils/common.js +0 -7
- package/utils/commonUtils.js +6 -2
- package/v2Components/CapImageUpload/index.js +45 -51
- package/v2Components/CapInAppCTA/index.js +0 -1
- package/v2Components/CapTagList/index.js +120 -177
- package/v2Components/CapVideoUpload/constants.js +0 -3
- package/v2Components/CapVideoUpload/index.js +110 -167
- package/v2Components/CapVideoUpload/messages.js +0 -16
- package/v2Components/Carousel/index.js +13 -15
- package/v2Components/CustomerSearchSection/_customerSearch.scss +309 -0
- package/v2Components/CustomerSearchSection/constants.js +5 -0
- package/v2Components/CustomerSearchSection/index.js +362 -0
- package/v2Components/CustomerSearchSection/messages.js +20 -0
- package/v2Components/CustomerSearchSection/tests/utils.test.js +334 -0
- package/v2Components/CustomerSearchSection/utils.js +49 -0
- package/v2Components/ErrorInfoNote/style.scss +0 -1
- package/v2Components/MobilePushPreviewV2/index.js +5 -37
- package/v2Components/TemplatePreview/_templatePreview.scss +72 -114
- package/v2Components/TemplatePreview/index.js +50 -178
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +543 -0
- package/v2Components/TestAndPreviewSlidebox/actions.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/constants.js +67 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +771 -0
- package/v2Components/TestAndPreviewSlidebox/messages.js +147 -0
- package/v2Components/TestAndPreviewSlidebox/reducer.js +233 -0
- package/v2Components/TestAndPreviewSlidebox/sagas.js +258 -0
- package/v2Components/TestAndPreviewSlidebox/selectors.js +142 -0
- package/v2Components/TestAndPreviewSlidebox/tests/actions.test.js +80 -0
- package/v2Components/TestAndPreviewSlidebox/tests/reducer.test.js +367 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.rtl.test.js +192 -0
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +652 -0
- package/v2Components/TestAndPreviewSlidebox/tests/selector.test.js +182 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +21 -9
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +23 -2
- package/v2Containers/CreativesContainer/index.js +160 -195
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +21 -0
- package/v2Containers/Email/index.js +18 -6
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +10 -0
- package/v2Containers/EmailWrapper/index.js +6 -0
- package/v2Containers/InApp/constants.js +0 -1
- package/v2Containers/InApp/index.js +13 -13
- 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/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
- package/v2Containers/MobilePush/Create/index.js +0 -1
- package/v2Containers/MobilePush/commonMethods.js +14 -7
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +23 -5
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +10 -56
- package/v2Containers/Templates/_templates.scss +1 -101
- package/v2Containers/Templates/index.js +35 -147
- package/v2Containers/Templates/messages.js +0 -8
- package/v2Containers/Templates/sagas.js +0 -2
- package/v2Containers/WeChat/RichmediaTemplates/Create/index.js +1 -1
- package/v2Containers/Whatsapp/constants.js +0 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -0
- package/utils/createPayload.js +0 -270
- package/utils/tests/createPayload.test.js +0 -761
- package/v2Components/CapMpushCTA/constants.js +0 -25
- package/v2Components/CapMpushCTA/index.js +0 -332
- package/v2Components/CapMpushCTA/index.scss +0 -95
- package/v2Components/CapMpushCTA/messages.js +0 -89
- package/v2Components/TemplatePreview/assets/images/Android _ With date and time.svg +0 -29
- package/v2Components/TemplatePreview/assets/images/android.svg +0 -9
- package/v2Components/TemplatePreview/assets/images/iOS _ With date and time.svg +0 -26
- package/v2Components/TemplatePreview/assets/images/ios.svg +0 -9
- package/v2Containers/Email/tests/index.test.js +0 -35
- package/v2Containers/MobilePushNew/actions.js +0 -116
- package/v2Containers/MobilePushNew/components/CtaButtons.js +0 -170
- package/v2Containers/MobilePushNew/components/MediaUploaders.js +0 -686
- package/v2Containers/MobilePushNew/components/PlatformContentFields.js +0 -279
- package/v2Containers/MobilePushNew/components/index.js +0 -5
- package/v2Containers/MobilePushNew/components/tests/CtaButtons.test.js +0 -779
- package/v2Containers/MobilePushNew/components/tests/MediaUploaders.test.js +0 -2114
- package/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +0 -343
- package/v2Containers/MobilePushNew/constants.js +0 -115
- package/v2Containers/MobilePushNew/hooks/tests/usePlatformSync.test.js +0 -1299
- package/v2Containers/MobilePushNew/hooks/tests/useUpload.test.js +0 -1223
- package/v2Containers/MobilePushNew/hooks/usePlatformSync.js +0 -246
- package/v2Containers/MobilePushNew/hooks/useUpload.js +0 -709
- package/v2Containers/MobilePushNew/index.js +0 -2170
- package/v2Containers/MobilePushNew/index.scss +0 -308
- package/v2Containers/MobilePushNew/messages.js +0 -226
- package/v2Containers/MobilePushNew/reducer.js +0 -160
- package/v2Containers/MobilePushNew/sagas.js +0 -198
- package/v2Containers/MobilePushNew/selectors.js +0 -55
- package/v2Containers/MobilePushNew/tests/reducer.test.js +0 -741
- package/v2Containers/MobilePushNew/tests/sagas.test.js +0 -863
- package/v2Containers/MobilePushNew/tests/selectors.test.js +0 -425
- package/v2Containers/MobilePushNew/tests/utils.test.js +0 -322
- package/v2Containers/MobilePushNew/utils.js +0 -33
package/config/app.js
CHANGED
|
@@ -7,6 +7,9 @@ const config = {
|
|
|
7
7
|
campaigns_api_endpoint: '/iris/v2/campaigns',
|
|
8
8
|
campaigns_api_org_endpoint: '/iris/v2/org/campaign',
|
|
9
9
|
liquid_endpoint:'/iris/v2/template',
|
|
10
|
+
membercare_api_endpoint: '/member-care/api/v1',
|
|
11
|
+
iris_api_endpoint: '/iris/v2',
|
|
12
|
+
adiona_api_endpoint: '/adiona/api/v1',
|
|
10
13
|
auth_endpoint: '/arya/api/v1/auth',
|
|
11
14
|
arya_endpoint: '/arya/api/v1',
|
|
12
15
|
login_url: '/auth/login',
|
|
@@ -27,6 +30,9 @@ const config = {
|
|
|
27
30
|
login_url: '/auth/login',
|
|
28
31
|
dashboard_url: '/sms',
|
|
29
32
|
liquid_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/template',
|
|
33
|
+
membercare_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/member-care/api/v1',
|
|
34
|
+
iris_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2',
|
|
35
|
+
adiona_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/adiona/api/v1',
|
|
30
36
|
dashboard_url_v2: '/v2',
|
|
31
37
|
},
|
|
32
38
|
testing: {
|
|
@@ -18,7 +18,6 @@ export const JP_LOCALE_HIDE_FEATURE = 'JP_LOCALE_HIDE_FEATURE';
|
|
|
18
18
|
export const ENABLE_WECHAT = 'ENABLE_WECHAT';
|
|
19
19
|
export const ENABLE_CUSTOMER_BARCODE_TAG = "ENABLE_CUSTOMER_BARCODE_TAG";
|
|
20
20
|
export const EMAIL_UNSUBSCRIBE_TAG_MANDATORY = "EMAIL_UNSUBSCRIBE_TAG_MANDATORY";
|
|
21
|
-
export const ENABLE_NEW_MPUSH = "ENABLE_NEW_MPUSH";
|
|
22
21
|
|
|
23
22
|
export const CARD_RELATED_TAGS = [
|
|
24
23
|
'card_series',
|
|
@@ -1049,7 +1049,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1049
1049
|
}
|
|
1050
1050
|
this.edmEvent = undefined;
|
|
1051
1051
|
} else if (this.state.editorInstanse) {
|
|
1052
|
-
this.state.editorInstanse.insertHtml(`<img src='${nextProps.Email.uploadedAssetData.metaInfo.secure_file_path}' alt='
|
|
1052
|
+
this.state.editorInstanse.insertHtml(`<img src='${nextProps.Email.uploadedAssetData.metaInfo.secure_file_path}' alt='Image'>`);
|
|
1053
1053
|
//this.resetCkEditorInstance(this.state.currentTab, this.state.formData, true, nextProps.Email.uploadedAssetData, true);
|
|
1054
1054
|
}
|
|
1055
1055
|
this.setState({showImageSelectionBox: false});
|
|
@@ -1620,7 +1620,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1620
1620
|
if (onInsert && !isImage) {
|
|
1621
1621
|
this.state.editorInstanse.insertHtml(`{{${value}}}`);
|
|
1622
1622
|
} else if (onInsert) {
|
|
1623
|
-
this.state.editorInstanse.insertHtml(`<img src='${value.metaInfo.secure_file_path}' alt='
|
|
1623
|
+
this.state.editorInstanse.insertHtml(`<img src='${value.metaInfo.secure_file_path}' alt='Image'>`);
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
});
|
|
@@ -1979,7 +1979,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
1979
1979
|
// if (this.state.isDragDrop) {
|
|
1980
1980
|
//
|
|
1981
1981
|
// } else {
|
|
1982
|
-
// this.state.editorInstanse.insertHtml(`<img src='${data.metaInfo.public_url}' alt='
|
|
1982
|
+
// this.state.editorInstanse.insertHtml(`<img src='${data.metaInfo.public_url}' alt='Image'>`);
|
|
1983
1983
|
// }
|
|
1984
1984
|
// }
|
|
1985
1985
|
}
|
|
@@ -2070,7 +2070,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2070
2070
|
}
|
|
2071
2071
|
this.edmEvent = undefined;
|
|
2072
2072
|
} else if (this.state.editorInstanse) {
|
|
2073
|
-
this.state.editorInstanse.insertHtml(`<img src='${data.metaInfo.secure_file_path}' alt='
|
|
2073
|
+
this.state.editorInstanse.insertHtml(`<img src='${data.metaInfo.secure_file_path}' alt='Image'>`);
|
|
2074
2074
|
//this.resetCkEditorInstance(this.state.currentTab, this.state.formData, true, data, true);
|
|
2075
2075
|
}
|
|
2076
2076
|
}
|
|
@@ -2446,7 +2446,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2446
2446
|
|
|
2447
2447
|
selectAsset = (asset) => {
|
|
2448
2448
|
if (this.state.editorInstanse) {
|
|
2449
|
-
this.state.editorInstanse.insertHtml(`<img src='${asset}' alt='
|
|
2449
|
+
this.state.editorInstanse.insertHtml(`<img src='${asset}' alt='Image'>`);
|
|
2450
2450
|
}
|
|
2451
2451
|
}
|
|
2452
2452
|
|
|
@@ -903,7 +903,7 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
903
903
|
}
|
|
904
904
|
updateContentData = () => {
|
|
905
905
|
if (this.state.editorInstanse) {
|
|
906
|
-
this.state.editorInstanse.insertHtml(`<img src='${this.props.ContentImageData.metaInfo.wechatUrl}' alt='
|
|
906
|
+
this.state.editorInstanse.insertHtml(`<img src='${this.props.ContentImageData.metaInfo.wechatUrl}' alt='Image'>`);
|
|
907
907
|
}
|
|
908
908
|
this.props.actions.clearContentImageStore();
|
|
909
909
|
this.setState({loading: false});
|
package/initialReducer.js
CHANGED
|
@@ -14,6 +14,7 @@ import ftpReducer from 'v2Containers/FTP/reducer';
|
|
|
14
14
|
import galleryReducer from './v2Containers/Assets/Gallery/reducer';
|
|
15
15
|
import CapCollapsibleLeftNavigationReducer from '@capillarytech/cap-ui-library/CapCollapsibleLeftNavigation/reducer';
|
|
16
16
|
import { AIRA_REDUCER_DOMAIN, askAiraReducer } from '@capillarytech/cap-ui-library/CapAskAira';
|
|
17
|
+
import previewAndTestReducer from './v2Components/TestAndPreviewSlidebox/reducer';
|
|
17
18
|
|
|
18
19
|
export const initialReducer = {
|
|
19
20
|
language: languageProviderReducer,
|
|
@@ -31,4 +32,5 @@ export const initialReducer = {
|
|
|
31
32
|
[AIRA_REDUCER_DOMAIN]: askAiraReducer,
|
|
32
33
|
gallery: galleryReducer,
|
|
33
34
|
navigationConfig: CapCollapsibleLeftNavigationReducer,
|
|
35
|
+
previewAndTest: previewAndTestReducer,
|
|
34
36
|
};
|
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -16,6 +16,9 @@ let EXPORT_API_ENDPOINT = config.development.exports_api_endpoint;
|
|
|
16
16
|
let CAMPAIGNS_API_ENDPOINT = config.development.campaigns_api_endpoint;
|
|
17
17
|
let CAMPAIGNS_API_ORG_ENDPOINT = config.development.campaigns_api_org_endpoint;
|
|
18
18
|
let LIQUID_API_ENDPOINT = config.development.liquid_endpoint;
|
|
19
|
+
let MEMBERCARE_API_ENDPOINT = config.development.membercare_api_endpoint;
|
|
20
|
+
let IRIS_API_ENDPOINT = config.development.iris_api_endpoint;
|
|
21
|
+
let ADIONA_API_ENDPOINT = config.development.adiona_api_endpoint;
|
|
19
22
|
|
|
20
23
|
let API_AUTH_ENDPOINT = config.development.auth_endpoint;
|
|
21
24
|
let ARYA_ENDPOINT = config.development.arya_endpoint;
|
|
@@ -29,6 +32,9 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
29
32
|
SUBSCRIPTION_API_ENDPOINT = config.production.subscription_api_endpoint;
|
|
30
33
|
EXPORT_API_ENDPOINT = config.production.exports_api_endpoint;
|
|
31
34
|
LIQUID_API_ENDPOINT = config.production.liquid_endpoint;
|
|
35
|
+
MEMBERCARE_API_ENDPOINT = config.production.membercare_api_endpoint;
|
|
36
|
+
IRIS_API_ENDPOINT = config.production.iris_api_endpoint;
|
|
37
|
+
ADIONA_API_ENDPOINT = config.production.adiona_api_endpoint;
|
|
32
38
|
}
|
|
33
39
|
let requestCallerName = '';
|
|
34
40
|
const isProd = process.env.NODE_ENV === 'production';
|
|
@@ -172,6 +178,46 @@ function getAPICallObject(method, body, isFileUpload = false, loadCampaignHeader
|
|
|
172
178
|
return requestObj;
|
|
173
179
|
}
|
|
174
180
|
|
|
181
|
+
function get_LOYALTY_API_CallObject(method, body, notStringify) {
|
|
182
|
+
const token = loadItem('token');
|
|
183
|
+
const orgID = loadItem('orgID');
|
|
184
|
+
const user = loadItem('user');
|
|
185
|
+
const headers = {};
|
|
186
|
+
|
|
187
|
+
if (!notStringify) {
|
|
188
|
+
headers['Content-Type'] = 'application/json';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (user && user.refID) {
|
|
192
|
+
headers['X-CAP-REMOTE-USER'] = user.refID;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (process.env.NODE_ENV !== 'production' && orgID !== undefined) {
|
|
196
|
+
headers['X-CAP-API-AUTH-ORG-ID'] = orgID;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (token !== undefined) {
|
|
200
|
+
headers.Authorization = `Bearer ${token}`;
|
|
201
|
+
}
|
|
202
|
+
const requestObj = {
|
|
203
|
+
method,
|
|
204
|
+
mode: 'cors',
|
|
205
|
+
headers: new Headers(headers),
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
if (process.env.NODE_ENV === 'production') {
|
|
209
|
+
requestObj.credentials = 'same-origin';
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (body && !notStringify) {
|
|
213
|
+
requestObj.body = JSON.stringify(body);
|
|
214
|
+
} else {
|
|
215
|
+
requestObj.body = body;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return requestObj;
|
|
219
|
+
}
|
|
220
|
+
|
|
175
221
|
// Authentication
|
|
176
222
|
export const authorize = (user) => {
|
|
177
223
|
const body = {
|
|
@@ -231,7 +277,7 @@ export const createWeChatTemplate = ({template}) => {
|
|
|
231
277
|
return request(url, getAPICallObject('POST', template));
|
|
232
278
|
};
|
|
233
279
|
|
|
234
|
-
export const createMobilePushTemplate = (template) => {
|
|
280
|
+
export const createMobilePushTemplate = ({template}) => {
|
|
235
281
|
const url = `${API_ENDPOINT}/templates/MOBILEPUSH`;
|
|
236
282
|
return request(url, getAPICallObject('POST', template));
|
|
237
283
|
};
|
|
@@ -584,4 +630,51 @@ export const createCentralCommsMetaId = (payload, metaType = TRANSACTION) => {
|
|
|
584
630
|
return request(url, getAPICallObject('POST', payload, false, false, false, true));
|
|
585
631
|
};
|
|
586
632
|
|
|
633
|
+
// Customer Search APIs for Email Test & Preview Feature
|
|
634
|
+
export const searchCustomers = ({ query }) => {
|
|
635
|
+
const url = `${MEMBERCARE_API_ENDPOINT}/customers/search?q=${encodeURIComponent(query)}&limit=10`;
|
|
636
|
+
return request(url, get_LOYALTY_API_CallObject('GET'));
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
export const extractTagsWithMetaData = (payload) => {
|
|
640
|
+
const url = `${LIQUID_API_ENDPOINT}/extractTagsWithMetaData`;
|
|
641
|
+
return request(url, getAPICallObject('POST', payload, false, true));
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
export const updateEmailPreview = (payload) => {
|
|
645
|
+
const url = `${LIQUID_API_ENDPOINT}/preview`;
|
|
646
|
+
return request(url, getAPICallObject('POST', payload, false, true));
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
export const sendTestMessage = (payload) => {
|
|
650
|
+
const url = `${LIQUID_API_ENDPOINT}/sendTestMessage`;
|
|
651
|
+
return request(url, getAPICallObject('POST', payload, false, true));
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
export const fetchTestCustomers = () => {
|
|
655
|
+
const url = `${IRIS_API_ENDPOINT}/userGroup/default`;
|
|
656
|
+
return request(url, getAPICallObject('GET', null, false, true));
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
export const fetchTestGroups = () => {
|
|
660
|
+
const url = `${IRIS_API_ENDPOINT}/userGroup?isDefault=false`;
|
|
661
|
+
return request(url, getAPICallObject('GET', null, false, true));
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
export const getBulkCustomerDetails = (userIds) => {
|
|
665
|
+
const user = loadItem('user');
|
|
666
|
+
const url = `${ADIONA_API_ENDPOINT}/journeys/getBulkCustomer?source=ALL&userValue=${user?.loginName}`;
|
|
667
|
+
return request(url, get_LOYALTY_API_CallObject('POST', userIds));
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
export const createTestMessageMeta = (payload) => {
|
|
671
|
+
const url = `${LIQUID_API_ENDPOINT}/TEST/createMessageMeta`;
|
|
672
|
+
return request(url, getAPICallObject('POST', payload, false, true));
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
export const updateTestMessageMeta = (payload) => {
|
|
676
|
+
const url = `${LIQUID_API_ENDPOINT}/TEST/${payload.messageMetaConfigId}/updateMessageMeta`;
|
|
677
|
+
return request(url, getAPICallObject('POST', payload?.data, false, true));
|
|
678
|
+
};
|
|
679
|
+
|
|
587
680
|
export {request, getAPICallObject};
|
|
@@ -14,6 +14,15 @@ import {
|
|
|
14
14
|
fetchSchemaForEntity,
|
|
15
15
|
getDefaultBeeTemplates,
|
|
16
16
|
getEdmTemplates,
|
|
17
|
+
searchCustomers,
|
|
18
|
+
extractTagsWithMetaData,
|
|
19
|
+
updateEmailPreview,
|
|
20
|
+
sendTestMessage,
|
|
21
|
+
fetchTestCustomers,
|
|
22
|
+
fetchTestGroups,
|
|
23
|
+
getBulkCustomerDetails,
|
|
24
|
+
createTestMessageMeta,
|
|
25
|
+
updateTestMessageMeta,
|
|
17
26
|
} from '../api';
|
|
18
27
|
import { mockData } from './mockData';
|
|
19
28
|
import getSchema from '../getSchema';
|
|
@@ -613,3 +622,185 @@ describe('Email Template APIs', () => {
|
|
|
613
622
|
sharedTests(getDefaultBeeTemplates, 'getDefaultBeeTemplates');
|
|
614
623
|
});
|
|
615
624
|
});
|
|
625
|
+
|
|
626
|
+
describe('searchCustomers', () => {
|
|
627
|
+
it('should return correct response', async () => {
|
|
628
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
629
|
+
status: 200,
|
|
630
|
+
json: () => Promise.resolve({
|
|
631
|
+
status: 200,
|
|
632
|
+
response: 'test',
|
|
633
|
+
}),
|
|
634
|
+
}));
|
|
635
|
+
const result = await searchCustomers({ query: 'test' });
|
|
636
|
+
expect(result).toEqual({
|
|
637
|
+
status: 200,
|
|
638
|
+
response: 'test',
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
it('should handle fetch failure', async () => {
|
|
642
|
+
global.fetch.mockRejectedValue({ error: 'Network error' });
|
|
643
|
+
const result = await searchCustomers({ query: 'test' });
|
|
644
|
+
expect(result).toEqual({
|
|
645
|
+
error: 'Network error',
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
describe('extractTagsWithMetaData', () => {
|
|
650
|
+
it('should return correct response', async () => {
|
|
651
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
652
|
+
status: 200,
|
|
653
|
+
json: () => Promise.resolve({
|
|
654
|
+
status: 200,
|
|
655
|
+
response: 'test',
|
|
656
|
+
}),
|
|
657
|
+
}));
|
|
658
|
+
const result = await extractTagsWithMetaData({ query: 'test' });
|
|
659
|
+
expect(result).toEqual({
|
|
660
|
+
status: 200,
|
|
661
|
+
response: 'test',
|
|
662
|
+
});
|
|
663
|
+
});
|
|
664
|
+
it('should handle fetch failure', async () => {
|
|
665
|
+
global.fetch.mockRejectedValue({ error: 'Network error' });
|
|
666
|
+
const result = await extractTagsWithMetaData({ query: 'test' });
|
|
667
|
+
expect(result).toEqual({
|
|
668
|
+
error: 'Network error',
|
|
669
|
+
});
|
|
670
|
+
});
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
describe('updateEmailPreview', () => {
|
|
674
|
+
it('should return correct response', async () => {
|
|
675
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
676
|
+
status: 200,
|
|
677
|
+
json: () => Promise.resolve({
|
|
678
|
+
status: 200,
|
|
679
|
+
response: 'test',
|
|
680
|
+
}),
|
|
681
|
+
}));
|
|
682
|
+
const result = await updateEmailPreview({ query: 'test' });
|
|
683
|
+
expect(result).toEqual({
|
|
684
|
+
status: 200,
|
|
685
|
+
response: 'test',
|
|
686
|
+
});
|
|
687
|
+
});
|
|
688
|
+
it('should handle fetch failure', async () => {
|
|
689
|
+
global.fetch.mockRejectedValue({ error: 'Network error' });
|
|
690
|
+
const result = await updateEmailPreview({ query: 'test' });
|
|
691
|
+
expect(result).toEqual({
|
|
692
|
+
error: 'Network error',
|
|
693
|
+
});
|
|
694
|
+
});
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
describe('sendTestMessage', () => {
|
|
698
|
+
it('should return correct response', async () => {
|
|
699
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
700
|
+
status: 200,
|
|
701
|
+
json: () => Promise.resolve({
|
|
702
|
+
status: 200,
|
|
703
|
+
response: 'test',
|
|
704
|
+
}),
|
|
705
|
+
}));
|
|
706
|
+
const result = await sendTestMessage({ query: 'test' });
|
|
707
|
+
expect(result).toEqual({
|
|
708
|
+
status: 200,
|
|
709
|
+
response: 'test',
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
});
|
|
713
|
+
describe('fetchTestCustomers', () => {
|
|
714
|
+
it('should return correct response', async () => {
|
|
715
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
716
|
+
status: 200,
|
|
717
|
+
json: () => Promise.resolve({
|
|
718
|
+
status: 200,
|
|
719
|
+
response: 'test',
|
|
720
|
+
}),
|
|
721
|
+
}));
|
|
722
|
+
const result = await fetchTestCustomers({ query: 'test' });
|
|
723
|
+
expect(result).toEqual({
|
|
724
|
+
status: 200,
|
|
725
|
+
response: 'test',
|
|
726
|
+
});
|
|
727
|
+
});
|
|
728
|
+
it('should handle fetch failure', async () => {
|
|
729
|
+
global.fetch.mockRejectedValue({ error: 'Network error' });
|
|
730
|
+
const result = await fetchTestCustomers({ query: 'test' });
|
|
731
|
+
expect(result).toEqual({
|
|
732
|
+
error: 'Network error',
|
|
733
|
+
});
|
|
734
|
+
});
|
|
735
|
+
});
|
|
736
|
+
describe('fetchTestGroups', () => {
|
|
737
|
+
it('should return correct response', async () => {
|
|
738
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
739
|
+
status: 200,
|
|
740
|
+
json: () => Promise.resolve({
|
|
741
|
+
status: 200,
|
|
742
|
+
response: 'test',
|
|
743
|
+
}),
|
|
744
|
+
}));
|
|
745
|
+
const result = await fetchTestGroups({ query: 'test' });
|
|
746
|
+
expect(result).toEqual({
|
|
747
|
+
status: 200,
|
|
748
|
+
response: 'test',
|
|
749
|
+
});
|
|
750
|
+
});
|
|
751
|
+
});
|
|
752
|
+
describe('getBulkCustomerDetails', () => {
|
|
753
|
+
it('should return correct response', async () => {
|
|
754
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
755
|
+
status: 200,
|
|
756
|
+
json: () => Promise.resolve({
|
|
757
|
+
status: 200,
|
|
758
|
+
response: 'test',
|
|
759
|
+
}),
|
|
760
|
+
}));
|
|
761
|
+
const result = await getBulkCustomerDetails({ query: 'test' });
|
|
762
|
+
expect(result).toEqual({
|
|
763
|
+
status: 200,
|
|
764
|
+
response: 'test',
|
|
765
|
+
});
|
|
766
|
+
});
|
|
767
|
+
it('should handle fetch failure', async () => {
|
|
768
|
+
global.fetch.mockRejectedValue({ error: 'Network error' });
|
|
769
|
+
const result = await getBulkCustomerDetails({ query: 'test' });
|
|
770
|
+
expect(result).toEqual({
|
|
771
|
+
error: 'Network error',
|
|
772
|
+
});
|
|
773
|
+
});
|
|
774
|
+
});
|
|
775
|
+
describe('createTestMessageMeta', () => {
|
|
776
|
+
it('should return correct response', async () => {
|
|
777
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
778
|
+
status: 200,
|
|
779
|
+
json: () => Promise.resolve({
|
|
780
|
+
status: 200,
|
|
781
|
+
response: 'test',
|
|
782
|
+
}),
|
|
783
|
+
}));
|
|
784
|
+
const result = await createTestMessageMeta({ query: 'test' });
|
|
785
|
+
expect(result).toEqual({
|
|
786
|
+
status: 200,
|
|
787
|
+
response: 'test',
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
describe('updateTestMessageMeta', () => {
|
|
792
|
+
it('should return correct response', async () => {
|
|
793
|
+
global.fetch.mockReturnValue(Promise.resolve({
|
|
794
|
+
status: 200,
|
|
795
|
+
json: () => Promise.resolve({
|
|
796
|
+
status: 200,
|
|
797
|
+
response: 'test',
|
|
798
|
+
}),
|
|
799
|
+
}));
|
|
800
|
+
const result = await updateTestMessageMeta({ query: 'test' });
|
|
801
|
+
expect(result).toEqual({
|
|
802
|
+
status: 200,
|
|
803
|
+
response: 'test',
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
});
|
|
@@ -32,7 +32,7 @@ jest.mock('@capillarytech/cap-ui-utils', () => ({
|
|
|
32
32
|
},
|
|
33
33
|
}));
|
|
34
34
|
|
|
35
|
-
jest.setTimeout(
|
|
35
|
+
jest.setTimeout(30000);
|
|
36
36
|
|
|
37
37
|
const initializeCreatives = () => {
|
|
38
38
|
const store = configureStore(mockInitialState, initialReducer, history);
|
|
@@ -51,12 +51,6 @@ beforeEach(() => {
|
|
|
51
51
|
server.listen();
|
|
52
52
|
localStorage.clear();
|
|
53
53
|
localStorage.setItem('token', true);
|
|
54
|
-
|
|
55
|
-
// Mock cap auth
|
|
56
|
-
window.capAuth = {
|
|
57
|
-
hasFeatureAccess: jest.fn().mockReturnValue(false),
|
|
58
|
-
isInitialized: jest.fn().mockReturnValue(true),
|
|
59
|
-
};
|
|
60
54
|
});
|
|
61
55
|
|
|
62
56
|
// clean up once the tests are done
|
|
@@ -68,6 +62,7 @@ afterAll(() => {
|
|
|
68
62
|
});
|
|
69
63
|
|
|
70
64
|
describe("Creatives testing template creation", () => {
|
|
65
|
+
jest.useFakeTimers();
|
|
71
66
|
it("Should navigate from creatives home page and create template in RCS channel", async () => {
|
|
72
67
|
initializeCreatives();
|
|
73
68
|
const creativesScreen = await helper.getCreativesScreen();
|
|
@@ -98,7 +93,7 @@ describe("Creatives testing template creation", () => {
|
|
|
98
93
|
name: globalMessages.email.defaultMessage,
|
|
99
94
|
});
|
|
100
95
|
await userEvent.click(whatsapp);
|
|
101
|
-
|
|
96
|
+
waitFor(() => {
|
|
102
97
|
expect(
|
|
103
98
|
creativesScreen.getByText(
|
|
104
99
|
/Whatsapp accounts are not setup for your brand/i
|
|
@@ -20418,8 +20418,3 @@ export const tag = {
|
|
|
20418
20418
|
}
|
|
20419
20419
|
};
|
|
20420
20420
|
|
|
20421
|
-
export const cdnTransformationConfig = {
|
|
20422
|
-
enabled: false,
|
|
20423
|
-
transformations: [],
|
|
20424
|
-
};
|
|
20425
|
-
|
|
@@ -4,52 +4,73 @@ import 'whatwg-fetch';
|
|
|
4
4
|
import * as apiResponse from './api-response';
|
|
5
5
|
|
|
6
6
|
import config from '../../../config/app';
|
|
7
|
-
import { MOBILE_PUSH } from '../../../v2Containers/CreativesContainer/constants';
|
|
8
7
|
const API_ENDPOINT = config.development.api_endpoint;
|
|
9
8
|
const AUTH_ENDPOINT = config.development.auth_endpoint;
|
|
10
9
|
const CAMPAIGNS_API_ENDPOINT = config.development.campaigns_api_org_endpoint;
|
|
11
10
|
|
|
12
11
|
export const server = setupServer(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
rest.options('*', (req, res, ctx) =>
|
|
13
|
+
res(
|
|
14
|
+
ctx.status(200),
|
|
15
|
+
ctx.set('access-control-allow-origin', '*'),
|
|
16
|
+
ctx.set('Access-Control-Allow-Headers', 'x-cap-org'),
|
|
17
|
+
ctx.set('Access-Control-Allow-Headers', 'x-cap-remote-user'),
|
|
18
|
+
ctx.set('Access-Control-Allow-Headers', 'x-cap-api-data-context-org-id'),
|
|
19
|
+
ctx.set('Access-Control-Allow-Headers', 'x-cap-api-auth-org-id'),
|
|
20
|
+
),
|
|
21
|
+
),
|
|
22
|
+
rest.get(`${AUTH_ENDPOINT}/auth/org/:orgId/users`, (req, res, ctx) => {
|
|
23
|
+
const { orgId } = req.params;
|
|
24
|
+
switch (orgId) {
|
|
25
|
+
case '50146':
|
|
26
|
+
return res(ctx.status(200), ctx.json(apiResponse.authOrgUsersReonData));
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
rest.get(`${AUTH_ENDPOINT}/user`, (req, res, ctx) =>
|
|
31
|
+
res(ctx.status(200), ctx.json(apiResponse.authUserReonData)),
|
|
32
|
+
),
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
)
|
|
34
|
+
rest.get(`${AUTH_ENDPOINT}/org/users`, (req, res, ctx) =>
|
|
35
|
+
res(ctx.status(200), ctx.json(apiResponse.authOrgUsersReonData)),
|
|
36
|
+
),
|
|
37
|
+
rest.get(`${API_ENDPOINT}/templates/Sms`, (req, res, ctx) =>
|
|
38
|
+
res(ctx.status(200), ctx.json(apiResponse.smsTemplates)),
|
|
39
|
+
),
|
|
40
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Sms`, (req, res, ctx) =>
|
|
41
|
+
res(ctx.status(200), ctx.json(apiResponse.smsTemplates)),
|
|
42
|
+
),
|
|
43
|
+
rest.get(`${API_ENDPOINT}/templates/Rcs`, (req, res, ctx) =>
|
|
44
|
+
res(ctx.status(200), ctx.json(apiResponse.rcsTemplates)),
|
|
45
|
+
),
|
|
46
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Rcs`, (req, res, ctx) =>
|
|
47
|
+
res(ctx.status(200), ctx.json(apiResponse.rcsTemplates)),
|
|
48
|
+
),
|
|
49
|
+
rest.get(`${API_ENDPOINT}/meta/wecrm`, (req, res, ctx) =>
|
|
50
|
+
res(ctx.status(200), ctx.json(apiResponse.viberAccount)),
|
|
51
|
+
),
|
|
52
|
+
rest.get(`${API_ENDPOINT}/meta/wecrm`, (req, res, ctx) =>
|
|
53
|
+
res(ctx.status(200), ctx.json(apiResponse.whatsappAccount)),
|
|
54
|
+
),
|
|
55
|
+
rest.get(`${API_ENDPOINT}/meta/wecrm`, (req, res, ctx) =>
|
|
56
|
+
res(ctx.status(200), ctx.json(apiResponse.mpushAccount)),
|
|
57
|
+
),
|
|
58
|
+
rest.get(`${API_ENDPOINT}/assets/image`, (req, res, ctx) =>
|
|
59
|
+
res(ctx.status(200), ctx.json(apiResponse.gallery)),
|
|
60
|
+
),
|
|
61
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Line`, (req, res, ctx) =>
|
|
62
|
+
res(ctx.status(200), ctx.json(apiResponse.lineTemplates)),
|
|
63
|
+
),
|
|
64
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Viber`, (req, res, ctx) =>
|
|
65
|
+
res(ctx.status(200), ctx.json(apiResponse.viberTemplates)),
|
|
66
|
+
),
|
|
67
|
+
rest.get(`${API_ENDPOINT}/templates/v1/Email`, (req, res, ctx) =>
|
|
68
|
+
res(ctx.status(200), ctx.json(apiResponse.emailTemplates)),
|
|
69
|
+
),
|
|
70
|
+
rest.get(`${API_ENDPOINT}/meta/TAG`, (req, res, ctx) =>
|
|
71
|
+
res(ctx.status(200), ctx.json(apiResponse.tag)),
|
|
72
|
+
),
|
|
73
|
+
rest.get(`${CAMPAIGNS_API_ENDPOINT}/meta/domainProperties`, (req, res, ctx) =>
|
|
74
|
+
res(ctx.status(200), ctx.json(apiResponse.domainProperties)),
|
|
75
|
+
),
|
|
76
|
+
);
|
package/utils/common.js
CHANGED
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
BADGES_ISSUE,
|
|
23
23
|
ENABLE_WECHAT,
|
|
24
24
|
LIQUID_SUPPORT,
|
|
25
|
-
ENABLE_NEW_MPUSH,
|
|
26
25
|
} from '../containers/App/constants';
|
|
27
26
|
import { apiMessageFormatHandler } from './commonUtils';
|
|
28
27
|
|
|
@@ -125,12 +124,6 @@ export const isEmailUnsubscribeTagMandatory = Auth.hasFeatureAccess.bind(
|
|
|
125
124
|
null,
|
|
126
125
|
EMAIL_UNSUBSCRIBE_TAG_MANDATORY,
|
|
127
126
|
);
|
|
128
|
-
|
|
129
|
-
export const hasNewMobilePushFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
130
|
-
null,
|
|
131
|
-
ENABLE_NEW_MPUSH,
|
|
132
|
-
);
|
|
133
|
-
|
|
134
127
|
//filtering tags based on scope
|
|
135
128
|
export const filterTags = (tagsToFilter, tagsList) => tagsList?.filter(
|
|
136
129
|
(tag) => !tagsToFilter?.includes(tag?.definition?.value)
|
package/utils/commonUtils.js
CHANGED
|
@@ -35,7 +35,7 @@ export const addBaseToTemplate = (template) => {
|
|
|
35
35
|
...template.versions,
|
|
36
36
|
base: {
|
|
37
37
|
...history[0],
|
|
38
|
-
...( get(template, 'versions.base.subject') ? {subject: get(template, 'versions.base.subject')} :
|
|
38
|
+
...( get(template, 'versions.base.subject') ? {subject : get(template, 'versions.base.subject')} :{ subject:history?.[0]?.subject }),
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
});
|
|
@@ -151,7 +151,7 @@ export const validateLiquidTemplateContent = async (
|
|
|
151
151
|
const emptyBodyError = formatMessage(messages?.emailBodyEmptyError);
|
|
152
152
|
const somethingWrongMsg = formatMessage(messages?.somethingWentWrong);
|
|
153
153
|
// Empty content check
|
|
154
|
-
|
|
154
|
+
|
|
155
155
|
if (!content || content.trim() === "") {
|
|
156
156
|
onError({
|
|
157
157
|
standardErrors: [emptyBodyError],
|
|
@@ -170,6 +170,7 @@ export const validateLiquidTemplateContent = async (
|
|
|
170
170
|
|
|
171
171
|
const {askAiraResponse: result, isError} = await getLiquidTagsAsync(content);
|
|
172
172
|
const validString = /\S/.test(content);
|
|
173
|
+
|
|
173
174
|
// Handle API errors or empty content
|
|
174
175
|
if (result?.errors?.length > 0 || !validString || isError) {
|
|
175
176
|
let standardErrors = [];
|
|
@@ -301,6 +302,7 @@ export const _validatePlatformSpecificContent = async (
|
|
|
301
302
|
if (singleTab === IOS) {
|
|
302
303
|
isAndroidValid = true;
|
|
303
304
|
}
|
|
305
|
+
|
|
304
306
|
return isAndroidValid && isIosValid; // Overall success
|
|
305
307
|
};
|
|
306
308
|
|
|
@@ -338,6 +340,7 @@ export const validateMobilePushContent = async (formData, options) => {
|
|
|
338
340
|
if (iosContent) return [iosContent, IOS?.toLowerCase()];
|
|
339
341
|
return ["", ""];
|
|
340
342
|
};
|
|
343
|
+
|
|
341
344
|
if (overallSuccess) {
|
|
342
345
|
const [contentToSubmit, tabTypeToSubmit] = getContentToSubmit();
|
|
343
346
|
// Call the FINAL onSuccess only ONCE here
|
|
@@ -370,6 +373,7 @@ export const validateInAppContent = async (formData, options) => {
|
|
|
370
373
|
onSuccess, // FINAL success callback
|
|
371
374
|
...restOptions // Options for validateLiquidTemplateContent
|
|
372
375
|
} = options;
|
|
376
|
+
|
|
373
377
|
// Clear previous errors with new structure
|
|
374
378
|
onError({
|
|
375
379
|
standardErrors: {
|