@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,233 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// Utils
|
|
4
|
+
import { MESSAGES } from '../../../../utils/message';
|
|
5
|
+
import { TemplateCategory, TemplateRecord, TemplateType } from '../customTemplateSection';
|
|
6
|
+
|
|
7
|
+
// Components
|
|
8
|
+
import Typography from '../../../GenericUIBlocks/Typography';
|
|
9
|
+
import GeneralSelect from '../../../GenericUIBlocks/GeneralSelect';
|
|
10
|
+
import Input from '../../../GenericUIBlocks/Input';
|
|
11
|
+
|
|
12
|
+
// Icons
|
|
13
|
+
import DesignIcon from '../../../../assets/images/templates/template-default-design';
|
|
14
|
+
import dummyTemplateIcon from '../../../../assets/images/templates/template-default-design';
|
|
15
|
+
|
|
16
|
+
// styles
|
|
17
|
+
import './styles.scss';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const templateTextStyles: React.CSSProperties = {
|
|
21
|
+
color: `#000`,
|
|
22
|
+
fontSize: `12px`,
|
|
23
|
+
fontStyle: `normal`,
|
|
24
|
+
fontWeight: `500`,
|
|
25
|
+
lineHeight: `normal`,
|
|
26
|
+
marginBottom: `16px`,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
type CustomTemplateSectionProps = {
|
|
31
|
+
selectedCategory: TemplateCategory | null,
|
|
32
|
+
templateCategories: TemplateCategory[],
|
|
33
|
+
currentTemplateType: TemplateType | undefined,
|
|
34
|
+
templateTypes: TemplateType[] | null | undefined,
|
|
35
|
+
search: any,
|
|
36
|
+
searchApplied: boolean,
|
|
37
|
+
loader: boolean,
|
|
38
|
+
platformName: any,
|
|
39
|
+
myTemplates: TemplateRecord[],
|
|
40
|
+
teamTemplates: TemplateRecord[],
|
|
41
|
+
olcTemplates: TemplateRecord[],
|
|
42
|
+
setSearch: any,
|
|
43
|
+
handleSearch: any,
|
|
44
|
+
removeSearchInput: any,
|
|
45
|
+
searchKeyDown: any,
|
|
46
|
+
setCurrentTemplateType: any,
|
|
47
|
+
setSelectedCategory: any,
|
|
48
|
+
handleLoadTemplateModel: any,
|
|
49
|
+
handleDialogChange: any,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
const SideBarSelction = (props: CustomTemplateSectionProps) => {
|
|
54
|
+
|
|
55
|
+
const {
|
|
56
|
+
selectedCategory,
|
|
57
|
+
templateCategories,
|
|
58
|
+
currentTemplateType,
|
|
59
|
+
templateTypes,
|
|
60
|
+
search,
|
|
61
|
+
searchApplied,
|
|
62
|
+
loader,
|
|
63
|
+
platformName,
|
|
64
|
+
myTemplates,
|
|
65
|
+
teamTemplates,
|
|
66
|
+
olcTemplates,
|
|
67
|
+
setSearch,
|
|
68
|
+
handleSearch,
|
|
69
|
+
removeSearchInput,
|
|
70
|
+
searchKeyDown,
|
|
71
|
+
setCurrentTemplateType,
|
|
72
|
+
setSelectedCategory,
|
|
73
|
+
handleLoadTemplateModel,
|
|
74
|
+
handleDialogChange,
|
|
75
|
+
} = props;
|
|
76
|
+
|
|
77
|
+
const uniqueCurrentTemplates = Array.from(
|
|
78
|
+
new Map(olcTemplates.map((item) => [item.id, item])).values()
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<div className="custom-template-section">
|
|
83
|
+
<div className="templateTabsWrapper">
|
|
84
|
+
<div style={{ marginTop: '8px' }}>
|
|
85
|
+
<GeneralSelect
|
|
86
|
+
placeholder="Template Types"
|
|
87
|
+
options={templateTypes as any}
|
|
88
|
+
setSelectedValue={setCurrentTemplateType as any}
|
|
89
|
+
selectedValue={currentTemplateType as any}
|
|
90
|
+
builderSelect={true}
|
|
91
|
+
search={false}
|
|
92
|
+
isError={false}
|
|
93
|
+
gallerySelect={false}
|
|
94
|
+
clearField={false}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
{currentTemplateType?.id === '3' && templateCategories?.length > 1 && (
|
|
98
|
+
<div style={{ marginTop: 8 }}>
|
|
99
|
+
<GeneralSelect
|
|
100
|
+
placeholder="Select Category"
|
|
101
|
+
options={templateCategories as any}
|
|
102
|
+
setSelectedValue={setSelectedCategory as any}
|
|
103
|
+
selectedValue={selectedCategory as any}
|
|
104
|
+
builderSelect={true}
|
|
105
|
+
clearField={true}
|
|
106
|
+
isError={false}
|
|
107
|
+
gallerySelect={false}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
<div
|
|
112
|
+
className="searchWrapper">
|
|
113
|
+
<Input
|
|
114
|
+
type="text"
|
|
115
|
+
value={search}
|
|
116
|
+
builderInput={true}
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
onKeyDown={searchKeyDown}
|
|
119
|
+
onChange={(e: any) => setSearch(e.target.value.trimStart())}
|
|
120
|
+
placeholder="Search by template name"
|
|
121
|
+
inputIcon={true}
|
|
122
|
+
onClick={handleSearch}
|
|
123
|
+
searchApplied={searchApplied}
|
|
124
|
+
removeSearchInput={removeSearchInput}
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
{loader ? (
|
|
128
|
+
<div className="noTemplateText">
|
|
129
|
+
<Typography>{MESSAGES.TEMPLATE.LOADING_TEMPLATE}</Typography>
|
|
130
|
+
</div>
|
|
131
|
+
) : currentTemplateType?.id === '1' ? (
|
|
132
|
+
<>
|
|
133
|
+
<div
|
|
134
|
+
className="default-design"
|
|
135
|
+
onClick={() => handleDialogChange('design-own')}
|
|
136
|
+
>
|
|
137
|
+
<DesignIcon fill="var(--primary-color)" />
|
|
138
|
+
<Typography style={templateTextStyles}>
|
|
139
|
+
{MESSAGES.TEMPLATE.DESIGN_NEW}
|
|
140
|
+
</Typography>
|
|
141
|
+
</div>
|
|
142
|
+
{myTemplates.length ? (
|
|
143
|
+
myTemplates.map((template: any, i: number) => (
|
|
144
|
+
<div
|
|
145
|
+
className="design-template"
|
|
146
|
+
key={i}
|
|
147
|
+
onClick={() => handleLoadTemplateModel(template)}
|
|
148
|
+
>
|
|
149
|
+
<img
|
|
150
|
+
src={template.thumbnailUrl}
|
|
151
|
+
alt={template.title}
|
|
152
|
+
onError={({ currentTarget }) => {
|
|
153
|
+
currentTarget.onerror = null; // prevents looping
|
|
154
|
+
//@ts-ignore
|
|
155
|
+
currentTarget.src = dummyTemplateIcon;
|
|
156
|
+
currentTarget.classList.add('dummy-image');
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
</div>
|
|
160
|
+
))
|
|
161
|
+
) : (
|
|
162
|
+
<div className="noTemplateText">
|
|
163
|
+
<Typography>{MESSAGES.TEMPLATE.NO_MY_TEMPLATES}</Typography>
|
|
164
|
+
</div>
|
|
165
|
+
)}
|
|
166
|
+
</>
|
|
167
|
+
) : currentTemplateType?.id === '2' ? (
|
|
168
|
+
<>
|
|
169
|
+
{teamTemplates.length ? (
|
|
170
|
+
teamTemplates?.map((template: any, i: number) => (
|
|
171
|
+
<div
|
|
172
|
+
className="design-template"
|
|
173
|
+
key={i}
|
|
174
|
+
onClick={() => handleLoadTemplateModel(template)}
|
|
175
|
+
>
|
|
176
|
+
<img
|
|
177
|
+
src={template.thumbnailUrl}
|
|
178
|
+
alt={template.title}
|
|
179
|
+
onError={({ currentTarget }) => {
|
|
180
|
+
currentTarget.onerror = null; // prevents looping
|
|
181
|
+
//@ts-ignore
|
|
182
|
+
currentTarget.src = dummyTemplateIcon;
|
|
183
|
+
currentTarget.classList.add('dummy-image');
|
|
184
|
+
}}
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
))
|
|
188
|
+
) : (
|
|
189
|
+
<div className="noTemplateText">
|
|
190
|
+
<Typography>
|
|
191
|
+
{MESSAGES.TEMPLATE.NO_TEAM_TEMPLATES}
|
|
192
|
+
</Typography>
|
|
193
|
+
</div>
|
|
194
|
+
)}
|
|
195
|
+
</>
|
|
196
|
+
) : currentTemplateType?.id === '3' ? (
|
|
197
|
+
<>
|
|
198
|
+
{uniqueCurrentTemplates.length ? (
|
|
199
|
+
uniqueCurrentTemplates?.map((template, i) => (
|
|
200
|
+
<div
|
|
201
|
+
className="design-template"
|
|
202
|
+
key={i}
|
|
203
|
+
onClick={() => handleLoadTemplateModel(template)}
|
|
204
|
+
>
|
|
205
|
+
<img
|
|
206
|
+
src={template.thumbnailUrl}
|
|
207
|
+
alt={template.title}
|
|
208
|
+
onError={({ currentTarget }) => {
|
|
209
|
+
currentTarget.onerror = null; // prevents looping
|
|
210
|
+
//@ts-ignore
|
|
211
|
+
currentTarget.src = dummyTemplateIcon;
|
|
212
|
+
currentTarget.classList.add('dummy-image');
|
|
213
|
+
}}
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
))
|
|
217
|
+
) : (
|
|
218
|
+
<div className="noTemplateText">
|
|
219
|
+
<Typography>
|
|
220
|
+
{platformName
|
|
221
|
+
? `No ${platformName} Templates to show`
|
|
222
|
+
: MESSAGES.TEMPLATE.NO_OLC_TEMPLATES}
|
|
223
|
+
</Typography>
|
|
224
|
+
</div>
|
|
225
|
+
)}
|
|
226
|
+
</>
|
|
227
|
+
) : null}
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export default SideBarSelction;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
.polotno-panel-container {
|
|
2
|
+
overflow-y: scroll;
|
|
3
|
+
|
|
4
|
+
& .custom-template-section {
|
|
5
|
+
display: "flex";
|
|
6
|
+
flex-wrap: "wrap";
|
|
7
|
+
overflow-y: "scroll";
|
|
8
|
+
|
|
9
|
+
& .title {
|
|
10
|
+
& span {
|
|
11
|
+
font-size: 16px;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
color: #ed5c2f;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
@mixin designCommonStyles {
|
|
17
|
+
width: 320px;
|
|
18
|
+
height: 224px;
|
|
19
|
+
border-radius: 3px;
|
|
20
|
+
border: 0.5px solid #303030;
|
|
21
|
+
margin: 10px auto;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
& .default-design {
|
|
25
|
+
@include designCommonStyles;
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
& p {
|
|
31
|
+
color: #303030;
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
line-height: 14.52px;
|
|
35
|
+
margin-top: 5px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
& .design-template {
|
|
39
|
+
@include designCommonStyles;
|
|
40
|
+
& img {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
object-fit: cover;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.dummy-image {
|
|
50
|
+
padding: 85px;
|
|
51
|
+
object-fit: fill !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.MuiTabs-indicator {
|
|
55
|
+
background-color: #ed5c2f !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.templateTabsWrapper {
|
|
59
|
+
.templateTabs {
|
|
60
|
+
.MuiTabScrollButton-root {
|
|
61
|
+
width: 15px;
|
|
62
|
+
opacity: 1 !important;
|
|
63
|
+
&:hover {
|
|
64
|
+
svg {
|
|
65
|
+
color: #ed5c2f !important;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
.Mui-disabled {
|
|
69
|
+
opacity: 1 !important;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.noTemplateText {
|
|
76
|
+
height: 100%;
|
|
77
|
+
min-height: 200px;
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
align-items: center;
|
|
81
|
+
p {
|
|
82
|
+
color: #303030;
|
|
83
|
+
font-family: Inter;
|
|
84
|
+
font-size: 18px;
|
|
85
|
+
font-style: normal;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
line-height: normal;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.searchWrapper {
|
|
92
|
+
display: flex;
|
|
93
|
+
justify-content: flex-start;
|
|
94
|
+
align-items: center;
|
|
95
|
+
width: 100%;
|
|
96
|
+
gap: 10px;
|
|
97
|
+
position: relative;
|
|
98
|
+
|
|
99
|
+
.searchInput {
|
|
100
|
+
border-radius: 3px;
|
|
101
|
+
border: 0.5px solid rgba(68, 66, 65, 0.5);
|
|
102
|
+
background: #fff;
|
|
103
|
+
width: 100%;
|
|
104
|
+
max-width: 520px;
|
|
105
|
+
padding: 5px 20px;
|
|
106
|
+
color: #000;
|
|
107
|
+
font-family: Inter;
|
|
108
|
+
font-size: 16px;
|
|
109
|
+
font-style: normal;
|
|
110
|
+
font-weight: 400;
|
|
111
|
+
line-height: normal;
|
|
112
|
+
height: 40px;
|
|
113
|
+
width: 514px;
|
|
114
|
+
// position: relative;
|
|
115
|
+
&::after,
|
|
116
|
+
&::before {
|
|
117
|
+
display: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.searchIcon {
|
|
121
|
+
position: relative;
|
|
122
|
+
color: #ed5c2f;
|
|
123
|
+
|
|
124
|
+
&::before {
|
|
125
|
+
position: absolute;
|
|
126
|
+
content: "";
|
|
127
|
+
width: 1px;
|
|
128
|
+
height: 90%;
|
|
129
|
+
background-color: #000;
|
|
130
|
+
left: -5px;
|
|
131
|
+
opacity: 0.5;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.searchApplied {
|
|
138
|
+
background: #fff8ee;
|
|
139
|
+
input {
|
|
140
|
+
padding-right: 28px;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.clearSerach {
|
|
145
|
+
position: absolute;
|
|
146
|
+
top: 10px;
|
|
147
|
+
right: 55px;
|
|
148
|
+
font-size: 18px;
|
|
149
|
+
opacity: 0.6;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
// Utils
|
|
4
|
+
import { MESSAGES } from '../../../../../utils/message';
|
|
5
|
+
|
|
6
|
+
// // icons
|
|
7
|
+
import Typography from '../../../../GenericUIBlocks/Typography';
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import LeftArrow from '../../../../../assets/images/templates/left-arrow.svg';
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import RightArrow from '../../../../../assets/images/templates/right-arrow.svg';
|
|
12
|
+
|
|
13
|
+
// styles
|
|
14
|
+
import './styles.scss';
|
|
15
|
+
|
|
16
|
+
const TemplatesCard = (props: any) => {
|
|
17
|
+
const {
|
|
18
|
+
templates,
|
|
19
|
+
loading,
|
|
20
|
+
handleLoadTemplateModel,
|
|
21
|
+
platformName,
|
|
22
|
+
currentTemplateType,
|
|
23
|
+
product,
|
|
24
|
+
searchApplied,
|
|
25
|
+
primaryColorRGBA,
|
|
26
|
+
designerQueryAmount,
|
|
27
|
+
} = props;
|
|
28
|
+
|
|
29
|
+
const [isFilpedIds, setIsFlipedIds] = useState<string[]>([]);
|
|
30
|
+
|
|
31
|
+
const singleSideProducts = [2, 4, 5, 16];
|
|
32
|
+
|
|
33
|
+
// handler for Flip
|
|
34
|
+
const handleFlip = (templateId: string) => {
|
|
35
|
+
const existingTemplateIds = isFilpedIds || [];
|
|
36
|
+
let updatedIds: string[];
|
|
37
|
+
if (existingTemplateIds.includes(templateId)) {
|
|
38
|
+
updatedIds = existingTemplateIds.filter((item) => item !== templateId);
|
|
39
|
+
} else {
|
|
40
|
+
updatedIds = [...existingTemplateIds, templateId];
|
|
41
|
+
}
|
|
42
|
+
setIsFlipedIds(updatedIds);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// handler for setting color
|
|
46
|
+
const colorSetter = (templateId: any, side: string) => {
|
|
47
|
+
const result =
|
|
48
|
+
!isFilpedIds.includes(templateId) && side === 'Front'
|
|
49
|
+
? { fill: '#FFFFFF' }
|
|
50
|
+
: isFilpedIds.includes(templateId) && side === 'Back'
|
|
51
|
+
? { fill: '#FFFFFF' }
|
|
52
|
+
: { fill: '#878585' };
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// handler for setting rotation
|
|
57
|
+
const transformSetter = (templateId: any) => {
|
|
58
|
+
const result = isFilpedIds.includes(templateId)
|
|
59
|
+
? {
|
|
60
|
+
transform: 'rotateY(0deg)',
|
|
61
|
+
}
|
|
62
|
+
: {
|
|
63
|
+
transform: 'rotateY(360deg)',
|
|
64
|
+
};
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
{loading ? (
|
|
71
|
+
<div className="noTemplateGallery-v2">
|
|
72
|
+
<Typography>{MESSAGES.TEMPLATE.LOADING_TEMPLATE}</Typography>
|
|
73
|
+
</div>
|
|
74
|
+
) : templates.length ? (
|
|
75
|
+
templates.map((template: any, index: string) => {
|
|
76
|
+
return (
|
|
77
|
+
<div className="templateCard-v2" key={index}>
|
|
78
|
+
<div className="templateImage">
|
|
79
|
+
<img
|
|
80
|
+
src={
|
|
81
|
+
isFilpedIds.includes(template?.id)
|
|
82
|
+
? template.backThumbnailUrl
|
|
83
|
+
: template.thumbnailUrl
|
|
84
|
+
}
|
|
85
|
+
alt="template"
|
|
86
|
+
style={transformSetter(template?.id)}
|
|
87
|
+
loading="lazy"
|
|
88
|
+
/>
|
|
89
|
+
{!singleSideProducts.includes(Number(product?.id)) && (
|
|
90
|
+
<>
|
|
91
|
+
<img src={LeftArrow} alt="back" className="left-arrow" onClick={() => handleFlip(template?.id)} />
|
|
92
|
+
<img src={RightArrow} alt="front" className="right-arrow" onClick={() => handleFlip(template?.id)} />
|
|
93
|
+
</>
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
<div className="title-btn-container">
|
|
97
|
+
<Typography className="templateName">
|
|
98
|
+
{template?.title}
|
|
99
|
+
</Typography>
|
|
100
|
+
<button
|
|
101
|
+
className="tempButton"
|
|
102
|
+
onClick={() => handleLoadTemplateModel(template)}
|
|
103
|
+
>
|
|
104
|
+
Use Template
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
})
|
|
110
|
+
) : currentTemplateType?.id === '1' ? (
|
|
111
|
+
<div
|
|
112
|
+
className={`${+product?.id === 5 && designerQueryAmount
|
|
113
|
+
? 'noTemplateGallery-v2 more-visible'
|
|
114
|
+
: product?.productType === 'Professional Letters'
|
|
115
|
+
? 'noTemplateGallery-v2 noTemplateProfessionalAndPersonal'
|
|
116
|
+
: 'noTemplateGallery-v2'
|
|
117
|
+
}`}
|
|
118
|
+
>
|
|
119
|
+
<Typography>{MESSAGES.TEMPLATE.NO_MY_TEMPLATES}</Typography>
|
|
120
|
+
</div>
|
|
121
|
+
) : currentTemplateType?.id === '2' ? (
|
|
122
|
+
<div
|
|
123
|
+
className={`${+product?.id === 5 && designerQueryAmount ? 'noTemplateGallery-v2 more-visible' : 'noTemplateGallery-v2'}`}
|
|
124
|
+
>
|
|
125
|
+
<Typography>{MESSAGES.TEMPLATE.NO_TEAM_TEMPLATES}</Typography>
|
|
126
|
+
</div>
|
|
127
|
+
) : currentTemplateType?.id === '3' ? (
|
|
128
|
+
<div
|
|
129
|
+
className={`${+product?.id === 5 && designerQueryAmount
|
|
130
|
+
? 'noTemplateGallery-v2 more-visible'
|
|
131
|
+
: product?.productType === 'Professional Letters'
|
|
132
|
+
? 'noTemplateGallery-v2 noTemplateProfessionalAndPersonal'
|
|
133
|
+
: 'noTemplateGallery-v2'
|
|
134
|
+
}`}
|
|
135
|
+
>
|
|
136
|
+
<Typography>
|
|
137
|
+
{platformName
|
|
138
|
+
? `No ${platformName} Templates to show`
|
|
139
|
+
: MESSAGES.TEMPLATE.NO_OLC_TEMPLATES}
|
|
140
|
+
</Typography>
|
|
141
|
+
</div>
|
|
142
|
+
) : (
|
|
143
|
+
<></>
|
|
144
|
+
)}
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export default TemplatesCard;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
.templateCard-v2 {
|
|
2
|
+
width: 100%;
|
|
3
|
+
border-radius: 3px;
|
|
4
|
+
flex: 0 460px;
|
|
5
|
+
height: 374px;
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
border: 0.36px solid #00000066;
|
|
8
|
+
padding: 20px;
|
|
9
|
+
border-radius: 12px;
|
|
10
|
+
|
|
11
|
+
.templateImage {
|
|
12
|
+
position: relative;
|
|
13
|
+
margin-bottom: 16px;
|
|
14
|
+
border: none;
|
|
15
|
+
transition: 0.1s ease-in all;
|
|
16
|
+
height: 100%;
|
|
17
|
+
max-height: 280px;
|
|
18
|
+
background-color: #F9FAFB;
|
|
19
|
+
|
|
20
|
+
img {
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
border-radius: 7px;
|
|
24
|
+
padding: 1.5px;
|
|
25
|
+
object-fit: contain;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
.tempButton {
|
|
30
|
+
display: flex !important;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.left-arrow, .right-arrow {
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.left-arrow {
|
|
39
|
+
display: none;
|
|
40
|
+
position: absolute;
|
|
41
|
+
left: 10px;
|
|
42
|
+
top: 50%;
|
|
43
|
+
transform: translateY(-50%);
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
width: 40px;
|
|
46
|
+
height: 40px;
|
|
47
|
+
border-radius: 50%;
|
|
48
|
+
background-color: #ffffff;
|
|
49
|
+
transition: 0.1s ease-in all;
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
filter: invert(1) brightness(0.8);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.right-arrow {
|
|
57
|
+
display: none;
|
|
58
|
+
position: absolute;
|
|
59
|
+
right: 10px;
|
|
60
|
+
top: 50%;
|
|
61
|
+
transform: translateY(-50%);
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
width: 40px;
|
|
64
|
+
height: 40px;
|
|
65
|
+
border-radius: 50%;
|
|
66
|
+
background-color: #ffffff;
|
|
67
|
+
transition: 0.1s ease-in all;
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
filter: invert(1) brightness(0.8);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.title-btn-container{
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: space-between;
|
|
78
|
+
align-items: center;
|
|
79
|
+
gap: 10px;
|
|
80
|
+
|
|
81
|
+
.templateName {
|
|
82
|
+
font-size: 16px;
|
|
83
|
+
font-weight: 400;
|
|
84
|
+
margin: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.tempButton {
|
|
88
|
+
background-color: #ffffff;
|
|
89
|
+
color: #000;
|
|
90
|
+
text-transform: capitalize;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
transition: 0.3s ease-in all !important;
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
font-weight: 600;
|
|
95
|
+
font-family: var(--font-family);
|
|
96
|
+
width: 140px;
|
|
97
|
+
height: 40px;
|
|
98
|
+
border: none;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
border: 0.5px solid #0000003D;
|
|
101
|
+
box-shadow: 0px 2px 6px 0px #0000000A;
|
|
102
|
+
|
|
103
|
+
&:focus {
|
|
104
|
+
outline: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&:hover {
|
|
108
|
+
background-color: #F9FAFB;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
.templateID {
|
|
116
|
+
font-size: 16px !important;
|
|
117
|
+
color: #6a6565 !important;
|
|
118
|
+
font-weight: 300 !important;
|
|
119
|
+
margin-top: 7px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.noTemplateGallery-v2 {
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
align-items: center;
|
|
127
|
+
width: 100%;
|
|
128
|
+
background-color: #F9FAFB;
|
|
129
|
+
border-radius: 7px;
|
|
130
|
+
height: calc(100vh - 270px);
|
|
131
|
+
// margin-right: 32px;
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@media (width <= 1125px){
|
|
135
|
+
height: calc(100vh - 320px);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
p {
|
|
139
|
+
font-size: 16px;
|
|
140
|
+
font-style: normal;
|
|
141
|
+
font-weight: 400;
|
|
142
|
+
line-height: normal;
|
|
143
|
+
color: #00000066 !important;
|
|
144
|
+
margin: 0;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.noTemplateProfessionalAndPersonal {
|
|
149
|
+
height: calc(100vh - 1000px) !important;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
.more-visible {
|
|
154
|
+
height: calc(100vh - 850px) !important;
|
|
155
|
+
margin-top: -20px !important;
|
|
156
|
+
}
|