@openlettermarketing/olc-react-sdk 2.1.7 → 2.1.8
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/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/types/version.d.ts +1 -1
- package/package.json +7 -6
- package/.eslintignore +0 -1
- package/.eslintrc.cjs +0 -18
- package/.eslintrc.yml +0 -47
- package/.github/workflows/publish-beta.yml +0 -154
- package/.github/workflows/publish-production.yml +0 -143
- package/.prettierignore +0 -3
- package/.prettierrc.yml +0 -5
- package/CHANGELOG.md +0 -4
- package/babel.config.json +0 -10
- package/examples/.eslintrc.yml +0 -4
- package/index.html +0 -18
- package/public/vite.svg +0 -1
- package/src/App.tsx +0 -209
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/create-template/prebuilt.svg +0 -13
- package/src/assets/images/create-template/scratch.svg +0 -4
- package/src/assets/images/input/cancel.tsx +0 -20
- package/src/assets/images/input/search.tsx +0 -20
- package/src/assets/images/input/select-cancel.tsx +0 -17
- package/src/assets/images/modal-icons/add.tsx +0 -36
- package/src/assets/images/modal-icons/cancel-file.tsx +0 -12
- package/src/assets/images/modal-icons/cancel-input.tsx +0 -13
- package/src/assets/images/modal-icons/cancel.tsx +0 -35
- package/src/assets/images/modal-icons/close-new.svg +0 -3
- package/src/assets/images/modal-icons/confirm-close-icon.tsx +0 -14
- package/src/assets/images/modal-icons/confirm-new.tsx +0 -22
- package/src/assets/images/modal-icons/confirm.svg +0 -12
- package/src/assets/images/modal-icons/cross.tsx +0 -23
- package/src/assets/images/modal-icons/del.tsx +0 -19
- package/src/assets/images/modal-icons/design-icon.tsx +0 -22
- package/src/assets/images/modal-icons/doc.tsx +0 -43
- package/src/assets/images/modal-icons/docx.tsx +0 -43
- package/src/assets/images/modal-icons/envelope-icon.tsx +0 -26
- package/src/assets/images/modal-icons/info.tsx +0 -19
- package/src/assets/images/modal-icons/jpeg.tsx +0 -43
- package/src/assets/images/modal-icons/jpg.tsx +0 -43
- package/src/assets/images/modal-icons/modal-cros.svg +0 -4
- package/src/assets/images/modal-icons/modal-cross.tsx +0 -37
- package/src/assets/images/modal-icons/new-cancel.tsx +0 -11
- package/src/assets/images/modal-icons/order-download.tsx +0 -42
- package/src/assets/images/modal-icons/pdf.tsx +0 -51
- package/src/assets/images/modal-icons/png.tsx +0 -43
- package/src/assets/images/modal-icons/save.tsx +0 -23
- package/src/assets/images/modal-icons/template-copy.tsx +0 -25
- package/src/assets/images/modal-icons/tool-cancel.tsx +0 -25
- package/src/assets/images/products/bi-new.svg +0 -23
- package/src/assets/images/products/left-arrow.svg +0 -17
- package/src/assets/images/products/personal-new.tsx +0 -31
- package/src/assets/images/products/postcard-new.tsx +0 -27
- package/src/assets/images/products/professional-new.tsx +0 -24
- package/src/assets/images/products/real-new.tsx +0 -30
- package/src/assets/images/products/right-arrow.svg +0 -17
- package/src/assets/images/products/snap-new.svg +0 -31
- package/src/assets/images/templates/actions.svg +0 -3
- package/src/assets/images/templates/address-block-icon.tsx +0 -62
- package/src/assets/images/templates/archive.svg +0 -3
- package/src/assets/images/templates/arrow-down.tsx +0 -27
- package/src/assets/images/templates/back-arrow.tsx +0 -19
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +0 -28
- package/src/assets/images/templates/check.svg +0 -3
- package/src/assets/images/templates/code.svg +0 -10
- package/src/assets/images/templates/content-copy-icon.tsx +0 -24
- package/src/assets/images/templates/custom-add-on-icon.tsx +0 -18
- package/src/assets/images/templates/custom-qr-section-icon.tsx +0 -9
- package/src/assets/images/templates/custom-template.tsx +0 -23
- package/src/assets/images/templates/designer.tsx +0 -43
- package/src/assets/images/templates/dot.tsx +0 -22
- package/src/assets/images/templates/download-v2.svg +0 -4
- package/src/assets/images/templates/download.svg +0 -4
- package/src/assets/images/templates/dummy-template.tsx +0 -76
- package/src/assets/images/templates/dynamic-field.tsx +0 -119
- package/src/assets/images/templates/edit-pencil-icon.tsx +0 -21
- package/src/assets/images/templates/edit.svg +0 -3
- package/src/assets/images/templates/epo-icon.tsx +0 -16
- package/src/assets/images/templates/field.tsx +0 -29
- package/src/assets/images/templates/gsv-icon.tsx +0 -31
- package/src/assets/images/templates/info-icon.tsx +0 -37
- package/src/assets/images/templates/left-arrow.svg +0 -17
- package/src/assets/images/templates/pencil.svg +0 -3
- package/src/assets/images/templates/personal-letter.tsx +0 -53
- package/src/assets/images/templates/postcard.tsx +0 -32
- package/src/assets/images/templates/professional-letter.tsx +0 -53
- package/src/assets/images/templates/qr-code.tsx +0 -13
- package/src/assets/images/templates/real-penned-letters.tsx +0 -57
- package/src/assets/images/templates/right-arrow.svg +0 -17
- package/src/assets/images/templates/size-image-lg.tsx +0 -20
- package/src/assets/images/templates/size-image-mid.tsx +0 -20
- package/src/assets/images/templates/size-image-xl.tsx +0 -20
- package/src/assets/images/templates/size-image.tsx +0 -20
- package/src/assets/images/templates/snap-pack.tsx +0 -67
- package/src/assets/images/templates/template-default-design.tsx +0 -21
- package/src/assets/images/templates/trash-upload.svg +0 -3
- package/src/assets/images/templates/trash.svg +0 -3
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +0 -93
- package/src/assets/images/templates/upload-image.svg +0 -10
- package/src/assets/images/templates/x.svg +0 -3
- package/src/assets/images/thumbnails/one.svg +0 -9
- package/src/assets/images/tooltip/tool-arrow.tsx +0 -25
- package/src/components/CreateTemplate/V2/index.tsx +0 -527
- package/src/components/CreateTemplate/V2/styles.scss +0 -372
- package/src/components/CreateTemplate/index.tsx +0 -508
- package/src/components/CreateTemplate/styles.scss +0 -404
- package/src/components/GenericUIBlocks/Button/index.tsx +0 -54
- package/src/components/GenericUIBlocks/Button/styles.scss +0 -43
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +0 -18
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +0 -93
- package/src/components/GenericUIBlocks/CustomTooltip/index.tsx +0 -88
- package/src/components/GenericUIBlocks/CustomTooltip/styles.scss +0 -19
- package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +0 -227
- package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +0 -289
- package/src/components/GenericUIBlocks/Dialog/index.tsx +0 -185
- package/src/components/GenericUIBlocks/Dialog/styles.scss +0 -227
- package/src/components/GenericUIBlocks/Divider/index.tsx +0 -12
- package/src/components/GenericUIBlocks/Divider/styles.scss +0 -7
- package/src/components/GenericUIBlocks/GeneralSelect/index.tsx +0 -114
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +0 -406
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +0 -25
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +0 -20
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/index.tsx +0 -91
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/styles.scss +0 -92
- package/src/components/GenericUIBlocks/Grid/index.tsx +0 -82
- package/src/components/GenericUIBlocks/Input/index.tsx +0 -269
- package/src/components/GenericUIBlocks/Input/styles.scss +0 -332
- package/src/components/GenericUIBlocks/Tabs/index.tsx +0 -71
- package/src/components/GenericUIBlocks/Tabs/styles.scss +0 -42
- package/src/components/GenericUIBlocks/Typography/index.tsx +0 -18
- package/src/components/GenericUIBlocks/Typography/styles.scss +0 -27
- package/src/components/SidePanel/CustomAddOns/index.tsx +0 -342
- package/src/components/SidePanel/CustomAddOns/styles.scss +0 -86
- package/src/components/SidePanel/CustomBlockColors/index.tsx +0 -211
- package/src/components/SidePanel/CustomBlockColors/styles.scss +0 -80
- package/src/components/SidePanel/CustomFields/customFieldSection.tsx +0 -547
- package/src/components/SidePanel/CustomFields/styles.scss +0 -64
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/index.tsx +0 -172
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/styles.scss +0 -46
- package/src/components/SidePanel/CustomQRCode/index.tsx +0 -1070
- package/src/components/SidePanel/CustomQRCode/styles.scss +0 -149
- package/src/components/SidePanel/CustomUploads/V2/index.tsx +0 -542
- package/src/components/SidePanel/CustomUploads/V2/styles.scss +0 -267
- package/src/components/SidePanel/CustomUploads/index.tsx +0 -301
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/index.tsx +0 -424
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/styles.scss +0 -180
- package/src/components/SidePanel/Templates/ModalGallery/V2/index.tsx +0 -235
- package/src/components/SidePanel/Templates/ModalGallery/V2/styles.scss +0 -244
- package/src/components/SidePanel/Templates/ModalGallery/index.tsx +0 -231
- package/src/components/SidePanel/Templates/SideBarGallery/index.tsx +0 -233
- package/src/components/SidePanel/Templates/SideBarGallery/styles.scss +0 -152
- package/src/components/SidePanel/Templates/TemplatesCard/V2/index.tsx +0 -149
- package/src/components/SidePanel/Templates/TemplatesCard/V2/styles.scss +0 -156
- package/src/components/SidePanel/Templates/TemplatesCard/index.tsx +0 -160
- package/src/components/SidePanel/Templates/TemplatesCard/styles.scss +0 -98
- package/src/components/SidePanel/Templates/customTemplateSection.tsx +0 -793
- package/src/components/SidePanel/Templates/styles.scss +0 -244
- package/src/components/SidePanel/index.tsx +0 -160
- package/src/components/TemplateBuilder/index.tsx +0 -585
- package/src/components/TemplateBuilder/styles.scss +0 -100
- package/src/components/TemplateTypes/index.tsx +0 -96
- package/src/components/TemplateTypes/styles.scss +0 -91
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +0 -81
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +0 -123
- package/src/components/TopNavigation/DuplicateTemplateModal.tsx +0 -103
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +0 -71
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +0 -88
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +0 -201
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +0 -128
- package/src/components/TopNavigation/index.tsx +0 -938
- package/src/components/TopNavigation/styles.scss +0 -303
- package/src/importMeta.d.ts +0 -31
- package/src/index.scss +0 -131
- package/src/index.tsx +0 -238
- package/src/libs/test.ts +0 -7
- package/src/redux/actions/action-types.ts +0 -52
- package/src/redux/actions/customQRCodeActions.ts +0 -54
- package/src/redux/actions/snackbarActions.ts +0 -16
- package/src/redux/actions/templateActions.ts +0 -236
- package/src/redux/reducers/customFieldReducer.ts +0 -99
- package/src/redux/reducers/customQRCodeReducer.ts +0 -58
- package/src/redux/reducers/index.ts +0 -15
- package/src/redux/reducers/snackbarReducer.ts +0 -40
- package/src/redux/reducers/templateReducer.ts +0 -485
- package/src/redux/store.ts +0 -18
- package/src/styles/colors.scss +0 -61
- package/src/test/mocks.js +0 -89
- package/src/test/setupJest.js +0 -1
- package/src/utils/api.ts +0 -36
- package/src/utils/constants.ts +0 -182
- package/src/utils/customStyles.ts +0 -45
- package/src/utils/fetchWrapper.ts +0 -73
- package/src/utils/fonts.json +0 -1597
- package/src/utils/helper.ts +0 -205
- package/src/utils/local-storage.ts +0 -15
- package/src/utils/message.ts +0 -162
- package/src/utils/products.ts +0 -186
- package/src/utils/template-builder.ts +0 -328
- package/src/utils/templateIdentifierArea/biFold.ts +0 -107
- package/src/utils/templateIdentifierArea/index.ts +0 -35
- package/src/utils/templateIdentifierArea/personal.ts +0 -107
- package/src/utils/templateIdentifierArea/postCards.ts +0 -163
- package/src/utils/templateIdentifierArea/professional.ts +0 -125
- package/src/utils/templateIdentifierArea/snapPack.ts +0 -107
- package/src/utils/templateIdentifierArea/triFold.ts +0 -107
- package/src/utils/templateRestrictedArea/biFold.ts +0 -329
- package/src/utils/templateRestrictedArea/nonWindowProfessional.ts +0 -90
- package/src/utils/templateRestrictedArea/personal.ts +0 -90
- package/src/utils/templateRestrictedArea/postCard.ts +0 -334
- package/src/utils/templateRestrictedArea/postCardJumbo.tsx +0 -408
- package/src/utils/templateRestrictedArea/professional.ts +0 -318
- package/src/utils/templateRestrictedArea/realPenned.ts +0 -233
- package/src/utils/templateRestrictedArea/snapPack.ts +0 -1009
- package/src/utils/templateRestrictedArea/triFold.ts +0 -330
- package/src/utils/templateSafetyBorders/biFold.ts +0 -91
- package/src/utils/templateSafetyBorders/index.ts +0 -43
- package/src/utils/templateSafetyBorders/personal.ts +0 -41
- package/src/utils/templateSafetyBorders/postCards.ts +0 -259
- package/src/utils/templateSafetyBorders/professional.ts +0 -78
- package/src/utils/templateSafetyBorders/snapPack.ts +0 -165
- package/src/utils/templateSafetyBorders/triFold.ts +0 -114
- package/src/utils/templateSafetyBorders/types.d.ts +0 -68
- package/src/utils/types.ts +0 -12
- package/src/v2Theme.scss +0 -142
- package/tsconfig.json +0 -29
- package/tsconfig.node.json +0 -12
- package/update-version.js +0 -23
- package/version.js +0 -1
- package/vite.config.ts +0 -8
- package/webpack.config.js +0 -80
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const ToolArrow = (props: any) => {
|
|
4
|
-
const {style, className} = props;
|
|
5
|
-
return (
|
|
6
|
-
<>
|
|
7
|
-
<svg
|
|
8
|
-
width="19"
|
|
9
|
-
height="17"
|
|
10
|
-
viewBox="0 0 19 17"
|
|
11
|
-
fill="none"
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
-
style={style}
|
|
14
|
-
className={className}
|
|
15
|
-
>
|
|
16
|
-
<path
|
|
17
|
-
d="M10.5699 15.6341C10.0247 16.569 8.67178 16.5631 8.1347 15.6235L0.801114 2.79264C0.264037 1.85297 0.945586 0.684273 2.0279 0.688985L16.8065 0.753326C17.8888 0.758038 18.5602 1.93262 18.0149 2.86758L10.5699 15.6341Z"
|
|
18
|
-
fill="white"
|
|
19
|
-
/>
|
|
20
|
-
</svg>
|
|
21
|
-
</>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default ToolArrow;
|
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
import React, { ReactElement, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
//hooks
|
|
4
|
-
import { useNavigate } from 'react-router-dom';
|
|
5
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
6
|
-
import { AppDispatch, RootState } from '../../../redux/store';
|
|
7
|
-
|
|
8
|
-
//actions
|
|
9
|
-
import {
|
|
10
|
-
clearTemplateFields,
|
|
11
|
-
searchAndAdvanceChange,
|
|
12
|
-
selectPostCard,
|
|
13
|
-
selectProduct,
|
|
14
|
-
fetchProducts,
|
|
15
|
-
} from '../../../redux/actions/templateActions';
|
|
16
|
-
import { CLEAR_TEMPLATE } from '../../../redux/actions/action-types';
|
|
17
|
-
import { clearQrFields } from '../../../redux/actions/customQRCodeActions';
|
|
18
|
-
|
|
19
|
-
//utils
|
|
20
|
-
import { sortOrderForTemplatesV2 } from '../../../utils/constants';
|
|
21
|
-
import { removeItem } from '../../../utils/local-storage';
|
|
22
|
-
import { MESSAGES } from '../../../utils/message';
|
|
23
|
-
import { designTypes, envelopeTypes, selfMailerProduct } from '../../../utils/template-builder';
|
|
24
|
-
|
|
25
|
-
// UI Components
|
|
26
|
-
import Typography from '../../GenericUIBlocks/Typography';
|
|
27
|
-
import Input from '../../GenericUIBlocks/Input';
|
|
28
|
-
import CircularProgress from '../../GenericUIBlocks/CircularProgress';
|
|
29
|
-
|
|
30
|
-
// images
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
import Postcard from '../../../assets/images/products/postcard-new.tsx';
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
import ProfessionalLetter from '../../../assets/images/products/professional-new.tsx';
|
|
35
|
-
// @ts-ignore
|
|
36
|
-
import PersonalLetter from '../../../assets/images/products/personal-new.tsx';
|
|
37
|
-
//@ts-ignore
|
|
38
|
-
import TriFoldSelfMailers from '../../../assets/images/templates/tri-fold-self-mailers.tsx';
|
|
39
|
-
//@ts-ignore
|
|
40
|
-
import BiFoldSelfMailers from '../../../assets/images/templates/bi-fold-self-mailers.tsx';
|
|
41
|
-
// @ts-ignore
|
|
42
|
-
import RealPennedLetter from '../../../assets/images/products/real-new.tsx';
|
|
43
|
-
//@ts-ignore
|
|
44
|
-
import SnapPackMailers from '../../../assets/images/templates/snap-pack.tsx';
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
import SelfMailer from '../../../assets/images/products/bi-new.svg';
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
import LeftArrow from '../../../assets/images/products/left-arrow.svg'
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
import RightArrow from '../../../assets/images/products/right-arrow.svg'
|
|
51
|
-
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
import One from '../../../assets/images/thumbnails/one.svg';
|
|
54
|
-
|
|
55
|
-
// styles
|
|
56
|
-
import './styles.scss';
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const textStyles = {
|
|
60
|
-
fontSize: '20px',
|
|
61
|
-
fontWeight: '600',
|
|
62
|
-
color: '#000',
|
|
63
|
-
marginBottom: '0',
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const descriptionStyles = {
|
|
67
|
-
fontSize: '16px',
|
|
68
|
-
fontWeight: '400',
|
|
69
|
-
color: '#00000099',
|
|
70
|
-
marginBottom: '12px',
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const buttonStyles = {
|
|
74
|
-
width: '100%',
|
|
75
|
-
maxWidth: '157px',
|
|
76
|
-
height: '50px',
|
|
77
|
-
borderRadius: '8px',
|
|
78
|
-
fontSize: '16px',
|
|
79
|
-
fontWeight: '600',
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const progressStyles = {
|
|
83
|
-
width: '20px',
|
|
84
|
-
height: '20px',
|
|
85
|
-
border: '2px solid var(--primary-color)',
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const Images: Record<string, ReactElement> = {
|
|
89
|
-
Postcards: <Postcard fill="var(--svg-color)" />,
|
|
90
|
-
'Professional Letters': <ProfessionalLetter fill="var(--svg-color)" />,
|
|
91
|
-
'Personal Letters': <PersonalLetter fill="var(--svg-color)" />,
|
|
92
|
-
'Real Penned Letter': <RealPennedLetter fill="var(--svg-color)" />,
|
|
93
|
-
'Tri-Fold Self-Mailers': <TriFoldSelfMailers fill="var(--svg-color)" />,
|
|
94
|
-
'Bi-Fold Self-Mailers': <BiFoldSelfMailers fill="var(--svg-color)" />,
|
|
95
|
-
'Snap Pack Mailers': <SnapPackMailers fill="var(--svg-color)" />,
|
|
96
|
-
"Self Mailer": <BiFoldSelfMailers fill="var(--svg-color)" />
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
interface CreateTemplateV2Props {
|
|
100
|
-
onReturnAndNavigate?: () => void;
|
|
101
|
-
createTemplateRoute?: string | null;
|
|
102
|
-
templateBuilderRoute?: string | null;
|
|
103
|
-
restrictedProducts?: any;
|
|
104
|
-
disallowedProducts?: string[] | null | undefined;
|
|
105
|
-
currentTheme?: string | null | undefined;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const CreateTemplateV2: React.FC<CreateTemplateV2Props> = ({
|
|
109
|
-
onReturnAndNavigate,
|
|
110
|
-
createTemplateRoute,
|
|
111
|
-
templateBuilderRoute,
|
|
112
|
-
restrictedProducts,
|
|
113
|
-
disallowedProducts,
|
|
114
|
-
currentTheme
|
|
115
|
-
}) => {
|
|
116
|
-
const [activeProduct, setActiveProduct] = useState("13");
|
|
117
|
-
const [activeProductType, setActiveProductType] = useState("Postcards");
|
|
118
|
-
const [selectedSize, setSelectedSize] = useState('4x6');
|
|
119
|
-
const [selectedRPLType, setSelectedRPLType] = useState('16');
|
|
120
|
-
const [selectedDesign, setSelectedDesign] = useState<any>(designTypes[0])
|
|
121
|
-
const [envelopeType, setEnvelopeType] = useState<any>(envelopeTypes[0]);
|
|
122
|
-
|
|
123
|
-
const [inputValue, setInputValue] = useState('');
|
|
124
|
-
const [showingFrontImage, setShowingFrontImage] = useState(true);
|
|
125
|
-
const [isError, setIsError] = useState<boolean>(false);
|
|
126
|
-
const [isImageLoading, setIsImageLoading] = useState<boolean>(true);
|
|
127
|
-
const [imageToShow, setImageToShow] = useState(null);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const dispatch: AppDispatch = useDispatch();
|
|
131
|
-
const navigate = useNavigate();
|
|
132
|
-
|
|
133
|
-
const title = useSelector((state: RootState) => state.templates.title) || '';
|
|
134
|
-
const product = useSelector(
|
|
135
|
-
(state: RootState) => state.templates.product
|
|
136
|
-
) as Record<string, any>;
|
|
137
|
-
const allProducts = useSelector((state: RootState) => state.templates.products);
|
|
138
|
-
const products = useMemo(() => {
|
|
139
|
-
const exists = allProducts.some(p => p.id === "100");
|
|
140
|
-
return exists
|
|
141
|
-
? allProducts
|
|
142
|
-
: [...allProducts.filter((prod) => prod.id !== '9' && prod.id !== '11'), selfMailerProduct];
|
|
143
|
-
}, [allProducts]);
|
|
144
|
-
const productDetails = useSelector((state: RootState) => state.templates.productDetails);
|
|
145
|
-
const templateType = useSelector(
|
|
146
|
-
(state: RootState) => state.templates.templateType
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
const restrictedSet = new Set(
|
|
150
|
-
(restrictedProducts ?? []).map((id: any) => String(id))
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
const disallowedSet = new Set(disallowedProducts ?? []);
|
|
154
|
-
const sortedProducts = products
|
|
155
|
-
?.sort((a, b) => {
|
|
156
|
-
const indexA = sortOrderForTemplatesV2.indexOf(a.title === 'Self Mailer' ? a.title : a.productType);
|
|
157
|
-
const indexB = sortOrderForTemplatesV2.indexOf(b.title === 'Self Mailer' ? b.title : b.productType);
|
|
158
|
-
return indexA - indexB;
|
|
159
|
-
})
|
|
160
|
-
.filter((product) => {
|
|
161
|
-
return (
|
|
162
|
-
!restrictedSet.has(String(product.id)) &&
|
|
163
|
-
!disallowedSet.has(product.productType.toLowerCase().replace(/\s+/g, '_'))
|
|
164
|
-
);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
const filteredEnvelopeTypes = envelopeTypes.filter((type) => {
|
|
168
|
-
return !restrictedProducts?.includes(type.productId);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
const filteredDesignTypes = designTypes.filter((type) => {
|
|
172
|
-
return !restrictedProducts?.includes(type.productId);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
const handleNext = () => {
|
|
176
|
-
const trimedTitle = title.trim();
|
|
177
|
-
if (
|
|
178
|
-
!trimedTitle ||
|
|
179
|
-
trimedTitle?.length > 50 ||
|
|
180
|
-
!templateType ||
|
|
181
|
-
!product ||
|
|
182
|
-
(product &&
|
|
183
|
-
product.productType === 'Postcards' &&
|
|
184
|
-
!product?.selectedSize) ||
|
|
185
|
-
(product &&
|
|
186
|
-
product.productType === 'Professional Letters' &&
|
|
187
|
-
!Object.keys(envelopeType).length)
|
|
188
|
-
) {
|
|
189
|
-
setIsError(true);
|
|
190
|
-
} else {
|
|
191
|
-
let envelope: string | string[] = '';
|
|
192
|
-
if (product.productType === 'Professional Letters') {
|
|
193
|
-
//@ts-ignore
|
|
194
|
-
envelope = envelopeTypes.find(
|
|
195
|
-
//@ts-ignore
|
|
196
|
-
(envelope) => envelope?.label === envelopeType.label
|
|
197
|
-
)?.type;
|
|
198
|
-
}
|
|
199
|
-
dispatch(searchAndAdvanceChange('title', trimedTitle));
|
|
200
|
-
dispatch(searchAndAdvanceChange('envelopeType', envelope));
|
|
201
|
-
navigate(
|
|
202
|
-
templateBuilderRoute ? templateBuilderRoute : '/template-builder'
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
const handleProductChange = (prod: any) => {
|
|
208
|
-
setActiveProduct(prod.id);
|
|
209
|
-
setActiveProductType(prod.title === 'Self Mailer' ? 'Bi-Fold Self-Mailers' : prod.productType);
|
|
210
|
-
setShowingFrontImage(true);
|
|
211
|
-
setIsImageLoading(true);
|
|
212
|
-
dispatch(selectProduct(prod));
|
|
213
|
-
prod.productType !== "Postcards" && setSelectedSize('4x6');
|
|
214
|
-
prod.productType !== "Professional Letters" && setEnvelopeType(envelopeTypes[0]);
|
|
215
|
-
prod.productType !== "Real Penned Letter" && setSelectedRPLType('16');
|
|
216
|
-
prod.title !== "Self Mailer" && setSelectedDesign(designTypes[0]);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const handlePostCardSizeChange = (type: any, product: any) => {
|
|
220
|
-
setSelectedSize(type.size);
|
|
221
|
-
handleProductChange(product);
|
|
222
|
-
dispatch(
|
|
223
|
-
selectPostCard(
|
|
224
|
-
{
|
|
225
|
-
...type,
|
|
226
|
-
size: product.size,
|
|
227
|
-
selectedSize: type.size,
|
|
228
|
-
paper: product.paper,
|
|
229
|
-
finish: product.finish
|
|
230
|
-
},
|
|
231
|
-
'Postcards'
|
|
232
|
-
)
|
|
233
|
-
)
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
const handleEnvelopeTypeChange = (envelope: any, product: any) => {
|
|
237
|
-
setEnvelopeType(envelope);
|
|
238
|
-
let selectedProduct = null;
|
|
239
|
-
if (envelope?.label === 'Non-Windowed Envelope') {
|
|
240
|
-
selectedProduct = sortedProducts.find((item) => item.windowed === false)
|
|
241
|
-
} else if (envelope?.label === 'Windowed Envelope') {
|
|
242
|
-
selectedProduct = sortedProducts.find((item) => item.windowed === true)
|
|
243
|
-
}
|
|
244
|
-
if (selectedProduct) {
|
|
245
|
-
handleProductChange(selectedProduct);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const handleRealPennedLetter = (type: any, product: any) => {
|
|
250
|
-
setSelectedRPLType(type.id);
|
|
251
|
-
handleProductChange(product);
|
|
252
|
-
dispatch(selectPostCard({
|
|
253
|
-
...product,
|
|
254
|
-
id: type.id,
|
|
255
|
-
size: product.size,
|
|
256
|
-
selectedSize: type.size,
|
|
257
|
-
label: type.label
|
|
258
|
-
}, 'Real Penned Letter'));
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
const handleSliderArrowClick = (direction: string) => {
|
|
262
|
-
if (direction === 'left') {
|
|
263
|
-
setShowingFrontImage(true);
|
|
264
|
-
} else {
|
|
265
|
-
setShowingFrontImage(false);
|
|
266
|
-
}
|
|
267
|
-
setIsImageLoading(true);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const handleTemplateNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
271
|
-
setInputValue(e.target.value);
|
|
272
|
-
dispatch(searchAndAdvanceChange('title', e.target.value));
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
const getCurrentProductDetails = (selectProduct: any) => {
|
|
276
|
-
return productDetails?.find((detail: any) => detail.id === selectProduct.id) || null;
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
useEffect(() => {
|
|
280
|
-
dispatch(fetchProducts());
|
|
281
|
-
dispatch(clearTemplateFields());
|
|
282
|
-
dispatch(clearQrFields());
|
|
283
|
-
removeItem('formData');
|
|
284
|
-
dispatch({ type: CLEAR_TEMPLATE });
|
|
285
|
-
}, []);
|
|
286
|
-
|
|
287
|
-
useEffect(() => {
|
|
288
|
-
if(product && productDetails?.length === 0) setIsImageLoading(false);
|
|
289
|
-
const currentProductDetail = getCurrentProductDetails(product);
|
|
290
|
-
const currentImage = showingFrontImage
|
|
291
|
-
? currentProductDetail?.thumbnailFrontUrl
|
|
292
|
-
: currentProductDetail?.thumbnailBackUrl;
|
|
293
|
-
|
|
294
|
-
setImageToShow(currentImage);
|
|
295
|
-
}, [product, productDetails, showingFrontImage])
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
useEffect(() => {
|
|
299
|
-
if (sortedProducts?.length) {
|
|
300
|
-
dispatch(selectProduct(sortedProducts[0]));
|
|
301
|
-
}
|
|
302
|
-
}, [products]);
|
|
303
|
-
|
|
304
|
-
return (
|
|
305
|
-
<div className='create-template-container'>
|
|
306
|
-
<Typography style={{ ...textStyles, marginBottom: '20px' }}>Create a Template</Typography>
|
|
307
|
-
<div className='create-template-content-container'>
|
|
308
|
-
<div className='product-selection-container'>
|
|
309
|
-
<Typography style={descriptionStyles}>Select a Product</Typography>
|
|
310
|
-
<div className='products-container'>
|
|
311
|
-
{sortedProducts &&
|
|
312
|
-
sortedProducts
|
|
313
|
-
?.filter((prod) => {
|
|
314
|
-
if (restrictedSet.has('2') || restrictedSet.has('4')) {
|
|
315
|
-
return true;
|
|
316
|
-
} else {
|
|
317
|
-
return prod.windowed !== false;
|
|
318
|
-
}
|
|
319
|
-
})
|
|
320
|
-
.map((prod, index) => {
|
|
321
|
-
const ImageOrComponent = Images[prod.productType];
|
|
322
|
-
return (
|
|
323
|
-
<div
|
|
324
|
-
className={`product-card ${prod.productType === activeProductType ? 'active' : ''}`}
|
|
325
|
-
key={index}
|
|
326
|
-
onClick={() => handleProductChange(prod)}
|
|
327
|
-
>
|
|
328
|
-
{typeof ImageOrComponent === 'string' ? (
|
|
329
|
-
<img src={ImageOrComponent} alt="Product" />
|
|
330
|
-
) : (
|
|
331
|
-
ImageOrComponent
|
|
332
|
-
)}
|
|
333
|
-
<Typography style={{ ...textStyles, fontSize: '16px', fontWeight: '500', color: '#000' }}>{prod.title === 'Self Mailer' ? prod.title : prod.productType}</Typography>
|
|
334
|
-
</div>
|
|
335
|
-
);
|
|
336
|
-
})}
|
|
337
|
-
</div>
|
|
338
|
-
{product && product?.productType === 'Postcards' && product?.size && (
|
|
339
|
-
<div className='size-selection-container'>
|
|
340
|
-
<Typography style={descriptionStyles}>Postcard Size</Typography>
|
|
341
|
-
<div className='radio-buttons-container'>
|
|
342
|
-
{product?.size
|
|
343
|
-
.map((type: any, index: any) => {
|
|
344
|
-
const size = type?.label?.split('x') || type?.size?.split('x');
|
|
345
|
-
return (
|
|
346
|
-
<label key={index} className={`radio-button-wrapper ${selectedSize === type.size ? 'selected' : ''}`}>
|
|
347
|
-
<input type="radio" name="postcardSize" value={type.size} checked={selectedSize === type.size} onChange={() => handlePostCardSizeChange(type, product)} className="radio-input" />
|
|
348
|
-
<span className="radio-button"></span>
|
|
349
|
-
|
|
350
|
-
<Typography
|
|
351
|
-
style={{
|
|
352
|
-
fontSize: '16px',
|
|
353
|
-
fontWeight: 400,
|
|
354
|
-
color: '#000',
|
|
355
|
-
margin: 0,
|
|
356
|
-
}}
|
|
357
|
-
>
|
|
358
|
-
{`${size[0]}" x ${size[1]}"`}
|
|
359
|
-
</Typography>
|
|
360
|
-
</label>
|
|
361
|
-
)
|
|
362
|
-
})}
|
|
363
|
-
</div>
|
|
364
|
-
</div>
|
|
365
|
-
)}
|
|
366
|
-
{product && (product?.title === 'Self Mailer' || product?.productType === "Bi-Fold Self-Mailers" || product?.productType === "Tri-Fold Self-Mailers") && (
|
|
367
|
-
<div className='size-selection-container'>
|
|
368
|
-
<Typography style={descriptionStyles}>Design Format</Typography>
|
|
369
|
-
<div className='radio-buttons-container'>
|
|
370
|
-
{filteredDesignTypes.map((design: any, index: any) => {
|
|
371
|
-
return (
|
|
372
|
-
<label key={index} className={`radio-button-wrapper ${selectedDesign.id === design.id ? 'selected' : ''}`}>
|
|
373
|
-
<input type="radio" name="postcardSize" value={design.type} checked={selectedDesign.id === design.id} onChange={() => { setSelectedDesign(design), handleProductChange(selfMailerProduct?.types[design.id]) }} className="radio-input" />
|
|
374
|
-
<span className="radio-button"></span>
|
|
375
|
-
|
|
376
|
-
<Typography
|
|
377
|
-
style={{
|
|
378
|
-
fontSize: '16px',
|
|
379
|
-
fontWeight: 400,
|
|
380
|
-
color: '#000',
|
|
381
|
-
margin: 0,
|
|
382
|
-
}}
|
|
383
|
-
>
|
|
384
|
-
{design?.label}
|
|
385
|
-
</Typography>
|
|
386
|
-
</label>
|
|
387
|
-
)
|
|
388
|
-
})}
|
|
389
|
-
</div>
|
|
390
|
-
</div>
|
|
391
|
-
)}
|
|
392
|
-
{product && product.productType === 'Professional Letters' && (
|
|
393
|
-
<div className='size-selection-container'>
|
|
394
|
-
<Typography style={descriptionStyles}>Envelope Type</Typography>
|
|
395
|
-
<div className='radio-buttons-container'>
|
|
396
|
-
{filteredEnvelopeTypes.map((envelope) => (
|
|
397
|
-
<label key={envelope.id} className={`radio-button-wrapper ${envelopeType?.id === envelope.id ? 'selected' : ''}`}>
|
|
398
|
-
<input type="radio" name="postcardSize" value={envelope.type} checked={envelopeType?.id === envelope.id} onChange={() => handleEnvelopeTypeChange(envelope, product)} className="radio-input" />
|
|
399
|
-
<span className="radio-button"></span>
|
|
400
|
-
<Typography style={{ fontSize: '16px', fontWeight: '400', color: 'var(--text-color)', margin: 0 }}>{envelope.label}</Typography>
|
|
401
|
-
</label>
|
|
402
|
-
))}
|
|
403
|
-
</div>
|
|
404
|
-
</div>
|
|
405
|
-
)}
|
|
406
|
-
{product?.productType === 'Real Penned Letter' && (
|
|
407
|
-
<div className='size-selection-container'>
|
|
408
|
-
<Typography style={descriptionStyles}>Design Format</Typography>
|
|
409
|
-
<div className='radio-buttons-container'>
|
|
410
|
-
{product?.size
|
|
411
|
-
?.filter((type: any) => !restrictedSet.has(String(type.id)))
|
|
412
|
-
.map((type: any) => (
|
|
413
|
-
<label key={type.id} className={`radio-button-wrapper ${selectedRPLType === type.id ? 'selected' : ''}`}>
|
|
414
|
-
<input type="radio" name="postcardSize" value={type.id} checked={selectedRPLType === type.id} onChange={() => handleRealPennedLetter(type, product)} className="radio-input" />
|
|
415
|
-
<span className="radio-button"></span>
|
|
416
|
-
<Typography style={{ fontSize: '16px', fontWeight: '400', color: 'var(--text-color)', margin: 0 }}>{type.title}</Typography>
|
|
417
|
-
</label>
|
|
418
|
-
))}
|
|
419
|
-
</div>
|
|
420
|
-
</div>
|
|
421
|
-
)}
|
|
422
|
-
<div>
|
|
423
|
-
<Input
|
|
424
|
-
label='Template Name'
|
|
425
|
-
type="text"
|
|
426
|
-
placeholder='Untitled Name'
|
|
427
|
-
className="NewDesignSearch"
|
|
428
|
-
currentTheme={currentTheme}
|
|
429
|
-
value={inputValue}
|
|
430
|
-
onChange={handleTemplateNameChange}
|
|
431
|
-
error={
|
|
432
|
-
!title.trim() && isError
|
|
433
|
-
? MESSAGES.TEMPLATE.NAME_REQUIRED
|
|
434
|
-
: title.length > 50 && isError
|
|
435
|
-
? MESSAGES.TEMPLATE.NAME_LESS_50
|
|
436
|
-
: ''
|
|
437
|
-
}
|
|
438
|
-
/>
|
|
439
|
-
</div>
|
|
440
|
-
</div>
|
|
441
|
-
<div className='product-thumbnail-container'>
|
|
442
|
-
<div className='product-thumbnail-card'>
|
|
443
|
-
<div className='thumbail-slider'>
|
|
444
|
-
<div className='thumbail-slider-image'>
|
|
445
|
-
{isImageLoading && (
|
|
446
|
-
<div className='image-loader'>
|
|
447
|
-
<CircularProgress style={progressStyles} />
|
|
448
|
-
</div>
|
|
449
|
-
)}
|
|
450
|
-
{!isImageLoading && !imageToShow ? (
|
|
451
|
-
<img
|
|
452
|
-
src={One}
|
|
453
|
-
alt={`Dummy Product thumbnail`}
|
|
454
|
-
onLoad={() => setIsImageLoading(false)}
|
|
455
|
-
onError={() => setIsImageLoading(false)}
|
|
456
|
-
style={{ display: isImageLoading ? 'none' : 'block' }}
|
|
457
|
-
/>
|
|
458
|
-
|
|
459
|
-
) : (
|
|
460
|
-
<img
|
|
461
|
-
key={showingFrontImage ? 'front' : 'back'}
|
|
462
|
-
//@ts-ignore
|
|
463
|
-
src={imageToShow}
|
|
464
|
-
alt={`Product ${showingFrontImage ? 'front' : 'back'} thumbnail`}
|
|
465
|
-
onLoad={() => setIsImageLoading(false)}
|
|
466
|
-
onError={() => setIsImageLoading(false)}
|
|
467
|
-
style={{ display: isImageLoading ? 'none' : 'block' }}
|
|
468
|
-
/>
|
|
469
|
-
)}
|
|
470
|
-
{(() => {
|
|
471
|
-
const currentProductDetail = getCurrentProductDetails(product);
|
|
472
|
-
|
|
473
|
-
if (!currentProductDetail || !currentProductDetail?.thumbnailBackUrl) {
|
|
474
|
-
return null;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
return (
|
|
478
|
-
<>
|
|
479
|
-
<div
|
|
480
|
-
className={`slider-arrow-left ${showingFrontImage ? 'disabled' : ''}`}
|
|
481
|
-
onClick={() => !showingFrontImage && handleSliderArrowClick('left')}
|
|
482
|
-
>
|
|
483
|
-
<img src={LeftArrow} alt='left' />
|
|
484
|
-
</div>
|
|
485
|
-
<div
|
|
486
|
-
className={`slider-arrow-right ${!showingFrontImage ? 'disabled' : ''}`}
|
|
487
|
-
onClick={() => showingFrontImage && handleSliderArrowClick('right')}
|
|
488
|
-
>
|
|
489
|
-
<img src={RightArrow} alt='right' />
|
|
490
|
-
</div>
|
|
491
|
-
</>
|
|
492
|
-
);
|
|
493
|
-
})()}
|
|
494
|
-
</div>
|
|
495
|
-
</div>
|
|
496
|
-
</div>
|
|
497
|
-
<div className='product-thumbnail-details'>
|
|
498
|
-
<Typography style={{ ...textStyles, fontSize: '16px' }}>
|
|
499
|
-
Size:{' '}
|
|
500
|
-
<span>
|
|
501
|
-
{(() => {
|
|
502
|
-
const size = product?.label?.split('x') || product?.selectedSize?.split('x');
|
|
503
|
-
return size?.length ? `${size[0] || ''}" x ${size[1] || ''}"` : product?.selectedSize;
|
|
504
|
-
})() || product?.selectedSize || '-'}
|
|
505
|
-
</span>
|
|
506
|
-
</Typography>
|
|
507
|
-
<Typography style={{ ...textStyles, fontSize: '16px' }}>
|
|
508
|
-
Paper: <span>{product?.paper}</span>
|
|
509
|
-
</Typography>
|
|
510
|
-
{product?.finish && <Typography style={{ ...textStyles, fontSize: '16px' }}>
|
|
511
|
-
Finish: <span>{product?.finish}</span>
|
|
512
|
-
</Typography>}
|
|
513
|
-
{product?.envelopeOptions && <Typography style={{ ...textStyles, fontSize: '16px' }}>
|
|
514
|
-
Envelope: <span>{product?.envelopeOptions}</span>
|
|
515
|
-
</Typography>}
|
|
516
|
-
</div>
|
|
517
|
-
</div>
|
|
518
|
-
</div>
|
|
519
|
-
<div className='buttons-container'>
|
|
520
|
-
<button onClick={handleNext}>Next</button>
|
|
521
|
-
<button onClick={() => onReturnAndNavigate ? onReturnAndNavigate() : navigate(createTemplateRoute || '/create-template')}>Cancel</button>
|
|
522
|
-
</div>
|
|
523
|
-
</div>
|
|
524
|
-
)
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
export default CreateTemplateV2;
|