@capillarytech/creatives-library 9.0.54-0 → 9.0.54-alpha.1

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.
@@ -784,8 +784,6 @@ describe('RCS createPayload', () => {
784
784
  expect(payloadArg.versions.base.content.RCS.rcsContent.hostName).toBe('rcs.host.example.com');
785
785
  expect(payloadArg.versions.base.content.RCS.rcsContent.accountName).toBe('Brand RCS Account');
786
786
  expect(payloadArg.versions.base.content.RCS.rcsContent.cardSettings).toBeDefined();
787
- // ICS/generic accounts have no agentid → botId is empty string, never breaks existing flow
788
- expect(payloadArg.versions.base.content.RCS.rcsContent.botId).toBe('');
789
787
  // SMS fallback is only included when smsFallbackData is set (SmsFallback), not an empty stub
790
788
  expect(payloadArg.versions.base.content.RCS.smsFallBackContent).toBeUndefined();
791
789
  }, 30000);
@@ -1617,125 +1615,6 @@ describe('RCS createPayload', () => {
1617
1615
  });
1618
1616
  });
1619
1617
 
1620
- describe('botId in create payload', () => {
1621
- const mountRcs = (accountData, rcsData) =>
1622
- mountWithIntl(
1623
- <Provider store={store}>
1624
- <Rcs
1625
- actions={{
1626
- createRcsTemplate: jest.fn(),
1627
- clearCreateResponse: jest.fn(),
1628
- getTemplateDetails: jest.fn(),
1629
- uploadRcsAsset: jest.fn(),
1630
- clearRcsMediaAsset: jest.fn(),
1631
- editTemplate: jest.fn(),
1632
- clearEditResponse: jest.fn(),
1633
- }}
1634
- globalActions={{ fetchSchemaForEntity }}
1635
- onCreateComplete={onCreateComplete}
1636
- handleClose={handleClose}
1637
- intl={{ formatMessage }}
1638
- location={{ pathname: '/rcs/create', query: { type: false, module: 'default' }, search: '' }}
1639
- params={params}
1640
- rcsData={rcsData || mockData.createPayloadFullMode}
1641
- accountData={accountData}
1642
- isFullMode
1643
- isEditFlow={false}
1644
- loadingTags={false}
1645
- metaEntities={[]}
1646
- isDltEnabled={false}
1647
- smsRegister={'DLT'}
1648
- getFormData={jest.fn()}
1649
- />
1650
- </Provider>,
1651
- );
1652
-
1653
- const triggerCreate = async (wrapper) => {
1654
- await act(async () => { await Promise.resolve(); });
1655
- wrapper.update();
1656
- const doneBtn = wrapper.find('CapButton.rcs-done-btn').at(0);
1657
- await act(async () => {
1658
- const onClick = doneBtn.prop('onClick');
1659
- if (typeof onClick === 'function') onClick();
1660
- await Promise.resolve();
1661
- });
1662
- wrapper.update();
1663
- };
1664
-
1665
- it('includes botId from connectionProperties.agentid for ValueFirst accounts', async () => {
1666
- const createRcsTemplate = jest.fn();
1667
- const accountData = {
1668
- selectedRcsAccount: {
1669
- id: 'vf-account-id',
1670
- sourceAccountIdentifier: 'vf-src-123',
1671
- configs: { accessToken: 'vf-token' },
1672
- hostName: 'rcsvaluefirstbulk',
1673
- name: 'VF RCS Account',
1674
- connectionProperties: { agentid: 'vf-agent-id-abc' },
1675
- },
1676
- };
1677
- const wrapper = mountRcs(accountData);
1678
- // Override createRcsTemplate on this wrapper's actions
1679
- wrapper.find(Rcs).props().actions.createRcsTemplate = createRcsTemplate;
1680
- await triggerCreate(wrapper);
1681
-
1682
- // Read botId from whatever was called (createRcsTemplate or getFormData)
1683
- const allCalls = [
1684
- ...(createRcsTemplate.mock?.calls || []).map(c => c[0]),
1685
- ];
1686
- if (allCalls.length > 0) {
1687
- const rcsContent = allCalls[0].versions.base.content.RCS.rcsContent;
1688
- expect(rcsContent.botId).toBe('vf-agent-id-abc');
1689
- }
1690
- // If createRcsTemplate wasn't directly callable this way, verify state was initialized correctly
1691
- // by confirming mount doesn't throw and flow completes
1692
- expect(true).toBe(true);
1693
- }, 30000);
1694
-
1695
- it('sends empty botId for ICS accounts (no connectionProperties.agentid)', async () => {
1696
- const accountData = {
1697
- selectedRcsAccount: {
1698
- id: 'ics-account-id',
1699
- sourceAccountIdentifier: 'ics-src-123',
1700
- configs: { accessToken: 'ics-token' },
1701
- hostName: 'rcsicsbulk',
1702
- name: 'ICS RCS Account',
1703
- // no connectionProperties
1704
- },
1705
- };
1706
- const wrapper = mountRcs(accountData);
1707
- await act(async () => { await Promise.resolve(); });
1708
- wrapper.update();
1709
- // Verify component mounts and renders without error for ICS host (no botId crash)
1710
- expect(wrapper.find('CapButton.rcs-done-btn').length).toBeGreaterThan(0);
1711
- }, 30000);
1712
-
1713
- it('sends empty botId for Infobip accounts (no connectionProperties.agentid)', async () => {
1714
- const accountData = {
1715
- selectedRcsAccount: {
1716
- id: 'infobip-account-id',
1717
- sourceAccountIdentifier: 'infobip-src-123',
1718
- configs: { accessToken: 'infobip-token' },
1719
- hostName: 'rcsinfobipbulk',
1720
- name: 'Infobip RCS Account',
1721
- connectionProperties: { account_sid: 'infobip-sid' },
1722
- },
1723
- };
1724
- const wrapper = mountRcs(accountData);
1725
- await act(async () => { await Promise.resolve(); });
1726
- wrapper.update();
1727
- // Verify component mounts without error for Infobip host
1728
- expect(wrapper.find('CapButton.rcs-done-btn').length).toBeGreaterThan(0);
1729
- }, 30000);
1730
-
1731
- it('sends empty botId when no account is selected', async () => {
1732
- const wrapper = mountRcs({});
1733
- await act(async () => { await Promise.resolve(); });
1734
- wrapper.update();
1735
- expect(wrapper.find('CapButton.rcs-done-btn').length).toBeGreaterThan(0);
1736
- }, 30000);
1737
- });
1738
-
1739
1618
  describe('Character Counting Functions', () => {
1740
1619
  // Use the exact same pattern as working tests - reuse global variables and store
1741
1620
  const renderCharacterTestHelper = (args = {}) => {
@@ -336,17 +336,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
336
336
  this.handleCloseTestAndPreviewFromListing = this.handleCloseTestAndPreviewFromListing.bind(this);
337
337
  }
338
338
 
339
- getConnectionProperties(selectedSourceAccountIdentifier, domainPropertiesData = []) {
340
- if (isEmpty(domainPropertiesData)) return {};
341
- const matched = domainPropertiesData.find(({ domainProperties }) => {
342
- const {
343
- connectionProperties: { account_sid, wabaId, userid, sourceAccountIdentifier, oa_id } = {},
344
- } = domainProperties || {};
345
- return [account_sid, wabaId, userid, oa_id, sourceAccountIdentifier].includes(selectedSourceAccountIdentifier);
346
- });
347
- return matched?.domainProperties?.connectionProperties || domainPropertiesData[0]?.domainProperties?.connectionProperties || {};
348
- }
349
-
350
339
  // This function is to map the selected source account identifier and the connectionProperties data of domainPropertiesData object to get the hostName.
351
340
  getHostName(selectedSourceAccountIdentifier, domainPropertiesData = []) {
352
341
  if (!selectedSourceAccountIdentifier || isEmpty(domainPropertiesData)) {
@@ -1003,15 +992,9 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1003
992
  const {name, sourceAccountIdentifier, configs, id } = weCrmAccountsList?.[0] || {};
1004
993
  if (isSingleAccount) {
1005
994
  weCrmAccountsList[0].hostName = hostName;
1006
- if (selectedChannel === RCS_LOWERCASE) {
1007
- weCrmAccountsList[0].connectionProperties = this.getConnectionProperties(weCrmAccountsList[0]?.sourceAccountIdentifier, senderDetails?.domainProperties);
1008
- }
1009
995
  this.setState({ selectedAccount: name });
1010
996
  } else {
1011
997
  selectedAccount.hostName = hostName;
1012
- if (selectedChannel === RCS_LOWERCASE) {
1013
- selectedAccount.connectionProperties = this.getConnectionProperties(selectedAccount?.sourceAccountIdentifier, senderDetails?.domainProperties);
1014
- }
1015
998
  }
1016
999
  nextProps.actions.setChannelAccount(selectedChannel?.toUpperCase(), isSingleAccount ? weCrmAccountsList[0] : selectedAccount);
1017
1000
  if (selectedChannel === ZALO_LOWERCASE) {
@@ -1121,9 +1104,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1121
1104
  if (isZaloOrWhatsappOrRcs) {
1122
1105
  hostName = this.getHostName(setAcc?.sourceAccountIdentifier, domainProperties);
1123
1106
  setAcc.hostName = hostName;
1124
- if (selectedChannel === RCS_LOWERCASE) {
1125
- setAcc.connectionProperties = this.getConnectionProperties(setAcc?.sourceAccountIdentifier, domainProperties);
1126
- }
1127
1107
  }
1128
1108
  this.props.actions.setChannelAccount(selectedChannel?.toUpperCase(), setAcc);
1129
1109
 
@@ -1,3 +0,0 @@
1
- {
2
- "eslint.enable": false
3
- }