@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
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* },
|
|
31
31
|
* });
|
|
32
32
|
*/
|
|
33
|
+
import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
|
|
33
34
|
import type { DatabaseReference } from '../platform/DataverseDataSources.js';
|
|
34
35
|
import type { OnDisambiguationNeeded, OnMissingConnection } from '../connections/types.js';
|
|
35
36
|
import type { ConnectorSchema } from './resolveConnections.js';
|
|
@@ -88,6 +89,14 @@ export interface UseConnectionRefsOptions {
|
|
|
88
89
|
* as missing so the setup screen can guide the user to create a new one.
|
|
89
90
|
*/
|
|
90
91
|
isvClientId?: string;
|
|
92
|
+
/** Called when an existing environment response establishes telemetry geography. */
|
|
93
|
+
onTelemetryLocationResolved?: (location: TelemetryLocation) => void;
|
|
94
|
+
targetIdentity?: {
|
|
95
|
+
tenantId: string;
|
|
96
|
+
appName: string;
|
|
97
|
+
generation: number;
|
|
98
|
+
accountIdentifier: string;
|
|
99
|
+
};
|
|
91
100
|
}
|
|
92
101
|
export interface UseConnectionRefsResult {
|
|
93
102
|
connectionRefs: Record<string, AppConnectionReference>;
|
|
@@ -122,7 +131,7 @@ export interface UseConnectionRefsResult {
|
|
|
122
131
|
/** Database references resolved from the RP launch response. */
|
|
123
132
|
databaseReferences: Record<string, DatabaseReference>;
|
|
124
133
|
}
|
|
125
|
-
export type ConnectionResolutionErrorKind = 'app-access-denied' | 'generic';
|
|
134
|
+
export type ConnectionResolutionErrorKind = 'app-access-denied' | 'app-not-found' | 'generic';
|
|
126
135
|
/**
|
|
127
136
|
* Resolves Power Platform connection references for the current user, with
|
|
128
137
|
* disambiguation support for environments where multiple connections exist for
|
|
@@ -133,5 +142,5 @@ export type ConnectionResolutionErrorKind = 'app-access-denied' | 'generic';
|
|
|
133
142
|
* Both paths disambiguate candidates, pre-warm Dataverse authentication, and
|
|
134
143
|
* return a fully populated bridge configuration.
|
|
135
144
|
*/
|
|
136
|
-
export declare function useConnectionRefs({ isSignedIn, acquireToken, appId, environmentId, region, connectionReferences, hasDataverse, schemaMap, onDisambiguationNeeded, onMissingConnection, isvClientId, }: UseConnectionRefsOptions): UseConnectionRefsResult;
|
|
145
|
+
export declare function useConnectionRefs({ isSignedIn, acquireToken, appId, environmentId, region, connectionReferences, hasDataverse, schemaMap, onDisambiguationNeeded, onMissingConnection, isvClientId, onTelemetryLocationResolved, targetIdentity, }: UseConnectionRefsOptions): UseConnectionRefsResult;
|
|
137
146
|
//# sourceMappingURL=useConnectionRefs.d.ts.map
|
|
@@ -9,7 +9,7 @@ export { PowerPagesBridge, setupPowerPagesHost } from './bridge/PowerPagesBridge
|
|
|
9
9
|
export type { PowerPagesBridgeOptions } from './bridge/PowerPagesBridge.js';
|
|
10
10
|
export type { NativeBridgeOptions, CdsDataSourceConfig, AppConnection, AppConnectionReference } from './bridge/NativePowerAppsBridge.js';
|
|
11
11
|
export { buildConnectionReferences } from './bridge/NativePowerAppsBridge.js';
|
|
12
|
-
export { setupNativeHost } from './bridge/setupNativeHost.js';
|
|
12
|
+
export { invalidateNativeHostRuntime, setupNativeHost } from './bridge/setupNativeHost.js';
|
|
13
13
|
export { updateBridgeOptionsInPlace } from './bridge/bridgeState.js';
|
|
14
14
|
export { AuthProvider, useAuth } from './auth/AuthContext';
|
|
15
15
|
export type { AuthState, AuthProviderProps } from './auth/AuthContext';
|
|
@@ -19,8 +19,12 @@ export { PowerAppsHostProvider } from './provider/PowerAppsHostProvider';
|
|
|
19
19
|
export type { PowerAppsHostProviderProps } from './provider/PowerAppsHostProvider';
|
|
20
20
|
export { PowerAppsProvider } from './provider/PowerAppsProvider.js';
|
|
21
21
|
export type { AppInsightsConfig, PowerAppsAppConfig, PowerAppsProviderProps, PowerConfig, } from './provider/PowerAppsProvider.js';
|
|
22
|
+
export { PowerAppsRuntimeGate, usePowerAppsExperience } from './target/PowerAppsExperience.js';
|
|
23
|
+
export type { PowerAppsEnvironmentSummary, PowerAppsExperience, PowerAppsExperienceComponent, PowerAppsExperienceComponentProps, PowerAppsExperienceError, } from './target/PowerAppsExperience.js';
|
|
22
24
|
export { buildEnvironmentEndpoint, POWER_PLATFORM_API_SCOPE } from './platform/PowerPlatformEnvironmentApi.js';
|
|
23
25
|
export { fetchInstanceUrl } from './platform/DataverseGlobalDiscoveryApi.js';
|
|
26
|
+
export { buildCanvasAppResolutionUrl, canonicalizeDataverseOrigin, } from './platform/CanvasAppResolution.js';
|
|
27
|
+
export { resolveCanvasApp } from './platform/CanvasAppResolutionApi.js';
|
|
24
28
|
export { buildCdsDataSources } from './platform/DataverseDataSources.js';
|
|
25
29
|
export type { LinkedEnvironmentMetadata, DatabaseReference, DatabaseReferenceDataSource } from './platform/DataverseDataSources.js';
|
|
26
30
|
export { useConnectionRefs } from './connections/useConnectionRefs.js';
|
|
@@ -47,7 +51,7 @@ export { ImagePicker } from './controls/ImagePicker.js';
|
|
|
47
51
|
export type { ImagePickerProps, PickedImageInfo } from './controls/ImagePicker.js';
|
|
48
52
|
export { isDevPlayer } from './utils/isDevPlayer.js';
|
|
49
53
|
export { base64ToDataverseUploadFile, base64ToUint8Array, createDataverseUploadFile, } from './utils/dataverseUtils.js';
|
|
50
|
-
export { getAppLogger, configureAppLogger,
|
|
51
|
-
export type {
|
|
54
|
+
export { getAppLogger, configureAppLogger, getCustomEventsLogger, HostOperationNames, } from './telemetry/index.js';
|
|
55
|
+
export type { ICustomEventsLogger, ILogger, } from '@microsoft/power-apps-native-common';
|
|
52
56
|
export { ErrorBoundary } from './ErrorBoundary.js';
|
|
53
57
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function canonicalizeDataverseOrigin(value: string): string;
|
|
2
|
+
export declare function areDataverseOriginAliases(left: string, right: string): boolean;
|
|
3
|
+
export declare function buildCanvasAppResolutionUrl(dataverseApiUrl: string, appName: string): string;
|
|
4
|
+
//# sourceMappingURL=CanvasAppResolution.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PowerPlatformTarget, ResolvedPowerPlatformTarget } from '../target/types.js';
|
|
2
|
+
export declare function resolveCanvasApp(target: PowerPlatformTarget, dataverseApiUrl: string, acquireToken: (scopes: string[]) => Promise<string | null>, generation?: {
|
|
3
|
+
value: number;
|
|
4
|
+
isCurrent: (value: number) => boolean;
|
|
5
|
+
}): Promise<ResolvedPowerPlatformTarget>;
|
|
6
|
+
//# sourceMappingURL=CanvasAppResolutionApi.d.ts.map
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
|
|
2
|
+
import type { PowerPlatformTarget } from '../target/types.js';
|
|
3
|
+
/** Enumerate enabled commercial-cloud Dataverse environments available to an authenticated tenant account. */
|
|
4
|
+
export declare function fetchAccessibleEnvironments(tenantId: string, appDisplayName: string, appName: string, acquireToken: (scopes: string[]) => Promise<string | null>): Promise<PowerPlatformTarget[]>;
|
|
5
|
+
export interface DataverseInstanceMetadata {
|
|
6
|
+
instanceUrl: string;
|
|
7
|
+
telemetryLocation?: TelemetryLocation;
|
|
8
|
+
}
|
|
9
|
+
/** Fetch Dataverse environment metadata from the Global Discovery Service. */
|
|
10
|
+
export declare function fetchInstanceMetadata(environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>, _bearerToken?: string): Promise<DataverseInstanceMetadata | undefined>;
|
|
11
|
+
/** Fetch only the Dataverse instance URL for callers that do not need region metadata. */
|
|
12
|
+
export declare function fetchInstanceUrl(environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>, bearerToken?: string): Promise<string | undefined>;
|
|
3
13
|
//# sourceMappingURL=DataverseGlobalDiscoveryApi.d.ts.map
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
import type { PowerPlatformTarget } from '../target/types.js';
|
|
2
|
+
export type DiscoveryInstance = {
|
|
3
|
+
ApiUrl?: unknown;
|
|
4
|
+
EnvironmentId?: unknown;
|
|
5
|
+
FriendlyName?: unknown;
|
|
6
|
+
Region?: unknown;
|
|
7
|
+
State?: unknown;
|
|
8
|
+
TenantId?: unknown;
|
|
9
|
+
};
|
|
10
|
+
export declare function isEnabledDiscoveryState(state: unknown): boolean;
|
|
11
|
+
export declare function parseDiscoveredEnvironments(instances: DiscoveryInstance[], tenantId: string, appDisplayName: string, appName: string): PowerPlatformTarget[];
|
|
1
12
|
export declare function globalDiscoveryEndpoint(region: string): string;
|
|
2
13
|
export declare function globalDiscoveryScope(region: string): string;
|
|
3
14
|
export declare function buildGlobalDiscoveryUrl(environmentId: string, region: string): string;
|
|
15
|
+
export declare function buildGlobalDiscoveryListUrl(region: string): string;
|
|
4
16
|
//# sourceMappingURL=GlobalDiscovery.d.ts.map
|
|
@@ -31,6 +31,7 @@ import type { ConnectorSchema } from '../connections/useConnectionRefs.js';
|
|
|
31
31
|
import type { DatabaseReference } from '../platform/DataverseDataSources.js';
|
|
32
32
|
import type { OnDisambiguationNeeded } from '../connections/types.js';
|
|
33
33
|
import type { ConnectionReferenceConfig, ConnectionUsageInput, ResourceConsentRequirement } from '../connections/types.js';
|
|
34
|
+
import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
|
|
34
35
|
export interface PowerAppsHostProviderProps {
|
|
35
36
|
/**
|
|
36
37
|
* Callback to acquire an access token for the given scopes.
|
|
@@ -104,6 +105,13 @@ export interface PowerAppsHostProviderProps {
|
|
|
104
105
|
* appid at runtime (prevents 403 "missing connection ACL" for third-party tokens).
|
|
105
106
|
*/
|
|
106
107
|
isvClientId: string;
|
|
108
|
+
targetGeneration?: number;
|
|
109
|
+
targetTenantId?: string;
|
|
110
|
+
targetAppName?: string;
|
|
111
|
+
targetAccountIdentifier?: string;
|
|
112
|
+
expectedDataverseOrigin?: string;
|
|
113
|
+
/** Receives geography resolved from API responses already used during startup. */
|
|
114
|
+
onTelemetryLocationResolved?: (location: TelemetryLocation) => void;
|
|
107
115
|
/**
|
|
108
116
|
* Called when multiple Connected connections exist for the same connector.
|
|
109
117
|
* Present a native picker UI and return the chosen connectionId, or null to
|
|
@@ -130,5 +138,5 @@ export interface PowerAppsHostProviderProps {
|
|
|
130
138
|
*
|
|
131
139
|
* Children are never rendered until all required connections are resolved.
|
|
132
140
|
*/
|
|
133
|
-
export declare function PowerAppsHostProvider({ acquireToken, isSignedIn, onSignOut, appId, environmentId, region, connectionReferences, schemaMap, databaseReferences, renderOAuthWebView, isvClientId, onDisambiguationNeeded, onConnectionConsent, onResourceConsent, onConnectionConsentDeclined, children, }: PowerAppsHostProviderProps): React.JSX.Element;
|
|
141
|
+
export declare function PowerAppsHostProvider({ acquireToken, isSignedIn, onSignOut, appId, environmentId, region, connectionReferences, schemaMap, databaseReferences, renderOAuthWebView, isvClientId, onTelemetryLocationResolved, targetGeneration, targetTenantId, targetAppName, targetAccountIdentifier, expectedDataverseOrigin, onDisambiguationNeeded, onConnectionConsent, onResourceConsent, onConnectionConsentDeclined, children, }: PowerAppsHostProviderProps): React.JSX.Element;
|
|
134
142
|
//# sourceMappingURL=PowerAppsHostProvider.d.ts.map
|
|
@@ -34,6 +34,7 @@ import type { ConnectionReferenceConfig, OnDisambiguationNeeded } from '../conne
|
|
|
34
34
|
import type { ThemeTokens } from '../theme/tokens.js';
|
|
35
35
|
import type { ILogger } from '@microsoft/power-apps-native-common';
|
|
36
36
|
import type { ApplicationInsightsTelemetryProviderConfig } from '@microsoft/power-apps-native-common';
|
|
37
|
+
import type { PowerAppsExperienceComponent } from '../target/PowerAppsExperience.js';
|
|
37
38
|
/** Shape of power.config.json consumed by the provider. */
|
|
38
39
|
export interface PowerConfig {
|
|
39
40
|
/**
|
|
@@ -46,14 +47,6 @@ export interface PowerConfig {
|
|
|
46
47
|
appId?: string | null;
|
|
47
48
|
environmentId?: string;
|
|
48
49
|
region?: string;
|
|
49
|
-
/**
|
|
50
|
-
* BAP environment `location` value (`environment.properties.location` from the
|
|
51
|
-
* Get Environments API). EU locations — `"europe"`, `"unitedkingdom"`,
|
|
52
|
-
* `"france"`, `"germany"`, `"italy"`, `"poland"`, `"norway"`, `"sweden"`,
|
|
53
|
-
* `"switzerland"` — route telemetry to the EU 1DS collector.
|
|
54
|
-
* Omit for the default global collector.
|
|
55
|
-
*/
|
|
56
|
-
geoRegion?: string;
|
|
57
50
|
connectionReferences?: Record<string, ConnectionReferenceConfig>;
|
|
58
51
|
databaseReferences?: Record<string, DatabaseReference>;
|
|
59
52
|
/**
|
|
@@ -79,7 +72,7 @@ export interface PowerAppsAppConfig {
|
|
|
79
72
|
};
|
|
80
73
|
[key: string]: unknown;
|
|
81
74
|
}
|
|
82
|
-
|
|
75
|
+
interface PowerAppsProviderCommonProps {
|
|
83
76
|
/**
|
|
84
77
|
* Contents of the generated app.json.
|
|
85
78
|
*
|
|
@@ -88,10 +81,6 @@ export interface PowerAppsProviderProps {
|
|
|
88
81
|
* The provider falls back to `Constants.expoConfig` when omitted.
|
|
89
82
|
*/
|
|
90
83
|
appConfig?: PowerAppsAppConfig;
|
|
91
|
-
/** MSAL configuration from auth.config.json (msal section). */
|
|
92
|
-
msalConfig: AuthProviderProps['msalConfig'];
|
|
93
|
-
/** Intune MAM configuration. Defaults to enabled in release builds. */
|
|
94
|
-
intuneConfig?: AuthProviderProps['intuneConfig'];
|
|
95
84
|
/** Contents of power.config.json. */
|
|
96
85
|
powerConfig: PowerConfig;
|
|
97
86
|
/**
|
|
@@ -163,7 +152,7 @@ export interface PowerAppsProviderProps {
|
|
|
163
152
|
/**
|
|
164
153
|
* Optional customer-owned Application Insights destination.
|
|
165
154
|
*
|
|
166
|
-
* Events are sent directly to the selected
|
|
155
|
+
* Events are sent directly to the selected customer-owned Application Insights
|
|
167
156
|
* resource and fan out alongside the default Microsoft OneDS provider.
|
|
168
157
|
* Defaults to `appConfig.expo.extra.appInsightsConfig`, then falls back to
|
|
169
158
|
* `Constants.expoConfig.extra.appInsightsConfig`.
|
|
@@ -177,8 +166,18 @@ export interface PowerAppsProviderProps {
|
|
|
177
166
|
* if you want to pass the profile programmatically (e.g., tests).
|
|
178
167
|
*/
|
|
179
168
|
offlineProfile?: Record<string, unknown>;
|
|
169
|
+
/**
|
|
170
|
+
* Customer-owned UI for multi-tenant sign-in, discovery, environment
|
|
171
|
+
* selection, loading, and errors. The built-in experience is used when
|
|
172
|
+
* omitted. Ignored in single-tenant mode.
|
|
173
|
+
*/
|
|
174
|
+
multiTenantExperience?: PowerAppsExperienceComponent;
|
|
180
175
|
children: React.ReactNode;
|
|
181
176
|
}
|
|
177
|
+
export type PowerAppsProviderProps = PowerAppsProviderCommonProps & {
|
|
178
|
+
msalConfig: AuthProviderProps['msalConfig'];
|
|
179
|
+
intuneConfig?: AuthProviderProps['intuneConfig'];
|
|
180
|
+
};
|
|
182
181
|
/**
|
|
183
182
|
* Top-level provider for Power Apps canvas apps running inside an Expo shell.
|
|
184
183
|
*
|
|
@@ -187,7 +186,6 @@ export interface PowerAppsProviderProps {
|
|
|
187
186
|
* component, eliminating all provider boilerplate from the consuming app's
|
|
188
187
|
* root layout.
|
|
189
188
|
*/
|
|
190
|
-
export declare function PowerAppsProvider({
|
|
191
|
-
defaultTheme, theme, darkTheme, followSystemTheme, renderOAuthWebView, onDisambiguationNeeded, onConnectionConsent, onResourceConsent, onConnectionConsentDeclined, appName, logger: loggerProp, showSessionDetailsOnLongPress, showSessionDetailsOnSwipe, appInsightsConfig, offlineProfile, children, }: PowerAppsProviderProps): React.JSX.Element;
|
|
189
|
+
export declare function PowerAppsProvider({ ...props }: PowerAppsProviderProps): React.JSX.Element;
|
|
192
190
|
export {};
|
|
193
191
|
//# sourceMappingURL=PowerAppsProvider.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
export declare function DefaultPowerAppsExperience({ appDisplayName, children, }: PropsWithChildren<{
|
|
4
|
+
appDisplayName: string;
|
|
5
|
+
}>): React.JSX.Element;
|
|
6
|
+
//# sourceMappingURL=DefaultPowerAppsExperience.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PowerAppsEnvironmentSummary {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PowerAppsExperienceError {
|
|
7
|
+
code: string;
|
|
8
|
+
message: string;
|
|
9
|
+
retryable: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type PowerAppsExperience = {
|
|
12
|
+
status: 'preparing';
|
|
13
|
+
} | {
|
|
14
|
+
status: 'signIn';
|
|
15
|
+
error?: string;
|
|
16
|
+
signIn: () => Promise<void>;
|
|
17
|
+
goBack?: () => void;
|
|
18
|
+
} | {
|
|
19
|
+
status: 'discovering';
|
|
20
|
+
} | {
|
|
21
|
+
status: 'selectEnvironment';
|
|
22
|
+
environments: readonly PowerAppsEnvironmentSummary[];
|
|
23
|
+
selectEnvironment: (environmentId: string) => void;
|
|
24
|
+
signOut: () => Promise<void>;
|
|
25
|
+
} | {
|
|
26
|
+
status: 'connecting';
|
|
27
|
+
environment: PowerAppsEnvironmentSummary;
|
|
28
|
+
} | {
|
|
29
|
+
status: 'resolvingApp';
|
|
30
|
+
environment: PowerAppsEnvironmentSummary;
|
|
31
|
+
} | {
|
|
32
|
+
status: 'empty';
|
|
33
|
+
retry: () => void;
|
|
34
|
+
signOut: () => Promise<void>;
|
|
35
|
+
} | {
|
|
36
|
+
status: 'error';
|
|
37
|
+
error: PowerAppsExperienceError;
|
|
38
|
+
retry?: () => void;
|
|
39
|
+
goBack?: () => void;
|
|
40
|
+
signOut?: () => Promise<void>;
|
|
41
|
+
} | {
|
|
42
|
+
status: 'ready';
|
|
43
|
+
environment: PowerAppsEnvironmentSummary;
|
|
44
|
+
};
|
|
45
|
+
export interface PowerAppsExperienceComponentProps {
|
|
46
|
+
appDisplayName: string;
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
export type PowerAppsExperienceComponent = React.ComponentType<PowerAppsExperienceComponentProps>;
|
|
50
|
+
export declare function usePowerAppsExperience(): PowerAppsExperience;
|
|
51
|
+
export declare function PowerAppsRuntimeGate({ children }: {
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
}): React.JSX.Element | null;
|
|
54
|
+
export declare function PowerAppsExperienceBoundary({ experience, appDisplayName, component: Component, children, fallback, }: {
|
|
55
|
+
experience: PowerAppsExperience;
|
|
56
|
+
appDisplayName: string;
|
|
57
|
+
component?: PowerAppsExperienceComponent;
|
|
58
|
+
children?: React.ReactNode;
|
|
59
|
+
fallback: React.ReactNode;
|
|
60
|
+
}): React.JSX.Element;
|
|
61
|
+
//# sourceMappingURL=PowerAppsExperience.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MsalAuthConfig } from '@microsoft/power-apps-native-auth';
|
|
3
|
+
import { type PowerAppsTenantPolicy } from '../config/tenantMode.js';
|
|
4
|
+
import { type PowerAppsExperienceComponent } from './PowerAppsExperience.js';
|
|
5
|
+
import type { ResolvedPowerPlatformTarget, TargetAuthSession } from './types.js';
|
|
6
|
+
export interface PowerAppsTargetBootstrapProps {
|
|
7
|
+
msalConfig: MsalAuthConfig;
|
|
8
|
+
appDisplayName: string;
|
|
9
|
+
appName: string;
|
|
10
|
+
tenantPolicy: PowerAppsTenantPolicy;
|
|
11
|
+
experienceComponent?: PowerAppsExperienceComponent;
|
|
12
|
+
children: (target: ResolvedPowerPlatformTarget, authSession: TargetAuthSession) => React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function PowerAppsTargetBootstrap({ msalConfig, appDisplayName, appName, tenantPolicy, experienceComponent, children }: PowerAppsTargetBootstrapProps): React.JSX.Element;
|
|
15
|
+
//# sourceMappingURL=PowerAppsTargetBootstrap.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type TargetErrorCode = 'invalid-build-config' | 'catalog-invalid' | 'stored-target-invalid' | 'authentication-cancelled' | 'authentication-failed' | 'tenant-mismatch' | 'environment-unavailable' | 'discovery-failed' | 'dataverse-access-denied' | 'app-metadata-missing' | 'app-metadata-ambiguous' | 'app-metadata-access-denied' | 'app-not-found' | 'app-access-denied' | 'launch-target-mismatch' | 'connection-setup-failed' | 'offline-switch-unsupported' | 'switch-blocked' | 'stale-operation' | 'service-unavailable';
|
|
2
|
+
export type TargetErrorStage = 'configuration' | 'authentication' | 'discovery' | 'app-resolution' | 'launch' | 'connections' | 'switching';
|
|
3
|
+
export declare class TargetRuntimeError extends Error {
|
|
4
|
+
readonly code: TargetErrorCode;
|
|
5
|
+
readonly stage: TargetErrorStage;
|
|
6
|
+
readonly retryable: boolean;
|
|
7
|
+
readonly userMessage: string;
|
|
8
|
+
readonly targetId?: string | undefined;
|
|
9
|
+
readonly name = "TargetRuntimeError";
|
|
10
|
+
readonly cause?: unknown;
|
|
11
|
+
constructor(code: TargetErrorCode, stage: TargetErrorStage, retryable: boolean, userMessage: string, targetId?: string | undefined, cause?: unknown);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type PowerPlatformTarget = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
tenantId: string;
|
|
5
|
+
environmentId: string;
|
|
6
|
+
appDisplayName: string;
|
|
7
|
+
appName: string;
|
|
8
|
+
region: string;
|
|
9
|
+
cloud?: 'commercial';
|
|
10
|
+
dataverseApiUrl: string;
|
|
11
|
+
};
|
|
12
|
+
export type ResolvedPowerPlatformTarget = PowerPlatformTarget & {
|
|
13
|
+
appId: string;
|
|
14
|
+
dataverseApiUrl: string;
|
|
15
|
+
};
|
|
16
|
+
export type TargetRuntimeState = 'bootstrapping' | 'selecting' | 'switching' | 'authenticating' | 'resolving' | 'configuring-connections' | 'ready' | 'error';
|
|
17
|
+
export interface TargetTokenBroker {
|
|
18
|
+
readonly tenantId: string;
|
|
19
|
+
readonly generation: number;
|
|
20
|
+
acquireGlobalDiscoveryToken(): Promise<string>;
|
|
21
|
+
acquireDataverseToken(apiUrl: string): Promise<string>;
|
|
22
|
+
acquirePowerPlatformToken(region: string): Promise<string>;
|
|
23
|
+
acquireConnectionUserConsentToken(region: string): Promise<string>;
|
|
24
|
+
acquireApiHubToken(): Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
export interface TargetAuthSession {
|
|
27
|
+
readonly clientId: string;
|
|
28
|
+
readonly accountIdentifier: string;
|
|
29
|
+
readonly accountTenantId: string;
|
|
30
|
+
readonly generation: number;
|
|
31
|
+
readonly tokenBroker: TargetTokenBroker;
|
|
32
|
+
signOut(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* alongside the canonical host operation-name constants.
|
|
9
9
|
*/
|
|
10
10
|
import { HttpClient } from '@microsoft/power-apps-native-common/http';
|
|
11
|
-
export { getAppLogger, configureAppLogger,
|
|
12
|
-
export type {
|
|
11
|
+
export { getAppLogger, configureAppLogger, getCustomEventsLogger } from '@microsoft/power-apps-native-common';
|
|
12
|
+
export type { ICustomEventsLogger } from '@microsoft/power-apps-native-common';
|
|
13
13
|
/**
|
|
14
14
|
* Canonical operation names for host package telemetry.
|
|
15
15
|
* Follow the `PowerAppsHost.<Subsystem>.<Action>` convention so events are
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/power-apps-native-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "React Native host integration for @microsoft/power-apps",
|
|
5
5
|
"author": "Microsoft Corporation",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"./app.plugin.js": "./app.plugin.js"
|
|
48
48
|
},
|
|
49
49
|
"bin": {
|
|
50
|
+
"power-apps-dev": "scripts/dev.js",
|
|
50
51
|
"generate-connector-schemas": "scripts/generate-connector-schemas.js",
|
|
51
52
|
"js-bundle": "scripts/bundle.js",
|
|
52
53
|
"build-codegen-package": "scripts/build-codegen-package.js",
|
|
@@ -74,10 +75,14 @@
|
|
|
74
75
|
"test:offline-compatibility": "bob build && node --test test/OfflineSdkCompatibility.test.js"
|
|
75
76
|
},
|
|
76
77
|
"dependencies": {
|
|
78
|
+
"@azure/identity": "^4.13.3",
|
|
77
79
|
"@expo/config-plugins": "55.0.11",
|
|
80
|
+
"@microsoft/dev-tunnels-connections": "^1.3.60",
|
|
81
|
+
"@microsoft/dev-tunnels-contracts": "^1.3.60",
|
|
82
|
+
"@microsoft/dev-tunnels-management": "^1.3.60",
|
|
78
83
|
"@microsoft/power-apps-native-assets": "^0.3.0",
|
|
79
|
-
"@microsoft/power-apps-native-auth": "^0.
|
|
80
|
-
"@microsoft/power-apps-native-common": "^0.
|
|
84
|
+
"@microsoft/power-apps-native-auth": "^0.4.0",
|
|
85
|
+
"@microsoft/power-apps-native-common": "^0.3.2",
|
|
81
86
|
"@ster5/global-mutex": "3.3.0",
|
|
82
87
|
"@tamagui/config": "2.4.5",
|
|
83
88
|
"@tamagui/core": "2.4.5",
|
|
@@ -85,6 +90,8 @@
|
|
|
85
90
|
"@tamagui/toast": "2.4.5",
|
|
86
91
|
"@tanstack/react-query": "5.62.0",
|
|
87
92
|
"diff": "9.0.0",
|
|
93
|
+
"lan-network": "0.2.1",
|
|
94
|
+
"qrcode-terminal": "^0.12.0",
|
|
88
95
|
"resolve-workspace-root": "2.0.1",
|
|
89
96
|
"write-file-atomic": "7.0.1"
|
|
90
97
|
},
|
|
@@ -95,14 +102,14 @@
|
|
|
95
102
|
"@react-native-community/netinfo": ">=11.0.0",
|
|
96
103
|
"burnt": ">=0.12.2",
|
|
97
104
|
"expo-application": ">=55.0.0 <56",
|
|
98
|
-
"expo-constants": ">=55.0.0 <56",
|
|
99
105
|
"expo-clipboard": ">=55.0.0 <56",
|
|
106
|
+
"expo-constants": ">=55.0.0 <56",
|
|
100
107
|
"expo-document-picker": ">=55.0.13 <56",
|
|
101
108
|
"expo-file-system": ">=55.0.19 <56",
|
|
102
109
|
"expo-image-picker": ">=55.0.20 <56",
|
|
103
110
|
"expo-linking": ">=55.0.14 <56",
|
|
104
|
-
"expo-sharing": ">=55.0.18 <56",
|
|
105
111
|
"expo-secure-store": ">=55.0.0 <56",
|
|
112
|
+
"expo-sharing": ">=55.0.18 <56",
|
|
106
113
|
"expo-web-browser": ">=55.0.14 <56",
|
|
107
114
|
"react": ">=19.2.0 <20",
|
|
108
115
|
"react-dom": ">=19.2.0 <19.3.0",
|
|
@@ -23,10 +23,12 @@
|
|
|
23
23
|
* under the neutral name `powerapps-customer-assets/`, which the native module
|
|
24
24
|
* reads at runtime.
|
|
25
25
|
*
|
|
26
|
-
* manifest.json shape (schemaVersion
|
|
26
|
+
* manifest.json shape (schemaVersion 2):
|
|
27
27
|
* {
|
|
28
|
-
* "schemaVersion":
|
|
28
|
+
* "schemaVersion": 2,
|
|
29
29
|
* "platform": "android" | "ios",
|
|
30
|
+
* "tenantMode": "single" | "multi",
|
|
31
|
+
* "multiTenantConfig": null | { "appDisplayName": "...", "appName": "...", "tenantPolicy": ... },
|
|
30
32
|
* "bundle": { "path": "index.android.bundle.hbc" },
|
|
31
33
|
* "assets": [
|
|
32
34
|
* { "fileHash": "<md5>", "type": "png", "path": "assets/<md5>.png",
|
|
@@ -46,6 +48,10 @@ const path = require('path');
|
|
|
46
48
|
const fs = require('fs');
|
|
47
49
|
const os = require('os');
|
|
48
50
|
const crypto = require('crypto');
|
|
51
|
+
const {
|
|
52
|
+
resolveMultiTenantConfig,
|
|
53
|
+
resolveTenantMode,
|
|
54
|
+
} = require('../lib/commonjs/config/tenantMode.js');
|
|
49
55
|
|
|
50
56
|
const platform = process.argv[2];
|
|
51
57
|
if (platform !== 'android' && platform !== 'ios') {
|
|
@@ -104,6 +110,29 @@ function sha256File(filePath) {
|
|
|
104
110
|
.digest('hex');
|
|
105
111
|
}
|
|
106
112
|
|
|
113
|
+
function canonicalizeJson(value) {
|
|
114
|
+
if (Array.isArray(value)) return value.map(canonicalizeJson);
|
|
115
|
+
if (value && typeof value === 'object') {
|
|
116
|
+
return Object.fromEntries(
|
|
117
|
+
Object.keys(value).sort().map((key) => [key, canonicalizeJson(value[key])]),
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function resolveBuildContract() {
|
|
124
|
+
const appConfigPath = path.join(projectRoot, 'app.json');
|
|
125
|
+
if (!fs.existsSync(appConfigPath)) throw new Error('app.json not found');
|
|
126
|
+
const appConfig = JSON.parse(fs.readFileSync(appConfigPath, 'utf8'));
|
|
127
|
+
const tenantMode = resolveTenantMode(appConfig);
|
|
128
|
+
return {
|
|
129
|
+
tenantMode,
|
|
130
|
+
multiTenantConfig: tenantMode === 'multi'
|
|
131
|
+
? canonicalizeJson(resolveMultiTenantConfig(appConfig))
|
|
132
|
+
: null,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
107
136
|
function isHermesBytecode(filePath) {
|
|
108
137
|
const fd = fs.openSync(filePath, 'r');
|
|
109
138
|
try {
|
|
@@ -194,9 +223,11 @@ function buildAssetPackage(exportDir, distDir, bundlePath) {
|
|
|
194
223
|
const assetsOutDir = path.join(distDir, ASSET_DIR_NAME, 'assets');
|
|
195
224
|
const manifestPath = path.join(distDir, ASSET_DIR_NAME, 'manifest.json');
|
|
196
225
|
|
|
226
|
+
const buildContract = resolveBuildContract();
|
|
197
227
|
const manifest = {
|
|
198
|
-
schemaVersion:
|
|
228
|
+
schemaVersion: 2,
|
|
199
229
|
platform,
|
|
230
|
+
...buildContract,
|
|
200
231
|
// BIN-3: sha256 pins every artifact the wrap pipeline injects. The wrap
|
|
201
232
|
// recomputes these before use, so a truncated or swapped blob fails the
|
|
202
233
|
// build instead of shipping inside a signed app.
|