From 2b634dc99dda78779f80817ac941982a13a0e717 Mon Sep 17 00:00:00 2001 From: Edie Lemoine Date: Wed, 4 Sep 2019 14:44:57 +0200 Subject: [PATCH] MY-12648 bump version and namespace events correctly --- package.json | 2 +- src/Errors.vue | 2 +- src/config/configBus.js | 2 +- src/config/data/eventConfig.js | 15 ++++++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 1b285660..6cc76ad5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@myparcel/checkout", - "version": "3.0.4", + "version": "3.0.5", "types": "index.d.ts", "scripts": { "serve": "vue-cli-service serve", diff --git a/src/Errors.vue b/src/Errors.vue index 707200ae..aa499482 100644 --- a/src/Errors.vue +++ b/src/Errors.vue @@ -59,7 +59,7 @@ export default { document.dispatchEvent(new Event(EVENTS.UPDATE_CHECKOUT_IN)); // Send the new values in an event. It's up to the external platform to do handle this event or not. - document.dispatchEvent(new CustomEvent(EVENTS.ADDRESS_UPDATED_OUT, { detail: this.values })); + document.dispatchEvent(new CustomEvent(EVENTS.UPDATE_ADDRESS_OUT, { detail: this.values })); }, }, }; diff --git a/src/config/configBus.js b/src/config/configBus.js index 470e29d3..37766b9a 100644 --- a/src/config/configBus.js +++ b/src/config/configBus.js @@ -130,7 +130,7 @@ export const createConfigBus = () => { initialize(); - document.addEventListener(EVENTS.UPDATE_CONFIG, initialize); + document.addEventListener(EVENTS.UPDATE_CONFIG_IN, initialize); }, methods: { diff --git a/src/config/data/eventConfig.js b/src/config/data/eventConfig.js index 85cb17af..a342ebb8 100644 --- a/src/config/data/eventConfig.js +++ b/src/config/data/eventConfig.js @@ -1,3 +1,7 @@ +/* + * configBus events + */ + /** * Sent by configBus when a setting is updated. * @@ -19,12 +23,17 @@ export const AFTER_UPDATE = 'afterUpdate'; */ export const ERROR = 'error'; +/* + * Document events + * The following events should be namespaced to avoid any possible conflicts. + */ + /** * This event is used to change the config after the initialization. * * @type {string} */ -export const UPDATE_CONFIG = 'myparcel_update_config'; +export const UPDATE_CONFIG_IN = 'myparcel_update_config'; /** * For the external platform to tell this application to update. @@ -38,11 +47,11 @@ export const UPDATE_CHECKOUT_IN = 'myparcel_update_checkout'; * * @type {string} */ -export const ADDRESS_UPDATED_OUT = 'address_updated'; +export const UPDATE_ADDRESS_OUT = 'myparcel_updated_address'; /** * To tell the external platform it needs to update. * * @type {string} */ -export const UPDATE_CHECKOUT_OUT = 'update_checkout'; +export const UPDATE_CHECKOUT_OUT = 'myparecl_updated_checkout';