@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.
Files changed (111) hide show
  1. package/README.md +60 -0
  2. package/compatibility/current.json +1 -1
  3. package/lib/NOTICE.txt +2957 -371
  4. package/lib/commonjs/auth/AuthContext.js +49 -22
  5. package/lib/commonjs/auth/targetAuthorization.js +53 -0
  6. package/lib/commonjs/bridge/NativePowerAppsBridge.js +33 -2
  7. package/lib/commonjs/bridge/PowerPagesBridge.js +1 -3
  8. package/lib/commonjs/bridge/setupNativeHost.js +6 -0
  9. package/lib/commonjs/config/expoConfig.js +14 -0
  10. package/lib/commonjs/config/runtimeTenantMode.js +16 -0
  11. package/lib/commonjs/config/runtimeTenantMode.web.js +9 -0
  12. package/lib/commonjs/config/tenantMode.js +68 -0
  13. package/lib/commonjs/connections/PowerPlatformConnectionApi.js +24 -27
  14. package/lib/commonjs/connections/connectionMetadata.js +2 -2
  15. package/lib/commonjs/connections/resolveConnections.js +8 -3
  16. package/lib/commonjs/connections/types.js +9 -2
  17. package/lib/commonjs/connections/useConnectionRefs.js +19 -10
  18. package/lib/commonjs/index.js +41 -2
  19. package/lib/commonjs/platform/CanvasAppResolution.js +33 -0
  20. package/lib/commonjs/platform/CanvasAppResolutionApi.js +69 -0
  21. package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +50 -13
  22. package/lib/commonjs/platform/GlobalDiscovery.js +40 -1
  23. package/lib/commonjs/provider/PowerAppsHostProvider.js +47 -8
  24. package/lib/commonjs/provider/PowerAppsProvider.js +175 -9
  25. package/lib/commonjs/target/DefaultPowerAppsExperience.js +564 -0
  26. package/lib/commonjs/target/PowerAppsExperience.js +41 -0
  27. package/lib/commonjs/target/PowerAppsTargetBootstrap.js +534 -0
  28. package/lib/commonjs/target/errors.js +24 -0
  29. package/lib/commonjs/target/types.js +1 -0
  30. package/lib/commonjs/telemetry/index.js +2 -2
  31. package/lib/module/auth/AuthContext.js +49 -22
  32. package/lib/module/auth/targetAuthorization.js +48 -0
  33. package/lib/module/bridge/NativePowerAppsBridge.js +33 -2
  34. package/lib/module/bridge/PowerPagesBridge.js +1 -3
  35. package/lib/module/bridge/setupNativeHost.js +5 -0
  36. package/lib/module/config/expoConfig.js +14 -0
  37. package/lib/module/config/runtimeTenantMode.js +12 -0
  38. package/lib/module/config/runtimeTenantMode.web.js +5 -0
  39. package/lib/module/config/tenantMode.js +61 -0
  40. package/lib/module/connections/PowerPlatformConnectionApi.js +24 -27
  41. package/lib/module/connections/connectionMetadata.js +2 -2
  42. package/lib/module/connections/resolveConnections.js +9 -4
  43. package/lib/module/connections/types.js +9 -2
  44. package/lib/module/connections/useConnectionRefs.js +20 -11
  45. package/lib/module/index.js +5 -2
  46. package/lib/module/platform/CanvasAppResolution.js +27 -0
  47. package/lib/module/platform/CanvasAppResolutionApi.js +65 -0
  48. package/lib/module/platform/DataverseGlobalDiscoveryApi.js +49 -14
  49. package/lib/module/platform/GlobalDiscovery.js +37 -1
  50. package/lib/module/provider/PowerAppsHostProvider.js +47 -8
  51. package/lib/module/provider/PowerAppsProvider.js +179 -13
  52. package/lib/module/target/DefaultPowerAppsExperience.js +559 -0
  53. package/lib/module/target/PowerAppsExperience.js +34 -0
  54. package/lib/module/target/PowerAppsTargetBootstrap.js +529 -0
  55. package/lib/module/target/errors.js +19 -0
  56. package/lib/module/target/types.js +1 -0
  57. package/lib/module/telemetry/index.js +1 -1
  58. package/lib/typescript/commonjs/auth/AuthContext.d.ts +11 -2
  59. package/lib/typescript/commonjs/auth/targetAuthorization.d.ts +15 -0
  60. package/lib/typescript/commonjs/bridge/NativePowerAppsBridge.d.ts +6 -0
  61. package/lib/typescript/commonjs/bridge/setupNativeHost.d.ts +2 -0
  62. package/lib/typescript/commonjs/config/runtimeTenantMode.d.ts +3 -0
  63. package/lib/typescript/commonjs/config/runtimeTenantMode.web.d.ts +3 -0
  64. package/lib/typescript/commonjs/config/tenantMode.d.ts +14 -0
  65. package/lib/typescript/commonjs/connections/PowerPlatformConnectionApi.d.ts +5 -2
  66. package/lib/typescript/commonjs/connections/connectionMetadata.d.ts +1 -1
  67. package/lib/typescript/commonjs/connections/types.d.ts +7 -1
  68. package/lib/typescript/commonjs/connections/useConnectionRefs.d.ts +11 -2
  69. package/lib/typescript/commonjs/index.d.ts +7 -3
  70. package/lib/typescript/commonjs/platform/CanvasAppResolution.d.ts +4 -0
  71. package/lib/typescript/commonjs/platform/CanvasAppResolutionApi.d.ts +6 -0
  72. package/lib/typescript/commonjs/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
  73. package/lib/typescript/commonjs/platform/GlobalDiscovery.d.ts +12 -0
  74. package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +9 -1
  75. package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +14 -16
  76. package/lib/typescript/commonjs/target/DefaultPowerAppsExperience.d.ts +6 -0
  77. package/lib/typescript/commonjs/target/PowerAppsExperience.d.ts +61 -0
  78. package/lib/typescript/commonjs/target/PowerAppsTargetBootstrap.d.ts +15 -0
  79. package/lib/typescript/commonjs/target/errors.d.ts +13 -0
  80. package/lib/typescript/commonjs/target/types.d.ts +34 -0
  81. package/lib/typescript/commonjs/telemetry/index.d.ts +2 -2
  82. package/lib/typescript/module/auth/AuthContext.d.ts +11 -2
  83. package/lib/typescript/module/auth/targetAuthorization.d.ts +15 -0
  84. package/lib/typescript/module/bridge/NativePowerAppsBridge.d.ts +6 -0
  85. package/lib/typescript/module/bridge/setupNativeHost.d.ts +2 -0
  86. package/lib/typescript/module/config/runtimeTenantMode.d.ts +3 -0
  87. package/lib/typescript/module/config/runtimeTenantMode.web.d.ts +3 -0
  88. package/lib/typescript/module/config/tenantMode.d.ts +14 -0
  89. package/lib/typescript/module/connections/PowerPlatformConnectionApi.d.ts +5 -2
  90. package/lib/typescript/module/connections/connectionMetadata.d.ts +1 -1
  91. package/lib/typescript/module/connections/types.d.ts +7 -1
  92. package/lib/typescript/module/connections/useConnectionRefs.d.ts +11 -2
  93. package/lib/typescript/module/index.d.ts +7 -3
  94. package/lib/typescript/module/platform/CanvasAppResolution.d.ts +4 -0
  95. package/lib/typescript/module/platform/CanvasAppResolutionApi.d.ts +6 -0
  96. package/lib/typescript/module/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
  97. package/lib/typescript/module/platform/GlobalDiscovery.d.ts +12 -0
  98. package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +9 -1
  99. package/lib/typescript/module/provider/PowerAppsProvider.d.ts +14 -16
  100. package/lib/typescript/module/target/DefaultPowerAppsExperience.d.ts +6 -0
  101. package/lib/typescript/module/target/PowerAppsExperience.d.ts +61 -0
  102. package/lib/typescript/module/target/PowerAppsTargetBootstrap.d.ts +15 -0
  103. package/lib/typescript/module/target/errors.d.ts +13 -0
  104. package/lib/typescript/module/target/types.d.ts +34 -0
  105. package/lib/typescript/module/telemetry/index.d.ts +2 -2
  106. package/package.json +12 -5
  107. package/scripts/build-codegen-package.js +34 -3
  108. package/scripts/dev.js +405 -0
  109. package/scripts/upgrade-authoring.js +85 -28
  110. package/scripts/wrap.js +42 -5
  111. package/src/config/generated-config.d.ts +21 -0
@@ -10,6 +10,7 @@
10
10
  import type { DatabaseReference } from '../platform/DataverseDataSources';
11
11
  import type { ConnectionInput, ConnectionParameterSet, ConnectionRequirement, ConnectionUsageInput, NativeConnectionInstance, ResourceConsentRequirement } from './types';
12
12
  import type { AppConnectionReference } from '../bridge/NativePowerAppsBridge';
13
+ import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
13
14
  export declare class AppLaunchAccessDeniedError extends Error {
14
15
  constructor();
15
16
  }
@@ -149,6 +150,8 @@ export interface AppLaunchResult {
149
150
  * has no linked Dataverse database).
150
151
  */
151
152
  dataverseOrgUrl: string;
153
+ /** Authoritative telemetry geography, or undefined when it cannot be resolved. */
154
+ telemetryLocation?: TelemetryLocation;
152
155
  /** Dataverse table metadata returned by the app launch endpoint. */
153
156
  databaseReferences: Record<string, DatabaseReference>;
154
157
  /**
@@ -202,9 +205,9 @@ export declare function reportScopeConsents(appId: string, usages: ConnectionUsa
202
205
  * @param environmentId - Environment GUID.
203
206
  * @param region - Cluster region (default "prod").
204
207
  * @param token - Bearer token for {@link powerPlatformScope}`(region)`.
205
- * @returns Processed launch data, or `null` when the app is not found.
208
+ * @returns Processed launch data. Missing or inaccessible apps throw a typed error.
206
209
  */
207
- export declare function fetchAppLaunchData(appId: string, environmentId: string, region: string, token: string): Promise<AppLaunchResult | null>;
210
+ export declare function fetchAppLaunchData(appId: string, environmentId: string, region: string, token: string): Promise<AppLaunchResult>;
208
211
  /**
209
212
  * Grant the calling application's delegated access to a connection for the
210
213
  * signed-in user. The backend derives both identities from the token and
@@ -40,7 +40,7 @@ export declare function parseConnectionParameters(parameters: Record<string, Raw
40
40
  export declare function buildConnectionParameterSets(connectionParameters: Record<string, RawConnectionParameter> | undefined, parameterSets: RawConnectionParameterSet[] | undefined): ConnectionParameterSet[];
41
41
  export declare function hasOAuthParameter(parameters: Record<string, RawConnectionParameter> | undefined): boolean;
42
42
  export declare function buildConnectionUserConsentUrl(environmentEndpoint: string, connectorId: string, connectionId: string): string;
43
- export declare function getAppLaunchFailureMessage(status: number, statusText: string, responseText: string): string | null;
43
+ export declare function getAppLaunchFailureMessage(status: number, _statusText: string, _responseText: string): string | null;
44
44
  export declare function isAppLaunchAccessDenied(status: number, responseText: string): boolean;
45
45
  export declare function buildConsentLinkDefinition(redirectUrl: string): ConsentLinkDefinition;
46
46
  export declare function serializeConnectionParameters(input?: ConnectionInput): SerializedConnectionParameters;
@@ -138,7 +138,13 @@ export declare function hasCompleteStaticConnectionConfig(connectionReferences:
138
138
  primaryRuntimeUrl: string;
139
139
  };
140
140
  }>): boolean;
141
- export declare function buildConnectionResolutionKey(appId: string | undefined, environmentId: string, connectionReferences: Record<string, ConnectionReferenceConfig>): string;
141
+ export declare function buildConnectionResolutionKey(appId: string | undefined, environmentId: string, connectionReferences: Record<string, ConnectionReferenceConfig>, targetIdentity?: {
142
+ tenantId?: string;
143
+ appName?: string;
144
+ region?: string;
145
+ generation?: number;
146
+ accountIdentifier?: string;
147
+ }): string;
142
148
  /** A single connection instance returned by the Power Platform connectivity API. */
143
149
  export interface NativeConnectionInstance {
144
150
  /** Terminal connection resource name exactly as returned by Power Platform. */
@@ -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';
34
35
  import type { OnDisambiguationNeeded, OnMissingConnection } from '../connections/types';
35
36
  import type { ConnectorSchema } from './resolveConnections';
@@ -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';
10
10
  export type { NativeBridgeOptions, CdsDataSourceConfig, AppConnection, AppConnectionReference } from './bridge/NativePowerAppsBridge';
11
11
  export { buildConnectionReferences } from './bridge/NativePowerAppsBridge';
12
- export { setupNativeHost } from './bridge/setupNativeHost';
12
+ export { invalidateNativeHostRuntime, setupNativeHost } from './bridge/setupNativeHost';
13
13
  export { updateBridgeOptionsInPlace } from './bridge/bridgeState';
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';
21
21
  export type { AppInsightsConfig, PowerAppsAppConfig, PowerAppsProviderProps, PowerConfig, } from './provider/PowerAppsProvider';
22
+ export { PowerAppsRuntimeGate, usePowerAppsExperience } from './target/PowerAppsExperience';
23
+ export type { PowerAppsEnvironmentSummary, PowerAppsExperience, PowerAppsExperienceComponent, PowerAppsExperienceComponentProps, PowerAppsExperienceError, } from './target/PowerAppsExperience';
22
24
  export { buildEnvironmentEndpoint, POWER_PLATFORM_API_SCOPE } from './platform/PowerPlatformEnvironmentApi';
23
25
  export { fetchInstanceUrl } from './platform/DataverseGlobalDiscoveryApi';
26
+ export { buildCanvasAppResolutionUrl, canonicalizeDataverseOrigin, } from './platform/CanvasAppResolution';
27
+ export { resolveCanvasApp } from './platform/CanvasAppResolutionApi';
24
28
  export { buildCdsDataSources } from './platform/DataverseDataSources';
25
29
  export type { LinkedEnvironmentMetadata, DatabaseReference, DatabaseReferenceDataSource } from './platform/DataverseDataSources';
26
30
  export { useConnectionRefs } from './connections/useConnectionRefs';
@@ -47,7 +51,7 @@ export { ImagePicker } from './controls/ImagePicker';
47
51
  export type { ImagePickerProps, PickedImageInfo } from './controls/ImagePicker';
48
52
  export { isDevPlayer } from './utils/isDevPlayer';
49
53
  export { base64ToDataverseUploadFile, base64ToUint8Array, createDataverseUploadFile, } from './utils/dataverseUtils';
50
- export { getAppLogger, configureAppLogger, getCustomerTelemetryLogger, HostOperationNames, } from './telemetry';
51
- export type { ICustomerTelemetryLogger, ILogger, } from '@microsoft/power-apps-native-common';
54
+ export { getAppLogger, configureAppLogger, getCustomEventsLogger, HostOperationNames, } from './telemetry';
55
+ export type { ICustomEventsLogger, ILogger, } from '@microsoft/power-apps-native-common';
52
56
  export { ErrorBoundary } from './ErrorBoundary';
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';
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
- /** Fetch the Dataverse instance URL from the Dataverse Global Discovery Service. */
2
- export declare function fetchInstanceUrl(environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>, _bearerToken?: string): Promise<string | undefined>;
1
+ import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
2
+ import type { PowerPlatformTarget } from '../target/types';
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';
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';
31
31
  import type { DatabaseReference } from '../platform/DataverseDataSources';
32
32
  import type { OnDisambiguationNeeded } from '../connections/types';
33
33
  import type { ConnectionReferenceConfig, ConnectionUsageInput, ResourceConsentRequirement } from '../connections/types';
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';
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';
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
- export interface PowerAppsProviderProps {
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 C1-owned Application Insights
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({ appConfig, msalConfig, intuneConfig, powerConfig, schemaMap, tamaguiConfig, // override with app's tamagui.config.ts
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';
4
+ import { type PowerAppsExperienceComponent } from './PowerAppsExperience';
5
+ import type { ResolvedPowerPlatformTarget, TargetAuthSession } from './types';
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, getCustomerTelemetryLogger } from '@microsoft/power-apps-native-common';
12
- export type { ICustomerTelemetryLogger } from '@microsoft/power-apps-native-common';
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
@@ -14,7 +14,7 @@
14
14
  * </AuthProvider>
15
15
  */
16
16
  import React from 'react';
17
- import type { MsalAuthConfig, IntuneConfig } from '@microsoft/power-apps-native-auth';
17
+ import type { MSALAccount, MsalAuthConfig, IntuneConfig } from '@microsoft/power-apps-native-auth';
18
18
  export interface AuthState {
19
19
  isLoading: boolean;
20
20
  isAuthReady: boolean;
@@ -28,6 +28,7 @@ export interface AuthState {
28
28
  * in a perpetual "waiting-for-auth" retry loop.
29
29
  */
30
30
  hasRealAccount: boolean;
31
+ account: MSALAccount | null;
31
32
  error: Error | null;
32
33
  acquireToken: (scopes: string[]) => Promise<string | null>;
33
34
  signIn: () => Promise<void>;
@@ -48,9 +49,17 @@ export interface AuthProviderProps {
48
49
  intuneConfig?: IntuneConfig;
49
50
  /** Token audiences that must be available before the account is considered signed in. */
50
51
  requiredScopes?: string[];
52
+ /** Tenant that every cached and newly acquired account must belong to. */
53
+ expectedTenantId?: string;
54
+ /** Authority segment used to initialize MSAL, such as `organizations` or a tenant GUID. */
55
+ authorityTenant?: string;
56
+ /** Cached account to restore when moving between authority-specific providers. */
57
+ preferredAccountIdentifier?: string;
58
+ /** Automatically request missing consent for the preferred cached account. */
59
+ autoAuthorizeMissingScopes?: boolean;
51
60
  children: React.ReactNode;
52
61
  }
53
- export declare function AuthProvider({ msalConfig, intuneConfig, requiredScopes, children, }: AuthProviderProps): React.JSX.Element;
62
+ export declare function AuthProvider({ msalConfig, intuneConfig, requiredScopes, expectedTenantId, authorityTenant, preferredAccountIdentifier, autoAuthorizeMissingScopes, children, }: AuthProviderProps): React.JSX.Element;
54
63
  /**
55
64
  * Returns the current auth state from the nearest <AuthProvider>.
56
65
  * Must be called within the AuthProvider tree.
@@ -0,0 +1,15 @@
1
+ import type { MSALAccount, MSALResult } from '@microsoft/power-apps-native-auth';
2
+ interface TargetAuthorizationClient {
3
+ acquireToken(params: {
4
+ scopes: string[];
5
+ loginHint?: string;
6
+ }): Promise<MSALResult>;
7
+ acquireTokenSilent(params: {
8
+ scopes: string[];
9
+ account: MSALAccount;
10
+ }): Promise<MSALResult>;
11
+ }
12
+ export declare function isInteractionRequired(error: unknown): boolean;
13
+ export declare function authorizeRequiredScopes(client: TargetAuthorizationClient, account: MSALAccount, scopes: string[], expectedTenantId?: string): Promise<MSALAccount>;
14
+ export {};
15
+ //# sourceMappingURL=targetAuthorization.d.ts.map
@@ -53,6 +53,10 @@ export declare function buildConnectionReferences(powerConfigConnectionReference
53
53
  [key: string]: unknown;
54
54
  }>): Record<string, AppConnectionReference>;
55
55
  export type NativeBridgeOptions = {
56
+ /** Active target generation. Changes invalidate in-flight bridge requests. */
57
+ targetGeneration?: number;
58
+ /** Target and account identity represented by the current bridge options. */
59
+ runtimeIdentity?: string;
56
60
  /**
57
61
  * Return an auth token scoped to a connector API endpoint.
58
62
  * @param apiId - Connection API identifier (e.g. "shared_sharepointonline").
@@ -76,6 +80,7 @@ export type NativeBridgeOptions = {
76
80
  };
77
81
  export declare class NativePowerAppsBridge {
78
82
  private _options;
83
+ private _runtimeEpoch;
79
84
  constructor(_options: NativeBridgeOptions);
80
85
  /**
81
86
  * Updates the bridge's options in-place.
@@ -86,6 +91,7 @@ export declare class NativePowerAppsBridge {
86
91
  * via globalThis would have no effect — mutating options is the correct path.
87
92
  */
88
93
  updateOptions(options: NativeBridgeOptions): void;
94
+ invalidateRuntime(): void;
89
95
  initialize(): Promise<void>;
90
96
  /**
91
97
  * Hermes-safe body construction. Returns the raw body value so that
@@ -36,4 +36,6 @@ import type { NativeBridgeOptions } from './NativePowerAppsBridge.js';
36
36
  * ```
37
37
  */
38
38
  export declare function setupNativeHost(options: NativeBridgeOptions): void;
39
+ /** Invalidates in-flight work without replacing the SDK-cached bridge singleton. */
40
+ export declare function invalidateNativeHostRuntime(): void;
39
41
  //# sourceMappingURL=setupNativeHost.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { PowerAppsTenantMode } from './tenantMode.js';
2
+ export declare function assertNativeTenantMode(tenantMode: PowerAppsTenantMode): void;
3
+ //# sourceMappingURL=runtimeTenantMode.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { PowerAppsTenantMode } from './tenantMode.js';
2
+ export declare function assertNativeTenantMode(_tenantMode: PowerAppsTenantMode): void;
3
+ //# sourceMappingURL=runtimeTenantMode.web.d.ts.map
@@ -0,0 +1,14 @@
1
+ export type PowerAppsTenantMode = 'single' | 'multi';
2
+ export type PowerAppsTenantPolicy = 'organizations' | {
3
+ allowedTenantIds: string[];
4
+ };
5
+ export declare const MULTI_TENANT_AUTHORITY = "common";
6
+ export type PowerAppsMultiTenantConfig = {
7
+ appDisplayName: string;
8
+ appName: string;
9
+ tenantPolicy: PowerAppsTenantPolicy;
10
+ };
11
+ export declare function resolveTenantMode(appConfig: unknown): PowerAppsTenantMode;
12
+ export declare function resolveMultiTenantConfig(appConfig: unknown): PowerAppsMultiTenantConfig;
13
+ export declare function isTenantAllowed(tenantId: string, policy: PowerAppsTenantPolicy): boolean;
14
+ //# sourceMappingURL=tenantMode.d.ts.map
@@ -10,6 +10,7 @@
10
10
  import type { DatabaseReference } from '../platform/DataverseDataSources.js';
11
11
  import type { ConnectionInput, ConnectionParameterSet, ConnectionRequirement, ConnectionUsageInput, NativeConnectionInstance, ResourceConsentRequirement } from './types.js';
12
12
  import type { AppConnectionReference } from '../bridge/NativePowerAppsBridge.js';
13
+ import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
13
14
  export declare class AppLaunchAccessDeniedError extends Error {
14
15
  constructor();
15
16
  }
@@ -149,6 +150,8 @@ export interface AppLaunchResult {
149
150
  * has no linked Dataverse database).
150
151
  */
151
152
  dataverseOrgUrl: string;
153
+ /** Authoritative telemetry geography, or undefined when it cannot be resolved. */
154
+ telemetryLocation?: TelemetryLocation;
152
155
  /** Dataverse table metadata returned by the app launch endpoint. */
153
156
  databaseReferences: Record<string, DatabaseReference>;
154
157
  /**
@@ -202,9 +205,9 @@ export declare function reportScopeConsents(appId: string, usages: ConnectionUsa
202
205
  * @param environmentId - Environment GUID.
203
206
  * @param region - Cluster region (default "prod").
204
207
  * @param token - Bearer token for {@link powerPlatformScope}`(region)`.
205
- * @returns Processed launch data, or `null` when the app is not found.
208
+ * @returns Processed launch data. Missing or inaccessible apps throw a typed error.
206
209
  */
207
- export declare function fetchAppLaunchData(appId: string, environmentId: string, region: string, token: string): Promise<AppLaunchResult | null>;
210
+ export declare function fetchAppLaunchData(appId: string, environmentId: string, region: string, token: string): Promise<AppLaunchResult>;
208
211
  /**
209
212
  * Grant the calling application's delegated access to a connection for the
210
213
  * signed-in user. The backend derives both identities from the token and
@@ -40,7 +40,7 @@ export declare function parseConnectionParameters(parameters: Record<string, Raw
40
40
  export declare function buildConnectionParameterSets(connectionParameters: Record<string, RawConnectionParameter> | undefined, parameterSets: RawConnectionParameterSet[] | undefined): ConnectionParameterSet[];
41
41
  export declare function hasOAuthParameter(parameters: Record<string, RawConnectionParameter> | undefined): boolean;
42
42
  export declare function buildConnectionUserConsentUrl(environmentEndpoint: string, connectorId: string, connectionId: string): string;
43
- export declare function getAppLaunchFailureMessage(status: number, statusText: string, responseText: string): string | null;
43
+ export declare function getAppLaunchFailureMessage(status: number, _statusText: string, _responseText: string): string | null;
44
44
  export declare function isAppLaunchAccessDenied(status: number, responseText: string): boolean;
45
45
  export declare function buildConsentLinkDefinition(redirectUrl: string): ConsentLinkDefinition;
46
46
  export declare function serializeConnectionParameters(input?: ConnectionInput): SerializedConnectionParameters;
@@ -138,7 +138,13 @@ export declare function hasCompleteStaticConnectionConfig(connectionReferences:
138
138
  primaryRuntimeUrl: string;
139
139
  };
140
140
  }>): boolean;
141
- export declare function buildConnectionResolutionKey(appId: string | undefined, environmentId: string, connectionReferences: Record<string, ConnectionReferenceConfig>): string;
141
+ export declare function buildConnectionResolutionKey(appId: string | undefined, environmentId: string, connectionReferences: Record<string, ConnectionReferenceConfig>, targetIdentity?: {
142
+ tenantId?: string;
143
+ appName?: string;
144
+ region?: string;
145
+ generation?: number;
146
+ accountIdentifier?: string;
147
+ }): string;
142
148
  /** A single connection instance returned by the Power Platform connectivity API. */
143
149
  export interface NativeConnectionInstance {
144
150
  /** Terminal connection resource name exactly as returned by Power Platform. */