Giter Site home page Giter Site logo

reactor-bridge's Introduction

Adobe Experience Platform Tags Extension Bridge

npm (scoped with tag)

Adobe Experience Platform Tags is a next-generation tag management solution enabling simplified deployment of marketing technologies. For more information regarding Experience Platform Tags, please visit our product website.

When a Tags user configures extensions, rules, and data elements within the Tags UI, the UI presents an extension's view within an iframe. This project provides the communication layer between the Tags UI and extension views for storage and retrieval of settings, validation, etc. It does so by exposing a simplified, abstracted API while leveraging the native postMessage browser API under the hood.

For more information about developing an extension for Experience Platform Tags, please visit our extension development guide.

Usage

The Tags UI consumes the bridge via the @adobe/reactor-bridge npm package while extension views consume the bridge by loading a CDN-hosted script as described in the extension development guide.

The communication layer consists three different pieces:

  • Parent (lib/parent.js): This is the portion of the communication layer that the Tags UI uses. The Tags UI uses this by importing it directly:

    import { loadIframe } from '@adobe/reactor-bridge';

    The arguments, return value, and behavior of loadIframe can be found within the code documentation in parent.js.

  • Child (dist/extensionbridge-child.js): This is the portion of the communication layer that extension views use, though extension views don't load it directly (see Child Loader). This file is hosted by the Tags UI which means it may be different based on the environment. This is important since it needs to be compatible with the Parent that is being used by the Tags UI in the same environment.

  • Child Loader (dist/extensionbridge.js): This loads Child. Child Loader will be loaded by extensions via a script tag. Extensions will always load the same Child Loader regardless of the environment they are running in. Child Loader then loads the environment-specific Child.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

To get started:

  1. Install node.js.
  2. Clone the repository.
  3. After navigating into the project directory, install project dependencies by running npm install.

Scripts

To run tests a single time, run the following command:

npm run test

To run tests continually while developing, run the following command:

npm run test:watch

To run a sandbox where you can manually test your changes (manipulate the sandbox directory as desired), run the following command:

npm run sandbox

To create a build, run the following command:

npm run build

Browser Support

The extension bridge supports the following browsers:

  • Chrome (latest)
  • Safari (latest)
  • Firefox (latest)
  • Edge (latest)

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

reactor-bridge's People

Contributors

aaronius avatar brenthosie avatar dependabot[bot] avatar dompuiu avatar jeffchasin avatar jhicken avatar markhicken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reactor-bridge's Issues

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.

extensionBridge.register() don't handle class instances

I don't know if it's something desired, but if you provide a class instance for extension bridge registration this doesn't work as expected.

class ExtensionView{
  constructor(vueSettings) {
    //...
  }
  init({extensionSettings}) {
    //...
  }

  getSettings() {
    //...
  }

  validate() {
    return false;
  }
}
class SomeExtensionView extends ExtensionView {
  constructor(vueSettings) {
    super(vueSettings);
  }
}

extensionBridge.register(new SomeExtensionView(someSettings));

You will get the error:

Unable to call init on the extension. The extension must register a init function using extensionBridge.register().

Only methods defined by the object itself are kept, inherited aren't, which is the case when you use class/prototype

The bridge child script when the extension is registered:

reactor-bridge/src/child.js

Lines 105 to 108 in 30ca5c4

register(methods) {
extensionViewMethods = {
...methods
};

And later when the method is called:

const getExtensionViewMethod = (methodName) => {
const method = extensionViewMethods[methodName];
if (method) {
return method.bind(extensionViewMethods);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.