@carlonicora/nextjs-jsonapi 6.13.0 → 6.13.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.
- package/dist/{BlockNoteEditor-2VLPSEKS.js → BlockNoteEditor-UBVEUFNR.js} +9 -9
- package/dist/{BlockNoteEditor-2VLPSEKS.js.map → BlockNoteEditor-UBVEUFNR.js.map} +1 -1
- package/dist/{BlockNoteEditor-22Q4DJBU.mjs → BlockNoteEditor-VXMDSQAA.mjs} +2 -2
- package/dist/billing/index.js +378 -378
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-H4NLDX5G.mjs → chunk-N4RZZKL5.mjs} +9 -3
- package/dist/chunk-N4RZZKL5.mjs.map +1 -0
- package/dist/{chunk-2H342HNN.js → chunk-PYRZCKC2.js} +267 -261
- package/dist/chunk-PYRZCKC2.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/email-automations/index.js +58 -58
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +96 -96
- package/dist/features/analytics/index.mjs +1 -1
- package/dist/features/blog/index.js +93 -93
- package/dist/features/blog/index.mjs +1 -1
- package/dist/features/help/index.js +31 -31
- package/dist/features/help/index.mjs +1 -1
- package/dist/features/tokenusage/index.js +102 -102
- package/dist/features/tokenusage/index.mjs +1 -1
- package/package.json +1 -1
- package/src/features/onboarding/contexts/OnboardingContext.spec.tsx +42 -1
- package/src/features/onboarding/contexts/OnboardingContext.tsx +11 -1
- package/dist/chunk-2H342HNN.js.map +0 -1
- package/dist/chunk-H4NLDX5G.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-22Q4DJBU.mjs.map → BlockNoteEditor-VXMDSQAA.mjs.map} +0 -0
|
@@ -20,6 +20,7 @@ const driverMock = vi.hoisted(() => {
|
|
|
20
20
|
movePrevious: vi.fn(),
|
|
21
21
|
moveTo: vi.fn(),
|
|
22
22
|
destroy: vi.fn(),
|
|
23
|
+
isActive: vi.fn(() => true),
|
|
23
24
|
};
|
|
24
25
|
const state: { config?: Hooks } = {};
|
|
25
26
|
const driver = vi.fn((config: Hooks) => {
|
|
@@ -53,7 +54,8 @@ describe("OnboardingProvider on driver.js", () => {
|
|
|
53
54
|
driverMock.driver.mockClear();
|
|
54
55
|
driverMock.instance.drive.mockClear();
|
|
55
56
|
driverMock.instance.destroy.mockClear();
|
|
56
|
-
driverMock.instance.moveNext.
|
|
57
|
+
driverMock.instance.moveNext.mockReset();
|
|
58
|
+
driverMock.instance.isActive.mockImplementation(() => true);
|
|
57
59
|
driverMock.state.config = undefined;
|
|
58
60
|
});
|
|
59
61
|
|
|
@@ -167,6 +169,45 @@ describe("OnboardingProvider on driver.js", () => {
|
|
|
167
169
|
expect(onTourEnd).toHaveBeenCalledTimes(1);
|
|
168
170
|
});
|
|
169
171
|
|
|
172
|
+
it("ends the tour when Next finds every remaining step's target missing", () => {
|
|
173
|
+
/* driver.js skips missing targets and, when none is left, destroys itself without
|
|
174
|
+
calling onDestroyed: without this the tour stayed "active" with no card on screen. */
|
|
175
|
+
const { wrapper, onTourEnd } = wrap();
|
|
176
|
+
const { result } = renderHook(() => useOnboarding(), { wrapper });
|
|
177
|
+
act(() => result.current.startTour("t", steps));
|
|
178
|
+
const config = driverMock.state.config!;
|
|
179
|
+
const popoverWrapper = document.createElement("div");
|
|
180
|
+
act(() => {
|
|
181
|
+
config.steps[0].onHighlightStarted?.();
|
|
182
|
+
config.steps[0].popover.onPopoverRender({ wrapper: popoverWrapper });
|
|
183
|
+
});
|
|
184
|
+
driverMock.instance.moveNext.mockImplementation(() => driverMock.instance.isActive.mockImplementation(() => false));
|
|
185
|
+
|
|
186
|
+
const next = Array.from(popoverWrapper.querySelectorAll("button")).find((b) => b.textContent === "Next")!;
|
|
187
|
+
act(() => next.click());
|
|
188
|
+
|
|
189
|
+
expect(driverMock.instance.moveNext).toHaveBeenCalled();
|
|
190
|
+
expect(result.current.isTourActive).toBe(false);
|
|
191
|
+
expect(result.current.activeTourId).toBeNull();
|
|
192
|
+
expect(onTourEnd).toHaveBeenCalledWith("t", "dismissed");
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("keeps the tour when Next moves to a step that is shown", () => {
|
|
196
|
+
const { wrapper, onTourEnd } = wrap();
|
|
197
|
+
const { result } = renderHook(() => useOnboarding(), { wrapper });
|
|
198
|
+
act(() => result.current.startTour("t", steps));
|
|
199
|
+
const config = driverMock.state.config!;
|
|
200
|
+
const popoverWrapper = document.createElement("div");
|
|
201
|
+
act(() => {
|
|
202
|
+
config.steps[0].onHighlightStarted?.();
|
|
203
|
+
config.steps[0].popover.onPopoverRender({ wrapper: popoverWrapper });
|
|
204
|
+
});
|
|
205
|
+
const next = Array.from(popoverWrapper.querySelectorAll("button")).find((b) => b.textContent === "Next")!;
|
|
206
|
+
act(() => next.click());
|
|
207
|
+
expect(result.current.isTourActive).toBe(true);
|
|
208
|
+
expect(onTourEnd).not.toHaveBeenCalled();
|
|
209
|
+
});
|
|
210
|
+
|
|
170
211
|
it("reports 'dismissed' when driver is destroyed without a card action", () => {
|
|
171
212
|
const { wrapper, onTourEnd } = wrap();
|
|
172
213
|
const { result } = renderHook(() => useOnboarding(), { wrapper });
|
|
@@ -147,7 +147,17 @@ export function OnboardingProvider({
|
|
|
147
147
|
|
|
148
148
|
const move = (direction: "next" | "previous", from: number) => {
|
|
149
149
|
const target = tourSteps[direction === "next" ? from + 1 : from - 1];
|
|
150
|
-
const go = () =>
|
|
150
|
+
const go = () => {
|
|
151
|
+
const instance = driverRef.current;
|
|
152
|
+
if (!instance) return;
|
|
153
|
+
if (direction === "next") instance.moveNext();
|
|
154
|
+
else instance.movePrevious();
|
|
155
|
+
/* driver.js skips steps whose target is missing (skipMissingElement); when every
|
|
156
|
+
step left is missing it destroys itself without calling onDestroyed (it only
|
|
157
|
+
does once its 400ms transition has run). The tour is then over: tear it down, as
|
|
158
|
+
"dismissed" because the user saw none of the remaining steps. */
|
|
159
|
+
if (driverRef.current === instance && !instance.isActive()) teardown("dismissed");
|
|
160
|
+
};
|
|
151
161
|
if (target?.showDelay) setTimeout(go, target.showDelay);
|
|
152
162
|
else go();
|
|
153
163
|
};
|