@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
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+
3
+ import React, { useCallback, useMemo, useState } from 'react';
4
+ import { Modal, Platform, Pressable, StyleSheet, Text, View } from 'react-native';
5
+ import * as Clipboard from 'expo-clipboard';
6
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
7
+ import { getAppLogger } from "../telemetry/index.js";
8
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
+ const SWIPE_DISTANCE = 80;
10
+ export function SessionDetailsGesture({
11
+ enabled,
12
+ appName,
13
+ appId,
14
+ environmentId,
15
+ region,
16
+ appVersion,
17
+ children
18
+ }) {
19
+ const [visible, setVisible] = useState(false);
20
+ const [sessionId, setSessionId] = useState();
21
+ const [copied, setCopied] = useState(false);
22
+ const showSessionDetails = useCallback(() => {
23
+ setSessionId(getAppLogger().sessionId);
24
+ setCopied(false);
25
+ setVisible(true);
26
+ }, []);
27
+ const gesture = useMemo(() => Gesture.Pan().enabled(enabled && Platform.OS !== 'web').minPointers(3).maxPointers(3).runOnJS(true).onEnd(({
28
+ translationX,
29
+ translationY
30
+ }) => {
31
+ if (translationY >= SWIPE_DISTANCE && translationY > Math.abs(translationX)) {
32
+ showSessionDetails();
33
+ }
34
+ }), [enabled, showSessionDetails]);
35
+ const close = useCallback(() => setVisible(false), []);
36
+ const copySessionId = useCallback(async () => {
37
+ if (!sessionId) return;
38
+ await Clipboard.setStringAsync(sessionId);
39
+ setCopied(true);
40
+ }, [sessionId]);
41
+ return /*#__PURE__*/_jsxs(_Fragment, {
42
+ children: [/*#__PURE__*/_jsx(GestureDetector, {
43
+ gesture: gesture,
44
+ children: /*#__PURE__*/_jsx(View, {
45
+ style: styles.content,
46
+ children: children
47
+ })
48
+ }), /*#__PURE__*/_jsx(Modal, {
49
+ animationType: "fade",
50
+ onRequestClose: close,
51
+ transparent: true,
52
+ visible: visible,
53
+ children: /*#__PURE__*/_jsx(Pressable, {
54
+ accessibilityRole: "button",
55
+ accessibilityLabel: "Close session details",
56
+ onPress: close,
57
+ style: styles.backdrop,
58
+ children: /*#__PURE__*/_jsxs(Pressable, {
59
+ accessible: false,
60
+ onPress: event => event.stopPropagation(),
61
+ style: styles.panel,
62
+ children: [/*#__PURE__*/_jsx(Text, {
63
+ style: styles.title,
64
+ children: "Session details"
65
+ }), /*#__PURE__*/_jsx(SessionDetail, {
66
+ label: "Telemetry session ID",
67
+ value: sessionId ?? 'Not available',
68
+ selectable: true,
69
+ singleLine: true
70
+ }), /*#__PURE__*/_jsx(Pressable, {
71
+ accessibilityRole: "button",
72
+ disabled: !sessionId,
73
+ onPress: () => {
74
+ void copySessionId();
75
+ },
76
+ style: ({
77
+ pressed
78
+ }) => [styles.copyButton, !sessionId && styles.disabledButton, pressed && styles.pressedButton],
79
+ children: /*#__PURE__*/_jsx(Text, {
80
+ style: styles.copyButtonText,
81
+ children: copied ? 'Copied' : 'Copy session ID'
82
+ })
83
+ }), /*#__PURE__*/_jsx(SessionDetail, {
84
+ label: "App",
85
+ value: appName
86
+ }), /*#__PURE__*/_jsx(SessionDetail, {
87
+ label: "App ID",
88
+ value: appId ?? 'Not available',
89
+ selectable: true
90
+ }), /*#__PURE__*/_jsx(SessionDetail, {
91
+ label: "Environment ID",
92
+ value: environmentId ?? 'Not available',
93
+ selectable: true
94
+ }), /*#__PURE__*/_jsx(SessionDetail, {
95
+ label: "Region",
96
+ value: region
97
+ }), /*#__PURE__*/_jsx(SessionDetail, {
98
+ label: "App version",
99
+ value: appVersion ?? 'Not available'
100
+ }), /*#__PURE__*/_jsx(Pressable, {
101
+ accessibilityRole: "button",
102
+ onPress: close,
103
+ style: styles.closeButton,
104
+ children: /*#__PURE__*/_jsx(Text, {
105
+ style: styles.closeButtonText,
106
+ children: "Close"
107
+ })
108
+ })]
109
+ })
110
+ })
111
+ })]
112
+ });
113
+ }
114
+ function SessionDetail({
115
+ label,
116
+ value,
117
+ selectable = false,
118
+ singleLine = false
119
+ }) {
120
+ return /*#__PURE__*/_jsxs(View, {
121
+ style: styles.row,
122
+ children: [/*#__PURE__*/_jsx(Text, {
123
+ style: styles.label,
124
+ children: label
125
+ }), /*#__PURE__*/_jsx(Text, {
126
+ adjustsFontSizeToFit: singleLine,
127
+ minimumFontScale: 0.85,
128
+ numberOfLines: singleLine ? 1 : undefined,
129
+ selectable: selectable,
130
+ style: styles.value,
131
+ children: value
132
+ })]
133
+ });
134
+ }
135
+ const styles = StyleSheet.create({
136
+ content: {
137
+ flex: 1
138
+ },
139
+ backdrop: {
140
+ alignItems: 'center',
141
+ backgroundColor: 'rgba(0, 0, 0, 0.48)',
142
+ flex: 1,
143
+ justifyContent: 'center',
144
+ paddingHorizontal: 12,
145
+ paddingVertical: 24
146
+ },
147
+ panel: {
148
+ backgroundColor: '#FFFFFF',
149
+ borderRadius: 8,
150
+ maxWidth: 520,
151
+ paddingHorizontal: 16,
152
+ paddingVertical: 24,
153
+ width: '100%'
154
+ },
155
+ title: {
156
+ color: '#242424',
157
+ fontSize: 20,
158
+ fontWeight: '700',
159
+ marginBottom: 20
160
+ },
161
+ row: {
162
+ marginBottom: 14
163
+ },
164
+ label: {
165
+ color: '#616161',
166
+ fontSize: 12,
167
+ fontWeight: '600',
168
+ marginBottom: 3
169
+ },
170
+ value: {
171
+ color: '#242424',
172
+ fontSize: 15,
173
+ lineHeight: 21
174
+ },
175
+ copyButton: {
176
+ alignSelf: 'flex-start',
177
+ borderColor: '#0F6CBD',
178
+ borderRadius: 4,
179
+ borderWidth: 1,
180
+ marginBottom: 14,
181
+ marginTop: -4,
182
+ paddingHorizontal: 12,
183
+ paddingVertical: 7
184
+ },
185
+ copyButtonText: {
186
+ color: '#0F6CBD',
187
+ fontSize: 13,
188
+ fontWeight: '600'
189
+ },
190
+ disabledButton: {
191
+ opacity: 0.45
192
+ },
193
+ pressedButton: {
194
+ opacity: 0.7
195
+ },
196
+ closeButton: {
197
+ alignItems: 'center',
198
+ alignSelf: 'flex-end',
199
+ backgroundColor: '#0F6CBD',
200
+ borderRadius: 4,
201
+ marginTop: 8,
202
+ minWidth: 88,
203
+ paddingHorizontal: 18,
204
+ paddingVertical: 10
205
+ },
206
+ closeButtonText: {
207
+ color: '#FFFFFF',
208
+ fontSize: 14,
209
+ fontWeight: '600'
210
+ }
211
+ });
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ import { getAppLogger } from '@microsoft/power-apps-native-common';
4
+ import * as OfflineSdk from '@microsoft/power-apps-native-offline';
5
+
6
+ /**
7
+ * Operation names for this adapter's own diagnostics, following the
8
+ * `PowerAppsHost.<Subsystem>.<Action>` convention used by `HostOperationNames`.
9
+ *
10
+ * Declared locally rather than imported from `./index`: this module must stay
11
+ * fail-open and side-effect free, and the barrel constructs HTTP clients at
12
+ * import time. Two string constants are not worth that dependency.
13
+ */
14
+ const OfflineTelemetryBindFailed = 'PowerAppsHost.Offline.TelemetryBind.Failed';
15
+ const OfflineTelemetryUnbindFailed = 'PowerAppsHost.Offline.TelemetryUnbind.Failed';
16
+
17
+ /**
18
+ * Non-sensitive error discriminator. Records the error's constructor name only,
19
+ * never its message, so diagnostics cannot leak user or tenant data.
20
+ */
21
+ function getSafeErrorName(error) {
22
+ return error instanceof Error ? error.constructor.name : typeof error;
23
+ }
24
+
25
+ /**
26
+ * True when the resolved SDK exposes the v1 host-telemetry transport.
27
+ *
28
+ * Reading a missing export yields `undefined` rather than throwing, so this
29
+ * probe is safe on SDK builds that predate the transport. Keeping it separate
30
+ * from the `try`/`catch` below is what lets an out-of-range SDK stay a silent,
31
+ * expected no-op while genuine wiring failures still get reported.
32
+ *
33
+ * The version equality matters as much as the `typeof`: a future transport
34
+ * revision with a different sink shape would accept a v1 sink and silently
35
+ * malform every event rather than throw.
36
+ */
37
+ function isTransportSupported() {
38
+ return typeof OfflineSdk.configureOfflineHostTelemetry === 'function' && OfflineSdk.OFFLINE_HOST_TELEMETRY_TRANSPORT_VERSION === 1;
39
+ }
40
+
41
+ /**
42
+ * Forwards the privacy-safe Offline SDK transport through the host's existing
43
+ * app logger so offline events carry the same session, device, and user data.
44
+ *
45
+ * The host owns exactly one thing here: binding the SDK transport to this
46
+ * host's logger. Buffering and teardown semantics live in the SDK.
47
+ *
48
+ * Setup and teardown are fail-open but not silent. This runs from an effect in
49
+ * the provider that roots the app, so an unguarded throw would take down the
50
+ * whole tree — telemetry is never worth an app that will not start. An
51
+ * unexpected failure is therefore downgraded to a logged diagnostic rather than
52
+ * swallowed, so broken wiring stays observable.
53
+ */
54
+ export function configureOfflineSdkTelemetry(forwardEvents) {
55
+ if (!isTransportSupported()) {
56
+ return () => undefined;
57
+ }
58
+ const stopForwarding = () => {
59
+ try {
60
+ OfflineSdk.configureOfflineHostTelemetry(undefined);
61
+ } catch (e) {
62
+ getAppLogger().trackErrorEvent(OfflineTelemetryUnbindFailed, {
63
+ errorName: getSafeErrorName(e)
64
+ });
65
+ }
66
+ };
67
+ if (!forwardEvents) {
68
+ stopForwarding();
69
+ return stopForwarding;
70
+ }
71
+ try {
72
+ OfflineSdk.configureOfflineHostTelemetry({
73
+ // Resolved per event, not captured: the Dev Player swaps the logger when
74
+ // it switches apps, and a captured instance would strand events.
75
+ //
76
+ // `name` is the operation name only. Deliberately not passed as the
77
+ // optional third `eventName` argument: that overrides the canonical
78
+ // `PowerAppsClient.Activity`/`.Error` 1DS event names, which would hide
79
+ // every offline event from the queries and dashboards that filter on
80
+ // them. The name already reaches 1DS as `operation_Name`.
81
+ trackActivityEvent: (name, properties) => getAppLogger().trackActivityEvent(name, properties),
82
+ trackErrorEvent: (name, properties) => getAppLogger().trackErrorEvent(name, properties)
83
+ });
84
+ } catch (e) {
85
+ getAppLogger().trackErrorEvent(OfflineTelemetryBindFailed, {
86
+ errorName: getSafeErrorName(e)
87
+ });
88
+ return () => undefined;
89
+ }
90
+ return stopForwarding;
91
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export function configureOfflineSdkTelemetry(_forwardEvents) {
4
+ return () => undefined;
5
+ }
@@ -10,8 +10,9 @@
10
10
  * alongside the canonical host operation-name constants.
11
11
  */
12
12
 
13
- export { getAppLogger, configureAppLogger } from '@microsoft/power-apps-native-common';
14
-
13
+ import { HttpClient } from '@microsoft/power-apps-native-common/http';
14
+ import { isDebugLoggingEnabled } from "../logger.js";
15
+ export { getAppLogger, configureAppLogger, getCustomerTelemetryLogger } from '@microsoft/power-apps-native-common';
15
16
  /**
16
17
  * Canonical operation names for host package telemetry.
17
18
  * Follow the `PowerAppsHost.<Subsystem>.<Action>` convention so events are
@@ -42,14 +43,24 @@ export const HostOperationNames = {
42
43
  /** Top-level React error boundary caught an unhandled JS error. */
43
44
  RuntimeUnhandledJsError: 'PowerAppsHost.Runtime.UnhandledJsError',
44
45
  // ── Platform APIs ─────────────────────────────────────────────────────────
46
+ /** Power Platform RP HTTP request, including backend correlation IDs. */
47
+ PlatformHttpRequest: 'PowerAppsHost.Platform.HttpRequest',
45
48
  /** Resolve Dataverse instanceUrl from Power Platform environment API. */
46
49
  PlatformFetchInstanceUrl: 'PowerAppsHost.Platform.FetchInstanceUrl',
47
50
  /** useConnectionRefs failed to resolve connections (recoverable). Recorded only on failure. */
48
51
  PlatformLoadConnectionsFailed: 'PowerAppsHost.Platform.LoadConnections.Failed',
49
52
  /** Create a new Power Platform connection. */
50
53
  PlatformCreateConnection: 'PowerAppsHost.Platform.CreateConnection',
54
+ /** Repair an existing Power Platform connection. */
55
+ PlatformRepairConnection: 'PowerAppsHost.Platform.RepairConnection',
56
+ /** Poll a connection until it becomes active. */
57
+ PlatformPollConnectionStatus: 'PowerAppsHost.Platform.PollConnectionStatus',
51
58
  /** Resolve app connection references for the current launch. */
52
59
  PlatformResolveConnectionRefs: 'PowerAppsHost.Platform.ResolveConnectionRefs',
53
60
  /** Grant this app access to a Power Platform connection ACL. */
54
- PlatformConnectionAclGrant: 'PowerAppsHost.Platform.ConnectionAclGrant'
55
- };
61
+ PlatformConnectionAclGrant: 'PowerAppsHost.Platform.ConnectionAclGrant',
62
+ /** Installed Offline SDK predates the SDK-owned routing contract. */
63
+ OfflineRoutingContractUnsupported: 'PowerAppsHost.Offline.RoutingContract.Unsupported'
64
+ };
65
+ export const bridgeHttpClient = new HttpClient(HostOperationNames.BridgeHttpRequest, isDebugLoggingEnabled);
66
+ export const platformHttpClient = new HttpClient(HostOperationNames.PlatformHttpRequest, isDebugLoggingEnabled);
@@ -46,9 +46,11 @@ export interface AuthProviderProps {
46
46
  * Pass explicitly only to override the default (e.g. in tests).
47
47
  */
48
48
  intuneConfig?: IntuneConfig;
49
+ /** Token audiences that must be available before the account is considered signed in. */
50
+ requiredScopes?: string[];
49
51
  children: React.ReactNode;
50
52
  }
51
- export declare function AuthProvider({ msalConfig, intuneConfig, children }: AuthProviderProps): React.JSX.Element;
53
+ export declare function AuthProvider({ msalConfig, intuneConfig, requiredScopes, children, }: AuthProviderProps): React.JSX.Element;
52
54
  /**
53
55
  * Returns the current auth state from the nearest <AuthProvider>.
54
56
  * Must be called within the AuthProvider tree.
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import type { IntuneConfig, MsalAuthConfig } from '@microsoft/power-apps-native-auth';
3
+ export interface AuthState {
4
+ isLoading: boolean;
5
+ isAuthReady: boolean;
6
+ isSignedIn: boolean;
7
+ hasRealAccount: boolean;
8
+ error: Error | null;
9
+ acquireToken: (scopes: string[]) => Promise<string | null>;
10
+ signIn: () => Promise<void>;
11
+ signOut: () => Promise<void>;
12
+ }
13
+ export interface AuthProviderProps {
14
+ msalConfig: MsalAuthConfig;
15
+ intuneConfig?: IntuneConfig;
16
+ requiredScopes?: string[];
17
+ children: React.ReactNode;
18
+ }
19
+ export declare function AuthProvider({ children }: AuthProviderProps): React.JSX.Element;
20
+ export declare function useAuth(): AuthState;
21
+ //# sourceMappingURL=AuthContext.web.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { WebBrowserCompleteAuthSessionOptions, WebBrowserCompleteAuthSessionResult } from 'expo-web-browser';
2
+ /**
3
+ * Completes an Expo web authentication popup when the current route is its
4
+ * redirect target. Call this at module initialization in the OAuth callback
5
+ * route; navigation after completion remains application-owned.
6
+ */
7
+ export declare function completePowerAppsAuthSession(options?: WebBrowserCompleteAuthSessionOptions): WebBrowserCompleteAuthSessionResult;
8
+ //# sourceMappingURL=completePowerAppsAuthSession.d.ts.map
@@ -0,0 +1,18 @@
1
+ import type { AppConnectionReference, CdsDataSourceConfig } from './NativePowerAppsBridge';
2
+ export type PowerPagesBridgeOptions = {
3
+ dataSources: CdsDataSourceConfig[];
4
+ connections: Record<string, AppConnectionReference>;
5
+ };
6
+ export declare class PowerPagesBridge {
7
+ private options;
8
+ constructor(options: PowerPagesBridgeOptions);
9
+ updateOptions(options: PowerPagesBridgeOptions): void;
10
+ initialize(): Promise<void>;
11
+ createRequestBody(config: {
12
+ body?: string | Uint8Array | ArrayBuffer | Blob;
13
+ }): Blob | string | Uint8Array | ArrayBuffer;
14
+ executePluginAsync<T = unknown>(pluginName: string, pluginAction: string, params: unknown[]): Promise<T>;
15
+ private sendHttpAsync;
16
+ }
17
+ export declare function setupPowerPagesHost(options: PowerPagesBridgeOptions): void;
18
+ //# sourceMappingURL=PowerPagesBridge.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { NativeBridgeOptions } from './NativePowerAppsBridge';
2
+ export declare function getRequestBodyForMethod(method: string, body: BodyInit | null): BodyInit | null;
3
+ export declare function assertSuccessfulHttpStatus(status: number, method: string): void;
4
+ export declare function updateBridgeOptionsInPlace(current: NativeBridgeOptions, next: NativeBridgeOptions): NativeBridgeOptions;
5
+ //# sourceMappingURL=bridgeState.d.ts.map
@@ -39,12 +39,23 @@
39
39
  * the consuming app decides how to render it (full-screen, modal, etc.).
40
40
  */
41
41
  import React from 'react';
42
- import type { ConnectorSchema } from '../platform/useConnectionRefs';
42
+ import type { ConnectionConsentDetails, ResourceConsentRequirement } from '../connections/types';
43
+ import type { ConnectorSchema } from './useConnectionRefs';
43
44
  export interface MissingConnectorEntry {
44
45
  /** Connector API ID (e.g. "/providers/Microsoft.PowerApps/apis/shared_office365users"). */
45
46
  apiId: string;
46
47
  /** Local ref ID from power.config.json (for correlation). */
47
48
  localRefId: string;
49
+ /** Canonical connector short name. Supplied by useConnectionRefs. */
50
+ connectorId?: string;
51
+ dataSources?: string[];
52
+ displayName?: string;
53
+ iconUri?: string;
54
+ appActions?: string[];
55
+ gatewayObjectIdHint?: string;
56
+ authenticationType?: string;
57
+ parameterSetName?: string;
58
+ sharedConnectionId?: string;
48
59
  }
49
60
  export interface ConnectionSetupScreenProps {
50
61
  /**
@@ -60,11 +71,20 @@ export interface ConnectionSetupScreenProps {
60
71
  environmentId: string;
61
72
  region?: string;
62
73
  acquireToken: (scopes: string[]) => Promise<string | null>;
74
+ onSignOut?: () => void | Promise<void>;
63
75
  /**
64
76
  * Called when all missing connections have been resolved.
65
- * `resolvedIds` maps apiId → connectionId for all newly created connections.
77
+ * `resolvedIds` maps localRefId → connectionId for all newly created connections.
66
78
  */
67
- onAllConnected: (resolvedIds: Record<string, string>) => void;
79
+ onAllConnected: (resolvedIds: Record<string, string>) => void | Promise<void>;
80
+ /** All connector usages requiring user approval, including already-resolved references. */
81
+ consentDetails?: ConnectionConsentDetails[];
82
+ /** Additional protected resources, such as cross-environment Dataverse instances. */
83
+ resourceConsents?: ResourceConsentRequirement[];
84
+ /** Called when the user explicitly declines access. */
85
+ onConsentDeclined?: () => void | Promise<void>;
86
+ /** Whether to show app-level Review Access after authentication. Defaults to true. */
87
+ showReview?: boolean;
68
88
  /**
69
89
  * If provided, a "Skip" button is shown. Useful for non-blocking connection flows.
70
90
  * The app should handle the case where connections remain unresolved.
@@ -76,11 +96,12 @@ export interface ConnectionSetupScreenProps {
76
96
  * access on each newly created connection, fixing the APIM 403 for
77
97
  * third-party app tokens.
78
98
  */
79
- isvClientId?: string;
99
+ isvClientId: string;
80
100
  /**
81
101
  * Optional custom renderer for the OAuth WebView.
82
102
  * Receives the consent URL and a dismiss callback.
83
- * If not provided, `Linking.openURL()` is used to open the URL in the system browser.
103
+ * If not provided, Expo's system authentication browser is used.
104
+ * Custom views should pass their final redirect URL to `onDone` when available.
84
105
  *
85
106
  * @example
86
107
  * // Using react-native-webview:
@@ -91,7 +112,7 @@ export interface ConnectionSetupScreenProps {
91
112
  * </Modal>
92
113
  * )}
93
114
  */
94
- renderOAuthWebView?: (url: string, onDone: () => void) => React.ReactNode;
115
+ renderOAuthWebView?: (url: string, onDone: (redirectUrl?: string) => void) => React.ReactNode;
95
116
  /** Optional title override (default: "Set up connections"). */
96
117
  title?: string;
97
118
  }
@@ -103,5 +124,5 @@ export interface ConnectionSetupScreenProps {
103
124
  * resolved `onAllConnected` fires and the parent app should unmount this
104
125
  * component and proceed to launch the app.
105
126
  */
106
- export declare function ConnectionSetupScreen({ missingConnectors, schemaMap, environmentId, region, acquireToken, isvClientId, onAllConnected, onSkip, renderOAuthWebView, title, }: ConnectionSetupScreenProps): React.JSX.Element;
127
+ export declare function ConnectionSetupScreen({ missingConnectors, schemaMap, environmentId, region, acquireToken, onSignOut, isvClientId, onAllConnected, onSkip, consentDetails, resourceConsents, onConsentDeclined, showReview, renderOAuthWebView, title, }: ConnectionSetupScreenProps): React.JSX.Element;
107
128
  //# sourceMappingURL=ConnectionSetupScreen.d.ts.map