@builder.io/sdk-solid 0.0.8-19 → 0.0.8-21

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": "@builder.io/sdk-solid",
3
- "version": "0.0.8-19",
3
+ "version": "0.0.8-21",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./src/solid-index.jsx",
@@ -1,5 +1,28 @@
1
+ import { createMutable } from "solid-js/store";
2
+
1
3
  function Video(props) {
2
- return <video {...props.attributes} preload="none" style={{
4
+ const state = createMutable({
5
+ get videoProps() {
6
+ return { ...(props.autoPlay === true ? {
7
+ autoPlay: true
8
+ } : {}),
9
+ ...(props.muted === true ? {
10
+ muted: true
11
+ } : {}),
12
+ ...(props.controls === true ? {
13
+ controls: true
14
+ } : {}),
15
+ ...(props.loop === true ? {
16
+ loop: true
17
+ } : {}),
18
+ ...(props.playsInline === true ? {
19
+ playsInline: true
20
+ } : {})
21
+ };
22
+ }
23
+
24
+ });
25
+ return <video {...state.videoProps} style={{
3
26
  width: "100%",
4
27
  height: "100%",
5
28
  ...props.attributes?.style,
@@ -8,7 +31,7 @@ function Video(props) {
8
31
  // Hack to get object fit to work as expected and
9
32
  // not have the video overflow
10
33
  "border-radius": 1
11
- }} src={props.video || "no-src"} poster={props.posterImage} autoPlay={props.autoPlay} muted={props.muted} controls={props.controls} loop={props.loop}></video>;
34
+ }} src={props.video || "no-src"} poster={props.posterImage}></video>;
12
35
  }
13
36
 
14
37
  export default Video;
@@ -102,6 +102,14 @@ function RenderContent(props) {
102
102
  return {};
103
103
  },
104
104
 
105
+ onClick(_event) {
106
+ if (state.useContent && props.canTrack !== false) {
107
+ track("click", {
108
+ contentId: state.useContent.id
109
+ });
110
+ }
111
+ },
112
+
105
113
  evalExpression(expression) {
106
114
  return expression.replace(/{{([^}]+)}}/g, (_match, group) => evaluate({
107
115
  code: group,
@@ -169,7 +177,7 @@ function RenderContent(props) {
169
177
  window.addEventListener("builder:component:stateChangeListenerActivated", state.emitStateUpdate);
170
178
  }
171
179
 
172
- if (state.useContent) {
180
+ if (state.useContent && props.canTrack !== false) {
173
181
  track("impression", {
174
182
  contentId: state.useContent.id
175
183
  });
@@ -241,9 +249,7 @@ function RenderContent(props) {
241
249
 
242
250
  }} component={BuilderContext.Provider}>
243
251
  <Show when={state.useContent}>
244
- <div onClick={event => track("click", {
245
- contentId: state.useContent.id
246
- })} builder-content-id={state.useContent?.id}>
252
+ <div onClick={event => state.onClick(event)} builder-content-id={state.useContent?.id}>
247
253
  <Show when={state.shouldRenderContentStyles}>
248
254
  <RenderContentStyles cssCode={state.useContent?.data?.cssCode} customFonts={state.useContent?.data?.customFonts}></RenderContentStyles>
249
255
  </Show>