From a764a461e4a563288c421281af1bb7c354e88454 Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Thu, 7 May 2020 10:49:40 +0100 Subject: [PATCH] Refactor client embed id into a shared constant --- examples/kitchen-sink/client/main.js | 3 ++- examples/kitchen-sink/constants.js | 1 + examples/kitchen-sink/server/controllers/home.js | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 examples/kitchen-sink/constants.js diff --git a/examples/kitchen-sink/client/main.js b/examples/kitchen-sink/client/main.js index c2a3a797c..039014402 100644 --- a/examples/kitchen-sink/client/main.js +++ b/examples/kitchen-sink/client/main.js @@ -5,12 +5,13 @@ import * as appContext from '@financial-times/dotcom-ui-app-context' import * as tracking from '@financial-times/n-tracking' import * as ads from '@financial-times/n-ads' import * as clientEmbed from '@financial-times/dotcom-ui-client-embed' +import { CLIENT_EMBED_ID } from '../constants.js' readyState.domready.then(() => { const flagsClient = flags.init() const appContextClient = appContext.init() - const clientEmbedClient = clientEmbed.init('custom-context') + const clientEmbedClient = clientEmbed.init(CLIENT_EMBED_ID) console.log(clientEmbedClient.getAll()) // eslint-disable-line no-console layout.init() diff --git a/examples/kitchen-sink/constants.js b/examples/kitchen-sink/constants.js new file mode 100644 index 000000000..500f42ecc --- /dev/null +++ b/examples/kitchen-sink/constants.js @@ -0,0 +1 @@ +export const CLIENT_EMBED_ID = 'client-embed' diff --git a/examples/kitchen-sink/server/controllers/home.js b/examples/kitchen-sink/server/controllers/home.js index 08b5655b1..a2181ba3e 100644 --- a/examples/kitchen-sink/server/controllers/home.js +++ b/examples/kitchen-sink/server/controllers/home.js @@ -4,6 +4,7 @@ const { Shell } = require('@financial-times/dotcom-ui-shell') const { Layout } = require('@financial-times/dotcom-ui-layout') const { Slot, AdsOptionsEmbed } = require('@financial-times/n-ads') const { ClientEmbed } = require('@financial-times/dotcom-ui-client-embed') +const { CLIENT_EMBED_ID } = require('../../constants.js') module.exports = (_, response, next) => { try { @@ -65,7 +66,7 @@ module.exports = (_, response, next) => { - + )