1.0.50 • Published 5 years ago

@cloudbusiness/mailbuilder v1.0.50

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

MailBuilder

by @cloudbusiness

About MailBuilder

Mailbuilder it's a library with UI components, with which you can create simple to understand and useful application for creating e-mails.

Technologies

Installation

npm i @cloudbusiness/mailbuilder

For update library

npm i @cloudbusiness/mailbuilder@latest

Getting started

1 First of all. Create your back-end with urls:

  1. Url: <your_API>/mailbuilder/templatesList
    Method: GET
    Description: return templatesList - array with templates(type of one template).

  2. Url: <your_API>/mailbuilder/delete/${id}
    Method: POST
    Body: -
    Description: remove template by id.

  3. Url: <your_API>/file/upload
    Method: POST
    Body: formData - data from window with selecting image file

  4. Url <your_API>/mailbuilder/template/${formId}
    Method: PUT
    Body:
    {
    id - personal id,
    commonPlaceStyles - settings with special common place styles type description - text with description of template; string
    name - name of template; string
    rows - array of data with special rows type stringHTML - HTML from edit place
    }

  5. Url: <your_API>/mailbuilder/template
    Method: POST
    Body:
    {
    id - personal id,
    commonPlaceStyles - settings with special common place styles type
    description - text with description of template; string
    name - name of template; string
    rows - array of data with special rows type stringHTML - HTML from edit place
    }

2 Next you can create page with MailBuilders simple ReactComponent.

EditMailTemplateSideBar
Component with Sidebar, which has settings to change view of email

Props:

Name of propsRequiredTypeDescription
setActiveLoadertrueFunctionFunction runs Loader which you create in your project
setInactiveLoadertrueFunctionFunction stops Loader which you create in your project
serverUrlfalsestringUrl which uses to send requests for server
jwtTokenfalsestringToken to insert at params in fetch
import {EditMailTemplateSideBar} from '@cloudbusiness/mailbuilder/lib';

<EditMailTemplateSideBar setActiveLoader={[Function]}
                         setInactiveLoader={[Function]}
                         serverUrl={[string]}
                         jwtToken={[string]}
/>

EditMailTemplateViewer
Component with Place, which has view of email

import {EditMailTemplateViewer} from '@cloudbusiness/mailbuilder/lib';

<EditMailTemplateViewer/>

MailTemplateList
Component with list of templates, which has cards of template with name and description

Props:

Name of propsRequiredTypeDescription
setActiveLoadertrueFunctionFunction runs Loader which you create in your project
setInactiveLoadertrueFunctionFunction stops Loader which you create in your project
clickOnTemplatetrueFunctionFunction run when user click on template
serverUrlfalsestringUrl which uses to send requests for server
jwtTokenfalsestringToken to insert at params in fetch
import {EditMailTemplateSideBar} from '@cloudbusiness/mailbuilder/lib';

<MailTemplateList setActiveLoader={[Function]}
                  setInactiveLoader={[Function]}
                  clickOnTemplate={[Funciton]}
                  serverUrl={[string]}
                  jwtToken={[string]}
/>

MainTableTemplatesComponent
Analog of MailTemplateList with different view. Component with list of templates, which has cards of template with name and description

Props:

Name of propsRequiredTypeDescription
setActiveLoadertrueFunctionFunction runs Loader which you create in your project
setInactiveLoadertrueFunctionFunction stops Loader which you create in your project
clickOnTemplatetrueFunctionFunction run when user click on template
serverUrlfalsestringUrl which uses to send requests for server
jwtTokenfalsestringToken to insert at params in fetch
import {EditMailTemplateSideBar} from '@cloudbusiness/mailbuilder/lib';

<MainTableTemplatesComponent setActiveLoader={[Function]}
                             setInactiveLoader={[Function]}
                             clickOnTemplate={[Funciton]}
                             serverUrl={[string]}
                             jwtToken={[string]}
/>

SidebarHeaderContent
Component with header, which has button for return to list templates and for return to main app(if you use routing - pathname should be '/editMailTemplate' ).

Props:

Name of propsRequiredTypeDescription
clickGoToApptrueFunctionFunction for button 'Back to App'
clickGoToTemplatestrueFunctionFunction for button 'Back to list'
import {SidebarHeaderContent} from '@cloudbusiness/mailbuilder/lib';

<SidebarHeaderContent clickGoToApp={[Function]}
                      clickGoToTemplates={[Function]}
/>

3 Merge mailbuilder reducer to your app

Mailbuilder ruducer is:

Name of field mailbuilder reducerDescription
templateslist of templates
activeTabname of active tab in sidebar with settings
activeBlockForChangeSettingscontrolling clicked block, has number of row and column by active block
allViewerRowsByActiveTemplatedata by active template
isOpenSidebarSettingscontrolling sidebar with settings
droppingBlockDatacontrolling dropped blocks from sidebar

Example of merge:

import {mailbuilderReducer} from '@cloudbusiness/mailbuilder/lib';

export default combineReducers({
    ...your data,
    mailbuilderReducer
});

Types

Type of commonPlaceStyles - Object with params:

Name of fieldType
widthstring
borderColorstring
borderSizestring
borderStylebackgroundColor

Type of rows - Array of Object with params:

Name of fieldType
columnsColumns type

Type of columns - Array of Object with params:

Name of fieldType
textstring
widthstring
heightstring
textColorstring
textWidthAlignstring
textVerticalAlignstring
backgroundColorstring
fontSizestring
fontFamilystring
italicboolean
boldboolean
underlineboolean
borderColorstring
borderSizestring
borderStylestring
imageWidthstring
imageHeightstring
imgstring
buttonColorstring
sizeOfButtonstring
linkTostring
typestring
isBasicButtonstring or boolean
editorstring

Type of template - Object of Object with params:

Name of fieldType
namestring
descriptionstring
idnumber or string
rowsrows type
commonPlaceStylescommonPlaceStyles type

Demo

1.0.50

5 years ago

1.0.49

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.44

5 years ago

1.0.43

5 years ago

1.0.42

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11-alpha.1

5 years ago

1.0.11-alpha.0

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago