Detalhes do pacote

@mailupinc/bee-plugin

BEE-Plugin86.7kApache-2.02.3.0

wrapper of bee-plugin

editor, email, bee, plugin

readme (leia-me)

alt bee-plugin-logo

Official Beefree SDK wrapper CI

PRs Welcome License NPM

A simple module to use the Beefree SDK

Why Beefree SDK?

Choose a reliable, easy-to-integrate multi-content type digital platform you can build on. Beefree SDK is more than an embeddable visual builder with a great drag-and-drop user experience. It’s a reliable, highly customizable email, landing page & popup builder.

Go from proof-of-concept to production in days, not months. Beefree SDK can be highly customized in how it looks, what it does, and how it interacts with your application. Deliver your business exactly what it needs with a small development effort.

You can embed it into your application!

Visit our developer documentation [https://docs.beefree.io/]

How to use it

Demo

It's free to use on 'https://beefree.io': you don't even need to create an account of any kind.

Do you want to try out an integration locally?

  1. Install Nodejs (also npm, which should come with nodejs already) or Yarn.
  2. clone this repository
  3. npm install or yarn install(if you have it installed) in the folder cloned
  4. rename the local .env.sample file into .env
  5. run npm start or yarn start
  6. Open http://localhost:8080.
  7. Have fun!

How to use this module for your own

install

You can either install it with npm or yarn.

npm install --save @mailupinc/bee-plugin

or

yarn add @mailupinc/bee-plugin

Initialize the builder

Get token(clientId, clientSecret)

You need to be authorized to start using the editor: beefree help documentation portal has a nice post explaining how to do it

It's not really raccomended to do it client side but it's possible with the module, just call getToken.

Pass your credential on getToken method and start the plugin in the returning promise. Example below:

import BeePlugin as BeefreeSDK from '@mailupinc/bee-plugin'

//Put your credentials in the .env file
const clientId = process.env.CLIENT_ID
const clientSecret = process.env.CLIENT_SECRET
const beeConfig = {...}

const template = {...}
const beeTest = new BeefreeSDK(token, authConfiguration)

beeTest.getToken(clientId, clientSecret)
  .then(() => beeTest.start(beeConfig, template))

new Bee(token, authConf?)

Initialize the BEE instance with a server side generated token


import BeePlugin as BeefreeSDK from '@mailupinc/bee-plugin'

const authConf = {...}
const beeConfig = {...}
const template = {...}

// You can add your personal configuration, if you omit some properties, the builder will use its default configuration
const authConf = {
  authUrl: process.env.YOUR_AUTH_URL,
  beePluginUrl: process.env.YOUR_HOST_URL
}
const builder = new BeefreeSDK(token, authConf)
builder.start(beeConfig, template)

Configuring the editor (beeConfig)

It requires a configuration for using the editor, beefree help documentation portal has a nice post explaining how to do it

Here is an example of the configuration; just read the official documentation for an extended version.


const beeConfig = {
  uid: 'test1-clientside', //needed for identify resources of the that user and billing stuff
  container: 'beefree-sdk-container', // Identifies the id of div element that contains the Beefree SDK builder
  language: 'en-US',
  onSave: (jsonFile, htmlFile) => {
    console.log('onSave', jsonFile, htmlFile)
  },
  onSaveAsTemplate: (jsonFile) => {
    console.log('onSaveAsTemplate', jsonFile)
  },
  onSend: (htmlFile) => {
    console.log('onSend', htmlFile)
  },
  onError: (errorMessage) => {
    console.log('onError ', errorMessage)
  }
}

Template JSON

It requires an initial template to start editing. Learn more here

Some json avaible here https://github.com/BeefreeSDK/beefree-sdk-assets-templates)

After you have started the builder it's possible to trigger this method

Methods

start(beeConfig, template, endpoint, options)

After the initialization you can call start to load the builder on the page; the method needs two parameters:

  • BEE configuration (required - js object)
  • Template (required - JSON)
  • Endpoint (optional - string or null)
  • Options (optional - js object e.g. { shared: true })

this returns a promise that is resolved after we call the builder's start function

load(template)

This changes the template; call load with the new template

reload(template)

This changes the template by trigging the loading dialog; just call reload with the new template

save()

This calls the Beefree SDK save method, which in turn will trigger the callback onSave defined on the configuration for getting fresh HTML of the email and the JSON template updated.

saveAsTemplate()

This calls the Beefree SDK saveAsTemplate method, which in turn will trigger the callback onSaveAsTemplate defined in the configuration for getting only the current JSON of the instance.

send()

This calls the Beefree SDK send method, which in turn will trigger the callback send defined in the configuration for getting only the current html of the instance.

preview()

This calls the Beefree SDK preview method, which triggers the preview modal inside the editor.

toggleStructure()

This calls the Beefree SDK toggleStructure method, which toggles the structure helper on the editor's stage.

toggleComments()

This calls the Beefree SDK toggleStructure method, which toggles the comments section on the editor's sidebar.

togglePreview()

This calls the Beefree SDK togglePreview method, which opens/closes the message preview behavior within the editor.

showComment(uuid)

This calls the Beefree SDK showComment method, which opens a specific comment and scrolls the stage to the related element. The method needs one parameter, a comment 'uuid' as a string.

loadConfig(ClientConfig)

This calls the Beefree SDK loadConfig method, which reloads the JSON configuration used to initialize the builder.

join(beeConfig, sessionId)

After the initialization you can call join to load the builder on the page and join a collaborative editing session; the method needs two parameters:

  • BEE configuration (JS object)
  • SessionID (string obtained from onSessionStarted callback)

this returns a promise that has resolved after we call the builder's start function. Visit the docs for more details about co-editing.

loadWorkspace(type)

This call the Beefree SDK loadWorkspace method, which accepts one of the following parameters: 'default'|'mixed'|'amp_only'|'html_only'. Visit the docs for more details about workspaces.

loadStageMode(arg)

This call the Beefree SDK loadStageMode method, which accepts an object parameter with the following structure: { mode: 'desktop'|'mobile', display: 'blur'|'hide'}. Visit the docs for more details about design mode.

loadConfig(ClientConfig)

This calls the Beefree SDK loadConfig method, which reloads the JSON configuration used to initialize the builder.

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.3.0 (2023-09-14)

Features

  • multilanguage: multilanguage params (d310c6c)

2.2.0 (2023-06-20)

2.2.0-type-ai-integration.4 (2023-06-15)

2.2.0-type-ai-integration.3 (2023-05-24)

Features

Bug Fixes

2.2.0-type-ai-integration.2 (2023-05-18)

2.2.0-type-ai-integration.0 (2023-04-18)

Features

  • adds types for ai integration and adds verticalAlign (7cb82de)

2.2.0-type-ai-integration.0 (2023-06-15)

2.2.0-type-ai-integration.3 (2023-05-24)

Features

Bug Fixes

2.2.0-type-ai-integration.2 (2023-05-18)

2.2.0-type-ai-integration.0 (2023-04-18)

Features

  • adds types for ai integration and adds verticalAlign (7cb82de)

2.1.6 (2023-06-14)

Bug Fixes

  • increased Node version for nvmrc (c4f6fe3)

2.1.6-chore-start-method-parameters.0 (2023-06-14)

2.1.5 (2023-05-19)

Features

Bug Fixes

2.2.0-type-ai-integration.2 (2023-05-18)

2.2.0-type-ai-integration.0 (2023-04-18)

Features

  • adds types for ai integration and adds verticalAlign (7cb82de)

2.2.0-type-ai-integration.0 (2023-05-18)

2.2.0-type-ai-integration.0 (2023-04-18)

Features

  • adds types for ai integration and adds verticalAlign (7cb82de)

2.1.4 (2023-04-19)

2.1.4-fix-109-token-interface.0 (2023-04-13)

Bug Fixes

  • fixed bad type for token property (bb89863)

2.1.3 (2023-04-13)

2.1.3-chore-dependencies.0 (2023-04-12)

2.1.2 (2023-04-12)

2.1.2-fix-108-external-content-urls.0 (2023-04-12)

Bug Fixes

  • added missing contentDialog externalContentURLs (31db83c)

2.1.1 (2023-03-23)

2.1.1 (2023-03-23)

2.1.0 (2023-02-20)

2.1.0-chore-missing-types.1 (2023-02-13)

Bug Fixes

  • added mixed and rowAddon types for addon contentDialog (b368581)

2.1.0-chore-missing-types.0 (2023-02-13)

Features

  • added missing methods picker() and updateToken(), added addOn contentDialog type (e62bbfb)

2.0.1 (2023-02-13)

Bug Fixes

2.0.0 (2023-02-06)

⚠ BREAKING CHANGES

  • commit for breaking change

  • commit for breaking change (d6539e8)

1.12.0-feat-master-rows.1 (2023-01-03)

1.12.0-feat-master-rows.0 (2022-12-12)

1.10.0-feat-master-rows.9 (2022-11-18)

Bug Fixes

  • added canDeleteSyncedRows flag (e84991f)

1.10.0-feat-master-rows.8 (2022-11-17)

Bug Fixes

  • added notPermittedDescription for edit synced row setting block (2821479)

1.10.0-feat-master-rows.7 (2022-11-15)

Bug Fixes

  • added advanced permissions to edit synced row (46c2937)

1.10.0-feat-master-rows.6 (2022-11-10)

Bug Fixes

  • added undefined to autoScrollTo (1a0379a)

1.10.0-feat-master-rows.5 (2022-11-10)

Bug Fixes

  • added autoScrollTo config property (9763efa)

1.10.0-feat-master-rows.4 (2022-11-08)

Bug Fixes

  • added editSyncedRow type (25dedbc)

1.10.0-feat-master-rows.3 (2022-11-04)

Bug Fixes

  • fixed contentDialog.saveRow type (b5bdc52)

1.10.0-feat-master-rows.2 (2022-11-03)

Bug Fixes

  • merged master into feat/master-rows (f968e89)

1.10.0-feat-master-rows.1 (2022-10-27)

Bug Fixes

  • updated resolve signature for BeePluginContentDialogHandler (6ae946d)

1.10.0-feat-master-rows.0 (2022-10-26)

Features

  • added synced parameter to plugin row (efde0c2)

1.11.2 (2023-01-12)

1.11.1 (2023-01-09)

1.11.0 (2022-11-23)

1.11.0-feat-add-comments-types.0 (2022-11-09)

Features

  • adds new types for comments (37efde9)

1.10.0 (2022-11-02)

1.10.0-fix-types-rows.0 (2022-11-02)

Features

  • commit for minor increase (83cd633)

1.9.2 (2022-11-02)

1.9.2-build-outdated-dependencies-update.0 (2022-10-31)

1.9.1 (2022-10-28)

Bug Fixes

  • changed to script onSaveAsTemplate json type, updated FileSaved cdn url (6a40575)

1.9.0 (2022-09-19)

1.9.0-alpha.0 (2022-09-01)

Features

  • upgraded rollup, axios, typescript eslint (77c7757)
  • upgraded rollup, axios, typescript eslint (c4d8156)

1.9.0-alpha.0 (2022-09-01)

Features

  • upgraded rollup, axios, typescript eslint (77c7757)
  • upgraded rollup, axios, typescript eslint (c4d8156)

    1.8.3 (2022-09-06)

1.8.3-beta.0 (2022-08-31)

Bug Fixes

  • removed id property from IMergeTag interface (7080dde)

1.8.2 (2022-08-04)

Bug Fixes

  • add missing IMergeTag.previewValue property (6fe86b0)

1.8.1 (2022-06-17)

Bug Fixes

  • fixed containerBackgroundImage in advancedPermissions (#70) (fcb0afd)

1.8.0 (2022-06-06)

Features

  • dummy commit to increase minor version (49b283d)

1.6.4-types-improvements.17 (2022-06-06)

Bug Fixes

  • added backgroundImage to advacned permission settings section (2b78687)

1.6.4-types-improvements.16 (2022-05-23)

Bug Fixes

  • fixed type letter spacing for h1/h2/h3 content defaults (04152fa)

1.6.4-types-improvements.15 (2022-05-23)

Bug Fixes

  • fixed FontElement type where url is not required (0d545d6)

1.6.4-types-improvements.14 (2022-05-23)

Bug Fixes

1.6.4-types-improvements.13 (2022-05-19)

Bug Fixes

  • fixed advanced permissions for addon (d0f549c)

1.6.4-types-improvements.12 (2022-05-19)

Bug Fixes

  • now beeConfiguration has only container and uid as mandatory fields (8e1cd6b)

1.6.4-types-improvements.11 (2022-05-19)

Bug Fixes

  • added other form module properties and other advancedPermissions properties (19bfe3b)

1.6.4-types-improvements.10 (2022-05-19)

Bug Fixes

  • added 5 more contentDefaults for form label and form button (da0505d)

1.6.4-types-improvements.9 (2022-05-18)

Bug Fixes

  • added some more types to AdvancedPermissions (ff41870)

1.6.4-types-improvements.8 (2022-05-17)

Bug Fixes

  • added contentAreaWidth for general contentDefaults (7041bdc)

1.6.4-types-improvements.7 (2022-05-16)

Bug Fixes

  • added align attribute to content.computerStyle for type IEntityContentJson (0e2170c)

1.6.4-types-improvements.6 (2022-05-16)

Bug Fixes

  • typed body for IEntityContentJson (252c442)

1.6.4-types-improvements.5 (2022-05-14)

Bug Fixes

  • fixed social module type, id was missing (9659cd2)

1.6.4-types-improvements.4 (2022-05-12)

Bug Fixes

  • added advancedPermission typing (43783f4)

1.6.4-types-improvements.3 (2022-05-05)

Bug Fixes

  • fixed module types and defaultContent types (ff33abb)
  • fixed module types removing general base type (94bbc3e)

1.6.4-types-improvements.2 (2022-04-29)

Bug Fixes

  • added menuItemsSpacing to IPluginComputedStyle (b3b5800)

1.6.4-types-improvements.1 (2022-04-29)

Bug Fixes

  • added carret to typescript version in package.json (8bddefa)

1.6.4-types-improvements.0 (2022-04-29)

Bug Fixes

1.7.0-feat-custom-assets.0 (2022-05-05)

Features

  • added customAssetsOption type (887d49c)

1.6.3 (2022-04-05)

Bug Fixes

  • added status to onPreview and onTogglePreview callbacks (b6259ab)

1.6.2 (2022-03-25)

Bug Fixes

  • added special links and merge tags dialog types (e48ddbd)

1.6.1 (2022-03-04)

1.6.0 (2022-02-23)

1.6.0-beta.2 (2022-02-10)

1.6.0-beta.1 (2022-02-09)

1.6.0-beta.0 (2022-02-08)

Features

  • typing: module types, on warning error data, row content, module, layout type (09be9e5)

1.6.0-beta.2 (2022-02-10)

1.6.0-beta.1 (2022-02-09)

1.6.0-beta.0 (2022-02-08)

Features

  • typing: module types, on warning error data, row content, module, layout type (09be9e5)

1.6.0-beta.1 (2022-02-09)

1.6.0-beta.0 (2022-02-08)

Features

  • typing: module types, on warning error data, row content, module, layout type (09be9e5)

    1.5.3 (2022-02-22)

1.5.3-beta.0 (2022-02-11)

1.5.2 (2022-02-10)

Bug Fixes

  • added undefined as second arsgument for BeePluginContentDialogHandler (34f685d)
  • fixed BeePluginContentDialogHandler for getMentions handler and engage handler (306d2e1)
  • made BeePluginContentDialogHandler backward compatible from prev releases (77efd5e)

1.5.1 (2021-12-09)

1.5.1-beta.1 (2021-12-06)

Bug Fixes

  • added type definition for get rows hooks (84836cf)

1.5.1-beta.0 (2021-12-06)

Bug Fixes

  • added column, content, display condition, computed styles type definition (2acfca9)

1.5.1-alpha.0 (2021-12-03)

Bug Fixes

  • added custom headers definition (0cc3bb9)
  • added load config type definition (aae2e52)
  • added on delete row and on edit row content dialogs definition (533a35b)
  • added on load workspace method definition (192acf5)
  • added on warning parameters definition (0b4ffad)
  • fixed example (e96ff92)

1.5.0 (2021-12-03)

1.5.0-beta.0 (2021-11-26)

1.5.0-alpha.1 (2021-11-22)

1.5.0-alpha.0 (2021-11-22)

Features

  • added role and getMentions dialog. Little bugfixing on types (400836f)

1.4.0 (2021-11-16)

1.4.0-beta.10 (2021-11-05)

1.4.0-beta.9 (2021-11-05)

1.3.7 (2021-09-02)

1.3.3 (2021-04-29)

1.4.0-beta.8 (2021-11-04)

1.4.0-beta.7 (2021-11-04)

1.4.0-beta.6 (2021-11-04)

1.4.0-beta.5 (2021-11-04)

1.4.0-beta.4 (2021-11-04)

1.4.0-beta.3 (2021-09-08)

Bug Fixes

  • fixed sintax error on CI :smirk: (ed6b0c7)

1.4.0-beta.2 (2021-09-08)

1.4.0-beta.1 (2021-09-08)

1.4.0-beta.0 (2021-09-08)

Features

  • loadConfig: added loadConfig action (ecb1d17)

1.4.0-alpha.5 (2021-08-31)

Bug Fixes

  • fp-ts: fixed deprecated import (b0c7a6d)

1.4.0-alpha.4 (2021-08-23)

1.4.0-alpha.3 (2021-08-23)

1.4.0-alpha.2 (2021-08-23)

1.4.0-alpha.1 (2021-08-20)

1.4.0-alpha.0 (2021-08-20)

Features

  • actions: added togglePreview, showComment and loadStageMode (ccea8f0)
  • store: created store (1b83169)

Bug Fixes

  • Readme: completed show comment description and link design mode documentation (a4ddc70)