@antscorp/antsomi-ui 2.0.113 → 2.0.115

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 (44) hide show
  1. package/CHANGELOG.md +92 -63
  2. package/es/components/atoms/SelectAssociatedTag/SelectAssociatedTag.d.ts +5 -0
  3. package/es/components/atoms/SelectAssociatedTag/SelectAssociatedTag.js +15 -0
  4. package/es/components/atoms/SelectAssociatedTag/SelectTag.d.ts +4 -0
  5. package/es/components/atoms/SelectAssociatedTag/SelectTag.js +26 -0
  6. package/es/components/atoms/SelectAssociatedTag/constants.d.ts +11 -0
  7. package/es/components/atoms/SelectAssociatedTag/constants.js +42 -0
  8. package/es/components/atoms/SelectAssociatedTag/index.d.ts +3 -0
  9. package/es/components/atoms/SelectAssociatedTag/index.js +2 -0
  10. package/es/components/atoms/SelectAssociatedTag/styled.d.ts +7 -0
  11. package/es/components/atoms/SelectAssociatedTag/styled.js +60 -0
  12. package/es/components/atoms/SelectAssociatedTag/types.d.ts +76 -0
  13. package/es/components/atoms/SelectAssociatedTag/types.js +1 -0
  14. package/es/components/atoms/index.d.ts +1 -0
  15. package/es/components/atoms/index.js +1 -0
  16. package/es/components/icons/CircleInfoIcon.js +2 -2
  17. package/es/components/icons/LazyIcon/LazyIcon.d.ts +2 -0
  18. package/es/components/icons/LazyIcon/LazyIcon.js +2 -0
  19. package/es/components/molecules/InputSelectAttribute/index.d.ts +25 -0
  20. package/es/components/molecules/InputSelectAttribute/index.js +124 -0
  21. package/es/components/molecules/InputSelectAttribute/styled.d.ts +14 -0
  22. package/es/components/molecules/InputSelectAttribute/styled.js +33 -0
  23. package/es/components/molecules/SelectV2/styled.d.ts +3 -1
  24. package/es/components/molecules/SelectV2/styled.js +2 -2
  25. package/es/components/molecules/TagifyInput/TagifyInput.js +159 -71
  26. package/es/components/molecules/TagifyInput/constants.d.ts +24 -2
  27. package/es/components/molecules/TagifyInput/constants.js +25 -2
  28. package/es/components/molecules/TagifyInput/patternHandlers.d.ts +12 -6
  29. package/es/components/molecules/TagifyInput/patternHandlers.js +88 -43
  30. package/es/components/molecules/TagifyInput/types.d.ts +24 -3
  31. package/es/components/molecules/TagifyInput/utils.d.ts +10 -1
  32. package/es/components/molecules/TagifyInput/utils.js +82 -4
  33. package/es/components/molecules/TagifyInput/utils.style.js +81 -96
  34. package/es/components/molecules/index.d.ts +1 -0
  35. package/es/components/molecules/index.js +1 -0
  36. package/es/components/organism/AccountSharing/AccountSharing.js +18 -10
  37. package/es/components/organism/ActivityTimeline/utils.js +168 -2
  38. package/es/components/organism/LeftMenu/hooks/usePermission.js +1 -1
  39. package/es/components/organism/LeftMenu/utils/index.js +1 -1
  40. package/es/components/organism/TextEditor/TextEditor.js +17 -1
  41. package/es/components/organism/TextEditor/types.d.ts +6 -2
  42. package/es/components/organism/TextEditor/ui/Toolbar/FormattingToolbar.js +11 -6
  43. package/es/utils/cookie.js +9 -0
  44. package/package.json +5 -5
@@ -3,7 +3,7 @@ import { css } from 'styled-components';
3
3
  import { isString } from 'lodash';
4
4
  // Constants
5
5
  import { globalToken } from '@antscorp/antsomi-ui/es/constants';
6
- import { DETECT_LINK, EMOJI, INVALID_TAG, MIN_H_WRAPPER, NO_VIEW_TAG, READONLY_TAG, REMOVED_TAG, SHORT_LINK, SHORT_LINK_TYPE, SHORT_LINK_V2, TAG_COLOR, TAG_H, TAG_TYPE, } from './constants';
6
+ import { DETECT_LINK, EMOJI, ERROR_TAG, MIN_H_WRAPPER, READONLY_TAG, SHORT_LINK, SHORT_LINK_TYPE, SHORT_LINK_V2, TAG_COLOR, TAG_H, TAG_TYPE, WARNING_TAG, TAG_TYPE_LIST, PREPARING_ST, } from './constants';
7
7
  export const getTagifyStyled = ({ $maxHeight, $tagifyFullWidth }) => css `
8
8
  ${$maxHeight &&
9
9
  css `
@@ -55,62 +55,62 @@ export const getTagifyInputStyled = ({ $minWidth, $placeholder, $minWidthPlaceho
55
55
 
56
56
  ${$isSingleLineText &&
57
57
  css `
58
- white-space: nowrap;
59
- overflow: auto;
58
+ white-space: nowrap;
59
+ overflow: auto;
60
60
 
61
- br {
62
- display: none;
63
- }
61
+ br {
62
+ display: none;
63
+ }
64
64
 
65
- div, p {
66
- display: inline-block;
67
- white-space: nowrap;
68
- overflow: auto
69
- overflow-y: hidden;
70
- }
71
- `}
65
+ div,
66
+ p {
67
+ display: inline-block;
68
+ white-space: nowrap;
69
+ }
70
+ `}
72
71
  `;
73
- export const getStyledTags = () => {
74
- const getBackgroundColor = (tag) => {
75
- const { type } = tag;
76
- switch (type) {
77
- case TAG_TYPE.SHORT_LINK: {
78
- const { shortlinkType } = tag;
79
- if (!shortlinkType)
80
- break;
81
- return TAG_COLOR[SHORT_LINK][shortlinkType];
82
- }
83
- case TAG_TYPE.SHORT_LINK_V2: {
84
- const { shortlinkType } = tag;
85
- if (!shortlinkType)
86
- break;
87
- return TAG_COLOR[SHORT_LINK_V2][shortlinkType];
88
- }
89
- default: {
90
- if (!type)
91
- return 'white';
92
- return TAG_COLOR[type];
93
- }
72
+ const getBackgroundColor = (tag) => {
73
+ const { type } = tag;
74
+ switch (type) {
75
+ case TAG_TYPE.SHORT_LINK: {
76
+ const { shortlinkType } = tag;
77
+ if (!shortlinkType)
78
+ break;
79
+ return TAG_COLOR[SHORT_LINK][shortlinkType];
94
80
  }
95
- return null;
96
- };
97
- const tagTypes = Object.values(TAG_TYPE);
98
- const backgroundStyles = tagTypes
99
- .map(type => {
100
- const background = getBackgroundColor({ type });
101
- if (!background)
102
- return '';
103
- return `
104
- &[data-tag-type~='${type}'] {
105
- background: ${getBackgroundColor({ type })};
106
- };
107
- `;
108
- })
109
- .join(' ');
81
+ case TAG_TYPE.SHORT_LINK_V2: {
82
+ const { shortlinkType } = tag;
83
+ if (!shortlinkType)
84
+ break;
85
+ return TAG_COLOR[SHORT_LINK_V2][shortlinkType];
86
+ }
87
+ default: {
88
+ if (!type)
89
+ return 'white';
90
+ return TAG_COLOR[type];
91
+ }
92
+ }
93
+ return null;
94
+ };
95
+ const tagListString = TAG_TYPE_LIST.map(tagType => `[data-tag-type~='${tagType}']`).join(',');
96
+ const backgroundStyles = TAG_TYPE_LIST.map(type => {
97
+ const background = getBackgroundColor({ type });
98
+ if (!background)
99
+ return '';
110
100
  return `
101
+ &[data-tag-type~='${type}'] {
102
+ background: ${background};
103
+ }
104
+
105
+ &[data-priority-color-type~='${type}'][data-bg-color-personalize-type~='${type}'] {
106
+ background: ${background};
107
+ }
108
+ `;
109
+ }).join(' ');
110
+ export const getStyledTags = () => `
111
111
  // For case unknown tag
112
112
  &[data-tag-type]:not(:is(
113
- ${tagTypes.map(tagType => `[data-tag-type~='${tagType}']`).join(',')}
113
+ ${tagListString}
114
114
  )) {
115
115
  background: ${globalToken?.accent7};
116
116
  };
@@ -122,45 +122,60 @@ export const getStyledTags = () => {
122
122
  padding: 0;
123
123
  };
124
124
 
125
+ &[data-tag-type~='${DETECT_LINK}'] {
126
+ border-radius: unset;
127
+ max-height: fit-content;
128
+
129
+ .tagify__tag-text {
130
+ max-width: fit-content;
131
+ white-space: normal;
132
+ }
133
+ };
134
+
125
135
  &[data-tag-type~='${TAG_TYPE.SHORT_LINK}'] {
126
136
  &[data-tag-${TAG_TYPE.SHORT_LINK}-type~='${SHORT_LINK_TYPE.INDIVIDUAL}'] {
127
137
  background: ${getBackgroundColor({
128
- type: TAG_TYPE.SHORT_LINK,
129
- shortlinkType: SHORT_LINK_TYPE.INDIVIDUAL,
130
- })};
138
+ type: TAG_TYPE.SHORT_LINK,
139
+ shortlinkType: SHORT_LINK_TYPE.INDIVIDUAL,
140
+ })};
131
141
  };
132
142
 
133
143
  &[data-tag-${TAG_TYPE.SHORT_LINK}-type~='${SHORT_LINK_TYPE.GENERAL}'] {
134
144
  background: ${getBackgroundColor({
135
- type: TAG_TYPE.SHORT_LINK,
136
- shortlinkType: SHORT_LINK_TYPE.GENERAL,
137
- })};
145
+ type: TAG_TYPE.SHORT_LINK,
146
+ shortlinkType: SHORT_LINK_TYPE.GENERAL,
147
+ })};
138
148
  };
139
149
  }
140
150
 
141
151
  &[data-tag-type~='${TAG_TYPE.SHORT_LINK_V2}'] {
142
152
  &[data-tag-${TAG_TYPE.SHORT_LINK_V2}-type~='${SHORT_LINK_TYPE.INDIVIDUAL}'] {
143
153
  background: ${getBackgroundColor({
144
- type: TAG_TYPE.SHORT_LINK_V2,
145
- shortlinkType: SHORT_LINK_TYPE.INDIVIDUAL,
146
- })};
154
+ type: TAG_TYPE.SHORT_LINK_V2,
155
+ shortlinkType: SHORT_LINK_TYPE.INDIVIDUAL,
156
+ })};
147
157
  };
148
158
 
149
159
  &[data-tag-${TAG_TYPE.SHORT_LINK_V2}-type~='${SHORT_LINK_TYPE.GENERAL}'] {
150
160
  background: ${getBackgroundColor({
151
- type: TAG_TYPE.SHORT_LINK_V2,
152
- shortlinkType: SHORT_LINK_TYPE.GENERAL,
153
- })};
161
+ type: TAG_TYPE.SHORT_LINK_V2,
162
+ shortlinkType: SHORT_LINK_TYPE.GENERAL,
163
+ })};
154
164
  };
155
165
  }
156
166
  `;
157
- };
158
167
  export const getTagifyTagStyled = (_wrapperProps) => css `
159
- &[${READONLY_TAG}='true'] {
168
+ &[type='${DETECT_LINK}'] {
169
+ max-width: fit-content;
170
+ height: fit-content;
171
+ }
172
+
173
+ &[${READONLY_TAG}='true'],
174
+ &[${PREPARING_ST}='true'] {
160
175
  cursor: not-allowed;
161
176
  }
162
177
 
163
- &[${REMOVED_TAG}='true'] {
178
+ &[${ERROR_TAG}='true'] {
164
179
  ${({ $tagErrorIcon }) => $tagErrorIcon &&
165
180
  css `
166
181
  > div {
@@ -190,7 +205,7 @@ export const getTagifyTagStyled = (_wrapperProps) => css `
190
205
  `}
191
206
  }
192
207
 
193
- &[${NO_VIEW_TAG}='true'] {
208
+ &[${WARNING_TAG}='true'] {
194
209
  ${({ $tagInvalidIcon }) => $tagInvalidIcon &&
195
210
  css `
196
211
  > div {
@@ -220,36 +235,6 @@ export const getTagifyTagStyled = (_wrapperProps) => css `
220
235
  `}
221
236
  }
222
237
 
223
- &[${INVALID_TAG}='true'] {
224
- ${({ $tagInvalidIcon }) => $tagInvalidIcon &&
225
- css `
226
- > div {
227
- padding-right: 22px;
228
- position: relative;
229
-
230
- > span {
231
- &::after {
232
- content: '';
233
- position: absolute;
234
- top: 50%;
235
- right: 5px;
236
- transform: translateY(calc(-50% - 1px));
237
- width: 14px;
238
- height: 14px;
239
- display: inline-block;
240
- background-image: url(${$tagInvalidIcon});
241
- background-size: contain;
242
- background-repeat: no-repeat;
243
- }
244
- }
245
- }
246
- > div[data-tag-type] {
247
- background-color: white !important;
248
- border: 1px solid red;
249
- }
250
- `}
251
- }
252
-
253
238
  height: ${TAG_H}px;
254
239
  cursor: pointer;
255
240
 
@@ -69,6 +69,7 @@ export * from './EmojiCollections';
69
69
  export * from './EmojiPopover';
70
70
  export * from './DisplayFormat';
71
71
  export * from './CodeStructure';
72
+ export { default as InputSelectAttribute } from './InputSelectAttribute';
72
73
  export * from './FontSizeInput';
73
74
  export * from './ItemNotFound';
74
75
  export { EditorScript } from './EditorScript';
@@ -69,6 +69,7 @@ export * from './EmojiCollections';
69
69
  export * from './EmojiPopover';
70
70
  export * from './DisplayFormat';
71
71
  export * from './CodeStructure';
72
+ export { default as InputSelectAttribute } from './InputSelectAttribute';
72
73
  export * from './FontSizeInput';
73
74
  export * from './ItemNotFound';
74
75
  export { EditorScript } from './EditorScript';
@@ -159,21 +159,29 @@ export const AccountSharing = props => {
159
159
  return arrMenus;
160
160
  };
161
161
  const checkRedirectHomePage = (homePage, data, userId, newNetworkId) => {
162
- const convertedHomePage = String(homePage).replace(/:user_id/g, userId);
162
+ const newHomePage = String(homePage).replace(/:user_id/g, userId);
163
163
  if (!Array.isArray(data) || !data.length) {
164
- window.location.href = convertedHomePage;
164
+ window.location.href = newHomePage;
165
165
  return;
166
166
  }
167
167
  const arrMenus = buildListAppMenus(data, userId);
168
- if (!arrMenus.some(url => convertedHomePage.includes(url))) {
169
- // Redirect to recommendation
170
- if (env !== ENV.DEV) {
171
- window.location.assign(`${CDP_ROUTE[env || 'development']}/gen2/${newNetworkId}/dashboard/recommendation`);
172
- return;
173
- }
174
- // return redirectFirstMenu(data, userId);
168
+ if (arrMenus.some(url => newHomePage.includes(url) || url.includes(newHomePage))) {
169
+ window.location.href = newHomePage;
170
+ return;
171
+ }
172
+ const recommendationPath = `/gen2/${newNetworkId}/dashboard/recommendation`;
173
+ if (newHomePage) {
174
+ const homeUrlObj = new URL(newHomePage);
175
+ window.location.assign(`${homeUrlObj?.origin}${recommendationPath}`);
176
+ return;
175
177
  }
176
- window.location.href = convertedHomePage;
178
+ const targetEnv = {
179
+ 33167: ENV.SANDBOX,
180
+ 564890547: ENV.SANDBOX,
181
+ 564888929: ENV.STAGING,
182
+ 564891336: ENV.STAGING,
183
+ }[+newNetworkId] || ENV.PROD;
184
+ window.location.assign(`${CDP_ROUTE[targetEnv]}${recommendationPath}`);
177
185
  };
178
186
  const getAppsMenus = ({ token, userId, accountId, homePage, newNetworkId }) => {
179
187
  if (permissionDomain && token && userId && accountId) {
@@ -229,6 +229,170 @@ const handleScreenviewEvent = (itemEvent, validateExtra, data) => {
229
229
  }
230
230
  }
231
231
  };
232
+ const handleLeadFormEvent = (validateExtra, valuesReplace, infoEvent) => {
233
+ delete valuesReplace.event_name;
234
+ if (validateExtra.form_name && validateExtra.lead_source) {
235
+ valuesReplace.form_name = validateExtra.form_name;
236
+ valuesReplace.lead_source = validateExtra.lead_source;
237
+ infoEvent.translateCode = translations._EVENT_DES_LEAD_3_INFO;
238
+ }
239
+ else if (validateExtra.lead_source) {
240
+ valuesReplace.lead_source = validateExtra.lead_source;
241
+ infoEvent.translateCode = translations._EVENT_DES_LEAD_2_INFO;
242
+ }
243
+ else {
244
+ infoEvent.translateCode = translations._EVENT_DES_LEAD_0_INFO;
245
+ }
246
+ };
247
+ const handleQrScanEvent = (validateExtra, valuesReplace, infoEvent) => {
248
+ delete valuesReplace.event_name;
249
+ valuesReplace.qr_code_id = validateExtra.qr_code?.id || 'N/A';
250
+ valuesReplace.status = validateExtra.status || 'N/A';
251
+ if (validateExtra.message_content) {
252
+ valuesReplace.message_content = validateExtra.message_content;
253
+ infoEvent.translateCode = translations._EVENT_DES_SCAN_FULL;
254
+ }
255
+ else {
256
+ infoEvent.translateCode = translations._EVENT_DES_SCAN_NO_ERR;
257
+ }
258
+ };
259
+ const handleClickBannerEvent = (validateExtra, valuesReplace, infoEvent) => {
260
+ delete valuesReplace.event_name;
261
+ valuesReplace.position = validateExtra.position || 'N/A';
262
+ infoEvent.translateCode = translations._EVENT_DES_CLICK_BANNER;
263
+ };
264
+ const handleClickButtonEvent = (validateExtra, valuesReplace, infoEvent) => {
265
+ delete valuesReplace.event_name;
266
+ valuesReplace.button_label = validateExtra.button_label || 'N/A';
267
+ valuesReplace.page_cate = validateExtra.page_cate || 'N/A';
268
+ infoEvent.translateCode = translations._EVENT_DES_CLICK_BUTTON;
269
+ };
270
+ const handleViewSchemeEvent = (validateExtra, valuesReplace, infoEvent) => {
271
+ delete valuesReplace.event_name;
272
+ valuesReplace.scheme_code =
273
+ validateExtra.scheme_marketing?.scheme_code ||
274
+ validateExtra.scheme_code ||
275
+ validateExtra.scheme_marketing?.id ||
276
+ 'N/A';
277
+ infoEvent.translateCode = translations._EVENT_DES_VIEW_SCHEME_DETAILS;
278
+ };
279
+ const handleRedeemPointEvent = (validateExtra, valuesReplace, infoEvent, isSuccess) => {
280
+ delete valuesReplace.event_name;
281
+ valuesReplace.scheme_code =
282
+ validateExtra.scheme_marketing?.scheme_code ||
283
+ validateExtra.scheme_code ||
284
+ validateExtra.scheme_marketing?.id ||
285
+ 'N/A';
286
+ if (isSuccess) {
287
+ infoEvent.translateCode = translations._EVENT_DES_REDEEM_SUCCESS;
288
+ }
289
+ else {
290
+ valuesReplace.reason_fail = validateExtra.reason_fail || 'N/A';
291
+ infoEvent.translateCode = translations._EVENT_DES_REDEEM_FAIL;
292
+ }
293
+ };
294
+ const handleUpdateRoleEvent = (validateExtra, valuesReplace, infoEvent, isVisitorProfile) => {
295
+ delete valuesReplace.event_name;
296
+ valuesReplace.visitor_name = isVisitorProfile
297
+ ? translate(translations._THIS_PERSON_UPPERCASE, 'This user')
298
+ : validateExtra.users?.name || valuesReplace.customer_name;
299
+ valuesReplace.name = validateExtra.user_update_name || 'N/A';
300
+ valuesReplace.role = validateExtra.user_update_role || 'N/A';
301
+ infoEvent.translateCode = translations._EVENT_DES_UPDATE_ROLE;
302
+ };
303
+ const handleApproveRequestEvent = (validateExtra, valuesReplace, infoEvent) => {
304
+ delete valuesReplace.event_name;
305
+ valuesReplace.visitor_name = validateExtra.users?.name || valuesReplace.customer_name;
306
+ valuesReplace.name = validateExtra.user_update_name || 'N/A';
307
+ valuesReplace.reason_fail = validateExtra.reason_fail || 'N/A';
308
+ infoEvent.translateCode = translations._EVENT_DES_APPROVE_REQ;
309
+ };
310
+ const handleAddMemberEvent = (validateExtra, valuesReplace, infoEvent) => {
311
+ delete valuesReplace.event_name;
312
+ valuesReplace.visitor_name = valuesReplace.customer_name;
313
+ valuesReplace.customer_name =
314
+ validateExtra.customers?.name || validateExtra.customer_name || 'N/A';
315
+ infoEvent.translateCode = translations._EVENT_DES_ADD_MEM;
316
+ };
317
+ const handleRemoveMemberEvent = (validateExtra, valuesReplace, infoEvent) => {
318
+ delete valuesReplace.event_name;
319
+ valuesReplace.name = validateExtra.user_update_name || 'N/A';
320
+ infoEvent.translateCode = translations._EVENT_DES_REMOVE_MEM;
321
+ };
322
+ const handleRequestAccessEvent = (validateExtra, valuesReplace, infoEvent, isVisitorProfile) => {
323
+ delete valuesReplace.event_name;
324
+ // Visitor page: "This user requested to join {customer_name}"
325
+ // Customer page: "{requester_name} requested to join {customer_name}"
326
+ valuesReplace.visitor_name = isVisitorProfile
327
+ ? valuesReplace.customer_name
328
+ : validateExtra.users?.name || 'A user';
329
+ valuesReplace.customer_name =
330
+ validateExtra.customer_name || validateExtra.customers?.name || valuesReplace.customer_name;
331
+ infoEvent.translateCode = translations._EVENT_DES_REQ_ACCESS;
332
+ };
333
+ const handleShareProgramEvent = (valuesReplace, infoEvent) => {
334
+ delete valuesReplace.event_name;
335
+ infoEvent.translateCode = translations._EVENT_DES_SHARE_PROGRAM;
336
+ };
337
+ const handleEarnRewardEvent = (validateExtra, valuesReplace, infoEvent, isReferrer) => {
338
+ delete valuesReplace.event_name;
339
+ valuesReplace.reward_value = validateExtra.reward_value || 'N/A';
340
+ valuesReplace.reward_type = validateExtra.reward_type || 'N/A';
341
+ if (isReferrer) {
342
+ infoEvent.translateCode = translations._EVENT_DES_EARN_REWARD_REFERRER;
343
+ }
344
+ else {
345
+ infoEvent.translateCode = translations._EVENT_DES_EARN_REWARD_REFEREE;
346
+ }
347
+ };
348
+ const handleCustomEventByEcEa = (eType, pageType, validateExtra, valuesReplace, infoEvent, isVisitorProfile) => {
349
+ if ((eType === 'lead_formated' && pageType === 'sync') ||
350
+ (eType === 'lead_form' && pageType === 'submit')) {
351
+ handleLeadFormEvent(validateExtra, valuesReplace, infoEvent);
352
+ }
353
+ else if (eType === 'qr_code' && pageType === 'scan') {
354
+ handleQrScanEvent(validateExtra, valuesReplace, infoEvent);
355
+ }
356
+ else if (eType === 'banner' && pageType === 'click') {
357
+ handleClickBannerEvent(validateExtra, valuesReplace, infoEvent);
358
+ }
359
+ else if (eType === 'button' && pageType === 'click') {
360
+ handleClickButtonEvent(validateExtra, valuesReplace, infoEvent);
361
+ }
362
+ else if (eType === 'scheme_marketing' && pageType === 'view') {
363
+ handleViewSchemeEvent(validateExtra, valuesReplace, infoEvent);
364
+ }
365
+ else if (eType === 'point' && pageType === 'redeem_point') {
366
+ handleRedeemPointEvent(validateExtra, valuesReplace, infoEvent, true);
367
+ }
368
+ else if (eType === 'point' && pageType === 'redeem_point_fail') {
369
+ handleRedeemPointEvent(validateExtra, valuesReplace, infoEvent, false);
370
+ }
371
+ else if (eType === 'role' && pageType === 'update') {
372
+ handleUpdateRoleEvent(validateExtra, valuesReplace, infoEvent, isVisitorProfile);
373
+ }
374
+ else if (eType === 'request' && pageType === 'approve') {
375
+ handleApproveRequestEvent(validateExtra, valuesReplace, infoEvent);
376
+ }
377
+ else if (eType === 'member' && pageType.toLowerCase() === 'add') {
378
+ handleAddMemberEvent(validateExtra, valuesReplace, infoEvent);
379
+ }
380
+ else if (eType === 'member' && pageType.toLowerCase() === 'remove') {
381
+ handleRemoveMemberEvent(validateExtra, valuesReplace, infoEvent);
382
+ }
383
+ else if (eType === 'access' && pageType === 'request') {
384
+ handleRequestAccessEvent(validateExtra, valuesReplace, infoEvent, isVisitorProfile);
385
+ }
386
+ else if (eType === 'program' && pageType === 'share') {
387
+ handleShareProgramEvent(valuesReplace, infoEvent);
388
+ }
389
+ else if (eType === 'referrer' && pageType === 'earn_reward') {
390
+ handleEarnRewardEvent(validateExtra, valuesReplace, infoEvent, true);
391
+ }
392
+ else if (eType === 'referee' && pageType === 'earn_reward') {
393
+ handleEarnRewardEvent(validateExtra, valuesReplace, infoEvent, false);
394
+ }
395
+ };
232
396
  const handleEventTrackingCode = (eventTracking, keyTitleEvent, validateExtra, valuesReplace, infoEvent, config) => {
233
397
  const { story = {} } = validateExtra;
234
398
  if (eventTracking.map[keyTitleEvent]?.eventTrackingCode === 'promotion_code_sent_tracking') {
@@ -353,7 +517,7 @@ const processEventByType = (eType, itemEvent, validateExtra, data) => {
353
517
  handleScreenviewEvent(itemEvent, validateExtra, data);
354
518
  }
355
519
  };
356
- const buildInfoEvent = (infoEvent, eventTracking, keyTitleEvent, validateExtra, data, config) => {
520
+ const buildInfoEvent = (infoEvent, eventTracking, keyTitleEvent, validateExtra, data, config, eType, pageType, isVisitorProfile) => {
357
521
  let valuesReplace = {};
358
522
  if (infoEvent) {
359
523
  infoEvent.iconName = get(eventTracking, `map.${keyTitleEvent}.iconUrl`);
@@ -375,6 +539,7 @@ const buildInfoEvent = (infoEvent, eventTracking, keyTitleEvent, validateExtra,
375
539
  valuesReplace = getValuesReplace(infoEvent.objectReplace, data);
376
540
  handleEventTrackingCode(eventTracking, keyTitleEvent, validateExtra, valuesReplace, infoEvent, config);
377
541
  }
542
+ handleCustomEventByEcEa(eType, pageType, validateExtra, valuesReplace, infoEvent, isVisitorProfile);
378
543
  return { infoEvent, valuesReplace };
379
544
  };
380
545
  const buildFullContentEvent = (infoEvent, titleEvent, valuesReplace, data) => {
@@ -403,6 +568,7 @@ const calculateSlideSettings = (itemEvent, infoEvent) => {
403
568
  export const getInfoEvent = (params) => {
404
569
  const { eType, itemEvent, eventTracking, config, customerName: customerNameParam } = params;
405
570
  const customerName = customerNameParam || '_THIS_PERSON_UPPERCASE';
571
+ const isVisitorProfile = customerName === '_THIS_PERSON_UPPERCASE';
406
572
  // Step 1: Prepare initial data and extract common fields
407
573
  const { keyTitleEvent, validateExtra, titleEvent: initialTitleEvent, data, } = prepareInitialData(itemEvent, eType, eventTracking, customerName);
408
574
  // Step 2: Update titleEvent if eventTracking has a mapping
@@ -414,7 +580,7 @@ export const getInfoEvent = (params) => {
414
580
  processEventByType(eType, itemEvent, validateExtra, data);
415
581
  // Step 4: Build infoEvent and valuesReplace
416
582
  let infoEvent = DATA_EVENT.map[`${itemEvent.pageType} ${eType}`];
417
- const { infoEvent: processedInfoEvent, valuesReplace } = buildInfoEvent(infoEvent, eventTracking, keyTitleEvent, validateExtra, data, config);
583
+ const { infoEvent: processedInfoEvent, valuesReplace } = buildInfoEvent(infoEvent, eventTracking, keyTitleEvent, validateExtra, data, config, eType, itemEvent.pageType, isVisitorProfile);
418
584
  infoEvent = processedInfoEvent;
419
585
  // Step 5: Build full content event text
420
586
  const fullContentEvent = buildFullContentEvent(infoEvent, titleEvent, valuesReplace, data);
@@ -115,7 +115,7 @@ export const usePermission = () => {
115
115
  },
116
116
  });
117
117
  const flattenMenuPermission = flattenMenuArray(menuListPermission || [], 'childs');
118
- const permissionMenu = useMemo(() => recursivePermissionMenu(sortBy(menuList?.rows || [], ['level_position']), flattenMenuPermission), [menuList?.rows, flattenMenuPermission]);
118
+ const permissionMenu = useMemo(() => recursivePermissionMenu(sortBy(menuList?.rows || [], [item => Number(item?.level_position)]), flattenMenuPermission), [menuList?.rows, flattenMenuPermission]);
119
119
  const mappingChildrenMenu = useMemo(() => getMappingAppChildren({
120
120
  menuList: permissionMenu,
121
121
  auth,
@@ -86,7 +86,7 @@ export const recursivePermissionMenu = (menuItems, menuPermissions) => {
86
86
  ...item,
87
87
  ...(isArray(item.children)
88
88
  ? {
89
- children: recursivePermissionMenu(sortBy(item.children || [], ['level_position']), menuPermissions),
89
+ children: recursivePermissionMenu(sortBy(item.children || [], [item => Number(item.level_position)]), menuPermissions),
90
90
  }
91
91
  : {}),
92
92
  }))
@@ -70,6 +70,7 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
70
70
  const text = editor.getText();
71
71
  const json = editor.getJSON();
72
72
  const html = editor.getHTML();
73
+ // console.log(id, { text });
73
74
  onUpdate?.({
74
75
  html: htmlSerializerForOutput(html),
75
76
  text,
@@ -106,7 +107,7 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
106
107
  bulletList: false,
107
108
  orderedList: false,
108
109
  listItem: false,
109
- undoRedo: config?.UndoRedo ?? {
110
+ undoRedo: config?.UndoRedo && {
110
111
  depth: 100,
111
112
  },
112
113
  }),
@@ -186,7 +187,12 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
186
187
  wrapperElement: contentRef.current.parentElement,
187
188
  defaultStyle: defaultTextStyle,
188
189
  });
190
+ // console.log(
191
+ // '[ONCREATE] safeParseContent !== initialContent:',
192
+ // safeParseContent !== initialContent,
193
+ // );
189
194
  if (safeParseContent !== initialContent) {
195
+ // console.log('[ONCREATE] Calling setContent - this RESETS editor content!');
190
196
  editor.commands.setContent(safeParseContent);
191
197
  }
192
198
  const text = editor.getText();
@@ -282,6 +288,7 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
282
288
  });
283
289
  }, [editor]);
284
290
  useImperativeHandle(ref, () => ({
291
+ editor,
285
292
  setLink: params => {
286
293
  editor?.chain().setCustomLink(params).run();
287
294
  },
@@ -308,6 +315,9 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
308
315
  deleteSmartTag: handleDeleteSmartTag,
309
316
  updateSmartTagAttrs: handleUpdateSmartTagAttrs,
310
317
  blur: handleBlur,
318
+ focus() {
319
+ editor.chain().focus().run();
320
+ },
311
321
  setContent: editor.commands.setContent,
312
322
  style: contentRef.current?.style,
313
323
  }));
@@ -352,6 +362,9 @@ const TextEditorWithProvider = forwardRef((props, ref) => {
352
362
  }, [colors]);
353
363
  useImperativeHandle(ref, () => ({
354
364
  // Forward TextEditorRef methods - accessed at call time
365
+ get editor() {
366
+ return editorRef.current?.editor;
367
+ },
355
368
  get style() {
356
369
  return editorRef.current?.style;
357
370
  },
@@ -388,6 +401,9 @@ const TextEditorWithProvider = forwardRef((props, ref) => {
388
401
  get blur() {
389
402
  return editorRef.current.blur;
390
403
  },
404
+ get focus() {
405
+ return editorRef.current.focus;
406
+ },
391
407
  get setContent() {
392
408
  return editorRef.current.setContent;
393
409
  },
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { JSONContent, MarkRange } from '@tiptap/core';
2
+ import type { Editor, JSONContent, MarkRange } from '@tiptap/core';
3
3
  import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
4
4
  import type { Mark, Node } from '@tiptap/pm/model';
5
5
  import { ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STYLE_TYPE } from './constants';
@@ -29,9 +29,13 @@ export type HandleLinkRef = {
29
29
  };
30
30
  export type TextEditorRef = HandleSmartTagRef & HandleLinkRef & {
31
31
  blur: (perserveSelection?: boolean) => void;
32
+ focus: () => void;
32
33
  style?: CSSStyleDeclaration;
33
34
  getHTML?: () => string;
34
- setContent?: (text: string) => void;
35
+ setContent?: (text: string, options?: Partial<{
36
+ emitUpdate: boolean;
37
+ }>) => void;
38
+ readonly editor: Editor;
35
39
  };
36
40
  export type SmartTagHandler = Partial<{
37
41
  edit: (id: string, event: React.MouseEvent) => void;
@@ -46,15 +46,20 @@ export const FormattingToolbar = (props) => {
46
46
  letterSpacing: _jsx(LetterSpacingAction, { editor: editor }, "letterSpacing"),
47
47
  indent: _jsx(IndentAction, { editor: editor }, "indent"),
48
48
  outdent: _jsx(OutdentAction, { editor: editor }, "outdent"),
49
- history: _jsx(HistoryAction, { editor: editor }, "history"),
49
+ history: config?.UndoRedo !== false ? _jsx(HistoryAction, { editor: editor }, "history") : null,
50
50
  clearFormatting: _jsx(ClearFormattingAction, { editor: editor }, "clearFormatting"),
51
51
  }), [
52
52
  editor,
53
- config?.FontFamily,
54
- config?.UnorderedList,
55
- defaultTextStyle,
56
- linkHanlder,
57
- smartTagHandler,
53
+ config?.FontFamily?.fonts,
54
+ config?.FontFamily?.fontGroupingFn,
55
+ config?.FontFamily?.groupOrder,
56
+ config?.UnorderedList?.useCustomBullet,
57
+ config?.UndoRedo,
58
+ defaultTextStyle.fontFamily,
59
+ defaultTextStyle.fontSize,
60
+ defaultTextStyle?.lineHeight,
61
+ linkHanlder?.onUpsert,
62
+ smartTagHandler?.onUpsert,
58
63
  onChangeFont,
59
64
  ]);
60
65
  // Group actions into rows
@@ -27,6 +27,15 @@ export const removeCookieSubDomain = ({ name, env = 'development', cookieOptions
27
27
  secure: true,
28
28
  ...cookieOptions,
29
29
  });
30
+ // Remove redundant cookies setted for full domain
31
+ if (['api_token', 'api_r_token', 'api_pid'].includes(name)) {
32
+ cookies.remove(name, {
33
+ path: '/',
34
+ sameSite: 'none',
35
+ secure: true,
36
+ ...cookieOptions,
37
+ });
38
+ }
30
39
  };
31
40
  export const removeAppCookieSessionSubdomain = (args) => {
32
41
  removeCookieSubDomain(args);