@capillarytech/creatives-library 8.0.276 → 8.0.278
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/utils/tests/imageUrlUpload.test.js +298 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +2 -0
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -2
- package/v2Containers/CreativesContainer/index.js +10 -6
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +165 -41
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +6 -0
- package/v2Containers/Email/index.js +75 -9
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +14 -8
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +6 -2
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +189 -6
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +137 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +7 -3
- package/v2Containers/EmailWrapper/index.js +3 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +26 -0
- package/v2Containers/Facebook/Advertisement/index.js +1 -1
- package/v2Containers/Line/Container/_lineCreate.scss +1 -0
- package/v2Containers/Line/Container/style.js +1 -1
- package/v2Containers/MobilePush/Edit/index.js +6 -5
- package/v2Containers/SmsTrai/Create/index.scss +1 -1
- package/v2Containers/SmsTrai/Edit/index.js +9 -3
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +11682 -86
- package/v2Containers/SmsTrai/Edit/tests/index.test.js +5 -0
- package/v2Containers/Viber/index.js +7 -0
- package/v2Containers/Viber/index.scss +4 -1
- package/v2Containers/Viber/style.js +0 -2
|
@@ -66,6 +66,7 @@ const useEmailWrapper = ({
|
|
|
66
66
|
Email,
|
|
67
67
|
templateData,
|
|
68
68
|
params,
|
|
69
|
+
isEditEmail = true,
|
|
69
70
|
}) => {
|
|
70
71
|
// State management
|
|
71
72
|
const [templateName, setTemplateName] = useState('');
|
|
@@ -194,7 +195,10 @@ const useEmailWrapper = ({
|
|
|
194
195
|
return;
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
// New flow: Fetch template details
|
|
198
|
+
// New flow: Fetch template details only when editing (not when creating)
|
|
199
|
+
if (!isEditEmail) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
198
202
|
const hasParamsId = params?.id || location?.query?.id || location?.params?.id || location?.pathname?.includes('/edit/');
|
|
199
203
|
const hasTemplateDetails = Email?.templateDetails && !isEmpty(Email.templateDetails);
|
|
200
204
|
const hasTemplateDataProp = templateData && !isEmpty(templateData);
|
|
@@ -207,7 +211,7 @@ const useEmailWrapper = ({
|
|
|
207
211
|
emailActions.getTemplateDetails(templateId, 'email');
|
|
208
212
|
}
|
|
209
213
|
}
|
|
210
|
-
}, [params?.id, location?.query?.id, location?.params?.id, location?.pathname, Email?.templateDetails, Email?.getTemplateDetailsInProgress, templateData, emailActions]);
|
|
214
|
+
}, [isEditEmail, params?.id, location?.query?.id, location?.params?.id, location?.pathname, Email?.templateDetails, Email?.getTemplateDetailsInProgress, templateData, emailActions]);
|
|
211
215
|
|
|
212
216
|
// Effect to set BEETemplate when template details are loaded for BEE templates
|
|
213
217
|
// This ensures Email component can properly initialize BEE editor
|
|
@@ -643,7 +647,7 @@ const useEmailWrapper = ({
|
|
|
643
647
|
// If template was created in BEE AND BEE is enabled → open in BEE editor
|
|
644
648
|
// Otherwise → open in HTML editor (fallback)
|
|
645
649
|
// IMPORTANT: When supportCKEditor is false, default to HTML editor unless explicitly BEE
|
|
646
|
-
if (isDragDrop && isBeeEnabled) {
|
|
650
|
+
if ((isDragDrop && isBeeEnabled)) {
|
|
647
651
|
editorType = 'BEE';
|
|
648
652
|
selectedEditorMode = null; // BEE uses existing flow
|
|
649
653
|
} else {
|
|
@@ -85,6 +85,7 @@ const EmailWrapper = (props) => {
|
|
|
85
85
|
createTemplateInProgress,
|
|
86
86
|
fetchingCmsData,
|
|
87
87
|
onHtmlEditorValidationStateChange,
|
|
88
|
+
isEditEmail = true,
|
|
88
89
|
} = props;
|
|
89
90
|
|
|
90
91
|
// Pass destructured props to the custom hook
|
|
@@ -143,6 +144,7 @@ const EmailWrapper = (props) => {
|
|
|
143
144
|
Email,
|
|
144
145
|
templateData,
|
|
145
146
|
params,
|
|
147
|
+
isEditEmail,
|
|
146
148
|
});
|
|
147
149
|
|
|
148
150
|
// Render using the presentation component with data from the hook
|
|
@@ -195,6 +197,7 @@ const EmailWrapper = (props) => {
|
|
|
195
197
|
setIsLoadingContent={setIsLoadingContent}
|
|
196
198
|
templateData={templateData}
|
|
197
199
|
params={params}
|
|
200
|
+
isEditEmail={isEditEmail}
|
|
198
201
|
showTemplateName={showTemplateName}
|
|
199
202
|
fetchingLiquidTags={fetchingLiquidTags}
|
|
200
203
|
createTemplateInProgress={createTemplateInProgress}
|
|
@@ -1025,6 +1025,32 @@ describe('useEmailWrapper', () => {
|
|
|
1025
1025
|
expect(mockEmailActions.getTemplateDetails).not.toHaveBeenCalled();
|
|
1026
1026
|
}, { timeout: 1000 });
|
|
1027
1027
|
});
|
|
1028
|
+
|
|
1029
|
+
it('should NOT call getTemplateDetails when isEditEmail is false (create flow)', async () => {
|
|
1030
|
+
const templateId = 'create-flow-id';
|
|
1031
|
+
const createFlowProps = {
|
|
1032
|
+
...newFlowMockProps,
|
|
1033
|
+
isEditEmail: false,
|
|
1034
|
+
params: { id: templateId },
|
|
1035
|
+
location: {
|
|
1036
|
+
pathname: `/email/edit/${templateId}`,
|
|
1037
|
+
query: { id: templateId },
|
|
1038
|
+
},
|
|
1039
|
+
Email: {
|
|
1040
|
+
...newFlowMockProps.Email,
|
|
1041
|
+
templateDetails: null,
|
|
1042
|
+
getTemplateDetailsInProgress: false,
|
|
1043
|
+
},
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
renderHook((props) => useEmailWrapper(props), {
|
|
1047
|
+
initialProps: createFlowProps,
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
await waitFor(() => {
|
|
1051
|
+
expect(mockEmailActions.getTemplateDetails).not.toHaveBeenCalled();
|
|
1052
|
+
}, { timeout: 1000 });
|
|
1053
|
+
});
|
|
1028
1054
|
});
|
|
1029
1055
|
});
|
|
1030
1056
|
|
|
@@ -167,7 +167,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
167
167
|
};
|
|
168
168
|
this.props.actions.getMobilepushTemplatesList('mobilepush', params);
|
|
169
169
|
}
|
|
170
|
-
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.fullSchema)) {
|
|
170
|
+
if (nextProps.metaEntities && nextProps.metaEntities.layouts && nextProps.metaEntities.layouts.length > 0 && _.isEmpty(this.state.fullSchema) && _.isEmpty(this.state.formData)) {
|
|
171
171
|
this.setState({fullSchema: nextProps.metaEntities.layouts[0].definition, schema: (nextProps.location.query.module === 'loyalty') ? nextProps.metaEntities.layouts[0].definition.textSchema : {}}, () => {
|
|
172
172
|
this.handleEditSchemaOnPropsChange(nextProps, selectedWeChatAccount);
|
|
173
173
|
const templateId = get(this, "props.params.id");
|
|
@@ -388,11 +388,11 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
390
|
} else {
|
|
391
|
-
selectedAccount = accounts[0];
|
|
391
|
+
selectedAccount = accounts?.length > 0 ? accounts[0] : {};
|
|
392
392
|
formData['mobilepush-accounts'] = selectedAccount?.id;
|
|
393
393
|
}
|
|
394
394
|
this.props.actions.setWeChatAccount(selectedAccount);
|
|
395
|
-
this.setState({formData, accountsOptions: accounts.map((acc) => ({key: acc.id, label: acc.name, value: acc.id}))});
|
|
395
|
+
this.setState({formData, accountsOptions: accounts?.length > 0 ? accounts.map((acc) => ({key: acc.id, label: acc.name, value: acc.id})) : []});
|
|
396
396
|
};
|
|
397
397
|
|
|
398
398
|
createDefinition = (account) => ({
|
|
@@ -2023,7 +2023,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2023
2023
|
<CapSpin spinning={spinning}>
|
|
2024
2024
|
<CapRow>
|
|
2025
2025
|
<CapColumn>
|
|
2026
|
-
|
|
2026
|
+
<FormBuilder
|
|
2027
|
+
key={!_.isEmpty(schema) ? 'has-schema' : 'no-schema'}
|
|
2027
2028
|
channel={MOBILE_PUSH}
|
|
2028
2029
|
schema={schema}
|
|
2029
2030
|
showLiquidErrorInFooter={this.props.showLiquidErrorInFooter}
|
|
@@ -2058,7 +2059,7 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
2058
2059
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
2059
2060
|
isFullMode={this.props.isFullMode}
|
|
2060
2061
|
eventContextTags={this.props?.eventContextTags}
|
|
2061
|
-
/>
|
|
2062
|
+
/>
|
|
2062
2063
|
</CapColumn>
|
|
2063
2064
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
2064
2065
|
<CapSlideBox
|
|
@@ -106,7 +106,6 @@ export const SmsTraiEdit = (props) => {
|
|
|
106
106
|
padding: ${CAP_SPACE_32} ${CAP_SPACE_24};
|
|
107
107
|
position: fixed;
|
|
108
108
|
bottom: 2rem;
|
|
109
|
-
margin-left: -2rem;
|
|
110
109
|
.ant-btn {
|
|
111
110
|
margin-right: ${CAP_SPACE_16};
|
|
112
111
|
}
|
|
@@ -688,17 +687,24 @@ export const SmsTraiEdit = (props) => {
|
|
|
688
687
|
<CapButton
|
|
689
688
|
onClick={handleTestAndPreview}
|
|
690
689
|
type="secondary"
|
|
691
|
-
className="create-msg
|
|
690
|
+
className="create-msg"
|
|
692
691
|
>
|
|
693
692
|
<FormattedMessage {...messages.testAndPreviewButtonLabel} />
|
|
694
693
|
</CapButton>
|
|
695
694
|
<CapButton
|
|
696
695
|
onClick={isLiquidSupportFeatureEnabled ? onSubmitWrapper : onDoneCallback}
|
|
697
|
-
className="create-msg"
|
|
696
|
+
className="create-msg create-dlt-msg"
|
|
698
697
|
disabled={isTagValidationError || (isLiquidSupportFeatureEnabled && !isObject(metaEntities?.tagLookupMap))}
|
|
699
698
|
>
|
|
700
699
|
<FormattedMessage {...messages.saveButtonLabel} />
|
|
701
700
|
</CapButton>
|
|
701
|
+
<CapButton
|
|
702
|
+
onClick={handleClose}
|
|
703
|
+
className="cancel-dlt-msg"
|
|
704
|
+
type="secondary"
|
|
705
|
+
>
|
|
706
|
+
<FormattedMessage {...messages.cancelButtonLabel} />
|
|
707
|
+
</CapButton>
|
|
702
708
|
</SMSTraiFooter>
|
|
703
709
|
<TestAndPreviewSlidebox
|
|
704
710
|
show={showTestAndPreviewSlidebox}
|