@capillarytech/creatives-library 8.0.144 → 8.0.146
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/initialReducer.js +0 -2
- package/package.json +1 -1
- package/services/api.js +0 -5
- package/services/tests/api.test.js +0 -17
- package/v2Components/MobilePushPreviewV2/index.js +2 -10
- package/v2Components/NavigationBar/saga.js +1 -1
- package/v2Components/NavigationBar/tests/saga.test.js +2 -2
- package/v2Components/TemplatePreview/index.js +6 -32
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +1 -1
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -26
- package/v2Containers/CreativesContainer/index.js +14 -68
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -5
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/InApp/actions.js +0 -7
- package/v2Containers/InApp/constants.js +1 -8
- package/v2Containers/InApp/index.js +53 -76
- package/v2Containers/InApp/reducer.js +0 -17
- package/v2Containers/InApp/sagas.js +0 -27
- package/v2Containers/InApp/selectors.js +1 -23
- package/v2Containers/InApp/tests/index.test.js +9 -0
- package/v2Containers/InApp/tests/reducer.test.js +0 -33
- package/v2Containers/InApp/tests/sagas.test.js +1 -57
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/Text/index.js +6 -6
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -9
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -18
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/Templates/_templates.scss +0 -3
- package/v2Containers/Templates/index.js +4 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -35
- package/v2Components/TemplatePreview/assets/images/empty_android.svg +0 -8
- package/v2Components/TemplatePreview/assets/images/empty_ios.svg +0 -5
- package/v2Components/TestAndPreviewSlidebox/tests/PreviewSection.test.js +0 -99
- package/v2Containers/BeePopupEditor/constants.js +0 -10
- package/v2Containers/BeePopupEditor/index.js +0 -169
- package/v2Containers/BeePopupEditor/tests/index.test.js +0 -628
- package/v2Containers/InApp/tests/selector.test.js +0 -612
- package/v2Containers/InappAdvanced/index.js +0 -459
- package/v2Containers/InappAdvanced/index.scss +0 -11
- package/v2Containers/InappAdvanced/tests/index.test.js +0 -442
- package/v2Containers/InappWrapper/_inappWrapper.scss +0 -19
- package/v2Containers/InappWrapper/index.js +0 -195
- package/v2Containers/InappWrapper/messages.js +0 -38
- package/v2Containers/InappWrapper/tests/index.test.js +0 -247
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { injectIntl } from 'react-intl';
|
|
4
|
-
import { connect } from 'react-redux';
|
|
5
|
-
// import { bindActionCreators } from 'redux';
|
|
6
|
-
import { createStructuredSelector } from 'reselect';
|
|
7
|
-
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
8
|
-
import TagList from '../TagList';
|
|
9
|
-
import { ANDROID, BEE_LAYOUT_OPTIONS, MOBILE, UNSUBSCRIBE } from './constants';
|
|
10
|
-
import emptyAndroidSvg from '../../v2Components/TemplatePreview/assets/images/empty_android.svg';
|
|
11
|
-
import emptyIosSvg from '../../v2Components/TemplatePreview/assets/images/empty_ios.svg';
|
|
12
|
-
function BeePopupEditor(props) {
|
|
13
|
-
const {
|
|
14
|
-
uid,
|
|
15
|
-
id,
|
|
16
|
-
tokenData,
|
|
17
|
-
saveBeeInstance,
|
|
18
|
-
saveBeeData,
|
|
19
|
-
beeJson,
|
|
20
|
-
templateLayoutType,
|
|
21
|
-
moduleFilterEnabled,
|
|
22
|
-
label,
|
|
23
|
-
location,
|
|
24
|
-
injectedTags,
|
|
25
|
-
className,
|
|
26
|
-
userLocale,
|
|
27
|
-
selectedOfferDetails,
|
|
28
|
-
tags,
|
|
29
|
-
onContextChange,
|
|
30
|
-
device,
|
|
31
|
-
} = props;
|
|
32
|
-
|
|
33
|
-
let beePluginInstance = null;
|
|
34
|
-
let intervalTimer;
|
|
35
|
-
const savedCallback = useRef();
|
|
36
|
-
|
|
37
|
-
const [visibleTaglist, setVisibleTaglist] = useState(false);
|
|
38
|
-
const [selectedTag, setSelectedTag] = useState({});
|
|
39
|
-
const filteredTags = (tags || []).filter((obj) => obj.definition.value !== UNSUBSCRIBE);
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
const beeConfig = {
|
|
43
|
-
uid,
|
|
44
|
-
trackChanges: true,
|
|
45
|
-
container: 'bee-plugin-container',
|
|
46
|
-
workspace: {
|
|
47
|
-
popup: {
|
|
48
|
-
backgroundImageMobile: device === ANDROID ? emptyAndroidSvg : emptyIosSvg,
|
|
49
|
-
layout: BEE_LAYOUT_OPTIONS[templateLayoutType],
|
|
50
|
-
customStyles: {
|
|
51
|
-
container: {
|
|
52
|
-
width: "90%",
|
|
53
|
-
margin: "1.5rem",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
stage: MOBILE,
|
|
58
|
-
hideStageToggle: true,
|
|
59
|
-
},
|
|
60
|
-
contentDialog: {
|
|
61
|
-
mergeTags: {
|
|
62
|
-
label: 'Add Label',
|
|
63
|
-
handler: async (resolve, reject) => {
|
|
64
|
-
// this will open tag modal
|
|
65
|
-
await setVisibleTaglist(true);
|
|
66
|
-
// until tag modal will not open promise will not execute
|
|
67
|
-
// once tag modal is opened it will start 2 sec interval to wait use has selected any tag or cancel the tag selection
|
|
68
|
-
const promise = new Promise((resolveP) => {
|
|
69
|
-
intervalTimer = setInterval(() => {
|
|
70
|
-
// this will execute, if user cancel the tag selection
|
|
71
|
-
if ((savedCallback.current || {}).close === true) {
|
|
72
|
-
reject();
|
|
73
|
-
clearInterval(intervalTimer);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
// this block is checking use has selected any tag or not
|
|
77
|
-
if (Object.keys(savedCallback.current || {}).length > 0) {
|
|
78
|
-
resolveP(savedCallback.current);
|
|
79
|
-
setSelectedTag({});
|
|
80
|
-
clearInterval(intervalTimer);
|
|
81
|
-
}
|
|
82
|
-
}, 2000);
|
|
83
|
-
});
|
|
84
|
-
// once prmise will resolve , pass the resolve data to handler to show tags in bee edior
|
|
85
|
-
const result = await promise;
|
|
86
|
-
resolve(result);
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
onChange: (jsonFile, htmlFile) => {
|
|
91
|
-
saveBeeData(jsonFile, htmlFile, device);
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
window.BeePlugin.create(tokenData, beeConfig, (instance) => {
|
|
95
|
-
beePluginInstance = instance;
|
|
96
|
-
const parseJson = JSON.parse(beeJson);
|
|
97
|
-
beePluginInstance.start(parseJson);
|
|
98
|
-
saveBeeInstance(beePluginInstance);
|
|
99
|
-
});
|
|
100
|
-
return () => clearInterval(intervalTimer);
|
|
101
|
-
}, [templateLayoutType]);
|
|
102
|
-
|
|
103
|
-
useEffect(() => {
|
|
104
|
-
savedCallback.current = Object?.keys(selectedTag)?.length > 0 && selectedTag;
|
|
105
|
-
}, [selectedTag]);
|
|
106
|
-
|
|
107
|
-
const onTagSelect = (result) => {
|
|
108
|
-
const msg = {
|
|
109
|
-
name: result,
|
|
110
|
-
value: `{{${result}}}`,
|
|
111
|
-
};
|
|
112
|
-
setSelectedTag(msg);
|
|
113
|
-
setVisibleTaglist(false);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const onCancelTagList = () => {
|
|
117
|
-
setVisibleTaglist(false);
|
|
118
|
-
setSelectedTag({close: true});
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
return (
|
|
122
|
-
<>
|
|
123
|
-
<div id="bee-plugin-container" style={{ height: "46.5rem" }}></div>
|
|
124
|
-
<TagList
|
|
125
|
-
moduleFilterEnabled={moduleFilterEnabled}
|
|
126
|
-
label={label}
|
|
127
|
-
onTagSelect={onTagSelect}
|
|
128
|
-
location={location}
|
|
129
|
-
tags={filteredTags}
|
|
130
|
-
injectedTags={injectedTags}
|
|
131
|
-
className={className}
|
|
132
|
-
id={id}
|
|
133
|
-
userLocale={userLocale}
|
|
134
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
135
|
-
visibleTaglist={visibleTaglist}
|
|
136
|
-
hidePopover
|
|
137
|
-
modalProps={{
|
|
138
|
-
onCancel: onCancelTagList,
|
|
139
|
-
style: { left: 135, top: 250 },
|
|
140
|
-
className: "bee-editor-tag-list",
|
|
141
|
-
}}
|
|
142
|
-
onContextChange={onContextChange}
|
|
143
|
-
/>
|
|
144
|
-
</>
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
BeePopupEditor.propTypes = {
|
|
148
|
-
saveBeeData: PropTypes.func.isRequired,
|
|
149
|
-
saveBeeInstance: PropTypes.func.isRequired,
|
|
150
|
-
beeJson: PropTypes.object.isRequired,
|
|
151
|
-
tokenData: PropTypes.object.isRequired,
|
|
152
|
-
uid: PropTypes.string.isRequired,
|
|
153
|
-
templateLayoutType: PropTypes.string.isRequired,
|
|
154
|
-
id: PropTypes.string.isRequired,
|
|
155
|
-
moduleFilterEnabled: PropTypes.bool.isRequired,
|
|
156
|
-
label: PropTypes.string.isRequired,
|
|
157
|
-
location: PropTypes.object.isRequired,
|
|
158
|
-
injectedTags: PropTypes.array.isRequired,
|
|
159
|
-
className: PropTypes.string.isRequired,
|
|
160
|
-
userLocale: PropTypes.string.isRequired,
|
|
161
|
-
selectedOfferDetails: PropTypes.object.isRequired,
|
|
162
|
-
tags: PropTypes.array.isRequired,
|
|
163
|
-
onContextChange: PropTypes.func.isRequired,
|
|
164
|
-
device: PropTypes.string.isRequired,
|
|
165
|
-
};
|
|
166
|
-
const mapStateToProps = () => createStructuredSelector({});
|
|
167
|
-
|
|
168
|
-
function mapDispatchToProps() {}
|
|
169
|
-
export default UserIsAuthenticated(connect(mapStateToProps, mapDispatchToProps)(injectIntl(BeePopupEditor)));
|