@traffical/svelte 0.2.12 → 0.3.1

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.
@@ -5,7 +5,7 @@
5
5
  Alternative to calling initTraffical() directly in your layout.
6
6
  -->
7
7
  <script lang="ts">
8
- import { onMount } from "svelte";
8
+ import { onMount, untrack } from "svelte";
9
9
  import type { Snippet } from "svelte";
10
10
  import { initTraffical } from "./context.svelte.js";
11
11
  import type { TrafficalProviderConfig } from "./types.js";
@@ -19,9 +19,9 @@
19
19
 
20
20
  let { config, children }: Props = $props();
21
21
 
22
- // Initialize context - this sets up the client and makes it available to children
23
- // Note: Client is created but initialize() is NOT called yet to avoid SSR fetch warnings
24
- const context = initTraffical(config);
22
+ // Initialize context with the initial config value (intentionally non-reactive;
23
+ // setContext must run during component init, and provider config doesn't change).
24
+ const context = untrack(() => initTraffical(config));
25
25
 
26
26
  // Initialize the client ONLY on the client-side after mount
27
27
  // This prevents the "Avoid calling fetch eagerly during SSR" warning
package/dist/index.d.ts CHANGED
@@ -53,9 +53,11 @@
53
53
  * ```
54
54
  */
55
55
  export { resolveParameters, decide, evaluateCondition, evaluateConditions, fnv1a, computeBucket, isInBucketRange, generateEventId, generateDecisionId, generateExposureId, generateTrackEventId, } from "@traffical/core";
56
- export { TrafficalClient, createTrafficalClient, createTrafficalClientSync, LocalStorageProvider, MemoryStorageProvider, createStorageProvider, createDOMBindingPlugin, } from "@traffical/js-client";
56
+ export type { AssignmentLogEntry, AssignmentLogger, } from "@traffical/core";
57
+ export { TrafficalClient, createTrafficalClient, createTrafficalClientSync, LocalStorageProvider, MemoryStorageProvider, createStorageProvider, createDOMBindingPlugin, createWarehouseNativeLoggerPlugin, } from "@traffical/js-client";
57
58
  export { initTraffical, getTrafficalContext, hasTrafficalContext, } from "./context.svelte.js";
58
59
  export { useTraffical, useTrafficalTrack, useTrafficalReward, useTrafficalClient, useTrafficalPlugin, } from "./hooks.svelte.js";
59
60
  export { default as TrafficalProvider } from "./TrafficalProvider.svelte";
60
61
  export type { TrafficalProviderConfig, TrafficalContextValue, UseTrafficalOptions, UseTrafficalResult, BoundTrackOptions, TrackEventOptions, BoundTrackRewardOptions, TrackRewardOptions, LoadTrafficalBundleOptions, LoadTrafficalBundleResult, ConfigBundle, Context, DecisionResult, ParameterValue, TrafficalClient as TrafficalClientType, TrafficalPlugin, } from "./types.js";
62
+ export type { WarehouseNativeLoggerOptions } from "@traffical/js-client";
61
63
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAMH,OAAO,EAEL,iBAAiB,EACjB,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAElB,KAAK,EACL,aAAa,EACb,eAAe,EAEf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAEL,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EAEzB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EAErB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM1E,YAAY,EAEV,uBAAuB,EACvB,qBAAqB,EAErB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EAEjB,uBAAuB,EACvB,kBAAkB,EAElB,0BAA0B,EAC1B,yBAAyB,EAEzB,YAAY,EACZ,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,IAAI,mBAAmB,EACtC,eAAe,GAChB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAMH,OAAO,EAEL,iBAAiB,EACjB,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAElB,KAAK,EACL,aAAa,EACb,eAAe,EAEf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAEL,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EAEzB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EAErB,sBAAsB,EAEtB,iCAAiC,GAClC,MAAM,sBAAsB,CAAC;AAO9B,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM1E,YAAY,EAEV,uBAAuB,EACvB,qBAAqB,EAErB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EAEjB,uBAAuB,EACvB,kBAAkB,EAElB,0BAA0B,EAC1B,yBAAyB,EAEzB,YAAY,EACZ,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,IAAI,mBAAmB,EACtC,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -71,7 +71,9 @@ TrafficalClient, createTrafficalClient, createTrafficalClientSync,
71
71
  // Storage providers
72
72
  LocalStorageProvider, MemoryStorageProvider, createStorageProvider,
73
73
  // Plugins
74
- createDOMBindingPlugin, } from "@traffical/js-client";
74
+ createDOMBindingPlugin,
75
+ // Warehouse-native logger
76
+ createWarehouseNativeLoggerPlugin, } from "@traffical/js-client";
75
77
  // =============================================================================
76
78
  // Svelte-specific exports
77
79
  // =============================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@traffical/svelte",
3
- "version": "0.2.12",
3
+ "version": "0.3.1",
4
4
  "description": "Traffical SDK for Svelte 5 - Provider and hooks for parameter resolution with SSR support",
5
5
  "type": "module",
6
6
  "svelte": "./dist/index.js",
@@ -34,9 +34,9 @@
34
34
  "typecheck": "svelte-check --tsconfig ./tsconfig.json"
35
35
  },
36
36
  "dependencies": {
37
- "@traffical/core": "0.4.0",
38
- "@traffical/js-client": "0.5.1",
39
- "@traffical/node": "0.3.1"
37
+ "@traffical/core": "0.5.0",
38
+ "@traffical/js-client": "0.7.0",
39
+ "@traffical/node": "0.4.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@sveltejs/package": "^2.3.0",