@capillarytech/creatives-library 9.0.15-alpha.1 → 9.0.16

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 (132) hide show
  1. package/constants/unified.js +0 -29
  2. package/global-styles.js +1 -1
  3. package/package.json +1 -1
  4. package/services/tests/api.test.js +20 -35
  5. package/utils/commonUtils.js +1 -19
  6. package/v2Components/CapActionButton/constants.js +0 -7
  7. package/v2Components/CapActionButton/index.js +109 -168
  8. package/v2Components/CapActionButton/index.scss +5 -156
  9. package/v2Components/CapActionButton/messages.js +3 -19
  10. package/v2Components/CapActionButton/tests/index.test.js +18 -42
  11. package/v2Components/CapImageUpload/index.js +2 -2
  12. package/v2Components/CapTagList/index.js +0 -10
  13. package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +48 -70
  14. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +2 -8
  15. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +21 -214
  16. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -16
  17. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +9 -83
  18. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +0 -30
  19. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +11 -60
  20. package/v2Components/CommonTestAndPreview/SendTestMessage.js +5 -10
  21. package/v2Components/CommonTestAndPreview/UnifiedPreview/RcsPreviewContent.js +23 -201
  22. package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +76 -355
  23. package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +8 -155
  24. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +0 -11
  25. package/v2Components/CommonTestAndPreview/constants.js +2 -38
  26. package/v2Components/CommonTestAndPreview/index.js +222 -761
  27. package/v2Components/CommonTestAndPreview/messages.js +3 -45
  28. package/v2Components/CommonTestAndPreview/sagas.js +6 -25
  29. package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -1
  30. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +267 -284
  31. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +65 -231
  32. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +5 -118
  33. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +0 -341
  34. package/v2Components/CommonTestAndPreview/tests/PreviewSection.test.js +1 -8
  35. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +13 -34
  36. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/RcsPreviewContent.test.js +283 -281
  37. package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +1 -199
  38. package/v2Components/CommonTestAndPreview/tests/index.test.js +4 -133
  39. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +24 -31
  40. package/v2Components/TemplatePreview/_templatePreview.scss +22 -41
  41. package/v2Components/TemplatePreview/index.js +31 -143
  42. package/v2Components/TemplatePreview/tests/index.test.js +0 -142
  43. package/v2Components/TestAndPreviewSlidebox/CustomValuesEditor.js +6 -6
  44. package/v2Components/TestAndPreviewSlidebox/index.js +1 -13
  45. package/v2Components/TestAndPreviewSlidebox/sagas.js +4 -11
  46. package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +1 -3
  47. package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +1 -4
  48. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +0 -4
  49. package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +20 -20
  50. package/v2Containers/CreativesContainer/SlideBoxContent.js +7 -36
  51. package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -14
  52. package/v2Containers/CreativesContainer/SlideBoxHeader.js +5 -36
  53. package/v2Containers/CreativesContainer/constants.js +0 -11
  54. package/v2Containers/CreativesContainer/index.js +104 -323
  55. package/v2Containers/CreativesContainer/index.scss +1 -83
  56. package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +34 -79
  57. package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +16 -79
  58. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +0 -8
  59. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +90 -333
  60. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -20
  61. package/v2Containers/CreativesContainer/tests/index.test.js +9 -71
  62. package/v2Containers/Email/index.js +5 -2
  63. package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
  64. package/v2Containers/Rcs/constants.js +11 -131
  65. package/v2Containers/Rcs/index.js +810 -2605
  66. package/v2Containers/Rcs/index.scss +8 -289
  67. package/v2Containers/Rcs/messages.js +3 -34
  68. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +38537 -73535
  69. package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +8 -0
  70. package/v2Containers/Rcs/tests/index.test.js +36 -147
  71. package/v2Containers/Rcs/tests/mockData.js +0 -38
  72. package/v2Containers/Rcs/tests/utils.test.js +30 -646
  73. package/v2Containers/Rcs/utils.js +11 -478
  74. package/v2Containers/Sms/Create/index.js +48 -115
  75. package/v2Containers/SmsTrai/Create/index.js +4 -9
  76. package/v2Containers/SmsTrai/Edit/constants.js +0 -2
  77. package/v2Containers/SmsTrai/Edit/index.js +169 -678
  78. package/v2Containers/SmsTrai/Edit/messages.js +4 -14
  79. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +2854 -5455
  80. package/v2Containers/SmsWrapper/index.js +8 -37
  81. package/v2Containers/TagList/index.js +0 -6
  82. package/v2Containers/Templates/_templates.scss +12 -171
  83. package/v2Containers/Templates/actions.js +0 -11
  84. package/v2Containers/Templates/constants.js +0 -2
  85. package/v2Containers/Templates/index.js +55 -125
  86. package/v2Containers/Templates/sagas.js +13 -57
  87. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1015 -1060
  88. package/v2Containers/Templates/tests/sagas.test.js +16 -199
  89. package/v2Containers/TemplatesV2/TemplatesV2.style.js +1 -72
  90. package/v2Containers/TemplatesV2/index.js +23 -86
  91. package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -9
  92. package/v2Containers/Whatsapp/index.js +20 -3
  93. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -578
  94. package/utils/rcsPayloadUtils.js +0 -92
  95. package/utils/templateVarUtils.js +0 -201
  96. package/utils/tests/rcsPayloadUtils.test.js +0 -226
  97. package/utils/tests/templateVarUtils.test.js +0 -204
  98. package/v2Components/CommonTestAndPreview/previewApiUtils.js +0 -59
  99. package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +0 -67
  100. package/v2Components/CommonTestAndPreview/utils.js +0 -84
  101. package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +0 -91
  102. package/v2Components/SmsFallback/constants.js +0 -94
  103. package/v2Components/SmsFallback/index.js +0 -958
  104. package/v2Components/SmsFallback/index.scss +0 -266
  105. package/v2Components/SmsFallback/messages.js +0 -78
  106. package/v2Components/SmsFallback/smsFallbackUtils.js +0 -120
  107. package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +0 -50
  108. package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +0 -147
  109. package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +0 -304
  110. package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +0 -208
  111. package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +0 -309
  112. package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +0 -422
  113. package/v2Components/SmsFallback/useLocalTemplateList.js +0 -92
  114. package/v2Components/TemplatePreview/constants.js +0 -2
  115. package/v2Components/VarSegmentMessageEditor/constants.js +0 -2
  116. package/v2Components/VarSegmentMessageEditor/index.js +0 -125
  117. package/v2Components/VarSegmentMessageEditor/index.scss +0 -46
  118. package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +0 -17
  119. package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +0 -79
  120. package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +0 -90
  121. package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +0 -258
  122. package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +0 -125
  123. package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +0 -227
  124. package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +0 -318
  125. package/v2Containers/Sms/smsFormDataHelpers.js +0 -67
  126. package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +0 -253
  127. package/v2Containers/SmsTrai/Edit/index.scss +0 -126
  128. package/v2Containers/Templates/TemplatesActionBar.js +0 -101
  129. package/v2Containers/Templates/tests/TemplatesActionBar.test.js +0 -120
  130. package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +0 -180
  131. package/v2Containers/Templates/utils/smsTemplatesListApi.js +0 -79
  132. package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +0 -131
@@ -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/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
  }
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.1",
4
+ "version": "9.0.16",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -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
 
@@ -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
+ };
@@ -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
35
  export const BTN_MAX_LENGTH = 25;
43
36
  export const PHONE_NUMBER_MAX_LENGTH = 15;
44
37
  export const URL_MAX_LENGTH = 2000;