@nuwah/vertical-sdk 0.0.0-stage → 0.2.0-rc.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/LICENSE +17 -0
- package/README.md +229 -2
- package/bin/nuwah-contract-check-rules.d.mts +41 -0
- package/bin/nuwah-contract-check-rules.mjs +333 -0
- package/bin/nuwah-contract-check.mjs +64 -0
- package/dist/accounting.d.ts +1417 -0
- package/dist/accounting.js +274 -0
- package/dist/active-org.d.ts +13 -0
- package/dist/active-org.js +59 -0
- package/dist/actors.d.ts +448 -0
- package/dist/actors.js +143 -0
- package/dist/ai.d.ts +359 -0
- package/dist/ai.js +229 -0
- package/dist/analytics.d.ts +37 -0
- package/dist/analytics.js +8 -0
- package/dist/atlas.d.ts +291 -0
- package/dist/atlas.js +78 -0
- package/dist/audit.d.ts +193 -0
- package/dist/audit.js +26 -0
- package/dist/authentication.d.ts +119 -0
- package/dist/authentication.js +83 -0
- package/dist/awards.d.ts +38 -0
- package/dist/awards.js +10 -0
- package/dist/blueprint/document.d.ts +178 -0
- package/dist/blueprint/document.js +17 -0
- package/dist/blueprint/index.d.ts +3 -0
- package/dist/blueprint/index.js +5 -0
- package/dist/blueprint/manifest.d.ts +105 -0
- package/dist/blueprint/manifest.js +11 -0
- package/dist/blueprint/validate.d.ts +14 -0
- package/dist/blueprint/validate.js +416 -0
- package/dist/bookings-directory.d.ts +118 -0
- package/dist/bookings-directory.js +289 -0
- package/dist/bookings-extra.d.ts +1448 -0
- package/dist/bookings-extra.js +582 -0
- package/dist/bookings.d.ts +1365 -0
- package/dist/bookings.js +305 -0
- package/dist/builder-code.d.ts +164 -0
- package/dist/builder-code.js +12 -0
- package/dist/builder-core-gaps.d.ts +83 -0
- package/dist/builder-core-gaps.js +8 -0
- package/dist/builder-repos.d.ts +73 -0
- package/dist/builder-repos.js +37 -0
- package/dist/builder.d.ts +730 -0
- package/dist/builder.js +105 -0
- package/dist/campaigns.d.ts +105 -0
- package/dist/campaigns.js +25 -0
- package/dist/catalogs.d.ts +188 -0
- package/dist/catalogs.js +36 -0
- package/dist/commerce-ai.d.ts +182 -0
- package/dist/commerce-ai.js +27 -0
- package/dist/connections.d.ts +278 -0
- package/dist/connections.js +96 -0
- package/dist/content-control.d.ts +121 -0
- package/dist/content-control.js +23 -0
- package/dist/contributions.d.ts +560 -0
- package/dist/contributions.js +140 -0
- package/dist/conversation-assist.d.ts +154 -0
- package/dist/conversation-assist.js +51 -0
- package/dist/conversation-info.d.ts +219 -0
- package/dist/conversation-info.js +43 -0
- package/dist/crm.d.ts +533 -0
- package/dist/crm.js +142 -0
- package/dist/dashboards.d.ts +119 -0
- package/dist/dashboards.js +22 -0
- package/dist/delegations.d.ts +161 -0
- package/dist/delegations.js +39 -0
- package/dist/docs.d.ts +289 -0
- package/dist/docs.js +49 -0
- package/dist/documents.d.ts +317 -0
- package/dist/documents.js +84 -0
- package/dist/drafts.d.ts +132 -0
- package/dist/drafts.js +56 -0
- package/dist/engagements.d.ts +133 -0
- package/dist/engagements.js +15 -0
- package/dist/event-stream.d.ts +54 -0
- package/dist/event-stream.js +228 -0
- package/dist/exchanges.d.ts +447 -0
- package/dist/exchanges.js +145 -0
- package/dist/exports.d.ts +113 -0
- package/dist/exports.js +81 -0
- package/dist/feeds.d.ts +228 -0
- package/dist/feeds.js +52 -0
- package/dist/files.d.ts +56 -0
- package/dist/files.js +55 -0
- package/dist/finance-insights.d.ts +41 -0
- package/dist/finance-insights.js +61 -0
- package/dist/fixed-assets.d.ts +155 -0
- package/dist/fixed-assets.js +28 -0
- package/dist/fulfilment-jobs.d.ts +405 -0
- package/dist/fulfilment-jobs.js +76 -0
- package/dist/fulfilment.d.ts +205 -0
- package/dist/fulfilment.js +39 -0
- package/dist/hr.d.ts +350 -0
- package/dist/hr.js +94 -0
- package/dist/http.d.ts +124 -0
- package/dist/http.js +392 -0
- package/dist/inbox.d.ts +206 -0
- package/dist/inbox.js +36 -0
- package/dist/index.d.ts +384 -0
- package/dist/index.js +294 -0
- package/dist/insights.d.ts +176 -0
- package/dist/insights.js +52 -0
- package/dist/inventory.d.ts +797 -0
- package/dist/inventory.js +120 -0
- package/dist/list-query.d.ts +211 -0
- package/dist/list-query.js +158 -0
- package/dist/listings.d.ts +381 -0
- package/dist/listings.js +173 -0
- package/dist/location-sharing.d.ts +83 -0
- package/dist/location-sharing.js +20 -0
- package/dist/marketplace.d.ts +268 -0
- package/dist/marketplace.js +59 -0
- package/dist/matching.d.ts +103 -0
- package/dist/matching.js +22 -0
- package/dist/media.d.ts +221 -0
- package/dist/media.js +239 -0
- package/dist/metrics.d.ts +125 -0
- package/dist/metrics.js +45 -0
- package/dist/moderation.d.ts +240 -0
- package/dist/moderation.js +40 -0
- package/dist/money.d.ts +41 -0
- package/dist/money.js +79 -0
- package/dist/my-data.d.ts +266 -0
- package/dist/my-data.js +32 -0
- package/dist/names.d.ts +14 -0
- package/dist/names.js +17 -0
- package/dist/occasions.d.ts +256 -0
- package/dist/occasions.js +40 -0
- package/dist/onboarding.d.ts +88 -0
- package/dist/onboarding.js +38 -0
- package/dist/pagination.d.ts +204 -0
- package/dist/pagination.js +141 -0
- package/dist/party-baseline-attributes.d.ts +245 -0
- package/dist/party-baseline-attributes.js +36 -0
- package/dist/party.d.ts +401 -0
- package/dist/party.js +56 -0
- package/dist/patient.d.ts +161 -0
- package/dist/patient.js +45 -0
- package/dist/payroll.d.ts +378 -0
- package/dist/payroll.js +60 -0
- package/dist/person-addresses.d.ts +88 -0
- package/dist/person-addresses.js +18 -0
- package/dist/person-cart.d.ts +250 -0
- package/dist/person-cart.js +63 -0
- package/dist/person-chat-assist.d.ts +47 -0
- package/dist/person-chat-assist.js +13 -0
- package/dist/person-data-webhooks.d.ts +72 -0
- package/dist/person-data-webhooks.js +86 -0
- package/dist/person-data.d.ts +212 -0
- package/dist/person-data.js +162 -0
- package/dist/person-locations.d.ts +54 -0
- package/dist/person-locations.js +6 -0
- package/dist/person-messaging.d.ts +405 -0
- package/dist/person-messaging.js +112 -0
- package/dist/person-notifications.d.ts +319 -0
- package/dist/person-notifications.js +164 -0
- package/dist/personalisation.d.ts +21 -0
- package/dist/personalisation.js +8 -0
- package/dist/platform.d.ts +63 -0
- package/dist/platform.js +45 -0
- package/dist/portfolio.d.ts +163 -0
- package/dist/portfolio.js +28 -0
- package/dist/pos.d.ts +743 -0
- package/dist/pos.js +129 -0
- package/dist/procurement.d.ts +664 -0
- package/dist/procurement.js +157 -0
- package/dist/promotions.d.ts +169 -0
- package/dist/promotions.js +39 -0
- package/dist/publications.d.ts +583 -0
- package/dist/publications.js +164 -0
- package/dist/ranking.d.ts +43 -0
- package/dist/ranking.js +34 -0
- package/dist/ratings.d.ts +293 -0
- package/dist/ratings.js +109 -0
- package/dist/reactions.d.ts +123 -0
- package/dist/reactions.js +41 -0
- package/dist/recipient-orders.d.ts +294 -0
- package/dist/recipient-orders.js +73 -0
- package/dist/relationships.d.ts +18 -0
- package/dist/relationships.js +8 -0
- package/dist/reporting.d.ts +107 -0
- package/dist/reporting.js +56 -0
- package/dist/sales.d.ts +270 -0
- package/dist/sales.js +66 -0
- package/dist/shares.d.ts +105 -0
- package/dist/shares.js +27 -0
- package/dist/shop.d.ts +993 -0
- package/dist/shop.js +215 -0
- package/dist/shopping-assistant.d.ts +65 -0
- package/dist/shopping-assistant.js +14 -0
- package/dist/spaces.d.ts +422 -0
- package/dist/spaces.js +118 -0
- package/dist/stored-value.d.ts +754 -0
- package/dist/stored-value.js +177 -0
- package/dist/types.d.ts +83 -0
- package/dist/types.js +2 -0
- package/dist/vault.d.ts +290 -0
- package/dist/vault.js +55 -0
- package/dist/vertical-runtime.d.ts +17 -0
- package/dist/vertical-runtime.js +8 -0
- package/dist/vite/build-manifest-plugin.d.ts +42 -0
- package/dist/vite/build-manifest-plugin.js +42 -0
- package/dist/vite/first-paint-plugin.d.ts +26 -0
- package/dist/vite/first-paint-plugin.js +57 -0
- package/dist/wishlists.d.ts +591 -0
- package/dist/wishlists.js +188 -0
- package/dist/workbench.d.ts +114 -0
- package/dist/workbench.js +22 -0
- package/dist/workspace.d.ts +190 -0
- package/dist/workspace.js +41 -0
- package/package.json +52 -4
- package/templates/extension-image.Dockerfile +38 -0
- package/templates/nuwah-vertical.yml +102 -0
- package/templates/vertical-app/.env.example +34 -0
- package/templates/vertical-app/README.md +108 -0
- package/templates/vertical-app/github/workflows/ci.yml +51 -0
- package/templates/vertical-app/gitignore +5 -0
- package/templates/vertical-app/index.html +12 -0
- package/templates/vertical-app/package.json +28 -0
- package/templates/vertical-app/src/App.tsx +64 -0
- package/templates/vertical-app/src/blueprint/blueprint.ts +45 -0
- package/templates/vertical-app/src/blueprint/screens.ts +15 -0
- package/templates/vertical-app/src/env.d.ts +18 -0
- package/templates/vertical-app/src/index.css +139 -0
- package/templates/vertical-app/src/lib/i18n.ts +5 -0
- package/templates/vertical-app/src/lib/iam.ts +19 -0
- package/templates/vertical-app/src/lib/operations.ts +93 -0
- package/templates/vertical-app/src/lib/router.ts +24 -0
- package/templates/vertical-app/src/lib/sdk.ts +21 -0
- package/templates/vertical-app/src/lib/theme.ts +18 -0
- package/templates/vertical-app/src/lib/words.ts +39 -0
- package/templates/vertical-app/src/main.tsx +25 -0
- package/templates/vertical-app/src/pages/AppScreens.tsx +71 -0
- package/templates/vertical-app/src/pages/AuthCallback.tsx +44 -0
- package/templates/vertical-app/src/pages/Home.tsx +36 -0
- package/templates/vertical-app/tsconfig.json +24 -0
- package/templates/vertical-app/vite.config.ts +23 -0
- package/templates/vertical-ci.yml +192 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Semgrep rules for Nuwah vertical repositories, seeded as
|
|
2
|
+
# .semgrep/nuwah-vertical.yml and run by vertical-ci.yml with --error.
|
|
3
|
+
#
|
|
4
|
+
# These complement nuwah-contract-check (imports, SDK-only HTTP, known operations, adapter
|
|
5
|
+
# registration): semgrep catches dangerous CODE shapes the import graph cannot see.
|
|
6
|
+
#
|
|
7
|
+
# Source of truth: @nuwah/vertical-sdk/templates/nuwah-vertical.yml.
|
|
8
|
+
rules:
|
|
9
|
+
- id: nuwah-no-eval
|
|
10
|
+
languages: [typescript, javascript]
|
|
11
|
+
severity: ERROR
|
|
12
|
+
message: Code built from strings at run time cannot be checked. Remove eval / new Function.
|
|
13
|
+
pattern-either:
|
|
14
|
+
- pattern: eval(...)
|
|
15
|
+
- pattern: new Function(...)
|
|
16
|
+
- pattern: setTimeout("...", ...)
|
|
17
|
+
- pattern: setInterval("...", ...)
|
|
18
|
+
|
|
19
|
+
- id: nuwah-no-child-process
|
|
20
|
+
languages: [typescript, javascript]
|
|
21
|
+
severity: ERROR
|
|
22
|
+
message: Extensions may not start processes.
|
|
23
|
+
pattern-either:
|
|
24
|
+
- pattern: require("child_process")
|
|
25
|
+
- pattern: require("node:child_process")
|
|
26
|
+
- pattern: import "child_process"
|
|
27
|
+
- pattern: import "node:child_process"
|
|
28
|
+
|
|
29
|
+
- id: nuwah-no-raw-html
|
|
30
|
+
languages: [typescript, javascript]
|
|
31
|
+
severity: ERROR
|
|
32
|
+
message: Raw HTML injection opens cross-site scripting. Render text or use @nuwah/ui components.
|
|
33
|
+
pattern-either:
|
|
34
|
+
- pattern: $ELEMENT.innerHTML = $VALUE
|
|
35
|
+
- pattern: $ELEMENT.outerHTML = $VALUE
|
|
36
|
+
- pattern: document.write(...)
|
|
37
|
+
- pattern: $ELEMENT.insertAdjacentHTML(...)
|
|
38
|
+
|
|
39
|
+
- id: nuwah-no-raw-html-attribute
|
|
40
|
+
languages: [generic]
|
|
41
|
+
paths:
|
|
42
|
+
include: ['*.tsx', '*.jsx']
|
|
43
|
+
severity: ERROR
|
|
44
|
+
message: The innerHTML attribute injects raw HTML. Render text or use @nuwah/ui components.
|
|
45
|
+
pattern: innerHTML={...}
|
|
46
|
+
|
|
47
|
+
- id: nuwah-no-token-in-web-storage
|
|
48
|
+
languages: [typescript, javascript]
|
|
49
|
+
severity: ERROR
|
|
50
|
+
message: Tokens never go into web storage. The SDK holds the session.
|
|
51
|
+
patterns:
|
|
52
|
+
- pattern-either:
|
|
53
|
+
- pattern: localStorage.setItem($KEY, ...)
|
|
54
|
+
- pattern: sessionStorage.setItem($KEY, ...)
|
|
55
|
+
- metavariable-regex:
|
|
56
|
+
metavariable: $KEY
|
|
57
|
+
regex: (?i).*(token|secret|password|bearer|jwt).*
|
|
58
|
+
|
|
59
|
+
- id: nuwah-no-cookie-access
|
|
60
|
+
languages: [typescript, javascript]
|
|
61
|
+
severity: ERROR
|
|
62
|
+
message: Extensions do not read or write cookies.
|
|
63
|
+
pattern: document.cookie
|
|
64
|
+
|
|
65
|
+
- id: nuwah-no-wildcard-post-message
|
|
66
|
+
languages: [typescript, javascript]
|
|
67
|
+
severity: ERROR
|
|
68
|
+
message: postMessage to "*" lets any page read the message. Name the target origin.
|
|
69
|
+
pattern: $TARGET.postMessage($MESSAGE, "*")
|
|
70
|
+
|
|
71
|
+
- id: nuwah-no-environment-in-app
|
|
72
|
+
languages: [typescript, javascript]
|
|
73
|
+
paths:
|
|
74
|
+
include: ['app/src/**']
|
|
75
|
+
severity: ERROR
|
|
76
|
+
message: Browser code must not read process.env; anything in it ships to every visitor.
|
|
77
|
+
pattern: process.env
|
|
78
|
+
|
|
79
|
+
- id: nuwah-no-filesystem-writes
|
|
80
|
+
languages: [typescript, javascript]
|
|
81
|
+
paths:
|
|
82
|
+
include: ['app/src/extensions/**', 'server/src/extensions/**']
|
|
83
|
+
severity: ERROR
|
|
84
|
+
message: Extensions do not write to the server's filesystem. Use the platform's file APIs through the SDK.
|
|
85
|
+
pattern-either:
|
|
86
|
+
- pattern: $FS.writeFile(...)
|
|
87
|
+
- pattern: $FS.writeFileSync(...)
|
|
88
|
+
- pattern: $FS.appendFile(...)
|
|
89
|
+
- pattern: $FS.appendFileSync(...)
|
|
90
|
+
- pattern: $FS.rm(...)
|
|
91
|
+
- pattern: $FS.rmSync(...)
|
|
92
|
+
- pattern: $FS.unlink(...)
|
|
93
|
+
- pattern: $FS.unlinkSync(...)
|
|
94
|
+
|
|
95
|
+
- id: nuwah-no-disabled-tls
|
|
96
|
+
languages: [typescript, javascript]
|
|
97
|
+
severity: ERROR
|
|
98
|
+
message: Never turn off certificate checks.
|
|
99
|
+
pattern-either:
|
|
100
|
+
- pattern: process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
|
|
101
|
+
- pattern: |
|
|
102
|
+
{ ..., rejectUnauthorized: false, ... }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ─── Your Nuwah vertical app — environment ───────────────────────────────────
|
|
2
|
+
# Copy to `.env` for local development. Nothing in this file is a secret: an OAuth
|
|
3
|
+
# client id is public (the app is a PKCE public client), and the blueprint token
|
|
4
|
+
# below is read by the command-line tool only, never bundled into the app.
|
|
5
|
+
|
|
6
|
+
# IAM, the one sign-in authority for the whole platform.
|
|
7
|
+
VITE_IAM_URL=http://localhost:8070
|
|
8
|
+
|
|
9
|
+
# YOUR OAuth client (developer console → OAuth clients). Register a public client
|
|
10
|
+
# whose redirect URI is http://localhost:5600/auth/callback, and paste its id here.
|
|
11
|
+
VITE_IAM_CLIENT_ID=
|
|
12
|
+
|
|
13
|
+
# Scopes asked for at sign-in. `openid profile email` is enough to sign in.
|
|
14
|
+
VITE_IAM_SCOPES="openid profile email"
|
|
15
|
+
|
|
16
|
+
# Nuwah Core. Leave EMPTY in local development: the app calls same-origin `/api/...`
|
|
17
|
+
# and the Vite dev server forwards it to VITE_CORE_PROXY_TARGET.
|
|
18
|
+
VITE_CORE_API_URL=
|
|
19
|
+
VITE_CORE_PROXY_TARGET=http://localhost:8090
|
|
20
|
+
|
|
21
|
+
# The port the dev server listens on. Must match your OAuth client's redirect URI.
|
|
22
|
+
VITE_PORT=5600
|
|
23
|
+
|
|
24
|
+
# Staff screens act inside ONE organisation: its id, sent as X-Active-Org. Leave it
|
|
25
|
+
# empty when the app has only person and public screens. Not a secret.
|
|
26
|
+
VITE_ORGANISATION_ID=
|
|
27
|
+
|
|
28
|
+
# ─── The blueprint command-line tool (`npx @nuwah/blueprint`) ────────────────
|
|
29
|
+
# NOT read by the app. Set these in your shell or your CI secrets, not in `.env`
|
|
30
|
+
# files you commit: NUWAH_BLUEPRINT_TOKEN is a machine token (developer console →
|
|
31
|
+
# your blueprint → Take your app with you → Machine tokens).
|
|
32
|
+
# NUWAH_API_URL=http://localhost:8090
|
|
33
|
+
# NUWAH_BLUEPRINT_ID=
|
|
34
|
+
# NUWAH_BLUEPRINT_TOKEN=
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Your Nuwah vertical app
|
|
2
|
+
|
|
3
|
+
A starter project generated from your blueprint. You downloaded it from the developer console
|
|
4
|
+
(**your blueprint → Take your app with you → Download as a starter project**). It is a normal
|
|
5
|
+
Vite + Solid app: put it in your own git repository and change anything you like.
|
|
6
|
+
|
|
7
|
+
| File | What it is |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `nuwah.blueprint.json` | your blueprint as an export document (`nuwah.blueprint-export.v1`). The developer portal publishes its JSON Schema, so most editors check it as you type. |
|
|
10
|
+
| `src/screens/*Screen.tsx` | **generated, then yours:** one file per composed screen. Each holds the screen as the builder composed it (its blocks, the published operation each block uses, the fields it shows) and draws it with `ComposedScreen` from `@nuwah/ui`. |
|
|
11
|
+
| `src/blueprint/screens.ts` | generated: the list of screens the navigation opens, each loaded when first shown |
|
|
12
|
+
| `src/blueprint/blueprint.ts` | generated: the app's key, modules, navigation, brand colours, and every word the blueprint declares, in English and Arabic |
|
|
13
|
+
| `src/lib/operations.ts` | how a screen reads and writes: each block calls its published operation through `@nuwah/vertical-sdk`, with the signed-in person's own token |
|
|
14
|
+
| `src/lib/router.ts` | a small router: each screen lives at `/<screen key>` |
|
|
15
|
+
| `src/lib/iam.ts` | sign-in through IAM with **your own OAuth client** (PKCE, no secret) |
|
|
16
|
+
| `src/lib/sdk.ts` | the typed Nuwah Core client (`@nuwah/vertical-sdk`) |
|
|
17
|
+
| `src/lib/i18n.ts`, `src/lib/theme.ts`, `src/lib/words.ts` | English and Arabic with right to left, light and dark, and `word(key)` for every label |
|
|
18
|
+
| `.github/workflows/ci.yml` | CI: install, typecheck, build, and the blueprint check when a machine token is set |
|
|
19
|
+
|
|
20
|
+
## Install the packages
|
|
21
|
+
|
|
22
|
+
The app depends on four Nuwah packages: `@nuwah/ui`, `@nuwah/vertical-sdk`, `@nuwah/iam-client`
|
|
23
|
+
and (for the blueprint commands) `@nuwah/blueprint`. They come from npm, like any other package:
|
|
24
|
+
`npm install` resolves the ranges already in `package.json`.
|
|
25
|
+
|
|
26
|
+
## Run it
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cp .env.example .env # then set VITE_IAM_CLIENT_ID (and VITE_ORGANISATION_ID for staff screens)
|
|
30
|
+
npm install
|
|
31
|
+
npm run dev # http://localhost:5600
|
|
32
|
+
npm run typecheck && npm run build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`VITE_IAM_CLIENT_ID` is the id of a public OAuth client you register in the developer console
|
|
36
|
+
under **OAuth clients**, with the redirect URI `http://localhost:5600/auth/callback`. If you chose
|
|
37
|
+
one when you downloaded the project, it is already in `.env.example`. No value in `.env.example`
|
|
38
|
+
is a secret.
|
|
39
|
+
|
|
40
|
+
## Screens
|
|
41
|
+
|
|
42
|
+
Each composed screen is a file in `src/screens/`. The constant at the top is the screen as the
|
|
43
|
+
builder composed it; the component draws it live:
|
|
44
|
+
|
|
45
|
+
- **Lists** call their operation with the declared list wire (`sort`, `filter[…]`, `limit`,
|
|
46
|
+
`search`, `cursor`), so sorting, filters, search and "load more" work as in the builder preview.
|
|
47
|
+
- **Forms and row actions** call their operation's method and path; `{id}` in a path is filled
|
|
48
|
+
from the row. A write the platform marks idempotent carries an `Idempotency-Key`.
|
|
49
|
+
- **Staff screens** act inside one organisation: set `VITE_ORGANISATION_ID`. The signed-in person
|
|
50
|
+
needs the permission each operation declares, exactly as in any other Nuwah app.
|
|
51
|
+
- **Person blocks** (wishlist, wallet, cart, shopping assistant, catalogue browsing) draw the
|
|
52
|
+
signed-in person's own records from a `PersonBlockHost` (see `@nuwah/ui/solid/composer`). The
|
|
53
|
+
starter does not wire one, so those blocks say they are unavailable until you pass `person` to
|
|
54
|
+
`ComposedScreen`.
|
|
55
|
+
- **Navigation entries that open a module's own pages** (a pack such as the catalogue or the
|
|
56
|
+
public page) are not composed screens, so the starter leaves them out of the bar.
|
|
57
|
+
|
|
58
|
+
Change a screen freely: edit the constant, replace a block with your own component, or drop
|
|
59
|
+
`ComposedScreen` and write the page by hand. Every call still goes through `src/lib/sdk.ts`.
|
|
60
|
+
|
|
61
|
+
## Build and deploy
|
|
62
|
+
|
|
63
|
+
`npm run build` writes a static site to `dist/`. Serve it from any static host (an object store
|
|
64
|
+
behind a CDN, nginx, a container). Two settings change for production:
|
|
65
|
+
|
|
66
|
+
- `VITE_CORE_API_URL`: Nuwah Core's public address (in development it is empty and the dev
|
|
67
|
+
server forwards `/api`);
|
|
68
|
+
- your OAuth client's redirect URI: add the production `https://…/auth/callback`.
|
|
69
|
+
|
|
70
|
+
The host must answer every path with `index.html` (a single-page app), so `/orders` opens the
|
|
71
|
+
Orders screen after a reload.
|
|
72
|
+
|
|
73
|
+
## Sync changes back through the Blueprint API
|
|
74
|
+
|
|
75
|
+
The blueprint stays the platform's source of truth, and the builder still reviews every change.
|
|
76
|
+
The `@nuwah/blueprint` command-line tool uses the Blueprint API (`/api/builder/blueprints/{id}/…`):
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export NUWAH_API_URL=http://localhost:8090
|
|
80
|
+
export NUWAH_BLUEPRINT_TOKEN=nwbp_... # a machine token (console → Machine tokens); keep it out of git
|
|
81
|
+
|
|
82
|
+
npm run blueprint:validate # the builder's own validator: issues and what is still needed
|
|
83
|
+
npm run blueprint:diff # which sections differ from the current version
|
|
84
|
+
npm run blueprint:submit # sends the change as a proposal; confirm it in the builder studio
|
|
85
|
+
npx nuwah-blueprint export # fetch the current version into nuwah.blueprint.json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The same calls with curl:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
curl -H "Authorization: Bearer $NUWAH_BLUEPRINT_TOKEN" "$NUWAH_API_URL/api/builder/blueprints/<id>/export"
|
|
92
|
+
jq '{document: .}' nuwah.blueprint.json | curl -X POST -H "Authorization: Bearer $NUWAH_BLUEPRINT_TOKEN" \
|
|
93
|
+
-H "Content-Type: application/json" --data @- "$NUWAH_API_URL/api/builder/blueprints/<id>/validate"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
A submission is a proposal, exactly like one the assistant makes: nothing changes until you
|
|
97
|
+
confirm it in the studio. It names the version it was made from; if the blueprint moved on, the
|
|
98
|
+
tool says so and you `export` again before resubmitting. The generated files
|
|
99
|
+
(`src/blueprint/*`, `src/screens/*`) do not update themselves: download a new starter project and
|
|
100
|
+
compare, or edit them by hand.
|
|
101
|
+
|
|
102
|
+
## Its own repository (level 3)
|
|
103
|
+
|
|
104
|
+
When the blocks are not enough, the console can move the app to custom code: the platform makes a
|
|
105
|
+
private git repository for it (protected `main`, CI on every push, a code review before
|
|
106
|
+
production) and you can download it with its full history as a git bundle at any time. That is
|
|
107
|
+
the platform-run path; this starter project is the path where you run the app yourself. The
|
|
108
|
+
developer portal guide **Take your app with you** compares them.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# CI for a Nuwah starter project: install, typecheck, build, and (when a machine token is set)
|
|
2
|
+
# check the blueprint file with the builder's own validator. Runs on every push and pull request.
|
|
3
|
+
#
|
|
4
|
+
# The blueprint step needs the variable NUWAH_API_URL and the secret NUWAH_BLUEPRINT_TOKEN (a
|
|
5
|
+
# machine token with the read permission; developer console → your blueprint → Take your app
|
|
6
|
+
# with you → Machine tokens). Without them the step is skipped, never failed.
|
|
7
|
+
name: ci
|
|
8
|
+
|
|
9
|
+
on:
|
|
10
|
+
push:
|
|
11
|
+
pull_request:
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: ci-${{ github.ref }}
|
|
18
|
+
cancel-in-progress: true
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
build:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
timeout-minutes: 15
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
|
|
27
|
+
- uses: actions/setup-node@v4
|
|
28
|
+
with:
|
|
29
|
+
node-version: 22
|
|
30
|
+
|
|
31
|
+
- name: Install
|
|
32
|
+
run: |
|
|
33
|
+
if [ -f package-lock.json ]; then npm ci; else npm install; fi
|
|
34
|
+
|
|
35
|
+
- name: Typecheck
|
|
36
|
+
run: npm run typecheck
|
|
37
|
+
|
|
38
|
+
- name: Build
|
|
39
|
+
run: npm run build
|
|
40
|
+
|
|
41
|
+
- name: Validate the blueprint file
|
|
42
|
+
if: ${{ vars.NUWAH_API_URL != '' }}
|
|
43
|
+
run: |
|
|
44
|
+
if [ -z "$NUWAH_BLUEPRINT_TOKEN" ]; then
|
|
45
|
+
echo "NUWAH_BLUEPRINT_TOKEN is not set; skipping the blueprint check."
|
|
46
|
+
exit 0
|
|
47
|
+
fi
|
|
48
|
+
npm run blueprint:validate
|
|
49
|
+
env:
|
|
50
|
+
NUWAH_API_URL: ${{ vars.NUWAH_API_URL }}
|
|
51
|
+
NUWAH_BLUEPRINT_TOKEN: ${{ secrets.NUWAH_BLUEPRINT_TOKEN }}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" dir="ltr">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Your Nuwah app</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nuwah-vertical-app",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "A Nuwah vertical app started from the builder's app template: Solid, @nuwah/ui (English and Arabic, right to left, light and dark), IAM sign-in through your own OAuth client, and @nuwah/vertical-sdk.",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"typecheck": "tsc --noEmit",
|
|
11
|
+
"preview": "vite preview",
|
|
12
|
+
"blueprint:validate": "nuwah-blueprint validate nuwah.blueprint.json",
|
|
13
|
+
"blueprint:diff": "nuwah-blueprint diff nuwah.blueprint.json",
|
|
14
|
+
"blueprint:submit": "nuwah-blueprint submit nuwah.blueprint.json"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@nuwah/iam-client": "^0.2.0-rc.1",
|
|
18
|
+
"@nuwah/ui": "^0.2.0-rc.1",
|
|
19
|
+
"@nuwah/vertical-sdk": "^0.2.0-rc.1",
|
|
20
|
+
"solid-js": "^1.9.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@nuwah/blueprint": "^0.2.0-rc.1",
|
|
24
|
+
"typescript": "^5.7.2",
|
|
25
|
+
"vite": "^6.0.0",
|
|
26
|
+
"vite-plugin-solid": "^2.11.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createEffect, onMount, Show } from 'solid-js';
|
|
2
|
+
import { Button } from '@nuwah/ui/solid/Button';
|
|
3
|
+
import { Callout } from '@nuwah/ui/solid/Callout';
|
|
4
|
+
import { dir, locale, toggleLanguage } from './lib/i18n';
|
|
5
|
+
import { clientConfigured, initiateLogin, isSignedIn, ready, signOut, startAuth, unavailable } from './lib/iam';
|
|
6
|
+
import { theme, toggleTheme } from './lib/theme';
|
|
7
|
+
import { word } from './lib/words';
|
|
8
|
+
import AppScreens from './pages/AppScreens';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The app shell: the blueprint's name, the language and theme switches, and sign-in. Everything
|
|
12
|
+
* the person reads comes from the blueprint's words (`word('app.name')`, `word('nav.home')`, …).
|
|
13
|
+
*/
|
|
14
|
+
export default function App() {
|
|
15
|
+
onMount(() => {
|
|
16
|
+
void startAuth();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
createEffect(() => {
|
|
20
|
+
document.documentElement.lang = locale();
|
|
21
|
+
document.documentElement.dir = dir();
|
|
22
|
+
document.title = word('app.name');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div class="app-shell">
|
|
27
|
+
<header class="app-shell__bar">
|
|
28
|
+
<strong class="app-shell__name"><bdi>{word('app.name')}</bdi></strong>
|
|
29
|
+
<div class="app-shell__actions">
|
|
30
|
+
<Button variant="ghost" size="sm" onClick={toggleLanguage}>{word('interface.other_language')}</Button>
|
|
31
|
+
<Button variant="ghost" size="sm" onClick={toggleTheme}>
|
|
32
|
+
{theme.resolvedTheme() === 'dark' ? word('interface.light_theme') : word('interface.dark_theme')}
|
|
33
|
+
</Button>
|
|
34
|
+
<Show when={isSignedIn()}>
|
|
35
|
+
<Button variant="secondary" size="sm" onClick={() => signOut()}>{word('interface.sign_out')}</Button>
|
|
36
|
+
</Show>
|
|
37
|
+
</div>
|
|
38
|
+
</header>
|
|
39
|
+
|
|
40
|
+
<main class="app-shell__main">
|
|
41
|
+
<Show when={!clientConfigured()}>
|
|
42
|
+
<Callout tone="warning">{word('interface.client_missing')}</Callout>
|
|
43
|
+
</Show>
|
|
44
|
+
<Show when={unavailable()}>
|
|
45
|
+
<Callout tone="danger">{word('interface.unavailable')}</Callout>
|
|
46
|
+
</Show>
|
|
47
|
+
<Show
|
|
48
|
+
when={isSignedIn()}
|
|
49
|
+
fallback={
|
|
50
|
+
<section class="app-welcome">
|
|
51
|
+
<h1 class="app-welcome__title"><bdi>{word('app.name')}</bdi></h1>
|
|
52
|
+
<p class="app-welcome__tagline" dir="auto">{word('app.tagline', '')}</p>
|
|
53
|
+
<Button disabled={!ready() || !clientConfigured()} onClick={() => void initiateLogin({ returnTo: '/' })}>
|
|
54
|
+
{word('interface.sign_in')}
|
|
55
|
+
</Button>
|
|
56
|
+
</section>
|
|
57
|
+
}
|
|
58
|
+
>
|
|
59
|
+
<AppScreens />
|
|
60
|
+
</Show>
|
|
61
|
+
</main>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED from your blueprint when you download the app template. Regenerate it by downloading
|
|
3
|
+
* the template again; change the blueprint (in the builder, or in `nuwah.blueprint.json` followed
|
|
4
|
+
* by `npm run blueprint:submit`) rather than this file.
|
|
5
|
+
*
|
|
6
|
+
* `words` holds every name and word the blueprint declares, in English and Arabic: the app's
|
|
7
|
+
* name and tagline, its navigation, its roles and its vocabulary. The app shows these, never
|
|
8
|
+
* words of its own, so the blueprint stays the one place an app's language is decided.
|
|
9
|
+
*/
|
|
10
|
+
import type { Bilingual } from '@nuwah/ui/i18n/solid-store';
|
|
11
|
+
|
|
12
|
+
export interface BlueprintNavigationEntry {
|
|
13
|
+
key: string;
|
|
14
|
+
word: string;
|
|
15
|
+
/** The composed screen it opens, or null for a module's own pages. */
|
|
16
|
+
screen: string | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface BlueprintApp {
|
|
20
|
+
key: string;
|
|
21
|
+
blueprintId: string | null;
|
|
22
|
+
version: number;
|
|
23
|
+
primaryLanguage: 'en' | 'ar' | null;
|
|
24
|
+
branding: { primaryColor: string | null; accentColor: string | null };
|
|
25
|
+
modules: string[];
|
|
26
|
+
navigation: BlueprintNavigationEntry[];
|
|
27
|
+
roles: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const blueprintApp: BlueprintApp = {
|
|
31
|
+
key: 'sample-app',
|
|
32
|
+
blueprintId: null,
|
|
33
|
+
version: 1,
|
|
34
|
+
primaryLanguage: null,
|
|
35
|
+
branding: { primaryColor: '#0F766E', accentColor: null },
|
|
36
|
+
modules: [],
|
|
37
|
+
navigation: [{ key: 'home', word: 'nav.home', screen: null }],
|
|
38
|
+
roles: [],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const words: Record<string, Bilingual> = {
|
|
42
|
+
'app.name': { en: 'Sample app', ar: 'تطبيق تجريبي' },
|
|
43
|
+
'app.tagline': { en: 'Started from the Nuwah app template', ar: 'بدأ من قالب تطبيقات نواة' },
|
|
44
|
+
'nav.home': { en: 'Home', ar: 'الرئيسية' },
|
|
45
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stand-in so the template itself typechecks. The starter project you download replaces this
|
|
3
|
+
* file with your blueprint's composed screens (one `src/screens/<Name>Screen.tsx` each).
|
|
4
|
+
*/
|
|
5
|
+
import type { Component } from 'solid-js';
|
|
6
|
+
import type { Bilingual } from '@nuwah/ui/i18n/solid-store';
|
|
7
|
+
|
|
8
|
+
export interface BlueprintScreen {
|
|
9
|
+
key: string;
|
|
10
|
+
audience: 'staff' | 'public' | 'person';
|
|
11
|
+
title: Bilingual;
|
|
12
|
+
component: Component;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const screens: BlueprintScreen[] = [];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
/** IAM base URL, for example http://localhost:8070. */
|
|
5
|
+
readonly VITE_IAM_URL: string;
|
|
6
|
+
/** Your OAuth client id (developer console → OAuth clients). */
|
|
7
|
+
readonly VITE_IAM_CLIENT_ID: string;
|
|
8
|
+
/** Space-separated OAuth scopes. */
|
|
9
|
+
readonly VITE_IAM_SCOPES: string;
|
|
10
|
+
/** Nuwah Core base URL; empty in development (the dev server proxies `/api`). */
|
|
11
|
+
readonly VITE_CORE_API_URL?: string;
|
|
12
|
+
/** The organisation staff screens act in (sent as X-Active-Org); empty for person and public screens. */
|
|
13
|
+
readonly VITE_ORGANISATION_ID?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ImportMeta {
|
|
17
|
+
readonly env: ImportMetaEnv;
|
|
18
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The platform's design tokens and its light and dark themes, so every @nuwah/ui component and
|
|
3
|
+
* this shell re-theme from the same variables. Logical properties only (inline-start, not left),
|
|
4
|
+
* so Arabic mirrors without a second stylesheet.
|
|
5
|
+
*/
|
|
6
|
+
@import '@nuwah/ui/tokens/colors.css';
|
|
7
|
+
@import '@nuwah/ui/tokens/spacing.css';
|
|
8
|
+
@import '@nuwah/ui/tokens/typography.css';
|
|
9
|
+
@import '@nuwah/ui/tokens/radius.css';
|
|
10
|
+
@import '@nuwah/ui/tokens/shadows.css';
|
|
11
|
+
@import '@nuwah/ui/tokens/motion.css';
|
|
12
|
+
@import '@nuwah/ui/tokens/zindex.css';
|
|
13
|
+
@import '@nuwah/ui/styles/themes.css';
|
|
14
|
+
|
|
15
|
+
*,
|
|
16
|
+
*::before,
|
|
17
|
+
*::after {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
body {
|
|
22
|
+
margin: 0;
|
|
23
|
+
min-block-size: 100dvh;
|
|
24
|
+
background: var(--color-background, var(--color-surface));
|
|
25
|
+
color: var(--color-text);
|
|
26
|
+
font-family: var(--font-sans, system-ui, sans-serif);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.app-shell__bar {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
gap: 0.75rem;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
padding-block: 0.75rem;
|
|
36
|
+
padding-inline: 1rem;
|
|
37
|
+
border-block-end: 1px solid var(--color-border);
|
|
38
|
+
background: var(--color-surface);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.app-shell__name {
|
|
42
|
+
font-size: 1.125rem;
|
|
43
|
+
color: var(--color-primary);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.app-shell__actions {
|
|
47
|
+
display: flex;
|
|
48
|
+
gap: 0.5rem;
|
|
49
|
+
flex-wrap: wrap;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.app-shell__main {
|
|
53
|
+
max-inline-size: 64rem;
|
|
54
|
+
margin-inline: auto;
|
|
55
|
+
padding: 1.5rem 1rem;
|
|
56
|
+
display: grid;
|
|
57
|
+
gap: 1rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.app-welcome {
|
|
61
|
+
display: grid;
|
|
62
|
+
justify-items: start;
|
|
63
|
+
gap: 0.75rem;
|
|
64
|
+
padding-block: 3rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.app-welcome__title,
|
|
68
|
+
.app-home__title {
|
|
69
|
+
margin: 0;
|
|
70
|
+
font-size: clamp(1.5rem, 4vw, 2.25rem);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.app-welcome__tagline,
|
|
74
|
+
.app-home__muted {
|
|
75
|
+
margin: 0;
|
|
76
|
+
color: var(--color-text-muted, var(--color-text));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.app-home {
|
|
80
|
+
display: grid;
|
|
81
|
+
gap: 1rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.app-home__grid {
|
|
85
|
+
display: grid;
|
|
86
|
+
gap: 0.75rem;
|
|
87
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.app-callback {
|
|
91
|
+
display: grid;
|
|
92
|
+
place-content: center;
|
|
93
|
+
gap: 0.75rem;
|
|
94
|
+
min-block-size: 100dvh;
|
|
95
|
+
padding: 1rem;
|
|
96
|
+
text-align: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.app-screens {
|
|
100
|
+
display: grid;
|
|
101
|
+
gap: 1rem;
|
|
102
|
+
min-inline-size: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* The navigation wraps instead of scrolling the page sideways at 320px. */
|
|
106
|
+
.app-screens__nav {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-wrap: wrap;
|
|
109
|
+
gap: 0.25rem;
|
|
110
|
+
padding: 0.25rem;
|
|
111
|
+
border: 1px solid var(--color-border);
|
|
112
|
+
border-radius: var(--radius-lg, 0.75rem);
|
|
113
|
+
background: var(--color-surface);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.app-screens__link {
|
|
117
|
+
display: inline-flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
min-block-size: 2.75rem;
|
|
120
|
+
padding-inline: 0.875rem;
|
|
121
|
+
border-radius: var(--radius-md, 0.5rem);
|
|
122
|
+
color: var(--color-text);
|
|
123
|
+
text-decoration: none;
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.app-screens__link:hover {
|
|
128
|
+
background: var(--color-surface-hover, var(--color-background));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.app-screens__link:focus-visible {
|
|
132
|
+
outline: 2px solid var(--color-primary);
|
|
133
|
+
outline-offset: 2px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.app-screens__link[aria-current='page'] {
|
|
137
|
+
background: var(--color-primary);
|
|
138
|
+
color: var(--color-on-primary, #fff);
|
|
139
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English and Arabic, from the platform's one locale store. The store follows the reader's
|
|
3
|
+
* choice and keeps `<html lang dir>` in step, so every @nuwah/ui component mirrors for Arabic.
|
|
4
|
+
*/
|
|
5
|
+
export { locale, dir, setLocale, toggle as toggleLanguage, translate, type Bilingual } from '@nuwah/ui/i18n/solid-store';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sign-in through IAM with YOUR OAuth client (PKCE, no secret), from the platform's shared auth
|
|
3
|
+
* store: the same engine every Nuwah app uses, configured by VITE_IAM_URL, VITE_IAM_CLIENT_ID
|
|
4
|
+
* and VITE_IAM_SCOPES.
|
|
5
|
+
*/
|
|
6
|
+
export {
|
|
7
|
+
iamUser as user,
|
|
8
|
+
iamAuthReady as ready,
|
|
9
|
+
iamAuthUnavailable as unavailable,
|
|
10
|
+
isIamAuthenticated as isSignedIn,
|
|
11
|
+
iamAccessToken as accessToken,
|
|
12
|
+
initIamAuth as startAuth,
|
|
13
|
+
initiateLogin,
|
|
14
|
+
handleIamCallback as completeSignIn,
|
|
15
|
+
logoutIamAuth as signOut,
|
|
16
|
+
} from '@nuwah/iam-client/stores/iam-auth';
|
|
17
|
+
|
|
18
|
+
/** True when the OAuth client id is set; without it sign-in cannot start. */
|
|
19
|
+
export const clientConfigured = (): boolean => (import.meta.env.VITE_IAM_CLIENT_ID ?? '').trim() !== '';
|