@capillarytech/creatives-library 7.17.204-alpha.0 → 7.17.204
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/package.json +1 -1
- package/services/api.js +3 -2
- package/services/tests/api.test.js +34 -1
- package/utils/tagValidations.js +0 -7
- package/v2Components/FormBuilder/index.js +0 -11
- package/v2Containers/BeeEditor/index.js +0 -3
- package/v2Containers/CreativesContainer/SlideBoxContent.js +26 -47
- package/v2Containers/CreativesContainer/index.js +0 -3
- package/v2Containers/Email/index.js +0 -1
- package/v2Containers/EmailWrapper/index.js +0 -3
- package/v2Containers/MobilePush/Create/index.js +0 -2
- package/v2Containers/MobilePush/Edit/index.js +22 -16
- package/v2Containers/MobilepushWrapper/index.js +1 -5
- package/v2Containers/Sms/Create/index.js +0 -2
- package/v2Containers/Sms/Edit/index.js +0 -2
- package/v2Containers/SmsTrai/Edit/index.js +0 -2
- package/v2Containers/SmsWrapper/index.js +0 -2
- package/v2Containers/TagList/index.js +2 -27
- package/v2Containers/TagList/messages.js +0 -4
- package/v2Containers/Viber/index.js +0 -2
- package/v2Containers/Whatsapp/index.js +1 -4
- package/v2Containers/Zalo/index.js +0 -3
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -357,10 +357,11 @@ export const getUserList = () => {
|
|
|
357
357
|
return API.get(url);// request(url, getAPICallObject('GET'));
|
|
358
358
|
};
|
|
359
359
|
|
|
360
|
-
export const fetchSchemaForEntity = ({queryParams}) => {
|
|
360
|
+
export const fetchSchemaForEntity = async ({queryParams}) => {
|
|
361
361
|
if (queryParams.version === "v2" && queryParams.type === "LAYOUT") {
|
|
362
362
|
const schema = getSchema(queryParams.layout);
|
|
363
|
-
|
|
363
|
+
// Added async/await to ensure the schema object is resolved before returning it
|
|
364
|
+
return await schema.then((layout) => layout).catch((err) => {
|
|
364
365
|
console.error(err);
|
|
365
366
|
});
|
|
366
367
|
}
|
|
@@ -11,8 +11,10 @@ import {
|
|
|
11
11
|
getTemplateInfoById,
|
|
12
12
|
askAiraForLiquid,
|
|
13
13
|
getLiquidTags,
|
|
14
|
+
fetchSchemaForEntity,
|
|
14
15
|
} from '../api';
|
|
15
16
|
import { mockData } from './mockData';
|
|
17
|
+
import getSchema from '../getSchema';
|
|
16
18
|
const sampleFile = require('../../assets/line.png');
|
|
17
19
|
|
|
18
20
|
let mockDecompressJsonObject;
|
|
@@ -24,6 +26,8 @@ jest.mock('@capillarytech/cap-ui-utils', () => {
|
|
|
24
26
|
};
|
|
25
27
|
});
|
|
26
28
|
|
|
29
|
+
jest.mock('../getSchema', () => jest.fn());
|
|
30
|
+
|
|
27
31
|
describe('getSenderDetails -- Test with valid responses', () => {
|
|
28
32
|
it('Should return correct response', () =>
|
|
29
33
|
expect(getSenderDetails('WHATSAPP', -1)).toEqual(Promise.resolve()));
|
|
@@ -438,4 +442,33 @@ describe('getLiquidTags -- Test with various responses', () => {
|
|
|
438
442
|
error: 'Internal Server Error',
|
|
439
443
|
});
|
|
440
444
|
});
|
|
441
|
-
});
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
describe('fetchSchemaForEntity', () => {
|
|
448
|
+
it('should fetch schema for version v2 and type LAYOUT', async () => {
|
|
449
|
+
const queryParams = { version: 'v2', type: 'LAYOUT', layout: 'testLayout' };
|
|
450
|
+
const mockLayout = { id: 'layout1', name: 'Test Layout' };
|
|
451
|
+
|
|
452
|
+
getSchema.mockReturnValue(Promise.resolve(mockLayout));
|
|
453
|
+
|
|
454
|
+
const result = await fetchSchemaForEntity({ queryParams });
|
|
455
|
+
|
|
456
|
+
expect(getSchema).toHaveBeenCalledWith(queryParams.layout);
|
|
457
|
+
expect(result).toEqual(mockLayout);
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
it('should handle errors when fetching schema', async () => {
|
|
461
|
+
const queryParams = { version: 'v2', type: 'LAYOUT', layout: 'testLayout' };
|
|
462
|
+
const mockError = new Error('Failed to fetch schema');
|
|
463
|
+
|
|
464
|
+
getSchema.mockReturnValue(Promise.reject(mockError));
|
|
465
|
+
|
|
466
|
+
console.error = jest.fn();
|
|
467
|
+
|
|
468
|
+
const result = await fetchSchemaForEntity({ queryParams });
|
|
469
|
+
|
|
470
|
+
expect(getSchema).toHaveBeenCalledWith(queryParams.layout);
|
|
471
|
+
expect(result).toBeUndefined();
|
|
472
|
+
expect(console.error).toHaveBeenCalledWith(mockError);
|
|
473
|
+
});
|
|
474
|
+
});
|
package/utils/tagValidations.js
CHANGED
|
@@ -93,7 +93,6 @@ export const validateTags = ({
|
|
|
93
93
|
injectedTagsParams,
|
|
94
94
|
location,
|
|
95
95
|
tagModule,
|
|
96
|
-
eventContextTags,
|
|
97
96
|
}) => {
|
|
98
97
|
const tags = tagsParam;
|
|
99
98
|
const injectedTags = transformInjectedTags(injectedTagsParams);
|
|
@@ -146,12 +145,6 @@ export const validateTags = ({
|
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
}
|
|
149
|
-
// Journey Event Context Tags support
|
|
150
|
-
eventContextTags?.forEach((tag) => {
|
|
151
|
-
if (tagValue === tag?.tagName) {
|
|
152
|
-
ifSupported = true;
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
148
|
ifSupported = ifSupported || checkIfSupportedTag(tagValue, injectedTags);
|
|
156
149
|
if (!ifSupported) {
|
|
157
150
|
response.unsupportedTags.push(tagValue);
|
|
@@ -1262,14 +1262,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
|
-
|
|
1266
|
-
// Event Context Tags support
|
|
1267
|
-
this.props?.eventContextTags?.forEach((tag) => {
|
|
1268
|
-
if (tagValue === tag?.tagName) {
|
|
1269
|
-
ifSupported = true;
|
|
1270
|
-
}
|
|
1271
|
-
});
|
|
1272
|
-
|
|
1273
1265
|
ifSupported = ifSupported || this.checkIfSupportedTag(tagValue, injectedTags);
|
|
1274
1266
|
if (!ifSupported && !this.liquidFlow) {
|
|
1275
1267
|
response.unsupportedTags.push(tagValue);
|
|
@@ -2597,7 +2589,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2597
2589
|
id={val.id}
|
|
2598
2590
|
userLocale={this.props.userLocale}
|
|
2599
2591
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
2600
|
-
eventContextTags={this.props.eventContextTags}
|
|
2601
2592
|
/>
|
|
2602
2593
|
</CapColumn>
|
|
2603
2594
|
);
|
|
@@ -3219,7 +3210,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3219
3210
|
userLocale={this.state.translationLang}
|
|
3220
3211
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
3221
3212
|
channel={channel}
|
|
3222
|
-
eventContextTags={this.props.eventContextTags}
|
|
3223
3213
|
/>
|
|
3224
3214
|
</CapColumn>
|
|
3225
3215
|
);
|
|
@@ -3494,7 +3484,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3494
3484
|
saveBeeData={this.props.saveBeeData}
|
|
3495
3485
|
onContextChange={this.props.onContextChange}
|
|
3496
3486
|
moduleFilterEnabled={isModuleFilterEnabled}
|
|
3497
|
-
eventContextTags={this.props.eventContextTags}
|
|
3498
3487
|
/>
|
|
3499
3488
|
</CapColumn>
|
|
3500
3489
|
);
|
|
@@ -48,7 +48,6 @@ function BeeEditor(props) {
|
|
|
48
48
|
actions,
|
|
49
49
|
BEESelect,
|
|
50
50
|
currentOrgDetails,
|
|
51
|
-
eventContextTags,
|
|
52
51
|
} = props;
|
|
53
52
|
const { saveRowRequest } = BEESelect;
|
|
54
53
|
const {formatMessage} = intl;
|
|
@@ -281,7 +280,6 @@ function BeeEditor(props) {
|
|
|
281
280
|
className: "bee-editor-tag-list",
|
|
282
281
|
}}
|
|
283
282
|
onContextChange={onContextChange}
|
|
284
|
-
eventContextTags={eventContextTags}
|
|
285
283
|
/>
|
|
286
284
|
<CapModal
|
|
287
285
|
className="custom-row-modal"
|
|
@@ -325,7 +323,6 @@ BeeEditor.propTypes = {
|
|
|
325
323
|
injectedTags: PropTypes.object,
|
|
326
324
|
onContextChange: PropTypes.func,
|
|
327
325
|
userLocale: PropTypes.string,
|
|
328
|
-
eventContextTags: PropTypes.array,
|
|
329
326
|
};
|
|
330
327
|
|
|
331
328
|
const mapStateToProps = () => createStructuredSelector({
|
|
@@ -155,7 +155,6 @@ export function SlideBoxContent(props) {
|
|
|
155
155
|
moduleType,
|
|
156
156
|
showLiquidErrorInFooter,
|
|
157
157
|
creativesMode,
|
|
158
|
-
eventContextTags,
|
|
159
158
|
} = props;
|
|
160
159
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
161
160
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -396,7 +395,6 @@ export function SlideBoxContent(props) {
|
|
|
396
395
|
onCreateComplete,
|
|
397
396
|
selectedOfferDetails,
|
|
398
397
|
getFormData,
|
|
399
|
-
eventContextTags,
|
|
400
398
|
};
|
|
401
399
|
|
|
402
400
|
return (
|
|
@@ -431,7 +429,6 @@ export function SlideBoxContent(props) {
|
|
|
431
429
|
smsRegister={smsRegister}
|
|
432
430
|
enableNewChannels={enableNewChannels}
|
|
433
431
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
434
|
-
eventContextTags={eventContextTags}
|
|
435
432
|
/>
|
|
436
433
|
)}
|
|
437
434
|
{isPreview && (
|
|
@@ -511,7 +508,6 @@ export function SlideBoxContent(props) {
|
|
|
511
508
|
handleClose={handleClose}
|
|
512
509
|
onCreateComplete={onCreateComplete}
|
|
513
510
|
smsRegister={smsRegister}
|
|
514
|
-
eventContextTags={eventContextTags}
|
|
515
511
|
/>
|
|
516
512
|
)}
|
|
517
513
|
{isEditFTP && (
|
|
@@ -547,7 +543,6 @@ export function SlideBoxContent(props) {
|
|
|
547
543
|
query,
|
|
548
544
|
search: '',
|
|
549
545
|
}}
|
|
550
|
-
eventContextTags={eventContextTags}
|
|
551
546
|
/>
|
|
552
547
|
}
|
|
553
548
|
{
|
|
@@ -578,7 +573,6 @@ export function SlideBoxContent(props) {
|
|
|
578
573
|
onCreateComplete={onCreateComplete}
|
|
579
574
|
smsRegister={smsRegister}
|
|
580
575
|
onShowTemplates={onShowTemplates}
|
|
581
|
-
eventContextTags={eventContextTags}
|
|
582
576
|
/>
|
|
583
577
|
)}
|
|
584
578
|
|
|
@@ -610,7 +604,6 @@ export function SlideBoxContent(props) {
|
|
|
610
604
|
getCmsTemplatesInProgress={getCmsTemplatesInProgress}
|
|
611
605
|
moduleType={moduleType}
|
|
612
606
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
613
|
-
eventContextTags={eventContextTags}
|
|
614
607
|
/>
|
|
615
608
|
)}
|
|
616
609
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -639,7 +632,6 @@ export function SlideBoxContent(props) {
|
|
|
639
632
|
onTestContentClicked={onTestContentClicked}
|
|
640
633
|
moduleType={moduleType}
|
|
641
634
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
642
|
-
eventContextTags={eventContextTags}
|
|
643
635
|
/>
|
|
644
636
|
)}
|
|
645
637
|
{isEditMPush &&
|
|
@@ -665,38 +657,35 @@ export function SlideBoxContent(props) {
|
|
|
665
657
|
type={type}
|
|
666
658
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
667
659
|
creativesMode={creativesMode}
|
|
668
|
-
eventContextTags={eventContextTags}
|
|
669
660
|
/>
|
|
670
661
|
}
|
|
671
662
|
{isCreateMPush &&
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
/>
|
|
699
|
-
}
|
|
663
|
+
<MobilepushWrapper
|
|
664
|
+
key="creatives-mobilepush-wrapper"
|
|
665
|
+
date={new Date().getMilliseconds()}
|
|
666
|
+
setIsLoadingContent={setIsLoadingContent}
|
|
667
|
+
onMobilepushModeChange={onMobilepushModeChange}
|
|
668
|
+
mobilePushCreateMode={mobilePushCreateMode}
|
|
669
|
+
isGetFormData={isGetFormData}
|
|
670
|
+
getFormData={getFormData}
|
|
671
|
+
templateData={templateData}
|
|
672
|
+
type={type}
|
|
673
|
+
step={templateStep}
|
|
674
|
+
showNextStep={onCreateNextStep}
|
|
675
|
+
isFullMode={isFullMode}
|
|
676
|
+
onEnterTemplateName={onEnterTemplateName}
|
|
677
|
+
onRemoveTemplateName={onRemoveTemplateName}
|
|
678
|
+
cap={cap}
|
|
679
|
+
onResetStep={onResetStep}
|
|
680
|
+
showTemplateName={showTemplateName}
|
|
681
|
+
query={query}
|
|
682
|
+
forwardedTags={forwardedTags}
|
|
683
|
+
onValidationFail={onValidationFail}
|
|
684
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
685
|
+
onPreviewContentClicked={onPreviewContentClicked}
|
|
686
|
+
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
687
|
+
onTestContentClicked={onTestContentClicked}/>
|
|
688
|
+
}
|
|
700
689
|
{
|
|
701
690
|
isCreateFacebook && (
|
|
702
691
|
<Facebook
|
|
@@ -713,7 +702,6 @@ export function SlideBoxContent(props) {
|
|
|
713
702
|
fbAdManager={fbAdManager}
|
|
714
703
|
onSelectTemplate={onSelectTemplate}
|
|
715
704
|
orgUnitId={orgUnitId}
|
|
716
|
-
eventContextTags={eventContextTags}
|
|
717
705
|
/>
|
|
718
706
|
)
|
|
719
707
|
}
|
|
@@ -733,7 +721,6 @@ export function SlideBoxContent(props) {
|
|
|
733
721
|
getFormSubscriptionData={getFormData}
|
|
734
722
|
fbAdManager={fbAdManager}
|
|
735
723
|
onSelectTemplate={onSelectTemplate}
|
|
736
|
-
eventContextTags={eventContextTags}
|
|
737
724
|
/>
|
|
738
725
|
)
|
|
739
726
|
}
|
|
@@ -755,7 +742,6 @@ export function SlideBoxContent(props) {
|
|
|
755
742
|
selectedAccount={selectedAccount}
|
|
756
743
|
handleClose={handleClose}
|
|
757
744
|
selectedOfferDetails={selectedOfferDetails}
|
|
758
|
-
eventContextTags={eventContextTags}
|
|
759
745
|
/>
|
|
760
746
|
)
|
|
761
747
|
}
|
|
@@ -774,7 +760,6 @@ export function SlideBoxContent(props) {
|
|
|
774
760
|
createNew
|
|
775
761
|
handleClose={handleClose}
|
|
776
762
|
selectedOfferDetails={selectedOfferDetails}
|
|
777
|
-
eventContextTags={eventContextTags}
|
|
778
763
|
/>
|
|
779
764
|
)
|
|
780
765
|
}
|
|
@@ -789,7 +774,6 @@ export function SlideBoxContent(props) {
|
|
|
789
774
|
onShowTemplates={onShowTemplates}
|
|
790
775
|
templateData={templateData}
|
|
791
776
|
selectedOfferDetails={selectedOfferDetails}
|
|
792
|
-
eventContextTags={eventContextTags}
|
|
793
777
|
createNew/>
|
|
794
778
|
)}
|
|
795
779
|
|
|
@@ -806,13 +790,11 @@ export function SlideBoxContent(props) {
|
|
|
806
790
|
onShowTemplates={onShowTemplates}
|
|
807
791
|
templateData={templateData}
|
|
808
792
|
selectedOfferDetails={selectedOfferDetails}
|
|
809
|
-
eventContextTags={eventContextTags}
|
|
810
793
|
createNew/> }
|
|
811
794
|
|
|
812
795
|
{isCreateWhatsapp && (<Whatsapp
|
|
813
796
|
isFullMode={isFullMode}
|
|
814
797
|
onCreateComplete={onCreateComplete}
|
|
815
|
-
eventContextTags={eventContextTags}
|
|
816
798
|
handleClose={handleClose}/>
|
|
817
799
|
)}
|
|
818
800
|
|
|
@@ -823,7 +805,6 @@ export function SlideBoxContent(props) {
|
|
|
823
805
|
getDefaultTags={type}
|
|
824
806
|
forwardedTags={forwardedTags}
|
|
825
807
|
selectedOfferDetails={selectedOfferDetails}
|
|
826
|
-
eventContextTags={eventContextTags}
|
|
827
808
|
params={{
|
|
828
809
|
id: templateData._id,
|
|
829
810
|
}}
|
|
@@ -847,7 +828,6 @@ export function SlideBoxContent(props) {
|
|
|
847
828
|
isGetFormData={isGetFormData}
|
|
848
829
|
templateData={templateData}
|
|
849
830
|
getDefaultTags={type}
|
|
850
|
-
eventContextTags={eventContextTags}
|
|
851
831
|
/>
|
|
852
832
|
)}
|
|
853
833
|
|
|
@@ -859,7 +839,6 @@ export function SlideBoxContent(props) {
|
|
|
859
839
|
forwardedTags={forwardedTags}
|
|
860
840
|
onCreateComplete={onCreateComplete}
|
|
861
841
|
selectedOfferDetails={selectedOfferDetails}
|
|
862
|
-
eventContextTags={eventContextTags}
|
|
863
842
|
params={{
|
|
864
843
|
id: templateData._id,
|
|
865
844
|
}}
|
|
@@ -1213,7 +1213,6 @@ export class Creatives extends React.Component {
|
|
|
1213
1213
|
editor,
|
|
1214
1214
|
smsRegister,
|
|
1215
1215
|
enableNewChannels,
|
|
1216
|
-
eventContextTags,
|
|
1217
1216
|
} = this.props;
|
|
1218
1217
|
const mapTemplateCreate =
|
|
1219
1218
|
slidBoxContent === "createTemplate" &&
|
|
@@ -1314,7 +1313,6 @@ export class Creatives extends React.Component {
|
|
|
1314
1313
|
moduleType={this.props.messageDetails?.type}
|
|
1315
1314
|
showLiquidErrorInFooter={this.showLiquidErrorInFooter}
|
|
1316
1315
|
creativesMode={creativesMode} // An existing prop that we're using here. Required to ensure correct account details in Edit or Preview in case of Embedded mode.
|
|
1317
|
-
eventContextTags={eventContextTags}
|
|
1318
1316
|
/>
|
|
1319
1317
|
}
|
|
1320
1318
|
footer={this.shouldShowFooter() &&
|
|
@@ -1373,7 +1371,6 @@ Creatives.propTypes = {
|
|
|
1373
1371
|
selectedAccount: PropTypes.object,
|
|
1374
1372
|
strategy: PropTypes.string,
|
|
1375
1373
|
orgUnitId: PropTypes.number,
|
|
1376
|
-
eventContextTags: PropTypes.array,
|
|
1377
1374
|
};
|
|
1378
1375
|
const mapStatesToProps = () => createStructuredSelector({
|
|
1379
1376
|
isLoading: isLoadingSelector(),
|
|
@@ -2733,7 +2733,6 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2733
2733
|
isEmailLoading={isLoading}
|
|
2734
2734
|
moduleType={moduleType}
|
|
2735
2735
|
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
2736
|
-
eventContextTags={this.props?.eventContextTags}
|
|
2737
2736
|
/> : ''}
|
|
2738
2737
|
</Col>
|
|
2739
2738
|
</Row>
|
|
@@ -215,7 +215,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
215
215
|
currentOrgDetails,
|
|
216
216
|
moduleType,
|
|
217
217
|
showLiquidErrorInFooter,
|
|
218
|
-
eventContextTags,
|
|
219
218
|
} = this.props;
|
|
220
219
|
const {
|
|
221
220
|
templateName,
|
|
@@ -288,7 +287,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
288
287
|
onTestContentClicked={onTestContentClicked}
|
|
289
288
|
editor={editor}
|
|
290
289
|
moduleType={moduleType}
|
|
291
|
-
eventContextTags={eventContextTags}
|
|
292
290
|
/>}
|
|
293
291
|
{!isShowEmailCreate && (
|
|
294
292
|
<CmsTemplatesComponent
|
|
@@ -334,7 +332,6 @@ EmailWrapper.propTypes = {
|
|
|
334
332
|
moduleType: PropTypes.string,
|
|
335
333
|
onEnterTemplateName: PropTypes.func,
|
|
336
334
|
onRemoveTemplateName: PropTypes.func,
|
|
337
|
-
eventContextTags: PropTypes.array,
|
|
338
335
|
};
|
|
339
336
|
|
|
340
337
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -1789,7 +1789,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
1789
1789
|
templateData={this.props.templateData}
|
|
1790
1790
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1791
1791
|
isFullMode={this.props.isFullMode}
|
|
1792
|
-
eventContextTags={this.props?.eventContextTags}
|
|
1793
1792
|
/>
|
|
1794
1793
|
</CapColumn>
|
|
1795
1794
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -1881,7 +1880,6 @@ Create.propTypes = {
|
|
|
1881
1880
|
getFormLibraryData: PropTypes.func,
|
|
1882
1881
|
onPreviewContentClicked: PropTypes.func,
|
|
1883
1882
|
onTestContentClicked: PropTypes.func,
|
|
1884
|
-
eventContextTags: PropTypes.array,
|
|
1885
1883
|
};
|
|
1886
1884
|
|
|
1887
1885
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -36,6 +36,7 @@ import { MOBILE_PUSH } from '../../CreativesContainer/constants';
|
|
|
36
36
|
import { getCdnUrl } from '../../../utils/cdnTransformation';
|
|
37
37
|
import { MAPP_SDK } from './constants';
|
|
38
38
|
import { isEmbeddedEditOrPreview } from '../../../utils/commonUtils';
|
|
39
|
+
import { EMBEDDED } from '../../Whatsapp/constants';
|
|
39
40
|
|
|
40
41
|
const PrefixWrapper = styled.div`
|
|
41
42
|
margin-right: 16px;
|
|
@@ -110,27 +111,35 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
110
111
|
let selectedWeChatAccount = {};
|
|
111
112
|
const queryType = String(get(this.props, 'location.query.type', ''))?.toLowerCase();
|
|
112
113
|
const creativesMode = String(get(this.props, 'creativesMode', ''))?.toLowerCase();
|
|
114
|
+
const { Edit: EditProps, Templates } = this.props || {};
|
|
115
|
+
const { selectedWeChatAccount: editSelectedWeChatAccount, templateDetails } = EditProps || {};
|
|
116
|
+
const { id: selectedWeChatAccountId } = editSelectedWeChatAccount || {};
|
|
117
|
+
const { definition } = templateDetails || {};
|
|
118
|
+
const { accountId: templateAccountId } = definition || {};
|
|
119
|
+
const { Edit: nextEdit } = nextProps || {};
|
|
113
120
|
if (isEmbeddedEditOrPreview(queryType, creativesMode)) {
|
|
114
|
-
selectedWeChatAccount = !_.isEmpty(
|
|
115
|
-
?
|
|
116
|
-
:
|
|
117
|
-
} else if (!_.isEmpty(
|
|
118
|
-
selectedWeChatAccount =
|
|
121
|
+
selectedWeChatAccount = !_.isEmpty(editSelectedWeChatAccount)
|
|
122
|
+
? editSelectedWeChatAccount
|
|
123
|
+
: nextEdit?.selectedWeChatAccount;
|
|
124
|
+
} else if (!_.isEmpty(Templates?.selectedWeChatAccount)) {
|
|
125
|
+
selectedWeChatAccount = Templates?.selectedWeChatAccount;
|
|
119
126
|
}
|
|
120
127
|
|
|
121
|
-
if (
|
|
122
|
-
this.setMobilePushAccountOptions(
|
|
128
|
+
if (queryType === EMBEDDED && !nextEdit?.fetchingWeCrmAccounts && !_.isEqual(EditProps?.weCrmAccounts, nextEdit?.weCrmAccounts) && (!selectedWeChatAccount || _.isEmpty(selectedWeChatAccount))) {
|
|
129
|
+
this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, get(this.props, "templateData.definition.accountId"));
|
|
123
130
|
}
|
|
124
|
-
// Check if the
|
|
125
|
-
|
|
126
|
-
if
|
|
127
|
-
|
|
131
|
+
// Check if the current mode is either embedded edit or preview, and if the selected WeChat account ID,
|
|
132
|
+
// template account ID, and the next props' weCrmAccounts are available, and if fetchingWeCrmAccounts is false,
|
|
133
|
+
// and if the selected WeChat account ID is not equal to the template account ID.
|
|
134
|
+
// If all conditions are met, set the mobile push account options using the next props' weCrmAccounts and the template account ID.
|
|
135
|
+
if (isEmbeddedEditOrPreview(queryType, creativesMode) && nextEdit?.weCrmAccounts && templateAccountId && selectedWeChatAccountId && !_.isEqual(selectedWeChatAccountId, templateAccountId)) {
|
|
136
|
+
this.setMobilePushAccountOptions(nextEdit?.weCrmAccounts, templateAccountId);
|
|
128
137
|
}
|
|
129
|
-
if (!_.isEmpty(
|
|
138
|
+
if (!_.isEmpty(nextEdit?.selectedWeChatAccount) && !_.isEqual(editSelectedWeChatAccount, nextEdit?.selectedWeChatAccount) && (queryType === EMBEDDED) && this.props.location.query.module === "loyalty") {
|
|
130
139
|
const params = {
|
|
131
140
|
name: '',
|
|
132
141
|
sortBy: 'Most Recent',
|
|
133
|
-
accountId:
|
|
142
|
+
accountId: nextEdit?.selectedWeChatAccount?.id,
|
|
134
143
|
};
|
|
135
144
|
this.props.actions.getMobilepushTemplatesList('mobilepush', params);
|
|
136
145
|
}
|
|
@@ -159,7 +168,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
159
168
|
this.setTemplateOptions(nextProps.Edit.mobilepushTemplates);
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
|
-
|
|
163
171
|
this.handleEditSchemaOnPropsChange(nextProps, selectedWeChatAccount);
|
|
164
172
|
if (nextProps.Edit.uploadedAssetData) {
|
|
165
173
|
const formData = _.cloneDeep(this.state.formData);
|
|
@@ -1924,7 +1932,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1924
1932
|
templateData={this.props.templateData}
|
|
1925
1933
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1926
1934
|
isFullMode={this.props.isFullMode}
|
|
1927
|
-
eventContextTags={this.props?.eventContextTags}
|
|
1928
1935
|
/>}
|
|
1929
1936
|
</CapColumn>
|
|
1930
1937
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -2020,7 +2027,6 @@ Edit.propTypes = {
|
|
|
2020
2027
|
onPreviewContentClicked: PropTypes.func,
|
|
2021
2028
|
onTestContentClicked: PropTypes.func,
|
|
2022
2029
|
creativesMode: PropTypes.string,
|
|
2023
|
-
eventContextTags: PropTypes.array,
|
|
2024
2030
|
};
|
|
2025
2031
|
|
|
2026
2032
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -72,9 +72,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
render() {
|
|
75
|
-
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData
|
|
76
|
-
eventContextTags,
|
|
77
|
-
} = this.props;
|
|
75
|
+
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData} = this.props;
|
|
78
76
|
const {templateName} = this.state;
|
|
79
77
|
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
80
78
|
return (
|
|
@@ -121,7 +119,6 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
121
119
|
onTestContentClicked={onTestContentClicked}
|
|
122
120
|
templateData={templateData}
|
|
123
121
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
124
|
-
eventContextTags={eventContextTags}
|
|
125
122
|
/>
|
|
126
123
|
|
|
127
124
|
|
|
@@ -147,7 +144,6 @@ MobilepushWrapper.propTypes = {
|
|
|
147
144
|
showTemplateName: PropTypes.func,
|
|
148
145
|
type: PropTypes.string,
|
|
149
146
|
onValidationFail: PropTypes.func,
|
|
150
|
-
eventContextTags: PropTypes.array,
|
|
151
147
|
};
|
|
152
148
|
|
|
153
149
|
|
|
@@ -989,7 +989,6 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
989
989
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
990
990
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
991
991
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
992
|
-
eventContextTags={this.props?.eventContextTags}
|
|
993
992
|
/>
|
|
994
993
|
</CapColumn>
|
|
995
994
|
</CapRow>
|
|
@@ -1016,7 +1015,6 @@ Create.propTypes = {
|
|
|
1016
1015
|
getFormSubscriptionData: PropTypes.func,
|
|
1017
1016
|
isLoadingMetaEntities: PropTypes.bool,
|
|
1018
1017
|
selectedOfferDetails: PropTypes.array,
|
|
1019
|
-
eventContextTags: PropTypes.array,
|
|
1020
1018
|
};
|
|
1021
1019
|
|
|
1022
1020
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -987,7 +987,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
987
987
|
selectedOfferDetails={this.props.selectedOfferDetails}
|
|
988
988
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
989
989
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
990
|
-
eventContextTags={this.props.eventContextTags}
|
|
991
990
|
/>
|
|
992
991
|
</CapColumn>
|
|
993
992
|
</CapRow>
|
|
@@ -1017,7 +1016,6 @@ Edit.propTypes = {
|
|
|
1017
1016
|
// route: PropTypes.object,
|
|
1018
1017
|
injectedTags: PropTypes.object,
|
|
1019
1018
|
selectedOfferDetails: PropTypes.array,
|
|
1020
|
-
eventContextTags: PropTypes.array,
|
|
1021
1019
|
};
|
|
1022
1020
|
|
|
1023
1021
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -71,7 +71,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
71
71
|
getFormSubscriptionData,
|
|
72
72
|
templateData = {},
|
|
73
73
|
selectedOfferDetails,
|
|
74
|
-
eventContextTags,
|
|
75
74
|
} = props || {};
|
|
76
75
|
const { formatMessage } = intl;
|
|
77
76
|
const [loading, updateLoading] = useState(true);
|
|
@@ -570,7 +569,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
570
569
|
injectedTags={injectedTags || {}}
|
|
571
570
|
hidePopover={disablehandler()}
|
|
572
571
|
selectedOfferDetails={selectedOfferDetails}
|
|
573
|
-
eventContextTags={eventContextTags}
|
|
574
572
|
/>
|
|
575
573
|
}
|
|
576
574
|
/>
|
|
@@ -29,7 +29,6 @@ const SmsWrapper = (props) => {
|
|
|
29
29
|
handleClose,
|
|
30
30
|
smsRegister,
|
|
31
31
|
onShowTemplates,
|
|
32
|
-
eventContextTags,
|
|
33
32
|
} = props;
|
|
34
33
|
|
|
35
34
|
const smsProps = {
|
|
@@ -45,7 +44,6 @@ const SmsWrapper = (props) => {
|
|
|
45
44
|
selectedOfferDetails,
|
|
46
45
|
onPreviewContentClicked,
|
|
47
46
|
onTestContentClicked,
|
|
48
|
-
eventContextTags,
|
|
49
47
|
};
|
|
50
48
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
51
49
|
return <>
|
|
@@ -22,7 +22,6 @@ import './_tagList.scss';
|
|
|
22
22
|
import { selectCurrentOrgDetails, makeSelectFetchingSchemaError } from '../Cap/selectors';
|
|
23
23
|
import { injectIntl } from 'react-intl';
|
|
24
24
|
import { scope } from './messages';
|
|
25
|
-
import messages from './messages';
|
|
26
25
|
import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature, hasBadgesFeature, transformBadgeTags } from '../../utils/common';
|
|
27
26
|
import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS, BADGES_RELATED_TAGS, BADGES_ENROLL, BADGES_ISSUE } from '../../containers/App/constants';
|
|
28
27
|
|
|
@@ -84,9 +83,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
84
83
|
generateTags = (props) => {
|
|
85
84
|
let tags = {};
|
|
86
85
|
let injectedTags = {};
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
const {selectedOfferDetails, eventContextTags } = props;
|
|
86
|
+
const {selectedOfferDetails } = props;
|
|
90
87
|
if (props.injectedTags && !_.isEmpty(props.injectedTags)) {
|
|
91
88
|
const formattedInjectedTags = handleInjectedData(
|
|
92
89
|
props.injectedTags,
|
|
@@ -104,28 +101,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
|
|
|
104
101
|
this.transformCouponTags(selectedOfferDetails, tags);
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
|
-
|
|
108
|
-
const TAG_HEADER_MSG_LABEL = this.props.intl.formatMessage(messages.tagsBasedOnEntryTriggerEvent);
|
|
109
|
-
eventContextTagsObj.EventContextTags = {
|
|
110
|
-
name: TAG_HEADER_MSG_LABEL,
|
|
111
|
-
desc: TAG_HEADER_MSG_LABEL,
|
|
112
|
-
resolved: true,
|
|
113
|
-
'tag-header': true,
|
|
114
|
-
subtags: {},
|
|
115
|
-
};
|
|
116
|
-
eventContextTags.forEach((tag) => {
|
|
117
|
-
if (tag?.tagName) {
|
|
118
|
-
eventContextTagsObj.EventContextTags.subtags[tag?.tagName] = {
|
|
119
|
-
name: tag?.tagName,
|
|
120
|
-
desc: tag?.tagName,
|
|
121
|
-
resolved: true
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
console.log("Test >>> generateTags ", {eventTags: this.props.eventContextTags, eventContextTagsObj, tags, injectedTags});
|
|
127
|
-
this.setState({tags: _.merge( {}, tags, injectedTags, eventContextTagsObj )});
|
|
128
|
-
// this.setState({tags: _.merge( {}, tags, injectedTags)});
|
|
104
|
+
this.setState({tags: _.merge( {}, tags, injectedTags)});
|
|
129
105
|
}
|
|
130
106
|
populateTags(tagsList) {
|
|
131
107
|
const mainTags = {};
|
|
@@ -342,7 +318,6 @@ TagList.propTypes = {
|
|
|
342
318
|
channel: PropTypes.string,
|
|
343
319
|
disabled: PropTypes.bool,
|
|
344
320
|
fetchingSchemaError: PropTypes.bool,
|
|
345
|
-
eventContextTags: PropTypes.array,
|
|
346
321
|
};
|
|
347
322
|
|
|
348
323
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -11,8 +11,4 @@ export default defineMessages({
|
|
|
11
11
|
id: `${scope}.header`,
|
|
12
12
|
defaultMessage: 'This is TagList container !',
|
|
13
13
|
},
|
|
14
|
-
tagsBasedOnEntryTriggerEvent: {
|
|
15
|
-
id: `${scope}.tagsBasedOnEntryTriggerEvent`,
|
|
16
|
-
defaultMessage: 'Tags based on entry trigger event',
|
|
17
|
-
},
|
|
18
14
|
});
|
|
@@ -71,7 +71,6 @@ export const Viber = (props) => {
|
|
|
71
71
|
viberData = {},
|
|
72
72
|
selectedOfferDetails = [],
|
|
73
73
|
currentOrgDetails,
|
|
74
|
-
eventContextTags,
|
|
75
74
|
} = props || {};
|
|
76
75
|
|
|
77
76
|
const { formatMessage } = intl;
|
|
@@ -271,7 +270,6 @@ export const Viber = (props) => {
|
|
|
271
270
|
id={"viber_tags"}
|
|
272
271
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
273
272
|
selectedOfferDetails={selectedOfferDetails}
|
|
274
|
-
eventContextTags={eventContextTags}
|
|
275
273
|
/>
|
|
276
274
|
</CapColumn>
|
|
277
275
|
<div className="viber-textarea-wrapper">
|
|
@@ -128,8 +128,7 @@ export const Whatsapp = (props) => {
|
|
|
128
128
|
loadingTags,
|
|
129
129
|
getFormData,
|
|
130
130
|
selectedOfferDetails,
|
|
131
|
-
currentOrgDetails
|
|
132
|
-
eventContextTags,
|
|
131
|
+
currentOrgDetails
|
|
133
132
|
} = props || {};
|
|
134
133
|
const { formatMessage } = intl;
|
|
135
134
|
const { TextArea } = CapInput;
|
|
@@ -502,7 +501,6 @@ export const Whatsapp = (props) => {
|
|
|
502
501
|
injectedTagsParams: injectedTags,
|
|
503
502
|
location,
|
|
504
503
|
tagModule: getDefaultTags,
|
|
505
|
-
eventContextTags,
|
|
506
504
|
}) || {};
|
|
507
505
|
const unsupportedTagsLengthCheck =
|
|
508
506
|
validationResponse?.unsupportedTags?.length > 0;
|
|
@@ -2053,7 +2051,6 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
2053
2051
|
onContextChange={handleOnTagsContextChange}
|
|
2054
2052
|
injectedTags={injectedTags || {}}
|
|
2055
2053
|
selectedOfferDetails={selectedOfferDetails}
|
|
2056
|
-
eventContextTags={eventContextTags}
|
|
2057
2054
|
/>
|
|
2058
2055
|
)
|
|
2059
2056
|
}
|
|
@@ -65,7 +65,6 @@ export const Zalo = (props) => {
|
|
|
65
65
|
injectedTags,
|
|
66
66
|
getFormData,
|
|
67
67
|
selectedOfferDetails,
|
|
68
|
-
eventContextTags,
|
|
69
68
|
} = props || {};
|
|
70
69
|
const {hostName = ''} = senderDetails;
|
|
71
70
|
const { formatMessage } = intl;
|
|
@@ -256,7 +255,6 @@ export const Zalo = (props) => {
|
|
|
256
255
|
injectedTagsParams: injectedTags,
|
|
257
256
|
location,
|
|
258
257
|
tagModule: getDefaultTags,
|
|
259
|
-
eventContextTags,
|
|
260
258
|
}) || {};
|
|
261
259
|
const { unsupportedTags = [], isBraceError } = tagValidationResponse;
|
|
262
260
|
let tagError = '';
|
|
@@ -446,7 +444,6 @@ export const Zalo = (props) => {
|
|
|
446
444
|
injectedTags={injectedTags || {}}
|
|
447
445
|
selectedOfferDetails={selectedOfferDetails}
|
|
448
446
|
disabled={isFullMode}
|
|
449
|
-
eventContextTags={eventContextTags}
|
|
450
447
|
/>
|
|
451
448
|
}
|
|
452
449
|
/>
|