@capillarytech/creatives-library 8.0.234 → 8.0.236-alpha.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 (83) hide show
  1. package/assets/Android.png +0 -0
  2. package/assets/iOS.png +0 -0
  3. package/constants/unified.js +1 -1
  4. package/initialReducer.js +2 -0
  5. package/package.json +1 -1
  6. package/services/api.js +5 -0
  7. package/services/tests/api.test.js +18 -0
  8. package/utils/common.js +1 -2
  9. package/utils/commonUtils.js +14 -1
  10. package/utils/transformTemplateConfig.js +0 -10
  11. package/v2Components/CapDeviceContent/index.js +61 -56
  12. package/v2Components/CapTagList/index.js +4 -0
  13. package/v2Components/HtmlEditor/HTMLEditor.js +165 -80
  14. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +532 -0
  15. package/v2Components/HtmlEditor/_htmlEditor.scss +0 -4
  16. package/v2Components/HtmlEditor/_index.lazy.scss +0 -1
  17. package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +0 -98
  18. package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +125 -148
  19. package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -0
  20. package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
  21. package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
  22. package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
  23. package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
  24. package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
  25. package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
  26. package/v2Components/HtmlEditor/constants.js +29 -20
  27. package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +158 -17
  28. package/v2Components/HtmlEditor/hooks/useInAppContent.js +53 -143
  29. package/v2Components/HtmlEditor/index.js +1 -1
  30. package/v2Components/HtmlEditor/messages.js +85 -85
  31. package/v2Components/MobilePushPreviewV2/index.js +32 -7
  32. package/v2Components/TemplatePreview/_templatePreview.scss +31 -21
  33. package/v2Components/TemplatePreview/index.js +47 -32
  34. package/v2Components/TemplatePreview/messages.js +4 -0
  35. package/v2Containers/BeeEditor/index.js +82 -80
  36. package/v2Containers/BeePopupEditor/constants.js +10 -0
  37. package/v2Containers/BeePopupEditor/index.js +180 -0
  38. package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
  39. package/v2Containers/CreativesContainer/SlideBoxContent.js +69 -34
  40. package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -1
  41. package/v2Containers/CreativesContainer/constants.js +1 -0
  42. package/v2Containers/CreativesContainer/index.js +65 -13
  43. package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +4 -12
  44. package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +15 -0
  45. package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
  46. package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
  47. package/v2Containers/InApp/actions.js +7 -0
  48. package/v2Containers/InApp/constants.js +18 -4
  49. package/v2Containers/InApp/index.js +642 -355
  50. package/v2Containers/InApp/index.scss +4 -3
  51. package/v2Containers/InApp/messages.js +7 -3
  52. package/v2Containers/InApp/reducer.js +21 -3
  53. package/v2Containers/InApp/sagas.js +29 -9
  54. package/v2Containers/InApp/selectors.js +25 -5
  55. package/v2Containers/InApp/tests/index.test.js +154 -50
  56. package/v2Containers/InApp/tests/reducer.test.js +34 -0
  57. package/v2Containers/InApp/tests/sagas.test.js +61 -9
  58. package/v2Containers/InApp/tests/selectors.test.js +612 -0
  59. package/v2Containers/InAppWrapper/components/InAppWrapperView.js +159 -0
  60. package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +256 -0
  61. package/v2Containers/InAppWrapper/constants.js +16 -0
  62. package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
  63. package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
  64. package/v2Containers/InAppWrapper/index.js +146 -0
  65. package/v2Containers/InAppWrapper/messages.js +45 -0
  66. package/v2Containers/InappAdvance/index.js +1006 -0
  67. package/v2Containers/InappAdvance/index.scss +10 -0
  68. package/v2Containers/InappAdvance/tests/index.test.js +448 -0
  69. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -0
  70. package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
  71. package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
  72. package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
  73. package/v2Containers/Rcs/index.js +3 -1
  74. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -0
  75. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
  76. package/v2Containers/TagList/index.js +65 -1
  77. package/v2Containers/Templates/_templates.scss +49 -1
  78. package/v2Containers/Templates/index.js +93 -5
  79. package/v2Containers/Templates/messages.js +4 -0
  80. package/v2Containers/Templates/reducer.js +20 -7
  81. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +8 -88
  82. package/v2Containers/Templates/tests/reducer.test.js +125 -0
  83. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -0
@@ -0,0 +1,146 @@
1
+ /*
2
+ *
3
+ * InAppWrapper
4
+ *
5
+ */
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { injectIntl, intlShape } from 'react-intl';
9
+ import { bindActionCreators } from 'redux';
10
+ import { createStructuredSelector } from 'reselect';
11
+ import withCreatives from '../../hoc/withCreatives';
12
+ import useInAppWrapper from './hooks/useInAppWrapper';
13
+ import InAppWrapperView from './components/InAppWrapperView';
14
+ import * as inAppActions from '../InApp/actions';
15
+ const InAppWrapper = (props) => {
16
+ // Destructure props for clarity before passing to hook
17
+ const {
18
+ intl,
19
+ inAppEditorType,
20
+ step,
21
+ isFullMode,
22
+ onInAppEditorTypeChange,
23
+ showNextStep,
24
+ onResetStep,
25
+ setIsLoadingContent,
26
+ isGetFormData,
27
+ getFormdata,
28
+ type,
29
+ cap,
30
+ showTemplateName,
31
+ showLiquidErrorInFooter,
32
+ onValidationFail,
33
+ forwardedTags,
34
+ selectedOfferDetails,
35
+ onPreviewContentClicked,
36
+ onTestContentClicked,
37
+ eventContextTags,
38
+ onCreateComplete,
39
+ handleClose,
40
+ templateData,
41
+ getDefaultTags,
42
+ onEnterTemplateName,
43
+ onRemoveTemplateName,
44
+ } = props;
45
+
46
+ // Pass destructured props to the custom hook
47
+ const {
48
+ templateName,
49
+ isTemplateNameEmpty,
50
+ selectedEditorType,
51
+ modes,
52
+ isShowInAppCreate,
53
+ inAppProps,
54
+ onTemplateNameChange,
55
+ onChange,
56
+ handleEditorTypeSelection,
57
+ } = useInAppWrapper({
58
+ intl,
59
+ onInAppEditorTypeChange,
60
+ inAppEditorType,
61
+ step,
62
+ showNextStep,
63
+ onResetStep,
64
+ onEnterTemplateName,
65
+ onRemoveTemplateName,
66
+ setIsLoadingContent,
67
+ isGetFormData,
68
+ getFormdata,
69
+ type,
70
+ isFullMode,
71
+ cap,
72
+ showTemplateName,
73
+ showLiquidErrorInFooter,
74
+ onValidationFail,
75
+ forwardedTags,
76
+ selectedOfferDetails,
77
+ onPreviewContentClicked,
78
+ onTestContentClicked,
79
+ eventContextTags,
80
+ onCreateComplete,
81
+ handleClose,
82
+ templateData,
83
+ getDefaultTags,
84
+ });
85
+
86
+ // Render using the presentation component with data from the hook
87
+ return (
88
+ <InAppWrapperView
89
+ inAppEditorType={inAppEditorType}
90
+ step={step}
91
+ isFullMode={isFullMode}
92
+ templateName={templateName}
93
+ onTemplateNameChange={onTemplateNameChange}
94
+ isTemplateNameEmpty={isTemplateNameEmpty}
95
+ modes={modes}
96
+ onChange={onChange}
97
+ isShowInAppCreate={isShowInAppCreate}
98
+ inAppProps={inAppProps}
99
+ handleEditorTypeSelection={handleEditorTypeSelection}
100
+ />
101
+ );
102
+ };
103
+
104
+ InAppWrapper.propTypes = {
105
+ onInAppEditorTypeChange: PropTypes.func.isRequired,
106
+ isGetFormData: PropTypes.bool,
107
+ type: PropTypes.string,
108
+ inAppEditorType: PropTypes.string,
109
+ step: PropTypes.string,
110
+ showNextStep: PropTypes.func,
111
+ getFormdata: PropTypes.func,
112
+ intl: intlShape,
113
+ cap: PropTypes.object,
114
+ onResetStep: PropTypes.func,
115
+ isFullMode: PropTypes.bool,
116
+ setIsLoadingContent: PropTypes.func,
117
+ showTemplateName: PropTypes.func,
118
+ showLiquidErrorInFooter: PropTypes.func,
119
+ onValidationFail: PropTypes.func,
120
+ forwardedTags: PropTypes.object,
121
+ selectedOfferDetails: PropTypes.array,
122
+ onPreviewContentClicked: PropTypes.func,
123
+ onTestContentClicked: PropTypes.func,
124
+ eventContextTags: PropTypes.array,
125
+ onCreateComplete: PropTypes.func,
126
+ handleClose: PropTypes.func,
127
+ templateData: PropTypes.object,
128
+ getDefaultTags: PropTypes.string,
129
+ onEnterTemplateName: PropTypes.func,
130
+ onRemoveTemplateName: PropTypes.func,
131
+ };
132
+
133
+ const mapStateToProps = createStructuredSelector({
134
+ // Add selectors here if needed
135
+ });
136
+
137
+ const mapDispatchToProps = (dispatch) => ({
138
+ actions: bindActionCreators(inAppActions, dispatch),
139
+ });
140
+
141
+ export default withCreatives({
142
+ WrappedComponent: injectIntl(InAppWrapper),
143
+ mapStateToProps,
144
+ mapDispatchToProps,
145
+ userAuth: true,
146
+ });
@@ -0,0 +1,45 @@
1
+ /*
2
+ * InAppWrapper Messages
3
+ *
4
+ * This contains all the text for the InAppWrapper component.
5
+ */
6
+ import { defineMessages } from 'react-intl';
7
+
8
+ export default defineMessages({
9
+ header: {
10
+ id: 'creatives.containersV2.InAppWrapper.header',
11
+ defaultMessage: 'Create In App Message',
12
+ },
13
+ htmlEditor: {
14
+ id: 'creatives.containersV2.InAppWrapper.htmlEditor',
15
+ defaultMessage: 'HTML editor',
16
+ },
17
+ htmlEditorDesc: {
18
+ id: 'creatives.containersV2.InAppWrapper.htmlEditorDesc',
19
+ defaultMessage: 'Use a basic HTML editor to write and format your content. Suitable if you\'re familiar with HTML.',
20
+ },
21
+ dragDropEditor: {
22
+ id: 'creatives.containersV2.InAppWrapper.dragDropEditor',
23
+ defaultMessage: 'Drag & drop editor',
24
+ },
25
+ dragDropEditorDesc: {
26
+ id: 'creatives.containersV2.InAppWrapper.dragDropEditorDesc',
27
+ defaultMessage: 'Create your content visually by dragging blocks - no coding needed. Great for quick, easy designs.',
28
+ },
29
+ creativeName: {
30
+ id: 'creatives.containersV2.InAppWrapper.creativeName',
31
+ defaultMessage: 'Creative name',
32
+ },
33
+ editorType: {
34
+ id: 'creatives.containersV2.InAppWrapper.editorType',
35
+ defaultMessage: 'Editor type',
36
+ },
37
+ emptyTemplateName: {
38
+ id: 'creatives.containersV2.InAppWrapper.emptyTemplateName',
39
+ defaultMessage: 'Please enter template name.',
40
+ },
41
+ next: {
42
+ id: 'creatives.containersV2.InAppWrapper.next',
43
+ defaultMessage: 'Next',
44
+ },
45
+ });