All files / realm/blong-party index.browser.ts

0% Statements 0/88
0% Branches 0/1
0% Functions 0/1
0% Lines 0/88

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89                                                                                                                                                                                 
import {browser} from '@feasibleone/blong';
import pkg from './package.json' with {type: 'json'};

export default browser(blong => ({
    url: import.meta.url,
    pkg: {
        name: pkg.name,
        version: pkg.version,
    },
    validation: blong.type.Object({
        party: blong.type.Object({}),
        access: blong.type.Object({}),
    }),
    children: [
        async function blong() {
            return import('@feasibleone/blong-realm/browser.ts');
        },
        async function ui() {
            return import('@feasibleone/blong-browser/browser.ts');
        },
        async function login() {
            return import('@feasibleone/blong-login/browser.ts');
        },
        async function party() {
            return import('./browser.ts');
        },
        /** blong-access browser realm — access.* subject namespace + the self-service profile page. */
        async function access() {
            return import('@feasibleone/blong-access/browser.ts');
        },
    ],
    config: {
        default: {
            ui: {
                portal: {
                    portal: {
                        title: 'Blong Party',
                        // Self-service profile: the top-right account menu opens
                        // the profile tab and fetches the caller's profile for the
                        // avatar (personal details live on party.person here).
                        profile: {
                            page: 'access.user.profile',
                            get: 'access.profile.get',
                        },
                    },
                    // Self-registration: Login's Register button dispatches
                    // component/user.selfRegistration (party component layer).
                    login: {registerPage: 'user.selfRegistration'},
                    // Google OAuth fallback (e.g. Storybook / offline).  The
                    // browser fetches the live config at runtime from the
                    // backend's `access.google.get` endpoint; this static mock
                    // only keeps the button visible and covers the no-backend case.
                    google: {
                        baseUrl: 'http://localhost:9082',
                        clientId: 'mock-client',
                        redirectUri: 'http://localhost:9101/s/oauth/callback',
                    },
                },
                auth: {
                    google: {
                        baseUrl: 'http://localhost:9082',
                        clientId: 'mock-client',
                        redirectUri: 'http://localhost:9101/s/oauth/callback',
                    },
                },
            },
            blong: {},
            login: {},
            party: {},
            access: {},
        },
        // TEST-ONLY: the `integration` intent (active for dev/test/Playwright
        // — the browser entry `index.html.ts` hardcodes `microservice
        // integration dev`) enables the test hook that exposes the wrapped
        // handler as `window.__blongHandler` so E2E tests can invoke server
        // methods directly. Production uses the `prod` intent — never
        // `integration` — so real deployments do not expose the handler.
        integration: {
            ui: {
                portal: {
                    portal: {
                        testHook: true,
                    },
                },
            },
        } as never,
    },
}));