@octarq/plugin-links 0.0.0-stage → 0.1.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/index.ts ADDED
@@ -0,0 +1,20 @@
1
+ import { lazy } from "react";
2
+ import type { UIPlugin } from "@octarq/plugin-sdk";
3
+ import { linksI18n } from "./i18n";
4
+
5
+ const links: UIPlugin = {
6
+ name: "links",
7
+ routes: [{ path: "/links", Component: lazy(() => import("./pages")) }],
8
+ widgets: [
9
+ { slot: "home-overview", order: 10, Component: lazy(() => import("./widgets/LinksStatCardWidget")) },
10
+ { slot: "home-setup-steps", order: 20, Component: lazy(() => import("./widgets/LinksSetupStepWidget")) },
11
+ { slot: "home-chart", order: 10, Component: lazy(() => import("./widgets/ClicksChartWidget")) },
12
+ { slot: "home-panels", order: 10, Component: lazy(() => import("./widgets/TopLinksPanelWidget")) },
13
+ { slot: "home-panels", order: 20, Component: lazy(() => import("./widgets/TopCitiesPanelWidget")) },
14
+ { slot: "home-panels", order: 30, Component: lazy(() => import("./widgets/DevicesPanelWidget")) },
15
+ ],
16
+ i18n: linksI18n,
17
+ };
18
+
19
+ export default links;
20
+
@@ -0,0 +1,45 @@
1
+ import { describe, it, expect } from "vitest";
2
+
3
+ // Scope guard for the reserved-slug settings page. The config is one-per-
4
+ // deployment (GET/PUT /api/instance-settings, instance-admin gated), so its
5
+ // editor belongs in the /instance console — announced by the Go half's
6
+ // InstanceMenus() and registered as a UIPlugin.instanceRoutes entry. If it
7
+ // ever gets dragged back into the tenant Links shell (the old "settings" tab)
8
+ // or the console route stops pointing at /link-settings, this file goes red.
9
+ //
10
+ // Read the real sources rather than restating them here: a list in this file
11
+ // would drift from the pages it claims to guard. Same approach as
12
+ // shell/navHardcoding.test.ts.
13
+ const SOURCES = import.meta.glob("./{index.ts,pages/index.tsx}", {
14
+ query: "?raw",
15
+ import: "default",
16
+ eager: true,
17
+ }) as Record<string, string>;
18
+
19
+ const TENANT_PAGE = "./pages/index.tsx";
20
+ const PLUGIN_ENTRY = "./index.ts";
21
+
22
+ function sourceFor(key: string): string {
23
+ const hit = Object.entries(SOURCES).find(([k]) => k === key);
24
+ if (!hit) throw new Error(`import.meta.glob resolved no source at "${key}"`);
25
+ return hit[1];
26
+ }
27
+
28
+ describe("links instance scope", () => {
29
+ it("keeps instance-scope settings out of the tenant Links page", () => {
30
+ const page = sourceFor(TENANT_PAGE);
31
+
32
+ // The instance-scope editor (LinkSettings / InstanceLinkSettings) must not
33
+ // be referenced from the tenant page — import or otherwise.
34
+ expect(page).not.toMatch(/\bLinkSettings\b/);
35
+ // Nor any "settings" tab: no tab state, no tab-switch buttons, no branch.
36
+ expect(page).not.toMatch(/tab\s*===\s*'settings'/);
37
+ expect(page).not.toMatch(/setTab\s*\(\s*'settings'/);
38
+ });
39
+
40
+ it("does not register duplicate instance link settings route", () => {
41
+ const entry = sourceFor(PLUGIN_ENTRY);
42
+
43
+ expect(entry).not.toMatch(/path:\s*"\/link-settings"/);
44
+ });
45
+ });
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@octarq/plugin-links",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Short links and click analytics plugin for Octarq",
5
+ "type": "module",
6
+ "main": "./index.ts",
7
+ "types": "./index.ts",
8
+ "exports": {
9
+ ".": "./index.ts"
10
+ },
11
+ "peerDependencies": {
12
+ "@octarq/plugin-sdk": "^0.21.0",
13
+ "react": "^18.3.1",
14
+ "react-dom": "^18.3.1",
15
+ "react-router-dom": "^6.28.0 || ^7.0.0"
16
+ },
17
+ "dependencies": {
18
+ "lucide-react": "^1.21.0"
19
+ },
20
+ "devDependencies": {
21
+ "@octarq/plugin-sdk": "^0.21.0",
22
+ "@types/react": "^18.3.1",
23
+ "@types/react-dom": "^18.3.1",
24
+ "react": "^18.3.1",
25
+ "react-dom": "^18.3.1",
26
+ "react-router-dom": "^6.28.0",
27
+ "typescript": "^5.6.0"
28
+ }
6
29
  }