@builder.io/sdk-svelte 0.4.2 → 0.4.4

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "package",
@@ -1,3 +1,7 @@
1
+ ### 0.4.3
2
+
3
+ - Fix: SSR A/B test environment check (`isHydrationTarget`) now accurately checks current environment.
4
+
1
5
  ### 0.4.2
2
6
 
3
7
  - Feature: Added support for mutating Builder's `state` in custom element events and custom user code.
@@ -1,13 +1,4 @@
1
- <script context="module">/**
2
- * We can't make this a generic `ProvideContext` function because Vue 2 won't support root slots, e.g.
3
- *
4
- * ```vue
5
- *
6
- * <slot></slot>
7
- *
8
- * ```
9
- */
10
- </script>
1
+ <script context="module"></script>
11
2
 
12
3
  <script>import { setContext } from "svelte";
13
4
  import { writable } from "svelte/store";
@@ -1,3 +1,4 @@
1
+ import { TARGET } from '../../constants/target';
1
2
  import { isBrowser } from '../../functions/is-browser';
2
3
  export const getVariants = (content) => Object.values(content?.variations || {});
3
4
  export const checkShouldRunVariants = ({ canTrack, content, }) => {
@@ -155,10 +156,11 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget) {
155
156
  }
156
157
  return;
157
158
  }
158
- const isHydrationTarget = (target) => target === 'react' ||
159
+ const getIsHydrationTarget = (target) => target === 'react' ||
159
160
  target === 'reactNative' ||
160
161
  target === 'vue3' ||
161
162
  target === 'vue2';
163
+ const isHydrationTarget = getIsHydrationTarget(TARGET);
162
164
  /**
163
165
  * We hardcode explicit function names here, because the `.toString()` of a function can change depending on the bundler.
164
166
  * Some bundlers will minify the fn name, etc.
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.2";
1
+ export declare const SDK_VERSION = "0.4.4";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.4.2";
1
+ export const SDK_VERSION = "0.4.4";
@@ -43,7 +43,7 @@ export async function _track(eventProps) {
43
43
  if (!(isBrowser() || TARGET === 'reactNative')) {
44
44
  return;
45
45
  }
46
- return fetch(`https://builder.io/api/v1/track`, {
46
+ return fetch(`https://cdn.builder.io/api/v1/track`, {
47
47
  method: 'POST',
48
48
  body: JSON.stringify({
49
49
  events: [await createEvent(eventProps)],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "0.4.2",
4
+ "version": "0.4.4",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "package",
@@ -3,16 +3,6 @@
3
3
  block: BuilderBlock;
4
4
  repeatContext: BuilderContextInterface;
5
5
  };
6
-
7
- /**
8
- * We can't make this a generic `ProvideContext` function because Vue 2 won't support root slots, e.g.
9
- *
10
- * ```vue
11
- * <template>
12
- * <slot></slot>
13
- * </template>
14
- * ```
15
- */
16
6
  </script>
17
7
 
18
8
  <script lang="ts">
@@ -1,3 +1,4 @@
1
+ import { TARGET } from '../../constants/target';
1
2
  import { isBrowser } from '../../functions/is-browser';
2
3
  import type { Nullable } from '../../helpers/nullable';
3
4
  import type { BuilderContent } from '../../types/builder-content';
@@ -202,12 +203,14 @@ function bldrCntntScrpt(
202
203
  return;
203
204
  }
204
205
 
205
- const isHydrationTarget = (target: Target) =>
206
+ const getIsHydrationTarget = (target: Target) =>
206
207
  target === 'react' ||
207
208
  target === 'reactNative' ||
208
209
  target === 'vue3' ||
209
210
  target === 'vue2';
210
211
 
212
+ const isHydrationTarget = getIsHydrationTarget(TARGET);
213
+
211
214
  /**
212
215
  * We hardcode explicit function names here, because the `.toString()` of a function can change depending on the bundler.
213
216
  * Some bundlers will minify the fn name, etc.
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.4.2"
1
+ export const SDK_VERSION = "0.4.4"
@@ -118,7 +118,7 @@ export async function _track(eventProps: EventProps) {
118
118
  return;
119
119
  }
120
120
 
121
- return fetch(`https://builder.io/api/v1/track`, {
121
+ return fetch(`https://cdn.builder.io/api/v1/track`, {
122
122
  method: 'POST',
123
123
  body: JSON.stringify({
124
124
  events: [await createEvent(eventProps)],