@korsolutions/guidon 1.0.9 → 1.0.11

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.
Files changed (32) hide show
  1. package/README.md +160 -39
  2. package/dist/commonjs/components/GuidonProvider.js +41 -13
  3. package/dist/commonjs/components/GuidonProvider.js.map +1 -1
  4. package/dist/commonjs/index.js.map +1 -1
  5. package/dist/commonjs/store.js +95 -7
  6. package/dist/commonjs/store.js.map +1 -1
  7. package/dist/module/components/GuidonProvider.js +41 -13
  8. package/dist/module/components/GuidonProvider.js.map +1 -1
  9. package/dist/module/index.js.map +1 -1
  10. package/dist/module/store.js +95 -7
  11. package/dist/module/store.js.map +1 -1
  12. package/dist/typescript/commonjs/components/GuidonProvider.d.ts +1 -1
  13. package/dist/typescript/commonjs/components/GuidonProvider.d.ts.map +1 -1
  14. package/dist/typescript/commonjs/index.d.ts +1 -1
  15. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  16. package/dist/typescript/commonjs/store.d.ts +28 -4
  17. package/dist/typescript/commonjs/store.d.ts.map +1 -1
  18. package/dist/typescript/commonjs/types.d.ts +18 -6
  19. package/dist/typescript/commonjs/types.d.ts.map +1 -1
  20. package/dist/typescript/module/components/GuidonProvider.d.ts +1 -1
  21. package/dist/typescript/module/components/GuidonProvider.d.ts.map +1 -1
  22. package/dist/typescript/module/index.d.ts +1 -1
  23. package/dist/typescript/module/index.d.ts.map +1 -1
  24. package/dist/typescript/module/store.d.ts +28 -4
  25. package/dist/typescript/module/store.d.ts.map +1 -1
  26. package/dist/typescript/module/types.d.ts +18 -6
  27. package/dist/typescript/module/types.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/src/components/GuidonProvider.tsx +42 -14
  30. package/src/index.ts +1 -0
  31. package/src/store.ts +103 -13
  32. package/src/types.ts +19 -6
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/store.ts"],"names":[],"mappings":"AAEA,OAAO,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G;;IAKH;;OAEG;;CAEJ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,eAC4B,CAAC;AAEzD,eAAO,MAAM,aAAa,2CAItB,CAAC;AAEL,eAAO,MAAM,iBAAiB;;;;CAS3B,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,uBACsB,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;QAmBzB,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAI1B,CAAC"}
@@ -165,8 +165,8 @@ export interface GuidonTooltipRenderProps {
165
165
  */
166
166
  export interface GuidonProviderProps {
167
167
  children: ReactNode;
168
- /** Configuration for the guidon */
169
- config: GuidonConfig;
168
+ /** Configuration for the guidon (optional when using configureTours) */
169
+ config?: GuidonConfig;
170
170
  /** Whether to auto-start when the component mounts */
171
171
  autoStart?: boolean;
172
172
  /** Condition function to determine if guidon should start */
@@ -194,11 +194,19 @@ export interface GuidonTargetProps {
194
194
  /** Whether this target is currently active (for conditional rendering) */
195
195
  active?: boolean;
196
196
  }
197
+ /**
198
+ * Collection of named tours
199
+ */
200
+ export type GuidonTours = Record<string, GuidonConfig>;
197
201
  /**
198
202
  * Internal store state
199
203
  */
200
204
  export interface GuidonState {
201
- /** Currently active guidon config */
205
+ /** Collection of all configured tours */
206
+ tours: GuidonTours;
207
+ /** ID of the currently active tour */
208
+ activeTourId: string | null;
209
+ /** Currently active guidon config (derived from tours + activeTourId, or legacy single config) */
202
210
  config: GuidonConfig | null;
203
211
  /** Whether the guidon is currently active */
204
212
  isActive: boolean;
@@ -221,10 +229,14 @@ export interface GuidonState {
221
229
  * Internal store actions
222
230
  */
223
231
  export interface GuidonActions {
224
- /** Configure the guidon */
232
+ /** Configure a single guidon (legacy API, still supported) */
225
233
  configure: (config: GuidonConfig) => void;
226
- /** Start the guidon */
227
- start: () => void;
234
+ /** Configure multiple named tours */
235
+ configureTours: (tours: GuidonTours) => void;
236
+ /** Start a tour by ID, or the legacy single config if no ID provided */
237
+ start: (tourId?: string) => void;
238
+ /** Stop the current tour without completing it */
239
+ stop: () => void;
228
240
  /** Go to the next step */
229
241
  next: () => void;
230
242
  /** Go to the previous step */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,UAAU,GACV,WAAW,GACX,aAAa,GACb,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,8CAA8C;IAC9C,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,WAAW,CAAC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AI,CAAC;IAC7C,wEAAwE;IACxE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,kDAAkD;IAClD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,sBAAsB;IACtB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,0BAA0B;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,uCAAuC;IACvC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC7E,0BAA0B;IAC1B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,wBAAwB;IACxB,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,sBAAsB;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korsolutions/guidon",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "A cross-platform walkthrough/onboarding component library for React Native with web support. Features spotlight effects, customizable tooltips, and flexible persistence options. ",
5
5
  "repository": "https://github.com/KorSoftwareSolutions/guidon.git",
6
6
  "author": "Christian Jimenez <christianjimenezfael@gmail.com>",
@@ -10,7 +10,7 @@ import type {
10
10
  } from '../types';
11
11
 
12
12
  interface GuidonContextValue {
13
- start: () => void;
13
+ start: (tourId?: string) => void;
14
14
  skip: () => void;
15
15
  reset: () => void;
16
16
  replay: () => Promise<void>;
@@ -43,6 +43,7 @@ export function GuidonProvider({
43
43
  const hasInitialized = useRef(false);
44
44
  const isActive = useGuidonStore((state: GuidonStore) => state.isActive);
45
45
  const storeIsCompleted = useGuidonStore((state: GuidonStore) => state.isCompleted);
46
+ const storeConfig = useGuidonStore((state: GuidonStore) => state.config);
46
47
  const currentStepIndex = useGuidonStore((state: GuidonStore) => state.currentStepIndex);
47
48
  const configure = useGuidonStore((state: GuidonStore) => state.configure);
48
49
  const start = useGuidonStore((state: GuidonStore) => state.start);
@@ -53,17 +54,33 @@ export function GuidonProvider({
53
54
  // Check for waiting state (target element not mounted)
54
55
  const waitingState = useWaitingState();
55
56
 
57
+ // Use config prop ID for persistence, or fall back to store config ID
58
+ const persistenceId = config?.id ?? storeConfig?.id ?? '__guidon_default__';
59
+
56
60
  const {
57
61
  isLoading,
58
62
  isCompleted: persistedCompleted,
59
63
  markCompleted,
60
64
  markStepViewed,
61
65
  clearProgress,
62
- } = useGuidonPersistence(persistenceAdapter, config.id);
66
+ } = useGuidonPersistence(persistenceAdapter, persistenceId);
63
67
 
64
68
  const isCompleted = storeIsCompleted || persistedCompleted;
65
69
 
70
+ // Track if we've already configured to prevent re-configuring during active tour
71
+ const hasConfigured = useRef(false);
72
+ const configRef = useRef(config);
73
+ configRef.current = config;
74
+
75
+ // Only configure if a config prop is provided (legacy single-config mode)
76
+ // Don't reconfigure if a tour is already active
66
77
  useEffect(() => {
78
+ if (!config) return;
79
+ if (isActive) return; // Don't reconfigure while tour is running
80
+ if (hasConfigured.current && configRef.current === config) return; // Same config, already configured
81
+
82
+ hasConfigured.current = true;
83
+
67
84
  const enhancedConfig: GuidonConfig = {
68
85
  ...config,
69
86
  onComplete: async () => {
@@ -75,7 +92,9 @@ export function GuidonProvider({
75
92
  onSkip: async () => {
76
93
  config.onSkip?.();
77
94
  if (persistenceAdapter) {
78
- await markStepViewed(currentStepIndex);
95
+ // Get current step index from store at time of skip
96
+ const currentIdx = useGuidonStore.getState().currentStepIndex;
97
+ await markStepViewed(currentIdx);
79
98
  }
80
99
  },
81
100
  onStepChange: async (stepIndex, step) => {
@@ -87,10 +106,11 @@ export function GuidonProvider({
87
106
  };
88
107
 
89
108
  configure(enhancedConfig);
90
- }, [config, configure, persistenceAdapter, markCompleted, markStepViewed, currentStepIndex]);
109
+ }, [config, configure, persistenceAdapter, markCompleted, markStepViewed, isActive]);
91
110
 
111
+ // Auto-start only in legacy single-config mode
92
112
  useEffect(() => {
93
- if (!autoStart || hasInitialized.current || isLoading) return;
113
+ if (!config || !autoStart || hasInitialized.current || isLoading) return;
94
114
 
95
115
  const checkAndStart = async () => {
96
116
  hasInitialized.current = true;
@@ -108,11 +128,15 @@ export function GuidonProvider({
108
128
  };
109
129
 
110
130
  checkAndStart();
111
- }, [autoStart, isLoading, persistedCompleted, shouldStart, start]);
131
+ }, [config, autoStart, isLoading, persistedCompleted, shouldStart, start]);
112
132
 
113
133
  // Handle wait timeout - auto-skip to next step if waiting too long
134
+ // Works for both legacy and multi-tour mode (reads from store)
114
135
  useEffect(() => {
115
- const currentStep = config.steps[currentStepIndex];
136
+ const activeConfig = storeConfig;
137
+ if (!activeConfig) return;
138
+
139
+ const currentStep = activeConfig.steps[currentStepIndex];
116
140
  const waitTimeout = currentStep?.waitTimeout;
117
141
 
118
142
  // Only set timeout if:
@@ -132,7 +156,7 @@ export function GuidonProvider({
132
156
  }, waitTimeout);
133
157
 
134
158
  return () => clearTimeout(timer);
135
- }, [currentStepIndex, config.steps, waitingState?.isWaiting, next]);
159
+ }, [currentStepIndex, storeConfig, waitingState?.isWaiting, next]);
136
160
 
137
161
  const replay = useCallback(async () => {
138
162
  if (persistenceAdapter) {
@@ -145,9 +169,9 @@ export function GuidonProvider({
145
169
  }, 100);
146
170
  }, [persistenceAdapter, clearProgress, reset, start]);
147
171
 
148
- const manualStart = useCallback(() => {
172
+ const manualStart = useCallback((tourId?: string) => {
149
173
  if (!isActive && !isLoading) {
150
- start();
174
+ start(tourId);
151
175
  }
152
176
  }, [isActive, isLoading, start]);
153
177
 
@@ -161,16 +185,20 @@ export function GuidonProvider({
161
185
  isLoading,
162
186
  };
163
187
 
188
+ // Get theme from prop config or store config
189
+ const activeTheme = config?.theme ?? storeConfig?.theme;
190
+ const activeDuration = config?.animationDuration ?? storeConfig?.animationDuration;
191
+
164
192
  const overlayContent = (
165
193
  <>
166
194
  <GuidonOverlay
167
- theme={config.theme}
168
- animationDuration={config.animationDuration}
195
+ theme={activeTheme}
196
+ animationDuration={activeDuration}
169
197
  onBackdropPress={onBackdropPress}
170
198
  />
171
199
  <GuidonTooltip
172
- theme={config.theme}
173
- animationDuration={config.animationDuration}
200
+ theme={activeTheme}
201
+ animationDuration={activeDuration}
174
202
  renderCustomTooltip={renderTooltip}
175
203
  labels={tooltipLabels}
176
204
  />
package/src/index.ts CHANGED
@@ -26,6 +26,7 @@ export {
26
26
  export type {
27
27
  GuidonStep,
28
28
  GuidonConfig,
29
+ GuidonTours,
29
30
  GuidonTheme,
30
31
  GuidonProgress,
31
32
  GuidonPersistenceAdapter,
package/src/store.ts CHANGED
@@ -1,30 +1,66 @@
1
1
  import { create } from "zustand";
2
2
  import { useShallow } from "zustand/react/shallow";
3
- import type { GuidonConfig, GuidonStore, TargetMeasurements } from "./types";
3
+ import type { GuidonConfig, GuidonStore, GuidonTours, TargetMeasurements } from "./types";
4
4
 
5
5
  const initialState = {
6
- config: null,
6
+ tours: {} as GuidonTours,
7
+ activeTourId: null as string | null,
8
+ config: null as GuidonConfig | null,
7
9
  isActive: false,
8
10
  currentStepIndex: 0,
9
11
  isCompleted: false,
10
- targetMeasurements: {},
12
+ targetMeasurements: {} as Record<string, TargetMeasurements>,
11
13
  isLoading: false,
12
- error: null,
14
+ error: null as string | null,
13
15
  waitingForTarget: false,
14
- waitingTargetId: null,
16
+ waitingTargetId: null as string | null,
15
17
  };
16
18
 
17
19
  export const useGuidonStore = create<GuidonStore>((set, get) => ({
18
20
  ...initialState,
19
21
 
20
22
  configure: (config: GuidonConfig) => {
23
+ const { config: existingConfig } = get();
24
+
25
+ // Skip if same config reference (prevents re-renders from resetting)
26
+ if (existingConfig === config) {
27
+ return;
28
+ }
29
+
21
30
  console.log("[Guidon] configure() called - resetting to step 0");
22
31
  set({ config, currentStepIndex: 0, isCompleted: false });
23
32
  },
24
33
 
25
- start: () => {
26
- const { config } = get();
27
- console.log("[Guidon] start() called - will reset to step 0", {
34
+ configureTours: (tours: GuidonTours) => {
35
+ const { tours: existingTours } = get();
36
+
37
+ // Skip if same tours reference (prevents re-renders from resetting)
38
+ if (existingTours === tours) {
39
+ return;
40
+ }
41
+
42
+ console.log("[Guidon] configureTours() called with tours:", Object.keys(tours));
43
+ set({ tours });
44
+ },
45
+
46
+ start: (tourId?: string) => {
47
+ const { tours, config: legacyConfig } = get();
48
+
49
+ // If tourId provided, use that tour from the tours collection
50
+ let config: GuidonConfig | null = null;
51
+ if (tourId) {
52
+ config = tours[tourId] ?? null;
53
+ if (!config) {
54
+ console.log(`[Guidon] start() - tour "${tourId}" not found`);
55
+ return;
56
+ }
57
+ } else {
58
+ // Fall back to legacy single config
59
+ config = legacyConfig;
60
+ }
61
+
62
+ console.log("[Guidon] start() called", {
63
+ tourId: tourId ?? "legacy",
28
64
  hasConfig: !!config,
29
65
  stepCount: config?.steps.length ?? 0,
30
66
  });
@@ -38,7 +74,13 @@ export const useGuidonStore = create<GuidonStore>((set, get) => ({
38
74
  "[Guidon] starting walkthrough with steps:",
39
75
  config.steps.map((s) => s.id),
40
76
  );
41
- set({ isActive: true, currentStepIndex: 0, isCompleted: false });
77
+ set({
78
+ config,
79
+ activeTourId: tourId ?? null,
80
+ isActive: true,
81
+ currentStepIndex: 0,
82
+ isCompleted: false
83
+ });
42
84
 
43
85
  // Call onStepEnter for the first step
44
86
  const firstStep = config.steps[0];
@@ -48,6 +90,18 @@ export const useGuidonStore = create<GuidonStore>((set, get) => ({
48
90
  }
49
91
  },
50
92
 
93
+ stop: () => {
94
+ const { config, currentStepIndex, isActive } = get();
95
+ if (!isActive) return;
96
+
97
+ console.log("[Guidon] stop() called");
98
+
99
+ const currentStep = config?.steps[currentStepIndex];
100
+ currentStep?.onStepExit?.();
101
+
102
+ set({ isActive: false, activeTourId: null });
103
+ },
104
+
51
105
  next: () => {
52
106
  const { config, currentStepIndex, isActive } = get();
53
107
  console.log("[Guidon] next() called", {
@@ -193,17 +247,39 @@ export const useGuidonStore = create<GuidonStore>((set, get) => ({
193
247
  */
194
248
  export const Guidon = {
195
249
  /**
196
- * Configure the walkthrough with steps and options
250
+ * Configure a single walkthrough (legacy API)
197
251
  */
198
252
  configure: (config: GuidonConfig) => {
199
253
  useGuidonStore.getState().configure(config);
200
254
  },
201
255
 
202
256
  /**
203
- * Start the walkthrough
257
+ * Configure multiple named tours
258
+ * @example
259
+ * Guidon.configureTours({
260
+ * explore: { steps: [...], onComplete: () => {} },
261
+ * profile: { steps: [...] },
262
+ * });
263
+ */
264
+ configureTours: (tours: GuidonTours) => {
265
+ useGuidonStore.getState().configureTours(tours);
266
+ },
267
+
268
+ /**
269
+ * Start a tour by ID, or the legacy single config if no ID provided
270
+ * @example
271
+ * Guidon.start('explore'); // Start the 'explore' tour
272
+ * Guidon.start(); // Start legacy single config
204
273
  */
205
- start: () => {
206
- useGuidonStore.getState().start();
274
+ start: (tourId?: string) => {
275
+ useGuidonStore.getState().start(tourId);
276
+ },
277
+
278
+ /**
279
+ * Stop the current tour without completing it
280
+ */
281
+ stop: () => {
282
+ useGuidonStore.getState().stop();
207
283
  },
208
284
 
209
285
  /**
@@ -262,6 +338,20 @@ export const Guidon = {
262
338
  return useGuidonStore.getState().isCompleted;
263
339
  },
264
340
 
341
+ /**
342
+ * Get the currently active tour ID (null if using legacy single config)
343
+ */
344
+ getActiveTourId: () => {
345
+ return useGuidonStore.getState().activeTourId;
346
+ },
347
+
348
+ /**
349
+ * Get all configured tours
350
+ */
351
+ getTours: () => {
352
+ return useGuidonStore.getState().tours;
353
+ },
354
+
265
355
  /**
266
356
  * Get the current step index
267
357
  */
package/src/types.ts CHANGED
@@ -186,8 +186,8 @@ export interface GuidonTooltipRenderProps {
186
186
  */
187
187
  export interface GuidonProviderProps {
188
188
  children: ReactNode;
189
- /** Configuration for the guidon */
190
- config: GuidonConfig;
189
+ /** Configuration for the guidon (optional when using configureTours) */
190
+ config?: GuidonConfig;
191
191
  /** Whether to auto-start when the component mounts */
192
192
  autoStart?: boolean;
193
193
  /** Condition function to determine if guidon should start */
@@ -215,11 +215,20 @@ export interface GuidonTargetProps {
215
215
  active?: boolean;
216
216
  }
217
217
 
218
+ /**
219
+ * Collection of named tours
220
+ */
221
+ export type GuidonTours = Record<string, GuidonConfig>;
222
+
218
223
  /**
219
224
  * Internal store state
220
225
  */
221
226
  export interface GuidonState {
222
- /** Currently active guidon config */
227
+ /** Collection of all configured tours */
228
+ tours: GuidonTours;
229
+ /** ID of the currently active tour */
230
+ activeTourId: string | null;
231
+ /** Currently active guidon config (derived from tours + activeTourId, or legacy single config) */
223
232
  config: GuidonConfig | null;
224
233
  /** Whether the guidon is currently active */
225
234
  isActive: boolean;
@@ -243,10 +252,14 @@ export interface GuidonState {
243
252
  * Internal store actions
244
253
  */
245
254
  export interface GuidonActions {
246
- /** Configure the guidon */
255
+ /** Configure a single guidon (legacy API, still supported) */
247
256
  configure: (config: GuidonConfig) => void;
248
- /** Start the guidon */
249
- start: () => void;
257
+ /** Configure multiple named tours */
258
+ configureTours: (tours: GuidonTours) => void;
259
+ /** Start a tour by ID, or the legacy single config if no ID provided */
260
+ start: (tourId?: string) => void;
261
+ /** Stop the current tour without completing it */
262
+ stop: () => void;
250
263
  /** Go to the next step */
251
264
  next: () => void;
252
265
  /** Go to the previous step */