@latitude-data/webcomponents
Advanced tools
Comparing version 0.0.0 to 0.1.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
const utils = require('./utils-bcad3386.js'); | ||
exports.format = utils.format; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -5,6 +5,5 @@ 'use strict'; | ||
const index = require('./index-5aa4d283.js'); | ||
const utils = require('./utils-bcad3386.js'); | ||
const index = require('./index-10d39923.js'); | ||
const latitudeEmbedCss = ":host{display:block}"; | ||
const latitudeEmbedCss = ":host{display:block;height:100%}iframe{width:100%;height:100%;border:none}"; | ||
const LatitudeEmbedStyle0 = latitudeEmbedCss; | ||
@@ -15,12 +14,82 @@ | ||
index.registerInstance(this, hostRef); | ||
this.first = undefined; | ||
this.middle = undefined; | ||
this.last = undefined; | ||
this.paramsChanged = index.createEvent(this, "paramsChanged", 7); | ||
this.url = undefined; | ||
this.params = undefined; | ||
this.signedParams = undefined; | ||
this.iframeSrc = undefined; | ||
this.queryOrigin = undefined; | ||
} | ||
getText() { | ||
return utils.format(this.first, this.middle, this.last); | ||
get rootEl() { return index.getElement(this); } | ||
paramsChanged; | ||
componentWillLoad() { | ||
this.buildIframeData(); | ||
} | ||
componentDidLoad() { | ||
window.addEventListener('message', this.handleMessage); | ||
} | ||
disconnectedCallback() { | ||
window.removeEventListener('message', this.handleMessage); | ||
} | ||
queryChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
signedParamsChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
runHandler(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
paramsChangedHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
customEventHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
get iframe() { | ||
return this.rootEl.shadowRoot.querySelector('iframe'); | ||
} | ||
buildIframeData() { | ||
const queryParams = this.params ?? {}; | ||
const params = this.signedParams | ||
? { __token: this.signedParams, ...queryParams } | ||
: queryParams; | ||
const urlParams = new URLSearchParams(params); | ||
this.iframeSrc = this.url ? `${this.url}?${urlParams.toString()}` : null; | ||
this.queryOrigin = this.buildQueryOrigin(); | ||
} | ||
buildQueryOrigin() { | ||
if (!this.url) | ||
return ''; | ||
const url = new URL(this.url); | ||
return url.origin; | ||
} | ||
handleMessage = (event) => { | ||
if (event.source !== this.iframe.contentWindow) | ||
return; | ||
const type = event.data.type; | ||
switch (type) { | ||
case 'latitude-params-changed': | ||
this.paramsChanged.emit(event.data); | ||
break; | ||
} | ||
}; | ||
render() { | ||
return index.h("div", { key: '46812a42ed0d224cdb260860105f24e4bd9bd44f' }, "Hello, World! I'm ", this.getText()); | ||
return index.h("iframe", { key: '08cf16d3f346e7eb81f5bece29661d3bcbc1e55f', src: this.iframeSrc }); | ||
} | ||
static get watchers() { return { | ||
"url": ["queryChanged"], | ||
"signedParams": ["signedParamsChanged"] | ||
}; } | ||
}; | ||
@@ -27,0 +96,0 @@ LatitudeEmbed.style = LatitudeEmbedStyle0; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const index = require('./index-5aa4d283.js'); | ||
const index = require('./index-10d39923.js'); | ||
const appGlobals = require('./app-globals-3a1e7e63.js'); | ||
@@ -12,3 +12,3 @@ | ||
await appGlobals.globalScripts(); | ||
return index.bootstrapLazy([["latitude-embed.cjs",[[1,"latitude-embed",{"first":[1],"middle":[1],"last":[1]}]]]], options); | ||
return index.bootstrapLazy([["latitude-embed.cjs",[[1,"latitude-embed",{"url":[1025],"params":[1040],"signedParams":[1025,"signed-params"],"iframeSrc":[32],"queryOrigin":[32]},[[4,"latitude-run","runHandler"],[4,"latitude-params-changed","paramsChangedHander"],[4,"latitude-custom","customEventHander"]],{"url":["queryChanged"],"signedParams":["signedParamsChanged"]}]]]], options); | ||
}; | ||
@@ -15,0 +15,0 @@ |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const index = require('./index-5aa4d283.js'); | ||
const index = require('./index-10d39923.js'); | ||
const appGlobals = require('./app-globals-3a1e7e63.js'); | ||
@@ -23,3 +23,3 @@ | ||
await appGlobals.globalScripts(); | ||
return index.bootstrapLazy([["latitude-embed.cjs",[[1,"latitude-embed",{"first":[1],"middle":[1],"last":[1]}]]]], options); | ||
return index.bootstrapLazy([["latitude-embed.cjs",[[1,"latitude-embed",{"url":[1025],"params":[1040],"signedParams":[1025,"signed-params"],"iframeSrc":[32],"queryOrigin":[32]},[[4,"latitude-run","runHandler"],[4,"latitude-params-changed","paramsChangedHander"],[4,"latitude-custom","customEventHander"]],{"url":["queryChanged"],"signedParams":["signedParamsChanged"]}]]]], options); | ||
}); | ||
@@ -26,0 +26,0 @@ |
@@ -1,14 +0,79 @@ | ||
import { h } from "@stencil/core"; | ||
import { format } from "../../utils/utils"; | ||
import { h, } from "@stencil/core"; | ||
export class LatitudeEmbed { | ||
constructor() { | ||
this.first = undefined; | ||
this.middle = undefined; | ||
this.last = undefined; | ||
this.url = undefined; | ||
this.params = undefined; | ||
this.signedParams = undefined; | ||
this.iframeSrc = undefined; | ||
this.queryOrigin = undefined; | ||
} | ||
getText() { | ||
return format(this.first, this.middle, this.last); | ||
rootEl; | ||
paramsChanged; | ||
componentWillLoad() { | ||
this.buildIframeData(); | ||
} | ||
componentDidLoad() { | ||
window.addEventListener('message', this.handleMessage); | ||
} | ||
disconnectedCallback() { | ||
window.removeEventListener('message', this.handleMessage); | ||
} | ||
queryChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
signedParamsChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
runHandler(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
paramsChangedHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
customEventHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
get iframe() { | ||
return this.rootEl.shadowRoot.querySelector('iframe'); | ||
} | ||
buildIframeData() { | ||
const queryParams = this.params ?? {}; | ||
const params = this.signedParams | ||
? { __token: this.signedParams, ...queryParams } | ||
: queryParams; | ||
const urlParams = new URLSearchParams(params); | ||
this.iframeSrc = this.url ? `${this.url}?${urlParams.toString()}` : null; | ||
this.queryOrigin = this.buildQueryOrigin(); | ||
} | ||
buildQueryOrigin() { | ||
if (!this.url) | ||
return ''; | ||
const url = new URL(this.url); | ||
return url.origin; | ||
} | ||
handleMessage = (event) => { | ||
if (event.source !== this.iframe.contentWindow) | ||
return; | ||
const type = event.data.type; | ||
switch (type) { | ||
case 'latitude-params-changed': | ||
this.paramsChanged.emit(event.data); | ||
break; | ||
default: | ||
} | ||
}; | ||
render() { | ||
return h("div", { key: '46812a42ed0d224cdb260860105f24e4bd9bd44f' }, "Hello, World! I'm ", this.getText()); | ||
return h("iframe", { key: '08cf16d3f346e7eb81f5bece29661d3bcbc1e55f', src: this.iframeSrc }); | ||
} | ||
@@ -29,5 +94,5 @@ static get is() { return "latitude-embed"; } | ||
return { | ||
"first": { | ||
"url": { | ||
"type": "string", | ||
"mutable": false, | ||
"mutable": true, | ||
"complexType": { | ||
@@ -38,3 +103,3 @@ "original": "string", | ||
}, | ||
"required": false, | ||
"required": true, | ||
"optional": false, | ||
@@ -45,12 +110,17 @@ "docs": { | ||
}, | ||
"attribute": "first", | ||
"attribute": "url", | ||
"reflect": false | ||
}, | ||
"middle": { | ||
"type": "string", | ||
"mutable": false, | ||
"params": { | ||
"type": "unknown", | ||
"mutable": true, | ||
"complexType": { | ||
"original": "string", | ||
"resolved": "string", | ||
"references": {} | ||
"original": "Record<string, string>", | ||
"resolved": "{ [x: string]: string; }", | ||
"references": { | ||
"Record": { | ||
"location": "global", | ||
"id": "global::Record" | ||
} | ||
} | ||
}, | ||
@@ -62,9 +132,7 @@ "required": false, | ||
"text": "" | ||
}, | ||
"attribute": "middle", | ||
"reflect": false | ||
} | ||
}, | ||
"last": { | ||
"signedParams": { | ||
"type": "string", | ||
"mutable": false, | ||
"mutable": true, | ||
"complexType": { | ||
@@ -81,3 +149,3 @@ "original": "string", | ||
}, | ||
"attribute": "last", | ||
"attribute": "signed-params", | ||
"reflect": false | ||
@@ -87,3 +155,69 @@ } | ||
} | ||
static get states() { | ||
return { | ||
"iframeSrc": {}, | ||
"queryOrigin": {} | ||
}; | ||
} | ||
static get events() { | ||
return [{ | ||
"method": "paramsChanged", | ||
"name": "paramsChanged", | ||
"bubbles": true, | ||
"cancelable": true, | ||
"composed": true, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"complexType": { | ||
"original": "EmbeddingEventData<EmbeddingEvent.ParamsChanged>", | ||
"resolved": "{ type: EmbeddingEvent.ParamsChanged; params: ParamsChangedEventData; }", | ||
"references": { | ||
"EmbeddingEventData": { | ||
"location": "import", | ||
"path": "@latitude-data/embedding", | ||
"id": "../../embedding/dist/index.d.ts::EmbeddingEventData" | ||
}, | ||
"EmbeddingEvent": { | ||
"location": "import", | ||
"path": "@latitude-data/embedding", | ||
"id": "../../embedding/dist/index.d.ts::EmbeddingEvent" | ||
} | ||
} | ||
} | ||
}]; | ||
} | ||
static get elementRef() { return "rootEl"; } | ||
static get watchers() { | ||
return [{ | ||
"propName": "url", | ||
"methodName": "queryChanged" | ||
}, { | ||
"propName": "signedParams", | ||
"methodName": "signedParamsChanged" | ||
}]; | ||
} | ||
static get listeners() { | ||
return [{ | ||
"name": "latitude-run", | ||
"method": "runHandler", | ||
"target": "document", | ||
"capture": false, | ||
"passive": false | ||
}, { | ||
"name": "latitude-params-changed", | ||
"method": "paramsChangedHander", | ||
"target": "document", | ||
"capture": false, | ||
"passive": false | ||
}, { | ||
"name": "latitude-custom", | ||
"method": "customEventHander", | ||
"target": "document", | ||
"capture": false, | ||
"passive": false | ||
}]; | ||
} | ||
} | ||
//# sourceMappingURL=latitude-embed.js.map |
import { newSpecPage } from "@stencil/core/testing"; | ||
import { LatitudeEmbed } from "./latitude-embed"; | ||
describe('latitude-embed', () => { | ||
it('renders', async () => { | ||
it('renders an iframe', async () => { | ||
const { root } = await newSpecPage({ | ||
components: [LatitudeEmbed], | ||
html: '<latitude-embed></latitude-embed>', | ||
html: '<latitude-embed class="h-full"></latitude-embed>', | ||
}); | ||
expect(root).toEqualHtml(` | ||
<latitude-embed> | ||
<latitude-embed class="h-full"> | ||
<mock:shadow-root> | ||
<div> | ||
Hello, World! I'm | ||
</div> | ||
<iframe> | ||
</iframe> | ||
</mock:shadow-root> | ||
@@ -19,18 +18,38 @@ </latitude-embed> | ||
}); | ||
it('renders with values', async () => { | ||
const { root } = await newSpecPage({ | ||
it('renders the iframe URL with the right params', async () => { | ||
const page = await newSpecPage({ | ||
components: [LatitudeEmbed], | ||
html: `<latitude-embed first="Stencil" last="'Don't call me a framework' JS"></latitude-embed>`, | ||
html: ` | ||
<latitude-embed url="https://latitude.test-hack-init"></latitude-embed> | ||
`, | ||
}); | ||
expect(root).toEqualHtml(` | ||
<latitude-embed first="Stencil" last="'Don't call me a framework' JS"> | ||
<mock:shadow-root> | ||
<div> | ||
Hello, World! I'm Stencil 'Don't call me a framework' JS | ||
</div> | ||
</mock:shadow-root> | ||
</latitude-embed> | ||
`); | ||
// Test are done with webcomponents. So is not possible to | ||
// pass object as props directly. Instead, we need to set the | ||
// property of the instance. | ||
const { root, rootInstance: component } = page; | ||
component.params = { hello: 'world' }; | ||
component.url = 'https://latitude.test'; | ||
await page.waitForChanges(); | ||
// NOTE: URL + params are updated only when the component is loaded | ||
// We need to check the iframe src because URL only change whe url is changed | ||
// because we don't want to re-render the iframe every time the params change | ||
const iframe = root.shadowRoot.querySelector('iframe'); | ||
expect(iframe.getAttribute('src')).toBe('https://latitude.test?hello=world'); | ||
}); | ||
it('renders signedParams as part of the iframe URL', async () => { | ||
const page = await newSpecPage({ | ||
components: [LatitudeEmbed], | ||
html: ` | ||
<latitude-embed url="https://latitude.test-hack-init"></latitude-embed> | ||
`, | ||
}); | ||
const { root, rootInstance: component } = page; | ||
component.params = { hello: 'world' }; | ||
component.signedParams = 'ENCRYPTED_PARAMS'; | ||
component.url = 'https://latitude.test'; | ||
await page.waitForChanges(); | ||
const iframe = root.shadowRoot.querySelector('iframe'); | ||
expect(iframe.getAttribute('src')).toBe('https://latitude.test?__token=ENCRYPTED_PARAMS&hello=world'); | ||
}); | ||
}); | ||
//# sourceMappingURL=latitude-embed.spec.js.map |
@@ -10,3 +10,2 @@ /** | ||
*/ | ||
export { format } from './utils/utils'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
export { f as format, g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-713ca541.js'; | ||
export { g as getAssetPath, s as setAssetPath, a as setNonce, b as setPlatformOptions } from './p-6bf5b4ec.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,4 @@ | ||
import { p as proxyCustomElement, H, f as format, h } from './p-713ca541.js'; | ||
import { p as proxyCustomElement, H, c as createEvent, h } from './p-6bf5b4ec.js'; | ||
const latitudeEmbedCss = ":host{display:block}"; | ||
const latitudeEmbedCss = ":host{display:block;height:100%}iframe{width:100%;height:100%;border:none}"; | ||
const LatitudeEmbedStyle0 = latitudeEmbedCss; | ||
@@ -11,17 +11,92 @@ | ||
this.__attachShadow(); | ||
this.first = undefined; | ||
this.middle = undefined; | ||
this.last = undefined; | ||
this.paramsChanged = createEvent(this, "paramsChanged", 7); | ||
this.url = undefined; | ||
this.params = undefined; | ||
this.signedParams = undefined; | ||
this.iframeSrc = undefined; | ||
this.queryOrigin = undefined; | ||
} | ||
getText() { | ||
return format(this.first, this.middle, this.last); | ||
get rootEl() { return this; } | ||
paramsChanged; | ||
componentWillLoad() { | ||
this.buildIframeData(); | ||
} | ||
componentDidLoad() { | ||
window.addEventListener('message', this.handleMessage); | ||
} | ||
disconnectedCallback() { | ||
window.removeEventListener('message', this.handleMessage); | ||
} | ||
queryChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
signedParamsChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
runHandler(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
paramsChangedHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
customEventHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
get iframe() { | ||
return this.rootEl.shadowRoot.querySelector('iframe'); | ||
} | ||
buildIframeData() { | ||
const queryParams = this.params ?? {}; | ||
const params = this.signedParams | ||
? { __token: this.signedParams, ...queryParams } | ||
: queryParams; | ||
const urlParams = new URLSearchParams(params); | ||
this.iframeSrc = this.url ? `${this.url}?${urlParams.toString()}` : null; | ||
this.queryOrigin = this.buildQueryOrigin(); | ||
} | ||
buildQueryOrigin() { | ||
if (!this.url) | ||
return ''; | ||
const url = new URL(this.url); | ||
return url.origin; | ||
} | ||
handleMessage = (event) => { | ||
if (event.source !== this.iframe.contentWindow) | ||
return; | ||
const type = event.data.type; | ||
switch (type) { | ||
case 'latitude-params-changed': | ||
this.paramsChanged.emit(event.data); | ||
break; | ||
} | ||
}; | ||
render() { | ||
return h("div", { key: '46812a42ed0d224cdb260860105f24e4bd9bd44f' }, "Hello, World! I'm ", this.getText()); | ||
return h("iframe", { key: '08cf16d3f346e7eb81f5bece29661d3bcbc1e55f', src: this.iframeSrc }); | ||
} | ||
static get watchers() { return { | ||
"url": ["queryChanged"], | ||
"signedParams": ["signedParamsChanged"] | ||
}; } | ||
static get style() { return LatitudeEmbedStyle0; } | ||
}, [1, "latitude-embed", { | ||
"first": [1], | ||
"middle": [1], | ||
"last": [1] | ||
"url": [1025], | ||
"params": [1040], | ||
"signedParams": [1025, "signed-params"], | ||
"iframeSrc": [32], | ||
"queryOrigin": [32] | ||
}, [[4, "latitude-run", "runHandler"], [4, "latitude-params-changed", "paramsChangedHander"], [4, "latitude-custom", "customEventHander"]], { | ||
"url": ["queryChanged"], | ||
"signedParams": ["signedParamsChanged"] | ||
}]); | ||
@@ -28,0 +103,0 @@ function defineCustomElement$1() { |
@@ -1,3 +0,3 @@ | ||
export { f as format } from './utils-11fcde98.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,5 +0,4 @@ | ||
import { r as registerInstance, h } from './index-c91f3e72.js'; | ||
import { f as format } from './utils-11fcde98.js'; | ||
import { r as registerInstance, c as createEvent, g as getElement, h } from './index-3bad40ab.js'; | ||
const latitudeEmbedCss = ":host{display:block}"; | ||
const latitudeEmbedCss = ":host{display:block;height:100%}iframe{width:100%;height:100%;border:none}"; | ||
const LatitudeEmbedStyle0 = latitudeEmbedCss; | ||
@@ -10,12 +9,82 @@ | ||
registerInstance(this, hostRef); | ||
this.first = undefined; | ||
this.middle = undefined; | ||
this.last = undefined; | ||
this.paramsChanged = createEvent(this, "paramsChanged", 7); | ||
this.url = undefined; | ||
this.params = undefined; | ||
this.signedParams = undefined; | ||
this.iframeSrc = undefined; | ||
this.queryOrigin = undefined; | ||
} | ||
getText() { | ||
return format(this.first, this.middle, this.last); | ||
get rootEl() { return getElement(this); } | ||
paramsChanged; | ||
componentWillLoad() { | ||
this.buildIframeData(); | ||
} | ||
componentDidLoad() { | ||
window.addEventListener('message', this.handleMessage); | ||
} | ||
disconnectedCallback() { | ||
window.removeEventListener('message', this.handleMessage); | ||
} | ||
queryChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
signedParamsChanged() { | ||
// We don't want to re-render the iframe every time the | ||
// params change. We only want to re-render the iframe | ||
// when the query or signupParam change. | ||
this.buildIframeData(); | ||
} | ||
runHandler(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
paramsChangedHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
customEventHander(event) { | ||
this.iframe.contentWindow.postMessage(event.detail, { | ||
targetOrigin: this.queryOrigin, | ||
}); | ||
} | ||
get iframe() { | ||
return this.rootEl.shadowRoot.querySelector('iframe'); | ||
} | ||
buildIframeData() { | ||
const queryParams = this.params ?? {}; | ||
const params = this.signedParams | ||
? { __token: this.signedParams, ...queryParams } | ||
: queryParams; | ||
const urlParams = new URLSearchParams(params); | ||
this.iframeSrc = this.url ? `${this.url}?${urlParams.toString()}` : null; | ||
this.queryOrigin = this.buildQueryOrigin(); | ||
} | ||
buildQueryOrigin() { | ||
if (!this.url) | ||
return ''; | ||
const url = new URL(this.url); | ||
return url.origin; | ||
} | ||
handleMessage = (event) => { | ||
if (event.source !== this.iframe.contentWindow) | ||
return; | ||
const type = event.data.type; | ||
switch (type) { | ||
case 'latitude-params-changed': | ||
this.paramsChanged.emit(event.data); | ||
break; | ||
} | ||
}; | ||
render() { | ||
return h("div", { key: '46812a42ed0d224cdb260860105f24e4bd9bd44f' }, "Hello, World! I'm ", this.getText()); | ||
return h("iframe", { key: '08cf16d3f346e7eb81f5bece29661d3bcbc1e55f', src: this.iframeSrc }); | ||
} | ||
static get watchers() { return { | ||
"url": ["queryChanged"], | ||
"signedParams": ["signedParamsChanged"] | ||
}; } | ||
}; | ||
@@ -22,0 +91,0 @@ LatitudeEmbed.style = LatitudeEmbedStyle0; |
@@ -1,3 +0,3 @@ | ||
import { b as bootstrapLazy } from './index-c91f3e72.js'; | ||
export { s as setNonce } from './index-c91f3e72.js'; | ||
import { b as bootstrapLazy } from './index-3bad40ab.js'; | ||
export { s as setNonce } from './index-3bad40ab.js'; | ||
import { g as globalScripts } from './app-globals-0f993ce5.js'; | ||
@@ -8,3 +8,3 @@ | ||
await globalScripts(); | ||
return bootstrapLazy([["latitude-embed",[[1,"latitude-embed",{"first":[1],"middle":[1],"last":[1]}]]]], options); | ||
return bootstrapLazy([["latitude-embed",[[1,"latitude-embed",{"url":[1025],"params":[1040],"signedParams":[1025,"signed-params"],"iframeSrc":[32],"queryOrigin":[32]},[[4,"latitude-run","runHandler"],[4,"latitude-params-changed","paramsChangedHander"],[4,"latitude-custom","customEventHander"]],{"url":["queryChanged"],"signedParams":["signedParamsChanged"]}]]]], options); | ||
}; | ||
@@ -11,0 +11,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-c91f3e72.js'; | ||
export { s as setNonce } from './index-c91f3e72.js'; | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-3bad40ab.js'; | ||
export { s as setNonce } from './index-3bad40ab.js'; | ||
import { g as globalScripts } from './app-globals-0f993ce5.js'; | ||
@@ -19,5 +19,5 @@ | ||
await globalScripts(); | ||
return bootstrapLazy([["latitude-embed",[[1,"latitude-embed",{"first":[1],"middle":[1],"last":[1]}]]]], options); | ||
return bootstrapLazy([["latitude-embed",[[1,"latitude-embed",{"url":[1025],"params":[1040],"signedParams":[1025,"signed-params"],"iframeSrc":[32],"queryOrigin":[32]},[[4,"latitude-run","runHandler"],[4,"latitude-params-changed","paramsChangedHander"],[4,"latitude-custom","customEventHander"]],{"url":["queryChanged"],"signedParams":["signedParamsChanged"]}]]]], options); | ||
}); | ||
//# sourceMappingURL=webcomponents.js.map |
@@ -8,11 +8,28 @@ /* eslint-disable */ | ||
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime"; | ||
import { EmbeddingEvent, EmbeddingEventData } from "@latitude-data/embedding"; | ||
export { EmbeddingEvent, EmbeddingEventData } from "@latitude-data/embedding"; | ||
export namespace Components { | ||
interface LatitudeEmbed { | ||
"first": string; | ||
"last": string; | ||
"middle": string; | ||
"params": Record<string, string>; | ||
"signedParams": string; | ||
"url": string; | ||
} | ||
} | ||
export interface LatitudeEmbedCustomEvent<T> extends CustomEvent<T> { | ||
detail: T; | ||
target: HTMLLatitudeEmbedElement; | ||
} | ||
declare global { | ||
interface HTMLLatitudeEmbedElementEventMap { | ||
"paramsChanged": EmbeddingEventData<EmbeddingEvent.ParamsChanged>; | ||
} | ||
interface HTMLLatitudeEmbedElement extends Components.LatitudeEmbed, HTMLStencilElement { | ||
addEventListener<K extends keyof HTMLLatitudeEmbedElementEventMap>(type: K, listener: (this: HTMLLatitudeEmbedElement, ev: LatitudeEmbedCustomEvent<HTMLLatitudeEmbedElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void; | ||
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; | ||
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; | ||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; | ||
removeEventListener<K extends keyof HTMLLatitudeEmbedElementEventMap>(type: K, listener: (this: HTMLLatitudeEmbedElement, ev: LatitudeEmbedCustomEvent<HTMLLatitudeEmbedElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void; | ||
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void; | ||
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; | ||
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; | ||
} | ||
@@ -29,5 +46,6 @@ var HTMLLatitudeEmbedElement: { | ||
interface LatitudeEmbed { | ||
"first"?: string; | ||
"last"?: string; | ||
"middle"?: string; | ||
"onParamsChanged"?: (event: LatitudeEmbedCustomEvent<EmbeddingEventData<EmbeddingEvent.ParamsChanged>>) => void; | ||
"params"?: Record<string, string>; | ||
"signedParams"?: string; | ||
"url": string; | ||
} | ||
@@ -34,0 +52,0 @@ interface IntrinsicElements { |
@@ -0,7 +1,24 @@ | ||
import { EventEmitter } from '../../stencil-public-runtime'; | ||
import { EmbeddingEvent, type EmbeddingEventData } from '@latitude-data/embedding'; | ||
export declare class LatitudeEmbed { | ||
first: string; | ||
middle: string; | ||
last: string; | ||
private getText; | ||
url: string; | ||
params: Record<string, string>; | ||
signedParams: string; | ||
iframeSrc: string; | ||
queryOrigin: string; | ||
rootEl: HTMLElement; | ||
paramsChanged: EventEmitter<EmbeddingEventData<EmbeddingEvent.ParamsChanged>>; | ||
componentWillLoad(): void; | ||
componentDidLoad(): void; | ||
disconnectedCallback(): void; | ||
queryChanged(): void; | ||
signedParamsChanged(): void; | ||
runHandler(event: CustomEvent<EmbeddingEventData<EmbeddingEvent.Run>>): void; | ||
paramsChangedHander(event: CustomEvent<EmbeddingEventData<EmbeddingEvent.Run>>): void; | ||
customEventHander(event: CustomEvent<EmbeddingEventData<EmbeddingEvent.Run>>): void; | ||
private get iframe(); | ||
private buildIframeData; | ||
private buildQueryOrigin; | ||
private handleMessage; | ||
render(): any; | ||
} |
@@ -10,2 +10,1 @@ /** | ||
*/ | ||
export { format } from './utils/utils'; |
@@ -1,2 +0,2 @@ | ||
export{f as format}from"./p-b07dd267.js"; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
import{p as t,b as e}from"./p-6cb533d7.js";export{s as setNonce}from"./p-6cb533d7.js";import{g as r}from"./p-e1255160.js";const a=()=>{const s=import.meta.url;const e={};if(s!==""){e.resourcesUrl=new URL(".",s).href}return t(e)};a().then((async t=>{await r();return e([["p-86da8483",[[1,"latitude-embed",{first:[1],middle:[1],last:[1]}]]]],t)})); | ||
import{p as a,b as e}from"./p-ff69382e.js";export{s as setNonce}from"./p-ff69382e.js";import{g as r}from"./p-e1255160.js";const n=()=>{const e=import.meta.url;const r={};if(e!==""){r.resourcesUrl=new URL(".",e).href}return a(r)};n().then((async a=>{await r();return e([["p-2315492f",[[1,"latitude-embed",{url:[1025],params:[1040],signedParams:[1025,"signed-params"],iframeSrc:[32],queryOrigin:[32]},[[4,"latitude-run","runHandler"],[4,"latitude-params-changed","paramsChangedHander"],[4,"latitude-custom","customEventHander"]],{url:["queryChanged"],signedParams:["signedParamsChanged"]}]]]],a)})); | ||
//# sourceMappingURL=webcomponents.esm.js.map |
{ | ||
"name": "@latitude-data/webcomponents", | ||
"description": "Web Components for Latitude", | ||
"version": "0.0.0", | ||
"version": "0.1.0", | ||
"license": "LGPL", | ||
@@ -34,2 +34,5 @@ "repository": { | ||
], | ||
"dependencies": { | ||
"@latitude-data/embedding": "0.1.0" | ||
}, | ||
"devDependencies": { | ||
@@ -46,5 +49,6 @@ "@stencil/core": "^4.7.0", | ||
"scripts": { | ||
"dev": "stencil build --watch", | ||
"build": "stencil build", | ||
"prettier": "prettier --write 'src/*.ts' 'src/components.d.ts' 'src/**/*.tsx' 'src/**/*.ts'", | ||
"start": "stencil build --dev --watch --serve", | ||
"stencil": "stencil", | ||
"test": "stencil test --spec", | ||
@@ -51,0 +55,0 @@ "test:watch": "stencil test --spec --watchAll", |
# Latitude web components | ||
Common Latitude components used accross differnt frontend frameworks like | ||
`latitude-embed` iframe wrapper. | ||
Common Latitude components used accross different frontend frameworks. We expose | ||
webcomponents like `<latitude-embed></latitude-embed>` iframe wrapper. | ||
@@ -10,6 +10,6 @@ ## Getting Started | ||
pnpm install | ||
pnpm start | ||
pnpm dev | ||
``` | ||
To build the component for production, run: | ||
To build the component for production or using inside others packages, run: | ||
@@ -16,0 +16,0 @@ ```bash |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1466858
8257
1
70
2
+ Added@latitude-data/embedding@0.1.0(transitive)