@capillarytech/creatives-library 8.0.310-alpha.0 → 8.0.310

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 (79) hide show
  1. package/constants/unified.js +1 -5
  2. package/initialState.js +2 -0
  3. package/package.json +1 -1
  4. package/services/api.js +0 -17
  5. package/services/tests/api.test.js +0 -85
  6. package/utils/common.js +8 -5
  7. package/utils/commonUtils.js +93 -46
  8. package/utils/tagValidations.js +223 -83
  9. package/utils/tests/commonUtil.test.js +124 -316
  10. package/utils/tests/tagValidations.test.js +358 -441
  11. package/v2Components/CommonTestAndPreview/SendTestMessage.js +49 -78
  12. package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +34 -134
  13. package/v2Components/CommonTestAndPreview/actions.js +0 -10
  14. package/v2Components/CommonTestAndPreview/constants.js +1 -15
  15. package/v2Components/CommonTestAndPreview/index.js +19 -80
  16. package/v2Components/CommonTestAndPreview/messages.js +0 -94
  17. package/v2Components/CommonTestAndPreview/reducer.js +0 -10
  18. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +0 -53
  19. package/v2Components/CommonTestAndPreview/tests/constants.test.js +1 -31
  20. package/v2Components/CommonTestAndPreview/tests/index.test.js +0 -36
  21. package/v2Components/CommonTestAndPreview/tests/reducer.test.js +0 -71
  22. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +0 -377
  23. package/v2Components/CommonTestAndPreview/tests/selectors.test.js +0 -17
  24. package/v2Components/ErrorInfoNote/index.js +5 -2
  25. package/v2Components/FormBuilder/index.js +203 -137
  26. package/v2Components/FormBuilder/messages.js +8 -0
  27. package/v2Components/HtmlEditor/HTMLEditor.js +5 -0
  28. package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -0
  29. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +15 -0
  30. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +2 -1
  31. package/v2Containers/Cap/mockData.js +14 -0
  32. package/v2Containers/Cap/reducer.js +55 -3
  33. package/v2Containers/Cap/tests/reducer.test.js +102 -0
  34. package/v2Containers/CreativesContainer/SlideBoxContent.js +1 -5
  35. package/v2Containers/CreativesContainer/SlideBoxFooter.js +5 -13
  36. package/v2Containers/CreativesContainer/constants.js +0 -6
  37. package/v2Containers/CreativesContainer/index.js +7 -47
  38. package/v2Containers/Email/index.js +5 -1
  39. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +70 -23
  40. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +120 -20
  41. package/v2Containers/FTP/index.js +51 -2
  42. package/v2Containers/FTP/messages.js +4 -0
  43. package/v2Containers/InApp/index.js +107 -35
  44. package/v2Containers/InApp/tests/index.test.js +6 -17
  45. package/v2Containers/InappAdvance/index.js +112 -4
  46. package/v2Containers/InappAdvance/tests/index.test.js +0 -2
  47. package/v2Containers/Line/Container/Text/index.js +1 -0
  48. package/v2Containers/MobilePush/Create/index.js +19 -59
  49. package/v2Containers/MobilePush/Edit/index.js +20 -48
  50. package/v2Containers/MobilePushNew/index.js +32 -12
  51. package/v2Containers/MobilepushWrapper/index.js +1 -3
  52. package/v2Containers/Rcs/index.js +37 -12
  53. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +1276 -1408
  54. package/v2Containers/Sms/Create/index.js +3 -39
  55. package/v2Containers/Sms/Create/messages.js +0 -4
  56. package/v2Containers/Sms/Edit/index.js +3 -35
  57. package/v2Containers/Sms/commonMethods.js +6 -3
  58. package/v2Containers/SmsTrai/Edit/index.js +47 -11
  59. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +294 -327
  60. package/v2Containers/SmsWrapper/index.js +0 -2
  61. package/v2Containers/TemplatesV2/index.js +13 -28
  62. package/v2Containers/Viber/index.js +1 -0
  63. package/v2Containers/WebPush/Create/hooks/useTagManagement.js +3 -1
  64. package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +7 -0
  65. package/v2Containers/WebPush/Create/index.js +2 -2
  66. package/v2Containers/WebPush/Create/utils/validation.js +8 -17
  67. package/v2Containers/WebPush/Create/utils/validation.test.js +24 -44
  68. package/v2Containers/Whatsapp/index.js +17 -9
  69. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +4872 -5246
  70. package/v2Containers/Zalo/index.js +11 -3
  71. package/v2Components/CommonTestAndPreview/AddTestCustomer.js +0 -42
  72. package/v2Components/CommonTestAndPreview/CustomerCreationModal.js +0 -284
  73. package/v2Components/CommonTestAndPreview/ExistingCustomerModal.js +0 -72
  74. package/v2Components/CommonTestAndPreview/tests/AddTestCustomer.test.js +0 -66
  75. package/v2Components/CommonTestAndPreview/tests/CommonTestAndPreview.addTestCustomer.test.js +0 -657
  76. package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +0 -172
  77. package/v2Components/CommonTestAndPreview/tests/CustomerCreationModal.test.js +0 -466
  78. package/v2Components/CommonTestAndPreview/tests/ExistingCustomerModal.test.js +0 -114
  79. package/v2Containers/Sms/tests/commonMethods.test.js +0 -122
@@ -747,383 +747,6 @@ describe('CommonTestAndPreview Sagas', () => {
747
747
  });
748
748
  });
749
749
 
750
- describe('getBulkCustomerDetails', () => {
751
- it('should transform customer data successfully', () => {
752
- const fetchedUserIds = ['1', '2'];
753
- const bulkResponse = {
754
- result: {
755
- data: [
756
- {
757
- entity: {
758
- id: '1',
759
- profiles: [
760
- {
761
- firstName: 'John',
762
- lastName: 'Doe',
763
- identifiers: [
764
- { type: 'mobile', value: '1234567890' },
765
- { type: 'email', value: 'john@example.com' },
766
- ],
767
- },
768
- ],
769
- },
770
- },
771
- {
772
- entity: {
773
- id: '2',
774
- profiles: [
775
- {
776
- firstName: 'Jane',
777
- lastName: 'Doe',
778
- identifiers: [
779
- { type: 'mobile', value: '0987654321' },
780
- { type: 'email', value: 'jane@example.com' },
781
- ],
782
- },
783
- ],
784
- },
785
- },
786
- ],
787
- },
788
- };
789
-
790
- const generator = getBulkCustomerDetails({ fetchedUserIds });
791
-
792
- expect(generator.next().value).toEqual(
793
- call(Api.getBulkCustomerDetails, { userIds: fetchedUserIds })
794
- );
795
-
796
- const transformedData = [
797
- {
798
- userId: '1',
799
- name: 'John Doe',
800
- mobile: '1234567890',
801
- email: 'john@example.com',
802
- },
803
- {
804
- userId: '2',
805
- name: 'Jane Doe',
806
- mobile: '0987654321',
807
- email: 'jane@example.com',
808
- },
809
- ];
810
-
811
- expect(generator.next(bulkResponse).value).toEqual(
812
- put({
813
- type: GET_TEST_CUSTOMERS_SUCCESS,
814
- payload: { customers: transformedData },
815
- })
816
- );
817
-
818
- expect(generator.next().done).toBe(true);
819
- });
820
-
821
- it('should handle customer without mobile identifier', () => {
822
- const fetchedUserIds = ['1'];
823
- const bulkResponse = {
824
- result: {
825
- data: [
826
- {
827
- entity: {
828
- id: '1',
829
- profiles: [
830
- {
831
- firstName: 'John',
832
- lastName: 'Doe',
833
- identifiers: [
834
- { type: 'email', value: 'john@example.com' },
835
- ],
836
- },
837
- ],
838
- },
839
- },
840
- ],
841
- },
842
- };
843
-
844
- const generator = getBulkCustomerDetails({ fetchedUserIds });
845
-
846
- generator.next();
847
- const transformedData = [
848
- {
849
- userId: '1',
850
- name: 'John Doe',
851
- mobile: undefined,
852
- email: 'john@example.com',
853
- },
854
- ];
855
-
856
- expect(generator.next(bulkResponse).value).toEqual(
857
- put({
858
- type: GET_TEST_CUSTOMERS_SUCCESS,
859
- payload: { customers: transformedData },
860
- })
861
- );
862
- });
863
-
864
- it('should handle customer without email identifier', () => {
865
- const fetchedUserIds = ['1'];
866
- const bulkResponse = {
867
- result: {
868
- data: [
869
- {
870
- entity: {
871
- id: '1',
872
- profiles: [
873
- {
874
- firstName: 'John',
875
- lastName: 'Doe',
876
- identifiers: [
877
- { type: 'mobile', value: '1234567890' },
878
- ],
879
- },
880
- ],
881
- },
882
- },
883
- ],
884
- },
885
- };
886
-
887
- const generator = getBulkCustomerDetails({ fetchedUserIds });
888
-
889
- generator.next();
890
- const transformedData = [
891
- {
892
- userId: '1',
893
- name: 'John Doe',
894
- mobile: '1234567890',
895
- email: undefined,
896
- },
897
- ];
898
-
899
- expect(generator.next(bulkResponse).value).toEqual(
900
- put({
901
- type: GET_TEST_CUSTOMERS_SUCCESS,
902
- payload: { customers: transformedData },
903
- })
904
- );
905
- });
906
-
907
- it('should handle customer without identifiers', () => {
908
- const fetchedUserIds = ['1'];
909
- const bulkResponse = {
910
- result: {
911
- data: [
912
- {
913
- entity: {
914
- id: '1',
915
- profiles: [
916
- {
917
- firstName: 'John',
918
- lastName: 'Doe',
919
- identifiers: [],
920
- },
921
- ],
922
- },
923
- },
924
- ],
925
- },
926
- };
927
-
928
- const generator = getBulkCustomerDetails({ fetchedUserIds });
929
-
930
- generator.next();
931
- const transformedData = [
932
- {
933
- userId: '1',
934
- name: 'John Doe',
935
- mobile: undefined,
936
- email: undefined,
937
- },
938
- ];
939
-
940
- expect(generator.next(bulkResponse).value).toEqual(
941
- put({
942
- type: GET_TEST_CUSTOMERS_SUCCESS,
943
- payload: { customers: transformedData },
944
- })
945
- );
946
- });
947
-
948
- it('should handle empty profile', () => {
949
- const fetchedUserIds = ['1'];
950
- const bulkResponse = {
951
- result: {
952
- data: [
953
- {
954
- entity: {
955
- id: '1',
956
- profiles: [],
957
- },
958
- errors: [{ message: 'Profile not found' }],
959
- },
960
- ],
961
- },
962
- };
963
-
964
- const generator = getBulkCustomerDetails({ fetchedUserIds });
965
-
966
- generator.next();
967
- // The error is caught and put into failure action
968
- expect(generator.next(bulkResponse).value).toEqual(
969
- put({
970
- type: GET_TEST_CUSTOMERS_FAILURE,
971
- payload: { error: expect.objectContaining({ message: 'Profile not found' }) },
972
- })
973
- );
974
- });
975
-
976
- it('should handle profile with error message', () => {
977
- const fetchedUserIds = ['1'];
978
- const bulkResponse = {
979
- result: {
980
- data: [
981
- {
982
- entity: {
983
- id: '1',
984
- profiles: [],
985
- },
986
- errors: [{ message: 'Custom error' }],
987
- },
988
- ],
989
- },
990
- };
991
-
992
- const generator = getBulkCustomerDetails({ fetchedUserIds });
993
-
994
- generator.next();
995
- // The error is caught and put into failure action
996
- expect(generator.next(bulkResponse).value).toEqual(
997
- put({
998
- type: GET_TEST_CUSTOMERS_FAILURE,
999
- payload: { error: expect.objectContaining({ message: 'Custom error' }) },
1000
- })
1001
- );
1002
- });
1003
-
1004
- it('should handle profile without error message', () => {
1005
- const fetchedUserIds = ['1'];
1006
- const bulkResponse = {
1007
- result: {
1008
- data: [
1009
- {
1010
- entity: {
1011
- id: '1',
1012
- profiles: [],
1013
- },
1014
- },
1015
- ],
1016
- },
1017
- };
1018
-
1019
- const generator = getBulkCustomerDetails({ fetchedUserIds });
1020
-
1021
- generator.next();
1022
- // The error is caught and put into failure action
1023
- expect(generator.next(bulkResponse).value).toEqual(
1024
- put({
1025
- type: GET_TEST_CUSTOMERS_FAILURE,
1026
- payload: { error: expect.objectContaining({ message: 'Profile is empty' }) },
1027
- })
1028
- );
1029
- });
1030
-
1031
- it('should handle network error', () => {
1032
- const fetchedUserIds = ['1'];
1033
- const error = new Error('Network error');
1034
-
1035
- const generator = getBulkCustomerDetails({ fetchedUserIds });
1036
-
1037
- generator.next();
1038
- expect(generator.throw(error).value).toEqual(
1039
- put({
1040
- type: GET_TEST_CUSTOMERS_FAILURE,
1041
- payload: { error },
1042
- })
1043
- );
1044
- });
1045
-
1046
- it('should handle customer with missing firstName', () => {
1047
- const fetchedUserIds = ['1'];
1048
- const bulkResponse = {
1049
- result: {
1050
- data: [
1051
- {
1052
- entity: {
1053
- id: '1',
1054
- profiles: [
1055
- {
1056
- lastName: 'Doe',
1057
- identifiers: [],
1058
- },
1059
- ],
1060
- },
1061
- },
1062
- ],
1063
- },
1064
- };
1065
-
1066
- const generator = getBulkCustomerDetails({ fetchedUserIds });
1067
-
1068
- generator.next();
1069
- const transformedData = [
1070
- {
1071
- userId: '1',
1072
- name: 'undefined Doe',
1073
- mobile: undefined,
1074
- email: undefined,
1075
- },
1076
- ];
1077
-
1078
- expect(generator.next(bulkResponse).value).toEqual(
1079
- put({
1080
- type: GET_TEST_CUSTOMERS_SUCCESS,
1081
- payload: { customers: transformedData },
1082
- })
1083
- );
1084
- });
1085
-
1086
- it('should handle customer with missing lastName', () => {
1087
- const fetchedUserIds = ['1'];
1088
- const bulkResponse = {
1089
- result: {
1090
- data: [
1091
- {
1092
- entity: {
1093
- id: '1',
1094
- profiles: [
1095
- {
1096
- firstName: 'John',
1097
- identifiers: [],
1098
- },
1099
- ],
1100
- },
1101
- },
1102
- ],
1103
- },
1104
- };
1105
-
1106
- const generator = getBulkCustomerDetails({ fetchedUserIds });
1107
-
1108
- generator.next();
1109
- const transformedData = [
1110
- {
1111
- userId: '1',
1112
- name: 'John undefined',
1113
- mobile: undefined,
1114
- email: undefined,
1115
- },
1116
- ];
1117
-
1118
- expect(generator.next(bulkResponse).value).toEqual(
1119
- put({
1120
- type: GET_TEST_CUSTOMERS_SUCCESS,
1121
- payload: { customers: transformedData },
1122
- })
1123
- );
1124
- });
1125
- });
1126
-
1127
750
  describe('fetchTestCustomersSaga', () => {
1128
751
  it('should fetch test customers successfully', () => {
1129
752
  const response = {
@@ -431,23 +431,6 @@ describe('CommonTestAndPreview Selectors', () => {
431
431
  // Should handle null gracefully - returns null when prefilledValues is null
432
432
  expect(result).toBeNull();
433
433
  });
434
-
435
- it('should return undefined when commonTestAndPreview substate is missing', () => {
436
- const selector = makeSelectPrefilledValues();
437
- const result = selector(fromJS({}));
438
-
439
- expect(result).toBeUndefined();
440
- });
441
-
442
- it('should return null when prefilledValues is undefined', () => {
443
- const stateWithUndefined = fromJS({
444
- commonTestAndPreview: {},
445
- });
446
- const selector = makeSelectPrefilledValues();
447
- const result = selector(stateWithUndefined);
448
-
449
- expect(result).toBeNull();
450
- });
451
434
  });
452
435
 
453
436
  describe('makeSelectTestMessageResponse', () => {
@@ -186,6 +186,7 @@ export const ErrorInfoNote = (props) => {
186
186
  errorMessages,
187
187
  onErrorClick,
188
188
  onClose,
189
+ isLiquidEnabled = true,
189
190
  intl,
190
191
  useLegacyDisplay = false, // Use simple list display instead of tabs (for BEE Editor)
191
192
  } = props;
@@ -229,7 +230,7 @@ export const ErrorInfoNote = (props) => {
229
230
  const standardErrors = Array.isArray(rawStandardErrors) ? rawStandardErrors : [];
230
231
  const liquidErrors = Array.isArray(rawLiquidErrors) ? rawLiquidErrors : [];
231
232
  const hasStandardErrors = standardErrors.length > 0;
232
- const hasLiquidErrors = liquidErrors.length > 0;
233
+ const hasLiquidErrors = liquidErrors.length > 0 && isLiquidEnabled;
233
234
 
234
235
  if (!hasStandardErrors && !hasLiquidErrors) {
235
236
  return null;
@@ -356,7 +357,7 @@ export const ErrorInfoNote = (props) => {
356
357
  className="error-info-note__tabs"
357
358
  />
358
359
  <CapRow className="error-info-note__actions">
359
- {hasLiquidErrors && (
360
+ {hasLiquidErrors && isLiquidEnabled && (
360
361
  <CapButton
361
362
  type="flat"
362
363
  className="error-info-note__liquid-doc"
@@ -451,6 +452,7 @@ ErrorInfoNote.defaultProps = {
451
452
  },
452
453
  onErrorClick: null,
453
454
  onClose: null,
455
+ isLiquidEnabled: true,
454
456
  intl: null,
455
457
  useLegacyDisplay: false, // Use simple list display for BEE Editor
456
458
  };
@@ -477,6 +479,7 @@ ErrorInfoNote.propTypes = {
477
479
  }),
478
480
  onErrorClick: PropTypes.func,
479
481
  onClose: PropTypes.func,
482
+ isLiquidEnabled: PropTypes.bool,
480
483
  intl: PropTypes.object,
481
484
  useLegacyDisplay: PropTypes.bool, // Use simple list display for BEE Editor
482
485
  };