@openlettermarketing/olc-react-sdk 2.1.4 → 2.1.5-beta.2
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/.github/workflows/publish-beta.yml +154 -0
- package/.github/workflows/publish-production.yml +143 -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 +82 -82
- package/build/index.js.map +1 -1
- package/build/types/version.d.ts +1 -1
- package/examples/.eslintrc.yml +4 -0
- package/index.html +18 -0
- package/package.json +1 -1
- package/public/vite.svg +1 -0
- package/src/App.tsx +209 -0
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/create-template/prebuilt.svg +13 -0
- package/src/assets/images/create-template/scratch.svg +4 -0
- package/src/assets/images/input/cancel.tsx +20 -0
- package/src/assets/images/input/search.tsx +20 -0
- package/src/assets/images/input/select-cancel.tsx +17 -0
- package/src/assets/images/modal-icons/add.tsx +36 -0
- package/src/assets/images/modal-icons/cancel-file.tsx +12 -0
- package/src/assets/images/modal-icons/cancel-input.tsx +13 -0
- package/src/assets/images/modal-icons/cancel.tsx +35 -0
- package/src/assets/images/modal-icons/close-new.svg +3 -0
- package/src/assets/images/modal-icons/confirm-close-icon.tsx +14 -0
- package/src/assets/images/modal-icons/confirm-new.tsx +22 -0
- package/src/assets/images/modal-icons/confirm.svg +12 -0
- package/src/assets/images/modal-icons/cross.tsx +23 -0
- package/src/assets/images/modal-icons/del.tsx +19 -0
- package/src/assets/images/modal-icons/design-icon.tsx +22 -0
- package/src/assets/images/modal-icons/doc.tsx +43 -0
- package/src/assets/images/modal-icons/docx.tsx +43 -0
- package/src/assets/images/modal-icons/envelope-icon.tsx +26 -0
- package/src/assets/images/modal-icons/info.tsx +19 -0
- package/src/assets/images/modal-icons/jpeg.tsx +43 -0
- package/src/assets/images/modal-icons/jpg.tsx +43 -0
- package/src/assets/images/modal-icons/modal-cros.svg +4 -0
- package/src/assets/images/modal-icons/modal-cross.tsx +37 -0
- package/src/assets/images/modal-icons/new-cancel.tsx +11 -0
- package/src/assets/images/modal-icons/order-download.tsx +42 -0
- package/src/assets/images/modal-icons/pdf.tsx +51 -0
- package/src/assets/images/modal-icons/png.tsx +43 -0
- package/src/assets/images/modal-icons/save.tsx +23 -0
- package/src/assets/images/modal-icons/template-copy.tsx +25 -0
- package/src/assets/images/modal-icons/tool-cancel.tsx +25 -0
- package/src/assets/images/products/bi-new.svg +23 -0
- package/src/assets/images/products/left-arrow.svg +17 -0
- package/src/assets/images/products/personal-new.tsx +31 -0
- package/src/assets/images/products/postcard-new.tsx +27 -0
- package/src/assets/images/products/professional-new.tsx +24 -0
- package/src/assets/images/products/real-new.tsx +30 -0
- package/src/assets/images/products/right-arrow.svg +17 -0
- package/src/assets/images/products/snap-new.svg +31 -0
- package/src/assets/images/templates/actions.svg +3 -0
- package/src/assets/images/templates/address-block-icon.tsx +62 -0
- package/src/assets/images/templates/archive.svg +3 -0
- package/src/assets/images/templates/arrow-down.tsx +27 -0
- package/src/assets/images/templates/back-arrow.tsx +19 -0
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +28 -0
- package/src/assets/images/templates/check.svg +3 -0
- package/src/assets/images/templates/code.svg +10 -0
- package/src/assets/images/templates/content-copy-icon.tsx +24 -0
- package/src/assets/images/templates/custom-add-on-icon.tsx +18 -0
- package/src/assets/images/templates/custom-qr-section-icon.tsx +9 -0
- package/src/assets/images/templates/custom-template.tsx +23 -0
- package/src/assets/images/templates/designer.tsx +43 -0
- package/src/assets/images/templates/dot.tsx +22 -0
- package/src/assets/images/templates/download-v2.svg +4 -0
- package/src/assets/images/templates/download.svg +4 -0
- package/src/assets/images/templates/dummy-template.tsx +76 -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/edit.svg +3 -0
- package/src/assets/images/templates/epo-icon.tsx +16 -0
- package/src/assets/images/templates/field.tsx +29 -0
- package/src/assets/images/templates/gsv-icon.tsx +31 -0
- package/src/assets/images/templates/info-icon.tsx +37 -0
- package/src/assets/images/templates/left-arrow.svg +17 -0
- package/src/assets/images/templates/pencil.svg +3 -0
- package/src/assets/images/templates/personal-letter.tsx +53 -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/qr-code.tsx +13 -0
- package/src/assets/images/templates/real-penned-letters.tsx +57 -0
- package/src/assets/images/templates/right-arrow.svg +17 -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-xl.tsx +20 -0
- package/src/assets/images/templates/size-image.tsx +20 -0
- package/src/assets/images/templates/snap-pack.tsx +67 -0
- package/src/assets/images/templates/template-default-design.tsx +21 -0
- package/src/assets/images/templates/trash-upload.svg +3 -0
- package/src/assets/images/templates/trash.svg +3 -0
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +93 -0
- package/src/assets/images/templates/upload-image.svg +10 -0
- package/src/assets/images/templates/x.svg +3 -0
- package/src/assets/images/thumbnails/one.svg +9 -0
- package/src/assets/images/tooltip/tool-arrow.tsx +25 -0
- package/src/components/CreateTemplate/V2/index.tsx +525 -0
- package/src/components/CreateTemplate/V2/styles.scss +372 -0
- package/src/components/CreateTemplate/index.tsx +508 -0
- package/src/components/CreateTemplate/styles.scss +404 -0
- package/src/components/GenericUIBlocks/Button/index.tsx +54 -0
- package/src/components/GenericUIBlocks/Button/styles.scss +43 -0
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +18 -0
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +93 -0
- package/src/components/GenericUIBlocks/CustomTooltip/index.tsx +88 -0
- package/src/components/GenericUIBlocks/CustomTooltip/styles.scss +19 -0
- package/src/components/GenericUIBlocks/Dialog/V2/index.tsx +227 -0
- package/src/components/GenericUIBlocks/Dialog/V2/styles.scss +289 -0
- package/src/components/GenericUIBlocks/Dialog/index.tsx +185 -0
- package/src/components/GenericUIBlocks/Dialog/styles.scss +227 -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 +114 -0
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +406 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +25 -0
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +20 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/index.tsx +91 -0
- package/src/components/GenericUIBlocks/GenericSnackbar/Toast/styles.scss +92 -0
- package/src/components/GenericUIBlocks/Grid/index.tsx +82 -0
- package/src/components/GenericUIBlocks/Input/index.tsx +269 -0
- package/src/components/GenericUIBlocks/Input/styles.scss +332 -0
- package/src/components/GenericUIBlocks/Tabs/index.tsx +71 -0
- package/src/components/GenericUIBlocks/Tabs/styles.scss +42 -0
- package/src/components/GenericUIBlocks/Typography/index.tsx +18 -0
- package/src/components/GenericUIBlocks/Typography/styles.scss +27 -0
- package/src/components/SidePanel/CustomAddOns/index.tsx +342 -0
- package/src/components/SidePanel/CustomAddOns/styles.scss +86 -0
- package/src/components/SidePanel/CustomBlockColors/index.tsx +211 -0
- package/src/components/SidePanel/CustomBlockColors/styles.scss +80 -0
- package/src/components/SidePanel/CustomFields/customFieldSection.tsx +547 -0
- package/src/components/SidePanel/CustomFields/styles.scss +64 -0
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/index.tsx +172 -0
- package/src/components/SidePanel/CustomQRCode/V2/QRCodeModal/styles.scss +46 -0
- package/src/components/SidePanel/CustomQRCode/index.tsx +1070 -0
- package/src/components/SidePanel/CustomQRCode/styles.scss +149 -0
- package/src/components/SidePanel/CustomUploads/V2/index.tsx +542 -0
- package/src/components/SidePanel/CustomUploads/V2/styles.scss +267 -0
- package/src/components/SidePanel/CustomUploads/index.tsx +301 -0
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/index.tsx +424 -0
- package/src/components/SidePanel/Templates/ModalGallery/HireDesigner/styles.scss +180 -0
- package/src/components/SidePanel/Templates/ModalGallery/V2/index.tsx +235 -0
- package/src/components/SidePanel/Templates/ModalGallery/V2/styles.scss +244 -0
- package/src/components/SidePanel/Templates/ModalGallery/index.tsx +231 -0
- package/src/components/SidePanel/Templates/SideBarGallery/index.tsx +233 -0
- package/src/components/SidePanel/Templates/SideBarGallery/styles.scss +152 -0
- package/src/components/SidePanel/Templates/TemplatesCard/V2/index.tsx +149 -0
- package/src/components/SidePanel/Templates/TemplatesCard/V2/styles.scss +156 -0
- package/src/components/SidePanel/Templates/TemplatesCard/index.tsx +160 -0
- package/src/components/SidePanel/Templates/TemplatesCard/styles.scss +98 -0
- package/src/components/SidePanel/Templates/customTemplateSection.tsx +793 -0
- package/src/components/SidePanel/Templates/styles.scss +244 -0
- package/src/components/SidePanel/index.tsx +160 -0
- package/src/components/TemplateBuilder/index.tsx +585 -0
- package/src/components/TemplateBuilder/styles.scss +100 -0
- package/src/components/TemplateTypes/index.tsx +96 -0
- package/src/components/TemplateTypes/styles.scss +91 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +81 -0
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +123 -0
- package/src/components/TopNavigation/DuplicateTemplateModal.tsx +103 -0
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +71 -0
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +88 -0
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +201 -0
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +128 -0
- package/src/components/TopNavigation/index.tsx +938 -0
- package/src/components/TopNavigation/styles.scss +303 -0
- package/src/importMeta.d.ts +31 -0
- package/src/index.scss +131 -0
- package/src/index.tsx +238 -0
- package/src/libs/test.ts +7 -0
- package/src/redux/actions/action-types.ts +52 -0
- package/src/redux/actions/customQRCodeActions.ts +54 -0
- package/src/redux/actions/snackbarActions.ts +16 -0
- package/src/redux/actions/templateActions.ts +236 -0
- package/src/redux/reducers/customFieldReducer.ts +99 -0
- package/src/redux/reducers/customQRCodeReducer.ts +58 -0
- package/src/redux/reducers/index.ts +15 -0
- package/src/redux/reducers/snackbarReducer.ts +40 -0
- package/src/redux/reducers/templateReducer.ts +485 -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 +182 -0
- package/src/utils/customStyles.ts +45 -0
- package/src/utils/fetchWrapper.ts +73 -0
- package/src/utils/fonts.json +1597 -0
- package/src/utils/helper.ts +205 -0
- package/src/utils/local-storage.ts +15 -0
- package/src/utils/message.ts +162 -0
- package/src/utils/products.ts +186 -0
- package/src/utils/template-builder.ts +328 -0
- package/src/utils/templateIdentifierArea/biFold.ts +107 -0
- package/src/utils/templateIdentifierArea/index.ts +35 -0
- package/src/utils/templateIdentifierArea/personal.ts +107 -0
- package/src/utils/templateIdentifierArea/postCards.ts +163 -0
- package/src/utils/templateIdentifierArea/professional.ts +125 -0
- package/src/utils/templateIdentifierArea/snapPack.ts +107 -0
- package/src/utils/templateIdentifierArea/triFold.ts +107 -0
- package/src/utils/templateRestrictedArea/biFold.ts +329 -0
- package/src/utils/templateRestrictedArea/nonWindowProfessional.ts +90 -0
- package/src/utils/templateRestrictedArea/personal.ts +90 -0
- package/src/utils/templateRestrictedArea/postCard.ts +334 -0
- package/src/utils/templateRestrictedArea/postCardJumbo.tsx +408 -0
- package/src/utils/templateRestrictedArea/professional.ts +318 -0
- package/src/utils/templateRestrictedArea/realPenned.ts +233 -0
- package/src/utils/templateRestrictedArea/snapPack.ts +1009 -0
- package/src/utils/templateRestrictedArea/triFold.ts +330 -0
- package/src/utils/templateSafetyBorders/biFold.ts +91 -0
- package/src/utils/templateSafetyBorders/index.ts +43 -0
- package/src/utils/templateSafetyBorders/personal.ts +41 -0
- package/src/utils/templateSafetyBorders/postCards.ts +259 -0
- package/src/utils/templateSafetyBorders/professional.ts +78 -0
- package/src/utils/templateSafetyBorders/snapPack.ts +165 -0
- package/src/utils/templateSafetyBorders/triFold.ts +114 -0
- package/src/utils/templateSafetyBorders/types.d.ts +68 -0
- package/src/utils/types.ts +12 -0
- package/src/v2Theme.scss +142 -0
- package/tsconfig.json +29 -0
- package/tsconfig.node.json +12 -0
- package/update-version.js +23 -0
- package/version.js +1 -0
- package/vite.config.ts +8 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
/* eslint-disable no-case-declarations */
|
|
2
|
+
import {
|
|
3
|
+
GET_ONE_TEMPLATE,
|
|
4
|
+
TEMPLATE_LOADING,
|
|
5
|
+
TEMPLATE_PAGINATION_CHANGE,
|
|
6
|
+
TEMPLATE_SEARCH,
|
|
7
|
+
CLEAR_ALL_TEMPLATE,
|
|
8
|
+
SELECT_PRODUCT,
|
|
9
|
+
SELECT_POSTCARD,
|
|
10
|
+
SET_UPLOADED_IMAGES,
|
|
11
|
+
CLEAR_TEMPLATE_FIELDS,
|
|
12
|
+
LOAD_DATA_FROM_LOCAL_STORAGE,
|
|
13
|
+
SET_ROS_OFFER_PERCENTAGE,
|
|
14
|
+
SET_HIRE_DESIGNER_FORM_FIELDS,
|
|
15
|
+
CLEAR_HIRE_DESIGNER_FORM_FIELDS,
|
|
16
|
+
SET_BLOCK_COLOR,
|
|
17
|
+
CLEAR_TEMPLATE,
|
|
18
|
+
CLEAR_REDUX,
|
|
19
|
+
SET_PAGE_COUNT,
|
|
20
|
+
SET_PRODUCTS
|
|
21
|
+
} from '../actions/action-types';
|
|
22
|
+
|
|
23
|
+
// Utils
|
|
24
|
+
import {Products} from '../../utils/products';
|
|
25
|
+
|
|
26
|
+
export interface DynamicField {
|
|
27
|
+
value: string;
|
|
28
|
+
key: string;
|
|
29
|
+
defaultValue: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Template {
|
|
33
|
+
title: string;
|
|
34
|
+
product: Product | null;
|
|
35
|
+
templateType: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface Product {
|
|
39
|
+
id: string | number;
|
|
40
|
+
size: Array<{size: string}>;
|
|
41
|
+
productType: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface TemplatesState {
|
|
45
|
+
count: number;
|
|
46
|
+
rows: any[];
|
|
47
|
+
currentPage: number;
|
|
48
|
+
lastPage: number;
|
|
49
|
+
from: number;
|
|
50
|
+
to: number;
|
|
51
|
+
perPage: number;
|
|
52
|
+
total: number;
|
|
53
|
+
loading: boolean;
|
|
54
|
+
totalRecordsInDB: number | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface PaginationState {
|
|
58
|
+
page: number;
|
|
59
|
+
pageSize: number;
|
|
60
|
+
loading: boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface TemplateState {
|
|
64
|
+
title: string;
|
|
65
|
+
product: Product | null;
|
|
66
|
+
dynamicField: string;
|
|
67
|
+
dynamicFields: Record<string, DynamicField>;
|
|
68
|
+
defaultDynamicFieldsHashMap: Record<string, DynamicField>;
|
|
69
|
+
defaultDynamicFields: DynamicField[];
|
|
70
|
+
defaultSenderFields: DynamicField[];
|
|
71
|
+
defaultPropertyFields: DynamicField[];
|
|
72
|
+
defaultMiscFields: DynamicField[];
|
|
73
|
+
products: any[];
|
|
74
|
+
productDetails: any[];
|
|
75
|
+
productDetailByTemplate: any[];
|
|
76
|
+
templates: TemplatesState;
|
|
77
|
+
templatesPagination: PaginationState;
|
|
78
|
+
template: Template | null;
|
|
79
|
+
totalRecordsInDB: number | null;
|
|
80
|
+
search: string;
|
|
81
|
+
searchProductIds: string;
|
|
82
|
+
searchCreator: string;
|
|
83
|
+
templateType: string;
|
|
84
|
+
envelopeType: string;
|
|
85
|
+
templateLoading: boolean | null;
|
|
86
|
+
uploadedImages: any[];
|
|
87
|
+
offerPercentage: string | null;
|
|
88
|
+
blockColor: string;
|
|
89
|
+
hireDesignerForm: any;
|
|
90
|
+
pageCount: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
const initialState: TemplateState = {
|
|
95
|
+
title: '',
|
|
96
|
+
product: null,
|
|
97
|
+
dynamicField: '',
|
|
98
|
+
dynamicFields: {},
|
|
99
|
+
defaultDynamicFieldsHashMap: {
|
|
100
|
+
'{{C.FIRST_NAME}}': {
|
|
101
|
+
value: 'First Name',
|
|
102
|
+
key: '{{C.FIRST_NAME}}',
|
|
103
|
+
defaultValue: 'John',
|
|
104
|
+
},
|
|
105
|
+
'{{C.LAST_NAME}}': {
|
|
106
|
+
value: 'Last Name',
|
|
107
|
+
key: '{{C.LAST_NAME}}',
|
|
108
|
+
defaultValue: 'Doe',
|
|
109
|
+
},
|
|
110
|
+
'{{C.FIRST_NAME}} {{C.LAST_NAME}}': {
|
|
111
|
+
value: 'Full Name',
|
|
112
|
+
key: '{{C.FIRST_NAME}} {{C.LAST_NAME}}',
|
|
113
|
+
defaultValue: 'John Doe',
|
|
114
|
+
},
|
|
115
|
+
'{{C.COMPANY_NAME}}': {
|
|
116
|
+
value: 'Company Name',
|
|
117
|
+
key: '{{C.COMPANY_NAME}}',
|
|
118
|
+
defaultValue: 'ABC Company, Inc.',
|
|
119
|
+
},
|
|
120
|
+
'{{C.ADDRESS_1}}': {
|
|
121
|
+
value: 'Mailing Address 1',
|
|
122
|
+
key: '{{C.ADDRESS_1}}',
|
|
123
|
+
defaultValue: '123 Main Street',
|
|
124
|
+
},
|
|
125
|
+
'{{C.ADDRESS_2}}': {
|
|
126
|
+
value: 'Mailing Address 2',
|
|
127
|
+
key: '{{C.ADDRESS_2}}',
|
|
128
|
+
defaultValue: 'Suite 2',
|
|
129
|
+
},
|
|
130
|
+
'{{C.CITY}}': {
|
|
131
|
+
value: 'Mailing City',
|
|
132
|
+
key: '{{C.CITY}}',
|
|
133
|
+
defaultValue: 'Lawrence',
|
|
134
|
+
},
|
|
135
|
+
'{{C.STATE}}': {
|
|
136
|
+
value: 'Mailing State',
|
|
137
|
+
key: '{{C.STATE}}',
|
|
138
|
+
defaultValue: 'MA',
|
|
139
|
+
},
|
|
140
|
+
'{{C.ZIP_CODE}}': {
|
|
141
|
+
value: 'Mailing Zip Code',
|
|
142
|
+
key: '{{C.ZIP_CODE}}',
|
|
143
|
+
defaultValue: '01843',
|
|
144
|
+
},
|
|
145
|
+
'{{C.PHONE_NUMBER}}': {
|
|
146
|
+
value: 'Contact Phone Number',
|
|
147
|
+
key: '{{C.PHONE_NUMBER}}',
|
|
148
|
+
defaultValue: '(555) 278-9389',
|
|
149
|
+
},
|
|
150
|
+
'{{C.EMAIL}}': {
|
|
151
|
+
value: 'Contact Email',
|
|
152
|
+
key: '{{C.EMAIL}}',
|
|
153
|
+
defaultValue: 'johndoe@gmail.com',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
defaultDynamicFields: [
|
|
157
|
+
{
|
|
158
|
+
value: 'First Name',
|
|
159
|
+
key: '{{C.FIRST_NAME}}',
|
|
160
|
+
defaultValue: 'John',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
value: 'Last Name',
|
|
164
|
+
key: '{{C.LAST_NAME}}',
|
|
165
|
+
defaultValue: 'Doe',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
value: 'Full Name',
|
|
169
|
+
key: '{{C.FIRST_NAME}} {{C.LAST_NAME}}',
|
|
170
|
+
defaultValue: 'John Doe',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
value: 'Company Name',
|
|
174
|
+
key: '{{C.COMPANY_NAME}}',
|
|
175
|
+
defaultValue: 'ABC Company, Inc.',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
value: 'Address 1',
|
|
179
|
+
key: '{{C.ADDRESS_1}}',
|
|
180
|
+
defaultValue: '123 Main Street',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: 'Address 2',
|
|
184
|
+
key: '{{C.ADDRESS_2}}',
|
|
185
|
+
defaultValue: 'Suite 2',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
value: 'City',
|
|
189
|
+
key: '{{C.CITY}}',
|
|
190
|
+
defaultValue: 'Lawrence',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
value: 'State',
|
|
194
|
+
key: '{{C.STATE}}',
|
|
195
|
+
defaultValue: 'MA',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
value: 'Zip Code',
|
|
199
|
+
key: '{{C.ZIP_CODE}}',
|
|
200
|
+
defaultValue: '01843',
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
value: 'Phone Number',
|
|
204
|
+
key: '{{C.PHONE_NUMBER}}',
|
|
205
|
+
defaultValue: '(555) 278-9389',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
value: 'Email',
|
|
209
|
+
key: '{{C.EMAIL}}',
|
|
210
|
+
defaultValue: 'johndoe@gmail.com',
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
defaultSenderFields: [
|
|
214
|
+
{
|
|
215
|
+
value: 'Sender First Name',
|
|
216
|
+
key: '{{SPF.FIRST_NAME}}',
|
|
217
|
+
defaultValue: 'John',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
value: 'Sender Last Name',
|
|
221
|
+
key: '{{SPF.LAST_NAME}}',
|
|
222
|
+
defaultValue: 'Doe',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
value: "Sender Company Name",
|
|
226
|
+
key: "{{SPF.COMPANY_NAME}}",
|
|
227
|
+
defaultValue: "ABC Company, Inc.",
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
value: "Sender Address 1",
|
|
231
|
+
key: "{{SPF.ADDRESS_1}}",
|
|
232
|
+
defaultValue: "123 Main Street",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
value: "Sender Address 2",
|
|
236
|
+
key: "{{SPF.ADDRESS_2}}",
|
|
237
|
+
defaultValue: "Suite 2",
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
value: "Sender City",
|
|
241
|
+
key: "{{SPF.CITY}}",
|
|
242
|
+
defaultValue: "Lawrence",
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
value: "Sender State",
|
|
246
|
+
key: "{{SPF.STATE}}",
|
|
247
|
+
defaultValue: "MA",
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
value: "Sender Zip Code",
|
|
251
|
+
key: "{{SPF.ZIP_CODE}}",
|
|
252
|
+
defaultValue: "01843",
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
value: "Sender Phone Number",
|
|
256
|
+
key: "{{SPF.PHONE_NUMBER}}",
|
|
257
|
+
defaultValue: "(555) 278-9389",
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
value: 'Sender Email',
|
|
261
|
+
key: '{{SPF.EMAIL}}',
|
|
262
|
+
defaultValue: 'johndoe@gmail.com',
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
defaultPropertyFields: [
|
|
266
|
+
{
|
|
267
|
+
value: 'Property Address',
|
|
268
|
+
key: '{{C.PROPERTY_ADDRESS}}',
|
|
269
|
+
defaultValue: '912 Main Street',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
value: 'Property City',
|
|
273
|
+
key: '{{C.PROPERTY_CITY}}',
|
|
274
|
+
defaultValue: 'New York',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
value: 'Property State',
|
|
278
|
+
key: '{{C.PROPERTY_STATE}}',
|
|
279
|
+
defaultValue: 'NY',
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
value: 'Property Zip Code',
|
|
283
|
+
key: '{{C.PROPERTY_ZIP_CODE}}',
|
|
284
|
+
defaultValue: '10008',
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
value: 'Property Offer',
|
|
288
|
+
key: '{{C.PROPERTY_OFFER}}',
|
|
289
|
+
defaultValue: '$123,456.00',
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
value: 'Property Written Offer',
|
|
293
|
+
key: '{{ROS.WRITTEN_OFFER}}',
|
|
294
|
+
defaultValue:
|
|
295
|
+
'One hundred twenty-three thousand four hundred fifty-six and 00/100',
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
defaultMiscFields: [
|
|
299
|
+
{
|
|
300
|
+
value: "Mailing Date - mm/dd/yyyy",
|
|
301
|
+
key: "{{MISC.MAILED_DATE}}",
|
|
302
|
+
defaultValue: "12/13/2025",
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
value: "Mailing Date - Month DD, YYYY",
|
|
306
|
+
key: "{{MISC.MAILED_DATE_MONTH_D_Y}}",
|
|
307
|
+
defaultValue: "December 13, 2025",
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
value: "Respond by Date - mm/dd/yyyy",
|
|
311
|
+
key: "{{MISC.RESPOND_BY_DATE}}",
|
|
312
|
+
defaultValue: "01/12/2026",
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
value: "Respond by Date - Month DD, YYYY",
|
|
316
|
+
key: "{{MISC.RESPOND_BY_DATE_MONTH_D_Y}}",
|
|
317
|
+
defaultValue: "January 12, 2026",
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
products: Products,
|
|
321
|
+
productDetailByTemplate: [],
|
|
322
|
+
templates: {
|
|
323
|
+
count: 0,
|
|
324
|
+
rows: [],
|
|
325
|
+
currentPage: 1,
|
|
326
|
+
lastPage: 1,
|
|
327
|
+
from: 0,
|
|
328
|
+
to: 0,
|
|
329
|
+
perPage: 20,
|
|
330
|
+
total: 0,
|
|
331
|
+
loading: true,
|
|
332
|
+
totalRecordsInDB: null,
|
|
333
|
+
},
|
|
334
|
+
templatesPagination: {page: 0, pageSize: 20, loading: false},
|
|
335
|
+
template: null,
|
|
336
|
+
totalRecordsInDB: null,
|
|
337
|
+
search: '',
|
|
338
|
+
searchProductIds: '',
|
|
339
|
+
searchCreator: '',
|
|
340
|
+
templateType: 'json',
|
|
341
|
+
envelopeType: '',
|
|
342
|
+
templateLoading: null,
|
|
343
|
+
uploadedImages: [],
|
|
344
|
+
offerPercentage: null,
|
|
345
|
+
blockColor: '#FFFFFF45',
|
|
346
|
+
hireDesignerForm: {
|
|
347
|
+
queryTitle: '',
|
|
348
|
+
queryEmail: '',
|
|
349
|
+
queryFiles: [],
|
|
350
|
+
queryVideoUrl: '',
|
|
351
|
+
queryComments: '',
|
|
352
|
+
},
|
|
353
|
+
pageCount: 1
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// @ts-ignore
|
|
357
|
+
const templateReducer = (
|
|
358
|
+
state = initialState,
|
|
359
|
+
{type, payload}: {type: string; payload: any}
|
|
360
|
+
): TemplateState => {
|
|
361
|
+
switch (type) {
|
|
362
|
+
case GET_ONE_TEMPLATE:
|
|
363
|
+
return {
|
|
364
|
+
...state,
|
|
365
|
+
template: payload.data,
|
|
366
|
+
title: payload.type === 'copy' ? state.title : payload.data.title,
|
|
367
|
+
product: payload.data.product,
|
|
368
|
+
templateType: payload.data.templateType,
|
|
369
|
+
};
|
|
370
|
+
case CLEAR_TEMPLATE:
|
|
371
|
+
return {
|
|
372
|
+
...state,
|
|
373
|
+
template: null,
|
|
374
|
+
};
|
|
375
|
+
case TEMPLATE_LOADING:
|
|
376
|
+
return {
|
|
377
|
+
...state,
|
|
378
|
+
templateLoading: payload,
|
|
379
|
+
};
|
|
380
|
+
case TEMPLATE_PAGINATION_CHANGE:
|
|
381
|
+
return {
|
|
382
|
+
...state,
|
|
383
|
+
templatesPagination: {...payload.data},
|
|
384
|
+
};
|
|
385
|
+
case TEMPLATE_SEARCH:
|
|
386
|
+
return {
|
|
387
|
+
...state,
|
|
388
|
+
[payload.name]: payload.value,
|
|
389
|
+
};
|
|
390
|
+
case SELECT_PRODUCT:
|
|
391
|
+
return {
|
|
392
|
+
...state,
|
|
393
|
+
product: {
|
|
394
|
+
...payload.product,
|
|
395
|
+
selectedSize: payload.product.size[0].size,
|
|
396
|
+
...(!payload.productType &&
|
|
397
|
+
payload.product.productType !== 'Postcards'
|
|
398
|
+
? {selectedSize: payload.product.size[0].size}
|
|
399
|
+
: {}),
|
|
400
|
+
...(payload.productType ? {productType: payload.productType} : {}),
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
case SELECT_POSTCARD:
|
|
404
|
+
return {
|
|
405
|
+
...state,
|
|
406
|
+
product: {
|
|
407
|
+
...payload.product,
|
|
408
|
+
productType: payload.productType,
|
|
409
|
+
},
|
|
410
|
+
};
|
|
411
|
+
case SET_HIRE_DESIGNER_FORM_FIELDS:
|
|
412
|
+
return {
|
|
413
|
+
...state,
|
|
414
|
+
hireDesignerForm: {
|
|
415
|
+
...state.hireDesignerForm,
|
|
416
|
+
...payload,
|
|
417
|
+
},
|
|
418
|
+
};
|
|
419
|
+
case SET_UPLOADED_IMAGES:
|
|
420
|
+
return {
|
|
421
|
+
...state,
|
|
422
|
+
uploadedImages: payload,
|
|
423
|
+
};
|
|
424
|
+
case CLEAR_ALL_TEMPLATE:
|
|
425
|
+
return {
|
|
426
|
+
...state,
|
|
427
|
+
templates: {...initialState.templates},
|
|
428
|
+
};
|
|
429
|
+
case CLEAR_TEMPLATE_FIELDS:
|
|
430
|
+
return {
|
|
431
|
+
...state,
|
|
432
|
+
title: '',
|
|
433
|
+
product: null,
|
|
434
|
+
dynamicField: '',
|
|
435
|
+
dynamicFields: {},
|
|
436
|
+
templateType: 'json',
|
|
437
|
+
envelopeType: '',
|
|
438
|
+
};
|
|
439
|
+
case LOAD_DATA_FROM_LOCAL_STORAGE:
|
|
440
|
+
return {
|
|
441
|
+
...state,
|
|
442
|
+
title: payload.data.title,
|
|
443
|
+
product: payload.data.product,
|
|
444
|
+
templateType: payload.data.templateType,
|
|
445
|
+
envelopeType: payload.data.envelopeType,
|
|
446
|
+
};
|
|
447
|
+
case CLEAR_HIRE_DESIGNER_FORM_FIELDS:
|
|
448
|
+
return {
|
|
449
|
+
...state,
|
|
450
|
+
hireDesignerForm: {
|
|
451
|
+
queryTitle: '',
|
|
452
|
+
queryEmail: '',
|
|
453
|
+
queryFiles: [],
|
|
454
|
+
queryVideoUrl: '',
|
|
455
|
+
queryComments: '',
|
|
456
|
+
},
|
|
457
|
+
};
|
|
458
|
+
case SET_ROS_OFFER_PERCENTAGE:
|
|
459
|
+
return {
|
|
460
|
+
...state,
|
|
461
|
+
offerPercentage: payload,
|
|
462
|
+
};
|
|
463
|
+
case SET_BLOCK_COLOR:
|
|
464
|
+
return {
|
|
465
|
+
...state,
|
|
466
|
+
blockColor: payload,
|
|
467
|
+
};
|
|
468
|
+
case SET_PAGE_COUNT:
|
|
469
|
+
return {
|
|
470
|
+
...state,
|
|
471
|
+
pageCount: payload,
|
|
472
|
+
};
|
|
473
|
+
case SET_PRODUCTS:
|
|
474
|
+
return {
|
|
475
|
+
...state,
|
|
476
|
+
productDetails: payload?.rows || [],
|
|
477
|
+
};
|
|
478
|
+
case CLEAR_REDUX:
|
|
479
|
+
return initialState;
|
|
480
|
+
default:
|
|
481
|
+
return state;
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
export {templateReducer};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// redux/store.ts
|
|
2
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
3
|
+
import rootReducer from './reducers';
|
|
4
|
+
|
|
5
|
+
const store = configureStore({
|
|
6
|
+
reducer: rootReducer,
|
|
7
|
+
middleware: (getDefaultMiddleware : any) =>
|
|
8
|
+
getDefaultMiddleware({
|
|
9
|
+
thunk: true,
|
|
10
|
+
serializableCheck: false,
|
|
11
|
+
immutableCheck: false,
|
|
12
|
+
}),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type RootState = ReturnType<typeof store.getState>;
|
|
16
|
+
export type AppDispatch = typeof store.dispatch;
|
|
17
|
+
|
|
18
|
+
export default store;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// variables
|
|
2
|
+
|
|
3
|
+
// background colors
|
|
4
|
+
$bgLight: #fff7ea;
|
|
5
|
+
$bgTransparent: rgba(0, 0, 0, 0.5);
|
|
6
|
+
$bgLight300: #fff9f0;
|
|
7
|
+
$bgGrey: #f7fffb;
|
|
8
|
+
$bgPrimary: #f28230;
|
|
9
|
+
$bgPrimary800: #ef7820;
|
|
10
|
+
$bgGrey500: #f9f9f9;
|
|
11
|
+
$formLayoutBg: linear-gradient(
|
|
12
|
+
252deg,
|
|
13
|
+
#eec5b3 11.65%,
|
|
14
|
+
#ffceb3 26.15%,
|
|
15
|
+
#ffe4b4 42.72%,
|
|
16
|
+
#ffe4b3 61.64%,
|
|
17
|
+
#fbcbb4 80.93%,
|
|
18
|
+
#e2b9b3 100%
|
|
19
|
+
);
|
|
20
|
+
// primary color
|
|
21
|
+
$primary-color: #ed5c2f;
|
|
22
|
+
// dark shades
|
|
23
|
+
$black: #000;
|
|
24
|
+
$black200: rgba(68, 66, 65, 0.3);
|
|
25
|
+
$black300: rgba(0, 0, 0, 0.5);
|
|
26
|
+
$black400: #303030;
|
|
27
|
+
$black700: #000000bf;
|
|
28
|
+
$dark800: #080808;
|
|
29
|
+
$blue: #212b36;
|
|
30
|
+
// yellow shades
|
|
31
|
+
$yellow: #fab331;
|
|
32
|
+
$yellow300: #fff8ee;
|
|
33
|
+
$yellow400: #fdecd3;
|
|
34
|
+
$yellow500: #ffdec0;
|
|
35
|
+
// light shades
|
|
36
|
+
$white: #fff;
|
|
37
|
+
$grey: #545454;
|
|
38
|
+
$grey300: #aaa;
|
|
39
|
+
$grey400: #2b2b2a;
|
|
40
|
+
$grey500: #444241;
|
|
41
|
+
$grey800: #222221;
|
|
42
|
+
$light: rgba(255, 248, 238, 1);
|
|
43
|
+
$light300: #f4f4f4;
|
|
44
|
+
$grey: #696969;
|
|
45
|
+
$greyCheckBox: #d1d5db;
|
|
46
|
+
// red shades
|
|
47
|
+
$red: #ff0000;
|
|
48
|
+
$red400: rgba(255, 0, 0, 1);
|
|
49
|
+
// green shades
|
|
50
|
+
$green500: #03a155;
|
|
51
|
+
$success: #7ed321;
|
|
52
|
+
$bgSuccess: #01bb62;
|
|
53
|
+
// orange shade
|
|
54
|
+
$iconColor: rgba(237, 92, 47, 1);
|
|
55
|
+
// brown shades
|
|
56
|
+
$brown300: rgba(255, 192, 184, 0.23);
|
|
57
|
+
|
|
58
|
+
// Stripe Variables
|
|
59
|
+
$stripeBlue: #0570de;
|
|
60
|
+
$stripeText: #30313d;
|
|
61
|
+
$stripeDanger: #df1b41;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export const mockElement = () => ({
|
|
2
|
+
mount: jest.fn(),
|
|
3
|
+
destroy: jest.fn(),
|
|
4
|
+
on: jest.fn(),
|
|
5
|
+
update: jest.fn(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const mockElements = () => {
|
|
9
|
+
const elements = {};
|
|
10
|
+
return {
|
|
11
|
+
create: jest.fn((type) => {
|
|
12
|
+
elements[type] = mockElement();
|
|
13
|
+
return elements[type];
|
|
14
|
+
}),
|
|
15
|
+
getElement: jest.fn((type) => {
|
|
16
|
+
return elements[type] || null;
|
|
17
|
+
}),
|
|
18
|
+
update: jest.fn(),
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const mockCustomCheckoutSession = () => {
|
|
23
|
+
return {
|
|
24
|
+
lineItems: [],
|
|
25
|
+
currency: 'usd',
|
|
26
|
+
shippingOptions: [],
|
|
27
|
+
total: {
|
|
28
|
+
subtotal: 1099,
|
|
29
|
+
taxExclusive: 0,
|
|
30
|
+
taxInclusive: 0,
|
|
31
|
+
shippingRate: 0,
|
|
32
|
+
discount: 0,
|
|
33
|
+
total: 1099,
|
|
34
|
+
},
|
|
35
|
+
confirmationRequirements: [],
|
|
36
|
+
canConfirm: true,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const mockCustomCheckoutSdk = () => {
|
|
41
|
+
const elements = {};
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
changeAppearance: jest.fn(),
|
|
45
|
+
createElement: jest.fn((type) => {
|
|
46
|
+
elements[type] = mockElement();
|
|
47
|
+
return elements[type];
|
|
48
|
+
}),
|
|
49
|
+
getElement: jest.fn((type) => {
|
|
50
|
+
return elements[type] || null;
|
|
51
|
+
}),
|
|
52
|
+
session: jest.fn(() => mockCustomCheckoutSession()),
|
|
53
|
+
applyPromotionCode: jest.fn(),
|
|
54
|
+
removePromotionCode: jest.fn(),
|
|
55
|
+
updateShippingAddress: jest.fn(),
|
|
56
|
+
updateBillingAddress: jest.fn(),
|
|
57
|
+
updatePhoneNumber: jest.fn(),
|
|
58
|
+
updateEmail: jest.fn(),
|
|
59
|
+
updateLineItemQuantity: jest.fn(),
|
|
60
|
+
updateShippingOption: jest.fn(),
|
|
61
|
+
confirm: jest.fn(),
|
|
62
|
+
on: jest.fn(),
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const mockEmbeddedCheckout = () => ({
|
|
67
|
+
mount: jest.fn(),
|
|
68
|
+
unmount: jest.fn(),
|
|
69
|
+
destroy: jest.fn(),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const mockStripe = () => {
|
|
73
|
+
const customCheckoutSdk = mockCustomCheckoutSdk();
|
|
74
|
+
return {
|
|
75
|
+
elements: jest.fn(() => mockElements()),
|
|
76
|
+
createToken: jest.fn(),
|
|
77
|
+
createSource: jest.fn(),
|
|
78
|
+
createPaymentMethod: jest.fn(),
|
|
79
|
+
confirmCardPayment: jest.fn(),
|
|
80
|
+
confirmCardSetup: jest.fn(),
|
|
81
|
+
paymentRequest: jest.fn(),
|
|
82
|
+
registerAppInfo: jest.fn(),
|
|
83
|
+
_registerWrapper: jest.fn(),
|
|
84
|
+
initCustomCheckout: jest.fn().mockResolvedValue(customCheckoutSdk),
|
|
85
|
+
initEmbeddedCheckout: jest.fn(() =>
|
|
86
|
+
Promise.resolve(mockEmbeddedCheckout())
|
|
87
|
+
),
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
package/src/utils/api.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import fetchWrapper from './fetchWrapper';
|
|
2
|
+
|
|
3
|
+
export const get = async (endpoint: string, params?: any) => {
|
|
4
|
+
return await fetchWrapper(endpoint, {
|
|
5
|
+
method: 'GET',
|
|
6
|
+
params,
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const post = async (endpoint: string, body: any) => {
|
|
11
|
+
return await fetchWrapper(endpoint, {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
body,
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const put = async (endpoint: string, body: any) => {
|
|
18
|
+
return await fetchWrapper(endpoint, {
|
|
19
|
+
method: 'PUT',
|
|
20
|
+
body,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const patch = async (endpoint: string, body: any) => {
|
|
25
|
+
return await fetchWrapper(endpoint, {
|
|
26
|
+
method: 'PATCH',
|
|
27
|
+
body,
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const del = async (endpoint: string, params?: Record<string, string>) => {
|
|
32
|
+
return await fetchWrapper(endpoint, {
|
|
33
|
+
method: 'DELETE',
|
|
34
|
+
params,
|
|
35
|
+
});
|
|
36
|
+
};
|