Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/ui-community/mock-oidc.users.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,29 @@
"family_name": "Owner",
"tid": "test-tenant-id"
}
},
{
"username": "member@test.example",
"sub": "aaaaaaaa-bbbb-1ccc-9ddd-eeeeeeeeee02",
"password": "password",
"oidcConfigName": "end-user",
"claims": {
"email": "member@test.example",
"given_name": "Test",
"family_name": "Member",
"tid": "test-tenant-id"
}
},
{
"username": "other.owner@test.example",
"sub": "aaaaaaaa-bbbb-1ccc-9ddd-eeeeeeeeee03",
"password": "password",
"oidcConfigName": "end-user",
"claims": {
"email": "other.owner@test.example",
"given_name": "Other",
"family_name": "Owner",
"tid": "test-tenant-id"
}
}
]
1 change: 1 addition & 0 deletions apps/ui-community/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@ocom/local-dev-config": "workspace:*",
"@ocom/ui-community-route-accounts": "workspace:*",
"@ocom/ui-community-route-admin": "workspace:*",
"@ocom/ui-community-route-member": "workspace:*",
"@ocom/ui-community-route-root": "workspace:*",
"@ocom/ui-community-shared": "workspace:*",
"antd": "catalog:",
Expand Down
5 changes: 5 additions & 0 deletions apps/ui-community/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { RequireAuth } from '@cellix/ui-core';
import { Accounts } from '@ocom/ui-community-route-accounts';
import { Admin } from '@ocom/ui-community-route-admin';
import { Member } from '@ocom/ui-community-route-member';
import { Root } from '@ocom/ui-community-route-root';
import { Route, Routes } from 'react-router-dom';
import './App.css';
Expand Down Expand Up @@ -31,6 +32,10 @@ export default function App() {
path="/:communityId/admin/:memberId/*"
element={<Admin />}
/>
<Route
path="/:communityId/member/:memberId/*"
element={<Member />}
/>
</Routes>
</RequireAuth>
);
Expand Down
15 changes: 15 additions & 0 deletions codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ generates:
- typescript-operations
- typed-document-node

# UI community member-route client types
'./packages/ocom/ui-community-route-member/src/generated.tsx':
documents:
- './packages/ocom/ui-community-route-member/src/**/**.graphql'
config:
withHooks: true
withHOC: false
withComponent: false
useTypeImports: true
enumsAsTypes: true
plugins:
- typescript
- typescript-operations
- typed-document-node

# UI community client types
'./packages/ocom/ui-community-route-accounts/src/generated.tsx':
documents:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
type MemberPropertyOperationStatus = 'SUCCESS' | 'REJECTED' | 'ERROR' | null;
type MemberPropertyReadStatus = 'FOUND' | 'MISSING' | 'ERROR' | null;

/** Scenario-local state for member Property API behavior. */
export interface MemberPropertyNotes {
activeCommunityId: string;
activeCommunityName: string;
actingMemberId: string;
managerMemberId: string;
foreignMemberId: string | null;
knownPropertyIds: Record<string, string>;
listedPropertyNames: string[];
directoryStatus: MemberPropertyOperationStatus;
directoryError: string | null;
lastOperationStatus: MemberPropertyOperationStatus;
lastOperationError: string | null;
lastReadStatus: MemberPropertyReadStatus;
lastReadError: string | null;
lastReadPropertyId: string | null;
baselinePropertyNames: string[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { GraphQLClient } from '@cellix/serenity-framework/clients/graphql';
import { type Actor, type AnswersQuestions, notes, Question, type UsesAbilities } from '@serenity-js/core';
import { PROPERTIES_BY_COMMUNITY_ID_QUERY, type PropertyResult } from '../../../shared/graphql/property-operations.ts';
import type { MemberPropertyNotes } from '../notes/member-property-notes.ts';

export const MemberPropertyOperationStatus = () => Question.about('the member Property operation status', async (actor) => await actor.answer(notes<MemberPropertyNotes>().get('lastOperationStatus')));

export const MemberPropertyOperationError = () => Question.about('the member Property operation error', async (actor) => await actor.answer(notes<MemberPropertyNotes>().get('lastOperationError')));

export const MemberPropertyDirectoryStatus = () => Question.about('the member Property directory status', async (actor) => await actor.answer(notes<MemberPropertyNotes>().get('directoryStatus')));

export const MemberPropertyDirectoryNames = () => Question.about('the member Property directory names', async (actor) => await actor.answer(notes<MemberPropertyNotes>().get('listedPropertyNames')));

export const MemberPropertyReadStatus = () => Question.about('the member Property read status', async (actor) => await actor.answer(notes<MemberPropertyNotes>().get('lastReadStatus')));

export const MemberPropertyReadError = () => Question.about('the member Property read error', async (actor) => await actor.answer(notes<MemberPropertyNotes>().get('lastReadError')));

/** Reads a property by name from the actor's active member Property community. */
export class MemberPropertyNamed extends Question<Promise<PropertyResult | undefined>> {
static called(propertyName: string): MemberPropertyNamed {
return new MemberPropertyNamed(propertyName);
}

private constructor(private readonly propertyName: string) {
super(`the member Property named "${propertyName}"`);
}

override async answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<PropertyResult | undefined> {
const communityId = await actor.answer(notes<MemberPropertyNotes>().get('activeCommunityId'));
if (!communityId) {
throw new Error('No active member Property community is available to query a property by name');
}
const response = await GraphQLClient.as(actor as unknown as Actor).execute(PROPERTIES_BY_COMMUNITY_ID_QUERY, { communityId });
const properties = response.data.propertiesByCommunityId as PropertyResult[];
return properties.find((property) => property.propertyName === this.propertyName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './member-property.steps.ts';
Loading
Loading