@syntrologie/runtime-sdk 0.2.21 → 1.0.1-canary.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/logger.js ADDED
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Debug logger for Syntro SDK.
3
+ *
4
+ * Debug mode is enabled by:
5
+ * 1. URL param: ?syntro_debug=true (highest priority)
6
+ * 2. Token field: d: true
7
+ * 3. Default: false
8
+ */
9
+ let debugEnabled = false;
10
+ /**
11
+ * Check if debug mode is enabled via URL param.
12
+ */
13
+ function checkUrlParam() {
14
+ if (typeof window === 'undefined')
15
+ return false;
16
+ try {
17
+ const params = new URLSearchParams(window.location.search);
18
+ return params.get('syntro_debug') === 'true';
19
+ }
20
+ catch {
21
+ return false;
22
+ }
23
+ }
24
+ /**
25
+ * Initialize the logger with token debug flag.
26
+ * URL param always overrides token setting.
27
+ */
28
+ export function initLogger(tokenDebug) {
29
+ // URL param takes priority
30
+ if (checkUrlParam()) {
31
+ debugEnabled = true;
32
+ return;
33
+ }
34
+ // Otherwise use token setting (default false)
35
+ debugEnabled = tokenDebug !== null && tokenDebug !== void 0 ? tokenDebug : false;
36
+ }
37
+ /**
38
+ * Check if debug mode is currently enabled.
39
+ */
40
+ export function isDebugEnabled() {
41
+ // Always check URL param first (allows runtime override)
42
+ if (checkUrlParam())
43
+ return true;
44
+ return debugEnabled;
45
+ }
46
+ /**
47
+ * Log a debug message (only if debug mode enabled).
48
+ */
49
+ export function debug(prefix, message, data) {
50
+ if (!isDebugEnabled())
51
+ return;
52
+ if (data !== undefined) {
53
+ console.log(`[${prefix}]`, message, data);
54
+ }
55
+ else {
56
+ console.log(`[${prefix}]`, message);
57
+ }
58
+ }
59
+ /**
60
+ * Log a warning (always shown).
61
+ */
62
+ export function warn(prefix, message, data) {
63
+ if (data !== undefined) {
64
+ console.warn(`[${prefix}]`, message, data);
65
+ }
66
+ else {
67
+ console.warn(`[${prefix}]`, message);
68
+ }
69
+ }
70
+ /**
71
+ * Log an error (always shown).
72
+ */
73
+ export function error(prefix, message, data) {
74
+ if (data !== undefined) {
75
+ console.error(`[${prefix}]`, message, data);
76
+ }
77
+ else {
78
+ console.error(`[${prefix}]`, message);
79
+ }
80
+ }
81
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB;;GAEG;AACH,SAAS,aAAa;IACpB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAChD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,MAAM,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,UAAoB;IAC7C,2BAA2B;IAC3B,IAAI,aAAa,EAAE,EAAE,CAAC;QACpB,YAAY,GAAG,IAAI,CAAC;QACpB,OAAO;IACT,CAAC;IACD,8CAA8C;IAC9C,YAAY,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,KAAK,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,yDAAyD;IACzD,IAAI,aAAa,EAAE;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,MAAc,EAAE,OAAe,EAAE,IAAU;IAC/D,IAAI,CAAC,cAAc,EAAE;QAAE,OAAO;IAC9B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,MAAc,EAAE,OAAe,EAAE,IAAU;IAC9D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,MAAc,EAAE,OAAe,EAAE,IAAU;IAC/D,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
@@ -311,13 +311,13 @@ export declare const HighlightStepZ: z.ZodObject<{
311
311
  };
312
312
  kind: "highlight";
313
313
  id: string;
314
+ copy?: string | undefined;
314
315
  blocking?: boolean | undefined;
315
316
  dismiss?: {
316
317
  onEsc?: boolean | undefined;
317
318
  timeoutMs?: number | undefined;
318
319
  onClickOutside?: boolean | undefined;
319
320
  } | undefined;
320
- copy?: string | undefined;
321
321
  ring?: {
322
322
  paddingPx?: number | undefined;
323
323
  radiusPx?: number | undefined;
@@ -347,13 +347,13 @@ export declare const HighlightStepZ: z.ZodObject<{
347
347
  };
348
348
  kind: "highlight";
349
349
  id: string;
350
+ copy?: string | undefined;
350
351
  blocking?: boolean | undefined;
351
352
  dismiss?: {
352
353
  onEsc?: boolean | undefined;
353
354
  timeoutMs?: number | undefined;
354
355
  onClickOutside?: boolean | undefined;
355
356
  } | undefined;
356
- copy?: string | undefined;
357
357
  ring?: {
358
358
  paddingPx?: number | undefined;
359
359
  radiusPx?: number | undefined;
@@ -626,13 +626,13 @@ export declare const CanvasRecipeZ: z.ZodObject<{
626
626
  };
627
627
  kind: "highlight";
628
628
  id: string;
629
+ copy?: string | undefined;
629
630
  blocking?: boolean | undefined;
630
631
  dismiss?: {
631
632
  onEsc?: boolean | undefined;
632
633
  timeoutMs?: number | undefined;
633
634
  onClickOutside?: boolean | undefined;
634
635
  } | undefined;
635
- copy?: string | undefined;
636
636
  ring?: {
637
637
  paddingPx?: number | undefined;
638
638
  radiusPx?: number | undefined;
@@ -662,13 +662,13 @@ export declare const CanvasRecipeZ: z.ZodObject<{
662
662
  };
663
663
  kind: "highlight";
664
664
  id: string;
665
+ copy?: string | undefined;
665
666
  blocking?: boolean | undefined;
666
667
  dismiss?: {
667
668
  onEsc?: boolean | undefined;
668
669
  timeoutMs?: number | undefined;
669
670
  onClickOutside?: boolean | undefined;
670
671
  } | undefined;
671
- copy?: string | undefined;
672
672
  ring?: {
673
673
  paddingPx?: number | undefined;
674
674
  radiusPx?: number | undefined;
@@ -734,13 +734,13 @@ export declare const CanvasRecipeZ: z.ZodObject<{
734
734
  };
735
735
  kind: "highlight";
736
736
  id: string;
737
+ copy?: string | undefined;
737
738
  blocking?: boolean | undefined;
738
739
  dismiss?: {
739
740
  onEsc?: boolean | undefined;
740
741
  timeoutMs?: number | undefined;
741
742
  onClickOutside?: boolean | undefined;
742
743
  } | undefined;
743
- copy?: string | undefined;
744
744
  ring?: {
745
745
  paddingPx?: number | undefined;
746
746
  radiusPx?: number | undefined;
@@ -809,13 +809,13 @@ export declare const CanvasRecipeZ: z.ZodObject<{
809
809
  };
810
810
  kind: "highlight";
811
811
  id: string;
812
+ copy?: string | undefined;
812
813
  blocking?: boolean | undefined;
813
814
  dismiss?: {
814
815
  onEsc?: boolean | undefined;
815
816
  timeoutMs?: number | undefined;
816
817
  onClickOutside?: boolean | undefined;
817
818
  } | undefined;
818
- copy?: string | undefined;
819
819
  ring?: {
820
820
  paddingPx?: number | undefined;
821
821
  radiusPx?: number | undefined;
@@ -885,13 +885,13 @@ export declare function validateRecipe(json: unknown): {
885
885
  };
886
886
  kind: "highlight";
887
887
  id: string;
888
+ copy?: string | undefined;
888
889
  blocking?: boolean | undefined;
889
890
  dismiss?: {
890
891
  onEsc?: boolean | undefined;
891
892
  timeoutMs?: number | undefined;
892
893
  onClickOutside?: boolean | undefined;
893
894
  } | undefined;
894
- copy?: string | undefined;
895
895
  ring?: {
896
896
  paddingPx?: number | undefined;
897
897
  radiusPx?: number | undefined;