@openlettermarketing/olc-react-sdk 0.0.18 → 0.0.20

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 (138) hide show
  1. package/build/index.js +3 -3
  2. package/build/index.js.map +1 -1
  3. package/build/types/App.d.ts +1 -0
  4. package/build/types/components/TemplateBuilder/index.d.ts +1 -0
  5. package/build/types/components/TopNavigation/index.d.ts +1 -0
  6. package/build/types/index.d.ts +3 -2
  7. package/package.json +1 -1
  8. package/.eslintignore +0 -1
  9. package/.eslintrc.cjs +0 -18
  10. package/.eslintrc.yml +0 -47
  11. package/.prettierignore +0 -3
  12. package/.prettierrc.yml +0 -5
  13. package/CHANGELOG.md +0 -4
  14. package/babel.config.json +0 -10
  15. package/examples/.eslintrc.yml +0 -4
  16. package/index.html +0 -18
  17. package/public/vite.svg +0 -1
  18. package/src/App.tsx +0 -72
  19. package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
  20. package/src/assets/images/input/cancel.tsx +0 -20
  21. package/src/assets/images/input/search.tsx +0 -20
  22. package/src/assets/images/modal-icons/cancelIcon.png +0 -0
  23. package/src/assets/images/modal-icons/del.tsx +0 -19
  24. package/src/assets/images/modal-icons/delete.svg +0 -3
  25. package/src/assets/images/modal-icons/modal-cross.tsx +0 -23
  26. package/src/assets/images/modal-icons/save.tsx +0 -23
  27. package/src/assets/images/templates/add-icon.svg +0 -5
  28. package/src/assets/images/templates/back-arrow.tsx +0 -19
  29. package/src/assets/images/templates/back-dialog-icon.png +0 -0
  30. package/src/assets/images/templates/back-dialog-icon.svg +0 -3
  31. package/src/assets/images/templates/barcode.png +0 -0
  32. package/src/assets/images/templates/bi-fold-self-mailers.tsx +0 -28
  33. package/src/assets/images/templates/black-trash-icon.svg +0 -3
  34. package/src/assets/images/templates/cancel.svg +0 -4
  35. package/src/assets/images/templates/cancelIcon.png +0 -0
  36. package/src/assets/images/templates/clipboard.svg +0 -3
  37. package/src/assets/images/templates/contact-search.svg +0 -3
  38. package/src/assets/images/templates/content-copy-icon.tsx +0 -24
  39. package/src/assets/images/templates/cross.svg +0 -3
  40. package/src/assets/images/templates/custom-template-icon-black.svg +0 -3
  41. package/src/assets/images/templates/custom-template-icon.svg +0 -3
  42. package/src/assets/images/templates/custom-template.tsx +0 -23
  43. package/src/assets/images/templates/dummy-template.svg +0 -21
  44. package/src/assets/images/templates/dynamic-field.tsx +0 -119
  45. package/src/assets/images/templates/edit-pencil-icon.tsx +0 -21
  46. package/src/assets/images/templates/filter-2.svg +0 -13
  47. package/src/assets/images/templates/info-icon.svg +0 -12
  48. package/src/assets/images/templates/info-icon.tsx +0 -37
  49. package/src/assets/images/templates/one-barcode.png +0 -0
  50. package/src/assets/images/templates/personal-letter.tsx +0 -53
  51. package/src/assets/images/templates/plus-icon.svg +0 -5
  52. package/src/assets/images/templates/postcard.tsx +0 -32
  53. package/src/assets/images/templates/professional-letter.tsx +0 -53
  54. package/src/assets/images/templates/real-penned-letters.tsx +0 -57
  55. package/src/assets/images/templates/search.svg +0 -3
  56. package/src/assets/images/templates/size-image-lg.tsx +0 -20
  57. package/src/assets/images/templates/size-image-mid.tsx +0 -20
  58. package/src/assets/images/templates/size-image.tsx +0 -20
  59. package/src/assets/images/templates/template-copy.svg +0 -3
  60. package/src/assets/images/templates/template-default-design.tsx +0 -21
  61. package/src/assets/images/templates/template-delete.svg +0 -3
  62. package/src/assets/images/templates/template-edit.svg +0 -4
  63. package/src/assets/images/templates/template-save-icon.svg +0 -3
  64. package/src/assets/images/templates/template-search-2.svg +0 -9
  65. package/src/assets/images/templates/template-search.svg +0 -4
  66. package/src/assets/images/templates/thumbnail.svg +0 -10
  67. package/src/assets/images/templates/trash-icon.svg +0 -13
  68. package/src/assets/images/templates/tri-fold-self-mailers.tsx +0 -93
  69. package/src/components/CreateTemplate/index.tsx +0 -379
  70. package/src/components/CreateTemplate/styles.scss +0 -363
  71. package/src/components/GenericUIBlocks/Button/index.tsx +0 -21
  72. package/src/components/GenericUIBlocks/Button/styles.scss +0 -15
  73. package/src/components/GenericUIBlocks/CircularProgress/index.tsx +0 -18
  74. package/src/components/GenericUIBlocks/CircularProgress/styles.scss +0 -98
  75. package/src/components/GenericUIBlocks/Dialog/index.tsx +0 -127
  76. package/src/components/GenericUIBlocks/Dialog/styles.scss +0 -106
  77. package/src/components/GenericUIBlocks/Divider/index.tsx +0 -12
  78. package/src/components/GenericUIBlocks/Divider/styles.scss +0 -7
  79. package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +0 -86
  80. package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +0 -77
  81. package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +0 -24
  82. package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +0 -9
  83. package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +0 -53
  84. package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +0 -34
  85. package/src/components/GenericUIBlocks/Grid/index.tsx +0 -82
  86. package/src/components/GenericUIBlocks/Input/index.tsx +0 -89
  87. package/src/components/GenericUIBlocks/Input/styles.scss +0 -80
  88. package/src/components/GenericUIBlocks/Typography/index.tsx +0 -18
  89. package/src/components/GenericUIBlocks/Typography/styles.scss +0 -27
  90. package/src/components/SidePanel/customFields/customFieldSection.tsx +0 -173
  91. package/src/components/SidePanel/customFields/styles.scss +0 -47
  92. package/src/components/SidePanel/index.tsx +0 -42
  93. package/src/components/SidePanel/templates/customTemplateSection.tsx +0 -503
  94. package/src/components/SidePanel/templates/styles.scss +0 -151
  95. package/src/components/TemplateBuilder/index.tsx +0 -301
  96. package/src/components/TemplateBuilder/styles.scss +0 -66
  97. package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +0 -58
  98. package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +0 -123
  99. package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +0 -98
  100. package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +0 -88
  101. package/src/components/TopNavigation/SaveTemplateModel/index.tsx +0 -60
  102. package/src/components/TopNavigation/SaveTemplateModel/styles.scss +0 -128
  103. package/src/components/TopNavigation/index.tsx +0 -405
  104. package/src/components/TopNavigation/styles.scss +0 -83
  105. package/src/importMeta.d.ts +0 -9
  106. package/src/index.scss +0 -137
  107. package/src/index.tsx +0 -80
  108. package/src/libs/test.ts +0 -7
  109. package/src/redux/actions/action-types.ts +0 -42
  110. package/src/redux/actions/customFieldAction.ts +0 -28
  111. package/src/redux/actions/snackbarActions.ts +0 -16
  112. package/src/redux/actions/templateActions.ts +0 -456
  113. package/src/redux/reducers/customFieldReducer.ts +0 -97
  114. package/src/redux/reducers/index.ts +0 -14
  115. package/src/redux/reducers/snackbarReducer.ts +0 -41
  116. package/src/redux/reducers/templateReducer.ts +0 -353
  117. package/src/redux/store.ts +0 -18
  118. package/src/styles/colors.scss +0 -61
  119. package/src/test/mocks.js +0 -89
  120. package/src/test/setupJest.js +0 -1
  121. package/src/utils/api.ts +0 -36
  122. package/src/utils/constants.ts +0 -40
  123. package/src/utils/customStyles.ts +0 -135
  124. package/src/utils/fetchWrapper.ts +0 -68
  125. package/src/utils/fonts.json +0 -1597
  126. package/src/utils/helper.ts +0 -19
  127. package/src/utils/local-storage.ts +0 -15
  128. package/src/utils/message.ts +0 -71
  129. package/src/utils/template-builder.ts +0 -147
  130. package/src/utils/templateRestrictedArea/biFold.ts +0 -433
  131. package/src/utils/templateRestrictedArea/postCard.ts +0 -439
  132. package/src/utils/templateRestrictedArea/professional.ts +0 -422
  133. package/src/utils/templateRestrictedArea/realPenned.ts +0 -244
  134. package/src/utils/templateRestrictedArea/triFold.ts +0 -434
  135. package/tsconfig.json +0 -29
  136. package/tsconfig.node.json +0 -12
  137. package/vite.config.ts +0 -8
  138. package/webpack.config.js +0 -80
@@ -1,27 +0,0 @@
1
- .basic-typo{
2
- font-weight: 500;
3
- margin: 0;
4
- width: 100%;
5
- margin: 0;
6
- h1{
7
- font-size: 50px;
8
- }
9
- h2{
10
- font-size: 45px;
11
- }
12
- h3{
13
- font-size: 40px;
14
- }
15
- h4{
16
- font-size: 35px;
17
- }
18
- h5{
19
- font-size: 30px;
20
- }
21
- h6{
22
- font-size: 25px;
23
- }
24
- p{
25
- font-size: 18px;
26
- }
27
- }
@@ -1,173 +0,0 @@
1
- import React from 'react';
2
- import { observer } from 'mobx-react-lite';
3
- import { SectionTab, } from 'polotno/side-panel';
4
- import { useDispatch, useSelector } from 'react-redux';
5
- import { useEffect , useState} from 'react';
6
- import type { StoreType } from 'polotno/model/store';
7
- import type { TemplatesSection } from 'polotno/side-panel';
8
- import { AppDispatch, RootState } from '../../../redux/store';
9
- import { fetchCustomFields } from '../../../redux/actions/customFieldAction';
10
- import Button from '../../GenericUIBlocks/Button';
11
- import { copyToClipboard } from '../../../utils/helper';
12
- import './styles.scss'
13
- import GeneralTootip from '../../GenericUIBlocks/GeneralTooltip';
14
- import InfoIcon from '../../../assets/images/templates/info-icon';
15
- import ContentCopyIcon from '../../..//assets/images/templates/content-copy-icon';
16
- import DynamicField from '../../../assets/images/templates/dynamic-field';
17
- import { success } from '../../../redux/actions/snackbarActions';
18
-
19
- type SideSection = typeof TemplatesSection;
20
-
21
- const iconButtonStyles= {
22
- backgroundColor: 'transparent',
23
- }
24
-
25
- const customFieldSection: SideSection = {
26
- name: 'Fields',
27
- Tab: observer(
28
- (props: {store: StoreType; active: boolean; onClick: () => void}) => (
29
- <SectionTab name="Fields" {...props}>
30
- <DynamicField stroke="var(--sidepanelSVGColor)" />
31
- </SectionTab>
32
- )
33
- ) as SideSection['Tab'],
34
-
35
- Panel: observer(({store}) => {
36
- const [isShowDialog, setIsShowDialog] = useState(false);
37
- const dispatch = useDispatch<AppDispatch>();
38
- const customFields = useSelector(
39
- (state: RootState) => state.customFields.customFields
40
- ) as Record<string, any>;
41
- const defaultDynamicFields = useSelector(
42
- (state: RootState) => state.customFields.defaultDynamicFields
43
- );
44
- const product = useSelector((state: RootState) => state.templates.product);
45
- const currentTemplateType = product?.productType;
46
-
47
- const handleShowDialog = () => {
48
- setIsShowDialog((prev) => !prev);
49
- };
50
-
51
- useEffect(() => {
52
- dispatch(fetchCustomFields());
53
- }, [dispatch]);
54
-
55
-
56
- const copyCustomFieldText = (value: string) => {
57
- if (currentTemplateType === "Real Penned Letter") {
58
- let modifiedString = value.replace(/{{/g, "((").replace(/}}/g, "))");
59
- copyToClipboard(modifiedString);
60
- dispatch(success(`${modifiedString} Copied`));
61
- } else {
62
- copyToClipboard(value);
63
- dispatch(success(`${value} Copied`));
64
- }
65
- };
66
-
67
- const handleAddElementOnScreen = (event: any, value: any, type: any) => {
68
- event.preventDefault();
69
-
70
- if (currentTemplateType === "Real Penned Letter") {
71
- copyCustomFieldText(value);
72
- return;
73
- }
74
-
75
- let x, y;
76
-
77
- if (type === 'drag') {
78
- const rect = event.currentTarget.getBoundingClientRect();
79
- x = event.clientX - rect.left;
80
- y = event.clientY - rect.top;
81
- } else {
82
- // For click events, use nativeEvent.offsetX and nativeEvent.offsetY
83
- x = store.width / 2 - 200;
84
- y = 300;
85
- }
86
- x /= store.activePage.scale;
87
- y /= store.activePage.scale;
88
-
89
- store.activePage.addElement({
90
- type: 'text',
91
- x,
92
- y,
93
- text: value,
94
- width: value.length > 15 ? 10 * value.length : 150,
95
- contentEditable: false,
96
- });
97
- };
98
-
99
- return (
100
- <div className="dynamic-content">
101
- <div className="dynamic-content__top">
102
- <div>
103
- <span className="title">Contact Fields</span>
104
- <InfoIcon fill="var(--primaryColor)" className="infoIcon" />
105
- <GeneralTootip
106
- anchorSelect=".infoIcon"
107
- place="bottom"
108
- title="Merge fields allow you to personalize your mailer with contact information."
109
- />
110
- </div>
111
- </div>
112
- {defaultDynamicFields.map(
113
- ({key, value}: {key: string; value: string}, i: number) => (
114
- <div style={{display: 'flex', alignItems: 'center'}} key={i}>
115
- <span
116
- className="contact-element"
117
- onClick={(event) =>
118
- handleAddElementOnScreen(event, key, 'click')
119
- }
120
- >
121
- {value}
122
- </span>
123
- <Button
124
- style={iconButtonStyles}
125
- onClick={() => copyCustomFieldText(key)}
126
- >
127
- <ContentCopyIcon className="copy" />
128
- </Button>
129
- </div>
130
- )
131
- )}
132
- <GeneralTootip anchorSelect=".copy" place="bottom" title="Copy" />
133
- <hr className="divider" />
134
- <div className="dynamic-content__top">
135
- <div>
136
- <span className="title">Custom Fields</span>
137
- <InfoIcon fill="var(--primaryColor)" className="custom" />
138
- <GeneralTootip
139
- anchorSelect=".custom"
140
- place="bottom"
141
- title="You can add custom fields to your template."
142
- />
143
- </div>
144
- <Button onClick={handleShowDialog}></Button>
145
- </div>
146
- {customFields?.data?.map(
147
- ({key, value}: {key: string; value: string}, i: number) => (
148
- <div style={{display: 'flex', alignItems: 'center'}} key={i}>
149
- <span
150
- className="contact-element"
151
- onClick={(event) =>
152
- handleAddElementOnScreen(event, key, 'click')
153
- }
154
- >
155
- {value}
156
- </span>
157
- <Button
158
- style={iconButtonStyles}
159
- onClick={() => copyCustomFieldText(key)}
160
- >
161
- <ContentCopyIcon
162
- className="copy"
163
- />
164
- </Button>
165
- </div>
166
- )
167
- )}
168
- </div>
169
- );
170
- }) as SideSection['Panel'],
171
- };
172
-
173
- export default customFieldSection;
@@ -1,47 +0,0 @@
1
- .dynamic-icon{
2
- width:20px;
3
- height: 20px;
4
- }
5
- .dynamic-content{
6
- & .dynamic-content__top {
7
- display: flex;
8
- flex-direction: row;
9
- justify-content: space-between;
10
- align-items: center;
11
- margin: 8px auto;
12
- & .title{
13
- font-weight: 600;
14
- font-size: 16px;
15
- line-height: 19.36px;
16
- color: var(--primaryColor);
17
- margin-right: 5px;
18
- }
19
- & .icon{
20
- width: 12px;
21
- height: 12px;
22
- cursor: pointer;
23
- }
24
- & .plus-icon{
25
- // margin-right: 6px;
26
- }
27
- }
28
-
29
- & .divider{
30
- margin-top: 10px;
31
- color: #44424145;
32
- }
33
-
34
- & .contact-element{
35
- width: 100%;
36
- border-radius: 3px;
37
- border: 0.5px solid var(--customFieldBorderColor);
38
- text-align: center;
39
- height: 35px;
40
- line-height: 35px;
41
- margin: 5px auto;
42
- color: var(--customFieldTextColor);
43
- }
44
- .copy{
45
- fill: var(--customFieldCopySVGColor) !important;
46
- }
47
- }
@@ -1,42 +0,0 @@
1
- import React from 'react';
2
-
3
- // Polotno Imports
4
- import { SidePanelWrap } from 'polotno';
5
- import type { StoreType } from 'polotno/model/store';
6
- import { SidePanel as PolotnoSidePanel, DEFAULT_SECTIONS } from 'polotno/side-panel';
7
-
8
- // Custom Sections
9
- import customTemplateSection from './templates/customTemplateSection';
10
- import customFieldSection from './customFields/customFieldSection';
11
-
12
-
13
- interface Props {
14
- store: StoreType;
15
- currentTemplateType: string;
16
- }
17
-
18
- const SidePanel: React.FC<Props> = (props) => {
19
- const sections =
20
- props.currentTemplateType === "Real Penned Letter"
21
- ? DEFAULT_SECTIONS.filter((section) => section.name === "")
22
- : DEFAULT_SECTIONS.filter(
23
- (section) => !["photos", "size", "templates"].includes(section.name)
24
- );
25
-
26
- return (
27
- <SidePanelWrap>
28
- <PolotnoSidePanel store={props.store}
29
- sections={[
30
- ...(props.currentTemplateType !== "Real Penned Letter"
31
- ? [customTemplateSection]
32
- : []),
33
- ...sections,
34
- customFieldSection,
35
- ]}
36
- defaultSection="text" />
37
- </SidePanelWrap>
38
- );
39
- };
40
-
41
-
42
- export default SidePanel;