@microsoft/power-apps-native-host 0.3.3 → 0.5.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 +60 -0
- package/compatibility/current.json +1 -1
- package/lib/NOTICE.txt +2957 -371
- package/lib/commonjs/auth/AuthContext.js +49 -22
- package/lib/commonjs/auth/targetAuthorization.js +53 -0
- package/lib/commonjs/bridge/NativePowerAppsBridge.js +33 -2
- package/lib/commonjs/bridge/PowerPagesBridge.js +1 -3
- package/lib/commonjs/bridge/setupNativeHost.js +6 -0
- package/lib/commonjs/config/expoConfig.js +14 -0
- package/lib/commonjs/config/runtimeTenantMode.js +16 -0
- package/lib/commonjs/config/runtimeTenantMode.web.js +9 -0
- package/lib/commonjs/config/tenantMode.js +68 -0
- package/lib/commonjs/connections/PowerPlatformConnectionApi.js +24 -27
- package/lib/commonjs/connections/connectionMetadata.js +2 -2
- package/lib/commonjs/connections/resolveConnections.js +8 -3
- package/lib/commonjs/connections/types.js +9 -2
- package/lib/commonjs/connections/useConnectionRefs.js +19 -10
- package/lib/commonjs/index.js +41 -2
- package/lib/commonjs/platform/CanvasAppResolution.js +33 -0
- package/lib/commonjs/platform/CanvasAppResolutionApi.js +69 -0
- package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +50 -13
- package/lib/commonjs/platform/GlobalDiscovery.js +40 -1
- package/lib/commonjs/provider/PowerAppsHostProvider.js +47 -8
- package/lib/commonjs/provider/PowerAppsProvider.js +175 -9
- package/lib/commonjs/target/DefaultPowerAppsExperience.js +564 -0
- package/lib/commonjs/target/PowerAppsExperience.js +41 -0
- package/lib/commonjs/target/PowerAppsTargetBootstrap.js +534 -0
- package/lib/commonjs/target/errors.js +24 -0
- package/lib/commonjs/target/types.js +1 -0
- package/lib/commonjs/telemetry/index.js +2 -2
- package/lib/module/auth/AuthContext.js +49 -22
- package/lib/module/auth/targetAuthorization.js +48 -0
- package/lib/module/bridge/NativePowerAppsBridge.js +33 -2
- package/lib/module/bridge/PowerPagesBridge.js +1 -3
- package/lib/module/bridge/setupNativeHost.js +5 -0
- package/lib/module/config/expoConfig.js +14 -0
- package/lib/module/config/runtimeTenantMode.js +12 -0
- package/lib/module/config/runtimeTenantMode.web.js +5 -0
- package/lib/module/config/tenantMode.js +61 -0
- package/lib/module/connections/PowerPlatformConnectionApi.js +24 -27
- package/lib/module/connections/connectionMetadata.js +2 -2
- package/lib/module/connections/resolveConnections.js +9 -4
- package/lib/module/connections/types.js +9 -2
- package/lib/module/connections/useConnectionRefs.js +20 -11
- package/lib/module/index.js +5 -2
- package/lib/module/platform/CanvasAppResolution.js +27 -0
- package/lib/module/platform/CanvasAppResolutionApi.js +65 -0
- package/lib/module/platform/DataverseGlobalDiscoveryApi.js +49 -14
- package/lib/module/platform/GlobalDiscovery.js +37 -1
- package/lib/module/provider/PowerAppsHostProvider.js +47 -8
- package/lib/module/provider/PowerAppsProvider.js +179 -13
- package/lib/module/target/DefaultPowerAppsExperience.js +559 -0
- package/lib/module/target/PowerAppsExperience.js +34 -0
- package/lib/module/target/PowerAppsTargetBootstrap.js +529 -0
- package/lib/module/target/errors.js +19 -0
- package/lib/module/target/types.js +1 -0
- package/lib/module/telemetry/index.js +1 -1
- package/lib/typescript/commonjs/auth/AuthContext.d.ts +11 -2
- package/lib/typescript/commonjs/auth/targetAuthorization.d.ts +15 -0
- package/lib/typescript/commonjs/bridge/NativePowerAppsBridge.d.ts +6 -0
- package/lib/typescript/commonjs/bridge/setupNativeHost.d.ts +2 -0
- package/lib/typescript/commonjs/config/runtimeTenantMode.d.ts +3 -0
- package/lib/typescript/commonjs/config/runtimeTenantMode.web.d.ts +3 -0
- package/lib/typescript/commonjs/config/tenantMode.d.ts +14 -0
- package/lib/typescript/commonjs/connections/PowerPlatformConnectionApi.d.ts +5 -2
- package/lib/typescript/commonjs/connections/connectionMetadata.d.ts +1 -1
- package/lib/typescript/commonjs/connections/types.d.ts +7 -1
- package/lib/typescript/commonjs/connections/useConnectionRefs.d.ts +11 -2
- package/lib/typescript/commonjs/index.d.ts +7 -3
- package/lib/typescript/commonjs/platform/CanvasAppResolution.d.ts +4 -0
- package/lib/typescript/commonjs/platform/CanvasAppResolutionApi.d.ts +6 -0
- package/lib/typescript/commonjs/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
- package/lib/typescript/commonjs/platform/GlobalDiscovery.d.ts +12 -0
- package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +9 -1
- package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +14 -16
- package/lib/typescript/commonjs/target/DefaultPowerAppsExperience.d.ts +6 -0
- package/lib/typescript/commonjs/target/PowerAppsExperience.d.ts +61 -0
- package/lib/typescript/commonjs/target/PowerAppsTargetBootstrap.d.ts +15 -0
- package/lib/typescript/commonjs/target/errors.d.ts +13 -0
- package/lib/typescript/commonjs/target/types.d.ts +34 -0
- package/lib/typescript/commonjs/telemetry/index.d.ts +2 -2
- package/lib/typescript/module/auth/AuthContext.d.ts +11 -2
- package/lib/typescript/module/auth/targetAuthorization.d.ts +15 -0
- package/lib/typescript/module/bridge/NativePowerAppsBridge.d.ts +6 -0
- package/lib/typescript/module/bridge/setupNativeHost.d.ts +2 -0
- package/lib/typescript/module/config/runtimeTenantMode.d.ts +3 -0
- package/lib/typescript/module/config/runtimeTenantMode.web.d.ts +3 -0
- package/lib/typescript/module/config/tenantMode.d.ts +14 -0
- package/lib/typescript/module/connections/PowerPlatformConnectionApi.d.ts +5 -2
- package/lib/typescript/module/connections/connectionMetadata.d.ts +1 -1
- package/lib/typescript/module/connections/types.d.ts +7 -1
- package/lib/typescript/module/connections/useConnectionRefs.d.ts +11 -2
- package/lib/typescript/module/index.d.ts +7 -3
- package/lib/typescript/module/platform/CanvasAppResolution.d.ts +4 -0
- package/lib/typescript/module/platform/CanvasAppResolutionApi.d.ts +6 -0
- package/lib/typescript/module/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
- package/lib/typescript/module/platform/GlobalDiscovery.d.ts +12 -0
- package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +9 -1
- package/lib/typescript/module/provider/PowerAppsProvider.d.ts +14 -16
- package/lib/typescript/module/target/DefaultPowerAppsExperience.d.ts +6 -0
- package/lib/typescript/module/target/PowerAppsExperience.d.ts +61 -0
- package/lib/typescript/module/target/PowerAppsTargetBootstrap.d.ts +15 -0
- package/lib/typescript/module/target/errors.d.ts +13 -0
- package/lib/typescript/module/target/types.d.ts +34 -0
- package/lib/typescript/module/telemetry/index.d.ts +2 -2
- package/package.json +12 -5
- package/scripts/build-codegen-package.js +34 -3
- package/scripts/dev.js +405 -0
- package/scripts/upgrade-authoring.js +85 -28
- package/scripts/wrap.js +42 -5
- package/src/config/generated-config.d.ts +21 -0
package/README.md
CHANGED
|
@@ -82,6 +82,23 @@ wiring.
|
|
|
82
82
|
npm run dev
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
For a device that cannot reach the workstation over LAN, use a private,
|
|
86
|
+
authenticated Microsoft Dev Tunnel:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
az login
|
|
90
|
+
npm run dev -- --tunnel
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Pass `--tunnel-tenant <tenant-id>` to select an Entra tenant. The command
|
|
94
|
+
creates no anonymous access rule and deletes the tunnel when Metro exits.
|
|
95
|
+
Entra authentication stays on the workstation; the QR code gives the Dev
|
|
96
|
+
Player a tunnel-scoped connect token for Metro bundle and asset requests.
|
|
97
|
+
Enterprise firewalls must allow outbound HTTPS on port 443
|
|
98
|
+
to `login.microsoftonline.com`, `global.rel.tunnels.api.visualstudio.com`,
|
|
99
|
+
`*.rel.tunnels.api.visualstudio.com`, and `*.devtunnels.ms`, with TLS 1.2 or
|
|
100
|
+
newer.
|
|
101
|
+
|
|
85
102
|
6. Preview the app by scanning the QR code with the Power Apps Developer app.
|
|
86
103
|
|
|
87
104
|
- App Store: https://apps.apple.com/us/app/power-apps-developer/id6753083462
|
|
@@ -153,6 +170,48 @@ export default function App() {
|
|
|
153
170
|
|
|
154
171
|
See `src/index.ts` for the full exported API.
|
|
155
172
|
|
|
173
|
+
### Custom multi-tenant experience
|
|
174
|
+
|
|
175
|
+
Single-tenant apps and multi-tenant apps using the built-in screens do not
|
|
176
|
+
need any root-layout changes. To replace the multi-tenant sign-in, discovery,
|
|
177
|
+
environment selection, loading, and error screens, pass a component through
|
|
178
|
+
`multiTenantExperience`:
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import {
|
|
182
|
+
PowerAppsProvider,
|
|
183
|
+
PowerAppsRuntimeGate,
|
|
184
|
+
usePowerAppsExperience,
|
|
185
|
+
} from '@microsoft/power-apps-native-host';
|
|
186
|
+
|
|
187
|
+
function CustomerExperience({ children }: React.PropsWithChildren) {
|
|
188
|
+
const experience = usePowerAppsExperience();
|
|
189
|
+
|
|
190
|
+
if (experience.status === 'signIn') {
|
|
191
|
+
return <LoginScreen error={experience.error} onSignIn={experience.signIn} />;
|
|
192
|
+
}
|
|
193
|
+
if (experience.status === 'selectEnvironment') {
|
|
194
|
+
return <EnvironmentPicker {...experience} />;
|
|
195
|
+
}
|
|
196
|
+
if (experience.status === 'ready') {
|
|
197
|
+
return <PowerAppsRuntimeGate>{children}</PowerAppsRuntimeGate>;
|
|
198
|
+
}
|
|
199
|
+
return <BootstrapStatusScreen experience={experience} />;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export default function RootLayout() {
|
|
203
|
+
return (
|
|
204
|
+
<PowerAppsProvider {...config} multiTenantExperience={CustomerExperience}>
|
|
205
|
+
<Slot />
|
|
206
|
+
</PowerAppsProvider>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The experience model exposes presentation-safe state and commands only. Target
|
|
212
|
+
authentication sessions, access tokens, token brokers, and stale-operation
|
|
213
|
+
generation state remain internal to `PowerAppsProvider`.
|
|
214
|
+
|
|
156
215
|
## Metro Logger
|
|
157
216
|
|
|
158
217
|
Metro configuration can import the Node-only logger from
|
|
@@ -177,6 +236,7 @@ withPowerNativeMetroLogging(middleware, {
|
|
|
177
236
|
This package exposes these CLI scripts through the `bin` field:
|
|
178
237
|
|
|
179
238
|
- `generate-connector-schemas` - generates TypeScript schemas from connector definitions.
|
|
239
|
+
- `power-apps-dev` - starts Expo; pass `--tunnel` for a private authenticated Dev Tunnel.
|
|
180
240
|
- `js-bundle` - packages the JavaScript bundle for embedding.
|
|
181
241
|
- `build-ios-base` - builds the iOS base framework.
|
|
182
242
|
- `wrap` - builds a wrapped Android or iOS app.
|