@capillarytech/creatives-library 7.17.82-alpha.1 → 7.17.82
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 +0 -5
- package/services/tests/api.test.js +1 -9
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -20
- package/v2Components/TemplatePreview/index.js +0 -35
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Containers/CreativesContainer/index.js +1 -5
- package/v2Containers/Whatsapp/actions.js +0 -16
- package/v2Containers/Whatsapp/constants.js +0 -6
- package/v2Containers/Whatsapp/index.js +9 -74
- package/v2Containers/Whatsapp/index.scss +0 -6
- package/v2Containers/Whatsapp/messages.js +1 -5
- package/v2Containers/Whatsapp/reducer.js +0 -19
- package/v2Containers/Whatsapp/sagas.js +1 -40
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +1880 -11386
- package/v2Containers/Whatsapp/tests/actions.test.js +0 -21
- package/v2Containers/Whatsapp/tests/index.test.js +0 -8
- package/v2Containers/Whatsapp/tests/mockData.js +0 -6
- package/v2Containers/Whatsapp/tests/reducer.test.js +0 -67
- package/v2Containers/Whatsapp/tests/saga.test.js +0 -90
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -504,8 +504,3 @@ export const getTemplateInfoById = ({id, username, oa_id, token}) => {
|
|
|
504
504
|
const url = `${API_ENDPOINT}/templates/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}`;
|
|
505
505
|
return request(url, getAPICallObject('GET'));
|
|
506
506
|
};
|
|
507
|
-
|
|
508
|
-
export const getMetaTags = ({previewUrl}) => {
|
|
509
|
-
const url = `${API_ENDPOINT}/common/getMetaTags?url=${previewUrl}`;
|
|
510
|
-
return request(url, getAPICallObject('GET'));
|
|
511
|
-
};
|
|
@@ -2,8 +2,7 @@ import {
|
|
|
2
2
|
getSenderDetails,
|
|
3
3
|
uploadFile,
|
|
4
4
|
getCdnTransformationConfig,
|
|
5
|
-
createWhatsappTemplate
|
|
6
|
-
getMetaTags,
|
|
5
|
+
createWhatsappTemplate
|
|
7
6
|
} from '../api';
|
|
8
7
|
import { mockData } from './mockData';
|
|
9
8
|
const sampleFile = require('../../assets/line.png');
|
|
@@ -45,10 +44,3 @@ describe('createWhatsappTemplate -- Test with valid responses', () => {
|
|
|
45
44
|
createWhatsappTemplate(sampleFile, mockData.createWhatsappPayload),
|
|
46
45
|
).toEqual(Promise.resolve()));
|
|
47
46
|
});
|
|
48
|
-
|
|
49
|
-
describe('getMetaTags -- Test with valid responses', () => {
|
|
50
|
-
it('Should return correct response', () =>
|
|
51
|
-
expect(
|
|
52
|
-
getMetaTags({previewUrl: 'https://capillarytech.com'}),
|
|
53
|
-
).toEqual(Promise.resolve()));
|
|
54
|
-
});
|
|
@@ -520,24 +520,4 @@
|
|
|
520
520
|
.zalo-preview-container-campaign {
|
|
521
521
|
padding-left: 0px;
|
|
522
522
|
padding-right: 4.563rem;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
.url-preview-image {
|
|
526
|
-
width: 100%;
|
|
527
|
-
height: 100%;
|
|
528
|
-
background-color: hsl(0, 0%, 90%);
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
.url-preview-description {
|
|
532
|
-
font-size: 0.6rem;
|
|
533
|
-
font-weight: $FONT_WEIGHT_REGULAR;
|
|
534
|
-
color: $FONT_COLOR_01;
|
|
535
|
-
margin: 0.13rem 0;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
.url-preview {
|
|
539
|
-
font-size: 0.5rem;
|
|
540
|
-
font-weight: $FONT_WEIGHT_REGULAR;
|
|
541
|
-
color: $FONT_COLOR_02;
|
|
542
|
-
margin-bottom: $CAP_SPACE_08;
|
|
543
523
|
}
|
|
@@ -11,7 +11,6 @@ import _ from 'lodash';
|
|
|
11
11
|
import { injectIntl, FormattedMessage, intlShape } from 'react-intl';
|
|
12
12
|
// import styled from 'styled-components';
|
|
13
13
|
import { CapColumn, CapRow, CapHeading, CapIcon, CapButton, CapImage, CapLabel, CapDivider, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
14
|
-
import { isEmpty } from 'lodash';
|
|
15
14
|
import './_templatePreview.scss';
|
|
16
15
|
import {updateCharCount} from '../../utils/smsCharCountV2';
|
|
17
16
|
import messages from './messages';
|
|
@@ -343,37 +342,6 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
343
342
|
);
|
|
344
343
|
};
|
|
345
344
|
|
|
346
|
-
const renderUrlPreview = (metaTags) => {
|
|
347
|
-
const renderArray = [];
|
|
348
|
-
if (!isEmpty(metaTags)) {
|
|
349
|
-
if (metaTags?.image) {
|
|
350
|
-
renderArray.push(
|
|
351
|
-
<CapImage
|
|
352
|
-
src={metaTags?.image}
|
|
353
|
-
alt={formatMessage(messages.previewUrlMetaImage)}
|
|
354
|
-
className="url-preview-image"
|
|
355
|
-
/>
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
if (metaTags?.title) {
|
|
359
|
-
renderArray.push(
|
|
360
|
-
<CapLabel type="label8">{metaTags?.title}</CapLabel>
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
if (metaTags?.description) {
|
|
364
|
-
renderArray.push(
|
|
365
|
-
<CapLabel className="url-preview-description">{metaTags?.description}</CapLabel>
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
if (metaTags?.url) {
|
|
369
|
-
renderArray.push(
|
|
370
|
-
<CapLabel className="url-preview">{metaTags?.url}</CapLabel>
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
return renderArray;
|
|
375
|
-
};
|
|
376
|
-
|
|
377
345
|
const handlePreview = () => {
|
|
378
346
|
const {templatePreviewUrl = ''} = templateData;
|
|
379
347
|
handlePreviewInNewTab(templatePreviewUrl);
|
|
@@ -788,9 +756,6 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
788
756
|
<div className="msg-container whatsapp-message-container">
|
|
789
757
|
<div className="message-pop align-left" style={whatsappSectionStyle}>
|
|
790
758
|
<div className="whatsapp-content">
|
|
791
|
-
{content?.isPreviewUrl && (
|
|
792
|
-
renderUrlPreview(content?.metaTagsDetails)
|
|
793
|
-
)}
|
|
794
759
|
{content?.whatsappImageSrc && (
|
|
795
760
|
<CapImage
|
|
796
761
|
src={content.whatsappImageSrc}
|
|
@@ -82,8 +82,4 @@ export default defineMessages({
|
|
|
82
82
|
id: 'creatives.componentsV2.TemplatePreview.videoPreviewTooltip',
|
|
83
83
|
defaultMessage: "This is just for preview purposes, video cannot be played here",
|
|
84
84
|
},
|
|
85
|
-
previewUrlMetaImage: {
|
|
86
|
-
id: 'creatives.componentsV2.TemplatePreview.previewUrlMetaImage',
|
|
87
|
-
defaultMessage: 'Preview url meta image',
|
|
88
|
-
},
|
|
89
85
|
});
|
|
@@ -411,7 +411,6 @@ export class Creatives extends React.Component {
|
|
|
411
411
|
buttons = [],
|
|
412
412
|
mediaType = 'TEXT',
|
|
413
413
|
whatsappMedia = {},
|
|
414
|
-
isPreviewUrl = false,
|
|
415
414
|
} = {},
|
|
416
415
|
} = templateData;
|
|
417
416
|
const mediaParams = {};
|
|
@@ -477,7 +476,6 @@ export class Creatives extends React.Component {
|
|
|
477
476
|
: template,
|
|
478
477
|
},
|
|
479
478
|
],
|
|
480
|
-
isPreviewUrl,
|
|
481
479
|
},
|
|
482
480
|
},
|
|
483
481
|
},
|
|
@@ -679,8 +677,7 @@ export class Creatives extends React.Component {
|
|
|
679
677
|
headerVarMapped = {},
|
|
680
678
|
footer = '',
|
|
681
679
|
headerTemplate = '',
|
|
682
|
-
} = {}
|
|
683
|
-
isPreviewUrl = false,
|
|
680
|
+
} = {}
|
|
684
681
|
} = cloneDeep(versions.base.content.whatsapp);
|
|
685
682
|
|
|
686
683
|
const modifiedButtons = cloneDeep(buttons).map((btn) => {
|
|
@@ -750,7 +747,6 @@ export class Creatives extends React.Component {
|
|
|
750
747
|
buttons: modifiedButtons,
|
|
751
748
|
mediaType,
|
|
752
749
|
whatsappMedia,
|
|
753
|
-
isPreviewUrl,
|
|
754
750
|
},
|
|
755
751
|
};
|
|
756
752
|
}
|
|
@@ -6,8 +6,6 @@ import {
|
|
|
6
6
|
WHATSAPP,
|
|
7
7
|
UPLOAD_WHATSAPP_ASSET_REQUEST,
|
|
8
8
|
CLEAR_WHATSAPP_ASSET,
|
|
9
|
-
URL_META_TAGS_REQUEST,
|
|
10
|
-
URL_META_TAGS_RESET,
|
|
11
9
|
} from './constants';
|
|
12
10
|
|
|
13
11
|
export function createWhatsappTemplate(payload, callback, gupshupMediaFile) {
|
|
@@ -57,17 +55,3 @@ export const clearWhatsappAsset = (templateType) => ({
|
|
|
57
55
|
type: CLEAR_WHATSAPP_ASSET,
|
|
58
56
|
templateType,
|
|
59
57
|
});
|
|
60
|
-
|
|
61
|
-
export function getMetaTags({previewUrl, callBack}) {
|
|
62
|
-
return {
|
|
63
|
-
type: URL_META_TAGS_REQUEST,
|
|
64
|
-
previewUrl,
|
|
65
|
-
callBack,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function resetMetaTags() {
|
|
70
|
-
return {
|
|
71
|
-
type: URL_META_TAGS_RESET,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
@@ -31,12 +31,6 @@ export const UPLOAD_WHATSAPP_ASSET_SUCCESS = `${prefix}/UPLOAD_WHATSAPP_ASSET_SU
|
|
|
31
31
|
export const UPLOAD_WHATSAPP_ASSET_FAILURE = `${prefix}/UPLOAD_WHATSAPP_ASSET_FAILURE`;
|
|
32
32
|
export const CLEAR_WHATSAPP_ASSET = `${prefix}/CLEAR_WHATSAPP_ASSET`;
|
|
33
33
|
|
|
34
|
-
//For meta tags
|
|
35
|
-
export const URL_META_TAGS_REQUEST = `${prefix}/URL_META_TAGS_REQUEST`;
|
|
36
|
-
export const URL_META_TAGS_SUCCESS = `${prefix}/URL_META_TAGS_SUCCESS`;
|
|
37
|
-
export const URL_META_TAGS_FAILURE = `${prefix}/URL_META_TAGS_FAILURE`;
|
|
38
|
-
export const URL_META_TAGS_RESET = `${prefix}/URL_META_TAGS_RESET`;
|
|
39
|
-
|
|
40
34
|
export const STATUS = 'status';
|
|
41
35
|
export const CATEGORY = 'category';
|
|
42
36
|
|
|
@@ -181,12 +181,9 @@ export const Whatsapp = (props) => {
|
|
|
181
181
|
const [headerTextAreaId, setHeaderTextAreaId] = useState('');
|
|
182
182
|
const [isHeaderTagValidationError, updateIsHeaderTagValidationError] =
|
|
183
183
|
useState(false);
|
|
184
|
-
const [isPreviewUrl, setIsPreviewUrl] = useState(false);
|
|
185
|
-
const [previewUrl, setPreviewUrl] = useState('');
|
|
186
184
|
|
|
187
185
|
const validVarRegex = /{{([1-9]|1[0-9])}}/g;
|
|
188
186
|
const headerValidVarRegex = /{{(1)}}/g;
|
|
189
|
-
const urlMatchingRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])/g;
|
|
190
187
|
|
|
191
188
|
const isBtnTypeCta = buttonType === WHATSAPP_BUTTON_TYPES.CTA;
|
|
192
189
|
const isBtnTypeQuickReply = buttonType === WHATSAPP_BUTTON_TYPES.QUICK_REPLY;
|
|
@@ -271,7 +268,6 @@ export const Whatsapp = (props) => {
|
|
|
271
268
|
videoPreviewImg = '',
|
|
272
269
|
whatsappDocParams = {},
|
|
273
270
|
whatsappMedia: { header = '', footer = '' } = {},
|
|
274
|
-
isPreviewUrl: showUrlPreview = false,
|
|
275
271
|
} = editContent;
|
|
276
272
|
setTemplateCategory(category);
|
|
277
273
|
setTemplateStatus(status);
|
|
@@ -295,7 +291,6 @@ export const Whatsapp = (props) => {
|
|
|
295
291
|
setButtonType(btnType);
|
|
296
292
|
setTemplateFooter(footer);
|
|
297
293
|
setTemplateHeader(header);
|
|
298
|
-
setIsPreviewUrl(showUrlPreview);
|
|
299
294
|
if (btnType === WHATSAPP_BUTTON_TYPES.CTA && buttons.length > 0) {
|
|
300
295
|
setCtadata(
|
|
301
296
|
buttons.map((cta) => {
|
|
@@ -430,12 +425,6 @@ export const Whatsapp = (props) => {
|
|
|
430
425
|
arr[key.slice(key.indexOf('_') + 1)] = varMap[key];
|
|
431
426
|
}
|
|
432
427
|
}
|
|
433
|
-
if (arr?.length) {
|
|
434
|
-
const validUrls = arr.join("").match(urlMatchingRegex) || [];
|
|
435
|
-
if (validUrls && validUrls?.length) {
|
|
436
|
-
setPreviewUrl(validUrls?.[0] || '')
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
428
|
setUpdatedSmsEditor(arr);
|
|
440
429
|
}
|
|
441
430
|
}, [tempMsgArray]);
|
|
@@ -478,7 +467,7 @@ export const Whatsapp = (props) => {
|
|
|
478
467
|
|
|
479
468
|
const tagValidation = (contentData, regex, type) => {
|
|
480
469
|
if (contentData?.length > 0 && !contentData.join("").match(regex)) {
|
|
481
|
-
|
|
470
|
+
tagValidationResponse =
|
|
482
471
|
validateTags({
|
|
483
472
|
content: contentData.join(""),
|
|
484
473
|
tagsParam: tags,
|
|
@@ -486,45 +475,16 @@ export const Whatsapp = (props) => {
|
|
|
486
475
|
location,
|
|
487
476
|
tagModule: getDefaultTags,
|
|
488
477
|
}) || {};
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
updateIsTagValidationError(
|
|
497
|
-
validationResponse?.unsupportedTags?.length > 0
|
|
498
|
-
);
|
|
499
|
-
}
|
|
478
|
+
type === HEADER_TEXT
|
|
479
|
+
? updateIsHeaderTagValidationError(
|
|
480
|
+
tagValidationResponse?.unsupportedTags?.length > 0
|
|
481
|
+
)
|
|
482
|
+
: updateIsTagValidationError(
|
|
483
|
+
tagValidationResponse?.unsupportedTags?.length > 0
|
|
484
|
+
);
|
|
500
485
|
}
|
|
501
486
|
};
|
|
502
487
|
|
|
503
|
-
useEffect(() => {
|
|
504
|
-
if (updatedSmsEditor?.length > 0) {
|
|
505
|
-
const previewUrlArr = updatedSmsEditor.join("").match(urlMatchingRegex) || [];
|
|
506
|
-
if (previewUrlArr && previewUrlArr?.length) {
|
|
507
|
-
setPreviewUrl(previewUrlArr[0]);
|
|
508
|
-
} else {
|
|
509
|
-
setPreviewUrl('');
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}, [updatedSmsEditor])
|
|
513
|
-
|
|
514
|
-
useEffect(() => {
|
|
515
|
-
if (!isEmpty(previewUrl) && isPreviewUrl) {
|
|
516
|
-
const watingTimeFn = setTimeout(() => {
|
|
517
|
-
actions.getMetaTags({
|
|
518
|
-
previewUrl,
|
|
519
|
-
callBack: actionCallback,
|
|
520
|
-
})
|
|
521
|
-
}, 1000);
|
|
522
|
-
return () => clearTimeout(watingTimeFn);
|
|
523
|
-
} else {
|
|
524
|
-
actions.resetMetaTags();
|
|
525
|
-
}
|
|
526
|
-
}, [previewUrl, isPreviewUrl])
|
|
527
|
-
|
|
528
488
|
//performs tag validation
|
|
529
489
|
useEffect(() => {
|
|
530
490
|
if (!isFullMode)
|
|
@@ -827,10 +787,6 @@ export const Whatsapp = (props) => {
|
|
|
827
787
|
setTemplateMessageError(error);
|
|
828
788
|
};
|
|
829
789
|
|
|
830
|
-
const previewUrlHandler = ({ target: { checked } }) => {
|
|
831
|
-
setIsPreviewUrl(checked);
|
|
832
|
-
}
|
|
833
|
-
|
|
834
790
|
const renderUnsubscribeText = () => {
|
|
835
791
|
const isDisabled =
|
|
836
792
|
isEditFlow ||
|
|
@@ -1290,9 +1246,6 @@ export const Whatsapp = (props) => {
|
|
|
1290
1246
|
footer: templateFooter || ""
|
|
1291
1247
|
}),
|
|
1292
1248
|
},
|
|
1293
|
-
...(isEditFlow && !isFullMode && {
|
|
1294
|
-
isPreviewUrl
|
|
1295
|
-
})
|
|
1296
1249
|
},
|
|
1297
1250
|
},
|
|
1298
1251
|
},
|
|
@@ -1859,7 +1812,7 @@ export const Whatsapp = (props) => {
|
|
|
1859
1812
|
{isHeaderTagValidationError && tagValidationErrorMessage(HEADER_TEXT)}
|
|
1860
1813
|
{computeTextLength(HEADER_TEXT) > TEMPLATE_HEADER_MAX_LENGTH && (
|
|
1861
1814
|
<CapError>
|
|
1862
|
-
{formatMessage(messages.
|
|
1815
|
+
{formatMessage(messages.templateMessageLengthError)}
|
|
1863
1816
|
</CapError>
|
|
1864
1817
|
)}
|
|
1865
1818
|
</>
|
|
@@ -1906,19 +1859,6 @@ export const Whatsapp = (props) => {
|
|
|
1906
1859
|
) : (
|
|
1907
1860
|
""
|
|
1908
1861
|
)}
|
|
1909
|
-
<CapRow>
|
|
1910
|
-
<CapCheckbox
|
|
1911
|
-
className={`whatsapp-unsubscribe-checkbox ${'whatsapp-create-unsubscribe-checkbox'}`}
|
|
1912
|
-
onChange={previewUrlHandler}
|
|
1913
|
-
checked={isPreviewUrl}
|
|
1914
|
-
disabled={!isMediaTypeText}
|
|
1915
|
-
autoFocus={true}
|
|
1916
|
-
>
|
|
1917
|
-
<span className="whatsapp-render-url-preview-textt">
|
|
1918
|
-
{formatMessage(messages.showUrlPreview)}
|
|
1919
|
-
</span>
|
|
1920
|
-
</CapCheckbox>
|
|
1921
|
-
</CapRow>
|
|
1922
1862
|
{templateFooter && isHostIsNotTwilio && (
|
|
1923
1863
|
<>
|
|
1924
1864
|
<CapHeader
|
|
@@ -1982,7 +1922,6 @@ export const Whatsapp = (props) => {
|
|
|
1982
1922
|
|
|
1983
1923
|
//used by create and edit
|
|
1984
1924
|
const getPreviewSection = () => {
|
|
1985
|
-
const { metaTagsDetails = {} } = editData || {};
|
|
1986
1925
|
const templateMsg = (
|
|
1987
1926
|
<>
|
|
1988
1927
|
<CapLabel type="label5">
|
|
@@ -2034,10 +1973,6 @@ export const Whatsapp = (props) => {
|
|
|
2034
1973
|
...(isBtnTypeQuickReply && {
|
|
2035
1974
|
quickReplyData,
|
|
2036
1975
|
}),
|
|
2037
|
-
...(isMediaTypeText && isPreviewUrl && {
|
|
2038
|
-
isPreviewUrl,
|
|
2039
|
-
metaTagsDetails,
|
|
2040
|
-
}),
|
|
2041
1976
|
}}
|
|
2042
1977
|
whatsappContentLen={computeTextLength()}
|
|
2043
1978
|
whatsappAccountName={accountName}
|
|
@@ -659,9 +659,5 @@ export default defineMessages({
|
|
|
659
659
|
quickReplyButtons: {
|
|
660
660
|
id: `${prefix}.quickReplyButtons`,
|
|
661
661
|
defaultMessage: 'Quick reply buttons',
|
|
662
|
-
}
|
|
663
|
-
showUrlPreview: {
|
|
664
|
-
id: `${prefix}.showUrlPreview`,
|
|
665
|
-
defaultMessage: 'Show URL preview',
|
|
666
|
-
},
|
|
662
|
+
}
|
|
667
663
|
});
|
|
@@ -12,18 +12,11 @@ import {
|
|
|
12
12
|
UPLOAD_WHATSAPP_ASSET_SUCCESS,
|
|
13
13
|
UPLOAD_WHATSAPP_ASSET_FAILURE,
|
|
14
14
|
CLEAR_WHATSAPP_ASSET,
|
|
15
|
-
URL_META_TAGS_REQUEST,
|
|
16
|
-
URL_META_TAGS_SUCCESS,
|
|
17
|
-
URL_META_TAGS_FAILURE,
|
|
18
|
-
URL_META_TAGS_RESET,
|
|
19
15
|
} from './constants';
|
|
20
16
|
|
|
21
17
|
const initialState = fromJS({
|
|
22
18
|
uploadedAssetData: {},
|
|
23
19
|
createTemplateInProgress: false,
|
|
24
|
-
getMetaTagsRequest: false,
|
|
25
|
-
metaTagsDetails: {},
|
|
26
|
-
getMetaTagsError: '',
|
|
27
20
|
});
|
|
28
21
|
|
|
29
22
|
function whatsappReducer(state = initialState, action) {
|
|
@@ -58,18 +51,6 @@ function whatsappReducer(state = initialState, action) {
|
|
|
58
51
|
.set('templateDetails', action.data);
|
|
59
52
|
case GET_TEMPLATE_DETAILS_FAILURE:
|
|
60
53
|
return state.set('getTemplateDetailsInProgress', false);
|
|
61
|
-
case URL_META_TAGS_REQUEST:
|
|
62
|
-
return state.set('getMetaTagsRequest', true)
|
|
63
|
-
.set('metaTagsDetails', {});
|
|
64
|
-
case URL_META_TAGS_SUCCESS:
|
|
65
|
-
return state.set('getMetaTagsRequest', false)
|
|
66
|
-
.set('metaTagsDetails', action?.data);
|
|
67
|
-
case URL_META_TAGS_FAILURE:
|
|
68
|
-
return state.set('getMetaTagsRequest', false)
|
|
69
|
-
.set('getMetaTagsError', action?.error)
|
|
70
|
-
.set('metaTagsDetails', {});
|
|
71
|
-
case URL_META_TAGS_RESET:
|
|
72
|
-
return state.set('metaTagsDetails', {});
|
|
73
54
|
case RESET_EDIT_TEMPLATE:
|
|
74
55
|
return state.set('templateDetails', {});
|
|
75
56
|
case UPLOAD_WHATSAPP_ASSET_REQUEST:
|
|
@@ -12,9 +12,6 @@ import {
|
|
|
12
12
|
UPLOAD_WHATSAPP_ASSET_REQUEST,
|
|
13
13
|
UPLOAD_WHATSAPP_ASSET_SUCCESS,
|
|
14
14
|
UPLOAD_WHATSAPP_ASSET_FAILURE,
|
|
15
|
-
URL_META_TAGS_REQUEST,
|
|
16
|
-
URL_META_TAGS_SUCCESS,
|
|
17
|
-
URL_META_TAGS_FAILURE,
|
|
18
15
|
} from './constants';
|
|
19
16
|
|
|
20
17
|
export function* uploadWhatsappAsset(params) {
|
|
@@ -93,46 +90,11 @@ export function* getTemplateDetails({ id }) {
|
|
|
93
90
|
}
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
//For getMetaTags
|
|
97
|
-
export function* getMetaTagsDetails({ previewUrl, callBack }) {
|
|
98
|
-
try {
|
|
99
|
-
const result = yield call(Api.getMetaTags, {
|
|
100
|
-
previewUrl,
|
|
101
|
-
});
|
|
102
|
-
if (result?.success) {
|
|
103
|
-
yield put({
|
|
104
|
-
type: URL_META_TAGS_SUCCESS,
|
|
105
|
-
data: result?.response,
|
|
106
|
-
});
|
|
107
|
-
} else {
|
|
108
|
-
if (callBack) {
|
|
109
|
-
callBack({errorMessage: result?.message});
|
|
110
|
-
}
|
|
111
|
-
yield put({
|
|
112
|
-
type: URL_META_TAGS_FAILURE,
|
|
113
|
-
error: result?.message,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
} catch (error) {
|
|
117
|
-
if (callBack) {
|
|
118
|
-
callBack({errorMessage: error});
|
|
119
|
-
}
|
|
120
|
-
yield put({ type: URL_META_TAGS_FAILURE, error });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
93
|
function* watchGetTemplateDetails() {
|
|
125
|
-
yield takeLatest(
|
|
94
|
+
const watcher = yield takeLatest(
|
|
126
95
|
GET_TEMPLATE_DETAILS_REQUEST,
|
|
127
96
|
getTemplateDetails,
|
|
128
97
|
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function* watchGetMetaTagsDetails() {
|
|
132
|
-
const watcher = yield takeLatest(
|
|
133
|
-
URL_META_TAGS_REQUEST,
|
|
134
|
-
getMetaTagsDetails,
|
|
135
|
-
);
|
|
136
98
|
yield take(LOCATION_CHANGE);
|
|
137
99
|
yield cancel(watcher);
|
|
138
100
|
}
|
|
@@ -141,5 +103,4 @@ export default [
|
|
|
141
103
|
watchCreateTemplate,
|
|
142
104
|
watchGetTemplateDetails,
|
|
143
105
|
watchUploadWhatsappAsset,
|
|
144
|
-
watchGetMetaTagsDetails,
|
|
145
106
|
];
|