@multiplatform.one/core 7.46.0 → 7.47.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/core",
3
- "version": "7.46.0",
3
+ "version": "7.47.0",
4
4
  "description": "Core framework shell, provider composition, and layout factories for multiplatform.one",
5
5
  "keywords": [
6
6
  "app",
@@ -41,11 +41,11 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@multiplatform.one/i18n": "^7.46.0",
45
- "@multiplatform.one/logger": "^7.46.0",
46
- "@multiplatform.one/platform": "^7.46.0",
47
- "@multiplatform.one/store": "^7.46.0",
48
- "@multiplatform.one/theme": "^7.46.0",
44
+ "@multiplatform.one/i18n": "^7.47.0",
45
+ "@multiplatform.one/logger": "^7.47.0",
46
+ "@multiplatform.one/platform": "^7.47.0",
47
+ "@multiplatform.one/store": "^7.47.0",
48
+ "@multiplatform.one/theme": "^7.47.0",
49
49
  "@tanstack/devtools-utils": "^0.4.0",
50
50
  "@tanstack/pacer-devtools": "1.6.0",
51
51
  "@tanstack/react-devtools": "0.10.13",
@@ -53,8 +53,8 @@
53
53
  "react-cookie": "^8.1.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@multiplatform.one/frappe": "7.46.0",
57
- "@multiplatform.one/web3": "7.46.0",
56
+ "@multiplatform.one/frappe": "7.47.0",
57
+ "@multiplatform.one/web3": "7.47.0",
58
58
  "@sentry/react": "^10.51.0",
59
59
  "@tanstack/react-query": "^5.104.3",
60
60
  "@tanstack/react-query-devtools": "^5.104.3",
@@ -72,10 +72,10 @@
72
72
  "vitest": "^4.1.5"
73
73
  },
74
74
  "peerDependencies": {
75
- "@multiplatform.one/frappe": "^7.46.0",
76
- "@multiplatform.one/frappe-ui": "^7.46.0",
77
- "@multiplatform.one/keycloak": "^7.46.0",
78
- "@multiplatform.one/web3": "^7.46.0",
75
+ "@multiplatform.one/frappe": "^7.47.0",
76
+ "@multiplatform.one/frappe-ui": "^7.47.0",
77
+ "@multiplatform.one/keycloak": "^7.47.0",
78
+ "@multiplatform.one/web3": "^7.47.0",
79
79
  "@sentry/react": "^9.0.0 || ^10.0.0",
80
80
  "@tanstack/react-query": "^5.0.0",
81
81
  "@tanstack/react-query-devtools": "^5.0.0",
@@ -3,7 +3,15 @@ import type { PropsWithChildren } from "react";
3
3
  import type { ProviderComponent, TanstackConfig } from "./CreateApp";
4
4
 
5
5
  export function createTanstackProvider(tanstackConfig: TanstackConfig): ProviderComponent {
6
- const queryClient = new QueryClient(tanstackConfig.queryClientOptions);
6
+ const queryClient = new QueryClient({
7
+ defaultOptions: {
8
+ queries: {
9
+ staleTime: 30 * 1000,
10
+ retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 10_000),
11
+ },
12
+ },
13
+ ...tanstackConfig.queryClientOptions,
14
+ });
7
15
 
8
16
  function TanstackProvider({ children }: PropsWithChildren) {
9
17
  return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
@@ -0,0 +1,59 @@
1
+ // @vitest-environment jsdom
2
+ // React Native makes `window` the global object but gives it no
3
+ // addEventListener, removeEventListener or dispatchEvent, so the old
4
+ // `typeof window === "undefined"` guards let every devtools trigger through
5
+ // and each threw "undefined is not a function" (FZ-7799).
6
+ import { act } from "react";
7
+ import { createRoot } from "react-dom/client";
8
+ import { afterEach, beforeEach, describe, expect, it } from "vitest";
9
+ import {
10
+ armDevtoolsMotion,
11
+ useDevtoolsKeyboardTrigger,
12
+ useDevtoolsOpenRequests,
13
+ useShakeToOpen,
14
+ } from "./devtoolsTrigger";
15
+
16
+ (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
17
+
18
+ const methods = ["addEventListener", "removeEventListener", "dispatchEvent"] as const;
19
+ const saved = new Map<string, PropertyDescriptor | undefined>();
20
+
21
+ function stripWindowEvents() {
22
+ for (const name of methods) {
23
+ saved.set(name, Object.getOwnPropertyDescriptor(window, name));
24
+ Object.defineProperty(window, name, { configurable: true, writable: true, value: undefined });
25
+ }
26
+ }
27
+
28
+ function restoreWindowEvents() {
29
+ for (const name of methods) {
30
+ const original = saved.get(name);
31
+ if (original) Object.defineProperty(window, name, original);
32
+ else delete (window as unknown as Record<string, unknown>)[name];
33
+ }
34
+ saved.clear();
35
+ }
36
+
37
+ function Triggers() {
38
+ useDevtoolsKeyboardTrigger(true);
39
+ useShakeToOpen(true, () => {});
40
+ useDevtoolsOpenRequests();
41
+ return null;
42
+ }
43
+
44
+ describe("devtools triggers on React Native (window without event methods)", () => {
45
+ beforeEach(stripWindowEvents);
46
+ afterEach(restoreWindowEvents);
47
+
48
+ it("mounts and unmounts the keyboard, shake and open-request hooks without throwing", () => {
49
+ expect(typeof window.addEventListener).toBe("undefined");
50
+ const host = document.createElement("div");
51
+ const root = createRoot(host);
52
+ expect(() => act(() => root.render(<Triggers />))).not.toThrow();
53
+ expect(() => act(() => root.unmount())).not.toThrow();
54
+ });
55
+
56
+ it("arming shake-to-open is a no-op instead of a throw", () => {
57
+ expect(() => armDevtoolsMotion()).not.toThrow();
58
+ });
59
+ });
@@ -44,7 +44,8 @@ export function isDevtoolsOpenHotkeyEvent(event: KeyboardEvent): boolean {
44
44
  */
45
45
  export function useDevtoolsKeyboardTrigger(enabled: boolean) {
46
46
  useEffect(() => {
47
- if (!enabled || typeof window === "undefined") return;
47
+ if (!enabled || typeof window === "undefined" || typeof window.addEventListener !== "function")
48
+ return;
48
49
  const onKeyDown = (event: KeyboardEvent) => {
49
50
  if (!isDevtoolsOpenHotkeyEvent(event)) return;
50
51
  event.preventDefault();
@@ -120,7 +121,8 @@ export function openDevtoolsShell(storage: ShellStorage | undefined = shellStora
120
121
  } catch {
121
122
  return;
122
123
  }
123
- if (typeof window !== "undefined") window.dispatchEvent(new Event(devtoolsOpenRequestEvent));
124
+ if (typeof window !== "undefined" && typeof window.dispatchEvent === "function")
125
+ window.dispatchEvent(new Event(devtoolsOpenRequestEvent));
124
126
  }
125
127
 
126
128
  /**
@@ -131,7 +133,7 @@ export function openDevtoolsShell(storage: ShellStorage | undefined = shellStora
131
133
  export function useDevtoolsOpenRequests(): number {
132
134
  const [requests, setRequests] = useState(0);
133
135
  useEffect(() => {
134
- if (typeof window === "undefined") return;
136
+ if (typeof window === "undefined" || typeof window.addEventListener !== "function") return;
135
137
  const onRequest = () => setRequests((n) => n + 1);
136
138
  window.addEventListener(devtoolsOpenRequestEvent, onRequest);
137
139
  return () => window.removeEventListener(devtoolsOpenRequestEvent, onRequest);
@@ -401,7 +403,7 @@ export async function requestMotionPermissionFromGesture(): Promise<MotionPermis
401
403
  // Non-iOS: the flow granted (and attached) synchronously in its
402
404
  // constructor — nothing to await.
403
405
  if (flow.state !== "granted") await flow.handleGesture();
404
- if (typeof window !== "undefined") {
406
+ if (typeof window !== "undefined" && typeof window.dispatchEvent === "function") {
405
407
  window.dispatchEvent(
406
408
  new CustomEvent(devtoolsMotionArmedEvent, {
407
409
  detail: { granted: flow.state === "granted" },
@@ -418,7 +420,7 @@ export async function requestMotionPermissionFromGesture(): Promise<MotionPermis
418
420
  * iOS. No-op on the server.
419
421
  */
420
422
  export function armDevtoolsMotion(): void {
421
- if (typeof window === "undefined") return;
423
+ if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
422
424
  window.dispatchEvent(new Event(devtoolsArmMotionEvent));
423
425
  }
424
426
 
@@ -441,7 +443,8 @@ export function armDevtoolsMotion(): void {
441
443
  */
442
444
  export function useShakeToOpen(enabled: boolean, onShake: () => void = openDevtoolsShell) {
443
445
  useEffect(() => {
444
- if (!enabled || typeof window === "undefined") return;
446
+ if (!enabled || typeof window === "undefined" || typeof window.addEventListener !== "function")
447
+ return;
445
448
 
446
449
  const detector = createShakeDetector({ onShake });
447
450
  const motionListener = (event: Event) =>
@@ -1,3 +1,3 @@
1
1
  import type { ProviderComponent, TanstackConfig } from "./CreateApp";
2
2
  export declare function createTanstackProvider(tanstackConfig: TanstackConfig): ProviderComponent;
3
- //# sourceMappingURL=tanstackProvider.native.d.ts.map
3
+ //# sourceMappingURL=TanstackProvider.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TanstackProvider.native.d.ts","sourceRoot":"","sources":["../../src/app/TanstackProvider.native.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAErE,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,cAAc,GAAG,iBAAiB,CAgBxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"devtoolsTrigger.d.ts","sourceRoot":"","sources":["../../src/app/devtoolsTrigger.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,uCAAwC,CAAC;AAExE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAMvE;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,QAY1D;AAMD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAE5D,UAAU,YAAY;IACpB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3C;AAmBD,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,YAAY,GAAG,SAA0B,GAAG,OAAO,CAE/F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,YAAY,GAAG,SAA0B,GAAG,IAAI,CAW1F;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAShD;AAQD,gFAAgF;AAChF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