@capillarytech/creatives-library 8.0.58-alpha.0 → 8.0.58

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
@@ -17,8 +17,7 @@ const config = {
17
17
  accountConfig: (strs, accountId) => `${window.location.origin}/org/config/AccountAdd?q=a&channelId=2&accountId=${accountId}&edit=1`,
18
18
  },
19
19
  development: {
20
- // api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
21
- api_endpoint: 'http://localhost:2022/arya/api/v1/creatives',
20
+ api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/creatives',
22
21
  campaigns_api_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/campaigns',
23
22
  campaigns_api_org_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/iris/v2/org/campaign',
24
23
  auth_endpoint: 'https://crm-nightly-new.cc.capillarytech.com/arya/api/v1/auth',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.58-alpha.0",
4
+ "version": "8.0.58",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -269,7 +269,7 @@ export const createChannelWiseTemplate = ({ channel, template }) => {
269
269
  export const getTemplateDetails = async ({id, channel}) => {
270
270
  const url = `${API_ENDPOINT}/templates/v1/${id}/${channel ? channel.toUpperCase() : SMS}`;
271
271
  const compressedTemplatesData = await request(url, getAPICallObject('GET'));
272
- const {response = ''} = compressedTemplatesData || {};
272
+ const {response = ''} = compressedTemplatesData;
273
273
  const decompressData = decompressJsonObject(response);
274
274
  if (channel?.toUpperCase() === EMAIL) {
275
275
  return { ...compressedTemplatesData, response: addBaseToTemplate(decompressData) };
@@ -283,7 +283,7 @@ export const getAllTemplates = async ({channel, queryParams = {}}) => {
283
283
  queryParams,
284
284
  });
285
285
  const compressedTemplatesData = await request(url, getAPICallObject('GET'));
286
- const {response = ''} = compressedTemplatesData || {};
286
+ const {response = ''} = compressedTemplatesData;
287
287
  return { ...compressedTemplatesData, response: decompressJsonObject(response)};
288
288
  };
289
289
 
@@ -132,6 +132,14 @@ describe('getAllTemplates -- Test with valid responses', () => {
132
132
  });
133
133
  });
134
134
 
135
+ it('Should work for empty response', async () => {
136
+ global.fetch.mockReturnValue(Promise.resolve({json: () => Promise.resolve(),}));
137
+ mockDecompressJsonObject.mockReturnValue();
138
+ expect(await getAllTemplates({channel: 'email'})).toEqual({
139
+ "response": undefined,
140
+ });
141
+ });
142
+
135
143
  it('Should not return correct response', async () => {
136
144
  global.fetch.mockReturnValue(Promise.resolve({
137
145
  status: 200,
@@ -197,7 +205,18 @@ describe('getTemplateDetails -- Test with valid responses', () => {
197
205
  status: 200,
198
206
  });
199
207
  });
200
-
208
+ it('Should work incase of empty response', async () => {
209
+ global.fetch.mockReturnValue(Promise.resolve({
210
+ status: 200,
211
+ json: () => Promise.resolve({
212
+ status: 200,
213
+ }),
214
+ }));
215
+ mockDecompressJsonObject.mockReturnValue();
216
+ expect(await getTemplateDetails({id: '123', channel: 'email'})).toEqual({
217
+ status: 200,
218
+ });
219
+ });
201
220
  it('Should return response when channel is not email', async () => {
202
221
  global.fetch.mockReturnValue(Promise.resolve({
203
222
  status: 200,
@@ -12,6 +12,7 @@ import {
12
12
  iframePreviewAdjustWidth,
13
13
  getDecodedFileName,
14
14
  createQueryString,
15
+ getMergedUserList
15
16
  } from "../common";
16
17
  import * as mockdata from "./common.mockdata";
17
18
 
@@ -317,3 +318,48 @@ describe('createQueryString', () => {
317
318
  expect(result).toBe('?name=John');
318
319
  });
319
320
  });
321
+ describe('getMergedUserList', () => {
322
+ it('should merge user list when isCapUser is true', () => {
323
+ const userList = {
324
+ capUsers: [{ id: 1, name: 'Cap User 1' }],
325
+ otherUsers: [{ id: 2, name: 'Other User 1' }],
326
+ };
327
+
328
+ const result = getMergedUserList(userList, true);
329
+
330
+ expect(result).toEqual([
331
+ { id: 1, name: 'Cap User 1' },
332
+ { id: 2, name: 'Other User 1' },
333
+ ]);
334
+ });
335
+
336
+ it('should merge user list excluding capUsers when isCapUser is false', () => {
337
+ const userList = {
338
+ capUsers: [{ id: 1, name: 'Cap User 1' }],
339
+ otherUsers: [{ id: 2, name: 'Other User 1' }],
340
+ };
341
+
342
+ const result = getMergedUserList(userList, false);
343
+
344
+ expect(result).toEqual([{ id: 2, name: 'Other User 1' }]);
345
+ });
346
+
347
+ it('should handle empty userList', () => {
348
+ const userList = {};
349
+
350
+ const result = getMergedUserList(userList, true);
351
+
352
+ expect(result).toEqual([]);
353
+ });
354
+
355
+ it('should handle userList with empty arrays', () => {
356
+ const userList = {
357
+ capUsers: [],
358
+ otherUsers: [],
359
+ };
360
+
361
+ const result = getMergedUserList(userList);
362
+
363
+ expect(result).toEqual([]);
364
+ });
365
+ });
@@ -53,9 +53,7 @@ import { v2InAppSagas } from '../InApp/sagas';
53
53
  import { v2ViberSagas } from '../Viber/sagas';
54
54
  import { v2FacebookSagas } from '../Facebook/sagas';
55
55
  import createReducer from '../Line/Container/reducer';
56
- import { v2ZaloSagas } from '../Zalo/saga';
57
56
  import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
58
-
59
57
  const gtm = window.dataLayer || [];
60
58
  const {
61
59
  logNewTab,
@@ -618,7 +616,6 @@ const withEbillSaga = injectSaga({ key: 'ebill', saga: v2EbillSagas });
618
616
  const withEmailSaga = injectSaga({ key: 'email', saga: v2EmailDuplicateTemplateSaga });
619
617
  const withLineContainerSaga = injectSaga({ key: 'lineCreate', saga: v2LineContainerSagas });
620
618
  const withMobilePushCreateSaga = injectSaga({ key: 'mobileCreate', saga: v2MobilePushCreateSagas });
621
- const withZaloSaga = injectSaga({ key: 'zalo', saga: v2ZaloSagas });
622
619
  const withWechatMapTemplatesSaga = injectSaga({ key: 'weChatMapTemplate', saga: v2WechatMapTemplatesSagas });
623
620
  const withRcsSaga = injectSaga({ key: 'rcs', saga: v2RcsSagas });
624
621
  const withInAppSaga = injectSaga({ key: 'inapp', saga: v2InAppSagas });
@@ -635,7 +632,6 @@ export default compose(
635
632
  withLineContainerSaga,
636
633
  withMobilePushCreateSaga,
637
634
  withWechatMapTemplatesSaga,
638
- withZaloSaga,
639
635
  withRcsSaga,
640
636
  withInAppSaga,
641
637
  withViberSaga,
@@ -17,7 +17,7 @@ describe("v2SmsEditSagas Combined", () => {
17
17
  });
18
18
 
19
19
  describe('editTemplate Saga', () => {
20
- const template = { id: 1, name: 'Updated Template' };
20
+ const template = { id: 1, name: 'Updated Template',message: 'esd' };
21
21
 
22
22
  it('handles successful template edit', () => {
23
23
  const fakeResponse = {
@@ -38,6 +38,47 @@ describe("v2SmsEditSagas Combined", () => {
38
38
  .run();
39
39
  });
40
40
 
41
+ it('handles successful template edit for empty response', () => {
42
+ const fakeResponse = {
43
+ status: { code: 200 }
44
+ };
45
+
46
+ return expectSaga(editTemplate, template)
47
+ .provide([
48
+ [call(api.editTemplate, template), fakeResponse]
49
+ ])
50
+ .put({
51
+ type: types.EDIT_TEMPLATE_SUCCESS,
52
+ data: fakeResponse.response,
53
+ statusCode: 200,
54
+ errorMsg: undefined
55
+ })
56
+ .run();
57
+ });
58
+
59
+ it('handles failure template edit for empty response', () => {
60
+ const fakeResponse = {
61
+ status: { code: 500 }
62
+ };
63
+
64
+ return expectSaga(editTemplate, template)
65
+ .provide([
66
+ [call(api.editTemplate, template), fakeResponse]
67
+ ])
68
+ .put({
69
+ type: types.EDIT_TEMPLATE_SUCCESS,
70
+ data: undefined,
71
+ statusCode: 500,
72
+ errorMsg: undefined
73
+ })
74
+ .put({
75
+ type: types.EDIT_TEMPLATE_FAILURE,
76
+ error: new TypeError('template.onUpdateTemplateComplete is not a function'),
77
+ errorMsg: undefined
78
+ })
79
+ .run();
80
+ });
81
+
41
82
  it('handles failure in editing a template', () => {
42
83
  const error = new Error('Edit failed');
43
84
 
@@ -57,8 +57,7 @@ export function setWeChatAccount(weChatAccount) {
57
57
  weChatAccount,
58
58
  };
59
59
  }
60
- export function setChannelAccount(channel, account, caller) {
61
- console.log('### setChannelAccount', {channel, account, caller});
60
+ export function setChannelAccount(channel, account) {
62
61
  const channelTypeMapping = {
63
62
  [LINE]: types.SET_LINE_ACCOUNT,
64
63
  [WHATSAPP]: types.SET_WHATSAPP_ACCOUNT,
@@ -366,25 +366,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
366
366
 
367
367
  window.addEventListener("message", this.handleFrameTasks);
368
368
  }
369
-
370
- getHostName(accountHostName, whatsappAccounts) {
371
- // const whatsappAccounts = domainProperties?.entity?.WHATSAPP || [];
372
-
373
- for (const account of whatsappAccounts) {
374
- const { domainName, connectionProperties, hostName } = account.domainProperties || {};
375
- // if (
376
- // configs === name ||
377
- // connectionProperties?.wabaId === sourceAccountIdentifier ||
378
- // connectionProperties?.userid === sourceAccountIdentifier
379
- // )
380
- if (accountHostName === hostName) {
381
- console.log("### getHostName domainProperties", {domainName, connectionProperties, hostName});
382
- return hostName;
383
- }
384
- }
385
- return whatsappAccounts[0]?.domainProperties?.hostName || null;
386
- };
387
-
388
369
  componentWillReceiveProps(nextProps = {}) {
389
370
  const params = {
390
371
  name: this.state.searchText,
@@ -401,7 +382,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
401
382
  if (nextPropsTotalTemplatesCount && nextPropsTotalTemplatesCount !== propsTotalTemplatesCount) {
402
383
  this.setState({ templatesCount: nextPropsTotalTemplatesCount });
403
384
  }
404
- console.log("### weCrmAccountsList componentWillReceiveProps 1", {selectedChannel: this.state.channel, wecrm: nextProps.Templates});
405
385
  if (!isEqual(nextProps.route.name, this.props.route.name)) {
406
386
  let channel = '';
407
387
  this.props.actions.resetTemplate();
@@ -634,22 +614,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
634
614
  }
635
615
  const { weCrmAccounts: weCrmAccountsList = [], senderDetails: { hostName = '' } = {} } = get(nextProps, 'Templates', {});
636
616
  const weCrmChannels = ['wechat', WHATSAPP_LOWERCASE, ZALO_LOWERCASE];
637
- let paramsDefault = {};
638
- if (weCrmAccountsList?.length > 1 && this.state.defaultAccount && (selectedChannel === WHATSAPP_LOWERCASE) && !isEmpty(hostName)) {
639
- // 2 matching fields are present between domainProperties and wecrm data
640
- // sourceAccountIdentifier in wecrm data is present in domainProperties inside the connectionProperties either as wabaId or userId
641
- // domainName of domainProperties data is present in wecrm as name
642
- const selectedAccount = this.props.Templates.selectedWhatsappAccount;
643
- // const whatsappHostName = this.getHostName(selectedAccount.name, selectedAccount.sourceAccountIdentifier, this.props.Templates.senderDetails.hostName);
644
- // selectedAccount.hostName = whatsappHostName;
645
- // this.props.actions.setChannelAccount(selectedChannel.toUpperCase(), selectedAccount, 'call2');
646
- // const account = selectedAccount;
647
- paramsDefault.accountId = selectedAccount?.sourceAccountIdentifier;
648
-
649
- console.log("### weCrmAccountsList componentWillReceiveProps length2", {selectedChannel, hostName, selectedAccount, wecrm: weCrmAccountsList, senderDetails: nextProps.Templates.senderDetails});
650
- }
617
+
651
618
  if (weCrmAccountsList.length === 1 && this.state.defaultAccount && (weCrmChannels.indexOf(selectedChannel) > -1) && !isEmpty(hostName)) {
652
- // let paramsDefault = {};
619
+ let paramsDefault = {};
653
620
  if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
654
621
  paramsDefault = {
655
622
  name: this.state.searchText,
@@ -670,8 +637,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
670
637
  }
671
638
 
672
639
  weCrmAccountsList[0].hostName = hostName;
673
- console.log("### weCrmAccountsList componentWillReceiveProps length1", {selectedChannel, hostName, wecrm: weCrmAccountsList});
674
- nextProps.actions.setChannelAccount(selectedChannel.toUpperCase(), weCrmAccountsList[0], 'call1');
640
+ nextProps.actions.setChannelAccount(selectedChannel.toUpperCase(), weCrmAccountsList[0]);
675
641
  if (selectedChannel === ZALO_LOWERCASE) {
676
642
  paramsDefault.username = name;
677
643
  paramsDefault.oa_id = sourceAccountIdentifier;
@@ -749,16 +715,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
749
715
  params.isAccountSelection = true;
750
716
  params.host = this.props.Templates?.senderDetails?.hostName || this.props.Templates?.selectedZaloAccount?.hostName || this.state.hostName;
751
717
  }
752
- } else if (selectedChannel === WHATSAPP_LOWERCASE) {
753
- const selectedAccount = this.props.Templates.weCrmAccounts[findIndex(this.props.Templates.weCrmAccounts, { name: value})];
754
- // const whatsappHostName = this.getHostName(selectedAccount.configs?.hostName, this.props.Templates.senderDetails.hostName);
755
- // selectedAccount.hostName = whatsappHostName;
756
- selectedAccount.hostName = selectedAccount.configs?.hostName;
757
- this.props.actions.setChannelAccount(selectedChannel.toUpperCase(), selectedAccount, 'call2');
758
- params.accountId = selectedAccount?.sourceAccountIdentifier;
759
-
760
- console.log("### onAccountSelect", {params, selectedChannel, value, templ: this.props.Templates});
761
718
  }
719
+
762
720
  this.setState({activeMode: TEMPLATES_MODE});
763
721
 
764
722
  this.getAllTemplates({params, resetPage: true});
@@ -842,7 +800,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
842
800
  getAllTemplates = ({params, getNextPage, resetPage}, resetTemplates) => {
843
801
  let queryParams = params || {};
844
802
  let page = this.state.page;
845
- // console.log('### getAllTemplates', {params, resetTemplates, resetPage, getNextPage});
846
803
  const { activeMode } = this.state;
847
804
  if (activeMode === ACCOUNT_SELECTION_MODE) {
848
805
  this.setTemplatesMode();
@@ -866,13 +823,8 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
866
823
  }
867
824
  const channel = this.state.channel;
868
825
  if (([MOBILE_PUSH_LOWERCASE, INAPP_LOWERCASE].includes(channel.toLowerCase())) && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
869
- console.log('### this.props.Templates.selectedWeChatAccount', channel);
870
826
  queryParams.accountId = this.props.Templates?.selectedWeChatAccount?.id;
871
827
  }
872
- if (channel?.toLowerCase() === WHATSAPP_LOWERCASE) {
873
- queryParams.accountId = this.props.Templates?.selectedWeChatAccount?.sourceAccountIdentifier;
874
- }
875
- console.log('### getAllTemplates whatsapp if', {queryParams, resetTemplates, copyOf, templates: this.props.Templates});
876
828
  this.props.actions.getAllTemplates(channel, queryParams,`${copyOf}`);
877
829
  } else if ((resetPage || (page === 1 && this.state.templatesCount === 0) || page <= (this.state.templatesCount / this.state.perPageLimit))) {
878
830
  if (getNextPage) {
@@ -898,7 +850,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
898
850
  }
899
851
  if (([MOBILE_PUSH_LOWERCASE, INAPP_LOWERCASE].includes(this.state.channel.toLowerCase())) && !isEmpty(this.props.Templates.selectedWeChatAccount)) {
900
852
  queryParams.accountId = this.props.Templates.selectedWeChatAccount.id;
901
- console.log('### queryParams.accountId', {channel, queryParams});
902
853
  if (this.state.mode) {
903
854
  queryParams.mode = this.state.mode.toLowerCase();
904
855
  }
@@ -923,10 +874,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
923
874
  queryParams.token = token;
924
875
  queryParams.host = hostName || this.props.Templates?.senderDetails?.hostName ||this.state.hostName;
925
876
  }
926
- if (this.state.channel.toLowerCase() === WHATSAPP_LOWERCASE) {
927
- console.log('### getAllTemplates whatsapp', {queryParams, temp: this.props.Templates});
928
- }
929
- console.log('### getAllTemplates whatsapp else', {queryParams, resetTemplates, copyOf});
930
877
  this.setState({ page, templatesCount }, () => {
931
878
  queryParams.page = page;
932
879
  queryParams.perPage = this.state.perPageLimit;
@@ -1443,7 +1390,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1443
1390
  const showInAppIllustration = channelLowerCase === INAPP_LOWERCASE && isEmpty(templates);
1444
1391
  const noLoaderAndSearchText = isEmpty(this.state.searchText) && !isLoading;
1445
1392
  return (<div>
1446
- {[WECHAT, MOBILE_PUSH, INAPP, WHATSAPP].includes(currentChannel) && this.showAccountName()}
1393
+ {[WECHAT, MOBILE_PUSH, INAPP].includes(currentChannel) && this.showAccountName()}
1447
1394
  {filterContent}
1448
1395
  {[WHATSAPP, ZALO].includes(currentChannel) && this.selectedFilters()}
1449
1396
  <CapCustomSkeleton loader={isLoading}>
@@ -2618,11 +2565,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2618
2565
  const isInAppChannel = channel === INAPP;
2619
2566
  const isFacebookChannel = channel === FACEBOOK;
2620
2567
 
2621
- if ([WECHAT, MOBILE_PUSH, INAPP, LINE, ZALO, WHATSAPP].includes(channel) && !isEmpty(weCrmAccounts) && !isFacebookChannel) {
2568
+ if ([WECHAT, MOBILE_PUSH, INAPP, LINE, ZALO].includes(channel) && !isEmpty(weCrmAccounts) && !isFacebookChannel) {
2622
2569
  forEach(weCrmAccounts, (account) => {
2623
- if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || [MOBILE_PUSH, INAPP, LINE, ZALO, WHATSAPP].includes(channel)) {
2570
+ if ((isWechatChannel && account.configs && account.configs.is_wecrm_enabled) || [MOBILE_PUSH, INAPP, LINE, ZALO].includes(channel)) {
2624
2571
  if (query.type === 'embedded' && (!query.module || (query.module && query.module !== 'library'))) {
2625
- console.log('### Test renderAccountSelection if', {weCrmAccounts, account, query, channel});
2626
2572
  if (query.source_account_id && account.sourceAccountIdentifier === query.source_account_id) {
2627
2573
  accountOptions.push(
2628
2574
  { key: isMobilePushChannel || isInAppChannel ? account.id : account.uuid,
@@ -2642,7 +2588,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2642
2588
  );
2643
2589
  }
2644
2590
  } else {
2645
- console.log('### Test renderAccountSelection else', {weCrmAccounts, account, query, channel});
2646
2591
  accountOptions.push(
2647
2592
  {
2648
2593
  key: isMobilePushChannel || isInAppChannel ? account.id : account.uuid,
@@ -2705,10 +2650,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2705
2650
  break;
2706
2651
  }
2707
2652
  let showNoAccountHeader = isEmpty(weCrmAccounts) && !fetchingWeCrmAccounts;
2708
- // Test start
2709
- // if (channel === WHATSAPP && this.state.hostName === '') {
2710
- // showNoAccountHeader = true;
2711
- // }
2653
+ if (channel === WHATSAPP && this.state.hostName === '') {
2654
+ showNoAccountHeader = true;
2655
+ }
2712
2656
  if (channel === FACEBOOK && !isEmpty(campaignSettings) ) {
2713
2657
  const fbSetting = get(campaignSettings, 'accountSettings.socialAccountSettings.facebookAccountSettings', []);
2714
2658
  const { orgUnitFacebookPageSettingsMap } = fbSetting[0] || {};
@@ -62,124 +62,7 @@ export function* fetchUserList() {
62
62
 
63
63
  export function* fetchWeCrmAccounts(action) {
64
64
  try {
65
- // const result = yield call(Api.fetchWeCrmAccounts, action.source);
66
- const result = {
67
- "success": true,
68
- "status": {
69
- "isError": false,
70
- "code": 200,
71
- "message": "success"
72
- },
73
- "message": "WeCRM Account details fetched",
74
- "response": [
75
- {
76
- "id": 13694,
77
- "uuid": "c41edad79aab48dcb1030722509ab322",
78
- "name": "CapillaryWABA",
79
- "sourceAccountIdentifier": "107499611940863",
80
- "toMirror": true,
81
- "sourceTypeId": 19,
82
- "sourceTypeName": "WHATSAPP",
83
- "isActive": true,
84
- "commChannels": [
85
- "whatsapp"
86
- ],
87
- "configs": {
88
- "accessToken": "Bearer gDwEuRIm9icV6phixociSw==",
89
- "promotionalMessagingSSID": "919611759663",
90
- "transactionalMessagingSSID": "919611759663",
91
- hostName: "karixwhatsappbulk"
92
- },
93
- "attribution": {
94
- "createDate": "2025-01-10T00:00:00+05:30",
95
- "createdBy": {
96
- "id": 50716406,
97
- "code": "1724755070_",
98
- "description": "",
99
- "name": "1724755070_Aneel",
100
- "type": "ADMIN_USER",
101
- "referenceId": -1,
102
- "adminType": "GENERAL",
103
- "isActive": true,
104
- "isOuEnabled": false,
105
- "timeZoneId": 0,
106
- "currencyId": 0,
107
- "languageId": 0,
108
- "default": false
109
- },
110
- "modifiedBy": {
111
- "id": 50716406,
112
- "code": "1724755070_",
113
- "description": "",
114
- "name": "1724755070_Aneel",
115
- "type": "ADMIN_USER",
116
- "referenceId": -1,
117
- "adminType": "GENERAL",
118
- "isActive": true,
119
- "isOuEnabled": false,
120
- "timeZoneId": 0,
121
- "currencyId": 0,
122
- "languageId": 0,
123
- "default": false
124
- },
125
- "modifiedDate": "2025-01-10T00:00:00+05:30"
126
- }
127
- },
128
- {
129
- "id": 13695,
130
- "uuid": "e0cd92248fc54b7eb04c470e7434f8c3",
131
- "name": "gupshup_otp_nightly",
132
- "sourceAccountIdentifier": "2000239981",
133
- "toMirror": true,
134
- "sourceTypeId": 19,
135
- "sourceTypeName": "WHATSAPP",
136
- "isActive": true,
137
- "commChannels": [
138
- "whatsapp"
139
- ],
140
- "configs": {
141
- "accessToken": "qrtCAJCz",
142
- "promotionalMessagingSSID": "919289221771",
143
- "transactionalMessagingSSID": "919289221771",
144
- hostName: "gupshupwhatsappbulk"
145
- },
146
- "attribution": {
147
- "createDate": "2025-01-13T00:00:00+05:30",
148
- "createdBy": {
149
- "id": 50716406,
150
- "code": "1724755070_",
151
- "description": "",
152
- "name": "1724755070_Aneel",
153
- "type": "ADMIN_USER",
154
- "referenceId": -1,
155
- "adminType": "GENERAL",
156
- "isActive": true,
157
- "isOuEnabled": false,
158
- "timeZoneId": 0,
159
- "currencyId": 0,
160
- "languageId": 0,
161
- "default": false
162
- },
163
- "modifiedBy": {
164
- "id": 50716406,
165
- "code": "1724755070_",
166
- "description": "",
167
- "name": "1724755070_Aneel",
168
- "type": "ADMIN_USER",
169
- "referenceId": -1,
170
- "adminType": "GENERAL",
171
- "isActive": true,
172
- "isOuEnabled": false,
173
- "timeZoneId": 0,
174
- "currencyId": 0,
175
- "languageId": 0,
176
- "default": false
177
- },
178
- "modifiedDate": "2025-01-13T00:00:00+05:30"
179
- }
180
- }
181
- ]
182
- }
65
+ const result = yield call(Api.fetchWeCrmAccounts, action.source);
183
66
  yield put({
184
67
  type: types.GET_WECRM_ACCOUNTS_SUCCESS,
185
68
  data: result.response,
@@ -272,15 +155,13 @@ export function* getTemplateDetails(id, channel) {
272
155
  export function* getSenderDetails({
273
156
  channel,
274
157
  orgUnitId,
275
- identifiers: { name, sourceAccountIdentifier } = {},
276
158
  } = {}) {
277
159
  try {
278
- const apiResponse = yield call(Api.getSenderDetails, channel, orgUnitId);
279
- console.log("### domainProperties apiResponse", {channel, apiResponse, orgUnitId, name, sourceAccountIdentifier});
160
+ const apiResponse = yield call(Api.getSenderDetails, channel, orgUnitId);
280
161
  if (!apiResponse?.errors?.length) {
281
162
  yield put({
282
163
  type: types.GET_SENDER_DETAILS_SUCCESS,
283
- payload: channel === 'WHATSAPP' ? get(apiResponse, `entity.${channel}`, '') : get(apiResponse, `entity.${channel}[0].domainProperties.hostName`, ''),
164
+ payload: get(apiResponse, `entity.${channel}[0].domainProperties.hostName`, ''),
284
165
  });
285
166
  } else {
286
167
  yield put({
@@ -232,8 +232,7 @@ export const Whatsapp = (props) => {
232
232
  //edit
233
233
  //gets account details
234
234
  useEffect(() => {
235
- const accountObj = accountData.selectedWhatsappAccount || accountData.selectedWeChatAccount || {};
236
- console.log("### useEff ", { accountData });
235
+ const accountObj = accountData.selectedWhatsappAccount || {};
237
236
  if (!isEmpty(accountObj)) {
238
237
  const {
239
238
  sourceAccountIdentifier = '',
@@ -245,7 +244,6 @@ export const Whatsapp = (props) => {
245
244
  setAccessToken(configs.accessToken || '');
246
245
  setAccountName(name);
247
246
  setHost(hostName);
248
- console.log("### useEff2", { sourceAccountIdentifier, configs, name, hostName });
249
247
  }
250
248
  }, [accountData.selectedWhatsappAccount]);
251
249
 
@@ -53,7 +53,6 @@ import injectReducer from '../../utils/injectReducer';
53
53
  import * as globalActions from '../Cap/actions';
54
54
  import v2ZaloReducer from './reducer';
55
55
  import { v2ZaloSagas } from './saga';
56
- import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
57
56
 
58
57
  export const Zalo = (props) => {
59
58
  const {
@@ -507,9 +506,7 @@ const mapDispatchToProps = (dispatch) => ({
507
506
 
508
507
 
509
508
  const withReducer = injectReducer({ key: 'zalo', reducer: v2ZaloReducer });
510
-
511
- //DAEMON mode ensures that this saga is not injected twice
512
- const withZaloSaga = injectSaga({ key: 'zalo', saga: v2ZaloSagas, mode: DAEMON });
509
+ const withZaloSaga = injectSaga({ key: 'zalo', saga: v2ZaloSagas });
513
510
 
514
511
  export default withCreatives({
515
512
  WrappedComponent: Zalo,