@microsoft/rayfin-app-state-fabric 1.36.0-alpha.1818 → 1.36.0-alpha.1917
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 +41 -10
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# @microsoft/rayfin-app-state-fabric
|
|
2
2
|
|
|
3
|
-
Deep-link application state for Rayfin apps embedded in the Fabric portal.
|
|
3
|
+
Deep-link application state for Rayfin apps embedded in the Microsoft Fabric portal.
|
|
4
|
+
|
|
5
|
+
This package lets an embedded app read the state it was launched with and write state back to the portal URL.
|
|
6
|
+
|
|
7
|
+
A Fabric App runs in a cross-origin iframe and has no addressable URL of its own, so the portal host owns encoding, versioning, size limits, and browser history while the app supplies an opaque JSON object.
|
|
4
8
|
|
|
5
9
|
## Getting started
|
|
6
10
|
|
|
@@ -10,11 +14,38 @@ npm install @microsoft/rayfin-app-state-fabric
|
|
|
10
14
|
|
|
11
15
|
For more details, [visit our docs](https://aka.ms/rayfin/docs).
|
|
12
16
|
|
|
17
|
+
## When to Use This Package
|
|
18
|
+
|
|
19
|
+
Use this package when a user should be able to copy the browser URL and send someone the exact view they were looking at.
|
|
20
|
+
|
|
21
|
+
The package is designed for browser applications embedded in the Fabric portal that need to:
|
|
22
|
+
|
|
23
|
+
- restore a shared view before the first render, so no default state is painted first
|
|
24
|
+
- write state back as the user navigates, with or without a browser history entry
|
|
25
|
+
- react to the browser Back and Forward buttons
|
|
26
|
+
- detect whether the host supports deep linking at all, since it rolls out per tenant
|
|
27
|
+
|
|
28
|
+
## Exports
|
|
29
|
+
|
|
30
|
+
The package exports the following public API:
|
|
31
|
+
|
|
32
|
+
- `createFabricAppStateClient(options)`
|
|
33
|
+
- `FabricAppStateClient`
|
|
34
|
+
- `FabricAppStateClientOptions`
|
|
35
|
+
- `FabricAppState`
|
|
36
|
+
- `FabricAppStateValue`
|
|
37
|
+
- `FabricAppStateCapabilities`
|
|
38
|
+
- `FabricAppStateListener`
|
|
39
|
+
- `FabricAppStateError`
|
|
40
|
+
- `DEFAULT_MAX_ENCODED_BYTES`
|
|
41
|
+
- `DEFAULT_MAX_DEPTH`
|
|
42
|
+
|
|
13
43
|
## Deep linking
|
|
14
44
|
|
|
15
45
|
A Fabric App runs in an iframe and cannot touch the portal address bar directly.
|
|
16
46
|
`createFabricAppStateClient()` lets your app read the state it was launched with and write state back, so a user can share a link that reopens the exact view they were looking at.
|
|
17
47
|
|
|
48
|
+
Create one client for the lifetime of the app.
|
|
18
49
|
Read launch state *before* your first render so default state never flashes:
|
|
19
50
|
|
|
20
51
|
```ts
|
|
@@ -28,10 +59,11 @@ renderApp(launch ?? defaultView);
|
|
|
28
59
|
|
|
29
60
|
> **Leave `targetOrigin` unset.**
|
|
30
61
|
> The embedding Fabric extension host does not share the portal origin in the address bar, and it varies per environment.
|
|
31
|
-
> A wrong pin makes the browser drop every message silently.
|
|
62
|
+
> A wrong pin makes the browser drop every message silently.
|
|
63
|
+
> When omitted, messages are posted with `"*"` and inbound events are not origin-checked.
|
|
32
64
|
|
|
33
65
|
Write state as the user navigates.
|
|
34
|
-
Use `setState` for navigation the user would expect the Back button to undo, and `replaceState` for transient changes such as dragging a slider:
|
|
66
|
+
Use `setState` for navigation the user would expect the Back button to undo, and `replaceState` for app-driven or transient changes such as dragging a slider:
|
|
35
67
|
|
|
36
68
|
```ts
|
|
37
69
|
await appState.setState({ view: 'sales-by-region', filter: 'AT' });
|
|
@@ -112,21 +144,20 @@ Branch on `isSupported()`, or catch `NO_HOST_WINDOW` if you would rather attempt
|
|
|
112
144
|
|
|
113
145
|
State travels in a URL, so treat it accordingly.
|
|
114
146
|
|
|
115
|
-
- **It is visible to the user.**
|
|
147
|
+
- **It is visible to the user.**
|
|
148
|
+
It appears in the address bar, browser history, and bookmarks.
|
|
116
149
|
Never put secrets, tokens, or personal data in it.
|
|
117
|
-
- **It is untrusted input.**
|
|
150
|
+
- **It is untrusted input.**
|
|
151
|
+
Anyone can edit a link before sending it, so validate launch state exactly as you would a query parameter before using it to drive queries.
|
|
118
152
|
Your app should also tolerate state written by a different version of itself.
|
|
119
153
|
|
|
120
154
|
## Security
|
|
121
155
|
|
|
122
|
-
Microsoft takes the security of our software products and services seriously, which
|
|
123
|
-
includes all source code repositories in our GitHub organizations.
|
|
156
|
+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories in our GitHub organizations.
|
|
124
157
|
|
|
125
158
|
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
126
159
|
|
|
127
|
-
For security reporting information, locations, contact information, and policies,
|
|
128
|
-
please review the latest guidance for Microsoft repositories at
|
|
129
|
-
[https://aka.ms/SECURITY.md](https://aka.ms/SECURITY.md).
|
|
160
|
+
For security reporting information, locations, contact information, and policies, please review the latest guidance for Microsoft repositories at [https://aka.ms/SECURITY.md](https://aka.ms/SECURITY.md).
|
|
130
161
|
|
|
131
162
|
## Trademarks
|
|
132
163
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/rayfin-app-state-fabric",
|
|
3
|
-
"version": "1.36.0-alpha.
|
|
3
|
+
"version": "1.36.0-alpha.1917",
|
|
4
4
|
"description": "Deep-link application state for Rayfin apps embedded in the Fabric portal",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
],
|
|
14
14
|
"type": "module",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@microsoft/
|
|
17
|
-
"@microsoft/
|
|
16
|
+
"@microsoft/fabric-embedded-host": "1.36.0-alpha.1917",
|
|
17
|
+
"@microsoft/rayfin-lib": "1.36.0-alpha.1917"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"typescript": "^5.8.3",
|