@servicetitan/docs-anvil-uikit-contrib 25.0.1 → 25.4.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/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # `@servicetitan/docs-anvil-uikit-contrib`
2
+
3
+ This package contains documentation for Frontend Community packages, published at https://docs.st.dev.
4
+
5
+ <!---
6
+ ## Preview changes locally
7
+
8
+ To preview changes use the local `docusaurus` project. See the `docusaurus` README for instructions.
9
+ -->
10
+
11
+ ## Preview changes in situ
12
+
13
+ Use `yalc` to preview changes within the entire ServiceTitan Engineering documentation.
14
+
15
+ ### Initial setup
16
+
17
+ 1. Install the `yalc` package globally
18
+
19
+ ```sh
20
+ $ npm i yalc -g
21
+ ```
22
+
23
+ 2. Build the `anvil-uikit-contrib` packages
24
+
25
+ ```sh
26
+ $ cd <path-to-anvil-uikit-contrib>
27
+ $ npm run build
28
+ ```
29
+
30
+ 3. Run `yalc publish` in the `packages/docs` folder to publish the package documentation locally
31
+
32
+ ```sh
33
+ $ cd ./packages/docs
34
+ $ yalc publish
35
+ ```
36
+
37
+ 4. Run `yalc add @servicetitan/docs-anvil-uikit-contrib` in the `servicetitan/docs` repo to use the locally published documents
38
+
39
+ ```sh
40
+ $ cd <path-to-servicetitan/docs>
41
+ $ yalc add @servicetitan/docs-anvil-uikit-contrib
42
+ ```
43
+
44
+ 5. Update dependencies
45
+
46
+ ```sh
47
+ $ npm i
48
+ ```
49
+
50
+ 6. Start Docusaurus
51
+
52
+ ```sh
53
+ $ npm start
54
+ ```
55
+
56
+ This opens the documentation in a browser window.
57
+
58
+ ### Live updates
59
+
60
+ To see further changes without having to restart the server,
61
+
62
+ 1. Run `yalc push` in the anvil-uikit-contrib `packages/docs` folder to push changes to `servicetitan/docs`
63
+
64
+ ```sh
65
+ # > anvil-uikit-contrib/packages/docs
66
+ $ yalc push
67
+ ```
68
+
69
+ 2. Run `npm run prebuild` (or `npm run import-package-docs`) in `servicetitan/docs`
70
+
71
+ ```sh
72
+ # > servicetitan/docs
73
+ $ npm run prebuild
74
+ ```
@@ -2,8 +2,6 @@
2
2
  title: FormState
3
3
  ---
4
4
 
5
- import { CodeDemo } from '@site/src/components/code-demo';
6
-
7
5
  `@servicetitan/form-state` is a collection of utils to simplify daily routine related to form state management.
8
6
 
9
7
  ## Utilities
@@ -18,7 +18,7 @@ import {
18
18
  ServerCustomExample,
19
19
  } from '@servicetitan/notifications/dist/demo';
20
20
 
21
- import { CodeDemo } from '@site/src/components/code-demo';
21
+ import { CodeDemo, DemoCodeBlock } from '@site/src/components/code-demo';
22
22
 
23
23
  There're a lot of cases when a user should be notified in the result of various events. It could be from a simple one-time notification about the result of the network request to informing about the state of a complex long-running process launched on the worker.
24
24
 
@@ -92,40 +92,42 @@ Notification Center will automatically show notifications to the user sent from
92
92
 
93
93
  Most of the cases could be easily covered with default notification type and `DefaultPayload` container, it's also the preferable way.
94
94
 
95
- export const defaultServerCode =
96
- '' +
97
- 'IUserNotifier notification;\r\n' +
98
- '\r\n' +
99
- 'var payload = new DefaultPayload {\r\n' +
100
- ' Title = "Server Notification",\r\n' +
101
- ' Message = "Task was pushed into queue."\r\n' +
102
- '};\r\n' +
103
- 'notification = await notificationCenter.CreateNotifierAsync(\r\n' +
104
- ' GetUserId(),\r\n' +
105
- ' initialPayload: payload\r\n' +
106
- ');\r\n' +
107
- '\r\n' +
108
- 'await Task.Delay(2000);\r\n' +
109
- '\r\n' +
110
- 'payload.Message = "Task is running.";\r\n' +
111
- 'await notification.OnChangePayload(\r\n' +
112
- ' payload,\r\n' +
113
- ' UserNotificationStatus.InProgress\r\n' +
114
- ');\r\n' +
115
- '\r\n' +
116
- 'for (int progress = 0; progress < 100; progress += 5) {\r\n' +
117
- ' payload.Progress = progress;\r\n' +
118
- ' await notification.OnChangePayload(payload);\r\n' +
119
- '\r\n' +
120
- ' await Task.Delay(250);\r\n' +
121
- '}\r\n' +
122
- '\r\n' +
123
- 'payload.Message = "Task was successfully completed.";\r\n' +
124
- 'payload.Progress = null;\r\n' +
125
- 'await notification.OnChangePayload(\r\n' +
126
- ' payload,\r\n' +
127
- ' UserNotificationStatus.Success\r\n' +
128
- ');';
95
+ export const defaultServerCode = `
96
+ IUserNotifier notification;
97
+
98
+ var payload = new DefaultPayload {
99
+ Title = "Server Notification",
100
+ Message = "Task was pushed into queue."
101
+ };
102
+ notification = await notificationCenter.CreateNotifierAsync(
103
+ GetUserId(),
104
+ initialPayload: payload
105
+ );
106
+
107
+ await Task.Delay(2000);
108
+
109
+ payload.Message = "Task is running.";
110
+ await notification.OnChangePayload(
111
+ payload,
112
+ UserNotificationStatus.InProgress
113
+ );
114
+
115
+ for (int progress = 0; progress < 100; progress += 5) {
116
+ payload.Progress = progress;
117
+ await notification.OnChangePayload(payload);
118
+
119
+ await Task.Delay(250);
120
+ }
121
+
122
+ payload.Message = "Task was successfully completed.";
123
+ payload.Progress = null;
124
+ await notification.OnChangePayload(
125
+ payload,
126
+ UserNotificationStatus.Success
127
+ );
128
+ `
129
+ .replace(/\n\s{4}/g, '\n')
130
+ .trim();
129
131
 
130
132
  <Tabs
131
133
  defaultValue="example"
@@ -138,7 +140,7 @@ export const defaultServerCode =
138
140
  <ServerDefaultExample />
139
141
  </TabItem>
140
142
  <TabItem value="server">
141
- <CodeBlock className="csharp">{defaultServerCode}</CodeBlock>
143
+ <CodeBlock language="csharp">{defaultServerCode}</CodeBlock>
142
144
  </TabItem>
143
145
  </Tabs>
144
146
 
@@ -148,22 +150,24 @@ But if you need to show something more specific, then you can create a custom no
148
150
 
149
151
  **_It's required to register all your custom renderers in the `custom-notifications.ts` file on the module level, which should be imported in your module file._**
150
152
 
151
- export const customServerCode =
152
- '' +
153
- 'public class CustomPayload : INotificationPayload\r\n' +
154
- '{\r\n' +
155
- ' public string Username { get; set; }\r\n' +
156
- ' public string Message { get; set; }\r\n' +
157
- '}\r\n' +
158
- '\r\n' +
159
- 'await notificationCenter.CreateNotifierAsync(\r\n' +
160
- ' GetUserId(),\r\n' +
161
- ' "CustomServerNotification",\r\n' +
162
- ' initialPayload: new CustomPayload {\r\n' +
163
- ' Username = "Jane",\r\n' +
164
- ' Message = "Hello, your order completed."\r\n' +
165
- ' }\r\n' +
166
- ');';
153
+ export const customServerCode = `
154
+ public class CustomPayload : INotificationPayload
155
+ {
156
+ public string Username { get; set; }
157
+ public string Message { get; set; }
158
+ }
159
+
160
+ await notificationCenter.CreateNotifierAsync(
161
+ GetUserId(),
162
+ "CustomServerNotification",
163
+ initialPayload: new CustomPayload {
164
+ Username = "Jane",
165
+ Message = "Hello, your order completed."
166
+ }
167
+ );
168
+ `
169
+ .replace(/\n\s{4}/g, '\n')
170
+ .trim();
167
171
 
168
172
  <Tabs
169
173
  defaultValue="example"
@@ -177,12 +181,10 @@ export const customServerCode =
177
181
  <ServerCustomExample />
178
182
  </TabItem>
179
183
  <TabItem value="client">
180
- <CodeBlock className="ts">
181
- {require('@servicetitan/notifications/src/demo/server-custom-preview.tsx?raw')}
182
- </CodeBlock>
184
+ <DemoCodeBlock srcPath="notifications/src/demo/server-custom-preview.tsx" />
183
185
  </TabItem>
184
186
  <TabItem value="server">
185
- <CodeBlock className="csharp">{customServerCode}</CodeBlock>
187
+ <CodeBlock language="csharp">{customServerCode}</CodeBlock>
186
188
  </TabItem>
187
189
  </Tabs>
188
190
 
package/docs/table.mdx CHANGED
@@ -170,7 +170,7 @@ export interface TableProps<T, TId extends IdType = any, P = never, PId extends
170
170
 
171
171
  Simple example with some out of the box functionality.
172
172
 
173
- <CodeDemo example={TableExample} srcPath="table/src/demo/overview/table.tsx" />
173
+ <CodeDemo example={TableExample} srcPath="table/src/demo/overview/table.tsx" theme="light" />
174
174
 
175
175
  _This example consists of several files, the full code can be found [here](https://github.com/servicetitan/uikit/tree/master/packages/table/src/demo/overview)._
176
176
 
@@ -181,6 +181,7 @@ Table rows can expand and show additional content related to the open row. Anoth
181
181
  <CodeDemo
182
182
  example={TableMasterDetailExample}
183
183
  srcPath="table/src/demo/master-detail/table-master-detail.tsx"
184
+ theme="light"
184
185
  />
185
186
 
186
187
  _This example consists of several files, the full code can be found [here](https://github.com/servicetitan/uikit/tree/master/packages/table/src/demo/master-detail)._
@@ -192,6 +193,7 @@ Table State can be exported to restore it later. In the example below, we can sw
192
193
  <CodeDemo
193
194
  example={TableStateCachingExample}
194
195
  srcPath="table/src/demo/state-caching/state-caching-table.tsx"
196
+ theme="light"
195
197
  />
196
198
 
197
199
  _This example consists of several files, the full code can be found [here](https://github.com/servicetitan/uikit/tree/master/packages/table/src/demo/state-caching)._
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-anvil-uikit-contrib",
3
- "version": "25.0.1",
3
+ "version": "25.4.1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/servicetitan/anvil-uikit-contrib.git",
8
- "directory": "packages/docs"
8
+ "directory": "docusaurus"
9
9
  },
10
- "files": ["docs"],
10
+ "files": [
11
+ "docs"
12
+ ],
11
13
  "publishConfig": {
12
14
  "access": "public"
13
15
  },
14
16
  "cli": {
15
17
  "webpack": false
16
- }
18
+ },
19
+ "gitHead": "47af4bd32673af7e0292f1e55316164615135b74"
17
20
  }
@@ -1,35 +0,0 @@
1
- ---
2
- id: backendless
3
- title: Backendless
4
- ---
5
-
6
- Backendless lets you develop the frontend in the monolith app without running the backend.
7
-
8
- ## Setup
9
-
10
- 1. `cd` to your **app** project, then to `Clients/Web`
11
- 2. Run `npm start`
12
- 3. Run `npm run wwwroot` (admin or sudo rights are required to generate a trusted HTTPS certificate during the first run)
13
- 4. In a browser, open https://next.servicetitan.com/manage (or any other current environment), and login with your ServiceTitan credentials.
14
- 5. Open the developer console (**CTRL+Shift+J** on PC or **CMD+OPT+J** on Mac), and run `backendless.start()`
15
- 6. The ST page should reload and you should now see the Backendless logo
16
- 7. Have a happy development! 🙂
17
-
18
- To deactivate Backendless, you can run `backendless.end()` or unregister the Backendless service worker via the developer tools.
19
-
20
- *If you find any issues or have additional questions, please post them in the [#dev-backendless](https://servicetitan.slack.com/archives/C018D8C088L) Slack channel.*
21
-
22
- ## Troubleshooting
23
-
24
- ### WSL Certificate
25
-
26
- If you are using WSL2 on Windows, and are running `npm run wwwroot` from within WSL, you may experience an issue with your browser in Windows not trusting the certificate that gets generated and used for localhost.
27
-
28
- One solution is to run `npm run wwwroot` from Windows instead of WSL, so that the certificate will get correctly installed and trusted within Windows.
29
-
30
- There is another, longer solution that will allow you to continue running the script from within WSL after some setup.
31
- 1. Run `npm run wwwroot` within WSL first, so that WSL will know it generated a certificate already. Those certificates will likely be added to `/home/[UBUNTU_USERNAME]/.config/https-localhost/localhost.crt`.
32
- 2. Run `npm run wwwroot` within Windows. This may require you cloning the repo again from Windows, and will require node to be installed on Windows. This will add certificates to `C:\Users\[USERNAME]\AppData\Roaming\https-localhost`.
33
- 3. Copy the **localhost.crt** and **localhost.key** from `C:\Users\[username]\AppData\Roaming\https-localhost` to `/home/[UBUNTU_USERNAME]/.config/https-localhost/localhost.crt`. The WSL mount can be accessed from Windows via `\\wsl$\Ubuntu\home\[UBUNTU_USERNAME]]\.config\https-localhost\localhost.crt`.
34
-
35
- From then on, you should be able to run `npm run wwwroot` directly from WSL with no issues, because it is serving using the certificate generated from Windows and Windows trusts that certificate.
File without changes
File without changes