@openlettermarketing/olc-react-sdk 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build/types/App.d.ts +1 -0
- package/build/types/components/TemplateBuilder/index.d.ts +1 -0
- package/build/types/components/TopNavigation/index.d.ts +1 -0
- package/build/types/index.d.ts +3 -2
- package/package.json +1 -1
- package/.eslintignore +0 -1
- package/.eslintrc.cjs +0 -18
- package/.eslintrc.yml +0 -47
- 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 -72
- package/src/assets/Fonts/Lexi-Regular.ttf +0 -0
- package/src/assets/images/input/cancel.tsx +0 -20
- package/src/assets/images/input/search.tsx +0 -20
- package/src/assets/images/modal-icons/cancelIcon.png +0 -0
- package/src/assets/images/modal-icons/del.tsx +0 -19
- package/src/assets/images/modal-icons/delete.svg +0 -3
- package/src/assets/images/modal-icons/modal-cross.tsx +0 -23
- package/src/assets/images/modal-icons/save.tsx +0 -23
- package/src/assets/images/templates/add-icon.svg +0 -5
- package/src/assets/images/templates/back-arrow.tsx +0 -19
- package/src/assets/images/templates/back-dialog-icon.png +0 -0
- package/src/assets/images/templates/back-dialog-icon.svg +0 -3
- package/src/assets/images/templates/barcode.png +0 -0
- package/src/assets/images/templates/bi-fold-self-mailers.tsx +0 -28
- package/src/assets/images/templates/black-trash-icon.svg +0 -3
- package/src/assets/images/templates/cancel.svg +0 -4
- package/src/assets/images/templates/cancelIcon.png +0 -0
- package/src/assets/images/templates/clipboard.svg +0 -3
- package/src/assets/images/templates/contact-search.svg +0 -3
- package/src/assets/images/templates/content-copy-icon.tsx +0 -24
- package/src/assets/images/templates/cross.svg +0 -3
- package/src/assets/images/templates/custom-template-icon-black.svg +0 -3
- package/src/assets/images/templates/custom-template-icon.svg +0 -3
- package/src/assets/images/templates/custom-template.tsx +0 -23
- package/src/assets/images/templates/dummy-template.svg +0 -21
- 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/filter-2.svg +0 -13
- package/src/assets/images/templates/info-icon.svg +0 -12
- package/src/assets/images/templates/info-icon.tsx +0 -37
- package/src/assets/images/templates/one-barcode.png +0 -0
- package/src/assets/images/templates/personal-letter.tsx +0 -53
- package/src/assets/images/templates/plus-icon.svg +0 -5
- package/src/assets/images/templates/postcard.tsx +0 -32
- package/src/assets/images/templates/professional-letter.tsx +0 -53
- package/src/assets/images/templates/real-penned-letters.tsx +0 -57
- package/src/assets/images/templates/search.svg +0 -3
- 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.tsx +0 -20
- package/src/assets/images/templates/template-copy.svg +0 -3
- package/src/assets/images/templates/template-default-design.tsx +0 -21
- package/src/assets/images/templates/template-delete.svg +0 -3
- package/src/assets/images/templates/template-edit.svg +0 -4
- package/src/assets/images/templates/template-save-icon.svg +0 -3
- package/src/assets/images/templates/template-search-2.svg +0 -9
- package/src/assets/images/templates/template-search.svg +0 -4
- package/src/assets/images/templates/thumbnail.svg +0 -10
- package/src/assets/images/templates/trash-icon.svg +0 -13
- package/src/assets/images/templates/tri-fold-self-mailers.tsx +0 -93
- package/src/components/CreateTemplate/index.tsx +0 -379
- package/src/components/CreateTemplate/styles.scss +0 -363
- package/src/components/GenericUIBlocks/Button/index.tsx +0 -21
- package/src/components/GenericUIBlocks/Button/styles.scss +0 -15
- package/src/components/GenericUIBlocks/CircularProgress/index.tsx +0 -18
- package/src/components/GenericUIBlocks/CircularProgress/styles.scss +0 -98
- package/src/components/GenericUIBlocks/Dialog/index.tsx +0 -127
- package/src/components/GenericUIBlocks/Dialog/styles.scss +0 -106
- 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 -86
- package/src/components/GenericUIBlocks/GeneralSelect/styles.scss +0 -77
- package/src/components/GenericUIBlocks/GeneralTooltip/index.tsx +0 -24
- package/src/components/GenericUIBlocks/GeneralTooltip/styles.scss +0 -9
- package/src/components/GenericUIBlocks/GenericSnackbar/index.tsx +0 -53
- package/src/components/GenericUIBlocks/GenericSnackbar/styles.scss +0 -34
- package/src/components/GenericUIBlocks/Grid/index.tsx +0 -82
- package/src/components/GenericUIBlocks/Input/index.tsx +0 -89
- package/src/components/GenericUIBlocks/Input/styles.scss +0 -80
- package/src/components/GenericUIBlocks/Typography/index.tsx +0 -18
- package/src/components/GenericUIBlocks/Typography/styles.scss +0 -27
- package/src/components/SidePanel/customFields/customFieldSection.tsx +0 -173
- package/src/components/SidePanel/customFields/styles.scss +0 -47
- package/src/components/SidePanel/index.tsx +0 -42
- package/src/components/SidePanel/templates/customTemplateSection.tsx +0 -503
- package/src/components/SidePanel/templates/styles.scss +0 -151
- package/src/components/TemplateBuilder/index.tsx +0 -301
- package/src/components/TemplateBuilder/styles.scss +0 -66
- package/src/components/TopNavigation/ConfirmNavigateDialog/index.tsx +0 -58
- package/src/components/TopNavigation/ConfirmNavigateDialog/styles.scss +0 -123
- package/src/components/TopNavigation/EditTemplateNameModel/index.tsx +0 -98
- package/src/components/TopNavigation/EditTemplateNameModel/styles.scss +0 -88
- package/src/components/TopNavigation/SaveTemplateModel/index.tsx +0 -60
- package/src/components/TopNavigation/SaveTemplateModel/styles.scss +0 -128
- package/src/components/TopNavigation/index.tsx +0 -405
- package/src/components/TopNavigation/styles.scss +0 -83
- package/src/importMeta.d.ts +0 -9
- package/src/index.scss +0 -137
- package/src/index.tsx +0 -80
- package/src/libs/test.ts +0 -7
- package/src/redux/actions/action-types.ts +0 -42
- package/src/redux/actions/customFieldAction.ts +0 -28
- package/src/redux/actions/snackbarActions.ts +0 -16
- package/src/redux/actions/templateActions.ts +0 -456
- package/src/redux/reducers/customFieldReducer.ts +0 -97
- package/src/redux/reducers/index.ts +0 -14
- package/src/redux/reducers/snackbarReducer.ts +0 -41
- package/src/redux/reducers/templateReducer.ts +0 -353
- 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 -40
- package/src/utils/customStyles.ts +0 -135
- package/src/utils/fetchWrapper.ts +0 -68
- package/src/utils/fonts.json +0 -1597
- package/src/utils/helper.ts +0 -19
- package/src/utils/local-storage.ts +0 -15
- package/src/utils/message.ts +0 -71
- package/src/utils/template-builder.ts +0 -147
- package/src/utils/templateRestrictedArea/biFold.ts +0 -433
- package/src/utils/templateRestrictedArea/postCard.ts +0 -439
- package/src/utils/templateRestrictedArea/professional.ts +0 -422
- package/src/utils/templateRestrictedArea/realPenned.ts +0 -244
- package/src/utils/templateRestrictedArea/triFold.ts +0 -434
- package/tsconfig.json +0 -29
- package/tsconfig.node.json +0 -12
- package/vite.config.ts +0 -8
- package/webpack.config.js +0 -80
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-case-declarations */
|
|
2
|
-
import {
|
|
3
|
-
SET_DYNAMIC_FIELDS,
|
|
4
|
-
SET_DYNAMIC_FIELD_VALUE,
|
|
5
|
-
CLEAR_DYNAMIC_FIELDS,
|
|
6
|
-
REMOVE_FROM_DYNAMIC_FIELDS,
|
|
7
|
-
GET_PRODUCTS,
|
|
8
|
-
GET_ONE_TEMPLATE,
|
|
9
|
-
TEMPLATE_LOADING,
|
|
10
|
-
CLEAR_FIELDS,
|
|
11
|
-
TEMPLATE_PAGINATION_CHANGE,
|
|
12
|
-
TEMPLATE_SEARCH,
|
|
13
|
-
CLEAR_ALL_TEMPLATE,
|
|
14
|
-
SELECT_PRODUCT,
|
|
15
|
-
SELECT_POSTCARD,
|
|
16
|
-
CLEAR_TEMPLATE_FIELDS,
|
|
17
|
-
GET_DYNAMIC_FIELDS_FROM_SERVER,
|
|
18
|
-
LOAD_DATA_FROM_LOCAL_STORAGE,
|
|
19
|
-
SET_PRODUCT_DETAILS,
|
|
20
|
-
CLEAR_TEMPLATE,
|
|
21
|
-
CLEAR_REDUX
|
|
22
|
-
} from "../actions/action-types";
|
|
23
|
-
|
|
24
|
-
export interface DynamicField {
|
|
25
|
-
value: string;
|
|
26
|
-
key: string;
|
|
27
|
-
defaultValue: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface Template {
|
|
31
|
-
title: string;
|
|
32
|
-
product: Product | null;
|
|
33
|
-
templateType: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface Product {
|
|
37
|
-
size: Array<{ size: string }>;
|
|
38
|
-
productType: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface TemplatesState {
|
|
42
|
-
count: number;
|
|
43
|
-
rows: any[];
|
|
44
|
-
currentPage: number;
|
|
45
|
-
lastPage: number;
|
|
46
|
-
from: number;
|
|
47
|
-
to: number;
|
|
48
|
-
perPage: number;
|
|
49
|
-
total: number;
|
|
50
|
-
loading: boolean;
|
|
51
|
-
totalRecordsInDB: number | null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface PaginationState {
|
|
55
|
-
page: number;
|
|
56
|
-
pageSize: number;
|
|
57
|
-
loading: boolean;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface TemplateState {
|
|
61
|
-
title: string;
|
|
62
|
-
product: Product | null;
|
|
63
|
-
dynamicField: string;
|
|
64
|
-
dynamicFields: Record<string, DynamicField>;
|
|
65
|
-
defaultDynamicFieldsHashMap: Record<string, DynamicField>;
|
|
66
|
-
defaultDynamicFields: DynamicField[];
|
|
67
|
-
products: any[];
|
|
68
|
-
productDetailByTemplate: any[];
|
|
69
|
-
templates: TemplatesState;
|
|
70
|
-
templatesPagination: PaginationState;
|
|
71
|
-
template: Template | null;
|
|
72
|
-
totalRecordsInDB: number | null;
|
|
73
|
-
search: string;
|
|
74
|
-
searchProductIds: string;
|
|
75
|
-
searchCreator: string;
|
|
76
|
-
templateType: string;
|
|
77
|
-
envelopeType: string;
|
|
78
|
-
templateLoading: boolean | null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const initialState: TemplateState = {
|
|
84
|
-
title: "",
|
|
85
|
-
product: null,
|
|
86
|
-
dynamicField: "",
|
|
87
|
-
dynamicFields: {},
|
|
88
|
-
defaultDynamicFieldsHashMap: {
|
|
89
|
-
"{{C.FIRST_NAME}}": {
|
|
90
|
-
value: "First Name",
|
|
91
|
-
key: "{{C.FIRST_NAME}}",
|
|
92
|
-
defaultValue: "John",
|
|
93
|
-
},
|
|
94
|
-
"{{C.LAST_NAME}}": {
|
|
95
|
-
value: "Last Name",
|
|
96
|
-
key: "{{C.LAST_NAME}}",
|
|
97
|
-
defaultValue: "Doe",
|
|
98
|
-
},
|
|
99
|
-
"{{C.FIRST_NAME}} {{C.LAST_NAME}}": {
|
|
100
|
-
value: "Full Name",
|
|
101
|
-
key: "{{C.FIRST_NAME}} {{C.LAST_NAME}}",
|
|
102
|
-
defaultValue: "John Doe",
|
|
103
|
-
},
|
|
104
|
-
"{{C.COMPANY_NAME}}": {
|
|
105
|
-
value: "Company Name",
|
|
106
|
-
key: "{{C.COMPANY_NAME}}",
|
|
107
|
-
defaultValue: "ABC Company, Inc.",
|
|
108
|
-
},
|
|
109
|
-
"{{C.ADDRESS_1}}": {
|
|
110
|
-
value: "Address 1",
|
|
111
|
-
key: "{{C.ADDRESS_1}}",
|
|
112
|
-
defaultValue: "123 Main Street",
|
|
113
|
-
},
|
|
114
|
-
"{{C.ADDRESS_2}}": {
|
|
115
|
-
value: "Address 2",
|
|
116
|
-
key: "{{C.ADDRESS_2}}",
|
|
117
|
-
defaultValue: "Suite 2",
|
|
118
|
-
},
|
|
119
|
-
"{{C.CITY}}": {
|
|
120
|
-
value: "City",
|
|
121
|
-
key: "{{C.CITY}}",
|
|
122
|
-
defaultValue: "Lawrence",
|
|
123
|
-
},
|
|
124
|
-
"{{C.STATE}}": {
|
|
125
|
-
value: "State",
|
|
126
|
-
key: "{{C.STATE}}",
|
|
127
|
-
defaultValue: "MA",
|
|
128
|
-
},
|
|
129
|
-
"{{C.ZIP_CODE}}": {
|
|
130
|
-
value: "Zip Code",
|
|
131
|
-
key: "{{C.ZIP_CODE}}",
|
|
132
|
-
defaultValue: "01843",
|
|
133
|
-
},
|
|
134
|
-
"{{C.PHONE_NUMBER}}": {
|
|
135
|
-
value: "Phone Number",
|
|
136
|
-
key: "{{C.PHONE_NUMBER}}",
|
|
137
|
-
defaultValue: "(555) 278-9389",
|
|
138
|
-
},
|
|
139
|
-
"{{C.EMAIL}}": {
|
|
140
|
-
value: "Email",
|
|
141
|
-
key: "{{C.EMAIL}}",
|
|
142
|
-
defaultValue: "johndoe@gmail.com",
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
defaultDynamicFields: [
|
|
146
|
-
{
|
|
147
|
-
value: "First Name",
|
|
148
|
-
key: "{{C.FIRST_NAME}}",
|
|
149
|
-
defaultValue: "John",
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
value: "Last Name",
|
|
153
|
-
key: "{{C.LAST_NAME}}",
|
|
154
|
-
defaultValue: "Doe",
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
value: "Full Name",
|
|
158
|
-
key: "{{C.FIRST_NAME}} {{C.LAST_NAME}}",
|
|
159
|
-
defaultValue: "John Doe",
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
value: "Company Name",
|
|
163
|
-
key: "{{C.COMPANY_NAME}}",
|
|
164
|
-
defaultValue: "ABC Company, Inc.",
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
value: "Address 1",
|
|
168
|
-
key: "{{C.ADDRESS_1}}",
|
|
169
|
-
defaultValue: "123 Main Street",
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
value: "Address 2",
|
|
173
|
-
key: "{{C.ADDRESS_2}}",
|
|
174
|
-
defaultValue: "Suite 2",
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
value: "City",
|
|
178
|
-
key: "{{C.CITY}}",
|
|
179
|
-
defaultValue: "Lawrence",
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
value: "State",
|
|
183
|
-
key: "{{C.STATE}}",
|
|
184
|
-
defaultValue: "MA",
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
value: "Zip Code",
|
|
188
|
-
key: "{{C.ZIP_CODE}}",
|
|
189
|
-
defaultValue: "01843",
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
value: "Phone Number",
|
|
193
|
-
key: "{{C.PHONE_NUMBER}}",
|
|
194
|
-
defaultValue: "(555) 278-9389",
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
value: "Email",
|
|
198
|
-
key: "{{C.EMAIL}}",
|
|
199
|
-
defaultValue: "johndoe@gmail.com",
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
products: [],
|
|
203
|
-
productDetailByTemplate: [],
|
|
204
|
-
templates: {
|
|
205
|
-
count: 0,
|
|
206
|
-
rows: [],
|
|
207
|
-
currentPage: 1,
|
|
208
|
-
lastPage: 1,
|
|
209
|
-
from: 0,
|
|
210
|
-
to: 0,
|
|
211
|
-
perPage: 20,
|
|
212
|
-
total: 0,
|
|
213
|
-
loading: true,
|
|
214
|
-
totalRecordsInDB: null,
|
|
215
|
-
},
|
|
216
|
-
templatesPagination: { page: 0, pageSize: 20, loading: false },
|
|
217
|
-
template: null,
|
|
218
|
-
totalRecordsInDB: null,
|
|
219
|
-
search: "",
|
|
220
|
-
searchProductIds: "",
|
|
221
|
-
searchCreator: "",
|
|
222
|
-
templateType: "json",
|
|
223
|
-
envelopeType: "",
|
|
224
|
-
templateLoading: null,
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
// @ts-ignore
|
|
228
|
-
const templateReducer = (state = initialState, { type, payload }): TemplateState => {
|
|
229
|
-
switch (type) {
|
|
230
|
-
case SET_DYNAMIC_FIELD_VALUE:
|
|
231
|
-
return {
|
|
232
|
-
...state,
|
|
233
|
-
dynamicField: payload.value,
|
|
234
|
-
};
|
|
235
|
-
case SET_DYNAMIC_FIELDS:
|
|
236
|
-
return {
|
|
237
|
-
...state,
|
|
238
|
-
dynamicFields: {
|
|
239
|
-
...state.dynamicFields,
|
|
240
|
-
[state.dynamicField]: {
|
|
241
|
-
value: state.dynamicField,
|
|
242
|
-
key: `{{${state.dynamicField.replace(/ /g, "_").toUpperCase()}}}`,
|
|
243
|
-
defaultValue: `[${state.dynamicField}]`,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
dynamicField: "",
|
|
247
|
-
};
|
|
248
|
-
case REMOVE_FROM_DYNAMIC_FIELDS:
|
|
249
|
-
const dynamicFields = { ...state.dynamicFields };
|
|
250
|
-
delete dynamicFields[payload.value];
|
|
251
|
-
return {
|
|
252
|
-
...state,
|
|
253
|
-
dynamicFields: dynamicFields,
|
|
254
|
-
};
|
|
255
|
-
case GET_PRODUCTS:
|
|
256
|
-
return {
|
|
257
|
-
...state,
|
|
258
|
-
products: payload.products,
|
|
259
|
-
};
|
|
260
|
-
case GET_ONE_TEMPLATE:
|
|
261
|
-
return {
|
|
262
|
-
...state,
|
|
263
|
-
template: payload.data,
|
|
264
|
-
title: payload.type === "copy" ? state.title : payload.data.title,
|
|
265
|
-
product: payload.data.product,
|
|
266
|
-
templateType: payload.data.templateType,
|
|
267
|
-
};
|
|
268
|
-
case CLEAR_TEMPLATE:
|
|
269
|
-
return {
|
|
270
|
-
...state,
|
|
271
|
-
template: null,
|
|
272
|
-
};
|
|
273
|
-
case TEMPLATE_LOADING:
|
|
274
|
-
return {
|
|
275
|
-
...state,
|
|
276
|
-
templateLoading: payload,
|
|
277
|
-
};
|
|
278
|
-
case TEMPLATE_PAGINATION_CHANGE:
|
|
279
|
-
return {
|
|
280
|
-
...state,
|
|
281
|
-
templatesPagination: { ...payload.data },
|
|
282
|
-
};
|
|
283
|
-
case TEMPLATE_SEARCH:
|
|
284
|
-
return {
|
|
285
|
-
...state,
|
|
286
|
-
[payload.name]: payload.value,
|
|
287
|
-
};
|
|
288
|
-
case SELECT_PRODUCT:
|
|
289
|
-
return {
|
|
290
|
-
...state,
|
|
291
|
-
product: {
|
|
292
|
-
...payload.product,
|
|
293
|
-
selectedSize: payload.product.size[0].size,
|
|
294
|
-
...(!payload.productType &&
|
|
295
|
-
payload.product.productType !== "Postcards"
|
|
296
|
-
? { selectedSize: payload.product.size[0].size }
|
|
297
|
-
: {}),
|
|
298
|
-
...(payload.productType ? { productType: payload.productType } : {}),
|
|
299
|
-
},
|
|
300
|
-
};
|
|
301
|
-
case SELECT_POSTCARD:
|
|
302
|
-
return {
|
|
303
|
-
...state,
|
|
304
|
-
product: {
|
|
305
|
-
...payload.product,
|
|
306
|
-
productType: payload.productType,
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
case CLEAR_DYNAMIC_FIELDS:
|
|
310
|
-
return initialState;
|
|
311
|
-
case CLEAR_FIELDS:
|
|
312
|
-
return initialState;
|
|
313
|
-
case CLEAR_ALL_TEMPLATE:
|
|
314
|
-
return {
|
|
315
|
-
...state,
|
|
316
|
-
templates: { ...initialState.templates },
|
|
317
|
-
};
|
|
318
|
-
case CLEAR_TEMPLATE_FIELDS:
|
|
319
|
-
return {
|
|
320
|
-
...state,
|
|
321
|
-
title: "",
|
|
322
|
-
product: null,
|
|
323
|
-
dynamicField: "",
|
|
324
|
-
dynamicFields: {},
|
|
325
|
-
templateType: "json",
|
|
326
|
-
envelopeType: "",
|
|
327
|
-
};
|
|
328
|
-
case GET_DYNAMIC_FIELDS_FROM_SERVER:
|
|
329
|
-
return {
|
|
330
|
-
...state,
|
|
331
|
-
dynamicFields: payload.data,
|
|
332
|
-
};
|
|
333
|
-
case SET_PRODUCT_DETAILS:
|
|
334
|
-
return {
|
|
335
|
-
...state,
|
|
336
|
-
productDetailByTemplate: payload,
|
|
337
|
-
};
|
|
338
|
-
case LOAD_DATA_FROM_LOCAL_STORAGE:
|
|
339
|
-
return {
|
|
340
|
-
...state,
|
|
341
|
-
title: payload.data.title,
|
|
342
|
-
product: payload.data.product,
|
|
343
|
-
templateType: payload.data.templateType,
|
|
344
|
-
envelopeType: payload.data.envelopeType,
|
|
345
|
-
};
|
|
346
|
-
case CLEAR_REDUX:
|
|
347
|
-
return initialState;
|
|
348
|
-
default:
|
|
349
|
-
return state;
|
|
350
|
-
}
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
export { templateReducer };
|
package/src/redux/store.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
package/src/styles/colors.scss
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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
|
-
$primaryColor: #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;
|
package/src/test/mocks.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
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
|
-
};
|
package/src/test/setupJest.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
package/src/utils/api.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
};
|
package/src/utils/constants.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export const DPI: number = 96;
|
|
2
|
-
|
|
3
|
-
export const Barcode: string = 'https://api.openletterconnect.com/api/v1/download/s3/openletterconnect/assets/preview/one-barcode.png';
|
|
4
|
-
export const PRODUCT_LEARN_URL: string = "https://help.openletterconnect.com/getting-support/designing-your-mailers/wip-designing-mail-creatives/wip-mail-piece-design-specs";
|
|
5
|
-
|
|
6
|
-
export const multiPageLetters: string[] = [
|
|
7
|
-
"Postcards",
|
|
8
|
-
"Tri-Fold Self-Mailers",
|
|
9
|
-
"Bi-Fold Self-Mailers",
|
|
10
|
-
];
|
|
11
|
-
|
|
12
|
-
interface TemplateTypes {
|
|
13
|
-
id: string;
|
|
14
|
-
label: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const templateTypes = [
|
|
18
|
-
{
|
|
19
|
-
id: "1",
|
|
20
|
-
label: "My Templates",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "2",
|
|
24
|
-
label: "Team Templates",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: "3",
|
|
28
|
-
label: "OLC Templates",
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
export const sortOrderForTemplates: string[] = [
|
|
33
|
-
"Postcards",
|
|
34
|
-
"Personal Letters",
|
|
35
|
-
"Professional Letters",
|
|
36
|
-
"Bi-Fold Self-Mailers",
|
|
37
|
-
"Tri-Fold Self-Mailers",
|
|
38
|
-
"Real Penned Letter",
|
|
39
|
-
];
|
|
40
|
-
|