@syntrologie/runtime-sdk 2.15.0 → 2.16.0

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/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export * from './events';
28
28
  export type { NavigationDiagnostics, NavigationListener } from './navigation/NavigationMonitor';
29
29
  export { NavigationMonitor } from './navigation/NavigationMonitor';
30
30
  export * from './notifications';
31
+ export * from './platform';
31
32
  export { RuntimeProvider, useDecision, usePageContext, useRuntime, useRuntimeContext, useRuntimeEvents, useRuntimeState, useSessionContext, useViewportContext, } from './RuntimeProvider';
32
33
  export type { RuntimeMode, SmartCanvasRuntime, SmartCanvasRuntimeOptions } from './runtime';
33
34
  export { createSmartCanvasRuntime, RUNTIME_VERSION } from './runtime';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  ANIMATION_KEYFRAMES,
3
3
  AppRegistry,
4
+ COOKIE_NAME,
4
5
  CanvasEvents,
5
6
  ContextManager,
6
7
  DEFAULT_COOLDOWN,
@@ -21,6 +22,9 @@ import {
21
22
  SessionMetricTracker,
22
23
  ShadowCanvasOverlay,
23
24
  ShadowRootProvider,
25
+ ShopifyAdapter,
26
+ ShopifyAntiFlicker,
27
+ ShopifyPixelBridge,
24
28
  SmartCanvasApp,
25
29
  SmartCanvasController,
26
30
  SmartCanvasElement,
@@ -53,6 +57,7 @@ import {
53
57
  createSurfaceContainer,
54
58
  createSurfaces,
55
59
  decodeToken,
60
+ detectPlatform,
56
61
  encodeToken,
57
62
  evaluate,
58
63
  evaluateCondition,
@@ -100,7 +105,7 @@ import {
100
105
  validateEventName,
101
106
  validateProps,
102
107
  widgetRegistry
103
- } from "./chunk-CVMZW3II.js";
108
+ } from "./chunk-NVV7IWJC.js";
104
109
  import {
105
110
  base,
106
111
  purple,
@@ -4570,6 +4575,68 @@ function validateEventFilter(data) {
4570
4575
  return EventFilterZ.safeParse(data);
4571
4576
  }
4572
4577
 
4578
+ // src/platform/ShopifyAnchorResolver.ts
4579
+ var DAWN_FAMILY = ["dawn", "sense", "craft", "ride", "refresh", "colorblock", "taste", "studio"];
4580
+ var PRESTIGE_FAMILY = ["prestige", "impact", "stretch"];
4581
+ var LEGACY_FAMILY = [
4582
+ "debut",
4583
+ "brooklyn",
4584
+ "supply",
4585
+ "minimal",
4586
+ "narrative",
4587
+ "simple",
4588
+ "boundless"
4589
+ ];
4590
+ var IMPULSE_FAMILY = ["impulse"];
4591
+ var TURBO_FAMILY = ["turbo"];
4592
+ var TRADEMARK_FAMILY = ["trademark", "clean canvas"];
4593
+ function detectThemeFamily() {
4594
+ var _a2, _b;
4595
+ const themeName = (_b = (_a2 = window == null ? void 0 : window.Shopify) == null ? void 0 : _a2.theme) == null ? void 0 : _b.name;
4596
+ if (!themeName) return "unknown";
4597
+ const lower = themeName.toLowerCase();
4598
+ if (DAWN_FAMILY.includes(lower)) return "dawn";
4599
+ if (PRESTIGE_FAMILY.includes(lower)) return "prestige";
4600
+ if (IMPULSE_FAMILY.includes(lower)) return "impulse";
4601
+ if (TURBO_FAMILY.includes(lower)) return "turbo";
4602
+ if (TRADEMARK_FAMILY.includes(lower)) return "trademark";
4603
+ if (LEGACY_FAMILY.includes(lower)) return "legacy";
4604
+ return "unknown";
4605
+ }
4606
+ var ShopifyAnchorResolver = class {
4607
+ /**
4608
+ * Scope a CSS selector to its containing .shopify-section wrapper.
4609
+ */
4610
+ scopeSelector(selector, element) {
4611
+ const section = element.closest(".shopify-section");
4612
+ if (section == null ? void 0 : section.id) {
4613
+ const escaped = typeof CSS !== "undefined" ? CSS.escape(section.id) : section.id;
4614
+ return `#${escaped} ${selector}`;
4615
+ }
4616
+ return selector;
4617
+ }
4618
+ /**
4619
+ * Validate that a selector matches exactly one element in the document.
4620
+ */
4621
+ validateUniqueness(selector) {
4622
+ try {
4623
+ const matches = document.querySelectorAll(selector);
4624
+ return {
4625
+ unique: matches.length === 1,
4626
+ matchCount: matches.length
4627
+ };
4628
+ } catch {
4629
+ return { unique: false, matchCount: 0 };
4630
+ }
4631
+ }
4632
+ /**
4633
+ * Get the current theme family for diagnostic/logging purposes.
4634
+ */
4635
+ getThemeFamily() {
4636
+ return detectThemeFamily();
4637
+ }
4638
+ };
4639
+
4573
4640
  // src/state/schema.ts
4574
4641
  import { z as z5 } from "zod";
4575
4642
  var StoredValueZ = z5.object({
@@ -4669,6 +4736,7 @@ export {
4669
4736
  RuntimeProvider,
4670
4737
  SDK_SCHEMA_VERSION,
4671
4738
  SDK_VERSION,
4739
+ COOKIE_NAME as SHOPIFY_COOKIE_NAME,
4672
4740
  STATIC_SLOT_STYLES,
4673
4741
  ScoreStrategyZ,
4674
4742
  ScrollBehaviorZ,
@@ -4684,6 +4752,10 @@ export {
4684
4752
  SetTextZ,
4685
4753
  ShadowCanvasOverlay,
4686
4754
  ShadowRootProvider,
4755
+ ShopifyAdapter,
4756
+ ShopifyAnchorResolver,
4757
+ ShopifyAntiFlicker,
4758
+ ShopifyPixelBridge,
4687
4759
  SmartCanvasApp,
4688
4760
  SmartCanvasController,
4689
4761
  SmartCanvasElement,
@@ -4735,6 +4807,8 @@ export {
4735
4807
  createSurfaces,
4736
4808
  decisionSchemas,
4737
4809
  decodeToken,
4810
+ detectPlatform,
4811
+ detectThemeFamily,
4738
4812
  encodeToken,
4739
4813
  evaluate,
4740
4814
  evaluateCondition,