@capillarytech/creatives-library 8.0.129-alpha.5 → 8.0.130
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
CHANGED
|
@@ -20,7 +20,7 @@ const config = {
|
|
|
20
20
|
accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
|
|
21
21
|
},
|
|
22
22
|
development: {
|
|
23
|
-
api_endpoint: '
|
|
23
|
+
api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
|
|
24
24
|
campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
|
|
25
25
|
campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
|
|
26
26
|
auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
|
|
@@ -47,5 +47,14 @@ export const CLEAR_TEMPLATE_STORE_DATA = "app/containers/Templates/CLEAR_TEMPLAT
|
|
|
47
47
|
|
|
48
48
|
export const TRUE = 'true';
|
|
49
49
|
export const FALSE = 'false';
|
|
50
|
+
|
|
51
|
+
// Channel constants
|
|
50
52
|
export const EMAIL = 'email';
|
|
51
|
-
export const
|
|
53
|
+
export const SMS = 'sms';
|
|
54
|
+
export const LINE = 'line';
|
|
55
|
+
export const EBILL = 'ebill';
|
|
56
|
+
export const WECHAT = 'wechat';
|
|
57
|
+
export const WHATSAPP = 'whatsapp';
|
|
58
|
+
export const MOBILEPUSH = 'mobilepush';
|
|
59
|
+
|
|
60
|
+
export const TYPE_EMBEDDED = 'embedded';
|
|
@@ -134,10 +134,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
134
134
|
case "line":
|
|
135
135
|
channel = "Line";
|
|
136
136
|
break;
|
|
137
|
-
case "whatsapp":
|
|
138
|
-
channel = "whatsapp";
|
|
139
|
-
this.props.actions.getWeCrmAccounts();
|
|
140
|
-
break;
|
|
141
137
|
default:
|
|
142
138
|
channel = '';
|
|
143
139
|
}
|
|
@@ -150,7 +146,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
150
146
|
if (this.props.location.query.type === 'embedded' && this.isEnabledInLibraryModule("setLocale")) {
|
|
151
147
|
this.setLocale();
|
|
152
148
|
}
|
|
153
|
-
if (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill' || ((this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === 'mobilepush'
|
|
149
|
+
if (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill' || ((this.state.channel.toLowerCase() === 'wechat' || this.state.channel.toLowerCase() === 'mobilepush') && !_.isEmpty(this.props.Templates.selectedWeChatAccount))) {
|
|
154
150
|
const queryParams = {
|
|
155
151
|
// name: this.state.searchText,
|
|
156
152
|
// sortBy: this.state.sortBy,
|
|
@@ -160,13 +156,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
160
156
|
queryParams.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
|
|
161
157
|
queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
162
158
|
}
|
|
163
|
-
if (this.state.channel.toLowerCase() === 'whatsapp' && !_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
164
|
-
const { configs = {}, sourceAccountIdentifier = '' } = this.props.Templates.selectedWeChatAccount;
|
|
165
|
-
queryParams.hostName = this.props.Templates.selectedWeChatAccount.hostName;
|
|
166
|
-
queryParams.wabaId = sourceAccountIdentifier;
|
|
167
|
-
queryParams.accessToken = configs.accessToken;
|
|
168
|
-
queryParams.phoneId = configs.promotionalMessagingSSID;
|
|
169
|
-
}
|
|
170
159
|
if (this.state.channel.toLowerCase() === "mobilepush" && !_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
171
160
|
queryParams.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
172
161
|
}
|
|
@@ -215,19 +204,12 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
215
204
|
}
|
|
216
205
|
//
|
|
217
206
|
this.setState({ channel }, () => {
|
|
218
|
-
if (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill' || (this.state.channel.toLowerCase() === 'wechat' && !_.isEmpty(nextProps.Templates.selectedWeChatAccount))
|
|
207
|
+
if (this.state.channel.toLowerCase() === 'line' || this.state.channel.toLowerCase() === 'sms' || this.state.channel.toLowerCase() === 'email' || this.state.channel.toLowerCase() === 'ebill' || (this.state.channel.toLowerCase() === 'wechat' && !_.isEmpty(nextProps.Templates.selectedWeChatAccount))) {
|
|
219
208
|
if (this.state.channel.toLowerCase() === 'wechat' && !_.isEmpty(nextProps.Templates.selectedWeChatAccount)) {
|
|
220
209
|
params.wecrmId = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_app_id;
|
|
221
210
|
params.wecrmToken = (nextProps.Templates.selectedWeChatAccount.configs || {}).wecrm_token;
|
|
222
211
|
params.originalId = nextProps.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
223
212
|
}
|
|
224
|
-
if (this.state.channel.toLowerCase() === 'whatsapp' && !_.isEmpty(nextProps.Templates.selectedWeChatAccount)) {
|
|
225
|
-
const { configs = {}, sourceAccountIdentifier = '' } = nextProps.Templates.selectedWeChatAccount;
|
|
226
|
-
params.hostName = nextProps.Templates.selectedWeChatAccount.hostName;
|
|
227
|
-
params.wabaId = sourceAccountIdentifier;
|
|
228
|
-
params.accessToken = configs.accessToken;
|
|
229
|
-
params.phoneId = configs.promotionalMessagingSSID;
|
|
230
|
-
}
|
|
231
213
|
if (this.state.channel.toLowerCase() === "mobilepush" && !_.isEmpty(nextProps.Templates.selectedWeChatAccount)) {
|
|
232
214
|
params.accountId = nextProps.Templates.selectedWeChatAccount.id;
|
|
233
215
|
}
|
|
@@ -464,13 +446,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
464
446
|
queryParams.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
|
|
465
447
|
queryParams.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
466
448
|
}
|
|
467
|
-
if (this.state.channel.toLowerCase() === 'whatsapp' && !_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
468
|
-
const { configs = {}, sourceAccountIdentifier = '' } = this.props.Templates.selectedWeChatAccount;
|
|
469
|
-
queryParams.hostName = this.props.Templates.selectedWeChatAccount.hostName;
|
|
470
|
-
queryParams.wabaId = sourceAccountIdentifier;
|
|
471
|
-
queryParams.accessToken = configs.accessToken;
|
|
472
|
-
queryParams.phoneId = configs.promotionalMessagingSSID;
|
|
473
|
-
}
|
|
474
449
|
if (this.state.channel.toLowerCase() === "mobilepush" && !_.isEmpty(this.props.Templates.selectedWeChatAccount)) {
|
|
475
450
|
queryParams.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
476
451
|
if (this.state.mode) {
|
|
@@ -580,13 +555,13 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
580
555
|
const module = this.props.location.query.module ? this.props.location.query.module : 'default';
|
|
581
556
|
const isLanguageSupport = this.props.location.query.isLanguageSupport ? this.props.location.query.isLanguageSupport : true;
|
|
582
557
|
const isEdmSupport = (this.props.location.query.isEdmSupport !== "false") || false;
|
|
583
|
-
|
|
558
|
+
|
|
584
559
|
if (supportedZipFormats.indexOf(fileExtension.toLowerCase()) !== -1) {
|
|
585
|
-
|
|
560
|
+
|
|
586
561
|
this.props.actions.handleZipUpload(files[0]);
|
|
587
562
|
document.getElementById("filename").value = "";
|
|
588
563
|
} else if (fileExtension === 'html' || fileExtension === 'htm') {
|
|
589
|
-
|
|
564
|
+
|
|
590
565
|
const reader = new FileReader();
|
|
591
566
|
reader.onload = () => {
|
|
592
567
|
const text = reader.result;
|
|
@@ -837,13 +812,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
837
812
|
params.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
|
|
838
813
|
params.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
839
814
|
}
|
|
840
|
-
if (this.state.channel.toLowerCase() === 'whatsapp') {
|
|
841
|
-
const { configs = {}, sourceAccountIdentifier = '' } = this.props.Templates.selectedWeChatAccount;
|
|
842
|
-
params.hostName = this.props.Templates.selectedWeChatAccount.hostName;
|
|
843
|
-
params.wabaId = sourceAccountIdentifier;
|
|
844
|
-
params.accessToken = configs.accessToken;
|
|
845
|
-
params.phoneId = configs.promotionalMessagingSSID;
|
|
846
|
-
}
|
|
847
815
|
if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
848
816
|
params.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
849
817
|
}
|
|
@@ -862,13 +830,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
862
830
|
params.wecrmToken = this.props.Templates.selectedWeChatAccount.configs.wecrm_token;
|
|
863
831
|
params.originalId = this.props.Templates.selectedWeChatAccount.sourceAccountIdentifier;
|
|
864
832
|
}
|
|
865
|
-
if (this.state.channel.toLowerCase() === 'whatsapp') {
|
|
866
|
-
const { configs = {}, sourceAccountIdentifier = '' } = this.props.Templates.selectedWeChatAccount;
|
|
867
|
-
params.hostName = this.props.Templates.selectedWeChatAccount.hostName;
|
|
868
|
-
params.wabaId = sourceAccountIdentifier;
|
|
869
|
-
params.accessToken = configs.accessToken;
|
|
870
|
-
params.phoneId = configs.promotionalMessagingSSID;
|
|
871
|
-
}
|
|
872
833
|
if (this.state.channel.toLowerCase() === "mobilepush") {
|
|
873
834
|
params.accountId = this.props.Templates.selectedWeChatAccount.id;
|
|
874
835
|
}
|
package/package.json
CHANGED
|
@@ -61,36 +61,6 @@ function CapVideoUpload(props) {
|
|
|
61
61
|
|
|
62
62
|
const [isTemplateDrawerRequired, updateTemplateDrawerRequirement] = useState(false);
|
|
63
63
|
|
|
64
|
-
const {
|
|
65
|
-
formatMessage,
|
|
66
|
-
} = intl || {};
|
|
67
|
-
|
|
68
|
-
const submitVideoAction = useCallback((data, incorrectFile) => {
|
|
69
|
-
const {
|
|
70
|
-
file: {
|
|
71
|
-
size,
|
|
72
|
-
},
|
|
73
|
-
file,
|
|
74
|
-
fileParams,
|
|
75
|
-
type,
|
|
76
|
-
} = data;
|
|
77
|
-
if (incorrectFile || size > videoSize) {
|
|
78
|
-
if (errorMessage) {
|
|
79
|
-
updateVideoErrorMessage(errorMessage);
|
|
80
|
-
} else {
|
|
81
|
-
updateVideoErrorMessage(formatMessage(messages.videoIncorrectSize));
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
updateVideoErrorMessage('');
|
|
85
|
-
uploadAsset(
|
|
86
|
-
file,
|
|
87
|
-
type,
|
|
88
|
-
fileParams,
|
|
89
|
-
index,
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}, [isVideoError]);
|
|
93
|
-
|
|
94
64
|
const uploadVideo = useCallback((e, { files }) => {
|
|
95
65
|
if (e) {
|
|
96
66
|
e.preventDefault();
|
|
@@ -157,28 +127,40 @@ function CapVideoUpload(props) {
|
|
|
157
127
|
}
|
|
158
128
|
}, [uploadedAssetList]);
|
|
159
129
|
|
|
130
|
+
const submitVideoAction = useCallback((data, incorrectFile) => {
|
|
131
|
+
const {
|
|
132
|
+
file: {
|
|
133
|
+
size,
|
|
134
|
+
},
|
|
135
|
+
file,
|
|
136
|
+
fileParams,
|
|
137
|
+
type,
|
|
138
|
+
} = data;
|
|
139
|
+
if (incorrectFile || size > videoSize) {
|
|
140
|
+
if (errorMessage) {
|
|
141
|
+
updateVideoErrorMessage(errorMessage);
|
|
142
|
+
} else {
|
|
143
|
+
updateVideoErrorMessage(formatMessage(messages.videoIncorrectSize));
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
updateVideoErrorMessage('');
|
|
147
|
+
uploadAsset(
|
|
148
|
+
file,
|
|
149
|
+
type,
|
|
150
|
+
fileParams,
|
|
151
|
+
index,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}, [isVideoError]);
|
|
155
|
+
|
|
156
|
+
const {
|
|
157
|
+
formatMessage,
|
|
158
|
+
} = intl || {};
|
|
159
|
+
|
|
160
160
|
const capUploaderCustomVideoRequest = useCallback((uploadData) => {
|
|
161
161
|
uploadVideo(undefined, { files: [uploadData.file] });
|
|
162
162
|
}, []);
|
|
163
163
|
|
|
164
|
-
const onReUpload = useCallback(() => {
|
|
165
|
-
updateVideoStatus(false);
|
|
166
|
-
updateVideoDuration(null);
|
|
167
|
-
onVideoUploadUpdateAssestList(
|
|
168
|
-
index,
|
|
169
|
-
{
|
|
170
|
-
previewUrl: "",
|
|
171
|
-
videoName: "",
|
|
172
|
-
videoHeight: "",
|
|
173
|
-
videoWidth: "",
|
|
174
|
-
videoSrc: "",
|
|
175
|
-
videoDuration: null,
|
|
176
|
-
videoId: "",
|
|
177
|
-
fileHandle: "",
|
|
178
|
-
}
|
|
179
|
-
);
|
|
180
|
-
}, []);
|
|
181
|
-
|
|
182
164
|
const playVideo = useCallback((e) => {
|
|
183
165
|
if (e.target.paused && !isPlaying) {
|
|
184
166
|
e.target.play();
|
|
@@ -218,6 +200,23 @@ function CapVideoUpload(props) {
|
|
|
218
200
|
)
|
|
219
201
|
);
|
|
220
202
|
}
|
|
203
|
+
const onReUpload = () => {
|
|
204
|
+
updateVideoStatus(false);
|
|
205
|
+
updateVideoDuration(null);
|
|
206
|
+
onVideoUploadUpdateAssestList(
|
|
207
|
+
index,
|
|
208
|
+
{
|
|
209
|
+
previewUrl: "",
|
|
210
|
+
videoName: "",
|
|
211
|
+
videoHeight: "",
|
|
212
|
+
videoWidth: "",
|
|
213
|
+
videoSrc: "",
|
|
214
|
+
videoDuration: null,
|
|
215
|
+
videoId: "",
|
|
216
|
+
fileHandle: "",
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
};
|
|
221
220
|
|
|
222
221
|
const updateMetadataLoaded = () => {
|
|
223
222
|
const { current: { duration, videoHeight: metaVideoHeight, videoWidth: metaVideoWidth } = {} } = videoEl;
|
|
@@ -1057,7 +1057,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1057
1057
|
);
|
|
1058
1058
|
|
|
1059
1059
|
const uploadWhatsappAsset = (file, type, fileParams) => {
|
|
1060
|
-
const phoneId = accountData
|
|
1060
|
+
const phoneId = get(accountData, 'selectedWhatsappAccount.configs.promotionalMessagingSSID');
|
|
1061
1061
|
const whatsappParams = {
|
|
1062
1062
|
source: WHATSAPP.toLowerCase(),
|
|
1063
1063
|
wabaId: accountId,
|
|
@@ -1255,7 +1255,7 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1255
1255
|
errorMessage = formatMessage(
|
|
1256
1256
|
globalMessages.emptyTemplateNameErrorMessage,
|
|
1257
1257
|
);
|
|
1258
|
-
} else if (value.length < 3 &&
|
|
1258
|
+
} else if (value.length < 3 && [HOST_GUPSHUP, HOST_HAPTIC].includes(host)) {
|
|
1259
1259
|
errorMessage = formatMessage(messages.templateNameMinCharacters);
|
|
1260
1260
|
} else if (!templateNameRegex.test(value)) {
|
|
1261
1261
|
errorMessage = formatMessage(messages.templateNameRegexErrorMessage);
|
|
@@ -1566,9 +1566,9 @@ const isAuthenticationTemplate = isEqual(templateCategory, WHATSAPP_CATEGORIES.a
|
|
|
1566
1566
|
}
|
|
1567
1567
|
|
|
1568
1568
|
// Add the correct file handle based on host
|
|
1569
|
-
if (isHaptic) {
|
|
1570
|
-
|
|
1571
|
-
} else if (karixFileHandle) {
|
|
1569
|
+
if (isHaptic && hapticFileHandle) {
|
|
1570
|
+
mediaParams.hapticFileHandle = hapticFileHandle;
|
|
1571
|
+
} else if (!isHaptic && karixFileHandle) {
|
|
1572
1572
|
mediaParams.karixFileHandle = karixFileHandle;
|
|
1573
1573
|
}
|
|
1574
1574
|
return {
|