@meddleware/access-gate-ui 0.1.10 → 0.1.12

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,7 @@
1
1
  {
2
2
  "name": "@meddleware/access-gate-ui",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
+ "homepage": "https://docs.meddleware.co.uk/blockchain/sui/access-gate/",
4
5
  "description": "Operator console for creating and managing on-chain Sui access gates — create gates, configure settings, airdrop NFTs, and freeze gates via a wallet-connected SPA.",
5
6
  "author": "Meddleware <dev@meddleware.co.uk>",
6
7
  "license": "0BSD",
@@ -31,26 +32,31 @@
31
32
  "dev": "vite",
32
33
  "build": "vue-tsc --noEmit && vite build",
33
34
  "preview": "vite preview",
34
- "type-check": "vue-tsc --noEmit"
35
+ "type-check": "vue-tsc --noEmit",
36
+ "test": "vitest run",
37
+ "test:watch": "vitest"
35
38
  },
36
39
  "publishConfig": {
37
40
  "access": "public"
38
41
  },
39
42
  "dependencies": {
40
- "@meddleware/design-tokens": "^0.1.2",
41
- "@meddleware/ui": "^0.1.11",
43
+ "@meddleware/design-tokens": "^0.1.3",
44
+ "@meddleware/ui": "^0.1.13",
42
45
  "@meddleware/nft-gate-client": "^0.0.6",
43
- "@meddleware/wallet-adapter": "^0.0.5",
44
- "@mysten/sui": "^2.30.0",
45
- "@mysten/wallet-standard": "^0.20.0",
46
- "vue": "^3.5.40"
46
+ "@meddleware/wallet-adapter": "^0.0.6",
47
+ "@mysten/sui": "^2.31.0",
48
+ "@mysten/wallet-standard": "^0.21.0",
49
+ "vue": "^3.5.43"
47
50
  },
48
51
  "devDependencies": {
49
52
  "@types/node": "~24.12.2",
50
- "@vitejs/plugin-vue": "^6.0.8",
53
+ "@vitejs/plugin-vue": "^6.0.9",
54
+ "@vue/test-utils": "^2.5.1",
55
+ "jsdom": "^30.1.0",
51
56
  "typescript": "~6.0.0",
52
- "vite": "^8.1.5",
53
- "vue-tsc": "~3.3.0"
57
+ "vite": "^8.3.0",
58
+ "vitest": "~5.0.1",
59
+ "vue-tsc": "~3.3.11"
54
60
  },
55
61
  "engines": {
56
62
  "node": "^22.18.0 || >=24.12.0"
package/src/App.vue CHANGED
@@ -10,6 +10,8 @@ import { NETWORK } from './config.js'
10
10
  import AccessGateView from './components/AccessGateView.vue'
11
11
 
12
12
  const { mode, set } = useColorMode('dark')
13
+ const DOCS_URL = import.meta.env.VITE_DOCS_URL || 'https://docs.meddleware.co.uk/blockchain/sui/access-gate/'
14
+ const DEV_URL = import.meta.env.VITE_DEV_URL || 'https://dev.meddleware.co.uk/sui/access-gate/'
13
15
  const { wallets, account, connect, disconnect } = useWallet()
14
16
 
15
17
  async function onConnect(): Promise<void> {
@@ -42,7 +44,7 @@ async function onConnect(): Promise<void> {
42
44
 
43
45
  <AccessGateView />
44
46
 
45
- <AppFooter />
47
+ <AppFooter :docs-url="DOCS_URL" :dev-url="DEV_URL" />
46
48
  </div>
47
49
  </template>
48
50
 
@@ -99,7 +99,7 @@ function priceLabel(mist: bigint): string {
99
99
  color: var(--muted);
100
100
  }
101
101
  .badge--warn {
102
- color: var(--mw-gold-500, #b8860b);
102
+ color: var(--warning);
103
103
  border-color: currentColor;
104
104
  }
105
105
  .actions {
package/src/constants.ts CHANGED
@@ -30,3 +30,40 @@ export function accessGateNftType(network: SuiNetwork, soulbound: boolean): stri
30
30
  const variant = soulbound ? 'SoulboundAccessNFT' : 'AccessNFT'
31
31
  return `${ACCESS_GATE_PACKAGE_ID[network]}::access_gate::${variant}`
32
32
  }
33
+
34
+ /** A canonical Sui package/object id: `0x` followed by exactly 64 lowercase hex digits. */
35
+ const PACKAGE_ID_RE = /^0x[0-9a-f]{64}$/
36
+
37
+ /**
38
+ * True iff `id` is a canonically-formatted Sui package id (`0x` + 64 lowercase hex). Empty or
39
+ * malformed ids (e.g. the not-yet-populated `mainnet` constants) return `false`.
40
+ */
41
+ export function validatePackageId(id: string): boolean {
42
+ return PACKAGE_ID_RE.test(id)
43
+ }
44
+
45
+ /**
46
+ * Fail-closed diagnostic run at app init. The app already fails closed when a package id is empty
47
+ * (it produces an unusable `::access_gate::…` type string that no on-chain call will accept); this
48
+ * surfaces *why* with a clear console warning instead of a silent malformed request. It never
49
+ * throws — a mis-set network should degrade to "nothing works, here's the reason", not a white
50
+ * screen.
51
+ */
52
+ export function warnIfPackageConfigInvalid(network: SuiNetwork): void {
53
+ const pkg = ACCESS_GATE_PACKAGE_ID[network]
54
+ const cfg = ACCESS_GATE_PLATFORM_CONFIG_ID[network]
55
+ if (!validatePackageId(pkg)) {
56
+ console.warn(
57
+ `[access-gate-ui] ACCESS_GATE_PACKAGE_ID for network "${network}" is not a valid package id ` +
58
+ `(${pkg === '' ? 'empty — not yet deployed' : `got "${pkg}"`}). Gate reads/writes will fail ` +
59
+ `closed until constants.ts is populated with the deployed package id.`,
60
+ )
61
+ }
62
+ if (!validatePackageId(cfg)) {
63
+ console.warn(
64
+ `[access-gate-ui] ACCESS_GATE_PLATFORM_CONFIG_ID for network "${network}" is not a valid ` +
65
+ `object id (${cfg === '' ? 'empty — not yet deployed' : `got "${cfg}"`}). Purchase-preview ` +
66
+ `and commission display will be unavailable until it is populated.`,
67
+ )
68
+ }
69
+ }
package/src/main.ts CHANGED
@@ -2,5 +2,11 @@ import '@meddleware/design-tokens/tokens.css'
2
2
  import '@meddleware/ui/base.css'
3
3
  import { createApp } from 'vue'
4
4
  import App from './App.vue'
5
+ import { NETWORK } from './config'
6
+ import { warnIfPackageConfigInvalid } from './constants'
7
+
8
+ // Fail-closed diagnostic: surfaces a clear reason if the active network's package/config ids are
9
+ // missing or malformed (e.g. mainnet before deploy) instead of silently issuing broken calls.
10
+ warnIfPackageConfigInvalid(NETWORK)
5
11
 
6
12
  createApp(App).mount('#app')