@formsort/web-embed-api
Advanced tools
Comparing version 2.2.2 to 2.2.3
# CHANGELOG | ||
## 2.2.3 | ||
### Various fixes & improvements | ||
- Revert Client subdomain as default domain (#78) by @atikenny | ||
## 2.2.2 | ||
@@ -4,0 +10,0 @@ |
@@ -8,6 +8,6 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
const DEFAULT_FLOW_DOMAIN = 'formsort.app'; | ||
const DEFAULT_FLOW_ORIGIN = `https://flow.formsort.com`; | ||
const DEFAULT_CONFIG = { | ||
useHistoryAPI: false, | ||
origin: undefined, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
}; | ||
@@ -27,3 +27,3 @@ var SupportedAnalyticsEvent; | ||
const { style, autoHeight } = config; | ||
let formsortOrigin = config.origin; | ||
const formsortOrigin = config.origin || DEFAULT_FLOW_ORIGIN; | ||
iframeEl.style.border = 'none'; | ||
@@ -162,14 +162,3 @@ if (style) { | ||
const loadFlow = (clientLabel, flowLabel, variantLabel, queryParams) => { | ||
// We overwrite `formsortOrigin` because `onWindowMessage` will read it | ||
formsortOrigin = formsortOrigin || `https://${clientLabel}.${DEFAULT_FLOW_DOMAIN}`; | ||
let url; | ||
if (config.origin) { | ||
// If a custom origin is set, we need to add the clientLabel and flowLabel to the Url | ||
url = `${formsortOrigin}/client/${clientLabel}/flow/${flowLabel}`; | ||
} | ||
else { | ||
// If there is no custom origin set in the config | ||
// we use the default Flow domain which includes the clientLabel | ||
url = `${formsortOrigin}/flow/${flowLabel}`; | ||
} | ||
let url = `${formsortOrigin}/client/${clientLabel}/flow/${flowLabel}`; | ||
if (variantLabel) { | ||
@@ -176,0 +165,0 @@ url += `/variant/${variantLabel}`; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const _1 = tslib_1.__importStar(require(".")); | ||
const DEFAULT_FLOW_ORIGIN = 'https://flow.formsort.com'; | ||
const EMBEDDING_WINDOW_ORIGIN = 'https://test-origin.formsort.com'; | ||
@@ -95,3 +96,3 @@ const clientLabel = 'test-client'; | ||
const iframe = iframes[0]; | ||
expect(iframe.src).toBe(`https://${clientLabel}.formsort.app/flow/${flowLabel}`); | ||
expect(iframe.src).toBe(`https://flow.formsort.com/client/${clientLabel}/flow/${flowLabel}`); | ||
}); | ||
@@ -128,4 +129,4 @@ test('loads and handles messages from custom origin when specified', () => { | ||
const iframe = iframes[0]; | ||
expect(iframe.src).toBe(`https://${clientLabel}.formsort.app` + | ||
`/flow/${flowLabel}/variant/${variantLabel}`); | ||
expect(iframe.src).toBe(`https://flow.formsort.com` + | ||
`/client/${clientLabel}/flow/${flowLabel}/variant/${variantLabel}`); | ||
}); | ||
@@ -145,4 +146,4 @@ test('loads with query parameters if specified', () => { | ||
const iframe = iframes[0]; | ||
expect(iframe.src).toBe(`https://${clientLabel}.formsort.app` + | ||
`/flow/${flowLabel}` + | ||
expect(iframe.src).toBe(`https://flow.formsort.com` + | ||
`/client/${clientLabel}/flow/${flowLabel}` + | ||
`?${queryParamA}=${queryValueA}&${queryParamB}=${queryValueB}`); | ||
@@ -176,3 +177,3 @@ }); | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: undefined, | ||
@@ -192,5 +193,5 @@ }); | ||
const firstFlowIframe = iframes[0]; | ||
expect(firstFlowIframe.src).toBe(`https://${clientLabel}.formsort.app/flow/${flowLabel}`); | ||
expect(firstFlowIframe.src).toBe(`https://flow.formsort.com/client/${clientLabel}/flow/${flowLabel}`); | ||
const secondFlowIframe = iframes[1]; | ||
expect(secondFlowIframe.src).toBe(`https://${clientLabel}.formsort.app/flow/${secondFlowLabel}`); | ||
expect(secondFlowIframe.src).toBe(`https://flow.formsort.com/client/${clientLabel}/flow/${secondFlowLabel}`); | ||
const firstFlowFinalized = jest.fn(); | ||
@@ -202,3 +203,3 @@ firstEmbed.addEventListener(_1.SupportedAnalyticsEvent.FlowFinalized, firstFlowFinalized); | ||
source: firstFlowIframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -224,3 +225,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -247,3 +248,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -263,3 +264,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -282,3 +283,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -304,3 +305,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -324,3 +325,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -348,3 +349,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -367,3 +368,3 @@ type: constants_1.WebEmbedMessage.EMBED_RESIZE_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -381,3 +382,3 @@ type: constants_1.WebEmbedMessage.EMBED_RESIZE_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -406,3 +407,3 @@ type: constants_1.WebEmbedMessage.EMBED_RESIZE_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -429,3 +430,3 @@ type: constants_1.WebEmbedMessage.EMBED_RESIZE_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -455,3 +456,3 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -481,3 +482,3 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -506,3 +507,3 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -531,3 +532,3 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -572,3 +573,3 @@ type: constants_1.WebEmbedMessage.EMBED_EVENT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -596,3 +597,3 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -606,3 +607,3 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -645,3 +646,3 @@ type: constants_1.WebEmbedMessage.EMBED_RESIZE_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -667,3 +668,3 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, | ||
source: iframe.contentWindow, | ||
origin: `https://${clientLabel}.formsort.app`, | ||
origin: DEFAULT_FLOW_ORIGIN, | ||
data: { | ||
@@ -670,0 +671,0 @@ type: constants_1.WebEmbedMessage.EMBED_REDIRECT_MSG, |
{ | ||
"name": "@formsort/web-embed-api", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Embed Formsort flows within other webpages", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
52812
987