@embeddable.com/sdk-core 3.9.10 → 3.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddable.com/sdk-core",
3
- "version": "3.9.10",
3
+ "version": "3.9.12",
4
4
  "description": "Core Embeddable SDK module responsible for web-components bundling and publishing.",
5
5
  "keywords": [
6
6
  "embeddable",
@@ -9,7 +9,7 @@ import { Component, Watch, Host, Prop, Event, EventEmitter, h, Listen } from '@s
9
9
  export class EmbeddableComponent {
10
10
 
11
11
  private rootElement?: HTMLDivElement;
12
- private updatePropsEventDispatched?: boolean;
12
+ private updateEventDispatched?: boolean;
13
13
 
14
14
  @Prop() componentName: string;
15
15
  @Prop() props: string = '{}';
@@ -22,7 +22,6 @@ export class EmbeddableComponent {
22
22
  bubbles: true,
23
23
  }) componentDidLoadEvent: EventEmitter<any>;
24
24
 
25
- @Watch('clientContext')
26
25
  @Watch('componentName')
27
26
  watchComponentName() {
28
27
  this.handlePops();
@@ -45,12 +44,19 @@ export class EmbeddableComponent {
45
44
  }
46
45
 
47
46
  componentWillUpdate() {
48
- const event = new CustomEvent('embeddable-event:update-props', {
47
+ const eventProps = new CustomEvent('embeddable-event:update-props', {
49
48
  bubbles: false,
50
49
  detail: JSON.parse(this.props),
51
50
  });
52
- this.rootElement.dispatchEvent(event);
53
- this.updatePropsEventDispatched = true;
51
+
52
+ const eventClientContext = new CustomEvent('embeddable-event:update-client-context', {
53
+ bubbles: false,
54
+ detail: JSON.parse(this.clientContext),
55
+ });
56
+
57
+ this.rootElement.dispatchEvent(eventProps);
58
+ this.rootElement.dispatchEvent(eventClientContext);
59
+ this.updateEventDispatched = true;
54
60
  }
55
61
 
56
62
  @Listen('embeddable-event:update-props-listen', {target: 'window'})
@@ -58,7 +64,7 @@ export class EmbeddableComponent {
58
64
  const componentId = e.detail.componentId;
59
65
  const props = JSON.parse(this.props);
60
66
 
61
- if(this.updatePropsEventDispatched && componentId === props.componentId) {
67
+ if(this.updateEventDispatched && componentId === props.componentId) {
62
68
  const event = new CustomEvent('embeddable-event:update-props', {
63
69
  bubbles: false,
64
70
  detail: props,
@@ -67,6 +73,20 @@ export class EmbeddableComponent {
67
73
  }
68
74
  }
69
75
 
76
+ @Listen('embeddable-event:update-client-context-listen', {target: 'window'})
77
+ handleUpdateClientContextListen(e) {
78
+ const componentId = e.detail.componentId;
79
+ const props = JSON.parse(this.props);
80
+ if(this.updateEventDispatched && componentId === props.componentId) {
81
+ const clientContext = JSON.parse(this.clientContext);
82
+ const event = new CustomEvent('embeddable-event:update-client-context', {
83
+ bubbles: false,
84
+ detail: clientContext,
85
+ });
86
+ this.rootElement.dispatchEvent(event);
87
+ }
88
+ }
89
+
70
90
  render() {
71
91
  return (
72
92
  <Host>