@capillarytech/creatives-library 7.17.51 → 7.17.53
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
CHANGED
|
@@ -122,7 +122,7 @@ export class Creatives extends React.Component {
|
|
|
122
122
|
name = "",
|
|
123
123
|
sourceAccountIdentifier = "",
|
|
124
124
|
configs: { token = "" } = {},
|
|
125
|
-
} = get(this.props, "Templates.
|
|
125
|
+
} = get(this.props, "Templates.selectedZaloAccount", {});
|
|
126
126
|
this.props.zaloActions.getTemplateInfoById({
|
|
127
127
|
username: name,
|
|
128
128
|
oa_id: sourceAccountIdentifier,
|
|
@@ -641,10 +641,11 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
641
641
|
onAccountSelect(e) {
|
|
642
642
|
const value = e.target.value;
|
|
643
643
|
this.setState({selectedAccount: value}, () => {
|
|
644
|
-
const params = {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
644
|
+
const params = {};
|
|
645
|
+
if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
|
|
646
|
+
params.name = this.state.searchText;
|
|
647
|
+
params.sortBy = this.state.sortBy;
|
|
648
|
+
}
|
|
648
649
|
const selectedChannel = this.state.channel.toLowerCase();
|
|
649
650
|
if (selectedChannel === 'wechat') {
|
|
650
651
|
params.wecrmId = this.props.Templates.weCrmAccounts[findIndex(this.props.Templates.weCrmAccounts, { name: value})].configs.wecrm_app_id;
|
|
@@ -664,8 +665,19 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
664
665
|
} else {
|
|
665
666
|
this.setState({ selectedAccountError: false });
|
|
666
667
|
}
|
|
667
|
-
} else if ([LINE.toLowerCase(), RCS_LOWERCASE].includes(selectedChannel)) {
|
|
668
|
-
|
|
668
|
+
} else if ([LINE.toLowerCase(), RCS_LOWERCASE, ZALO_LOWERCASE].includes(selectedChannel)) {
|
|
669
|
+
const setAcc = this.props.Templates.weCrmAccounts.find((item) => item.name === this.state.selectedAccount);
|
|
670
|
+
this.props.actions.setChannelAccount(selectedChannel?.toUpperCase(), setAcc);
|
|
671
|
+
if(selectedChannel === ZALO_LOWERCASE){
|
|
672
|
+
const {
|
|
673
|
+
name = "",
|
|
674
|
+
sourceAccountIdentifier = "",
|
|
675
|
+
configs: { token = "" } = {},
|
|
676
|
+
} = setAcc;
|
|
677
|
+
params.username = name;
|
|
678
|
+
params.oa_id = sourceAccountIdentifier;
|
|
679
|
+
params.token = token;
|
|
680
|
+
}
|
|
669
681
|
}
|
|
670
682
|
|
|
671
683
|
this.setState({activeMode: TEMPLATES_MODE});
|
|
@@ -805,12 +817,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
805
817
|
}
|
|
806
818
|
if ((this.state.channel || '').toLowerCase() === SMS_LOWERCASE && isTraiDltFeature) {
|
|
807
819
|
queryParams.traiEnable = true;
|
|
808
|
-
}
|
|
809
|
-
if (this.state.channel.toLowerCase() === ZALO_LOWERCASE) {
|
|
810
|
-
queryParams.username = this.props.Templates?.weCrmAccounts[0]?.name;
|
|
811
|
-
queryParams.oa_id = this.props.Templates?.weCrmAccounts[0]?.sourceAccountIdentifier;
|
|
812
|
-
queryParams.token = this.props.Templates?.weCrmAccounts[0]?.configs?.token;
|
|
813
|
-
}
|
|
820
|
+
}
|
|
814
821
|
this.setState({ page, templatesCount }, () => {
|
|
815
822
|
queryParams.page = page;
|
|
816
823
|
queryParams.perPage = this.state.perPageLimit;
|
|
@@ -1947,16 +1954,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
1947
1954
|
}
|
|
1948
1955
|
} else {
|
|
1949
1956
|
const {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
sourceAccountIdentifier,
|
|
1955
|
-
configs: { token },
|
|
1956
|
-
},
|
|
1957
|
-
],
|
|
1958
|
-
},
|
|
1959
|
-
} = this.props;
|
|
1957
|
+
name = "",
|
|
1958
|
+
sourceAccountIdentifier = "",
|
|
1959
|
+
configs: { token = "" } = {},
|
|
1960
|
+
} = get(this.props, "Templates.selectedZaloAccount", {});
|
|
1960
1961
|
this.props.zaloActions.getTemplateInfoById({
|
|
1961
1962
|
username: name,
|
|
1962
1963
|
oa_id: sourceAccountIdentifier,
|
|
@@ -2383,9 +2384,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
|
|
|
2383
2384
|
const isMobilePushChannel = channel === MOBILE_PUSH;
|
|
2384
2385
|
const isFacebookChannel = channel === FACEBOOK;
|
|
2385
2386
|
|
|
2386
|
-
if ([WECHAT, MOBILE_PUSH, LINE].includes(channel) && !isEmpty(weCrmAccounts) && !isFacebookChannel) {
|
|
2387
|
+
if ([WECHAT, MOBILE_PUSH, LINE, ZALO].includes(channel) && !isEmpty(weCrmAccounts) && !isFacebookChannel) {
|
|
2387
2388
|
forEach(weCrmAccounts, (account) => {
|
|
2388
|
-
if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || [MOBILE_PUSH, LINE].includes(channel)) {
|
|
2389
|
+
if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || [MOBILE_PUSH, LINE, ZALO].includes(channel)) {
|
|
2389
2390
|
if (query.type === 'embedded' && (!query.module || (query.module && query.module !== 'library'))) {
|
|
2390
2391
|
if (query.source_account_id && account.sourceAccountIdentifier === query.source_account_id) {
|
|
2391
2392
|
accountOptions.push(
|
|
@@ -39,7 +39,22 @@ exports[`Test Templates container Should render correct component for zalo chann
|
|
|
39
39
|
className="select-account"
|
|
40
40
|
defaultValue=""
|
|
41
41
|
onChange={[Function]}
|
|
42
|
-
panes={
|
|
42
|
+
panes={
|
|
43
|
+
Array [
|
|
44
|
+
Object {
|
|
45
|
+
"icon": <CapIconAvatar
|
|
46
|
+
backgroundProps={Object {}}
|
|
47
|
+
height="2rem"
|
|
48
|
+
labelProps={Object {}}
|
|
49
|
+
text="c"
|
|
50
|
+
width="auto"
|
|
51
|
+
/>,
|
|
52
|
+
"key": "fa66f53ca2bb4b93b02dfc5bd265e2fd",
|
|
53
|
+
"title": "capillary_zns",
|
|
54
|
+
"value": "capillary_zns",
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
}
|
|
43
58
|
selected=""
|
|
44
59
|
size="small"
|
|
45
60
|
/>
|