@capillarytech/creatives-library 9.0.15-alpha.3 → 9.0.16-beta.0

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 (146) hide show
  1. package/AppRoot.js +80 -0
  2. package/app.js +5 -3
  3. package/constants/unified.js +0 -29
  4. package/entry.js +67 -1
  5. package/global-styles.js +1 -1
  6. package/mfe-exposed-components.js +2 -4
  7. package/package.json +2 -2
  8. package/services/api.js +1 -1
  9. package/services/tests/api.test.js +20 -35
  10. package/styles/containers/layout/_layoutPage.scss +8 -6
  11. package/utils/commonUtils.js +1 -19
  12. package/utils/getDataLayer.js +15 -0
  13. package/utils/gtmTrackers/gtmEvents/creativeDetails.js +2 -1
  14. package/utils/mfeDetect.js +1 -0
  15. package/v2Components/CapActionButton/constants.js +1 -8
  16. package/v2Components/CapActionButton/index.js +144 -202
  17. package/v2Components/CapActionButton/index.scss +14 -232
  18. package/v2Components/CapActionButton/messages.js +3 -19
  19. package/v2Components/CapActionButton/tests/index.test.js +18 -42
  20. package/v2Components/CapImageUpload/index.js +2 -2
  21. package/v2Components/CapTagList/index.js +0 -10
  22. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
  23. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
  24. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
  25. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
  26. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
  27. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
  28. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
  29. package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
  30. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +22 -202
  31. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +80 -381
  32. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
  33. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
  34. package/v2Components/CommonTestAndPreview/constants.js +2 -38
  35. package/v2Components/CommonTestAndPreview/index.js +222 -761
  36. package/v2Components/CommonTestAndPreview/messages.js +3 -45
  37. package/v2Components/CommonTestAndPreview/sagas.js +6 -25
  38. package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
  39. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
  40. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
  41. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
  42. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
  43. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
  44. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
  45. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
  46. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
  47. package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
  48. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
  49. package/v2Components/NavigationBar/index.js +9 -7
  50. package/v2Components/NavigationBar/mfeModuleHeader.config.js +16 -0
  51. package/v2Components/Pagination/_pagination.scss +2 -0
  52. package/v2Components/TemplatePreview/_templatePreview.scss +25 -45
  53. package/v2Components/TemplatePreview/index.js +32 -147
  54. package/v2Components/TemplatePreview/tests/index.test.js +0 -142
  55. package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
  56. package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
  57. package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
  58. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
  59. package/v2Containers/Cap/constants.js +1 -0
  60. package/v2Containers/Cap/index.js +47 -21
  61. package/v2Containers/Cap/sagas.js +19 -0
  62. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
  63. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
  64. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
  65. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -37
  66. package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
  67. package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
  68. package/v2Containers/CreativesContainer/constants.js +0 -11
  69. package/v2Containers/CreativesContainer/index.js +104 -323
  70. package/v2Containers/CreativesContainer/index.scss +1 -83
  71. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
  72. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
  73. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
  74. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
  75. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
  76. package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
  77. package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
  78. package/v2Containers/Rcs/constants.js +11 -131
  79. package/v2Containers/Rcs/index.js +829 -2682
  80. package/v2Containers/Rcs/index.scss +8 -443
  81. package/v2Containers/Rcs/messages.js +6 -45
  82. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +39409 -74176
  83. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +74 -10
  84. package/v2Containers/Rcs/tests/index.test.js +40 -151
  85. package/v2Containers/Rcs/tests/mockData.js +0 -38
  86. package/v2Containers/Rcs/tests/utils.test.js +30 -643
  87. package/v2Containers/Rcs/utils.js +12 -466
  88. package/v2Containers/Sms/Create/index.js +48 -115
  89. package/v2Containers/SmsTrai/Create/index.js +4 -9
  90. package/v2Containers/SmsTrai/Edit/constants.js +0 -2
  91. package/v2Containers/SmsTrai/Edit/index.js +169 -678
  92. package/v2Containers/SmsTrai/Edit/messages.js +4 -14
  93. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
  94. package/v2Containers/SmsWrapper/index.js +8 -37
  95. package/v2Containers/TagList/index.js +0 -6
  96. package/v2Containers/Templates/_templates.scss +11 -196
  97. package/v2Containers/Templates/actions.js +0 -11
  98. package/v2Containers/Templates/constants.js +0 -2
  99. package/v2Containers/Templates/index.js +60 -131
  100. package/v2Containers/Templates/sagas.js +13 -57
  101. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
  102. package/v2Containers/Templates/tests/sagas.test.js +16 -199
  103. package/v2Containers/TemplatesV2/TemplatesV2.style.js +10 -75
  104. package/v2Containers/TemplatesV2/index.js +43 -86
  105. package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
  106. package/v2Containers/Whatsapp/index.js +25 -4
  107. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
  108. package/utils/rcsPayloadUtils.js +0 -92
  109. package/utils/templateVarUtils.js +0 -201
  110. package/utils/tests/rcsPayloadUtils.test.js +0 -226
  111. package/utils/tests/templateVarUtils.test.js +0 -204
  112. package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
  113. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
  114. package/v2Components/CommonTestAndPreview/utils.js +0 -84
  115. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
  116. package/v2Components/SmsFallback/constants.js +0 -94
  117. package/v2Components/SmsFallback/index.js +0 -958
  118. package/v2Components/SmsFallback/index.scss +0 -266
  119. package/v2Components/SmsFallback/messages.js +0 -78
  120. package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
  121. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
  122. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
  123. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
  124. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
  125. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
  126. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
  127. package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
  128. package/v2Components/TemplatePreview/constants.js +0 -2
  129. package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
  130. package/v2Components/VarSegmentMessageEditor/index.js +0 -125
  131. package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
  132. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
  133. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
  134. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
  135. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
  136. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
  137. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
  138. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
  139. package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
  140. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
  141. package/v2Containers/SmsTrai/Edit/index.scss +0 -126
  142. package/v2Containers/Templates/TemplatesActionBar.js +0 -101
  143. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
  144. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
  145. package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
  146. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
package/AppRoot.js ADDED
@@ -0,0 +1,80 @@
1
+ import React, { useMemo, useEffect, useRef } from 'react';
2
+ import { Provider } from 'react-redux';
3
+ import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
4
+ import { createBrowserHistory } from 'history';
5
+ import ConfigProvider from 'antd/lib/config-provider';
6
+ import { getCapThemeConfig, loadCapUI } from '@capillarytech/cap-ui-library/utils';
7
+
8
+ import LanguageProvider from 'v2Containers/LanguageProvider';
9
+ import App from './containers/App';
10
+ import './styles/main.scss';
11
+ import { initialReducer } from './initialReducer';
12
+ import { translationMessages } from './i18n';
13
+ import initialState from './initialState';
14
+ import pathConfig from './config/path';
15
+ import { isMFEMode } from './utils/mfeDetect';
16
+ import { MFEEventBus } from '@capillarytech/cap-ui-utils';
17
+ import appConfig from '../app-config';
18
+
19
+ // Module-scope SDK init — MUST run before configureStore.
20
+ loadCapUI();
21
+
22
+ const AppRoot = ({ basename: _basename = '/creatives/ui', history: hostHistory }) => {
23
+ const { store, history } = useMemo(() => {
24
+ const hist =
25
+ hostHistory ||
26
+ createBrowserHistory({ basename: pathConfig.publicPath });
27
+ const st = configureStore(initialState, initialReducer, hist);
28
+ return { store: st, history: hist };
29
+ }, [hostHistory]);
30
+
31
+ const fcpReported = useRef(false);
32
+ useEffect(() => {
33
+ if (isMFEMode() && !fcpReported.current) {
34
+ fcpReported.current = true;
35
+ requestAnimationFrame(() => {
36
+ MFEEventBus.emit('mfe:segment', {
37
+ action: 'stop',
38
+ appId: appConfig.appName,
39
+ type: 'fcp',
40
+ timestamp: performance.now(),
41
+ });
42
+ });
43
+ }
44
+ }, []);
45
+
46
+ useEffect(() => {
47
+ if (!isMFEMode()) {
48
+ const { startStandalone } = require('locize');
49
+ startStandalone();
50
+ }
51
+ }, []);
52
+
53
+ useEffect(() => {
54
+ if (isMFEMode()) {
55
+ MFEEventBus.emit('gtm:init', {
56
+ appId: appConfig.appName,
57
+ containerId: appConfig.gtm.trackingId,
58
+ });
59
+ }
60
+ }, []);
61
+
62
+ useEffect(() => {
63
+ const unsub = MFEEventBus.on('creatives:navigate', ({ path }) => {
64
+ if (path) history.push(path);
65
+ });
66
+ return unsub;
67
+ }, [history]);
68
+
69
+ return (
70
+ <Provider store={store}>
71
+ <LanguageProvider messages={translationMessages}>
72
+ <ConfigProvider theme={getCapThemeConfig()}>
73
+ <App history={history} />
74
+ </ConfigProvider>
75
+ </LanguageProvider>
76
+ </Provider>
77
+ );
78
+ };
79
+
80
+ export default AppRoot;
package/app.js CHANGED
@@ -33,9 +33,11 @@ import { getCapThemeConfig, loadCapUI } from '@capillarytech/cap-ui-library/util
33
33
  loadCapUI();
34
34
 
35
35
  try {
36
- const { setupNewrelicWebVitals } = require('./newRelic/utils');
37
- // Setup New Relic WebVitals tracking
38
- setupNewrelicWebVitals();
36
+ if (!window.MFE_HOST) {
37
+ const { setupNewrelicWebVitals } = require('./newRelic/utils');
38
+ // Setup New Relic WebVitals tracking
39
+ setupNewrelicWebVitals();
40
+ }
39
41
  } catch (error) {
40
42
  Bugsnag.notify(error);
41
43
  }
@@ -162,24 +162,6 @@ export const TAG_CONTENT_REGEX = /{{([^}]+)}}/g;
162
162
  export const ENTRY_TRIGGER_TAG_REGEX = /\bentryTrigger\.\w+(?:\.\w+)?(?:\(\w+\))?/g;
163
163
  export const SKIP_TAGS_REGEX_GROUPS = ["dynamic_expiry_date_after_\\d+_days.FORMAT_\\d", "unsubscribe\\(#[a-zA-Z\\d]{6}\\)", "Link_to_[a-zA-Z]", "SURVEY.*.TOKEN", "^[A-Za-z].*\\([a-zA-Z\\d]*\\)", "referral_unique_(code|url).*userid"];
164
164
 
165
- // --- Template variable tokens (`{{var}}`, DLT `{#var#}`) ---
166
- /** Global: all `{{…}}` placeholders in a string. */
167
- export const DEFAULT_MUSTACHE_VAR_REGEX = /\{\{[^}]+\}\}/g;
168
- /** Global: `{{…}}` or DLT `{#…#}` tokens (SMS combined mode). */
169
- export const COMBINED_SMS_TEMPLATE_VAR_REGEX = /\{\{[^}]+\}\}|\{\#[^#]*\#\}/g;
170
- /** Full-string check: one mustache token. */
171
- export const MUSTACHE_VAR_TOKEN_FULL_STRING_REGEX = /^\{\{[^}]+\}\}$/;
172
- /** Full-string check: one DLT hash token. */
173
- export const DLT_HASH_VAR_TOKEN_FULL_STRING_REGEX = /^\{\#[^#]*\#\}$/;
174
- /** Full-string with capture group: inner name for `{{ name }}`-style tokens (whitespace-tolerant). */
175
- export const MUSTACHE_TOKEN_INNER_NAME_REGEX = /^\{\{\s*([^}]+?)\s*\}\}$/;
176
- /** Full-string with capture group: inner name/body for `{# name #}` DLT tokens (whitespace-tolerant). */
177
- export const DLT_HASH_TOKEN_INNER_NAME_REGEX = /^\{#\s*(.*?)\s*#\}$/;
178
- /** Global with capture group: inner name inside `{{name}}`. */
179
- export const MUSTACHE_VAR_NAME_CAPTURE_REGEX = /\{\{([^}]+)\}\}/g;
180
- /** Global with capture group: inner body inside `{#body#}`. */
181
- export const DLT_VAR_BODY_CAPTURE_REGEX = /\{\#([^#]*)\#\}/g;
182
-
183
165
  export const GET_TRANSLATION_MAPPED = {
184
166
  'en': 'en-US',
185
167
  'zh-cn': 'zh',
@@ -217,14 +199,3 @@ export const LOGOUT_FAILURE = 'cap/LOGOUT_FAILURE';
217
199
  export const JAPANESE_HELP_TEXT = 'ヘルプ :トークンの定義';
218
200
 
219
201
  export const TAG_TRANSLATION_DOC = 'https://docs.capillarytech.com/docs/tags-translation';
220
-
221
- // --- RCS SMS fallback API contract (shared across modules: campaigns, journey, etc.) ---
222
-
223
- /** Keys on `messageContent.*.smsFallBackContent` sent to the API: only `message` + `templateConfigs`.
224
- * `rcsSmsFallbackVarMapped` is editor-only — merged into `message` at normalize, not sent on the wire. */
225
- export const RCS_API_SMS_FALLBACK_KEYS = Object.freeze({
226
- MESSAGE: 'message',
227
- TEMPLATE_CONFIGS: 'templateConfigs',
228
- RCS_SMS_FALLBACK_VAR_MAPPED: 'rcsSmsFallbackVarMapped',
229
- });
230
-
package/entry.js CHANGED
@@ -1,2 +1,68 @@
1
1
  import { publicPath } from './config/path';
2
- __webpack_public_path__ = ((new URL(((document || {}).currentScript || {}).src || window.location)).origin) + `${publicPath}/`;
2
+
3
+ function normalizeTrailingSlash(url) {
4
+ if (!url) return url;
5
+ return url.endsWith('/') ? url : `${url}/`;
6
+ }
7
+
8
+ function getCreativesRemoteEntryScript() {
9
+ if (typeof document === 'undefined') return null;
10
+ const all = Array.from(
11
+ document.querySelectorAll('script[src*="remoteEntry"]'),
12
+ );
13
+ const match =
14
+ all.find(s => /cap-creatives-ui/i.test(s.src)) || all[all.length - 1];
15
+ return match;
16
+ }
17
+
18
+ function getRemoteEntryOrigin() {
19
+ const el = getCreativesRemoteEntryScript();
20
+ if (!el || !el.src) return '';
21
+ try {
22
+ return new URL(el.src, window.location.href).origin;
23
+ } catch (e) {
24
+ return '';
25
+ }
26
+ }
27
+
28
+ function getRemoteEntryBaseUrl() {
29
+ const el = getCreativesRemoteEntryScript();
30
+ if (!el || !el.src) return '';
31
+ try {
32
+ const u = new URL(el.src, window.location.href);
33
+ const dir = u.pathname.replace(/\/[^/]+\.js(\?.*)?$/, '/');
34
+ return normalizeTrailingSlash(`${u.origin}${dir}`);
35
+ } catch (e) {
36
+ return '';
37
+ }
38
+ }
39
+
40
+ function resolveWebpackPublicPath() {
41
+ const envPath = process.env.MFE_PUBLIC_PATH;
42
+
43
+ if (envPath && envPath.length > 0) {
44
+ if (/^https?:\/\//i.test(envPath)) {
45
+ return normalizeTrailingSlash(envPath);
46
+ }
47
+ const origin = getRemoteEntryOrigin();
48
+ if (origin) {
49
+ const p = envPath.startsWith('/') ? envPath : `/${envPath}`;
50
+ return normalizeTrailingSlash(new URL(p, origin).href);
51
+ }
52
+ return normalizeTrailingSlash(
53
+ `${window.location.origin}${envPath.startsWith('/') ? '' : '/'}${envPath}`,
54
+ );
55
+ }
56
+
57
+ const fromRemote = getRemoteEntryBaseUrl();
58
+ if (fromRemote) {
59
+ return fromRemote;
60
+ }
61
+
62
+ const origin = new URL(
63
+ ((document || {}).currentScript || {}).src || window.location,
64
+ ).origin;
65
+ return `${origin}${publicPath}/`;
66
+ }
67
+
68
+ __webpack_public_path__ = resolveWebpackPublicPath();
package/global-styles.js CHANGED
@@ -51,7 +51,7 @@ export default createGlobalStyle`
51
51
  }
52
52
 
53
53
  .slidebox-header-icon-right {
54
- .title-desc-container:not(:has(.whatsapp-rcs-slidebox-template-name)):not(:has(.cap-header-v2-description)) {
54
+ .title-desc-container:not(:has(.whatsapp-rcs-slidebox-template-name)) {
55
55
  display: flex;
56
56
  align-items: center;
57
57
  }
@@ -2,7 +2,5 @@
2
2
  // Contents of this file are used in webpack config's ModuleFederationPlugin.
3
3
  //
4
4
  module.exports = {
5
- // which exposes
6
- // ADD MFE COMPONENT YOU WANT TO EXPORT example:
7
- // './Home': './app/components/pages/Home',
8
- };
5
+ './AppRoot': './app/AppRoot',
6
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "9.0.15-alpha.3",
4
+ "version": "9.0.16-beta.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -16,7 +16,7 @@
16
16
  "@babel/polyfill": "7.4.3",
17
17
  "@bugsnag/js": "^7.2.1",
18
18
  "@bugsnag/plugin-react": "7.2.1",
19
- "@capillarytech/cap-ui-utils": "3.0.4",
19
+ "@capillarytech/cap-ui-utils": "3.0.20",
20
20
  "@capillarytech/vulcan-react-sdk": "3.0.1",
21
21
  "@codemirror/autocomplete": "^6.19.0",
22
22
  "@codemirror/lang-css": "^6.3.1",
package/services/api.js CHANGED
@@ -679,7 +679,7 @@ export const getSupportVideosConfig = () => {
679
679
  };
680
680
 
681
681
  export const getNavigationConfigApi = async () => {
682
- const url = `${ARYA_ENDPOINT}/navigations`;
682
+ const url = `${ARYA_ENDPOINT}/mfe_navigations`;
683
683
  return request(url, getAPICallObject('GET'));
684
684
  };
685
685
 
@@ -89,26 +89,21 @@ describe('uploadFile -- whatsapp image upload', () => {
89
89
 
90
90
  it('Uploads the file with the original filename when encodeURIComponent fails', async () => {
91
91
  // Mocking the encodeURIComponent function to throw an error
92
- const originalEncodeURIComponent = global.encodeURIComponent;
93
92
  global.encodeURIComponent = jest.fn(() => { throw new Error('encodeURIComponent error'); });
94
93
  const blob = new Blob([''], { type: 'image/jpeg' });
95
94
  const file = new File([blob], '@%test.jpeg', { type: 'image/jpeg' });
96
- try {
97
- expect(
98
- uploadFile({
99
- file,
100
- assetType: 'image',
101
- fileParams: {
102
- width: 275,
103
- height: 183,
104
- error: false,
105
- },
106
- whatsappParams: {},
107
- }),
108
- ).toEqual(Promise.resolve());
109
- } finally {
110
- global.encodeURIComponent = originalEncodeURIComponent;
111
- }
95
+ expect(
96
+ uploadFile({
97
+ file,
98
+ assetType: 'image',
99
+ fileParams: {
100
+ width: 275,
101
+ height: 183,
102
+ error: false,
103
+ },
104
+ whatsappParams: {},
105
+ }),
106
+ ).toEqual(Promise.resolve());
112
107
  });
113
108
  });
114
109
 
@@ -1042,26 +1037,16 @@ describe('getMembersLookup', () => {
1042
1037
  expect(result).toBeInstanceOf(Promise);
1043
1038
  });
1044
1039
 
1045
- it('should call fetch with correct URL encoding and GET method', async () => {
1040
+ it('should call fetch with correct URL encoding and GET method', () => {
1046
1041
  global.fetch.mockClear();
1047
- await getMembersLookup('email', 'user+test@example.com');
1042
+ getMembersLookup('email', 'user+test@example.com');
1048
1043
  expect(global.fetch).toHaveBeenCalled();
1049
-
1050
- // Find the first call that uses both the members endpoint and proper encoding
1051
- const call = global.fetch.mock.calls.find(
1052
- ([url]) =>
1053
- url &&
1054
- url.includes('members') &&
1055
- url.includes('identifierType=email') &&
1056
- url.includes('identifierValue=user%2Btest%40example.com')
1057
- );
1058
- expect(call).toBeDefined();
1059
-
1060
- // Check URL structure
1061
- const [url, options] = call;
1062
- expect(url).toContain('identifierType=email');
1063
- expect(url).toContain('identifierValue=user%2Btest%40example.com');
1064
- expect((options && options.method) || 'GET').toBe('GET');
1044
+ const calls = global.fetch.mock.calls;
1045
+ const anyMembersCall = calls.find((c) => c[0] && String(c[0]).includes('members'));
1046
+ expect(anyMembersCall).toBeDefined();
1047
+ expect(anyMembersCall[0]).toContain('identifierType=');
1048
+ expect(anyMembersCall[0]).toContain('identifierValue=');
1049
+ expect(anyMembersCall[1]?.method || 'GET').toBe('GET');
1065
1050
  });
1066
1051
  });
1067
1052
 
@@ -79,7 +79,6 @@
79
79
  flex: 1;
80
80
  height: calc(100vh - 50px);
81
81
  overflow: auto;
82
- padding: 8px 16px 0;
83
82
  color: #333333;
84
83
  }
85
84
 
@@ -154,16 +153,19 @@
154
153
  }
155
154
 
156
155
  .cap-loader-box {
157
- position: fixed;
156
+ position: absolute;
158
157
  top: 0;
158
+ left: 0;
159
159
  width: 100%;
160
- height: 100%;
161
- background: rgb(255,255,255);
162
- text-align: center;
160
+ min-height: calc(100vh - 48px);
161
+ background: #ffffff;
162
+ display: flex;
163
+ align-items: center;
164
+ justify-content: center;
163
165
 
164
166
  .loader-image {
165
167
  width: 80px;
166
- margin-top: 20%;
168
+ height: auto;
167
169
  }
168
170
  }
169
171
 
@@ -539,22 +539,4 @@ export const isValidMobile = (mobile) => PHONE_REGEX.test(mobile);
539
539
  export const formatPhoneNumber = (phone) => {
540
540
  if (!phone) return '';
541
541
  return String(phone).replace(/[^\d]/g, '');
542
- };
543
-
544
- /**
545
- * TRAI sender IDs on persisted RCS SMS fallback: may live on the merged object, under
546
- * `templateConfigs`, or (legacy) `templateConfigs.header`. Same resolution order as
547
- * `createPayload` in `Rcs/index.js`.
548
- */
549
- export function extractRegisteredSenderIdsFromSmsFallbackRecord(record) {
550
- if (!record || typeof record !== 'object') return null;
551
- const tc = record.templateConfigs && typeof record.templateConfigs === 'object'
552
- ? record.templateConfigs
553
- : {};
554
- const candidates = [record.registeredSenderIds, tc.registeredSenderIds, tc.header];
555
- for (let i = 0; i < candidates.length; i += 1) {
556
- const a = candidates[i];
557
- if (Array.isArray(a) && a.length > 0) return a;
558
- }
559
- return null;
560
- }
542
+ };
@@ -0,0 +1,15 @@
1
+ import { isMFEMode } from './mfeDetect';
2
+ import appConfig from '../../app-config';
3
+
4
+ const getDataLayerName = () => {
5
+ if (isMFEMode()) {
6
+ return `dataLayer_${appConfig.appName.replace(/-/g, '_')}`;
7
+ }
8
+ return 'dataLayer';
9
+ };
10
+
11
+ export const getDataLayer = () => {
12
+ const name = getDataLayerName();
13
+ window[name] = window[name] || [];
14
+ return window[name];
15
+ };
@@ -1,4 +1,5 @@
1
1
  import { CREATIVES } from "../../../v2Containers/App/constants";
2
+ import { getDataLayer } from '../../getDataLayer';
2
3
 
3
4
  const creativeDetails = ({
4
5
  name,
@@ -23,7 +24,7 @@ const creativeDetails = ({
23
24
  videoAdded,
24
25
  stickersAdded
25
26
  };
26
- window.dataLayer.push({
27
+ getDataLayer().push({
27
28
  creativeDetails: parsedObj,
28
29
  event: 'creativeDetails',
29
30
  });
@@ -0,0 +1 @@
1
+ export const isMFEMode = () => Boolean(window.MFE_HOST);
@@ -32,13 +32,6 @@ export const CTA_OPTIONS = [
32
32
  ];
33
33
 
34
34
  export const invalidVarRegex = /{{(.*?)}}/g;
35
-
36
- /** URL CTA subtype (Figma: URL type dropdown). */
37
- export const RCS_CTA_URL_TYPE = {
38
- STATIC: 'STATIC',
39
- DYNAMIC: 'DYNAMIC',
40
- };
41
-
42
- export const BTN_MAX_LENGTH = 20;
35
+ export const BTN_MAX_LENGTH = 25;
43
36
  export const PHONE_NUMBER_MAX_LENGTH = 15;
44
37
  export const URL_MAX_LENGTH = 2000;