@microsoft/power-apps-native-host 0.2.25 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -10
- package/compatibility/current.json +31 -4
- package/lib/NOTICE.txt +1325 -24
- package/lib/commonjs/auth/AuthContext.js +110 -33
- package/lib/commonjs/bridge/NativePowerAppsBridge.js +11 -18
- package/lib/commonjs/bridge/PowerPagesBridge.js +27 -8
- package/lib/commonjs/bridge/bridgeState.js +40 -0
- package/lib/commonjs/config/babelConfig.js +13 -0
- package/lib/commonjs/config/expoConfig.js +71 -0
- package/lib/commonjs/config/metroConfig.js +70 -0
- package/lib/commonjs/config/metroLogger.js +182 -0
- package/lib/commonjs/config/tamaguiConfig.js +98 -0
- package/lib/commonjs/connections/ConnectionSetupScreen.js +459 -80
- package/lib/commonjs/connections/PowerPlatformConnectionApi.js +946 -0
- package/lib/commonjs/connections/connectionMetadata.js +127 -0
- package/lib/commonjs/connections/connectionState.js +96 -0
- package/lib/commonjs/connections/disambiguate.js +19 -11
- package/lib/commonjs/connections/resolveConnections.js +348 -0
- package/lib/commonjs/connections/types.js +106 -0
- package/lib/commonjs/{platform → connections}/useConnectionRefs.js +130 -65
- package/lib/commonjs/connections/useConnectionSetup.js +111 -52
- package/lib/commonjs/controls/FilePicker.js +6 -0
- package/lib/commonjs/controls/ImagePicker.js +8 -0
- package/lib/commonjs/index.js +167 -4
- package/lib/commonjs/logger.js +9 -6
- package/lib/commonjs/offline/createOfflineHostActivationCallbacks.js +61 -0
- package/lib/commonjs/offline/useOfflineIntegrationWithStartupGate.js +48 -0
- package/lib/commonjs/offline/useOfflineIntegrationWithStartupGate.web.js +13 -0
- package/lib/commonjs/platform/DataverseDataSources.js +18 -0
- package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +94 -0
- package/lib/commonjs/platform/GlobalDiscovery.js +51 -0
- package/lib/commonjs/platform/PowerPlatformEnvironmentApi.js +6 -106
- package/lib/commonjs/provider/PowerAppsHostProvider.js +157 -25
- package/lib/commonjs/provider/PowerAppsProvider.js +178 -134
- package/lib/commonjs/provider/SessionDetailsGesture.js +208 -0
- package/lib/commonjs/telemetry/OfflineSdkTelemetry.js +95 -0
- package/lib/commonjs/telemetry/OfflineSdkTelemetry.web.js +9 -0
- package/lib/commonjs/telemetry/index.js +22 -3
- package/lib/module/auth/AuthContext.js +110 -33
- package/lib/module/bridge/NativePowerAppsBridge.js +12 -19
- package/lib/module/bridge/PowerPagesBridge.js +27 -8
- package/lib/module/bridge/bridgeState.js +34 -0
- package/lib/module/config/babelConfig.js +9 -0
- package/lib/module/config/expoConfig.js +67 -0
- package/lib/module/config/metroConfig.js +65 -0
- package/lib/module/config/metroLogger.js +175 -0
- package/lib/module/config/tamaguiConfig.js +93 -0
- package/lib/module/connections/ConnectionSetupScreen.js +460 -81
- package/lib/module/connections/PowerPlatformConnectionApi.js +932 -0
- package/lib/module/connections/connectionMetadata.js +112 -0
- package/lib/module/connections/connectionState.js +82 -0
- package/lib/module/connections/disambiguate.js +19 -12
- package/lib/module/connections/resolveConnections.js +343 -0
- package/lib/module/connections/types.js +91 -0
- package/lib/module/{platform → connections}/useConnectionRefs.js +131 -66
- package/lib/module/connections/useConnectionSetup.js +113 -54
- package/lib/module/controls/FilePicker.js +6 -0
- package/lib/module/controls/ImagePicker.js +8 -0
- package/lib/module/index.js +14 -4
- package/lib/module/logger.js +8 -6
- package/lib/module/offline/createOfflineHostActivationCallbacks.js +55 -0
- package/lib/module/offline/useOfflineIntegrationWithStartupGate.js +44 -0
- package/lib/module/offline/useOfflineIntegrationWithStartupGate.web.js +9 -0
- package/lib/module/platform/DataverseDataSources.js +13 -0
- package/lib/module/platform/DataverseGlobalDiscoveryApi.js +89 -0
- package/lib/module/platform/GlobalDiscovery.js +45 -0
- package/lib/module/platform/PowerPlatformEnvironmentApi.js +5 -104
- package/lib/module/provider/PowerAppsHostProvider.js +160 -28
- package/lib/module/provider/PowerAppsProvider.js +182 -138
- package/lib/module/provider/SessionDetailsGesture.js +203 -0
- package/lib/module/telemetry/OfflineSdkTelemetry.js +91 -0
- package/lib/module/telemetry/OfflineSdkTelemetry.web.js +5 -0
- package/lib/module/telemetry/index.js +15 -4
- package/lib/typescript/commonjs/auth/AuthContext.d.ts +3 -1
- package/lib/typescript/commonjs/auth/AuthContext.web.d.ts +1 -0
- package/lib/typescript/commonjs/bridge/bridgeState.d.ts +5 -0
- package/lib/typescript/commonjs/config/babelConfig.d.ts +12 -0
- package/lib/typescript/commonjs/config/expoConfig.d.ts +21 -0
- package/lib/typescript/commonjs/config/metroConfig.d.ts +6 -0
- package/lib/typescript/commonjs/config/metroLogger.d.ts +21 -0
- package/lib/typescript/commonjs/config/tamaguiConfig.d.ts +1792 -0
- package/lib/typescript/commonjs/connections/ConnectionSetupScreen.d.ts +28 -7
- package/lib/typescript/commonjs/{platform → connections}/PowerPlatformConnectionApi.d.ts +52 -43
- package/lib/typescript/commonjs/connections/connectionMetadata.d.ts +66 -0
- package/lib/typescript/commonjs/connections/connectionState.d.ts +16 -0
- package/lib/typescript/commonjs/connections/disambiguate.d.ts +4 -2
- package/lib/typescript/commonjs/{platform → connections}/resolveConnections.d.ts +22 -20
- package/lib/typescript/commonjs/connections/types.d.ts +129 -1
- package/lib/typescript/commonjs/{platform → connections}/useConnectionRefs.d.ts +36 -25
- package/lib/typescript/commonjs/connections/useConnectionSetup.d.ts +12 -8
- package/lib/typescript/commonjs/controls/FilePicker.d.ts +7 -1
- package/lib/typescript/commonjs/controls/ImagePicker.d.ts +9 -1
- package/lib/typescript/commonjs/index.d.ts +18 -10
- package/lib/typescript/commonjs/logger.d.ts +4 -4
- package/lib/typescript/commonjs/offline/createOfflineHostActivationCallbacks.d.ts +12 -0
- package/lib/typescript/commonjs/offline/useOfflineIntegrationWithStartupGate.d.ts +15 -0
- package/lib/typescript/commonjs/offline/useOfflineIntegrationWithStartupGate.web.d.ts +6 -0
- package/lib/typescript/commonjs/platform/DataverseDataSources.d.ts +28 -0
- package/lib/typescript/commonjs/platform/DataverseGlobalDiscoveryApi.d.ts +3 -0
- package/lib/typescript/commonjs/platform/GlobalDiscovery.d.ts +4 -0
- package/lib/typescript/commonjs/platform/PowerPlatformEnvironmentApi.d.ts +3 -74
- package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +29 -18
- package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +54 -9
- package/lib/typescript/commonjs/provider/SessionDetailsGesture.d.ts +13 -0
- package/lib/typescript/commonjs/telemetry/OfflineSdkTelemetry.d.ts +15 -0
- package/lib/typescript/commonjs/telemetry/OfflineSdkTelemetry.web.d.ts +2 -0
- package/lib/typescript/commonjs/telemetry/index.d.ts +13 -1
- package/lib/typescript/module/auth/AuthContext.d.ts +3 -1
- package/lib/typescript/module/auth/AuthContext.web.d.ts +1 -0
- package/lib/typescript/module/bridge/bridgeState.d.ts +5 -0
- package/lib/typescript/module/config/babelConfig.d.ts +12 -0
- package/lib/typescript/module/config/expoConfig.d.ts +21 -0
- package/lib/typescript/module/config/metroConfig.d.ts +6 -0
- package/lib/typescript/module/config/metroLogger.d.ts +21 -0
- package/lib/typescript/module/config/tamaguiConfig.d.ts +1792 -0
- package/lib/typescript/module/connections/ConnectionSetupScreen.d.ts +28 -7
- package/lib/typescript/module/{platform → connections}/PowerPlatformConnectionApi.d.ts +52 -43
- package/lib/typescript/module/connections/connectionMetadata.d.ts +66 -0
- package/lib/typescript/module/connections/connectionState.d.ts +16 -0
- package/lib/typescript/module/connections/disambiguate.d.ts +4 -2
- package/lib/typescript/module/{platform → connections}/resolveConnections.d.ts +22 -20
- package/lib/typescript/module/connections/types.d.ts +129 -1
- package/lib/typescript/module/{platform → connections}/useConnectionRefs.d.ts +36 -25
- package/lib/typescript/module/connections/useConnectionSetup.d.ts +12 -8
- package/lib/typescript/module/controls/FilePicker.d.ts +7 -1
- package/lib/typescript/module/controls/ImagePicker.d.ts +9 -1
- package/lib/typescript/module/index.d.ts +18 -10
- package/lib/typescript/module/logger.d.ts +4 -4
- package/lib/typescript/module/offline/createOfflineHostActivationCallbacks.d.ts +12 -0
- package/lib/typescript/module/offline/useOfflineIntegrationWithStartupGate.d.ts +15 -0
- package/lib/typescript/module/offline/useOfflineIntegrationWithStartupGate.web.d.ts +6 -0
- package/lib/typescript/module/platform/DataverseDataSources.d.ts +28 -0
- package/lib/typescript/module/platform/DataverseGlobalDiscoveryApi.d.ts +3 -0
- package/lib/typescript/module/platform/GlobalDiscovery.d.ts +4 -0
- package/lib/typescript/module/platform/PowerPlatformEnvironmentApi.d.ts +3 -74
- package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +29 -18
- package/lib/typescript/module/provider/PowerAppsProvider.d.ts +54 -9
- package/lib/typescript/module/provider/SessionDetailsGesture.d.ts +13 -0
- package/lib/typescript/module/telemetry/OfflineSdkTelemetry.d.ts +15 -0
- package/lib/typescript/module/telemetry/OfflineSdkTelemetry.web.d.ts +2 -0
- package/lib/typescript/module/telemetry/index.d.ts +13 -1
- package/package.json +52 -13
- package/scripts/build-codegen-package.js +283 -0
- package/scripts/start-web.mjs +9 -5
- package/scripts/upgrade/runtime.js +139 -24
- package/scripts/upgrade-authoring.js +274 -180
- package/scripts/upgrade.js +10 -16
- package/src/config/generated-config.d.ts +4 -0
- package/src/config/index.d.ts +3 -0
- package/src/config/tsconfig.json +26 -0
- package/lib/commonjs/platform/PowerPlatformConnectionApi.js +0 -606
- package/lib/commonjs/platform/resolveConnections.js +0 -264
- package/lib/module/platform/PowerPlatformConnectionApi.js +0 -595
- package/lib/module/platform/resolveConnections.js +0 -259
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useConnectionSetup = useConnectionSetup;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
var _PowerPlatformConnectionApi = require("
|
|
8
|
+
var _PowerPlatformConnectionApi = require("./PowerPlatformConnectionApi.js");
|
|
9
9
|
var _PowerPlatformEnvironmentApi = require("../platform/PowerPlatformEnvironmentApi.js");
|
|
10
10
|
var _disambiguate = require("../connections/disambiguate.js");
|
|
11
|
+
var _connectionState = require("./connectionState.js");
|
|
12
|
+
var _isDevPlayer = require("../utils/isDevPlayer.js");
|
|
11
13
|
var _logger = require("../logger.js");
|
|
12
14
|
var _index = require("../telemetry/index.js");
|
|
13
15
|
/*!
|
|
@@ -55,7 +57,7 @@ function useConnectionSetup({
|
|
|
55
57
|
region = 'prod',
|
|
56
58
|
acquireToken,
|
|
57
59
|
onConnected,
|
|
58
|
-
|
|
60
|
+
sharedConnectionId,
|
|
59
61
|
oauthRedirectUrl,
|
|
60
62
|
polling
|
|
61
63
|
}) {
|
|
@@ -67,44 +69,53 @@ function useConnectionSetup({
|
|
|
67
69
|
const connectionNameRef = (0, _react.useRef)(null);
|
|
68
70
|
// Prevent concurrent startCreate / checkNow calls.
|
|
69
71
|
const inFlightRef = (0, _react.useRef)(false);
|
|
72
|
+
const operationRef = (0, _react.useRef)(null);
|
|
73
|
+
const beginOperation = (0, _react.useCallback)(() => {
|
|
74
|
+
operationRef.current?.abort();
|
|
75
|
+
const controller = new AbortController();
|
|
76
|
+
operationRef.current = controller;
|
|
77
|
+
return controller;
|
|
78
|
+
}, []);
|
|
79
|
+
(0, _react.useEffect)(() => () => operationRef.current?.abort(), []);
|
|
70
80
|
const handleConnected = (0, _react.useCallback)(async instance => {
|
|
71
81
|
setPhase('connected');
|
|
72
82
|
setConsentUrl(null);
|
|
83
|
+
if (!(0, _connectionState.shouldGrantConnectionUserConsent)({
|
|
84
|
+
sharedConnectionId
|
|
85
|
+
}, _isDevPlayer.isDevPlayer)) {
|
|
86
|
+
onConnected?.(instance);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
73
89
|
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
(0, _index.getAppLogger)().trackErrorEvent(_index.HostOperationNames.PlatformConnectionAclGrant, {
|
|
97
|
-
phase: 'setupConnectionAcl',
|
|
98
|
-
reason: 'aclGrantRejected'
|
|
99
|
-
});
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
90
|
+
// APIM checks the requesting appid against the user's effective ACL.
|
|
91
|
+
// User consent lets RP select the applicable direct, group, or tenant ACL.
|
|
92
|
+
const consentToken = await acquireToken([(0, _PowerPlatformEnvironmentApi.connectionUserConsentScope)(region)]);
|
|
93
|
+
if (!consentToken) {
|
|
94
|
+
setPhase('error');
|
|
95
|
+
setErrorMessage('Connection was created, but access could not be granted to this app. Please try again.');
|
|
96
|
+
(0, _logger.debugWarn)('[useConnectionSetup] could not grant connection consent: missing Power Platform token');
|
|
97
|
+
(0, _index.getAppLogger)().trackErrorEvent(_index.HostOperationNames.PlatformConnectionAclGrant, {
|
|
98
|
+
phase: 'setupConnectionAcl',
|
|
99
|
+
reason: 'missingPowerPlatformToken'
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const aclGranted = await (0, _PowerPlatformConnectionApi.grantConnectionUserConsent)(connectorId, instance.id, environmentId, region, consentToken);
|
|
104
|
+
if (!aclGranted) {
|
|
105
|
+
setPhase('error');
|
|
106
|
+
setErrorMessage('Connection was created, but access could not be granted to this app. Please try again.');
|
|
107
|
+
(0, _index.getAppLogger)().trackErrorEvent(_index.HostOperationNames.PlatformConnectionAclGrant, {
|
|
108
|
+
phase: 'setupConnectionAcl',
|
|
109
|
+
reason: 'aclGrantRejected'
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
102
112
|
}
|
|
103
113
|
onConnected?.(instance);
|
|
104
|
-
}, [onConnected, acquireToken, connectorId, environmentId,
|
|
105
|
-
const startCreate = (0, _react.useCallback)(async
|
|
114
|
+
}, [onConnected, acquireToken, connectorId, environmentId, region, sharedConnectionId]);
|
|
115
|
+
const startCreate = (0, _react.useCallback)(async input => {
|
|
106
116
|
if (inFlightRef.current) return;
|
|
107
117
|
inFlightRef.current = true;
|
|
118
|
+
const operation = beginOperation();
|
|
108
119
|
setPhase('creating');
|
|
109
120
|
setErrorMessage(null);
|
|
110
121
|
setConsentUrl(null);
|
|
@@ -116,7 +127,7 @@ function useConnectionSetup({
|
|
|
116
127
|
setErrorMessage('Failed to acquire authentication token');
|
|
117
128
|
return;
|
|
118
129
|
}
|
|
119
|
-
const result = await (0, _PowerPlatformConnectionApi.createConnection)(connectorId, environmentId, region, token, undefined, oauthRedirectUrl);
|
|
130
|
+
const result = await (0, _PowerPlatformConnectionApi.createConnection)(connectorId, environmentId, region, token, undefined, oauthRedirectUrl, input);
|
|
120
131
|
if (result.status === 'error') {
|
|
121
132
|
setPhase('error');
|
|
122
133
|
setErrorMessage(result.message);
|
|
@@ -127,10 +138,11 @@ function useConnectionSetup({
|
|
|
127
138
|
// Connection is already Connected — poll once to get the full instance.
|
|
128
139
|
const instance = await (0, _PowerPlatformConnectionApi.pollConnectionStatus)(connectorId, result.connectionName, environmentId, region, acquireToken, {
|
|
129
140
|
timeoutMs: 10_000,
|
|
130
|
-
...polling
|
|
141
|
+
...polling,
|
|
142
|
+
signal: operation.signal
|
|
131
143
|
});
|
|
132
144
|
if (instance) {
|
|
133
|
-
handleConnected(instance);
|
|
145
|
+
await handleConnected(instance);
|
|
134
146
|
} else {
|
|
135
147
|
// Already created but not Connected yet — treat as oauth phase without a URL.
|
|
136
148
|
setPhase('oauth');
|
|
@@ -141,36 +153,77 @@ function useConnectionSetup({
|
|
|
141
153
|
// status === 'pending': show the OAuth URL in a WebView.
|
|
142
154
|
setConsentUrl(result.consentLink);
|
|
143
155
|
setPhase('oauth');
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
156
|
+
} finally {
|
|
157
|
+
inFlightRef.current = false;
|
|
158
|
+
}
|
|
159
|
+
}, [connectorId, environmentId, region, acquireToken, polling, handleConnected, beginOperation]);
|
|
160
|
+
const startRepair = (0, _react.useCallback)(async (instance, input, requiresApiConsent = true) => {
|
|
161
|
+
if (inFlightRef.current) return;
|
|
162
|
+
inFlightRef.current = true;
|
|
163
|
+
const operation = beginOperation();
|
|
164
|
+
setPhase('creating');
|
|
165
|
+
setErrorMessage(null);
|
|
166
|
+
setConsentUrl(null);
|
|
167
|
+
connectionNameRef.current = instance.name;
|
|
168
|
+
try {
|
|
169
|
+
const token = await acquireToken([(0, _PowerPlatformEnvironmentApi.powerPlatformScope)(region)]);
|
|
170
|
+
if (!token) {
|
|
171
|
+
setPhase('error');
|
|
172
|
+
setErrorMessage('Failed to acquire authentication token');
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const result = await (0, _PowerPlatformConnectionApi.repairConnection)(connectorId, instance.name, environmentId, region, token, oauthRedirectUrl, input, requiresApiConsent);
|
|
176
|
+
if (result.status === 'error') {
|
|
153
177
|
setPhase('error');
|
|
154
|
-
setErrorMessage(
|
|
178
|
+
setErrorMessage(result.message);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
connectionNameRef.current = result.connectionName;
|
|
182
|
+
if (result.status === 'pending') {
|
|
183
|
+
setConsentUrl(result.consentLink);
|
|
184
|
+
setPhase('oauth');
|
|
185
|
+
} else {
|
|
186
|
+
const repaired = await (0, _PowerPlatformConnectionApi.pollConnectionStatus)(connectorId, result.connectionName, environmentId, region, acquireToken, {
|
|
187
|
+
timeoutMs: 10_000,
|
|
188
|
+
...polling,
|
|
189
|
+
signal: operation.signal
|
|
190
|
+
});
|
|
191
|
+
if (repaired) await handleConnected(repaired);else {
|
|
192
|
+
setPhase('error');
|
|
193
|
+
setErrorMessage('The connection was updated but did not become active.');
|
|
194
|
+
}
|
|
155
195
|
}
|
|
156
196
|
} finally {
|
|
157
197
|
inFlightRef.current = false;
|
|
158
198
|
}
|
|
159
|
-
}, [connectorId, environmentId,
|
|
199
|
+
}, [acquireToken, beginOperation, connectorId, environmentId, handleConnected, oauthRedirectUrl, polling, region]);
|
|
200
|
+
const useExisting = (0, _react.useCallback)(async instance => {
|
|
201
|
+
if (inFlightRef.current) return;
|
|
202
|
+
inFlightRef.current = true;
|
|
203
|
+
setPhase('confirming');
|
|
204
|
+
setErrorMessage(null);
|
|
205
|
+
try {
|
|
206
|
+
await handleConnected(instance);
|
|
207
|
+
} finally {
|
|
208
|
+
inFlightRef.current = false;
|
|
209
|
+
}
|
|
210
|
+
}, [handleConnected]);
|
|
160
211
|
const checkNow = (0, _react.useCallback)(async () => {
|
|
161
212
|
const name = connectionNameRef.current;
|
|
162
213
|
if (!name || inFlightRef.current) return;
|
|
163
214
|
if (phase !== 'oauth' && phase !== 'confirming') return;
|
|
164
215
|
inFlightRef.current = true;
|
|
216
|
+
const operation = beginOperation();
|
|
165
217
|
setPhase('confirming');
|
|
166
218
|
try {
|
|
167
219
|
const instance = await (0, _PowerPlatformConnectionApi.pollConnectionStatus)(connectorId, name, environmentId, region, acquireToken, {
|
|
168
220
|
intervalMs: 1000,
|
|
169
221
|
timeoutMs: 30_000,
|
|
170
|
-
...polling
|
|
222
|
+
...polling,
|
|
223
|
+
signal: operation.signal
|
|
171
224
|
});
|
|
172
225
|
if (instance) {
|
|
173
|
-
handleConnected(instance);
|
|
226
|
+
await handleConnected(instance);
|
|
174
227
|
} else {
|
|
175
228
|
// Not yet connected — go back to oauth so the user can retry.
|
|
176
229
|
setPhase('oauth');
|
|
@@ -179,8 +232,10 @@ function useConnectionSetup({
|
|
|
179
232
|
} finally {
|
|
180
233
|
inFlightRef.current = false;
|
|
181
234
|
}
|
|
182
|
-
}, [phase, environmentId, region, acquireToken, polling, handleConnected]);
|
|
235
|
+
}, [phase, connectorId, environmentId, region, acquireToken, polling, handleConnected, beginOperation]);
|
|
183
236
|
const reset = (0, _react.useCallback)(() => {
|
|
237
|
+
operationRef.current?.abort();
|
|
238
|
+
operationRef.current = null;
|
|
184
239
|
inFlightRef.current = false;
|
|
185
240
|
connectionNameRef.current = null;
|
|
186
241
|
setPhase('idle');
|
|
@@ -200,6 +255,7 @@ function useConnectionSetup({
|
|
|
200
255
|
const name = connectionNameRef.current;
|
|
201
256
|
if (!name || inFlightRef.current) return;
|
|
202
257
|
inFlightRef.current = true;
|
|
258
|
+
const operation = beginOperation();
|
|
203
259
|
setPhase('confirming');
|
|
204
260
|
try {
|
|
205
261
|
if (code) {
|
|
@@ -212,10 +268,11 @@ function useConnectionSetup({
|
|
|
212
268
|
const instance = await (0, _PowerPlatformConnectionApi.pollConnectionStatus)(connectorId, name, environmentId, region, acquireToken, {
|
|
213
269
|
intervalMs: 1000,
|
|
214
270
|
timeoutMs: 30_000,
|
|
215
|
-
...polling
|
|
271
|
+
...polling,
|
|
272
|
+
signal: operation.signal
|
|
216
273
|
});
|
|
217
274
|
if (instance) {
|
|
218
|
-
handleConnected(instance);
|
|
275
|
+
await handleConnected(instance);
|
|
219
276
|
} else {
|
|
220
277
|
setPhase('oauth');
|
|
221
278
|
setErrorMessage('Connection is not yet active. Complete the sign-in and try again.');
|
|
@@ -223,12 +280,14 @@ function useConnectionSetup({
|
|
|
223
280
|
} finally {
|
|
224
281
|
inFlightRef.current = false;
|
|
225
282
|
}
|
|
226
|
-
}, [connectorId, environmentId, region, acquireToken, polling, handleConnected]);
|
|
283
|
+
}, [connectorId, environmentId, region, acquireToken, polling, handleConnected, beginOperation]);
|
|
227
284
|
return {
|
|
228
285
|
phase,
|
|
229
286
|
consentUrl,
|
|
230
287
|
errorMessage,
|
|
231
288
|
startCreate,
|
|
289
|
+
startRepair,
|
|
290
|
+
useExisting,
|
|
232
291
|
checkNow,
|
|
233
292
|
completeConsent,
|
|
234
293
|
reset
|
|
@@ -24,6 +24,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
24
24
|
*/
|
|
25
25
|
function FilePicker({
|
|
26
26
|
label,
|
|
27
|
+
testID,
|
|
28
|
+
fileRowTestID,
|
|
29
|
+
pickButtonTestID,
|
|
27
30
|
fileName,
|
|
28
31
|
onDownload,
|
|
29
32
|
shareTitle,
|
|
@@ -90,6 +93,7 @@ function FilePicker({
|
|
|
90
93
|
}
|
|
91
94
|
};
|
|
92
95
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
96
|
+
testID: testID,
|
|
93
97
|
style: [styles.container, containerStyle],
|
|
94
98
|
children: [label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
95
99
|
style: [styles.label, {
|
|
@@ -97,6 +101,7 @@ function FilePicker({
|
|
|
97
101
|
}, labelStyle],
|
|
98
102
|
children: label
|
|
99
103
|
}) : null, displayName ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
104
|
+
testID: fileRowTestID,
|
|
100
105
|
style: [styles.fileRow, fileRowStyle],
|
|
101
106
|
onPress: onDownload ? download : undefined,
|
|
102
107
|
activeOpacity: onDownload ? 0.7 : 1,
|
|
@@ -120,6 +125,7 @@ function FilePicker({
|
|
|
120
125
|
color: accent
|
|
121
126
|
}))]
|
|
122
127
|
}) : null, onChange ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
128
|
+
testID: pickButtonTestID,
|
|
123
129
|
style: [styles.button, {
|
|
124
130
|
borderColor: accent,
|
|
125
131
|
backgroundColor: bg
|
|
@@ -22,6 +22,10 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
22
22
|
*/
|
|
23
23
|
function ImagePicker({
|
|
24
24
|
label = 'Image',
|
|
25
|
+
testID,
|
|
26
|
+
cameraButtonTestID,
|
|
27
|
+
selectButtonTestID,
|
|
28
|
+
previewTestID,
|
|
25
29
|
initialBase64,
|
|
26
30
|
onChange,
|
|
27
31
|
containerStyle,
|
|
@@ -136,6 +140,7 @@ function ImagePicker({
|
|
|
136
140
|
}
|
|
137
141
|
};
|
|
138
142
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
143
|
+
testID: testID,
|
|
139
144
|
style: [styles.container, containerStyle],
|
|
140
145
|
children: [label ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
141
146
|
style: [styles.label, {
|
|
@@ -145,6 +150,7 @@ function ImagePicker({
|
|
|
145
150
|
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
146
151
|
style: [styles.buttonRow, buttonRowStyle],
|
|
147
152
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
153
|
+
testID: cameraButtonTestID,
|
|
148
154
|
style: [styles.button, {
|
|
149
155
|
borderColor: accentColor_resolved,
|
|
150
156
|
backgroundColor: bg
|
|
@@ -166,6 +172,7 @@ function ImagePicker({
|
|
|
166
172
|
children: reading ? readingLabel : cameraButtonLabel
|
|
167
173
|
})]
|
|
168
174
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
175
|
+
testID: selectButtonTestID,
|
|
169
176
|
style: [styles.button, {
|
|
170
177
|
borderColor: accentColor_resolved,
|
|
171
178
|
backgroundColor: bg
|
|
@@ -188,6 +195,7 @@ function ImagePicker({
|
|
|
188
195
|
})]
|
|
189
196
|
})]
|
|
190
197
|
}), previewUri ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
|
|
198
|
+
testID: previewTestID,
|
|
191
199
|
source: {
|
|
192
200
|
uri: previewUri
|
|
193
201
|
},
|
package/lib/commonjs/index.js
CHANGED
|
@@ -90,7 +90,13 @@ Object.defineProperty(exports, "base64ToUint8Array", {
|
|
|
90
90
|
Object.defineProperty(exports, "buildCdsDataSources", {
|
|
91
91
|
enumerable: true,
|
|
92
92
|
get: function () {
|
|
93
|
-
return
|
|
93
|
+
return _DataverseDataSources.buildCdsDataSources;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "buildConnectionParameterSets", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _connectionMetadata.buildConnectionParameterSets;
|
|
94
100
|
}
|
|
95
101
|
});
|
|
96
102
|
Object.defineProperty(exports, "buildConnectionReferences", {
|
|
@@ -99,12 +105,60 @@ Object.defineProperty(exports, "buildConnectionReferences", {
|
|
|
99
105
|
return _NativePowerAppsBridge.buildConnectionReferences;
|
|
100
106
|
}
|
|
101
107
|
});
|
|
108
|
+
Object.defineProperty(exports, "buildConnectionRequirements", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _types.buildConnectionRequirements;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "buildConnectionResolutionKey", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _types.buildConnectionResolutionKey;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "buildConnectionUsageRequest", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _connectionMetadata.buildConnectionUsageRequest;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "buildConnectionUsageUrl", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () {
|
|
129
|
+
return _connectionMetadata.buildConnectionUsageUrl;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "buildConnectionUserConsentUrl", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _connectionMetadata.buildConnectionUserConsentUrl;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "buildConsentLinkDefinition", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () {
|
|
141
|
+
return _connectionMetadata.buildConsentLinkDefinition;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
102
144
|
Object.defineProperty(exports, "buildEnvironmentEndpoint", {
|
|
103
145
|
enumerable: true,
|
|
104
146
|
get: function () {
|
|
105
147
|
return _PowerPlatformEnvironmentApi.buildEnvironmentEndpoint;
|
|
106
148
|
}
|
|
107
149
|
});
|
|
150
|
+
Object.defineProperty(exports, "buildScopeConsentRequest", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _connectionMetadata.buildScopeConsentRequest;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "buildScopeConsentUrl", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _connectionMetadata.buildScopeConsentUrl;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
108
162
|
Object.defineProperty(exports, "completePowerAppsAuthSession", {
|
|
109
163
|
enumerable: true,
|
|
110
164
|
get: function () {
|
|
@@ -141,6 +195,12 @@ Object.defineProperty(exports, "darkTheme", {
|
|
|
141
195
|
return _tokens.darkTheme;
|
|
142
196
|
}
|
|
143
197
|
});
|
|
198
|
+
Object.defineProperty(exports, "deleteConnection", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () {
|
|
201
|
+
return _PowerPlatformConnectionApi.deleteConnection;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
144
204
|
Object.defineProperty(exports, "disambiguateConnections", {
|
|
145
205
|
enumerable: true,
|
|
146
206
|
get: function () {
|
|
@@ -153,6 +213,12 @@ Object.defineProperty(exports, "extractConnectionId", {
|
|
|
153
213
|
return _disambiguate.extractConnectionId;
|
|
154
214
|
}
|
|
155
215
|
});
|
|
216
|
+
Object.defineProperty(exports, "fetchAppConnectionUsages", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return _PowerPlatformConnectionApi.fetchAppConnectionUsages;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
156
222
|
Object.defineProperty(exports, "fetchAppLaunchData", {
|
|
157
223
|
enumerable: true,
|
|
158
224
|
get: function () {
|
|
@@ -174,7 +240,13 @@ Object.defineProperty(exports, "fetchConnectorMetadata", {
|
|
|
174
240
|
Object.defineProperty(exports, "fetchInstanceUrl", {
|
|
175
241
|
enumerable: true,
|
|
176
242
|
get: function () {
|
|
177
|
-
return
|
|
243
|
+
return _DataverseGlobalDiscoveryApi.fetchInstanceUrl;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, "findConnectionDataSourceConflicts", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function () {
|
|
249
|
+
return _types.findConnectionDataSourceConflicts;
|
|
178
250
|
}
|
|
179
251
|
});
|
|
180
252
|
Object.defineProperty(exports, "getAppLogger", {
|
|
@@ -183,6 +255,36 @@ Object.defineProperty(exports, "getAppLogger", {
|
|
|
183
255
|
return _index.getAppLogger;
|
|
184
256
|
}
|
|
185
257
|
});
|
|
258
|
+
Object.defineProperty(exports, "getConnectorId", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function () {
|
|
261
|
+
return _types.getConnectorId;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(exports, "getCustomerTelemetryLogger", {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
get: function () {
|
|
267
|
+
return _index.getCustomerTelemetryLogger;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
Object.defineProperty(exports, "hasCompleteStaticConnectionConfig", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function () {
|
|
273
|
+
return _types.hasCompleteStaticConnectionConfig;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
Object.defineProperty(exports, "hasOAuthParameter", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () {
|
|
279
|
+
return _connectionMetadata.hasOAuthParameter;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, "isCompositeConnectionApiId", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () {
|
|
285
|
+
return _types.isCompositeConnectionApiId;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
186
288
|
Object.defineProperty(exports, "isDevPlayer", {
|
|
187
289
|
enumerable: true,
|
|
188
290
|
get: function () {
|
|
@@ -195,12 +297,48 @@ Object.defineProperty(exports, "lightTheme", {
|
|
|
195
297
|
return _tokens.lightTheme;
|
|
196
298
|
}
|
|
197
299
|
});
|
|
300
|
+
Object.defineProperty(exports, "normalizeApiId", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _types.normalizeApiId;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(exports, "parseConnectionParameters", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function () {
|
|
309
|
+
return _connectionMetadata.parseConnectionParameters;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
198
312
|
Object.defineProperty(exports, "pollConnectionStatus", {
|
|
199
313
|
enumerable: true,
|
|
200
314
|
get: function () {
|
|
201
315
|
return _PowerPlatformConnectionApi.pollConnectionStatus;
|
|
202
316
|
}
|
|
203
317
|
});
|
|
318
|
+
Object.defineProperty(exports, "postConnectionUsage", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function () {
|
|
321
|
+
return _PowerPlatformConnectionApi.postConnectionUsage;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
Object.defineProperty(exports, "repairConnection", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function () {
|
|
327
|
+
return _PowerPlatformConnectionApi.repairConnection;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
Object.defineProperty(exports, "reportScopeConsents", {
|
|
331
|
+
enumerable: true,
|
|
332
|
+
get: function () {
|
|
333
|
+
return _PowerPlatformConnectionApi.reportScopeConsents;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
Object.defineProperty(exports, "serializeConnectionParameters", {
|
|
337
|
+
enumerable: true,
|
|
338
|
+
get: function () {
|
|
339
|
+
return _connectionMetadata.serializeConnectionParameters;
|
|
340
|
+
}
|
|
341
|
+
});
|
|
204
342
|
Object.defineProperty(exports, "setupNativeHost", {
|
|
205
343
|
enumerable: true,
|
|
206
344
|
get: function () {
|
|
@@ -213,6 +351,24 @@ Object.defineProperty(exports, "setupPowerPagesHost", {
|
|
|
213
351
|
return _PowerPagesBridge.setupPowerPagesHost;
|
|
214
352
|
}
|
|
215
353
|
});
|
|
354
|
+
Object.defineProperty(exports, "shouldPersistConnectionUsages", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
get: function () {
|
|
357
|
+
return _connectionState.shouldPersistConnectionUsages;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(exports, "shouldShowConnectionReview", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () {
|
|
363
|
+
return _connectionState.shouldShowConnectionReview;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
Object.defineProperty(exports, "updateBridgeOptionsInPlace", {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
get: function () {
|
|
369
|
+
return _bridgeState.updateBridgeOptionsInPlace;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
216
372
|
Object.defineProperty(exports, "useAuth", {
|
|
217
373
|
enumerable: true,
|
|
218
374
|
get: function () {
|
|
@@ -243,17 +399,24 @@ Object.defineProperty(exports, "useThemeTokens", {
|
|
|
243
399
|
return _ThemeProvider.useThemeTokens;
|
|
244
400
|
}
|
|
245
401
|
});
|
|
402
|
+
require("@microsoft/power-apps-native-assets");
|
|
246
403
|
var _NativePowerAppsBridge = require("./bridge/NativePowerAppsBridge.js");
|
|
247
404
|
var _PowerPagesBridge = require("./bridge/PowerPagesBridge.js");
|
|
248
405
|
var _setupNativeHost = require("./bridge/setupNativeHost.js");
|
|
406
|
+
var _bridgeState = require("./bridge/bridgeState.js");
|
|
249
407
|
var _AuthContext = require("./auth/AuthContext");
|
|
250
408
|
var _completePowerAppsAuthSession = require("./auth/completePowerAppsAuthSession.js");
|
|
251
409
|
var _PowerAppsHostProvider = require("./provider/PowerAppsHostProvider");
|
|
252
410
|
var _PowerAppsProvider = require("./provider/PowerAppsProvider.js");
|
|
253
411
|
var _PowerPlatformEnvironmentApi = require("./platform/PowerPlatformEnvironmentApi.js");
|
|
254
|
-
var
|
|
255
|
-
var
|
|
412
|
+
var _DataverseGlobalDiscoveryApi = require("./platform/DataverseGlobalDiscoveryApi.js");
|
|
413
|
+
var _DataverseDataSources = require("./platform/DataverseDataSources.js");
|
|
414
|
+
var _useConnectionRefs = require("./connections/useConnectionRefs.js");
|
|
415
|
+
var _PowerPlatformConnectionApi = require("./connections/PowerPlatformConnectionApi.js");
|
|
256
416
|
var _disambiguate = require("./connections/disambiguate.js");
|
|
417
|
+
var _connectionState = require("./connections/connectionState.js");
|
|
418
|
+
var _types = require("./connections/types.js");
|
|
419
|
+
var _connectionMetadata = require("./connections/connectionMetadata.js");
|
|
257
420
|
var _useConnectionSetup = require("./connections/useConnectionSetup.js");
|
|
258
421
|
var _ConnectionSetupScreen = require("./connections/ConnectionSetupScreen.js");
|
|
259
422
|
var _ThemeProvider = require("./theme/ThemeProvider.js");
|
package/lib/commonjs/logger.js
CHANGED
|
@@ -5,23 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.debugLog = debugLog;
|
|
7
7
|
exports.debugWarn = debugWarn;
|
|
8
|
+
exports.isDebugLoggingEnabled = isDebugLoggingEnabled;
|
|
8
9
|
var _isDevPlayer = require("./utils/isDevPlayer.js");
|
|
9
10
|
/**
|
|
10
11
|
* Conditional debug logger for power-apps-native-host.
|
|
11
12
|
*
|
|
12
|
-
* Debug logs (debugLog / debugWarn) are
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* APKs generated from the template so the production log stream stays clean.
|
|
13
|
+
* Debug logs (debugLog / debugWarn) are emitted in development bundles or when
|
|
14
|
+
* running inside Power Apps Dev Player. They remain silent in wrapped release
|
|
15
|
+
* apps so the production log stream stays clean.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
function isDebugLoggingEnabled() {
|
|
19
|
+
return __DEV__ || _isDevPlayer.isDevPlayer;
|
|
20
|
+
}
|
|
18
21
|
function debugLog(...args) {
|
|
19
|
-
if (
|
|
22
|
+
if (isDebugLoggingEnabled()) {
|
|
20
23
|
console.log(...args);
|
|
21
24
|
}
|
|
22
25
|
}
|
|
23
26
|
function debugWarn(...args) {
|
|
24
|
-
if (
|
|
27
|
+
if (isDebugLoggingEnabled()) {
|
|
25
28
|
console.warn(...args);
|
|
26
29
|
}
|
|
27
30
|
}
|