@openlettermarketing/olc-react-sdk 0.0.8 → 0.0.10
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.
- package/.eslintignore +1 -0
- package/.eslintrc.cjs +18 -0
- package/.eslintrc.yml +47 -0
- package/.prettierignore +3 -0
- package/.prettierrc.yml +5 -0
- package/CHANGELOG.md +4 -0
- package/babel.config.json +10 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/examples/.eslintrc.yml +4 -0
- package/index.html +18 -0
- package/package.json +6 -6
- package/public/vite.svg +1 -0
- package/src/App.tsx +76 -0
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/input/cancel.tsx +20 -0
- package/src/assets/images/input/search.tsx +20 -0
- package/src/assets/images/modal-icons/cancelIcon.png +0 -0
- package/src/assets/images/modal-icons/del.tsx +19 -0
- package/src/assets/images/modal-icons/delete.svg +3 -0
- package/src/assets/images/modal-icons/modal-cross.tsx +23 -0
- package/src/assets/images/modal-icons/save.tsx +23 -0
- package/src/assets/images/templates/add-icon.svg +5 -0
- package/src/assets/images/templates/back-arrow.tsx +19 -0
- package/src/assets/images/templates/back-dialog-icon.png +0 -0
- package/src/assets/images/templates/back-dialog-icon.svg +3 -0
- package/src/assets/images/templates/barcode.png +0 -0
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
- package/src/assets/images/templates/black-trash-icon.svg +3 -0
- package/src/assets/images/templates/cancel.svg +4 -0
- package/src/assets/images/templates/cancelIcon.png +0 -0
- package/src/assets/images/templates/clipboard.svg +3 -0
- package/src/assets/images/templates/contact-search.svg +3 -0
- package/src/assets/images/templates/content-copy-icon.tsx +24 -0
- package/src/assets/images/templates/cross.svg +3 -0
- package/src/assets/images/templates/custom-template-icon-black.svg +3 -0
- package/src/assets/images/templates/custom-template-icon.svg +3 -0
- package/src/assets/images/templates/custom-template.tsx +23 -0
- package/src/assets/images/templates/dummy-template.svg +21 -0
- package/src/assets/images/templates/dynamic-field.tsx +119 -0
- package/src/assets/images/templates/edit-pencil-icon.tsx +21 -0
- package/src/assets/images/templates/filter-2.svg +13 -0
- package/src/assets/images/templates/info-icon.svg +12 -0
- package/src/assets/images/templates/info-icon.tsx +37 -0
- package/src/assets/images/templates/one-barcode.png +0 -0
- package/src/assets/images/templates/personal-letter.tsx +53 -0
- package/src/assets/images/templates/plus-icon.svg +5 -0
- package/src/assets/images/templates/postcard.tsx +32 -0
- package/src/assets/images/templates/professional-letter.tsx +53 -0
- package/src/assets/images/templates/real-penned-letters.tsx +57 -0
- package/src/assets/images/templates/search.svg +3 -0
- package/src/assets/images/templates/size-image-lg.tsx +20 -0
- package/src/assets/images/templates/size-image-mid.tsx +20 -0
- package/src/assets/images/templates/size-image.tsx +20 -0
- package/src/assets/images/templates/template-copy.svg +3 -0
- package/src/assets/images/templates/template-default-design.tsx +21 -0
- package/src/assets/images/templates/template-delete.svg +3 -0
- package/src/assets/images/templates/template-edit.svg +4 -0
- package/src/assets/images/templates/template-save-icon.svg +3 -0
- package/src/assets/images/templates/template-search-2.svg +9 -0
- package/src/assets/images/templates/template-search.svg +4 -0
- package/src/assets/images/templates/thumbnail.svg +10 -0
- package/src/assets/images/templates/trash-icon.svg +13 -0
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
- package/src/components/CreateTemplate/index.tsx +377 -0
- package/src/components/CreateTemplate/styles.scss +363 -0
- package/src/components/GenericUIBlocks/Button/index.tsx +21 -0
- package/src/components/GenericUIBlocks/Button/styles.scss +15 -0
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +98 -0
- package/src/components/GenericUIBlocks/Dialog/index.tsx +127 -0
- package/src/components/GenericUIBlocks/Dialog/styles.scss +106 -0
- package/src/components/GenericUIBlocks/Divider/index.tsx +12 -0
- package/src/components/GenericUIBlocks/Divider/styles.scss +7 -0
- package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +86 -0
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +77 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +24 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +9 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +53 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +34 -0
- package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
- package/src/components/GenericUIBlocks/Input/index.tsx +89 -0
- package/src/components/GenericUIBlocks/Input/styles.scss +80 -0
- package/src/components/GenericUIBlocks/Snackbar/index.tsx +66 -0
- package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
- package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
- package/src/components/SidePanel/customFields/customFieldSection.tsx +162 -0
- package/src/components/SidePanel/customFields/styles.scss +47 -0
- package/src/components/SidePanel/index.tsx +30 -0
- package/src/components/SidePanel/templates/customTemplateSection.tsx +505 -0
- package/src/components/SidePanel/templates/styles.scss +151 -0
- package/src/components/TemplateBuilder/index.tsx +295 -0
- package/src/components/TemplateBuilder/styles.scss +66 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +58 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +98 -0
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +60 -0
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
- package/src/components/TopNavigation/index.tsx +388 -0
- package/src/components/TopNavigation/styles.scss +83 -0
- package/src/importMeta.d.ts +9 -0
- package/src/index.scss +130 -0
- package/src/index.tsx +82 -0
- package/src/libs/test.ts +7 -0
- package/src/redux/actions/action-types.ts +42 -0
- package/src/redux/actions/customFieldAction.ts +28 -0
- package/src/redux/actions/snackbarActions.ts +16 -0
- package/src/redux/actions/templateActions.ts +456 -0
- package/src/redux/reducers/customFieldReducer.ts +97 -0
- package/src/redux/reducers/index.ts +14 -0
- package/src/redux/reducers/snackbarReducer.ts +41 -0
- package/src/redux/reducers/templateReducer.ts +353 -0
- package/src/redux/store.ts +18 -0
- package/src/styles/colors.scss +61 -0
- package/src/test/mocks.js +89 -0
- package/src/test/setupJest.js +1 -0
- package/src/utils/api.ts +36 -0
- package/src/utils/constants.ts +40 -0
- package/src/utils/customStyles.ts +135 -0
- package/src/utils/fetchWrapper.ts +68 -0
- package/src/utils/fonts.json +1597 -0
- package/src/utils/helper.ts +19 -0
- package/src/utils/local-storage.ts +15 -0
- package/src/utils/message.ts +71 -0
- package/src/utils/template-builder.ts +147 -0
- package/src/utils/templateRestrictedArea/biFold.ts +433 -0
- package/src/utils/templateRestrictedArea/postCard.ts +439 -0
- package/src/utils/templateRestrictedArea/professional.ts +422 -0
- package/src/utils/templateRestrictedArea/realPenned.ts +283 -0
- package/src/utils/templateRestrictedArea/triFold.ts +434 -0
- package/tsconfig.json +29 -0
- package/tsconfig.node.json +12 -0
- package/vite.config.ts +8 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.top-navigation-container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: 100%;
|
|
4
|
+
padding: 23px 20px;
|
|
5
|
+
height: 100%;
|
|
6
|
+
max-height: 70px;
|
|
7
|
+
background: var(--topbarBgColor);
|
|
8
|
+
margin: 0;
|
|
9
|
+
top: 0;
|
|
10
|
+
// z-index: 999;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
border-bottom: 0.5px solid var(--borderColor);
|
|
15
|
+
|
|
16
|
+
.middle {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: 5px;
|
|
21
|
+
p {
|
|
22
|
+
text-align: center;
|
|
23
|
+
margin-bottom: 0px;
|
|
24
|
+
font-size: 16px;
|
|
25
|
+
font-weight: 500;
|
|
26
|
+
text-overflow: ellipsis;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
color: var(--textColor);
|
|
30
|
+
}
|
|
31
|
+
div{
|
|
32
|
+
display: flex;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
border-radius: 50%;
|
|
37
|
+
padding: 5px;
|
|
38
|
+
transition: 0.1s ease-in-out all;
|
|
39
|
+
&:hover {
|
|
40
|
+
background-color: var(--iconHoverBgColor);
|
|
41
|
+
}
|
|
42
|
+
svg{
|
|
43
|
+
fill: var(--textColor);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
& button {
|
|
49
|
+
max-width: 120px !important;
|
|
50
|
+
text-transform: capitalize;
|
|
51
|
+
color: var(--textColor);
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
font-style: normal;
|
|
54
|
+
font-weight: 500;
|
|
55
|
+
line-height: normal;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& .MuiGrid-item {
|
|
59
|
+
padding-top: 0 !important;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
& .left {
|
|
63
|
+
justify-content: flex-start !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
& .right {
|
|
67
|
+
gap: 10px !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.actionsBtnWrapper {
|
|
71
|
+
display: flex;
|
|
72
|
+
justify-content: flex-end;
|
|
73
|
+
align-items: center;
|
|
74
|
+
flex-wrap: wrap;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.templateCreateBtn {
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 5px;
|
|
82
|
+
}
|
|
83
|
+
}
|
package/src/index.scss
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
// scroll bars colors
|
|
3
|
+
--sb-track-color: #fff8ee;
|
|
4
|
+
--sb-thumb-color: hsl(29, 100%, 88%);
|
|
5
|
+
// primary color
|
|
6
|
+
--primaryColor: #ed5c2f;
|
|
7
|
+
--svgColor: #fdb515;
|
|
8
|
+
// text colors
|
|
9
|
+
--textColor: #000;
|
|
10
|
+
// product Card Background color
|
|
11
|
+
--productCardBgColor: #fff;
|
|
12
|
+
--productCardBackgroundColorActive: #fff8ee;
|
|
13
|
+
// post Card Background colors
|
|
14
|
+
--postCardBgColor: #fff;
|
|
15
|
+
--postCardBackgroundColorActive: #fff8ee;
|
|
16
|
+
--postCardSVGColor: #fdecd3;
|
|
17
|
+
// input colors
|
|
18
|
+
--inputBgColor: #fff;
|
|
19
|
+
--inputTextColor: #000;
|
|
20
|
+
--inputBorderColor: #303030;
|
|
21
|
+
--inputSearchAppliedBg: #fff8ee;
|
|
22
|
+
--inputSearchIcon: #303030;
|
|
23
|
+
// select input & option colors
|
|
24
|
+
--selectBgColor: transparent;
|
|
25
|
+
--selectTextColor: #000;
|
|
26
|
+
--selectBorderColor: #303030;
|
|
27
|
+
--selectMenuBgColor: #fff;
|
|
28
|
+
--selectOptionTextColor: #000;
|
|
29
|
+
--selectOptionBorderColor: #5454544d;
|
|
30
|
+
--selectOptionFocusedColor: #fff8ee;
|
|
31
|
+
--selectOptionFocusedTextColor: #000;
|
|
32
|
+
--selectOptionSelectedColor: #fff8ee;
|
|
33
|
+
--selectOptionSelectedTextColor: #000;
|
|
34
|
+
--selectOptionSelectedBg: #FFF8EE;
|
|
35
|
+
// template builder colors
|
|
36
|
+
--topbarBgColor: #fff;
|
|
37
|
+
--sidepanelBgColor: #fff;
|
|
38
|
+
--sidepanelTextColor: #303030;
|
|
39
|
+
--sidepanelSVGColor: #303030;
|
|
40
|
+
--sidepanelSVGColorActive: #ed5c2f;
|
|
41
|
+
--sidepanelOptionHoverColor: #fff8ee;
|
|
42
|
+
// custom fields colors
|
|
43
|
+
--customFieldBorderColor: #303030;
|
|
44
|
+
--customFieldTextColor: #303030;
|
|
45
|
+
--customFieldCopySVGColor: #303030;
|
|
46
|
+
// builder Layer colors
|
|
47
|
+
--cardBgColor: transparent;
|
|
48
|
+
--cardTextColor: #000;
|
|
49
|
+
// dialog Modal colors
|
|
50
|
+
--dialogModalBgColor: #fff8ee;
|
|
51
|
+
--dialogModalHeadingColor: #ed5c2f;
|
|
52
|
+
--dialogModalTextColor: #000;
|
|
53
|
+
--dialogModalSVGColor: #ed5c2f;
|
|
54
|
+
// border colors
|
|
55
|
+
--borderColor: rgba(0, 0, 0, 0.5);
|
|
56
|
+
// button colors
|
|
57
|
+
--secondaryButtonBgColor: #fff;
|
|
58
|
+
--secondaryButtonTextColor: #000;
|
|
59
|
+
--primaryButtonBgColor: #ed5c2f;
|
|
60
|
+
--primaryButtonTextColor: #fff;
|
|
61
|
+
// topbar colors
|
|
62
|
+
--iconHoverBgColor: rgba(0, 0, 0, 0.076);
|
|
63
|
+
// footer bg color
|
|
64
|
+
--footerBgColor: #fff;
|
|
65
|
+
// red shades
|
|
66
|
+
--red: #ff0000;
|
|
67
|
+
|
|
68
|
+
body {
|
|
69
|
+
font-family: 'Inter', sans-serif !important;
|
|
70
|
+
padding: 70px 0 0;
|
|
71
|
+
margin: 0;
|
|
72
|
+
|
|
73
|
+
&::-webkit-scrollbar {
|
|
74
|
+
width: 10px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&::-webkit-scrollbar-track {
|
|
78
|
+
background: var(--sb-track-color) !important;
|
|
79
|
+
border-radius: 3px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&::-webkit-scrollbar-thumb {
|
|
83
|
+
background: var(--sb-thumb-color) !important;
|
|
84
|
+
border-radius: 3px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@supports not selector(::-webkit-scrollbar) {
|
|
88
|
+
body {
|
|
89
|
+
scrollbar-color: var(--sb-thumb-color) var(--sb-track-color);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.bp5-navbar {
|
|
94
|
+
z-index: auto !important;
|
|
95
|
+
color: var(--textColor);
|
|
96
|
+
background-color: var(--mainBackgroundColor);
|
|
97
|
+
.bp5-card {
|
|
98
|
+
color: var(--cardTextColor);
|
|
99
|
+
background-color: var(--cardBgColor);
|
|
100
|
+
}
|
|
101
|
+
.bp5-button-text {
|
|
102
|
+
color: var(--textColor);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.go4160152499,
|
|
107
|
+
.polotno-workspace-inner,
|
|
108
|
+
.polotno-panel-container > div > div > div {
|
|
109
|
+
&::-webkit-scrollbar {
|
|
110
|
+
width: 10px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&::-webkit-scrollbar-track {
|
|
114
|
+
background: var(--sb-track-color) !important;
|
|
115
|
+
border-radius: 3px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&::-webkit-scrollbar-thumb {
|
|
119
|
+
background: var(--sb-thumb-color) !important;
|
|
120
|
+
border-radius: 3px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@supports not selector(::-webkit-scrollbar) {
|
|
124
|
+
body {
|
|
125
|
+
scrollbar-color: var(--sb-thumb-color) var(--sb-track-color);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom/client';
|
|
3
|
+
import { setApiKey, setMode } from './utils/helper';
|
|
4
|
+
import { BrowserRouter as Router } from 'react-router-dom';
|
|
5
|
+
import { Provider } from 'react-redux';
|
|
6
|
+
import store from './redux/store';
|
|
7
|
+
import App from './App';
|
|
8
|
+
import GenericSnackbar from './components/GenericUIBlocks/GenericSnackbar';
|
|
9
|
+
|
|
10
|
+
import './index.scss';
|
|
11
|
+
|
|
12
|
+
// fonts
|
|
13
|
+
import '@fontsource/inter/400.css';
|
|
14
|
+
import '@fontsource/inter/700.css';
|
|
15
|
+
import '@fontsource/inter/600.css';
|
|
16
|
+
import '@fontsource/inter/500.css';
|
|
17
|
+
|
|
18
|
+
// utils
|
|
19
|
+
import { CustomCSSProperties } from './utils/customStyles';
|
|
20
|
+
|
|
21
|
+
interface TemplateBuilderProps {
|
|
22
|
+
container: HTMLElement | null;
|
|
23
|
+
apiKey: string;
|
|
24
|
+
mode: 'test' | 'live';
|
|
25
|
+
secretKey: string;
|
|
26
|
+
returnRoute?: string | null;
|
|
27
|
+
styles?: {
|
|
28
|
+
root?: CustomCSSProperties;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const TemplateBuilder = ({
|
|
33
|
+
container,
|
|
34
|
+
apiKey,
|
|
35
|
+
secretKey,
|
|
36
|
+
mode,
|
|
37
|
+
returnRoute,
|
|
38
|
+
styles,
|
|
39
|
+
}: TemplateBuilderProps): void => {
|
|
40
|
+
if (!container) {
|
|
41
|
+
throw new Error('Root element not found');
|
|
42
|
+
}
|
|
43
|
+
if (!apiKey) {
|
|
44
|
+
throw new Error('apiKey not found');
|
|
45
|
+
}
|
|
46
|
+
if (!secretKey) {
|
|
47
|
+
throw new Error('secretKey not found');
|
|
48
|
+
}
|
|
49
|
+
setApiKey(apiKey);
|
|
50
|
+
setMode(mode);
|
|
51
|
+
const root = ReactDOM.createRoot(container);
|
|
52
|
+
root.render(
|
|
53
|
+
<React.StrictMode>
|
|
54
|
+
<Router>
|
|
55
|
+
<Provider store={store}>
|
|
56
|
+
<App
|
|
57
|
+
secretKey={secretKey}
|
|
58
|
+
styles={styles}
|
|
59
|
+
returnRoute={returnRoute} />
|
|
60
|
+
<GenericSnackbar />
|
|
61
|
+
</Provider>
|
|
62
|
+
</Router>
|
|
63
|
+
</React.StrictMode>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Example to run the project locally for development. Comment out these lines when building the application
|
|
68
|
+
|
|
69
|
+
// const rootElement = document.getElementById('root');
|
|
70
|
+
// if (rootElement) {
|
|
71
|
+
// TemplateBuilder({
|
|
72
|
+
// container: rootElement,
|
|
73
|
+
// apiKey: import.meta.env.VITE_APP_ACCESS_TOKEN,
|
|
74
|
+
// mode: 'live',
|
|
75
|
+
// secretKey: import.meta.env.VITE_APP_PLOTNO_API_KEY,
|
|
76
|
+
// styles: {}
|
|
77
|
+
// });
|
|
78
|
+
// } else {
|
|
79
|
+
// console.error("Root element '#root' not found in the document.");
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
export default TemplateBuilder;
|
package/src/libs/test.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Snakbar Actions
|
|
2
|
+
export const SET_SUCCESS_SNACKBAR = 'SET_SUCCESS_SNACKBAR';
|
|
3
|
+
export const SET_ERROR_SNACKBAR = 'SET_ERROR_SNACKBAR';
|
|
4
|
+
export const CLEAR_SNACKBAR = 'CLEAR_SNACKBAR';
|
|
5
|
+
|
|
6
|
+
//Template Builder Actions
|
|
7
|
+
export const SET_DYNAMIC_FIELD_VALUE: string = 'SET_DYNAMIC_FIELD_VALUE';
|
|
8
|
+
export const SET_DYNAMIC_FIELDS: string = 'SET_DYNAMIC_FIELDS';
|
|
9
|
+
export const UPDATE_DYNAMIC_FIELDS: string = 'UPDATE_DYNAMIC_FIELDS';
|
|
10
|
+
export const UPDATE_CONTACT_FIELDS: string = 'UPDATE_CONTACT_FIELDS';
|
|
11
|
+
export const REMOVE_FROM_DYNAMIC_FIELDS: string = 'REMOVE_FROM_DYNAMIC_FIELDS';
|
|
12
|
+
export const GET_PRODUCTS: string = 'GET_PRODUCTS';
|
|
13
|
+
export const CLEAR_DYNAMIC_FIELDS: string = 'CLEAR_DYNAMIC_FIELDS';
|
|
14
|
+
export const CLEAR_FIELDS: string = 'CLEAR_FIELDS';
|
|
15
|
+
|
|
16
|
+
// Templates Action
|
|
17
|
+
export const GET_ALL_TEMPLATES: string = 'GET_ALL_TEMPLATES';
|
|
18
|
+
export const GET_ONE_TEMPLATE: string = 'GET_ONE_TEMPLATE';
|
|
19
|
+
export const TEMPLATE_LOADING: string = 'TEMPLATE_LOADING';
|
|
20
|
+
export const TEMPLATE_PAGINATION_CHANGE: string = 'TEMPLATE_PAGINATION_CHANGE';
|
|
21
|
+
export const TEMPLATE_SEARCH: string = 'TEMPLATE_SEARCH';
|
|
22
|
+
export const CLEAR_ALL_TEMPLATE: string = 'CLEAR_ALL_TEMPLATE';
|
|
23
|
+
export const CLEAR_TEMPLATE_FIELDS: string = 'CLEAR_TEMPLATE_FIELDS';
|
|
24
|
+
export const GET_DYNAMIC_FIELDS_FROM_SERVER: string = 'GET_DYNAMIC_FIELDS_FROM_SERVER';
|
|
25
|
+
export const LOAD_DATA_FROM_LOCAL_STORAGE: string = 'LOAD_DATA_FROM_LOCAL_STORAGE';
|
|
26
|
+
export const CLEAR_TEMPLATE: string = 'CLEAR_TEMPLATE';
|
|
27
|
+
|
|
28
|
+
//Product
|
|
29
|
+
export const SELECT_PRODUCT: string = 'SELECT_PRODUCT';
|
|
30
|
+
export const SELECT_POSTCARD: string = 'SELECT_POSTCARD';
|
|
31
|
+
|
|
32
|
+
// Product Actions
|
|
33
|
+
export const SET_PRODUCT_TYPES: string = 'SET_PRODUCT_TYPES';
|
|
34
|
+
export const SET_PRODUCT_DETAILS: string = 'SET_PRODUCT_DETAILS';
|
|
35
|
+
export const SET_PRODUCTS_DATA: string = 'SET_PRODUCTS_DATA';
|
|
36
|
+
|
|
37
|
+
export const CLEAR_REDUX: string = 'CLEAR_REDUX';
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
// TODO : Replace these with current ones
|
|
41
|
+
export const FETCH_TEMPLATES_REQUEST: string = 'FETCH_TEMPLATES_REQUEST';
|
|
42
|
+
export const SET_TEMPLATES: string = 'SET_TEMPLATES';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AppDispatch } from '../store';
|
|
2
|
+
import { get } from '../../utils/api';
|
|
3
|
+
|
|
4
|
+
export const FETCH_CUSTOM_FIELDS_REQUEST = 'FETCH_CUSTOM_FIELDS_REQUEST';
|
|
5
|
+
export const SET_CUSTOM_FIELDS = 'SET_CUSTOM_FIELDS';
|
|
6
|
+
|
|
7
|
+
const fetchCustomFieldsRequest = () => ({
|
|
8
|
+
type: FETCH_CUSTOM_FIELDS_REQUEST,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const fetchCustomFieldsSuccess = (fields: any[]) => ({
|
|
12
|
+
type: SET_CUSTOM_FIELDS,
|
|
13
|
+
payload: fields,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const fetchCustomFields = () => {
|
|
17
|
+
return async (dispatch: AppDispatch) => {
|
|
18
|
+
dispatch(fetchCustomFieldsRequest());
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const response = await get('custom-fields');
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
dispatch(fetchCustomFieldsSuccess(response?.data));
|
|
24
|
+
} catch (error: any) {
|
|
25
|
+
console.error('Failed to fetch custom fields:', error);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AppDispatch } from "../store";
|
|
2
|
+
import { SET_SUCCESS_SNACKBAR, SET_ERROR_SNACKBAR, CLEAR_SNACKBAR } from "./action-types"
|
|
3
|
+
|
|
4
|
+
const success = (message: string, heading: string = '') => (dispatch: AppDispatch) => {
|
|
5
|
+
dispatch({ type: SET_SUCCESS_SNACKBAR, payload: { message, heading } });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const failure = (message: string, heading: string = '') => (dispatch: AppDispatch) => {
|
|
9
|
+
dispatch({ type: SET_ERROR_SNACKBAR, payload: { message, heading } });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const closeSnackbar = () => (dispatch: AppDispatch) => {
|
|
13
|
+
dispatch({ type: CLEAR_SNACKBAR });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { success, failure, closeSnackbar }
|