@powerhousedao/academy 2.5.0-dev.4 → 2.5.0-dev.41

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/docs/academy/01-GetStarted/00-ExploreDemoPackage.md +19 -15
  3. package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +39 -40
  4. package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +22 -7
  5. package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +9 -4
  6. package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +146 -422
  7. package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +360 -0
  8. package/docs/academy/01-GetStarted/home.mdx +16 -24
  9. package/docs/academy/01-GetStarted/styles.module.css +31 -0
  10. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/01-Prerequisites.md +0 -18
  11. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/02-StandardDocumentModelWorkflow.md +10 -6
  12. package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +1 -1
  13. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/01-WhatIsADocumentModel.md +33 -16
  14. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +73 -0
  15. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +59 -4
  16. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +32 -12
  17. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +103 -38
  18. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +90 -228
  19. package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +41 -1
  20. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +342 -67
  21. package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/02-ConfiguringDrives.md +5 -3
  22. package/docs/academy/02-MasteryTrack/05-Launch/02-PublishYourProject.md +70 -5
  23. package/docs/academy/02-MasteryTrack/05-Launch/03-SetupEnvironment.md +162 -73
  24. package/docs/academy/02-MasteryTrack/05-Launch/{03-RunOnACloudServer.md → _03-RunOnACloudServer} +8 -5
  25. package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +10 -9
  26. package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +3 -4
  27. package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +1 -1
  28. package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
  29. package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +13 -49
  30. package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +3 -0
  31. package/docs/academy/05-Architecture/images/PowerhouseArchitecture.png +0 -0
  32. package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +85 -30
  33. package/docs/academy/06-ComponentLibrary/02-CreateCustomScalars.md +382 -0
  34. package/docs/academy/06-ComponentLibrary/03-IntegrateIntoAReactComponent.md +124 -0
  35. package/docs/academy/07-Cookbook.md +252 -4
  36. package/docs/academy/08-Glossary.md +20 -18
  37. package/docs/academy/09-AIResources +131 -0
  38. package/docusaurus.config.ts +4 -0
  39. package/package.json +1 -1
  40. package/sidebars.ts +3 -45
  41. package/src/css/custom.css +23 -1
  42. package/docs/academy/03-ExampleUsecases/Chatroom/01-SetupBuilderEnvironment.md +0 -216
  43. package/docs/academy/06-ComponentLibrary/02-BuildingWithScalars.md +0 -54
  44. package/docs/academy/06-ComponentLibrary/03-Scalar-Components/01-phid-field.mdx +0 -72
  45. package/docs/academy/06-ComponentLibrary/03-Scalar-Components/02-input-field.mdx +0 -0
  46. package/docs/academy/06-ComponentLibrary/04-Complex-Components/01-sidebar.mdx +0 -36
  47. package/docs/academy/06-ComponentLibrary/05-Layout-Components/01-test-toupdate.mdx +0 -61
  48. package/docs/academy/06-ComponentLibrary/06-Fragments/01-test-toupdate.mdx +0 -61
  49. /package/docs/academy/02-MasteryTrack/05-Launch/{02-IntroductionToPackages.md → 01-IntroductionToPackages.md} +0 -0
  50. /package/docs/academy/02-MasteryTrack/05-Launch/{00-IntegrateInAFront-End → _00-IntegrateInAFront-End} +0 -0
  51. /package/docs/academy/02-MasteryTrack/05-Launch/{01-IntroducingFusion → _01-IntroducingFusion} +0 -0
  52. /package/docs/academy/02-MasteryTrack/05-Launch/{04-GraphQLNamespacing → _04-GraphQLNamespacing} +0 -0
  53. /package/docs/academy/02-MasteryTrack/05-Launch/{05-LaunchYourBackend.md → _05-LaunchYourBackend} +0 -0
  54. /package/docs/academy/02-MasteryTrack/05-Launch/{06-LaunchYourFrontend.md → _06-LaunchYourFrontend} +0 -0
  55. /package/docs/academy/04-APIReferences/{01-ReactHooks.md → 01-ReactHooks} +0 -0
  56. /package/docs/academy/04-APIReferences/{02-ReactorAPI.md → 02-ReactorAPI} +0 -0
  57. /package/docs/academy/04-APIReferences/{03-Configuration.md → 03-Configuration} +0 -0
@@ -1,216 +0,0 @@
1
-
2
- # Setup Builder Environment
3
-
4
- Let's set up your computer to start building your first Document Model. Don't worry if this is your first time setting up a development environment - we'll guide you through each step!
5
-
6
- :::warning
7
- If you've already setup git, node, and npm, your most important step is to install the Powerhouse CLI with the command `npm install ph-cmd`. A global install is recommended if you want to use the command from any directory as a power user. The Powerhouse CLI is used to create, build, and run your Document Models and give you direct access to a series of Powerhouse ecosystem tools.
8
- :::
9
-
10
- ## Table of Contents
11
- - [Prerequisites](#prerequisites)
12
- - [Installing node.js 22](#installing-nodejs)
13
- - [For Windows](#for-windows)
14
- - [For macOS](#for-macos)
15
- - [For Linux (Ubuntu/Debian)](#for-linux-ubuntudebian)
16
- - [Installing Visual Studio Code](#installing-visual-studio-code)
17
- - [For Windows](#for-windows-1)
18
- - [For macOS](#for-macos-1)
19
- - [For Linux (Ubuntu/Debian)](#for-linux-ubuntudebian-1)
20
- - [Install Git](#install-git)
21
- - [For Windows](#for-windows-2)
22
- - [For macOS](#for-macos-2)
23
- - [For Linux (Ubuntu/Debian)](#for-linux-ubuntudebian-2)
24
- - [Configure Git](#configure-git-all-systems)
25
- - [Verify Installation](#verify-installation)
26
-
27
- ## Prerequisites
28
-
29
- Before we begin building our Document Model, we need to install some software on your computer. We'll need three main tools: node.js 22, which helps us run our code, Visual Studio Code (VS Code), which is where we'll write our code, and Git, which helps us manage our code. Follow the steps below based on your computer's operating system.
30
-
31
- ### Installing node.js 22
32
-
33
- node.js 22 is a tool that lets us run our application. Let's install it step by step.
34
-
35
- #### For Windows:
36
- 1. **Set up PowerShell for running commands:**
37
- - Press the Windows key
38
- - Type "PowerShell"
39
- - Right-click on "Windows PowerShell" and select "Run as administrator"
40
- - In the PowerShell window, type this command and press Enter:
41
- ```powershell
42
- Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
43
- ```
44
- - Type 'A' when prompted to confirm
45
- - You can now close this window and open PowerShell normally for the remaining steps
46
-
47
- 2. **Install node.js 22:**
48
- - Visit the [node.js 22 official website](https://nodejs.org/)
49
- - Click the big green button that says "LTS" (this means Long Term Support - it's the most stable version)
50
- - Once the installer downloads, double-click it to start installation
51
- - Click "Next" through the installation wizard, leaving all settings at their defaults
52
-
53
- 3. **Verify Installation:**
54
- - Open PowerShell (no need for admin mode)
55
- - Type these commands one at a time and press Enter after each:
56
- ```powershell
57
- node --version
58
- pnpm --version
59
- ```
60
- - You should see version numbers appear after each command (e.g., v18.17.0). If you do, congratulations - node.js 22 is installed!
61
-
62
- > **Note**: If node.js 22 commands don't work in VS Code, restart VS Code to refresh environment variables.
63
-
64
- #### For macOS:
65
- 1. **Install Homebrew:**
66
- - Open Terminal (press Command + Space and type "Terminal")
67
- - Copy and paste this command into Terminal and press Enter:
68
- ```bash
69
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
70
- ```
71
- - Follow any additional instructions that appear
72
-
73
- 2. **Install node.js 22:**
74
- - In the same Terminal window, type this command and press Enter:
75
- ```bash
76
- brew install node
77
- ```
78
-
79
- 3. **Verify Installation:**
80
- - In Terminal, type these commands one at a time and press Enter after each:
81
- ```bash
82
- node --version
83
- pnpm --version
84
- ```
85
- - If you see version numbers, you've successfully installed node.js 22!
86
-
87
- #### For Linux (Ubuntu/Debian):
88
- 1. **Open Terminal:**
89
- - Press Ctrl + Alt + T on your keyboard, or
90
- - Click the Activities button and type "Terminal"
91
-
92
- 2. **Update Package List:**
93
- ```bash
94
- sudo apt update
95
- ```
96
-
97
- 3. **Install node.js 22 and npm:**
98
- ```bash
99
- sudo apt install nodejs npm
100
- ```
101
-
102
- 4. **Verify Installation:**
103
- - Type these commands one at a time and press Enter after each:
104
- ```bash
105
- node --version
106
- pnpm --version
107
- ```
108
- - If you see version numbers, you're all set!
109
-
110
- ### Installing Visual Studio Code
111
-
112
- VS Code is the editor we'll use to write our code. Here's how to install it:
113
-
114
- #### For Windows:
115
- 1. Visit the [Visual Studio Code website](https://code.visualstudio.com/)
116
- 2. Click the blue "Download for Windows" button
117
- 3. Once the installer downloads, double-click it
118
- 4. Accept the license agreement and click "Next"
119
- 5. Leave the default installation location and click "Next"
120
- 6. In the Select Additional Tasks window, make sure "Add to PATH" is checked
121
- 7. Click "Next" and then "Install"
122
- 8. When installation is complete, click "Finish"
123
-
124
- #### For macOS:
125
- 1. Visit the [Visual Studio Code website](https://code.visualstudio.com/)
126
- 2. Click the blue "Download for Mac" button
127
- 3. Once the .zip file downloads, double-click it to extract
128
- 4. Drag Visual Studio Code.app to the Applications folder
129
- 5. Double-click the app to launch it
130
- 6. To make VS Code available in your terminal:
131
- - Open VS Code
132
- - Press Command + Shift + P
133
- - Type "shell command" and select "Install 'code' command in PATH"
134
-
135
- #### For Linux (Ubuntu/Debian):
136
- 1. Open Terminal (Ctrl + Alt + T)
137
- 2. First, update the packages list:
138
- ```bash
139
- sudo apt update
140
- ```
141
- 3. Install the dependencies needed to add Microsoft's repository:
142
- ```bash
143
- sudo apt install software-properties-common apt-transport-https wget
144
- ```
145
- 4. Import Microsoft's GPG key:
146
- ```bash
147
- wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
148
- ```
149
- 5. Add the VS Code repository:
150
- ```bash
151
- sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
152
- ```
153
- 6. Install VS Code:
154
- ```bash
155
- sudo apt install code
156
- ```
157
- 7. Once installed, you can launch VS Code by:
158
- - Typing `code` in the terminal, or
159
- - Finding it in your Applications menu
160
-
161
- ### Install Git
162
-
163
- #### Windows
164
- 1. Open PowerShell (press Windows key, type "PowerShell", and press Enter)
165
- 2. Visit the [Git website](https://git-scm.com/)
166
- 3. Download the latest version for Windows
167
- 4. Run the installer and use the recommended settings
168
- 5. Verify installation by opening PowerShell:
169
- ```powershell
170
- git --version
171
- ```
172
-
173
- #### macOS
174
- 1. Install using Homebrew:
175
- ```bash
176
- brew install git
177
- ```
178
- 2. Verify installation:
179
- ```bash
180
- git --version
181
- ```
182
-
183
- #### Linux (Ubuntu/Debian)
184
- 1. Update package list:
185
- ```bash
186
- sudo apt update
187
- ```
188
- 2. Install Git:
189
- ```bash
190
- sudo apt install git
191
- ```
192
- 3. Verify installation:
193
- ```bash
194
- git --version
195
- ```
196
-
197
- ### Configure Git (All Systems)
198
-
199
- Open your terminal (command prompt) and run the following commands to set up Git:
200
-
201
- After installation, set up your identity:
202
- ```bash
203
- git config --global user.name "Your Name"
204
- git config --global user.email "your.email@example.com"
205
- ```
206
-
207
- ### Verify Installation
208
-
209
- Open your terminal (command prompt) and run the following commands to verify your setup:
210
- ```bash
211
- node --version
212
- pnpm --version
213
- git --version
214
- ```
215
-
216
- You should see version numbers displayed for all commands. You're now ready to start building your Document Model!
@@ -1,54 +0,0 @@
1
- # Build with Scalars
2
-
3
- Scalars are here to help you define custom fields in your document model schema and speed up the development process.
4
- There are two applications of scalar components in the document model workflow:
5
-
6
- 1. At the **schema definition** level where you build your schema and write your GraphQL state schema.
7
- 2. At the **frontend / react** level where you import it and place it in your UI to represent the scalar field
8
-
9
- ## Scalar Definition in the Document Model Schema
10
-
11
- As you might know, the document model schema defines the structure of the document and serves as the backbone of the document model. The GraphQL state schema defines how data is captured with the help of types & scalars. When you define a scalar in the document model schema, you are essentially defining a new field that can be used in the document model to capture data.
12
-
13
- In the Document Model Editor, you can find all the custom scalar types available in our documentation under the 'Scalars' section.
14
-
15
- Insert image of the feature.
16
-
17
- ````
18
- scalar PHID <-- imported from the design system library? not sure
19
- type MyType {
20
- myScalar: PHID
21
- }
22
- ````
23
-
24
- ## React Component Implementation in the Frontend
25
-
26
- All of our reusable components are available in the Document-Engineering design system library or package.
27
- This package comes as a dependency in your project when creating a new document model project.
28
- ````
29
- import PHIDField from 'document-engineering'
30
- const reactComponent = () => {
31
-
32
- return (
33
- <div>
34
- <PHIDField
35
- fetchOptionsCallback={function Js(){}}
36
- fetchSelectedOptionCallback={function Js(){}}
37
- label="PHID field"
38
- name="phid-field"
39
- placeholder="phd:"
40
- />
41
-
42
- </div>
43
-
44
- )
45
-
46
- }
47
- ````
48
-
49
- ## Scalars & Reusable Components
50
-
51
- To make your life easier, Powerhouse has defined all useful scalars with a set of reusable code and UI components.
52
- The reusable components are essentially a set of front-end components based on GraphQL scalars. Powerhouse also has a set of custom scalars that are not part of the GraphQL standard but are specific to the web3 ecosystem.
53
-
54
- Read the next chapter to get familiar with our reusable components.
@@ -1,72 +0,0 @@
1
- ---
2
- sidebar_label: 'PHID Field'
3
- sidebar_position: 1
4
- ---
5
-
6
- import { Tabs, TabItem } from '@theme/Tabs';
7
-
8
- # PHID Field Example
9
-
10
- ### **Scalar Definition**
11
-
12
- - **Name:** `PHID` (Powerhouse ID)
13
- - **Purpose:** Represents a unique identifier pointing to a document, branch, scope, or data object within the Powerhouse system.
14
-
15
-
16
- <details>
17
- <summary>**Formatting of the component:**</summary>
18
- - **Basic Notation:** `phd:<documentID>`
19
- - **Branch and Scope:** Optional components appended using colons `:`.
20
- - **Full Notation:** `phd:<documentID>:<branch>:<scope>`
21
- - **Branch:** Defaults to `main` if omitted.
22
- - **Scope:** Defaults to `public` if omitted.
23
- - **Data Object Reference:** `phd:<documentID>/<dataObjectID>`
24
- - **URL Format:** `phd://<domain>/<documentID>`
25
- - Example: `phd://switchboard.powerhouse.xyz/baefc2a4-f9a0-4950-8161-fd8d8cc7dea9`
26
-
27
- **Examples of the component formatting:**
28
- - **Basic PHID:** `phd:baefc2a4-f9a0-4950-8161-fd8d8cc7dea9`
29
- - **With Branch:** `phd:baefc2a4...:draft`
30
- - **With Scope:** `phd:baefc2a4...::local`
31
- - **With Branch and Scope:** `phd:baefc2a4...:draft:local`
32
- - **With Data Object ID:** `phd:baefc2a4.../3cf05e40...`
33
- </details>
34
-
35
- <details>
36
- <summary>**Validation of the Component:**</summary>
37
- - **Validate each format:**
38
- 1. **PHID only:** Ensure the document ID is a valid UUID.
39
- 2. **PHID with data element (OID):** Validate both the document ID and the data object ID.
40
- 3. **PHID with branch:** Validate the document ID and check if the branch is properly formatted.
41
- 4. **PHID with scope:** Validate the document ID and check if the scope is valid.
42
- 5. **PHID with branch and scope:** Validate all three components: document ID, branch, and scope.
43
- - **Error Message Example:** "Invalid PHID format. Please check the document ID, branch, or scope."
44
- </details>
45
-
46
- The following is a the UI component for the PHID field and scalar in a storybook.
47
- We use Storybook as our component development environment.
48
- It allows us to build and test UI components in isolation, making it easier to develop, test, and document reusable components.
49
- In our stories you'll find first find a basic UI implementation example of the component, followed by the component's properties, events, and validation options.
50
-
51
- - A list of the **default properties** and their descriptions, and a list of the available events that can be triggered.
52
- - A list of the **component's specific properties** and attributes based on the components functionality.
53
- - A list of **validation options**, or ways to validate the component's desired input values.
54
-
55
- Additionally, you'll find various **stories of the components in different states**.
56
-
57
- <div style={{
58
- border: '1px solid #E5E7EB',
59
- borderRadius: '8px',
60
- padding: '16px',
61
- marginBottom: '20px',
62
- }}>
63
- <iframe
64
- src="https://storybook.powerhouse.academy/iframe.html?id=scalars-phid-field--readme&viewMode=story"
65
- style={{
66
- width: '100%',
67
- height: '4500px',
68
- border: 'none',
69
- }}
70
- title="PhidField Component Demo"
71
- />
72
- </div>
@@ -1,36 +0,0 @@
1
- import { Tabs, TabItem } from '@theme/Tabs';
2
-
3
- # Sidebar
4
-
5
- ### **Scalar Definition**
6
-
7
- - **Name:** `Sidebar`
8
- - **Purpose:** The Sidebar component can be used within a page layout to provide a sidebar navigation. It provided a tree structure of nodes that can be used to navigate the application offering customization, search and more.
9
-
10
-
11
- <details>
12
- <summary>**Formatting of the component:**</summary>
13
-
14
- </details>
15
-
16
- <details>
17
- <summary>**Validation of the Component:**</summary>
18
-
19
- </details>
20
-
21
- <div style={{
22
- border: '1px solid #E5E7EB',
23
- borderRadius: '8px',
24
- padding: '16px',
25
- marginBottom: '20px',
26
- }}>
27
- <iframe
28
- src="https://dspot-scalars-storybook.vercel.app/iframe.html?args=&id=document-engineering-complex-components-sidebar--readme&viewMode=story"
29
- style={{
30
- width: '100%',
31
- height: '2000px',
32
- border: 'none',
33
- }}
34
- title="Sidebar Component Demo"
35
- />
36
- </div>
@@ -1,61 +0,0 @@
1
- ---
2
- sidebar_label: 'PHID Field'
3
- sidebar_position: 1
4
- ---
5
-
6
- import { Tabs, TabItem } from '@theme/Tabs';
7
-
8
- # PHID Field Example
9
-
10
- ### **Scalar Definition**
11
-
12
- - **Name:** `PHID` (Powerhouse ID)
13
- - **Purpose:** Represents a unique identifier pointing to a document, branch, scope, or data object within the Powerhouse system.
14
-
15
-
16
- <details>
17
- <summary>**Formatting of the component:**</summary>
18
- - **Basic Notation:** `phd:<documentID>`
19
- - **Branch and Scope:** Optional components appended using colons `:`.
20
- - **Full Notation:** `phd:<documentID>:<branch>:<scope>`
21
- - **Branch:** Defaults to `main` if omitted.
22
- - **Scope:** Defaults to `public` if omitted.
23
- - **Data Object Reference:** `phd:<documentID>/<dataObjectID>`
24
- - **URL Format:** `phd://<domain>/<documentID>`
25
- - Example: `phd://switchboard.powerhouse.xyz/baefc2a4-f9a0-4950-8161-fd8d8cc7dea9`
26
-
27
- **Examples of the component formatting:**
28
- - **Basic PHID:** `phd:baefc2a4-f9a0-4950-8161-fd8d8cc7dea9`
29
- - **With Branch:** `phd:baefc2a4...:draft`
30
- - **With Scope:** `phd:baefc2a4...::local`
31
- - **With Branch and Scope:** `phd:baefc2a4...:draft:local`
32
- - **With Data Object ID:** `phd:baefc2a4.../3cf05e40...`
33
- </details>
34
-
35
- <details>
36
- <summary>**Validation of the Component:**</summary>
37
- - **Validate each format:**
38
- 1. **PHID only:** Ensure the document ID is a valid UUID.
39
- 2. **PHID with data element (OID):** Validate both the document ID and the data object ID.
40
- 3. **PHID with branch:** Validate the document ID and check if the branch is properly formatted.
41
- 4. **PHID with scope:** Validate the document ID and check if the scope is valid.
42
- 5. **PHID with branch and scope:** Validate all three components: document ID, branch, and scope.
43
- - **Error Message Example:** "Invalid PHID format. Please check the document ID, branch, or scope."
44
- </details>
45
-
46
- <div style={{
47
- border: '1px solid #E5E7EB',
48
- borderRadius: '8px',
49
- padding: '16px',
50
- marginBottom: '20px',
51
- }}>
52
- <iframe
53
- src="https://dspot-scalars-storybook.vercel.app/iframe.html?args=name:amount-field;placeholder:test;label:Enter%20Amount%20and%20Select%20Currency;type:Amount;placeholderSelect:CUR;allowedTokens:!null;tokenIcons.Sol:1;value.amount:3454564564;value.currency:BTC&id=document-engineering-simple-components-phid-field--readme&viewMode=story"
54
- style={{
55
- width: '100%',
56
- height: '4500px',
57
- border: 'none',
58
- }}
59
- title="PhidField Component Demo"
60
- />
61
- </div>
@@ -1,61 +0,0 @@
1
- ---
2
- sidebar_label: 'PHID Field'
3
- sidebar_position: 1
4
- ---
5
-
6
- import { Tabs, TabItem } from '@theme/Tabs';
7
-
8
- # PHID Field Example
9
-
10
- ### **Scalar Definition**
11
-
12
- - **Name:** `PHID` (Powerhouse ID)
13
- - **Purpose:** Represents a unique identifier pointing to a document, branch, scope, or data object within the Powerhouse system.
14
-
15
-
16
- <details>
17
- <summary>**Formatting of the component:**</summary>
18
- - **Basic Notation:** `phd:<documentID>`
19
- - **Branch and Scope:** Optional components appended using colons `:`.
20
- - **Full Notation:** `phd:<documentID>:<branch>:<scope>`
21
- - **Branch:** Defaults to `main` if omitted.
22
- - **Scope:** Defaults to `public` if omitted.
23
- - **Data Object Reference:** `phd:<documentID>/<dataObjectID>`
24
- - **URL Format:** `phd://<domain>/<documentID>`
25
- - Example: `phd://switchboard.powerhouse.xyz/baefc2a4-f9a0-4950-8161-fd8d8cc7dea9`
26
-
27
- **Examples of the component formatting:**
28
- - **Basic PHID:** `phd:baefc2a4-f9a0-4950-8161-fd8d8cc7dea9`
29
- - **With Branch:** `phd:baefc2a4...:draft`
30
- - **With Scope:** `phd:baefc2a4...::local`
31
- - **With Branch and Scope:** `phd:baefc2a4...:draft:local`
32
- - **With Data Object ID:** `phd:baefc2a4.../3cf05e40...`
33
- </details>
34
-
35
- <details>
36
- <summary>**Validation of the Component:**</summary>
37
- - **Validate each format:**
38
- 1. **PHID only:** Ensure the document ID is a valid UUID.
39
- 2. **PHID with data element (OID):** Validate both the document ID and the data object ID.
40
- 3. **PHID with branch:** Validate the document ID and check if the branch is properly formatted.
41
- 4. **PHID with scope:** Validate the document ID and check if the scope is valid.
42
- 5. **PHID with branch and scope:** Validate all three components: document ID, branch, and scope.
43
- - **Error Message Example:** "Invalid PHID format. Please check the document ID, branch, or scope."
44
- </details>
45
-
46
- <div style={{
47
- border: '1px solid #E5E7EB',
48
- borderRadius: '8px',
49
- padding: '16px',
50
- marginBottom: '20px',
51
- }}>
52
- <iframe
53
- src="https://dspot-scalars-storybook.vercel.app/iframe.html?args=name:amount-field;placeholder:test;label:Enter%20Amount%20and%20Select%20Currency;type:Amount;placeholderSelect:CUR;allowedTokens:!null;tokenIcons.Sol:1;value.amount:3454564564;value.currency:BTC&id=document-engineering-simple-components-phid-field--readme&viewMode=story"
54
- style={{
55
- width: '100%',
56
- height: '4500px',
57
- border: 'none',
58
- }}
59
- title="PhidField Component Demo"
60
- />
61
- </div>