@microsoft/power-apps-native-host 0.2.22 → 0.3.0

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 (156) hide show
  1. package/README.md +162 -26
  2. package/compatibility/current.json +87 -0
  3. package/lib/NOTICE.txt +140 -1226
  4. package/lib/commonjs/auth/AuthContext.js +74 -18
  5. package/lib/commonjs/auth/AuthContext.web.js +32 -0
  6. package/lib/commonjs/auth/completePowerAppsAuthSession.js +16 -0
  7. package/lib/commonjs/bridge/NativePowerAppsBridge.js +20 -17
  8. package/lib/commonjs/bridge/PowerPagesBridge.js +157 -0
  9. package/lib/commonjs/bridge/bridgeState.js +40 -0
  10. package/lib/commonjs/connections/ConnectionSetupScreen.js +459 -80
  11. package/lib/commonjs/connections/PowerPlatformConnectionApi.js +946 -0
  12. package/lib/commonjs/connections/connectionMetadata.js +127 -0
  13. package/lib/commonjs/connections/connectionState.js +96 -0
  14. package/lib/commonjs/connections/disambiguate.js +19 -11
  15. package/lib/commonjs/connections/resolveConnections.js +347 -0
  16. package/lib/commonjs/connections/types.js +106 -0
  17. package/lib/commonjs/{platform → connections}/useConnectionRefs.js +128 -65
  18. package/lib/commonjs/connections/useConnectionSetup.js +111 -52
  19. package/lib/commonjs/controls/FilePicker.js +6 -0
  20. package/lib/commonjs/controls/ImagePicker.js +8 -0
  21. package/lib/commonjs/index.js +188 -6
  22. package/lib/commonjs/logger.js +9 -6
  23. package/lib/commonjs/offline/createOfflineHostActivationCallbacks.js +61 -0
  24. package/lib/commonjs/offline/useOfflineIntegration.js +12 -0
  25. package/lib/commonjs/offline/useOfflineIntegration.web.js +11 -0
  26. package/lib/commonjs/offline/useOfflineIntegrationWithStartupGate.js +46 -0
  27. package/lib/commonjs/offline/useOfflineIntegrationWithStartupGate.web.js +13 -0
  28. package/lib/commonjs/platform/DataverseDataSources.js +14 -0
  29. package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +49 -0
  30. package/lib/commonjs/platform/GlobalDiscovery.js +51 -0
  31. package/lib/commonjs/platform/PowerPlatformEnvironmentApi.js +6 -106
  32. package/lib/commonjs/provider/PowerAppsHostProvider.js +156 -25
  33. package/lib/commonjs/provider/PowerAppsHostProvider.web.js +41 -0
  34. package/lib/commonjs/provider/PowerAppsProvider.js +229 -133
  35. package/lib/commonjs/provider/SessionDetailsGesture.js +216 -0
  36. package/lib/commonjs/telemetry/OfflineSdkTelemetry.js +95 -0
  37. package/lib/commonjs/telemetry/OfflineSdkTelemetry.web.js +9 -0
  38. package/lib/commonjs/telemetry/index.js +22 -3
  39. package/lib/module/auth/AuthContext.js +74 -18
  40. package/lib/module/auth/AuthContext.web.js +26 -0
  41. package/lib/module/auth/completePowerAppsAuthSession.js +11 -0
  42. package/lib/module/bridge/NativePowerAppsBridge.js +21 -18
  43. package/lib/module/bridge/PowerPagesBridge.js +151 -0
  44. package/lib/module/bridge/bridgeState.js +34 -0
  45. package/lib/module/connections/ConnectionSetupScreen.js +460 -81
  46. package/lib/module/connections/PowerPlatformConnectionApi.js +932 -0
  47. package/lib/module/connections/connectionMetadata.js +112 -0
  48. package/lib/module/connections/connectionState.js +82 -0
  49. package/lib/module/connections/disambiguate.js +19 -12
  50. package/lib/module/connections/resolveConnections.js +342 -0
  51. package/lib/module/connections/types.js +91 -0
  52. package/lib/module/{platform → connections}/useConnectionRefs.js +129 -66
  53. package/lib/module/connections/useConnectionSetup.js +113 -54
  54. package/lib/module/controls/FilePicker.js +6 -0
  55. package/lib/module/controls/ImagePicker.js +8 -0
  56. package/lib/module/index.js +14 -6
  57. package/lib/module/logger.js +8 -6
  58. package/lib/module/offline/createOfflineHostActivationCallbacks.js +55 -0
  59. package/lib/module/offline/useOfflineIntegration.js +3 -0
  60. package/lib/module/offline/useOfflineIntegration.web.js +7 -0
  61. package/lib/module/offline/useOfflineIntegrationWithStartupGate.js +42 -0
  62. package/lib/module/offline/useOfflineIntegrationWithStartupGate.web.js +9 -0
  63. package/lib/module/platform/DataverseDataSources.js +10 -0
  64. package/lib/module/platform/DataverseGlobalDiscoveryApi.js +45 -0
  65. package/lib/module/platform/GlobalDiscovery.js +45 -0
  66. package/lib/module/platform/PowerPlatformEnvironmentApi.js +5 -104
  67. package/lib/module/provider/PowerAppsHostProvider.js +159 -28
  68. package/lib/module/provider/PowerAppsHostProvider.web.js +36 -0
  69. package/lib/module/provider/PowerAppsProvider.js +233 -137
  70. package/lib/module/provider/SessionDetailsGesture.js +211 -0
  71. package/lib/module/telemetry/OfflineSdkTelemetry.js +91 -0
  72. package/lib/module/telemetry/OfflineSdkTelemetry.web.js +5 -0
  73. package/lib/module/telemetry/index.js +15 -4
  74. package/lib/typescript/commonjs/auth/AuthContext.d.ts +3 -1
  75. package/lib/typescript/commonjs/auth/AuthContext.web.d.ts +21 -0
  76. package/lib/typescript/commonjs/auth/completePowerAppsAuthSession.d.ts +8 -0
  77. package/lib/typescript/commonjs/bridge/PowerPagesBridge.d.ts +18 -0
  78. package/lib/typescript/commonjs/bridge/bridgeState.d.ts +5 -0
  79. package/lib/typescript/commonjs/connections/ConnectionSetupScreen.d.ts +28 -7
  80. package/lib/typescript/commonjs/{platform → connections}/PowerPlatformConnectionApi.d.ts +52 -43
  81. package/lib/typescript/commonjs/connections/connectionMetadata.d.ts +66 -0
  82. package/lib/typescript/commonjs/connections/connectionState.d.ts +16 -0
  83. package/lib/typescript/commonjs/connections/disambiguate.d.ts +4 -2
  84. package/lib/typescript/commonjs/{platform → connections}/resolveConnections.d.ts +19 -19
  85. package/lib/typescript/commonjs/connections/types.d.ts +129 -1
  86. package/lib/typescript/commonjs/{platform → connections}/useConnectionRefs.d.ts +33 -24
  87. package/lib/typescript/commonjs/connections/useConnectionSetup.d.ts +12 -8
  88. package/lib/typescript/commonjs/controls/FilePicker.d.ts +7 -1
  89. package/lib/typescript/commonjs/controls/ImagePicker.d.ts +9 -1
  90. package/lib/typescript/commonjs/index.d.ts +20 -10
  91. package/lib/typescript/commonjs/logger.d.ts +4 -4
  92. package/lib/typescript/commonjs/offline/createOfflineHostActivationCallbacks.d.ts +12 -0
  93. package/lib/typescript/commonjs/offline/useOfflineIntegration.d.ts +2 -0
  94. package/lib/typescript/commonjs/offline/useOfflineIntegration.web.d.ts +4 -0
  95. package/lib/typescript/commonjs/offline/useOfflineIntegrationWithStartupGate.d.ts +15 -0
  96. package/lib/typescript/commonjs/offline/useOfflineIntegrationWithStartupGate.web.d.ts +6 -0
  97. package/lib/typescript/commonjs/platform/DataverseDataSources.d.ts +27 -0
  98. package/lib/typescript/commonjs/platform/DataverseGlobalDiscoveryApi.d.ts +3 -0
  99. package/lib/typescript/commonjs/platform/GlobalDiscovery.d.ts +4 -0
  100. package/lib/typescript/commonjs/platform/PowerPlatformEnvironmentApi.d.ts +3 -74
  101. package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +29 -18
  102. package/lib/typescript/commonjs/provider/PowerAppsHostProvider.web.d.ts +5 -0
  103. package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +32 -10
  104. package/lib/typescript/commonjs/provider/SessionDetailsGesture.d.ts +13 -0
  105. package/lib/typescript/commonjs/telemetry/OfflineSdkTelemetry.d.ts +15 -0
  106. package/lib/typescript/commonjs/telemetry/OfflineSdkTelemetry.web.d.ts +2 -0
  107. package/lib/typescript/commonjs/telemetry/index.d.ts +13 -1
  108. package/lib/typescript/module/auth/AuthContext.d.ts +3 -1
  109. package/lib/typescript/module/auth/AuthContext.web.d.ts +21 -0
  110. package/lib/typescript/module/auth/completePowerAppsAuthSession.d.ts +8 -0
  111. package/lib/typescript/module/bridge/PowerPagesBridge.d.ts +18 -0
  112. package/lib/typescript/module/bridge/bridgeState.d.ts +5 -0
  113. package/lib/typescript/module/connections/ConnectionSetupScreen.d.ts +28 -7
  114. package/lib/typescript/module/{platform → connections}/PowerPlatformConnectionApi.d.ts +52 -43
  115. package/lib/typescript/module/connections/connectionMetadata.d.ts +66 -0
  116. package/lib/typescript/module/connections/connectionState.d.ts +16 -0
  117. package/lib/typescript/module/connections/disambiguate.d.ts +4 -2
  118. package/lib/typescript/module/{platform → connections}/resolveConnections.d.ts +19 -19
  119. package/lib/typescript/module/connections/types.d.ts +129 -1
  120. package/lib/typescript/module/{platform → connections}/useConnectionRefs.d.ts +33 -24
  121. package/lib/typescript/module/connections/useConnectionSetup.d.ts +12 -8
  122. package/lib/typescript/module/controls/FilePicker.d.ts +7 -1
  123. package/lib/typescript/module/controls/ImagePicker.d.ts +9 -1
  124. package/lib/typescript/module/index.d.ts +24 -14
  125. package/lib/typescript/module/logger.d.ts +4 -4
  126. package/lib/typescript/module/offline/createOfflineHostActivationCallbacks.d.ts +12 -0
  127. package/lib/typescript/module/offline/useOfflineIntegration.d.ts +2 -0
  128. package/lib/typescript/module/offline/useOfflineIntegration.web.d.ts +4 -0
  129. package/lib/typescript/module/offline/useOfflineIntegrationWithStartupGate.d.ts +15 -0
  130. package/lib/typescript/module/offline/useOfflineIntegrationWithStartupGate.web.d.ts +6 -0
  131. package/lib/typescript/module/platform/DataverseDataSources.d.ts +27 -0
  132. package/lib/typescript/module/platform/DataverseGlobalDiscoveryApi.d.ts +3 -0
  133. package/lib/typescript/module/platform/GlobalDiscovery.d.ts +4 -0
  134. package/lib/typescript/module/platform/PowerPlatformEnvironmentApi.d.ts +3 -74
  135. package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +29 -18
  136. package/lib/typescript/module/provider/PowerAppsHostProvider.web.d.ts +5 -0
  137. package/lib/typescript/module/provider/PowerAppsProvider.d.ts +34 -12
  138. package/lib/typescript/module/provider/SessionDetailsGesture.d.ts +13 -0
  139. package/lib/typescript/module/telemetry/OfflineSdkTelemetry.d.ts +15 -0
  140. package/lib/typescript/module/telemetry/OfflineSdkTelemetry.web.d.ts +2 -0
  141. package/lib/typescript/module/telemetry/index.d.ts +13 -1
  142. package/package.json +43 -18
  143. package/scripts/build-ios-base.js +66 -27
  144. package/scripts/bundle.js +212 -5
  145. package/scripts/generate-connector-schemas.js +8 -6
  146. package/scripts/metro-logger.js +213 -0
  147. package/scripts/start-web.mjs +137 -0
  148. package/scripts/upgrade/runtime.js +463 -0
  149. package/scripts/upgrade/system.js +244 -0
  150. package/scripts/upgrade-authoring.js +534 -0
  151. package/scripts/upgrade.js +188 -0
  152. package/scripts/wrap.js +536 -0
  153. package/lib/commonjs/platform/PowerPlatformConnectionApi.js +0 -606
  154. package/lib/commonjs/platform/resolveConnections.js +0 -264
  155. package/lib/module/platform/PowerPlatformConnectionApi.js +0 -595
  156. package/lib/module/platform/resolveConnections.js +0 -259
@@ -17,18 +17,146 @@ export declare enum ConnectionStatus {
17
17
  NeedsAclGrant = "NeedsAclGrant",
18
18
  NotConnected = "NotConnected"
19
19
  }
20
+ export interface ConnectionReferenceConfig {
21
+ id: string;
22
+ dataSources: string[];
23
+ displayName?: string;
24
+ iconUri?: string;
25
+ appActions?: string[];
26
+ sharedConnectionId?: string;
27
+ gatewayObjectIdHint?: string;
28
+ authenticationType?: string;
29
+ parameterSetName?: string;
30
+ workflowDetails?: {
31
+ workflowEntityId?: string;
32
+ workflowDisplayName?: string;
33
+ workflowName?: string;
34
+ };
35
+ dataSets?: Record<string, unknown>;
36
+ dependencies?: Record<string, unknown>;
37
+ dependents?: string[];
38
+ nestedActions?: Array<{
39
+ actionName?: string;
40
+ apiName?: string;
41
+ flowConnectionRef?: string;
42
+ }>;
43
+ parameterHintsV2?: Record<string, {
44
+ value?: unknown;
45
+ }>;
46
+ [key: string]: unknown;
47
+ }
48
+ export interface ConnectionRequirement {
49
+ localRefId: string;
50
+ apiId: string;
51
+ connectorId: string;
52
+ dataSources: string[];
53
+ displayName?: string;
54
+ iconUri?: string;
55
+ appActions?: string[];
56
+ sharedConnectionId?: string;
57
+ gatewayObjectIdHint?: string;
58
+ authenticationType?: string;
59
+ parameterSetName?: string;
60
+ apiScopes: {
61
+ will: string[];
62
+ wont: string[];
63
+ };
64
+ isFlowDependent: boolean;
65
+ }
66
+ export type ConnectionParameterType = 'string' | 'securestring' | 'boolean' | 'integer' | 'clientcertificate';
67
+ export interface ConnectionParameterDefinition {
68
+ name: string;
69
+ displayName: string;
70
+ type: ConnectionParameterType;
71
+ required: boolean;
72
+ hidden: boolean;
73
+ capabilities?: string[];
74
+ allowedValues?: Array<{
75
+ value: string;
76
+ displayName: string;
77
+ }>;
78
+ defaultValue?: string | boolean | number;
79
+ }
80
+ export interface ConnectionParameterSet {
81
+ /** Undefined for a connector's single, non-parameter-set authentication definition. */
82
+ name?: string;
83
+ displayName: string;
84
+ parameters: ConnectionParameterDefinition[];
85
+ requiresApiConsent: boolean;
86
+ gatewayParameterName?: string;
87
+ }
88
+ export type ConnectionParameterValue = string | boolean | number | {
89
+ pfx: string;
90
+ password: string;
91
+ } | {
92
+ gatewayObjectId: string;
93
+ };
94
+ export interface ConnectionInput {
95
+ parameterSetName?: string;
96
+ gatewayObjectId?: string;
97
+ gatewayParameterName?: string;
98
+ parameters: Record<string, ConnectionParameterValue>;
99
+ }
100
+ export interface ConnectionConsentDetails {
101
+ localRefId: string;
102
+ connectorId: string;
103
+ displayName: string;
104
+ description: string;
105
+ appActions: string[];
106
+ }
107
+ export interface ResourceConsentRequirement {
108
+ resourceId: string;
109
+ displayName: string;
110
+ }
111
+ export interface ConnectionUsageInput {
112
+ localRefId: string;
113
+ apiId: string;
114
+ connectionId: string;
115
+ dataSources: string[];
116
+ appActions: string[];
117
+ apiScopes: {
118
+ will: string[];
119
+ wont: string[];
120
+ };
121
+ }
122
+ export declare function normalizeApiId(apiId: string): string;
123
+ export declare function getConnectorId(apiId: string): string;
124
+ export declare function getConnectionDatasetName(reference: {
125
+ dataSets?: Record<string, unknown>;
126
+ }): string;
127
+ export declare function getFlowConnectionName(reference: ConnectionReferenceConfig): string;
128
+ export declare function getFlowDataSourceNames(reference: ConnectionReferenceConfig): string[];
129
+ export declare function buildConnectionRequirements(connectionReferences: Record<string, ConnectionReferenceConfig>, scopesByApiId?: Record<string, {
130
+ will: string[];
131
+ wont: string[];
132
+ }>): ConnectionRequirement[];
133
+ export declare function isCompositeConnectionApiId(apiId: string): boolean;
134
+ export declare function findConnectionDataSourceConflicts(requirements: ConnectionRequirement[]): string[];
135
+ export declare function hasCompleteStaticConnectionConfig(connectionReferences: Record<string, ConnectionReferenceConfig>, schemaMap: Record<string, {
136
+ name: string;
137
+ properties: {
138
+ primaryRuntimeUrl: string;
139
+ };
140
+ }>): boolean;
141
+ export declare function buildConnectionResolutionKey(appId: string | undefined, environmentId: string, connectionReferences: Record<string, ConnectionReferenceConfig>): string;
20
142
  /** A single connection instance returned by the Power Platform connectivity API. */
21
143
  export interface NativeConnectionInstance {
22
- /** Extracted connection UUID (hex, no dashes). */
144
+ /** Terminal connection resource name exactly as returned by Power Platform. */
23
145
  id: string;
24
146
  /** Full resource name from the API (connector-prefixed, e.g. "shared_office365users/abc123"). */
25
147
  name: string;
26
148
  /** Connector API identifier (e.g. "/providers/Microsoft.PowerApps/apis/shared_office365users"). */
27
149
  apiId: string;
150
+ /** Object ID of the connection owner when returned by the connectivity API. */
151
+ ownerId?: string;
28
152
  /** Resolved authorization status of this connection. */
29
153
  status: ConnectionStatus;
30
154
  /** Optional human-readable display name from the API. */
31
155
  displayName?: string;
156
+ accountName?: string;
157
+ parameterSetName?: string;
158
+ isAuthenticated?: boolean;
159
+ statusErrorCode?: string;
32
160
  }
33
161
  /**
34
162
  * Result of attempting to match a single connection reference to an instance.
@@ -30,9 +30,12 @@
30
30
  * },
31
31
  * });
32
32
  */
33
- import { type OnDisambiguationNeeded, type OnMissingConnection } from '../connections/types.js';
33
+ import type { DatabaseReference } from '../platform/DataverseDataSources.js';
34
+ import type { OnDisambiguationNeeded, OnMissingConnection } from '../connections/types.js';
34
35
  import type { ConnectorSchema } from './resolveConnections.js';
35
36
  import type { AppConnectionReference } from '../bridge/NativePowerAppsBridge.js';
37
+ import type { ConnectionRequirement, ResourceConsentRequirement } from './types.js';
38
+ import type { ConnectionReferenceConfig } from './types.js';
36
39
  export type { ConnectorSchema } from './resolveConnections.js';
37
40
  export interface UseConnectionRefsOptions {
38
41
  isSignedIn: boolean;
@@ -46,23 +49,19 @@ export interface UseConnectionRefsOptions {
46
49
  region?: string;
47
50
  /**
48
51
  * PowerApps app GUID (from power.config.json `appId`).
49
- * When provided (and not running inside the Dev Player), connection
50
- * references are fetched at runtime from the PowerApps RP
51
- * `/apps/{appId}/launch` endpoint and take precedence over the static
52
- * `connectionReferences` object below.
53
- * Leave undefined during local development to use the static fallback.
52
+ * Outside Dev Player, app and connection metadata is fetched exclusively
53
+ * from the PowerApps RP `/apps/{appId}/launch` endpoint.
54
54
  */
55
55
  appId?: string;
56
56
  /**
57
57
  * The connectionReferences map from power.config.json.
58
+ * Used only in Dev Player for unpublished local apps.
58
59
  * Shape: { [refId]: { id: string; dataSources: string[] } }
59
60
  */
60
- connectionReferences: Record<string, {
61
- id: string;
62
- dataSources: string[];
63
- }>;
61
+ connectionReferences: Record<string, ConnectionReferenceConfig>;
64
62
  /**
65
63
  * Connector schema map keyed by data source name.
64
+ * Used only in Dev Player for unpublished local apps.
66
65
  * Generated automatically by generate-connector-schemas.
67
66
  * Shape: { [dataSourceName]: ConnectorSchema }
68
67
  */
@@ -80,10 +79,11 @@ export interface UseConnectionRefsOptions {
80
79
  */
81
80
  onMissingConnection?: OnMissingConnection;
82
81
  /**
83
- * The ISV's AAD application (client) ID. When provided, each resolved
84
- * `Connected` connection is checked via `addAadAppToConnectionAcl`.
82
+ * The ISV's AAD application (client) ID. When provided, each user-selected
83
+ * `Connected` connection is granted through delegated user consent. Fixed
84
+ * shared connections skip this grant in published apps.
85
85
  * Connections where the grant fails are marked `NeedsAclGrant` and treated
86
- * as missing so the setup screen can guide the user to create a new one.
86
+ * as missing so the setup screen can guide the user to create a new one.
87
87
  */
88
88
  isvClientId?: string;
89
89
  }
@@ -91,12 +91,25 @@ export interface UseConnectionRefsResult {
91
91
  connectionRefs: Record<string, AppConnectionReference>;
92
92
  isReady: boolean;
93
93
  error: string | null;
94
+ errorKind: ConnectionResolutionErrorKind | null;
94
95
  /**
95
96
  * API IDs of connectors for which no connection was found (or the user did
96
97
  * not resolve during disambiguation). Useful for surfacing a "Set up
97
98
  * connections" prompt in the app UI.
98
99
  */
99
100
  missingConnectors: string[];
101
+ /** Unresolved requirements keyed by the app's local connection-reference ID. */
102
+ missingConnectionReferences: ConnectionRequirement[];
103
+ /** Every connection reference required by the app. */
104
+ connectionRequirements: ConnectionRequirement[];
105
+ /** Non-connector protected resources returned by app launch metadata. */
106
+ resourceConsents: ResourceConsentRequirement[];
107
+ /** Blocking connection configuration errors. */
108
+ configurationErrors: string[];
109
+ /** Whether selected connection references still need durable app usage consent. */
110
+ requiresConnectionConsent: boolean;
111
+ /** Identity of the app/environment/config represented by this result. */
112
+ resolvedConfigKey: string | null;
100
113
  /**
101
114
  * The Dataverse org URL for this environment (e.g. "https://org12345.crm.dynamics.com").
102
115
  * Fetched from the Power Platform environment metadata independently of whether a
@@ -104,23 +117,19 @@ export interface UseConnectionRefsResult {
104
117
  * Empty string until isReady is true or if the environment has no linked Dataverse database.
105
118
  */
106
119
  dataverseOrgUrl: string;
120
+ /** Database references resolved from the RP launch response. */
121
+ databaseReferences: Record<string, DatabaseReference>;
107
122
  }
123
+ export type ConnectionResolutionErrorKind = 'app-access-denied' | 'generic';
108
124
  /**
109
125
  * Resolves Power Platform connection references for the current user, with
110
126
  * disambiguation support for environments where multiple connections exist for
111
127
  * the same connector.
112
128
  *
113
- * On sign-in this hook:
114
- * 1. If `appId` is set (production template), fetches connection references
115
- * from the PowerApps RP `/apps/{appId}/launch` endpoint and uses those
116
- * in place of the static `connectionReferences` from power.config.json.
117
- * 2. Acquires a Power Platform API token.
118
- * 3. In parallel: fetches the Dataverse instanceUrl and ALL connections for
119
- * each configured connector.
120
- * 4. Runs disambiguation: resolves single matches, invokes `onDisambiguationNeeded`
121
- * for multiple matches, and invokes `onMissingConnection` for absent ones.
122
- * 5. Pre-warms the Dataverse token in the MSAL cache.
123
- * 6. Sets isReady=true with the fully-populated connections map.
129
+ * Outside Dev Player, the published app launch endpoint is authoritative.
130
+ * Dev Player resolves unpublished local references through per-connector APIs.
131
+ * Both paths disambiguate candidates, pre-warm Dataverse authentication, and
132
+ * return a fully populated bridge configuration.
124
133
  */
125
134
  export declare function useConnectionRefs({ isSignedIn, acquireToken, appId, environmentId, region, connectionReferences, schemaMap, onDisambiguationNeeded, onMissingConnection, isvClientId, }: UseConnectionRefsOptions): UseConnectionRefsResult;
126
135
  //# sourceMappingURL=useConnectionRefs.d.ts.map
@@ -17,7 +17,7 @@
17
17
  * // Call setup.startCreate() to trigger connection creation
18
18
  * // Call setup.checkNow() to re-poll after WebView finishes
19
19
  */
20
- import type { NativeConnectionInstance } from '../connections/types.js';
20
+ import type { ConnectionInput, NativeConnectionInstance } from './types.js';
21
21
  /**
22
22
  * The current phase of the connection setup flow for one connector.
23
23
  *
@@ -43,12 +43,12 @@ export interface UseConnectionSetupOptions {
43
43
  onConnected?: (instance: NativeConnectionInstance) => void;
44
44
  /**
45
45
  * The ISV/wrap-app AAD client ID (from auth.config.json `msal.clientId`).
46
- * After connection creation, `addAadAppToConnectionAcl` is called to append
47
- * the ISV's client ID to the connection ACE's AppIds list. This is required
48
- * so that APIM accepts tokens bearing this appid at runtime (otherwise APIM
49
- * returns 403 "missing connection ACL" for all third-party app tokens).
46
+ * After connection creation, delegated user consent adds the calling app ID
47
+ * to the most specific applicable connection ACL.
50
48
  */
51
- isvClientId?: string;
49
+ isvClientId: string;
50
+ /** Fixed shared connection resource ID. */
51
+ sharedConnectionId?: string;
52
52
  /**
53
53
  * Redirect URL passed to the getConsentLink API call.
54
54
  * Defaults to the standard native-client redirect accepted by Power Platform.
@@ -71,7 +71,11 @@ export interface UseConnectionSetupResult {
71
71
  * Start the connection creation flow.
72
72
  * Transitions: idle/error → creating → (oauth | connected | error).
73
73
  */
74
- startCreate: () => Promise<void>;
74
+ startCreate: (input?: ConnectionInput) => Promise<void>;
75
+ /** Update and re-consent an existing unauthenticated connection. */
76
+ startRepair: (instance: NativeConnectionInstance, input?: ConnectionInput, requiresApiConsent?: boolean) => Promise<void>;
77
+ /** Verify third-party ACL access before accepting an existing connection. */
78
+ useExisting: (instance: NativeConnectionInstance) => Promise<void>;
75
79
  /**
76
80
  * Call after the OAuth WebView is dismissed (or anytime during 'oauth' phase)
77
81
  * to immediately poll the connection status instead of waiting for the next
@@ -92,5 +96,5 @@ export interface UseConnectionSetupResult {
92
96
  /** Reset the flow back to idle (e.g., for a retry). */
93
97
  reset: () => void;
94
98
  }
95
- export declare function useConnectionSetup({ connectorId, environmentId, region, acquireToken, onConnected, isvClientId, oauthRedirectUrl, polling, }: UseConnectionSetupOptions): UseConnectionSetupResult;
99
+ export declare function useConnectionSetup({ connectorId, environmentId, region, acquireToken, onConnected, sharedConnectionId, oauthRedirectUrl, polling, }: UseConnectionSetupOptions): UseConnectionSetupResult;
96
100
  //# sourceMappingURL=useConnectionSetup.d.ts.map
@@ -11,6 +11,12 @@ export interface PickedFileInfo {
11
11
  }
12
12
  export interface FilePickerProps {
13
13
  label?: string;
14
+ /** Optional test ID for the outer container. */
15
+ testID?: string;
16
+ /** Optional test ID for the selected file row. */
17
+ fileRowTestID?: string;
18
+ /** Optional test ID for the pick/replace button. */
19
+ pickButtonTestID?: string;
14
20
  /**
15
21
  * The file name to display.
16
22
  * - In view mode: the name of the existing Dataverse file.
@@ -61,5 +67,5 @@ export interface FilePickerProps {
61
67
  * - Pass both to show the existing file name (tappable to download) alongside a
62
68
  * replace button — useful when the edit screen should also allow previewing.
63
69
  */
64
- export declare function FilePicker({ label, fileName, onDownload, shareTitle, onChange, acceptedTypes, pickButtonLabel, replaceButtonLabel, readingLabel, containerStyle, labelStyle, fileRowStyle, fileNameStyle, buttonStyle, buttonTextStyle, accentColor, }: FilePickerProps): React.JSX.Element;
70
+ export declare function FilePicker({ label, testID, fileRowTestID, pickButtonTestID, fileName, onDownload, shareTitle, onChange, acceptedTypes, pickButtonLabel, replaceButtonLabel, readingLabel, containerStyle, labelStyle, fileRowStyle, fileNameStyle, buttonStyle, buttonTextStyle, accentColor, }: FilePickerProps): React.JSX.Element;
65
71
  //# sourceMappingURL=FilePicker.d.ts.map
@@ -13,6 +13,14 @@ export interface PickedImageInfo {
13
13
  }
14
14
  export interface ImagePickerProps {
15
15
  label?: string;
16
+ /** Optional test ID for the outer container. */
17
+ testID?: string;
18
+ /** Optional test ID for the camera button. */
19
+ cameraButtonTestID?: string;
20
+ /** Optional test ID for the image-library button. */
21
+ selectButtonTestID?: string;
22
+ /** Optional test ID for the selected image preview. */
23
+ previewTestID?: string;
16
24
  /**
17
25
  * Base64 string from Dataverse (the `cr_assetimage` thumbnail).
18
26
  * The component builds the preview data URI internally.
@@ -72,5 +80,5 @@ export interface ImagePickerProps {
72
80
  * - On pick, the image is returned as base64 for legacy callers and as a
73
81
  * File-compatible object for generated Dataverse upload methods.
74
82
  */
75
- export declare function ImagePicker({ label, initialBase64, onChange, containerStyle, labelStyle, buttonRowStyle, buttonStyle, buttonTextStyle, previewStyle, accentColor, onImageChange, imageFileName, quality, allowsEditing, aspect, cropShape, exif, legacy, cameraButtonLabel, selectButtonLabel, changeButtonLabel, readingLabel, }: ImagePickerProps): React.JSX.Element;
83
+ export declare function ImagePicker({ label, testID, cameraButtonTestID, selectButtonTestID, previewTestID, initialBase64, onChange, containerStyle, labelStyle, buttonRowStyle, buttonStyle, buttonTextStyle, previewStyle, accentColor, onImageChange, imageFileName, quality, allowsEditing, aspect, cropShape, exif, legacy, cameraButtonLabel, selectButtonLabel, changeButtonLabel, readingLabel, }: ImagePickerProps): React.JSX.Element;
76
84
  //# sourceMappingURL=ImagePicker.d.ts.map
@@ -4,24 +4,34 @@
4
4
  *
5
5
  */
6
6
  export { NativePowerAppsBridge } from './bridge/NativePowerAppsBridge.js';
7
+ export { PowerPagesBridge, setupPowerPagesHost } from './bridge/PowerPagesBridge.js';
8
+ export type { PowerPagesBridgeOptions } from './bridge/PowerPagesBridge.js';
7
9
  export type { NativeBridgeOptions, CdsDataSourceConfig, AppConnection, AppConnectionReference } from './bridge/NativePowerAppsBridge.js';
8
10
  export { buildConnectionReferences } from './bridge/NativePowerAppsBridge.js';
9
11
  export { setupNativeHost } from './bridge/setupNativeHost.js';
10
- export { AuthProvider, useAuth } from './auth/AuthContext.js';
11
- export type { AuthState, AuthProviderProps } from './auth/AuthContext.js';
12
+ export { updateBridgeOptionsInPlace } from './bridge/bridgeState.js';
13
+ export { AuthProvider, useAuth } from './auth/AuthContext';
14
+ export type { AuthState, AuthProviderProps } from './auth/AuthContext';
15
+ export { completePowerAppsAuthSession } from './auth/completePowerAppsAuthSession.js';
12
16
  export type { AuthConfig, MsalAuthConfig, IntuneConfig } from '@microsoft/power-apps-native-auth';
13
- export { PowerAppsHostProvider } from './provider/PowerAppsHostProvider.js';
14
- export type { PowerAppsHostProviderProps } from './provider/PowerAppsHostProvider.js';
17
+ export { PowerAppsHostProvider } from './provider/PowerAppsHostProvider';
18
+ export type { PowerAppsHostProviderProps } from './provider/PowerAppsHostProvider';
15
19
  export { PowerAppsProvider } from './provider/PowerAppsProvider.js';
16
- export type { PowerAppsProviderProps, PowerConfig } from './provider/PowerAppsProvider.js';
17
- export { fetchInstanceUrl, buildCdsDataSources, buildEnvironmentEndpoint, POWER_PLATFORM_API_SCOPE } from './platform/PowerPlatformEnvironmentApi.js';
18
- export type { LinkedEnvironmentMetadata, DatabaseReference, DatabaseReferenceDataSource } from './platform/PowerPlatformEnvironmentApi.js';
19
- export { useConnectionRefs } from './platform/useConnectionRefs.js';
20
- export type { UseConnectionRefsOptions, UseConnectionRefsResult, ConnectorSchema } from './platform/useConnectionRefs.js';
21
- export { fetchConnectorMetadata, fetchConnectionsForConnector, createConnection, pollConnectionStatus, confirmConsentCode, fetchAppLaunchData, } from './platform/PowerPlatformConnectionApi.js';
22
- export type { ConnectorMetadata, CreateConnectionResult, AppLaunchResult, } from './platform/PowerPlatformConnectionApi.js';
20
+ export type { AppInsightsConfig, PowerAppsProviderProps, PowerConfig } from './provider/PowerAppsProvider.js';
21
+ export { buildEnvironmentEndpoint, POWER_PLATFORM_API_SCOPE } from './platform/PowerPlatformEnvironmentApi.js';
22
+ export { fetchInstanceUrl } from './platform/DataverseGlobalDiscoveryApi.js';
23
+ export { buildCdsDataSources } from './platform/DataverseDataSources.js';
24
+ export type { LinkedEnvironmentMetadata, DatabaseReference, DatabaseReferenceDataSource } from './platform/DataverseDataSources.js';
25
+ export { useConnectionRefs } from './connections/useConnectionRefs.js';
26
+ export type { UseConnectionRefsOptions, UseConnectionRefsResult, ConnectorSchema } from './connections/useConnectionRefs.js';
27
+ export { fetchConnectorMetadata, fetchConnectionsForConnector, deleteConnection, createConnection, pollConnectionStatus, confirmConsentCode, repairConnection, fetchAppLaunchData, fetchAppConnectionUsages, postConnectionUsage, reportScopeConsents, } from './connections/PowerPlatformConnectionApi.js';
28
+ export type { ConnectorMetadata, CreateConnectionResult, AppLaunchResult, RegisteredConnectionUsage, } from './connections/PowerPlatformConnectionApi.js';
23
29
  export { disambiguateConnections, extractConnectionId } from './connections/disambiguate.js';
24
- export type { NativeConnectionInstance, NativeConnectionResolution, NativeDisambiguationResult, OnDisambiguationNeeded, OnMissingConnection, } from './connections/types.js';
30
+ export { shouldPersistConnectionUsages, shouldShowConnectionReview, } from './connections/connectionState.js';
31
+ export { buildConnectionRequirements, buildConnectionResolutionKey, findConnectionDataSourceConflicts, hasCompleteStaticConnectionConfig, isCompositeConnectionApiId, getConnectorId, normalizeApiId, } from './connections/types.js';
32
+ export { buildConnectionUserConsentUrl, buildConsentLinkDefinition, buildConnectionParameterSets, buildConnectionUsageRequest, buildConnectionUsageUrl, buildScopeConsentRequest, buildScopeConsentUrl, hasOAuthParameter, parseConnectionParameters, serializeConnectionParameters, } from './connections/connectionMetadata.js';
33
+ export type { ConsentLinkDefinition, RawConnectionParameter, RawConnectionParameterSet, SerializedConnectionParameters, } from './connections/connectionMetadata.js';
34
+ export type { ConnectionConsentDetails, ConnectionInput, ConnectionParameterDefinition, ConnectionParameterSet, ConnectionParameterType, ConnectionParameterValue, ConnectionReferenceConfig, ConnectionRequirement, ConnectionUsageInput, ResourceConsentRequirement, NativeConnectionInstance, NativeConnectionResolution, NativeDisambiguationResult, OnDisambiguationNeeded, OnMissingConnection, } from './connections/types.js';
25
35
  export { useConnectionSetup } from './connections/useConnectionSetup.js';
26
36
  export type { ConnectionSetupPhase, UseConnectionSetupOptions, UseConnectionSetupResult, } from './connections/useConnectionSetup.js';
27
37
  export { ConnectionSetupScreen } from './connections/ConnectionSetupScreen.js';
@@ -36,7 +46,7 @@ export { ImagePicker } from './controls/ImagePicker.js';
36
46
  export type { ImagePickerProps, PickedImageInfo } from './controls/ImagePicker.js';
37
47
  export { isDevPlayer } from './utils/isDevPlayer.js';
38
48
  export { base64ToDataverseUploadFile, base64ToUint8Array, createDataverseUploadFile, } from './utils/dataverseUtils.js';
39
- export { getAppLogger, configureAppLogger, HostOperationNames } from './telemetry/index.js';
40
- export type { ILogger } from '@microsoft/power-apps-native-common';
49
+ export { getAppLogger, configureAppLogger, getCustomerTelemetryLogger, HostOperationNames, } from './telemetry/index.js';
50
+ export type { ICustomerTelemetryLogger, ILogger, } from '@microsoft/power-apps-native-common';
41
51
  export { ErrorBoundary } from './ErrorBoundary.js';
42
52
  //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Conditional debug logger for power-apps-native-host.
3
3
  *
4
- * Debug logs (debugLog / debugWarn) are only emitted when the JS bundle
5
- * is running inside the Power Apps Dev Player (detected via
6
- * `Constants.expoConfig.extra.isDevPlayer`). They are silenced in release
7
- * APKs generated from the template so the production log stream stays clean.
4
+ * Debug logs (debugLog / debugWarn) are emitted in development bundles or when
5
+ * running inside Power Apps Dev Player. They remain silent in wrapped release
6
+ * apps so the production log stream stays clean.
8
7
  */
8
+ export declare function isDebugLoggingEnabled(): boolean;
9
9
  export declare function debugLog(...args: unknown[]): void;
10
10
  export declare function debugWarn(...args: unknown[]): void;
11
11
  //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ export declare function createHostQueryClient(): QueryClient;
3
+ export declare function createOfflineHostActivationCallbacks(queryClient: QueryClient): {
4
+ prepareForOfflineActivation: () => Promise<void>;
5
+ completeOfflineActivation: () => Promise<void>;
6
+ rollbackOfflineActivation: () => Promise<void>;
7
+ };
8
+ export declare function resolveSdkMountDecision(value: unknown): {
9
+ shouldMountChildren: boolean;
10
+ contractSupported: boolean;
11
+ };
12
+ //# sourceMappingURL=createOfflineHostActivationCallbacks.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { useOfflineIntegration } from '@microsoft/power-apps-native-offline';
2
+ //# sourceMappingURL=useOfflineIntegration.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare function useOfflineIntegration(_options: unknown): {
2
+ StatusOverlay: null;
3
+ };
4
+ //# sourceMappingURL=useOfflineIntegration.web.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { useOfflineIntegration } from './useOfflineIntegration';
2
+ type Options = {
3
+ powerConfig: Parameters<typeof useOfflineIntegration>[0]['powerConfig'];
4
+ offlineProfile?: Record<string, unknown>;
5
+ acquireToken: (scopes: string[]) => Promise<string | null>;
6
+ hasRealAccount: boolean;
7
+ isAuthReady: boolean;
8
+ };
9
+ export declare function useOfflineIntegrationWithStartupGate({ powerConfig, offlineProfile, acquireToken, hasRealAccount, isAuthReady, }: Options): {
10
+ isEnabled: boolean;
11
+ StatusOverlay: import("react").ComponentType<Record<string, never>> | null;
12
+ shouldMountChildren: boolean;
13
+ };
14
+ export {};
15
+ //# sourceMappingURL=useOfflineIntegrationWithStartupGate.d.ts.map
@@ -0,0 +1,6 @@
1
+ export declare function useOfflineIntegrationWithStartupGate(_options: unknown): {
2
+ isEnabled: false;
3
+ StatusOverlay: null;
4
+ shouldMountChildren: true;
5
+ };
6
+ //# sourceMappingURL=useOfflineIntegrationWithStartupGate.web.d.ts.map
@@ -0,0 +1,27 @@
1
+ export interface LinkedEnvironmentMetadata {
2
+ resourceId?: string;
3
+ friendlyName?: string;
4
+ uniqueName?: string;
5
+ domainName?: string;
6
+ version?: string;
7
+ instanceUrl?: string;
8
+ instanceApiUrl?: string;
9
+ baseLanguage?: number;
10
+ instanceState?: string;
11
+ createdTime?: string;
12
+ platformSku?: string;
13
+ }
14
+ export interface DatabaseReferenceDataSource {
15
+ entitySetName?: string;
16
+ logicalName?: string;
17
+ }
18
+ export interface DatabaseReference {
19
+ dataSources?: Record<string, DatabaseReferenceDataSource>;
20
+ }
21
+ export declare function buildCdsDataSources(databaseReferences: Record<string, DatabaseReference>, dataverseOrgUrl: string): Array<{
22
+ runtimeUrl: string;
23
+ entitySetName: string;
24
+ logicalName: string;
25
+ version: string;
26
+ }>;
27
+ //# sourceMappingURL=DataverseDataSources.d.ts.map
@@ -0,0 +1,3 @@
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>;
3
+ //# sourceMappingURL=DataverseGlobalDiscoveryApi.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare function globalDiscoveryEndpoint(region: string): string;
2
+ export declare function globalDiscoveryScope(region: string): string;
3
+ export declare function buildGlobalDiscoveryUrl(environmentId: string, region: string): string;
4
+ //# sourceMappingURL=GlobalDiscovery.d.ts.map
@@ -1,14 +1,7 @@
1
1
  /*!
2
2
  * power-apps-native-host — PowerPlatformEnvironmentApi
3
3
  *
4
- * Mirrors the Host SDK's DefaultAppMetadataProvider.fetchAppMetadataFromPowerConfig
5
- * pattern: resolves the Power Platform environment-scoped API endpoint from the
6
- * environment GUID and region, then fetches linkedEnvironmentMetadata to obtain
7
- * the Dataverse instanceUrl.
8
- *
9
- * Reference (Host SDK):
10
- * packages/power-apps-host/src/providers/defaults/DefaultAppMetadataProvider.ts
11
- * packages/power-apps-common/src/services/PowerPlatformApiDiscovery.ts
4
+ * Resolves Power Platform RP endpoints and scopes.
12
5
  */
13
6
  /**
14
7
  * Build the Power Platform environment-scoped API base URL.
@@ -26,19 +19,6 @@
26
19
  * → "d909aac059d0e5b1900dc082ef5774.d7.environment.api.powerplatform.com"
27
20
  */
28
21
  export declare function buildEnvironmentEndpoint(environmentId: string, region: string): string;
29
- export interface LinkedEnvironmentMetadata {
30
- resourceId?: string;
31
- friendlyName?: string;
32
- uniqueName?: string;
33
- domainName?: string;
34
- version?: string;
35
- instanceUrl?: string;
36
- instanceApiUrl?: string;
37
- baseLanguage?: number;
38
- instanceState?: string;
39
- createdTime?: string;
40
- platformSku?: string;
41
- }
42
22
  /**
43
23
  * Token scope for the Power Platform management API (prod cluster).
44
24
  * Non-prod clusters (test, gov, high, dev, mooncake, etc.) host the management
@@ -52,57 +32,6 @@ export declare const POWER_PLATFORM_API_SCOPE = "https://api.powerplatform.com/.
52
32
  * {@link buildEnvironmentEndpoint}.
53
33
  */
54
34
  export declare function powerPlatformScope(region: string): string;
55
- /**
56
- * Fetch the Dataverse instanceUrl for a Power Platform environment by calling
57
- * the environment-scoped Power Platform management API — the same call that
58
- * the Host SDK's DefaultAppMetadataProvider makes to populate
59
- * `databaseReferences[*].databaseDetails.linkedEnvironmentMetadata`.
60
- *
61
- * @param environmentId - Environment GUID (from power.config.json `environmentId`).
62
- * @param region - Cluster region string (from power.config.json `region`, default "prod").
63
- * @param acquireToken - Callback to obtain a bearer token for the given scopes.
64
- * Scope will be {@link powerPlatformScope}`(region)`.
65
- * @param bearerToken - Optional pre-fetched bearer token for {@link powerPlatformScope}`(region)`.
66
- * Pass this to avoid a redundant `acquireToken` round-trip when the
67
- * caller has already obtained a token for the same audience.
68
- * @returns The Dataverse org URL (e.g. "https://org12345.crm.dynamics.com"), or
69
- * `undefined` if the environment has no linked CDS database.
70
- */
71
- export declare function fetchInstanceUrl(environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>, bearerToken?: string): Promise<string | undefined>;
72
- /**
73
- * Shape of a single Dataverse table entry inside power.config.json
74
- * `databaseReferences[*].dataSources[*]`.
75
- */
76
- export interface DatabaseReferenceDataSource {
77
- entitySetName?: string;
78
- logicalName?: string;
79
- }
80
- /**
81
- * Shape of a single database reference entry inside power.config.json
82
- * `databaseReferences`.
83
- */
84
- export interface DatabaseReference {
85
- dataSources?: Record<string, DatabaseReferenceDataSource>;
86
- }
87
- /**
88
- * Build the CDS data source config array that the SDK reads via
89
- * AppPowerAppsClientPlugin.getAppCdsDataSourceConfigsAsync.
90
- *
91
- * Pass the resolved Dataverse org URL (from useConnectionRefs) and the
92
- * databaseReferences map from power.config.json. The resulting array is
93
- * passed directly to <PowerAppsHostProvider dataSources={...} />.
94
- *
95
- * @param databaseReferences - The `databaseReferences` map from power.config.json.
96
- * @param dataverseOrgUrl - The resolved Dataverse org URL
97
- * (connectionRefs['commondataserviceforapps']?.datasetName).
98
- * Pass an empty string before the org URL is known;
99
- * the host provider will receive empty runtimeUrl entries
100
- * and the SDK will not attempt Dataverse calls.
101
- */
102
- export declare function buildCdsDataSources(databaseReferences: Record<string, DatabaseReference>, dataverseOrgUrl: string): Array<{
103
- runtimeUrl: string;
104
- entitySetName: string;
105
- logicalName: string;
106
- version: string;
107
- }>;
35
+ /** Delegated permission required by the connection user-consent endpoint. */
36
+ export declare function connectionUserConsentScope(region: string): string;
108
37
  //# sourceMappingURL=PowerPlatformEnvironmentApi.d.ts.map