@openlettermarketing/olc-react-sdk 0.0.19 → 0.0.21

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 (134) hide show
  1. package/build/index.js +2 -2
  2. package/build/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/.eslintignore +0 -1
  5. package/.eslintrc.cjs +0 -18
  6. package/.eslintrc.yml +0 -47
  7. package/.prettierignore +0 -3
  8. package/.prettierrc.yml +0 -5
  9. package/CHANGELOG.md +0 -4
  10. package/babel.config.json +0 -10
  11. package/examples/.eslintrc.yml +0 -4
  12. package/index.html +0 -18
  13. package/public/vite.svg +0 -1
  14. package/src/App.tsx +0 -72
  15. package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
  16. package/src/assets/images/input/cancel.tsx +0 -20
  17. package/src/assets/images/input/search.tsx +0 -20
  18. package/src/assets/images/modal-icons/cancelIcon.png +0 -0
  19. package/src/assets/images/modal-icons/del.tsx +0 -19
  20. package/src/assets/images/modal-icons/delete.svg +0 -3
  21. package/src/assets/images/modal-icons/modal-cross.tsx +0 -23
  22. package/src/assets/images/modal-icons/save.tsx +0 -23
  23. package/src/assets/images/templates/add-icon.svg +0 -5
  24. package/src/assets/images/templates/back-arrow.tsx +0 -19
  25. package/src/assets/images/templates/back-dialog-icon.png +0 -0
  26. package/src/assets/images/templates/back-dialog-icon.svg +0 -3
  27. package/src/assets/images/templates/barcode.png +0 -0
  28. package/src/assets/images/templates/bi-fold-self-mailers.tsx +0 -28
  29. package/src/assets/images/templates/black-trash-icon.svg +0 -3
  30. package/src/assets/images/templates/cancel.svg +0 -4
  31. package/src/assets/images/templates/cancelIcon.png +0 -0
  32. package/src/assets/images/templates/clipboard.svg +0 -3
  33. package/src/assets/images/templates/contact-search.svg +0 -3
  34. package/src/assets/images/templates/content-copy-icon.tsx +0 -24
  35. package/src/assets/images/templates/cross.svg +0 -3
  36. package/src/assets/images/templates/custom-template-icon-black.svg +0 -3
  37. package/src/assets/images/templates/custom-template-icon.svg +0 -3
  38. package/src/assets/images/templates/custom-template.tsx +0 -23
  39. package/src/assets/images/templates/dummy-template.svg +0 -21
  40. package/src/assets/images/templates/dynamic-field.tsx +0 -119
  41. package/src/assets/images/templates/edit-pencil-icon.tsx +0 -21
  42. package/src/assets/images/templates/filter-2.svg +0 -13
  43. package/src/assets/images/templates/info-icon.svg +0 -12
  44. package/src/assets/images/templates/info-icon.tsx +0 -37
  45. package/src/assets/images/templates/one-barcode.png +0 -0
  46. package/src/assets/images/templates/personal-letter.tsx +0 -53
  47. package/src/assets/images/templates/plus-icon.svg +0 -5
  48. package/src/assets/images/templates/postcard.tsx +0 -32
  49. package/src/assets/images/templates/professional-letter.tsx +0 -53
  50. package/src/assets/images/templates/real-penned-letters.tsx +0 -57
  51. package/src/assets/images/templates/search.svg +0 -3
  52. package/src/assets/images/templates/size-image-lg.tsx +0 -20
  53. package/src/assets/images/templates/size-image-mid.tsx +0 -20
  54. package/src/assets/images/templates/size-image.tsx +0 -20
  55. package/src/assets/images/templates/template-copy.svg +0 -3
  56. package/src/assets/images/templates/template-default-design.tsx +0 -21
  57. package/src/assets/images/templates/template-delete.svg +0 -3
  58. package/src/assets/images/templates/template-edit.svg +0 -4
  59. package/src/assets/images/templates/template-save-icon.svg +0 -3
  60. package/src/assets/images/templates/template-search-2.svg +0 -9
  61. package/src/assets/images/templates/template-search.svg +0 -4
  62. package/src/assets/images/templates/thumbnail.svg +0 -10
  63. package/src/assets/images/templates/trash-icon.svg +0 -13
  64. package/src/assets/images/templates/tri-fold-self-mailers.tsx +0 -93
  65. package/src/components/CreateTemplate/index.tsx +0 -381
  66. package/src/components/CreateTemplate/styles.scss +0 -363
  67. package/src/components/GenericUIBlocks/Button/index.tsx +0 -21
  68. package/src/components/GenericUIBlocks/Button/styles.scss +0 -15
  69. package/src/components/GenericUIBlocks/CircularProgress/index.tsx +0 -18
  70. package/src/components/GenericUIBlocks/CircularProgress/styles.scss +0 -98
  71. package/src/components/GenericUIBlocks/Dialog/index.tsx +0 -127
  72. package/src/components/GenericUIBlocks/Dialog/styles.scss +0 -106
  73. package/src/components/GenericUIBlocks/Divider/index.tsx +0 -12
  74. package/src/components/GenericUIBlocks/Divider/styles.scss +0 -7
  75. package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +0 -86
  76. package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +0 -77
  77. package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +0 -24
  78. package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +0 -9
  79. package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +0 -53
  80. package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +0 -34
  81. package/src/components/GenericUIBlocks/Grid/index.tsx +0 -82
  82. package/src/components/GenericUIBlocks/Input/index.tsx +0 -89
  83. package/src/components/GenericUIBlocks/Input/styles.scss +0 -80
  84. package/src/components/GenericUIBlocks/Typography/index.tsx +0 -18
  85. package/src/components/GenericUIBlocks/Typography/styles.scss +0 -27
  86. package/src/components/SidePanel/customFields/customFieldSection.tsx +0 -173
  87. package/src/components/SidePanel/customFields/styles.scss +0 -47
  88. package/src/components/SidePanel/index.tsx +0 -42
  89. package/src/components/SidePanel/templates/customTemplateSection.tsx +0 -503
  90. package/src/components/SidePanel/templates/styles.scss +0 -151
  91. package/src/components/TemplateBuilder/index.tsx +0 -301
  92. package/src/components/TemplateBuilder/styles.scss +0 -66
  93. package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +0 -58
  94. package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +0 -123
  95. package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +0 -98
  96. package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +0 -88
  97. package/src/components/TopNavigation/SaveTemplateModel/index.tsx +0 -60
  98. package/src/components/TopNavigation/SaveTemplateModel/styles.scss +0 -128
  99. package/src/components/TopNavigation/index.tsx +0 -406
  100. package/src/components/TopNavigation/styles.scss +0 -83
  101. package/src/importMeta.d.ts +0 -9
  102. package/src/index.scss +0 -137
  103. package/src/index.tsx +0 -79
  104. package/src/libs/test.ts +0 -7
  105. package/src/redux/actions/action-types.ts +0 -42
  106. package/src/redux/actions/customFieldAction.ts +0 -28
  107. package/src/redux/actions/snackbarActions.ts +0 -16
  108. package/src/redux/actions/templateActions.ts +0 -456
  109. package/src/redux/reducers/customFieldReducer.ts +0 -97
  110. package/src/redux/reducers/index.ts +0 -14
  111. package/src/redux/reducers/snackbarReducer.ts +0 -41
  112. package/src/redux/reducers/templateReducer.ts +0 -353
  113. package/src/redux/store.ts +0 -18
  114. package/src/styles/colors.scss +0 -61
  115. package/src/test/mocks.js +0 -89
  116. package/src/test/setupJest.js +0 -1
  117. package/src/utils/api.ts +0 -36
  118. package/src/utils/constants.ts +0 -40
  119. package/src/utils/customStyles.ts +0 -135
  120. package/src/utils/fetchWrapper.ts +0 -68
  121. package/src/utils/fonts.json +0 -1597
  122. package/src/utils/helper.ts +0 -19
  123. package/src/utils/local-storage.ts +0 -15
  124. package/src/utils/message.ts +0 -71
  125. package/src/utils/template-builder.ts +0 -147
  126. package/src/utils/templateRestrictedArea/biFold.ts +0 -433
  127. package/src/utils/templateRestrictedArea/postCard.ts +0 -439
  128. package/src/utils/templateRestrictedArea/professional.ts +0 -422
  129. package/src/utils/templateRestrictedArea/realPenned.ts +0 -244
  130. package/src/utils/templateRestrictedArea/triFold.ts +0 -434
  131. package/tsconfig.json +0 -29
  132. package/tsconfig.node.json +0 -12
  133. package/vite.config.ts +0 -8
  134. 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;