@capillarytech/creatives-library 8.0.290 → 8.0.291

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.
Files changed (32) hide show
  1. package/package.json +1 -1
  2. package/v2Components/CommonTestAndPreview/SendTestMessage.js +1 -33
  3. package/v2Components/CommonTestAndPreview/actions.js +0 -20
  4. package/v2Components/CommonTestAndPreview/constants.js +0 -10
  5. package/v2Components/CommonTestAndPreview/index.js +15 -133
  6. package/v2Components/CommonTestAndPreview/reducer.js +0 -47
  7. package/v2Components/CommonTestAndPreview/sagas.js +0 -60
  8. package/v2Components/CommonTestAndPreview/selectors.js +0 -51
  9. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +0 -127
  10. package/v2Components/CommonTestAndPreview/tests/actions.test.js +0 -50
  11. package/v2Components/CommonTestAndPreview/tests/constants.test.js +0 -18
  12. package/v2Components/CommonTestAndPreview/tests/index.test.js +1 -214
  13. package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -118
  14. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +0 -145
  15. package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -146
  16. package/v2Components/TestAndPreviewSlidebox/index.js +0 -14
  17. package/v2Containers/CreativesContainer/index.js +8 -0
  18. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -649
  19. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -141
  20. package/v2Containers/Whatsapp/index.js +1 -1
  21. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4225 -26174
  22. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +0 -33
  23. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +0 -397
  24. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +0 -35
  25. package/v2Components/CommonTestAndPreview/DeliverySettings/TECH_DETAILING_DELIVERY_SETTINGS.md +0 -725
  26. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -92
  27. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +0 -243
  28. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -111
  29. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +0 -91
  30. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +0 -782
  31. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +0 -200
  32. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -235
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.290",
4
+ "version": "8.0.291",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -8,10 +8,6 @@ import CapStepsAccordian from '@capillarytech/cap-ui-library/CapStepsAccordian';
8
8
  import CapTreeSelect from '@capillarytech/cap-ui-library/CapTreeSelect';
9
9
  import isEmpty from 'lodash/isEmpty';
10
10
  import messages from './messages';
11
- import DeliverySettings from './DeliverySettings';
12
- import { CHANNELS } from './constants';
13
-
14
- const CHANNELS_WITH_DELIVERY_SETTINGS = [CHANNELS.SMS, CHANNELS.EMAIL, CHANNELS.WHATSAPP];
15
11
 
16
12
  const SendTestMessage = ({
17
13
  isFetchingTestCustomers,
@@ -21,14 +17,8 @@ const SendTestMessage = ({
21
17
  selectedTestEntities,
22
18
  handleSendTestMessage,
23
19
  formData,
24
- channel,
25
20
  isSendingTestMessage,
26
21
  formatMessage,
27
- deliverySettings,
28
- senderDetailsOptions,
29
- wecrmAccounts,
30
- onSaveDeliverySettings,
31
- isLoadingSenderDetails,
32
22
  }) => (
33
23
  <CapStepsAccordian
34
24
  showNumberSteps={false}
@@ -53,22 +43,6 @@ const SendTestMessage = ({
53
43
  multiple
54
44
  placeholder={formatMessage(messages.testCustomersPlaceholder)}
55
45
  />
56
- {CHANNELS_WITH_DELIVERY_SETTINGS.includes(channel) && (
57
- <DeliverySettings
58
- channel={channel}
59
- deliverySettings={deliverySettings || {}}
60
- senderDetailsOptions={senderDetailsOptions || []}
61
- wecrmAccounts={wecrmAccounts || []}
62
- onSaveDeliverySettings={onSaveDeliverySettings}
63
- isLoadingSenderDetails={isLoadingSenderDetails}
64
- formatMessage={formatMessage}
65
- whatsappAccountFromForm={
66
- channel === CHANNELS.WHATSAPP && formData?.accountName
67
- ? { accountName: formData.accountName }
68
- : undefined
69
- }
70
- />
71
- )}
72
46
  <CapButton onClick={handleSendTestMessage} disabled={isEmpty(selectedTestEntities) || isSendingTestMessage}>
73
47
  <FormattedMessage {...messages.sendTestButton} />
74
48
  </CapButton>
@@ -86,15 +60,9 @@ SendTestMessage.propTypes = {
86
60
  handleTestEntitiesChange: PropTypes.func.isRequired,
87
61
  selectedTestEntities: PropTypes.array.isRequired,
88
62
  handleSendTestMessage: PropTypes.func.isRequired,
89
- formData: PropTypes.object,
90
- channel: PropTypes.string,
63
+ formData: PropTypes.object.isRequired,
91
64
  isSendingTestMessage: PropTypes.bool.isRequired,
92
65
  formatMessage: PropTypes.func.isRequired,
93
- deliverySettings: PropTypes.object,
94
- senderDetailsOptions: PropTypes.array,
95
- wecrmAccounts: PropTypes.array,
96
- onSaveDeliverySettings: PropTypes.func,
97
- isLoadingSenderDetails: PropTypes.bool,
98
66
  };
99
67
 
100
68
  export default SendTestMessage;
@@ -18,8 +18,6 @@ import {
18
18
  GET_PREFILLED_VALUES_REQUESTED,
19
19
  CLEAR_PREFILLED_VALUES,
20
20
  CLEAR_PREVIEW_ERRORS,
21
- GET_SENDER_DETAILS_REQUESTED,
22
- GET_WECRM_ACCOUNTS_REQUESTED,
23
21
  } from './constants';
24
22
 
25
23
  // ============================================
@@ -127,21 +125,3 @@ export const clearPrefilledValues = () => ({
127
125
  export const clearPreviewErrors = () => ({
128
126
  type: CLEAR_PREVIEW_ERRORS,
129
127
  });
130
-
131
- /**
132
- * Request sender details for a channel (SMS, EMAIL, WHATSAPP) for delivery settings
133
- * @param {Object} payload - { channel, orgUnitId }
134
- */
135
- export const getSenderDetailsRequested = (payload) => ({
136
- type: GET_SENDER_DETAILS_REQUESTED,
137
- payload,
138
- });
139
-
140
- /**
141
- * Request WeCRM accounts (e.g. for WhatsApp account dropdown)
142
- * @param {Object} payload - { sourceName } e.g. { sourceName: 'WHATSAPP' }
143
- */
144
- export const getWeCrmAccountsRequested = (payload) => ({
145
- type: GET_WECRM_ACCOUNTS_REQUESTED,
146
- payload,
147
- });
@@ -55,16 +55,6 @@ export const CLEAR_SEARCH_RESULTS = 'app/CommonTestAndPreview/CLEAR_SEARCH_RESUL
55
55
  export const CLEAR_PREFILLED_VALUES = 'app/CommonTestAndPreview/CLEAR_PREFILLED_VALUES';
56
56
  export const CLEAR_PREVIEW_ERRORS = 'app/CommonTestAndPreview/CLEAR_PREVIEW_ERRORS';
57
57
 
58
- // Get Sender Details (delivery settings for Test and Preview)
59
- export const GET_SENDER_DETAILS_REQUESTED = 'app/CommonTestAndPreview/GET_SENDER_DETAILS_REQUESTED';
60
- export const GET_SENDER_DETAILS_SUCCESS = 'app/CommonTestAndPreview/GET_SENDER_DETAILS_SUCCESS';
61
- export const GET_SENDER_DETAILS_FAILURE = 'app/CommonTestAndPreview/GET_SENDER_DETAILS_FAILURE';
62
-
63
- // Get WeCRM Accounts (WhatsApp account list)
64
- export const GET_WECRM_ACCOUNTS_REQUESTED = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_REQUESTED';
65
- export const GET_WECRM_ACCOUNTS_SUCCESS = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_SUCCESS';
66
- export const GET_WECRM_ACCOUNTS_FAILURE = 'app/CommonTestAndPreview/GET_WECRM_ACCOUNTS_FAILURE';
67
-
68
58
  // ============================================
69
59
  // CHANNEL CONSTANTS
70
60
  // ============================================
@@ -105,10 +105,6 @@ const CommonTestAndPreview = (props) => {
105
105
  updatePreviewErrors,
106
106
  fetchPrefilledValuesError,
107
107
  fetchPrefilledValuesErrors,
108
- senderDetailsByChannel = {},
109
- wecrmAccounts = [],
110
- isLoadingSenderDetails = false,
111
- orgUnitId = -1,
112
108
  // Email-specific props
113
109
  beeInstance,
114
110
  currentTab = 1,
@@ -150,84 +146,6 @@ const CommonTestAndPreview = (props) => {
150
146
  const [selectedTestEntities, setSelectedTestEntities] = useState([]);
151
147
  const [beeContent, setBeeContent] = useState(''); // Track BEE editor content separately (EMAIL only)
152
148
  const previousBeeContentRef = useRef(''); // Track previous BEE content (EMAIL only)
153
- // Delivery settings for Test and Preview (SMS, Email, WhatsApp) — user selection only
154
- const [testPreviewDeliverySettings, setTestPreviewDeliverySettings] = useState({
155
- [CHANNELS.SMS]: {
156
- domainId: null, domainGatewayMapId: null, gsmSenderId: '', cdmaSenderId: '',
157
- },
158
- [CHANNELS.EMAIL]: {
159
- domainId: null, domainGatewayMapId: null, senderEmail: '', senderLabel: '', senderReplyTo: '',
160
- },
161
- [CHANNELS.WHATSAPP]: {
162
- domainId: null, senderMobNum: '', sourceAccountIdentifier: '',
163
- },
164
- });
165
-
166
- const channelsWithDeliverySettings = [CHANNELS.SMS, CHANNELS.EMAIL, CHANNELS.WHATSAPP];
167
-
168
- // Fetch sender details and WeCRM accounts when Test & Preview opens for SMS/Email/WhatsApp
169
- useEffect(() => {
170
- if (!show || !channel) {
171
- return;
172
- }
173
- if (channelsWithDeliverySettings.includes(channel)) {
174
- if (actions.getSenderDetailsRequested) {
175
- actions.getSenderDetailsRequested({ channel, orgUnitId: orgUnitId ?? -1 });
176
- }
177
- if (channel === CHANNELS.WHATSAPP && actions.getWeCrmAccountsRequested) {
178
- actions.getWeCrmAccountsRequested({ sourceName: CHANNELS.WHATSAPP });
179
- }
180
- }
181
- }, [show, channel, orgUnitId, actions]);
182
-
183
- const findDefault = (arr) => (arr && arr.find((x) => x.default)) || (arr && arr[0]) || {};
184
-
185
- // Auto-set default delivery setting when sender details load (campaigns-style: first domain + default/first sender)
186
- useEffect(() => {
187
- if (!channel || !channelsWithDeliverySettings.includes(channel)) return;
188
- const domains = senderDetailsByChannel[channel];
189
- if (!domains || domains.length === 0) return;
190
- const current = testPreviewDeliverySettings[channel];
191
- const isEmptySelection = !current?.domainId && !current?.gsmSenderId && !current?.senderEmail && !current?.senderMobNum;
192
- if (!isEmptySelection) return;
193
-
194
- const whatsappAccountFromForm = channel === CHANNELS.WHATSAPP ? formData?.accountName : undefined;
195
- const matchedWhatsappAccount = whatsappAccountFromForm
196
- ? (wecrmAccounts || []).find((account) => account?.name === whatsappAccountFromForm)
197
- : null;
198
- const firstDomain = channel === CHANNELS.WHATSAPP && matchedWhatsappAccount?.sourceAccountIdentifier
199
- ? domains.find((domain) => domain?.sourceAccountIdentifier === matchedWhatsappAccount.sourceAccountIdentifier) || domains[0]
200
- : domains[0];
201
- setTestPreviewDeliverySettings((prev) => {
202
- const next = { ...prev };
203
- if (channel === CHANNELS.SMS) {
204
- next[channel] = {
205
- domainId: firstDomain.domainId,
206
- domainGatewayMapId: firstDomain.dgmId,
207
- gsmSenderId: findDefault(firstDomain.gsmSenders)?.value || firstDomain.gsmSenders?.[0]?.value || '',
208
- cdmaSenderId: findDefault(firstDomain.cdmaSenders)?.value || '',
209
- };
210
- } else if (channel === CHANNELS.EMAIL) {
211
- const defSender = findDefault(firstDomain.emailSenders);
212
- const defReply = findDefault(firstDomain.emailRepliers);
213
- next[channel] = {
214
- domainId: firstDomain.domainId,
215
- domainGatewayMapId: firstDomain.dgmId,
216
- senderEmail: defSender?.value || '',
217
- senderLabel: defSender?.label || '',
218
- senderReplyTo: defReply?.value || '',
219
- };
220
- } else if (channel === CHANNELS.WHATSAPP) {
221
- const accId = firstDomain.sourceAccountIdentifier;
222
- next[channel] = {
223
- domainId: firstDomain.domainId,
224
- senderMobNum: firstDomain.gsmSenders?.[0]?.value || '',
225
- sourceAccountIdentifier: matchedWhatsappAccount?.sourceAccountIdentifier || accId || '',
226
- };
227
- }
228
- return next;
229
- });
230
- }, [channel, formData?.accountName, senderDetailsByChannel, wecrmAccounts]);
231
149
 
232
150
  // ============================================
233
151
  // MEMOIZED VALUES
@@ -524,7 +442,7 @@ const CommonTestAndPreview = (props) => {
524
442
  * Prepare payload for test message sending based on channel
525
443
  * Updated to match API structure with ouId, sourceEntityId, module, deliverySettings, etc.
526
444
  */
527
- const prepareTestMessagePayload = (channelType, formDataObj, contentStr, customValuesObj, recipientDetails, previewDataObj, deliverySettingsOverride) => {
445
+ const prepareTestMessagePayload = (channelType, formDataObj, contentStr, customValuesObj, recipientDetails, previewDataObj) => {
528
446
  // Base payload structure common to all channels
529
447
  const basePayload = {
530
448
  ouId: -1,
@@ -550,14 +468,6 @@ const CommonTestAndPreview = (props) => {
550
468
  ? resolveTagsInText(subject, customValuesObj)
551
469
  : subject;
552
470
 
553
- const emailChannelSettings = {
554
- channel: CHANNELS.EMAIL,
555
- senderLabel: deliverySettingsOverride?.senderLabel ?? '',
556
- senderId: deliverySettingsOverride?.senderEmail ?? '',
557
- replyToId: deliverySettingsOverride?.senderReplyTo ?? '',
558
- domainGatewayMapId: deliverySettingsOverride?.domainGatewayMapId ?? '',
559
- domainId: deliverySettingsOverride?.domainId ?? '',
560
- };
561
471
  return {
562
472
  ...basePayload,
563
473
  emailDeliverySettings: {
@@ -568,7 +478,12 @@ const CommonTestAndPreview = (props) => {
568
478
  skipRateLimit: false,
569
479
  bypassControlUser: false,
570
480
  },
571
- channelSettings: emailChannelSettings,
481
+ channelSettings: {
482
+ channel: CHANNELS.EMAIL,
483
+ senderLabel: '',
484
+ senderId: '',
485
+ replyToId: '',
486
+ },
572
487
  },
573
488
  emailMessageContent: {
574
489
  channel: CHANNELS.EMAIL,
@@ -605,12 +520,8 @@ const CommonTestAndPreview = (props) => {
605
520
  },
606
521
  smsDeliverySettings: {
607
522
  channelSettings: {
608
- gsmSenderId: deliverySettingsOverride?.gsmSenderId ?? '',
609
- domainId: deliverySettingsOverride?.domainId ?? null,
610
- domainGatewayMapId: deliverySettingsOverride?.domainGatewayMapId ?? '',
611
- targetNdnc: false,
612
- cdmaSenderId: deliverySettingsOverride?.cdmaSenderId ?? '',
613
- channel: CHANNELS.SMS,
523
+ gsmSenderId: '',
524
+ domainId: null,
614
525
  },
615
526
  additionalSettings: {
616
527
  useTinyUrl: false,
@@ -746,17 +657,16 @@ const CommonTestAndPreview = (props) => {
746
657
  templateConfigs.mediaType = formDataObj?.carouselMediaType?.toUpperCase() || MEDIA_TYPE_IMAGE;
747
658
  }
748
659
 
749
- // Extract delivery settings (override from Test & Preview delivery settings when present)
750
- const senderMobNum = deliverySettingsOverride?.senderMobNum ?? formDataObj?.senderMobNum ?? additionalProps?.senderMobNum ?? '';
751
- const domainId = deliverySettingsOverride?.domainId ?? formDataObj?.domainId ?? additionalProps?.domainId ?? null;
752
- const sourceAccountIdentifier = deliverySettingsOverride?.sourceAccountIdentifier ?? formDataObj?.sourceAccountIdentifier ?? '';
660
+ // Extract delivery settings
661
+ const senderMobNum = formDataObj?.senderMobNum || additionalProps?.senderMobNum || '';
662
+ const domainId = formDataObj?.domainId || additionalProps?.domainId || null;
753
663
 
754
664
  return {
755
665
  ...basePayload,
756
666
  whatsappMessageContent: {
757
667
  messageBody: templateEditorValue || '',
758
668
  accountId: formDataObj?.accountId || '',
759
- sourceAccountIdentifier: sourceAccountIdentifier || formDataObj?.sourceAccountIdentifier || '',
669
+ sourceAccountIdentifier: formDataObj?.sourceAccountIdentifier || '',
760
670
  accountName: formDataObj?.accountName || '',
761
671
  templateConfigs,
762
672
  channel: CHANNELS.WHATSAPP,
@@ -2460,10 +2370,6 @@ const CommonTestAndPreview = (props) => {
2460
2370
  });
2461
2371
  const uniqueUserIds = [...new Set(allUserIds)];
2462
2372
 
2463
- const deliveryOverride = [CHANNELS.SMS, CHANNELS.EMAIL, CHANNELS.WHATSAPP].includes(channel)
2464
- ? testPreviewDeliverySettings[channel]
2465
- : null;
2466
-
2467
2373
  // Create initial payload based on channel
2468
2374
  const initialPayload = prepareTestMessagePayload(
2469
2375
  channel,
@@ -2471,8 +2377,7 @@ const CommonTestAndPreview = (props) => {
2471
2377
  getCurrentContent,
2472
2378
  customValues,
2473
2379
  uniqueUserIds,
2474
- previewData,
2475
- deliveryOverride
2380
+ previewData
2476
2381
  );
2477
2382
 
2478
2383
  actions.createMessageMetaRequested(
@@ -2544,16 +2449,6 @@ const CommonTestAndPreview = (props) => {
2544
2449
  />
2545
2450
  );
2546
2451
 
2547
- const handleSaveDeliverySettings = (values) => {
2548
- setTestPreviewDeliverySettings((prev) => ({
2549
- ...prev,
2550
- [channel]: values,
2551
- }));
2552
- };
2553
-
2554
- // Use formData when present; for WhatsApp (and others) parent may pass template via content only
2555
- const formDataForSendTest = formData ?? (content && typeof content === 'object' && !Array.isArray(content) ? content : formData);
2556
-
2557
2452
  const renderSendTestMessage = () => (
2558
2453
  <SendTestMessage
2559
2454
  isFetchingTestCustomers={isFetchingTestCustomers}
@@ -2562,16 +2457,11 @@ const CommonTestAndPreview = (props) => {
2562
2457
  handleTestEntitiesChange={handleTestEntitiesChange}
2563
2458
  selectedTestEntities={selectedTestEntities}
2564
2459
  handleSendTestMessage={handleSendTestMessage}
2565
- formData={formDataForSendTest}
2460
+ formData={formData}
2566
2461
  content={getCurrentContent}
2567
2462
  channel={channel}
2568
2463
  isSendingTestMessage={isSendingTestMessage}
2569
2464
  formatMessage={formatMessage}
2570
- deliverySettings={testPreviewDeliverySettings[channel]}
2571
- senderDetailsOptions={senderDetailsByChannel[channel]}
2572
- wecrmAccounts={wecrmAccounts}
2573
- onSaveDeliverySettings={handleSaveDeliverySettings}
2574
- isLoadingSenderDetails={isLoadingSenderDetails}
2575
2465
  />
2576
2466
  );
2577
2467
 
@@ -2672,10 +2562,6 @@ CommonTestAndPreview.propTypes = {
2672
2562
  })),
2673
2563
  isSendingTestMessage: PropTypes.bool.isRequired,
2674
2564
  intl: PropTypes.object.isRequired,
2675
- senderDetailsByChannel: PropTypes.object,
2676
- wecrmAccounts: PropTypes.array,
2677
- isLoadingSenderDetails: PropTypes.bool,
2678
- orgUnitId: PropTypes.number,
2679
2565
 
2680
2566
  // Email-specific props
2681
2567
  beeInstance: PropTypes.object,
@@ -2711,10 +2597,6 @@ CommonTestAndPreview.defaultProps = {
2711
2597
  rcsOrientation: null,
2712
2598
  rcsIosPreview: false,
2713
2599
  templateLayoutType: null,
2714
- senderDetailsByChannel: {},
2715
- wecrmAccounts: [],
2716
- isLoadingSenderDetails: false,
2717
- orgUnitId: -1,
2718
2600
  };
2719
2601
 
2720
2602
  // ============================================
@@ -31,13 +31,6 @@ import {
31
31
  GET_PREFILLED_VALUES_FAILURE,
32
32
  CLEAR_PREFILLED_VALUES,
33
33
  CLEAR_PREVIEW_ERRORS,
34
- GET_SENDER_DETAILS_REQUESTED,
35
- GET_SENDER_DETAILS_SUCCESS,
36
- GET_SENDER_DETAILS_FAILURE,
37
- GET_WECRM_ACCOUNTS_REQUESTED,
38
- GET_WECRM_ACCOUNTS_SUCCESS,
39
- GET_WECRM_ACCOUNTS_FAILURE,
40
- CHANNELS,
41
34
  } from './constants';
42
35
 
43
36
  const initialState = fromJS({
@@ -92,16 +85,6 @@ const initialState = fromJS({
92
85
  isFetchingPrefilledValues: false,
93
86
  fetchPrefilledValuesError: null,
94
87
  fetchPrefilledValuesErrors: [],
95
-
96
- senderDetailsByChannel: fromJS({
97
- [CHANNELS.SMS]: [],
98
- [CHANNELS.EMAIL]: [],
99
- [CHANNELS.WHATSAPP]: [],
100
- }),
101
- wecrmAccounts: fromJS([]),
102
- isLoadingSenderDetails: false,
103
- fetchSenderDetailsError: null,
104
- fetchWeCrmAccountsError: null,
105
88
  });
106
89
 
107
90
  const previewAndTestReducer = (state = initialState, action) => {
@@ -267,36 +250,6 @@ const previewAndTestReducer = (state = initialState, action) => {
267
250
  .set('fetchPrefilledValuesError', null)
268
251
  .set('fetchPrefilledValuesErrors', fromJS([]));
269
252
 
270
- case GET_SENDER_DETAILS_REQUESTED:
271
- return state
272
- .set('isLoadingSenderDetails', true)
273
- .set('fetchSenderDetailsError', null);
274
-
275
- case GET_SENDER_DETAILS_SUCCESS: {
276
- const { channel, domains } = action.payload || {};
277
- if (!channel) return state;
278
- return state
279
- .setIn(['senderDetailsByChannel', channel], fromJS(domains || []))
280
- .set('isLoadingSenderDetails', false)
281
- .set('fetchSenderDetailsError', null);
282
- }
283
-
284
- case GET_SENDER_DETAILS_FAILURE:
285
- return state
286
- .set('isLoadingSenderDetails', false)
287
- .set('fetchSenderDetailsError', action.payload?.error ?? action.payload);
288
-
289
- case GET_WECRM_ACCOUNTS_REQUESTED:
290
- return state.set('fetchWeCrmAccountsError', null);
291
-
292
- case GET_WECRM_ACCOUNTS_SUCCESS:
293
- return state
294
- .set('wecrmAccounts', fromJS(action.payload?.accounts || []))
295
- .set('fetchWeCrmAccountsError', null);
296
-
297
- case GET_WECRM_ACCOUNTS_FAILURE:
298
- return state.set('fetchWeCrmAccountsError', action.payload?.error ?? action.payload);
299
-
300
253
  default:
301
254
  return state;
302
255
  }
@@ -35,15 +35,8 @@ import {
35
35
  GET_PREFILLED_VALUES_REQUESTED,
36
36
  GET_PREFILLED_VALUES_SUCCESS,
37
37
  GET_PREFILLED_VALUES_FAILURE,
38
- GET_SENDER_DETAILS_REQUESTED,
39
- GET_SENDER_DETAILS_SUCCESS,
40
- GET_SENDER_DETAILS_FAILURE,
41
- GET_WECRM_ACCOUNTS_REQUESTED,
42
- GET_WECRM_ACCOUNTS_SUCCESS,
43
- GET_WECRM_ACCOUNTS_FAILURE,
44
38
  ERROR_MESSAGES,
45
39
  } from './constants';
46
- import { parseSenderDetailsResponse } from './DeliverySettings/utils/parseSenderDetailsResponse';
47
40
 
48
41
  // Search Customers Saga
49
42
  export function* searchCustomersSaga(action) {
@@ -292,57 +285,6 @@ export function* watchGetPrefilledValues() {
292
285
  yield takeLatest(GET_PREFILLED_VALUES_REQUESTED, getPrefilledValuesSaga);
293
286
  }
294
287
 
295
- export function* getSenderDetailsSaga(action) {
296
- const { channel, orgUnitId } = action.payload || {};
297
- if (!channel) return;
298
- try {
299
- const response = yield call(Api.getSenderDetails, channel, orgUnitId ?? -1);
300
- if (response?.errors?.length) {
301
- yield put({
302
- type: GET_SENDER_DETAILS_FAILURE,
303
- payload: { channel, error: response.errors },
304
- });
305
- return;
306
- }
307
- const parsed = parseSenderDetailsResponse(channel, response);
308
- yield put({
309
- type: GET_SENDER_DETAILS_SUCCESS,
310
- payload: { channel, domains: parsed.domains || [] },
311
- });
312
- } catch (error) {
313
- yield put({
314
- type: GET_SENDER_DETAILS_FAILURE,
315
- payload: { channel, error: error.message || error },
316
- });
317
- }
318
- }
319
-
320
- export function* getWeCrmAccountsSaga(action) {
321
- const { sourceName } = action.payload || {};
322
- try {
323
- const result = yield call(Api.fetchWeCrmAccounts, sourceName || 'WHATSAPP');
324
- const accounts = get(result, 'response') || get(result, 'entity') || (result?.success ? result.response : null) || [];
325
- const list = Array.isArray(accounts) ? accounts : (accounts && accounts.data) || [];
326
- yield put({
327
- type: GET_WECRM_ACCOUNTS_SUCCESS,
328
- payload: { accounts: list },
329
- });
330
- } catch (error) {
331
- yield put({
332
- type: GET_WECRM_ACCOUNTS_FAILURE,
333
- payload: { error: error.message || error },
334
- });
335
- }
336
- }
337
-
338
- export function* watchGetSenderDetails() {
339
- yield takeLatest(GET_SENDER_DETAILS_REQUESTED, getSenderDetailsSaga);
340
- }
341
-
342
- export function* watchGetWeCrmAccounts() {
343
- yield takeLatest(GET_WECRM_ACCOUNTS_REQUESTED, getWeCrmAccountsSaga);
344
- }
345
-
346
288
  // Root saga
347
289
  export function* commonTestAndPreviewSaga() {
348
290
  yield all([
@@ -354,7 +296,5 @@ export function* commonTestAndPreviewSaga() {
354
296
  watchFetchTestGroups(),
355
297
  watchCreateMessageMeta(),
356
298
  watchGetPrefilledValues(),
357
- watchGetSenderDetails(),
358
- watchGetWeCrmAccounts(),
359
299
  ]);
360
300
  }
@@ -144,51 +144,6 @@ const makeSelectFetchPrefilledValuesErrors = () => createSelector(
144
144
  (substate) => substate.get('fetchPrefilledValuesErrors')?.toJS() || [],
145
145
  );
146
146
 
147
- const makeSelectSenderDetailsForChannel = (channel) => createSelector(
148
- selectCommonTestAndPreviewDomain,
149
- (substate) => {
150
- if (!substate) return [];
151
- const byChannel = substate.get('senderDetailsByChannel');
152
- if (!byChannel) return [];
153
- const list = byChannel.get(channel);
154
- return list ? list.toJS() : [];
155
- },
156
- );
157
-
158
- const makeSelectSenderDetailsByChannel = () => createSelector(
159
- selectCommonTestAndPreviewDomain,
160
- (substate) => {
161
- if (!substate) return {};
162
- const byChannel = substate.get('senderDetailsByChannel');
163
- if (!byChannel) return {};
164
- return byChannel.toJS ? byChannel.toJS() : {};
165
- },
166
- );
167
-
168
- const makeSelectWeCrmAccounts = () => createSelector(
169
- selectCommonTestAndPreviewDomain,
170
- (substate) => {
171
- if (!substate) return [];
172
- const list = substate.get('wecrmAccounts');
173
- return list ? list.toJS() : [];
174
- },
175
- );
176
-
177
- const makeSelectIsLoadingSenderDetails = () => createSelector(
178
- selectCommonTestAndPreviewDomain,
179
- (substate) => substate.get('isLoadingSenderDetails') || false,
180
- );
181
-
182
- const makeSelectFetchSenderDetailsError = () => createSelector(
183
- selectCommonTestAndPreviewDomain,
184
- (substate) => substate.get('fetchSenderDetailsError'),
185
- );
186
-
187
- const makeSelectFetchWeCrmAccountsError = () => createSelector(
188
- selectCommonTestAndPreviewDomain,
189
- (substate) => substate.get('fetchWeCrmAccountsError'),
190
- );
191
-
192
147
  export {
193
148
  makeSelectCommonTestAndPreview,
194
149
  makeSelectCustomers,
@@ -216,10 +171,4 @@ export {
216
171
  makeSelectUpdatePreviewErrors,
217
172
  makeSelectFetchPrefilledValuesError,
218
173
  makeSelectFetchPrefilledValuesErrors,
219
- makeSelectSenderDetailsForChannel,
220
- makeSelectSenderDetailsByChannel,
221
- makeSelectWeCrmAccounts,
222
- makeSelectIsLoadingSenderDetails,
223
- makeSelectFetchSenderDetailsError,
224
- makeSelectFetchWeCrmAccountsError,
225
174
  };