@hexclave/next 1.0.75 → 1.0.76

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 (114) hide show
  1. package/dist/{admin-app-impl-sTQD2d-3.d.ts → admin-app-impl-CsH-gVGz.d.ts} +7 -7
  2. package/dist/{admin-app-impl-sTQD2d-3.d.ts.map → admin-app-impl-CsH-gVGz.d.ts.map} +1 -1
  3. package/dist/components/api-key-dialogs.d.ts +1 -1
  4. package/dist/components/elements/sidebar-layout.js +1 -1
  5. package/dist/dev-tool/dev-tool-core.d.ts.map +1 -1
  6. package/dist/dev-tool/dev-tool-core.js +2 -2
  7. package/dist/dev-tool/dev-tool-core.js.map +1 -1
  8. package/dist/dev-tool/index.d.ts.map +1 -1
  9. package/dist/dev-tool/index.js +2 -8
  10. package/dist/dev-tool/index.js.map +1 -1
  11. package/dist/esm/components/api-key-dialogs.d.ts +1 -1
  12. package/dist/esm/components/elements/sidebar-layout.js +1 -1
  13. package/dist/esm/dev-tool/dev-tool-core.d.ts.map +1 -1
  14. package/dist/esm/dev-tool/dev-tool-core.js +1 -1
  15. package/dist/esm/dev-tool/dev-tool-core.js.map +1 -1
  16. package/dist/esm/dev-tool/index.d.ts.map +1 -1
  17. package/dist/esm/dev-tool/index.js +2 -8
  18. package/dist/esm/dev-tool/index.js.map +1 -1
  19. package/dist/esm/generated/quetzal-translations.d.ts +2 -2
  20. package/dist/esm/in-page-ui/dev-environment.d.ts +5 -0
  21. package/dist/esm/in-page-ui/dev-environment.d.ts.map +1 -0
  22. package/dist/esm/in-page-ui/dev-environment.js +18 -0
  23. package/dist/esm/in-page-ui/dev-environment.js.map +1 -0
  24. package/dist/esm/in-page-ui/issue-card.d.ts +52 -0
  25. package/dist/esm/in-page-ui/issue-card.d.ts.map +1 -0
  26. package/dist/esm/in-page-ui/issue-card.js +392 -0
  27. package/dist/esm/in-page-ui/issue-card.js.map +1 -0
  28. package/dist/esm/in-page-ui/issue-card.test.d.ts +1 -0
  29. package/dist/esm/in-page-ui/issue-card.test.js +60 -0
  30. package/dist/esm/in-page-ui/issue-card.test.js.map +1 -0
  31. package/dist/esm/in-page-ui/logo.d.ts +5 -0
  32. package/dist/esm/in-page-ui/logo.d.ts.map +1 -0
  33. package/dist/esm/in-page-ui/logo.js +6 -0
  34. package/dist/esm/in-page-ui/logo.js.map +1 -0
  35. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +4 -4
  36. package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
  37. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +140 -15
  38. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  39. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +2 -2
  40. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
  41. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js +95 -12
  42. package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  43. package/dist/esm/lib/hexclave-app/apps/implementations/common.js +2 -2
  44. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js +1 -0
  45. package/dist/esm/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js.map +1 -1
  46. package/dist/esm/pushed-config-error-overlay/index.d.ts.map +1 -1
  47. package/dist/esm/pushed-config-error-overlay/index.js +42 -343
  48. package/dist/esm/pushed-config-error-overlay/index.js.map +1 -1
  49. package/dist/esm/setup-error-overlay/index.d.ts +16 -0
  50. package/dist/esm/setup-error-overlay/index.d.ts.map +1 -0
  51. package/dist/esm/setup-error-overlay/index.js +106 -0
  52. package/dist/esm/setup-error-overlay/index.js.map +1 -0
  53. package/dist/esm/setup-error-overlay/index.test.d.ts +1 -0
  54. package/dist/esm/setup-error-overlay/index.test.js +125 -0
  55. package/dist/esm/setup-error-overlay/index.test.js.map +1 -0
  56. package/dist/generated/quetzal-translations.d.ts +1 -1
  57. package/dist/{hexclave-provider-BKxi3Vy-.d.ts → hexclave-provider-BA97jMlx.d.ts} +2 -2
  58. package/dist/{hexclave-provider-BKxi3Vy-.d.ts.map → hexclave-provider-BA97jMlx.d.ts.map} +1 -1
  59. package/dist/in-page-ui/dev-environment.d.ts +5 -0
  60. package/dist/in-page-ui/dev-environment.d.ts.map +1 -0
  61. package/dist/in-page-ui/dev-environment.js +19 -0
  62. package/dist/in-page-ui/dev-environment.js.map +1 -0
  63. package/dist/in-page-ui/issue-card.d.ts +52 -0
  64. package/dist/in-page-ui/issue-card.d.ts.map +1 -0
  65. package/dist/in-page-ui/issue-card.js +397 -0
  66. package/dist/in-page-ui/issue-card.js.map +1 -0
  67. package/dist/in-page-ui/issue-card.test.d.ts +1 -0
  68. package/dist/in-page-ui/issue-card.test.js +59 -0
  69. package/dist/in-page-ui/issue-card.test.js.map +1 -0
  70. package/dist/in-page-ui/logo.d.ts +5 -0
  71. package/dist/in-page-ui/logo.d.ts.map +1 -0
  72. package/dist/in-page-ui/logo.js +7 -0
  73. package/dist/in-page-ui/logo.js.map +1 -0
  74. package/dist/index.d.ts +1 -1
  75. package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +1 -1
  76. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js +140 -15
  77. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.js.map +1 -1
  78. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -1
  79. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js +94 -11
  80. package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
  81. package/dist/lib/hexclave-app/apps/implementations/common.js +2 -2
  82. package/dist/lib/hexclave-app/apps/implementations/index.d.ts +1 -1
  83. package/dist/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js +1 -0
  84. package/dist/lib/hexclave-app/apps/implementations/redirect-page-urls.test.js.map +1 -1
  85. package/dist/lib/hexclave-app/apps/implementations/server-app-impl.d.ts +1 -1
  86. package/dist/providers/hexclave-provider.d.ts +1 -1
  87. package/dist/providers/translation-provider.d.ts +1 -1
  88. package/dist/pushed-config-error-overlay/index.d.ts.map +1 -1
  89. package/dist/pushed-config-error-overlay/index.js +41 -342
  90. package/dist/pushed-config-error-overlay/index.js.map +1 -1
  91. package/dist/{quetzal-translations-XeH3zQ9l.d.ts → quetzal-translations-CK45_4Dm.d.ts} +3 -3
  92. package/dist/{quetzal-translations-XeH3zQ9l.d.ts.map → quetzal-translations-CK45_4Dm.d.ts.map} +1 -1
  93. package/dist/setup-error-overlay/index.d.ts +16 -0
  94. package/dist/setup-error-overlay/index.d.ts.map +1 -0
  95. package/dist/setup-error-overlay/index.js +108 -0
  96. package/dist/setup-error-overlay/index.js.map +1 -0
  97. package/dist/setup-error-overlay/index.test.d.ts +1 -0
  98. package/dist/setup-error-overlay/index.test.js +124 -0
  99. package/dist/setup-error-overlay/index.test.js.map +1 -0
  100. package/dist/{translation-provider-WOaZXqAz.d.ts → translation-provider-DQ3BJepJ.d.ts} +2 -2
  101. package/dist/{translation-provider-WOaZXqAz.d.ts.map → translation-provider-DQ3BJepJ.d.ts.map} +1 -1
  102. package/package.json +4 -4
  103. package/src/dev-tool/dev-tool-core.ts +1 -4
  104. package/src/dev-tool/index.ts +4 -15
  105. package/src/in-page-ui/dev-environment.ts +33 -0
  106. package/src/in-page-ui/issue-card.test.ts +67 -0
  107. package/src/in-page-ui/issue-card.ts +500 -0
  108. package/src/in-page-ui/logo.ts +8 -0
  109. package/src/lib/hexclave-app/apps/implementations/client-app-impl.cross-domain.test.ts +158 -0
  110. package/src/lib/hexclave-app/apps/implementations/client-app-impl.ts +125 -17
  111. package/src/lib/hexclave-app/apps/implementations/redirect-page-urls.test.ts +1 -0
  112. package/src/pushed-config-error-overlay/index.ts +45 -386
  113. package/src/setup-error-overlay/index.test.ts +133 -0
  114. package/src/setup-error-overlay/index.ts +150 -0
@@ -1 +1 @@
1
- {"version":3,"file":"quetzal-translations-XeH3zQ9l.d.ts","names":[],"sources":["../src/generated/quetzal-translations.ts"],"mappings":";cAUa,WAAA,EAAW,GAAA;AAAA,cAqTX,cAAA,EAAc,GAAA,mIAAA,GAAA,66qBAAA,GAAA,usnBAAA,GAAA,iyrBAAA,GAAA,g+qBAAA,GAAA,8srBAAA,GAAA,2trBAAA,GAAA,41pBAAA,GAAA,m3eAAA,GAAA,oreAAA,GAAA,swpBAAA,GAAA,+0qBAAA,GAAA,8wbAAA,GAAA"}
1
+ {"version":3,"file":"quetzal-translations-CK45_4Dm.d.ts","names":[],"sources":["../src/generated/quetzal-translations.ts"],"mappings":";cAUa,WAAA,EAAW,GAAA;AAAA,cAqTX,cAAA,EAAc,GAAA,mIAAA,GAAA,66qBAAA,GAAA,usnBAAA,GAAA,iyrBAAA,GAAA,g+qBAAA,GAAA,8srBAAA,GAAA,2trBAAA,GAAA,41pBAAA,GAAA,m3eAAA,GAAA,oreAAA,GAAA,swpBAAA,GAAA,+0qBAAA,GAAA,8wbAAA,GAAA"}
@@ -0,0 +1,16 @@
1
+ //#region src/setup-error-overlay/index.d.ts
2
+ /** Exported so tests can drop the singleton; every other consumer should go through `showSetupErrorOverlay`. */
3
+ declare const SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY = "__hexclave-setup-error-overlay";
4
+ /**
5
+ * Shows `error` as an error card on the current page.
6
+ *
7
+ * Setup errors are always shown, because the flow they aborted cannot complete no matter what the end user does, and
8
+ * their messages are written for exactly this purpose. Any other error is only shown while developing — those messages
9
+ * are internal diagnostics, so in production they stay in captureError's hands.
10
+ *
11
+ * Returns a cleanup function that removes the card again.
12
+ */
13
+ declare function showSetupErrorOverlay(error: unknown): () => void;
14
+ //#endregion
15
+ export { SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, showSetupErrorOverlay };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/setup-error-overlay/index.ts"],"mappings":";;cAiBa,uCAAA;;;;AAAuC;AA8DpD;;;;AAAoD;iBAApC,qBAAA,CAAsB,KAAc"}
@@ -0,0 +1,108 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let ___in_page_ui_dom_js = require("../in-page-ui/dom.js");
3
+ let _hexclave_shared_dist_utils_errors = require("@hexclave/shared/dist/utils/errors");
4
+ let ___in_page_ui_dev_environment_js = require("../in-page-ui/dev-environment.js");
5
+ let ___in_page_ui_issue_card_js = require("../in-page-ui/issue-card.js");
6
+ //#region src/setup-error-overlay/index.ts
7
+ /** Exported so tests can drop the singleton; every other consumer should go through `showSetupErrorOverlay`. */
8
+ const SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY = "__hexclave-setup-error-overlay";
9
+ const css = (0, ___in_page_ui_issue_card_js.getIssueCardCSS)(".hexclave-setup-error-overlay");
10
+ const unexpectedErrorHowToFix = [
11
+ "Check the browser console and your Hexclave dashboard's logs for the full error.",
12
+ "Make sure your Hexclave SDK packages are up to date.",
13
+ "If the error looks like a bug in Hexclave, report it at https://github.com/hexclave/hexclave/issues."
14
+ ];
15
+ function toSetupIssue(error) {
16
+ if (_hexclave_shared_dist_utils_errors.HexclaveSetupError.isSetupError(error)) return {
17
+ title: error.title,
18
+ message: error.message,
19
+ howToFix: error.howToFix,
20
+ isFatal: true
21
+ };
22
+ return {
23
+ title: "Hexclave could not finish an authentication flow",
24
+ message: (0, _hexclave_shared_dist_utils_errors.errorToNiceString)(error),
25
+ howToFix: unexpectedErrorHowToFix,
26
+ isFatal: false
27
+ };
28
+ }
29
+ function buildAiPrompt(issue) {
30
+ return [
31
+ "Help me fix this Hexclave setup error.",
32
+ "",
33
+ "Hexclave reminder:",
34
+ "This error was thrown by the Hexclave SDK in the browser while it was resolving an authentication flow, and the flow was aborted because of it. It is a problem with how my project is set up, not something my users can work around. Use your web fetch tool to read https://skill.hexclave.com to learn more about Hexclave.",
35
+ "",
36
+ "Error message:",
37
+ issue.message,
38
+ "",
39
+ "Hexclave suggests:",
40
+ ...issue.howToFix.map((step) => `- ${step}`),
41
+ "",
42
+ "Please explain the likely cause and suggest the smallest safe fix."
43
+ ].join("\n");
44
+ }
45
+ /**
46
+ * Shows `error` as an error card on the current page.
47
+ *
48
+ * Setup errors are always shown, because the flow they aborted cannot complete no matter what the end user does, and
49
+ * their messages are written for exactly this purpose. Any other error is only shown while developing — those messages
50
+ * are internal diagnostics, so in production they stay in captureError's hands.
51
+ *
52
+ * Returns a cleanup function that removes the card again.
53
+ */
54
+ function showSetupErrorOverlay(error) {
55
+ if (!(0, ___in_page_ui_dom_js.canMountIntoDom)()) return () => {};
56
+ if (!_hexclave_shared_dist_utils_errors.HexclaveSetupError.isSetupError(error) && !(0, ___in_page_ui_dev_environment_js.isLikelyDevelopmentEnvironment)()) return () => {};
57
+ const issue = toSetupIssue(error);
58
+ if ((0, ___in_page_ui_dom_js.getGlobalUiInstance)("__hexclave-setup-error-overlay") != null) return () => {};
59
+ const root = (0, ___in_page_ui_dom_js.h)("div", { className: "hexclave-setup-error-overlay" });
60
+ const style = (0, ___in_page_ui_dom_js.h)("style", null, css);
61
+ root.appendChild(style);
62
+ document.body.appendChild(root);
63
+ let focusTrap = null;
64
+ const render = (minimized) => {
65
+ focusTrap?.release();
66
+ focusTrap = null;
67
+ root.replaceChildren(style);
68
+ if (minimized) {
69
+ root.appendChild((0, ___in_page_ui_issue_card_js.renderIssuePill)({
70
+ kind: "error",
71
+ label: "Setup error",
72
+ ariaLabel: "Show Hexclave setup error",
73
+ onClick: () => render(false)
74
+ }));
75
+ return;
76
+ }
77
+ root.appendChild((0, ___in_page_ui_issue_card_js.renderIssueCard)({
78
+ kind: "error",
79
+ badge: "Setup error",
80
+ title: issue.title,
81
+ bodyText: issue.isFatal ? "Hexclave stopped the authentication flow that ran into this error, so nobody can sign in through it until it is fixed." : "Hexclave aborted the authentication flow that ran into this error. Errors like this one may also be transient, in which case retrying the flow works.",
82
+ messageLabel: "Error message",
83
+ message: issue.message,
84
+ howToFix: issue.howToFix,
85
+ footerText: issue.isFatal ? "This card is shown by the Hexclave SDK. Fix the problem above and reload the page to try the flow again." : "This card is shown by the Hexclave SDK while developing, and never in production.",
86
+ ariaLabel: "Hexclave setup error",
87
+ aiPrompt: buildAiPrompt(issue),
88
+ onCopyError: (copyError) => (0, _hexclave_shared_dist_utils_errors.captureError)("setup-error-overlay-copy", copyError),
89
+ onCopyAiPromptError: (copyError) => (0, _hexclave_shared_dist_utils_errors.captureError)("setup-error-overlay-copy-ai-prompt", copyError),
90
+ onMinimize: () => render(true)
91
+ }));
92
+ focusTrap = (0, ___in_page_ui_issue_card_js.trapFocusInIssueCard)(root);
93
+ };
94
+ render(false);
95
+ const cleanup = () => {
96
+ focusTrap?.release();
97
+ focusTrap = null;
98
+ root.remove();
99
+ if ((0, ___in_page_ui_dom_js.getGlobalUiInstance)("__hexclave-setup-error-overlay")?.cleanup === cleanup) (0, ___in_page_ui_dom_js.setGlobalUiInstance)(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, null);
100
+ };
101
+ (0, ___in_page_ui_dom_js.setGlobalUiInstance)(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, { cleanup });
102
+ return cleanup;
103
+ }
104
+ //#endregion
105
+ exports.SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY = SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY;
106
+ exports.showSetupErrorOverlay = showSetupErrorOverlay;
107
+
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["HexclaveSetupError"],"sources":["../../src/setup-error-overlay/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n\n// Renders an error card on the page when an auth flow dies because of a setup problem in the developer's project (a\n// domain missing from the trusted domains, for example). Those failures used to be logged with captureError only, which\n// meant the flow just quietly stopped: the developer saw a page that never signed anybody in, with the explanation\n// buried in the console or in Sentry. Setup errors are always the developer's to fix and never recoverable at runtime,\n// so they get the same treatment as a broken pushed config: a card that is impossible to miss.\n\nimport { HexclaveSetupError, captureError, errorToNiceString } from \"@hexclave/shared/dist/utils/errors\";\nimport { isLikelyDevelopmentEnvironment } from \"../in-page-ui/dev-environment\";\nimport { canMountIntoDom, getGlobalUiInstance, h, setGlobalUiInstance } from \"../in-page-ui/dom\";\nimport { getIssueCardCSS, renderIssueCard, renderIssuePill, trapFocusInIssueCard, type IssueCardFocusTrap } from \"../in-page-ui/issue-card\";\n\n/** Exported so tests can drop the singleton; every other consumer should go through `showSetupErrorOverlay`. */\nexport const SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY = \"__hexclave-setup-error-overlay\";\n\nconst css = getIssueCardCSS(\".hexclave-setup-error-overlay\");\n\nconst unexpectedErrorHowToFix = [\n \"Check the browser console and your Hexclave dashboard's logs for the full error.\",\n \"Make sure your Hexclave SDK packages are up to date.\",\n \"If the error looks like a bug in Hexclave, report it at https://github.com/hexclave/hexclave/issues.\",\n] as const;\n\ntype SetupIssue = {\n title: string,\n message: string,\n howToFix: readonly string[],\n // Setup errors are known to be fatal for their flow, so the card says so. Anything else may well be transient (a\n // network blip while resolving a session, say), and claiming that nobody can sign in anymore would be misleading.\n isFatal: boolean,\n};\n\nfunction toSetupIssue(error: unknown): SetupIssue {\n if (HexclaveSetupError.isSetupError(error)) {\n return {\n title: error.title,\n message: error.message,\n howToFix: error.howToFix,\n isFatal: true,\n };\n }\n return {\n title: \"Hexclave could not finish an authentication flow\",\n message: errorToNiceString(error),\n howToFix: unexpectedErrorHowToFix,\n isFatal: false,\n };\n}\n\nfunction buildAiPrompt(issue: SetupIssue): string {\n return [\n \"Help me fix this Hexclave setup error.\",\n \"\",\n \"Hexclave reminder:\",\n \"This error was thrown by the Hexclave SDK in the browser while it was resolving an authentication flow, and the flow was aborted because of it. It is a problem with how my project is set up, not something my users can work around. Use your web fetch tool to read https://skill.hexclave.com to learn more about Hexclave.\",\n \"\",\n \"Error message:\",\n issue.message,\n \"\",\n \"Hexclave suggests:\",\n ...issue.howToFix.map((step) => `- ${step}`),\n \"\",\n \"Please explain the likely cause and suggest the smallest safe fix.\",\n ].join(\"\\n\");\n}\n\n/**\n * Shows `error` as an error card on the current page.\n *\n * Setup errors are always shown, because the flow they aborted cannot complete no matter what the end user does, and\n * their messages are written for exactly this purpose. Any other error is only shown while developing — those messages\n * are internal diagnostics, so in production they stay in captureError's hands.\n *\n * Returns a cleanup function that removes the card again.\n */\nexport function showSetupErrorOverlay(error: unknown): () => void {\n if (!canMountIntoDom()) {\n return () => {};\n }\n if (!HexclaveSetupError.isSetupError(error) && !isLikelyDevelopmentEnvironment()) {\n return () => {};\n }\n\n const issue = toSetupIssue(error);\n const existingInstance = getGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY);\n if (existingInstance != null) {\n // A single broken setup usually throws the same error on every page load and sometimes from several flows at once.\n // Stacking cards on top of each other would only hide the first (and most relevant) one, so later errors keep to\n // captureError and leave the card that is already up alone.\n return () => {};\n }\n\n const root = h(\"div\", { className: \"hexclave-setup-error-overlay\" });\n const style = h(\"style\", null, css);\n root.appendChild(style);\n document.body.appendChild(root);\n\n let focusTrap: IssueCardFocusTrap | null = null;\n const render = (minimized: boolean) => {\n focusTrap?.release();\n focusTrap = null;\n root.replaceChildren(style);\n if (minimized) {\n root.appendChild(renderIssuePill({\n kind: \"error\",\n label: \"Setup error\",\n ariaLabel: \"Show Hexclave setup error\",\n onClick: () => render(false),\n }));\n return;\n }\n root.appendChild(renderIssueCard({\n kind: \"error\",\n badge: \"Setup error\",\n title: issue.title,\n bodyText: issue.isFatal\n ? \"Hexclave stopped the authentication flow that ran into this error, so nobody can sign in through it until it is fixed.\"\n : \"Hexclave aborted the authentication flow that ran into this error. Errors like this one may also be transient, in which case retrying the flow works.\",\n messageLabel: \"Error message\",\n message: issue.message,\n howToFix: issue.howToFix,\n footerText: issue.isFatal\n ? \"This card is shown by the Hexclave SDK. Fix the problem above and reload the page to try the flow again.\"\n : \"This card is shown by the Hexclave SDK while developing, and never in production.\",\n ariaLabel: \"Hexclave setup error\",\n aiPrompt: buildAiPrompt(issue),\n onCopyError: (copyError) => captureError(\"setup-error-overlay-copy\", copyError),\n onCopyAiPromptError: (copyError) => captureError(\"setup-error-overlay-copy-ai-prompt\", copyError),\n onMinimize: () => render(true),\n }));\n focusTrap = trapFocusInIssueCard(root);\n };\n render(false);\n\n const cleanup = () => {\n focusTrap?.release();\n focusTrap = null;\n root.remove();\n if (getGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY)?.cleanup === cleanup) {\n setGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, null);\n }\n };\n setGlobalUiInstance(SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, { cleanup });\n return cleanup;\n}\n\n"],"mappings":";;;;;;;AAiBA,MAAa,0CAA0C;AAEvD,MAAM,OAAA,GAAA,4BAAA,gBAAA,CAAsB,+BAA+B;AAE3D,MAAM,0BAA0B;CAC9B;CACA;CACA;AACF;AAWA,SAAS,aAAa,OAA4B;CAChD,IAAIA,mCAAAA,mBAAmB,aAAa,KAAK,GACvC,OAAO;EACL,OAAO,MAAM;EACb,SAAS,MAAM;EACf,UAAU,MAAM;EAChB,SAAS;CACX;CAEF,OAAO;EACL,OAAO;EACP,UAAA,GAAA,mCAAA,kBAAA,CAA2B,KAAK;EAChC,UAAU;EACV,SAAS;CACX;AACF;AAEA,SAAS,cAAc,OAA2B;CAChD,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,GAAG,MAAM,SAAS,KAAK,SAAS,KAAK,MAAM;EAC3C;EACA;CACF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vC;CACA,OAAO,KAAK;CAEZ,MAAM,gBAAgB;EACpB,WAAW,QAAQ;EACnB,YAAY;EACZ,KAAK,OAAO;EACZ,KAAA,GAAA,qBAAA,oBAAA,CAAA,gCAA+D,CAAC,EAAE,YAAY,SAC5E,CAAA,GAAA,qBAAA,oBAAA,CAAoB,yCAAyC,IAAI;CAErE;CACA,CAAA,GAAA,qBAAA,oBAAA,CAAoB,yCAAyC,EAAE,QAAQ,CAAC;CACxE,OAAO;AACT"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,124 @@
1
+ let _hexclave_shared_dist_utils_errors = require("@hexclave/shared/dist/utils/errors");
2
+ let vitest = require("vitest");
3
+ let __index_js = require("./index.js");
4
+ //#region src/setup-error-overlay/index.test.ts
5
+ // @vitest-environment jsdom
6
+ function createSetupError() {
7
+ return new _hexclave_shared_dist_utils_errors.HexclaveSetupError({
8
+ title: "A domain in your authentication flow is not one of your project's trusted domains",
9
+ message: "Nested cross-domain auth callback URL https://demo.example.test/ is not trusted.",
10
+ howToFix: ["Add https://demo.example.test to your project's trusted domains."]
11
+ });
12
+ }
13
+ function overlayRoots() {
14
+ return document.querySelectorAll(".hexclave-setup-error-overlay");
15
+ }
16
+ (0, vitest.describe)("setup error overlay", () => {
17
+ (0, vitest.afterEach)(() => {
18
+ vitest.vi.unstubAllEnvs();
19
+ for (const root of overlayRoots()) root.remove();
20
+ Reflect.deleteProperty(window, __index_js.SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY);
21
+ });
22
+ (0, vitest.it)("renders setup errors with their fix instructions, even outside development", () => {
23
+ vitest.vi.stubEnv("NODE_ENV", "production");
24
+ const error = createSetupError();
25
+ const cleanup = (0, __index_js.showSetupErrorOverlay)(error);
26
+ try {
27
+ (0, vitest.expect)(overlayRoots()).toHaveLength(1);
28
+ const text = document.body.textContent;
29
+ (0, vitest.expect)(text).toContain(error.title);
30
+ (0, vitest.expect)(text).toContain(error.message);
31
+ (0, vitest.expect)(text).toContain(error.howToFix[0]);
32
+ (0, vitest.expect)(document.querySelector("[role='alertdialog']")).not.toBeNull();
33
+ } finally {
34
+ cleanup();
35
+ }
36
+ (0, vitest.expect)(overlayRoots()).toHaveLength(0);
37
+ });
38
+ (0, vitest.it)("minimizes into a pill and back", () => {
39
+ vitest.vi.stubEnv("NODE_ENV", "production");
40
+ const cleanup = (0, __index_js.showSetupErrorOverlay)(createSetupError());
41
+ try {
42
+ const minimizeButton = document.querySelector("[aria-label='Minimize Hexclave setup error']");
43
+ (0, vitest.expect)(minimizeButton).not.toBeNull();
44
+ minimizeButton?.click();
45
+ (0, vitest.expect)(document.querySelector("[role='alertdialog']")).toBeNull();
46
+ const pill = document.querySelector("[aria-label='Show Hexclave setup error']");
47
+ (0, vitest.expect)(pill).not.toBeNull();
48
+ pill?.click();
49
+ (0, vitest.expect)(document.querySelector("[role='alertdialog']")).not.toBeNull();
50
+ } finally {
51
+ cleanup();
52
+ }
53
+ });
54
+ (0, vitest.it)("keeps keyboard focus inside the card and gives it back afterwards", () => {
55
+ vitest.vi.stubEnv("NODE_ENV", "production");
56
+ const pageButton = document.body.appendChild(document.createElement("button"));
57
+ pageButton.focus();
58
+ const cleanup = (0, __index_js.showSetupErrorOverlay)(createSetupError());
59
+ try {
60
+ const card = document.querySelector("[role='alertdialog']");
61
+ (0, vitest.expect)(document.activeElement).toBe(card);
62
+ const cardButtons = [...card?.querySelectorAll("button") ?? []];
63
+ (0, vitest.expect)(cardButtons.length).toBeGreaterThan(1);
64
+ cardButtons[cardButtons.length - 1].focus();
65
+ document.dispatchEvent(new KeyboardEvent("keydown", {
66
+ key: "Tab",
67
+ bubbles: true,
68
+ cancelable: true
69
+ }));
70
+ (0, vitest.expect)(document.activeElement).toBe(cardButtons[0]);
71
+ document.dispatchEvent(new KeyboardEvent("keydown", {
72
+ key: "Tab",
73
+ bubbles: true,
74
+ cancelable: true,
75
+ shiftKey: true
76
+ }));
77
+ (0, vitest.expect)(document.activeElement).toBe(cardButtons[cardButtons.length - 1]);
78
+ pageButton.focus();
79
+ document.dispatchEvent(new KeyboardEvent("keydown", {
80
+ key: "Tab",
81
+ bubbles: true,
82
+ cancelable: true
83
+ }));
84
+ (0, vitest.expect)(document.activeElement).toBe(cardButtons[0]);
85
+ } finally {
86
+ cleanup();
87
+ }
88
+ (0, vitest.expect)(document.activeElement).toBe(pageButton);
89
+ pageButton.remove();
90
+ });
91
+ (0, vitest.it)("keeps the first card instead of stacking later errors on top of it", () => {
92
+ vitest.vi.stubEnv("NODE_ENV", "production");
93
+ const firstError = createSetupError();
94
+ const cleanup = (0, __index_js.showSetupErrorOverlay)(firstError);
95
+ try {
96
+ (0, __index_js.showSetupErrorOverlay)(new _hexclave_shared_dist_utils_errors.HexclaveSetupError({
97
+ title: "Another setup error",
98
+ message: "Another setup error happened.",
99
+ howToFix: ["Fix the other thing."]
100
+ }))();
101
+ (0, vitest.expect)(overlayRoots()).toHaveLength(1);
102
+ (0, vitest.expect)(document.body.textContent).toContain(firstError.message);
103
+ (0, vitest.expect)(document.body.textContent).not.toContain("Another setup error happened.");
104
+ } finally {
105
+ cleanup();
106
+ }
107
+ });
108
+ (0, vitest.it)("only shows errors that are not setup errors while developing", () => {
109
+ vitest.vi.stubEnv("NODE_ENV", "production");
110
+ (0, __index_js.showSetupErrorOverlay)(/* @__PURE__ */ new Error("Some internal failure."))();
111
+ (0, vitest.expect)(overlayRoots()).toHaveLength(0);
112
+ vitest.vi.stubEnv("NODE_ENV", "development");
113
+ const cleanup = (0, __index_js.showSetupErrorOverlay)(/* @__PURE__ */ new Error("Some internal failure."));
114
+ try {
115
+ (0, vitest.expect)(overlayRoots()).toHaveLength(1);
116
+ (0, vitest.expect)(document.body.textContent).toContain("Some internal failure.");
117
+ } finally {
118
+ cleanup();
119
+ }
120
+ });
121
+ });
122
+ //#endregion
123
+
124
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","names":["HexclaveSetupError","SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY"],"sources":["../../src/setup-error-overlay/index.test.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n// @vitest-environment jsdom\n\nimport { HexclaveSetupError } from \"@hexclave/shared/dist/utils/errors\";\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\nimport { SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY, showSetupErrorOverlay } from \".\";\n\nfunction createSetupError() {\n return new HexclaveSetupError({\n title: \"A domain in your authentication flow is not one of your project's trusted domains\",\n message: \"Nested cross-domain auth callback URL https://demo.example.test/ is not trusted.\",\n howToFix: [\"Add https://demo.example.test to your project's trusted domains.\"],\n });\n}\n\nfunction overlayRoots() {\n return document.querySelectorAll(\".hexclave-setup-error-overlay\");\n}\n\ndescribe(\"setup error overlay\", () => {\n afterEach(() => {\n vi.unstubAllEnvs();\n for (const root of overlayRoots()) {\n root.remove();\n }\n Reflect.deleteProperty(window, SETUP_ERROR_OVERLAY_GLOBAL_INSTANCE_KEY);\n });\n\n it(\"renders setup errors with their fix instructions, even outside development\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const error = createSetupError();\n\n const cleanup = showSetupErrorOverlay(error);\n try {\n expect(overlayRoots()).toHaveLength(1);\n const text = document.body.textContent;\n expect(text).toContain(error.title);\n expect(text).toContain(error.message);\n expect(text).toContain(error.howToFix[0]);\n expect(document.querySelector(\"[role='alertdialog']\")).not.toBeNull();\n } finally {\n cleanup();\n }\n\n expect(overlayRoots()).toHaveLength(0);\n });\n\n it(\"minimizes into a pill and back\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const cleanup = showSetupErrorOverlay(createSetupError());\n try {\n const minimizeButton = document.querySelector<HTMLButtonElement>(\"[aria-label='Minimize Hexclave setup error']\");\n expect(minimizeButton).not.toBeNull();\n minimizeButton?.click();\n expect(document.querySelector(\"[role='alertdialog']\")).toBeNull();\n\n const pill = document.querySelector<HTMLButtonElement>(\"[aria-label='Show Hexclave setup error']\");\n expect(pill).not.toBeNull();\n pill?.click();\n expect(document.querySelector(\"[role='alertdialog']\")).not.toBeNull();\n } finally {\n cleanup();\n }\n });\n\n it(\"keeps keyboard focus inside the card and gives it back afterwards\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const pageButton = document.body.appendChild(document.createElement(\"button\"));\n pageButton.focus();\n\n const cleanup = showSetupErrorOverlay(createSetupError());\n try {\n const card = document.querySelector<HTMLElement>(\"[role='alertdialog']\");\n expect(document.activeElement).toBe(card);\n\n const cardButtons = [...(card?.querySelectorAll(\"button\") ?? [])];\n expect(cardButtons.length).toBeGreaterThan(1);\n cardButtons[cardButtons.length - 1].focus();\n document.dispatchEvent(new KeyboardEvent(\"keydown\", { key: \"Tab\", bubbles: true, cancelable: true }));\n expect(document.activeElement).toBe(cardButtons[0]);\n document.dispatchEvent(new KeyboardEvent(\"keydown\", { key: \"Tab\", bubbles: true, cancelable: true, shiftKey: true }));\n expect(document.activeElement).toBe(cardButtons[cardButtons.length - 1]);\n\n // Tabbing away from the card is what the trap exists to prevent, even when the page itself moves focus.\n pageButton.focus();\n document.dispatchEvent(new KeyboardEvent(\"keydown\", { key: \"Tab\", bubbles: true, cancelable: true }));\n expect(document.activeElement).toBe(cardButtons[0]);\n } finally {\n cleanup();\n }\n\n expect(document.activeElement).toBe(pageButton);\n pageButton.remove();\n });\n\n it(\"keeps the first card instead of stacking later errors on top of it\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n const firstError = createSetupError();\n const cleanup = showSetupErrorOverlay(firstError);\n try {\n const secondCleanup = showSetupErrorOverlay(new HexclaveSetupError({\n title: \"Another setup error\",\n message: \"Another setup error happened.\",\n howToFix: [\"Fix the other thing.\"],\n }));\n secondCleanup();\n\n expect(overlayRoots()).toHaveLength(1);\n expect(document.body.textContent).toContain(firstError.message);\n expect(document.body.textContent).not.toContain(\"Another setup error happened.\");\n } finally {\n cleanup();\n }\n });\n\n it(\"only shows errors that are not setup errors while developing\", () => {\n vi.stubEnv(\"NODE_ENV\", \"production\");\n showSetupErrorOverlay(new Error(\"Some internal failure.\"))();\n expect(overlayRoots()).toHaveLength(0);\n\n vi.stubEnv(\"NODE_ENV\", \"development\");\n const cleanup = showSetupErrorOverlay(new Error(\"Some internal failure.\"));\n try {\n expect(overlayRoots()).toHaveLength(1);\n expect(document.body.textContent).toContain(\"Some internal failure.\");\n } finally {\n cleanup();\n }\n });\n});\n"],"mappings":";;;;;AAUA,SAAS,mBAAmB;CAC1B,OAAO,IAAIA,mCAAAA,mBAAmB;EAC5B,OAAO;EACP,SAAS;EACT,UAAU,CAAC,kEAAkE;CAC/E,CAAC;AACH;AAEA,SAAS,eAAe;CACtB,OAAO,SAAS,iBAAiB,+BAA+B;AAClE;qBAES,6BAA6B;CACpC,CAAA,GAAA,OAAA,UAAA,OAAgB;EACd,OAAA,GAAG,cAAc;EACjB,KAAK,MAAM,QAAQ,aAAa,GAC9B,KAAK,OAAO;EAEd,QAAQ,eAAe,QAAQC,WAAAA,uCAAuC;CACxE,CAAC;CAED,CAAA,GAAA,OAAA,GAAA,CAAG,oFAAoF;EACrF,OAAA,GAAG,QAAQ,YAAY,YAAY;EACnC,MAAM,QAAQ,iBAAiB;EAE/B,MAAM,WAAA,GAAA,WAAA,sBAAA,CAAgC,KAAK;EAC3C,IAAI;GACF,CAAA,GAAA,OAAA,OAAA,CAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;GACrC,MAAM,OAAO,SAAS,KAAK;GAC3B,CAAA,GAAA,OAAA,OAAA,CAAO,IAAI,CAAC,CAAC,UAAU,MAAM,KAAK;GAClC,CAAA,GAAA,OAAA,OAAA,CAAO,IAAI,CAAC,CAAC,UAAU,MAAM,OAAO;GACpC,CAAA,GAAA,OAAA,OAAA,CAAO,IAAI,CAAC,CAAC,UAAU,MAAM,SAAS,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WAAW,CAAC,CAAC,UAAU,WAAW,OAAO;GAC9D,CAAA,GAAA,OAAA,OAAA,CAAO,SAAS,KAAK,WAAW,CAAC,CAAC,IAAI,UAAU,+BAA+B;EACjF,UAAU;GACR,QAAQ;EACV;CACF,CAAC;CAED,CAAA,GAAA,OAAA,GAAA,CAAG,sEAAsE;EACvE,OAAA,GAAG,QAAQ,YAAY,YAAY;EACnC,CAAA,GAAA,WAAA,sBAAA,iBAAsB,IAAI,MAAM,wBAAwB,CAAC,CAAC,CAAC;EAC3D,CAAA,GAAA,OAAA,OAAA,CAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;EAErC,OAAA,GAAG,QAAQ,YAAY,aAAa;EACpC,MAAM,WAAA,GAAA,WAAA,sBAAA,iBAAgC,IAAI,MAAM,wBAAwB,CAAC;EACzE,IAAI;GACF,CAAA,GAAA,OAAA,OAAA,CAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC;GACrC,CAAA,GAAA,OAAA,OAAA,CAAO,SAAS,KAAK,WAAW,CAAC,CAAC,UAAU,wBAAwB;EACtE,UAAU;GACR,QAAQ;EACV;CACF,CAAC;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as quetzalLocales } from "./quetzal-translations-XeH3zQ9l.js";
1
+ import { n as quetzalLocales } from "./quetzal-translations-CK45_4Dm.js";
2
2
 
3
3
  //#region src/providers/translation-provider.d.ts
4
4
  declare function TranslationProvider({
@@ -12,4 +12,4 @@ declare function TranslationProvider({
12
12
  }): import("react/jsx-runtime").JSX.Element;
13
13
  //#endregion
14
14
  export { TranslationProvider as t };
15
- //# sourceMappingURL=translation-provider-WOaZXqAz.d.ts.map
15
+ //# sourceMappingURL=translation-provider-DQ3BJepJ.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"translation-provider-WOaZXqAz.d.ts","names":[],"sources":["../src/providers/translation-provider.tsx"],"mappings":";;;iBAQgB,mBAAA;EAAsB,IAAA;EAAM,oBAAA;EAAsB;AAAA;EAChE,IAAA,EAAM,UAAA,QAAkB,cAAA,CAAe,GAAA;EACvC,oBAAA,GAAuB,MAAA;EACvB,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA,gCACjB,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"translation-provider-DQ3BJepJ.d.ts","names":[],"sources":["../src/providers/translation-provider.tsx"],"mappings":";;;iBAQgB,mBAAA;EAAsB,IAAA;EAAM,oBAAA;EAAsB;AAAA;EAChE,IAAA,EAAM,UAAA,QAAkB,cAAA,CAAe,GAAA;EACvC,oBAAA,GAAuB,MAAA;EACvB,QAAA,EAAU,KAAA,CAAM,SAAA;AAAA,gCACjB,GAAA,CAAA,OAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template (FOR package.json FILES, PLEASE EDIT package-template.json)",
3
3
  "name": "@hexclave/next",
4
- "version": "1.0.75",
4
+ "version": "1.0.76",
5
5
  "repository": "https://github.com/hexclave/hexclave",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -74,9 +74,9 @@
74
74
  "tailwindcss-animate": "^1.0.7",
75
75
  "rrweb": "^1.1.3",
76
76
  "yup": "^1.7.1",
77
- "@hexclave/sc": "1.0.75",
78
- "@hexclave/ui": "1.0.75",
79
- "@hexclave/shared": "1.0.75"
77
+ "@hexclave/shared": "1.0.76",
78
+ "@hexclave/ui": "1.0.76",
79
+ "@hexclave/sc": "1.0.76"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "@types/react": ">=18.0.0",
@@ -9,6 +9,7 @@ import { runAsynchronously, runAsynchronouslyWithAlert } from "@hexclave/shared/
9
9
  import { isLocalhost } from "@hexclave/shared/dist/utils/urls";
10
10
  import type { StackClientApp } from "../lib/hexclave-app";
11
11
  import { getGlobalUiInstance, h, hasAppendChild, setGlobalUiInstance, setHtml, type UiGlobalInstance } from "../in-page-ui/dom";
12
+ import { HEXCLAVE_LOGO_SVG } from "../in-page-ui/logo";
12
13
  import { getBaseUrl } from "../lib/hexclave-app/apps/implementations/common";
13
14
  import type { HandlerUrlOptions, HandlerUrls, HandlerUrlTarget } from "../lib/hexclave-app/common";
14
15
  import { hexclaveAppInternalsSymbol } from "../lib/hexclave-app/common";
@@ -88,10 +89,6 @@ const DEFAULT_STATE: DevToolState = {
88
89
  panelHeight: 520,
89
90
  };
90
91
 
91
- // Hexclave mark — hexagon outline with three radial bars, monochrome via currentColor
92
- // so it inherits the trigger logo's color. Sourced from apps/dashboard/public/hexclave-icon.svg
93
- // (gradient + glow stripped; this is a tiny trigger glyph, not the full brand mark).
94
- const HEXCLAVE_LOGO_SVG = '<svg width="16" height="16" viewBox="0 0 48 48" fill="none" stroke="currentColor" stroke-width="3" stroke-linejoin="miter"><path d="M 24 4 L 41.32 14 L 41.32 34 L 24 44 L 6.68 34 L 6.68 14 Z"/><path d="M 11 16.87 L 14 15.13 L 14 32.87 L 11 31.13 Z" fill="currentColor" stroke="none"/><path d="M 11 16.87 L 14 15.13 L 14 32.87 L 11 31.13 Z" fill="currentColor" stroke="none" transform="rotate(120 24 24)"/><path d="M 11 16.87 L 14 15.13 L 14 32.87 L 11 31.13 Z" fill="currentColor" stroke="none" transform="rotate(240 24 24)"/></svg>';
95
92
 
96
93
  // ---------------------------------------------------------------------------
97
94
  // State management
@@ -6,9 +6,8 @@
6
6
  import type { StackClientApp } from "../lib/hexclave-app";
7
7
  import { captureError } from "@hexclave/shared/dist/utils/errors";
8
8
  import { runAsynchronously } from "@hexclave/shared/dist/utils/promises";
9
- import { isLocalhost } from "@hexclave/shared/dist/utils/urls";
9
+ import { isLikelyDevelopmentEnvironment } from "../in-page-ui/dev-environment";
10
10
  import { canMountIntoDom } from "../in-page-ui/dom";
11
- import { envVars } from "../generated/env";
12
11
  import type { createDevTool as CreateDevToolFn } from "./dev-tool-core";
13
12
 
14
13
  // Hexclave rebrand: UI-only local pref — straight rename (one-time reset is harmless)
@@ -38,19 +37,9 @@ function shouldShow(): boolean {
38
37
  // consuming app itself was built or hosted as production.
39
38
  if (activeProjectIsDevelopmentEnvironment) return true;
40
39
 
41
- // "auto" behavior (the default):
42
- const nodeEnv = envVars.NODE_ENV;
43
- if (nodeEnv !== undefined) {
44
- // NODE_ENV is available (bundler/process env exists) — only show in development
45
- return nodeEnv === "development";
46
- }
47
-
48
- // NODE_ENV not found (no process.env/import.meta) — show on localhost or file: protocol
49
- try {
50
- const url = new URL(window.location.href);
51
- if (url.protocol === "file:") return true;
52
- } catch {}
53
- return isLocalhost(window.location.href);
40
+ // "auto" behavior (the default): every in-page UI that is only appropriate while developing shares one heuristic, so
41
+ // the dev tool and the error cards can never disagree about whether this looks like a development environment.
42
+ return isLikelyDevelopmentEnvironment();
54
43
  }
55
44
 
56
45
  let activeCleanup: (() => void) | null = null;
@@ -0,0 +1,33 @@
1
+
2
+ //===========================================
3
+ // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template
4
+ //===========================================
5
+ // Shared "are we in a development-like environment?" check for Hexclave's in-page UIs. Some of them (eg. surfacing an
6
+ // unexpected internal error) are only appropriate while developing, and the SDK cannot ask the server about it because
7
+ // the check has to work synchronously and before the app is authenticated.
8
+
9
+ import { isLocalhost } from "@hexclave/shared/dist/utils/urls";
10
+ import { envVars } from "../generated/env";
11
+
12
+ export function isLikelyDevelopmentEnvironment(): boolean {
13
+ // NODE_ENV is the most reliable signal, but plenty of bundlers (eg. Vite-based ones) don't define it in the browser
14
+ // bundle at all, so fall back to guessing from the current URL.
15
+ const nodeEnv = envVars.NODE_ENV;
16
+ if (nodeEnv !== undefined) {
17
+ return nodeEnv === "development";
18
+ }
19
+
20
+ if (typeof window === "undefined") {
21
+ return false;
22
+ }
23
+
24
+ try {
25
+ const url = new URL(window.location.href);
26
+ if (url.protocol === "file:") {
27
+ return true;
28
+ }
29
+ } catch {
30
+ return false;
31
+ }
32
+ return isLocalhost(window.location.href);
33
+ }
@@ -0,0 +1,67 @@
1
+
2
+ //===========================================
3
+ // THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template
4
+ //===========================================
5
+ // @vitest-environment jsdom
6
+
7
+ import { afterEach, describe, expect, it } from "vitest";
8
+ import { renderIssueCard, trapFocusInIssueCard } from "./issue-card";
9
+
10
+ function mountCard(): HTMLElement {
11
+ const root = document.body.appendChild(document.createElement("div"));
12
+ root.appendChild(renderIssueCard({
13
+ kind: "error",
14
+ badge: "Config error",
15
+ title: "Something is misconfigured",
16
+ bodyText: "Body",
17
+ messageLabel: "Error message",
18
+ message: "Message",
19
+ footerText: "Footer",
20
+ ariaLabel: "Hexclave config error",
21
+ aiPrompt: "prompt",
22
+ onCopyError: () => {},
23
+ onCopyAiPromptError: () => {},
24
+ onMinimize: () => {},
25
+ }));
26
+ return root;
27
+ }
28
+
29
+ function pressTab() {
30
+ document.dispatchEvent(new KeyboardEvent("keydown", { key: "Tab", bubbles: true, cancelable: true }));
31
+ }
32
+
33
+ function cardButtons(root: HTMLElement): HTMLButtonElement[] {
34
+ return [...root.querySelectorAll<HTMLButtonElement>(".hic-card button")];
35
+ }
36
+
37
+ describe("issue card focus trap", () => {
38
+ afterEach(() => {
39
+ document.body.replaceChildren();
40
+ });
41
+
42
+ it("follows a re-rendered card without moving focus or losing the original focus owner", () => {
43
+ const pageButton = document.body.appendChild(document.createElement("button"));
44
+ pageButton.focus();
45
+
46
+ const firstRoot = mountCard();
47
+ const firstTrap = trapFocusInIssueCard(firstRoot);
48
+ expect(document.activeElement).toBe(firstRoot.querySelector(".hic-card"));
49
+
50
+ // What the pushed-config overlay does on every poll: throw the rendered card away and render a fresh one.
51
+ firstRoot.remove();
52
+ const secondRoot = mountCard();
53
+ firstTrap.release({ restoreFocus: false });
54
+ const secondTrap = trapFocusInIssueCard(secondRoot, {
55
+ moveFocusIntoCard: false,
56
+ previouslyFocused: firstTrap.previouslyFocused,
57
+ });
58
+ expect(document.activeElement).not.toBe(secondRoot.querySelector(".hic-card"));
59
+
60
+ // The trap now belongs to the visible card, so Tab lands inside it instead of inside the detached one.
61
+ pressTab();
62
+ expect(document.activeElement).toBe(cardButtons(secondRoot)[0]);
63
+
64
+ secondTrap.release();
65
+ expect(document.activeElement).toBe(pageButton);
66
+ });
67
+ });