@microsoft/power-apps-native-host 0.3.3 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +60 -0
  2. package/compatibility/current.json +1 -1
  3. package/lib/NOTICE.txt +2957 -371
  4. package/lib/commonjs/auth/AuthContext.js +49 -22
  5. package/lib/commonjs/auth/targetAuthorization.js +53 -0
  6. package/lib/commonjs/bridge/NativePowerAppsBridge.js +33 -2
  7. package/lib/commonjs/bridge/PowerPagesBridge.js +1 -3
  8. package/lib/commonjs/bridge/setupNativeHost.js +6 -0
  9. package/lib/commonjs/config/expoConfig.js +14 -0
  10. package/lib/commonjs/config/runtimeTenantMode.js +16 -0
  11. package/lib/commonjs/config/runtimeTenantMode.web.js +9 -0
  12. package/lib/commonjs/config/tenantMode.js +68 -0
  13. package/lib/commonjs/connections/PowerPlatformConnectionApi.js +24 -27
  14. package/lib/commonjs/connections/connectionMetadata.js +2 -2
  15. package/lib/commonjs/connections/resolveConnections.js +8 -3
  16. package/lib/commonjs/connections/types.js +9 -2
  17. package/lib/commonjs/connections/useConnectionRefs.js +19 -10
  18. package/lib/commonjs/index.js +41 -2
  19. package/lib/commonjs/platform/CanvasAppResolution.js +33 -0
  20. package/lib/commonjs/platform/CanvasAppResolutionApi.js +69 -0
  21. package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +50 -13
  22. package/lib/commonjs/platform/GlobalDiscovery.js +40 -1
  23. package/lib/commonjs/provider/PowerAppsHostProvider.js +47 -8
  24. package/lib/commonjs/provider/PowerAppsProvider.js +175 -9
  25. package/lib/commonjs/target/DefaultPowerAppsExperience.js +564 -0
  26. package/lib/commonjs/target/PowerAppsExperience.js +41 -0
  27. package/lib/commonjs/target/PowerAppsTargetBootstrap.js +534 -0
  28. package/lib/commonjs/target/errors.js +24 -0
  29. package/lib/commonjs/target/types.js +1 -0
  30. package/lib/commonjs/telemetry/index.js +2 -2
  31. package/lib/module/auth/AuthContext.js +49 -22
  32. package/lib/module/auth/targetAuthorization.js +48 -0
  33. package/lib/module/bridge/NativePowerAppsBridge.js +33 -2
  34. package/lib/module/bridge/PowerPagesBridge.js +1 -3
  35. package/lib/module/bridge/setupNativeHost.js +5 -0
  36. package/lib/module/config/expoConfig.js +14 -0
  37. package/lib/module/config/runtimeTenantMode.js +12 -0
  38. package/lib/module/config/runtimeTenantMode.web.js +5 -0
  39. package/lib/module/config/tenantMode.js +61 -0
  40. package/lib/module/connections/PowerPlatformConnectionApi.js +24 -27
  41. package/lib/module/connections/connectionMetadata.js +2 -2
  42. package/lib/module/connections/resolveConnections.js +9 -4
  43. package/lib/module/connections/types.js +9 -2
  44. package/lib/module/connections/useConnectionRefs.js +20 -11
  45. package/lib/module/index.js +5 -2
  46. package/lib/module/platform/CanvasAppResolution.js +27 -0
  47. package/lib/module/platform/CanvasAppResolutionApi.js +65 -0
  48. package/lib/module/platform/DataverseGlobalDiscoveryApi.js +49 -14
  49. package/lib/module/platform/GlobalDiscovery.js +37 -1
  50. package/lib/module/provider/PowerAppsHostProvider.js +47 -8
  51. package/lib/module/provider/PowerAppsProvider.js +179 -13
  52. package/lib/module/target/DefaultPowerAppsExperience.js +559 -0
  53. package/lib/module/target/PowerAppsExperience.js +34 -0
  54. package/lib/module/target/PowerAppsTargetBootstrap.js +529 -0
  55. package/lib/module/target/errors.js +19 -0
  56. package/lib/module/target/types.js +1 -0
  57. package/lib/module/telemetry/index.js +1 -1
  58. package/lib/typescript/commonjs/auth/AuthContext.d.ts +11 -2
  59. package/lib/typescript/commonjs/auth/targetAuthorization.d.ts +15 -0
  60. package/lib/typescript/commonjs/bridge/NativePowerAppsBridge.d.ts +6 -0
  61. package/lib/typescript/commonjs/bridge/setupNativeHost.d.ts +2 -0
  62. package/lib/typescript/commonjs/config/runtimeTenantMode.d.ts +3 -0
  63. package/lib/typescript/commonjs/config/runtimeTenantMode.web.d.ts +3 -0
  64. package/lib/typescript/commonjs/config/tenantMode.d.ts +14 -0
  65. package/lib/typescript/commonjs/connections/PowerPlatformConnectionApi.d.ts +5 -2
  66. package/lib/typescript/commonjs/connections/connectionMetadata.d.ts +1 -1
  67. package/lib/typescript/commonjs/connections/types.d.ts +7 -1
  68. package/lib/typescript/commonjs/connections/useConnectionRefs.d.ts +11 -2
  69. package/lib/typescript/commonjs/index.d.ts +7 -3
  70. package/lib/typescript/commonjs/platform/CanvasAppResolution.d.ts +4 -0
  71. package/lib/typescript/commonjs/platform/CanvasAppResolutionApi.d.ts +6 -0
  72. package/lib/typescript/commonjs/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
  73. package/lib/typescript/commonjs/platform/GlobalDiscovery.d.ts +12 -0
  74. package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +9 -1
  75. package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +14 -16
  76. package/lib/typescript/commonjs/target/DefaultPowerAppsExperience.d.ts +6 -0
  77. package/lib/typescript/commonjs/target/PowerAppsExperience.d.ts +61 -0
  78. package/lib/typescript/commonjs/target/PowerAppsTargetBootstrap.d.ts +15 -0
  79. package/lib/typescript/commonjs/target/errors.d.ts +13 -0
  80. package/lib/typescript/commonjs/target/types.d.ts +34 -0
  81. package/lib/typescript/commonjs/telemetry/index.d.ts +2 -2
  82. package/lib/typescript/module/auth/AuthContext.d.ts +11 -2
  83. package/lib/typescript/module/auth/targetAuthorization.d.ts +15 -0
  84. package/lib/typescript/module/bridge/NativePowerAppsBridge.d.ts +6 -0
  85. package/lib/typescript/module/bridge/setupNativeHost.d.ts +2 -0
  86. package/lib/typescript/module/config/runtimeTenantMode.d.ts +3 -0
  87. package/lib/typescript/module/config/runtimeTenantMode.web.d.ts +3 -0
  88. package/lib/typescript/module/config/tenantMode.d.ts +14 -0
  89. package/lib/typescript/module/connections/PowerPlatformConnectionApi.d.ts +5 -2
  90. package/lib/typescript/module/connections/connectionMetadata.d.ts +1 -1
  91. package/lib/typescript/module/connections/types.d.ts +7 -1
  92. package/lib/typescript/module/connections/useConnectionRefs.d.ts +11 -2
  93. package/lib/typescript/module/index.d.ts +7 -3
  94. package/lib/typescript/module/platform/CanvasAppResolution.d.ts +4 -0
  95. package/lib/typescript/module/platform/CanvasAppResolutionApi.d.ts +6 -0
  96. package/lib/typescript/module/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
  97. package/lib/typescript/module/platform/GlobalDiscovery.d.ts +12 -0
  98. package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +9 -1
  99. package/lib/typescript/module/provider/PowerAppsProvider.d.ts +14 -16
  100. package/lib/typescript/module/target/DefaultPowerAppsExperience.d.ts +6 -0
  101. package/lib/typescript/module/target/PowerAppsExperience.d.ts +61 -0
  102. package/lib/typescript/module/target/PowerAppsTargetBootstrap.d.ts +15 -0
  103. package/lib/typescript/module/target/errors.d.ts +13 -0
  104. package/lib/typescript/module/target/types.d.ts +34 -0
  105. package/lib/typescript/module/telemetry/index.d.ts +2 -2
  106. package/package.json +12 -5
  107. package/scripts/build-codegen-package.js +34 -3
  108. package/scripts/dev.js +405 -0
  109. package/scripts/upgrade-authoring.js +85 -28
  110. package/scripts/wrap.js +42 -5
  111. package/src/config/generated-config.d.ts +21 -0
@@ -0,0 +1,564 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DefaultPowerAppsExperience = DefaultPowerAppsExperience;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _vectorIcons = require("@expo/vector-icons");
10
+ var _tokens = require("../theme/tokens.js");
11
+ var _PowerAppsExperience = require("./PowerAppsExperience.js");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ function Action({
15
+ label,
16
+ icon,
17
+ onPress,
18
+ theme,
19
+ secondary = false
20
+ }) {
21
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
22
+ accessibilityRole: "button",
23
+ onPress: onPress,
24
+ style: ({
25
+ pressed
26
+ }) => [styles.action, {
27
+ backgroundColor: secondary ? theme.surface0 : theme.accentBase
28
+ }, secondary && {
29
+ borderColor: theme.surface4
30
+ }, pressed && styles.pressed],
31
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
32
+ name: icon,
33
+ size: 18,
34
+ color: secondary ? theme.text1 : theme.accentOnAccent
35
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
36
+ style: [styles.actionLabel, {
37
+ color: secondary ? theme.text0 : theme.accentOnAccent
38
+ }],
39
+ children: label
40
+ })]
41
+ });
42
+ }
43
+ function Frame({
44
+ appDisplayName,
45
+ eyebrow,
46
+ title,
47
+ children
48
+ }) {
49
+ const theme = (0, _reactNative.useColorScheme)() === 'dark' ? _tokens.darkTheme : _tokens.lightTheme;
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
51
+ style: [styles.background, {
52
+ backgroundColor: theme.surface1
53
+ }],
54
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
55
+ style: [styles.topBand, {
56
+ backgroundColor: theme.accentDeep
57
+ }]
58
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
59
+ style: [styles.sideBand, {
60
+ backgroundColor: theme.accentSoft
61
+ }]
62
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
63
+ style: styles.frame,
64
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
65
+ style: styles.brandRow,
66
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
67
+ style: [styles.brandMark, {
68
+ backgroundColor: theme.accentBase
69
+ }],
70
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
71
+ name: "grid",
72
+ size: 22,
73
+ color: theme.accentOnAccent
74
+ })
75
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
76
+ numberOfLines: 2,
77
+ style: [styles.brandName, {
78
+ color: theme.text0
79
+ }],
80
+ children: appDisplayName
81
+ })]
82
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
83
+ style: styles.content,
84
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
85
+ style: [styles.eyebrow, {
86
+ color: theme.accentDeep
87
+ }],
88
+ children: eyebrow
89
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
90
+ accessibilityRole: "header",
91
+ style: [styles.title, {
92
+ color: theme.text0
93
+ }],
94
+ children: title
95
+ }), children]
96
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
97
+ style: [styles.footer, {
98
+ color: theme.text2
99
+ }],
100
+ children: "Powered by Microsoft Power Apps"
101
+ })]
102
+ })]
103
+ });
104
+ }
105
+ function Status({
106
+ appDisplayName,
107
+ title,
108
+ message
109
+ }) {
110
+ const theme = (0, _reactNative.useColorScheme)() === 'dark' ? _tokens.darkTheme : _tokens.lightTheme;
111
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Frame, {
112
+ appDisplayName: appDisplayName,
113
+ eyebrow: "Getting things ready",
114
+ title: title,
115
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
116
+ style: styles.statusRow,
117
+ accessibilityRole: "progressbar",
118
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
119
+ color: theme.accentBase,
120
+ size: "small"
121
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
122
+ style: [styles.body, {
123
+ color: theme.text1
124
+ }],
125
+ children: message
126
+ })]
127
+ })
128
+ });
129
+ }
130
+ function Message({
131
+ children,
132
+ theme
133
+ }) {
134
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
135
+ style: [styles.body, {
136
+ color: theme.text1
137
+ }],
138
+ children: children
139
+ });
140
+ }
141
+ function DefaultPowerAppsExperience({
142
+ appDisplayName,
143
+ children
144
+ }) {
145
+ const experience = (0, _PowerAppsExperience.usePowerAppsExperience)();
146
+ const theme = (0, _reactNative.useColorScheme)() === 'dark' ? _tokens.darkTheme : _tokens.lightTheme;
147
+ switch (experience.status) {
148
+ case 'preparing':
149
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Status, {
150
+ appDisplayName: appDisplayName,
151
+ title: "Welcome",
152
+ message: "Preparing secure sign-in..."
153
+ });
154
+ case 'discovering':
155
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Status, {
156
+ appDisplayName: appDisplayName,
157
+ title: "Finding your workspace",
158
+ message: "Checking the environments available to your account..."
159
+ });
160
+ case 'connecting':
161
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Status, {
162
+ appDisplayName: appDisplayName,
163
+ title: `Opening ${experience.environment.label}`,
164
+ message: "Establishing a secure connection..."
165
+ });
166
+ case 'resolvingApp':
167
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Status, {
168
+ appDisplayName: appDisplayName,
169
+ title: "Almost there",
170
+ message: "Loading the app configuration..."
171
+ });
172
+ case 'signIn':
173
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Frame, {
174
+ appDisplayName: appDisplayName,
175
+ eyebrow: "Secure access",
176
+ title: "Sign in to continue",
177
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
178
+ theme: theme,
179
+ children: "Use your work or school account to find the environments available to you."
180
+ }), experience.error ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
181
+ style: [styles.notice, {
182
+ backgroundColor: theme.surface2,
183
+ borderColor: theme.surface4
184
+ }],
185
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
186
+ name: "alert-circle",
187
+ size: 18,
188
+ color: "#A4262C"
189
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
190
+ style: [styles.noticeText, {
191
+ color: theme.text0
192
+ }],
193
+ children: experience.error
194
+ })]
195
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
196
+ style: styles.actions,
197
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
198
+ label: "Sign in with Microsoft",
199
+ icon: "log-in",
200
+ onPress: () => {
201
+ void experience.signIn();
202
+ },
203
+ theme: theme
204
+ }), experience.goBack ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
205
+ label: "Choose another environment",
206
+ icon: "arrow-left",
207
+ onPress: experience.goBack,
208
+ theme: theme,
209
+ secondary: true
210
+ }) : null]
211
+ })]
212
+ });
213
+ case 'selectEnvironment':
214
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
215
+ style: [styles.background, {
216
+ backgroundColor: theme.surface1
217
+ }],
218
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
219
+ style: [styles.topBand, {
220
+ backgroundColor: theme.accentDeep
221
+ }]
222
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
223
+ contentContainerStyle: styles.scrollFrame,
224
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
225
+ style: styles.brandRow,
226
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
227
+ style: [styles.brandMark, {
228
+ backgroundColor: theme.accentBase
229
+ }],
230
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
231
+ name: "grid",
232
+ size: 22,
233
+ color: theme.accentOnAccent
234
+ })
235
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
236
+ numberOfLines: 2,
237
+ style: [styles.brandName, {
238
+ color: theme.text0
239
+ }],
240
+ children: appDisplayName
241
+ })]
242
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
243
+ style: styles.content,
244
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
245
+ style: [styles.eyebrow, {
246
+ color: theme.accentDeep
247
+ }],
248
+ children: "Your workspace"
249
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
250
+ accessibilityRole: "header",
251
+ style: [styles.title, {
252
+ color: theme.text0
253
+ }],
254
+ children: "Choose an environment"
255
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
256
+ theme: theme,
257
+ children: "Select where you want to open this app."
258
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
259
+ style: styles.environmentList,
260
+ children: experience.environments.map(environment => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
261
+ accessibilityRole: "button",
262
+ accessibilityLabel: `Open ${environment.label}`,
263
+ onPress: () => experience.selectEnvironment(environment.id),
264
+ style: ({
265
+ pressed
266
+ }) => [styles.environment, {
267
+ backgroundColor: theme.surface0,
268
+ borderColor: theme.surface3
269
+ }, pressed && {
270
+ backgroundColor: theme.surface2
271
+ }],
272
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
273
+ style: [styles.environmentIcon, {
274
+ backgroundColor: theme.accentSoft
275
+ }],
276
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
277
+ name: "briefcase",
278
+ size: 19,
279
+ color: theme.accentDeep
280
+ })
281
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
282
+ numberOfLines: 2,
283
+ style: [styles.environmentLabel, {
284
+ color: theme.text0
285
+ }],
286
+ children: environment.label
287
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
288
+ name: "chevron-right",
289
+ size: 20,
290
+ color: theme.text2
291
+ })]
292
+ }, environment.id))
293
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
294
+ label: "Sign out",
295
+ icon: "log-out",
296
+ onPress: () => {
297
+ void experience.signOut();
298
+ },
299
+ theme: theme,
300
+ secondary: true
301
+ })]
302
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
303
+ style: [styles.footer, {
304
+ color: theme.text2
305
+ }],
306
+ children: "Powered by Microsoft Power Apps"
307
+ })]
308
+ })]
309
+ });
310
+ case 'empty':
311
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Frame, {
312
+ appDisplayName: appDisplayName,
313
+ eyebrow: "No environments",
314
+ title: "Nothing available yet",
315
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
316
+ style: [styles.stateIcon, {
317
+ backgroundColor: theme.accentSoft
318
+ }],
319
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
320
+ name: "inbox",
321
+ size: 26,
322
+ color: theme.accentDeep
323
+ })
324
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
325
+ theme: theme,
326
+ children: "We could not find a Dataverse environment that contains this app."
327
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
328
+ style: styles.actions,
329
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
330
+ label: "Try again",
331
+ icon: "refresh-cw",
332
+ onPress: experience.retry,
333
+ theme: theme
334
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
335
+ label: "Use another account",
336
+ icon: "user",
337
+ onPress: () => {
338
+ void experience.signOut();
339
+ },
340
+ theme: theme,
341
+ secondary: true
342
+ })]
343
+ })]
344
+ });
345
+ case 'error':
346
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Frame, {
347
+ appDisplayName: appDisplayName,
348
+ eyebrow: "We hit a problem",
349
+ title: "Unable to continue",
350
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
351
+ style: [styles.stateIcon, {
352
+ backgroundColor: theme.surface2
353
+ }],
354
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.Feather, {
355
+ name: "alert-triangle",
356
+ size: 26,
357
+ color: "#A4262C"
358
+ })
359
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Message, {
360
+ theme: theme,
361
+ children: experience.error.message
362
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
363
+ style: styles.actions,
364
+ children: [experience.retry ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
365
+ label: "Try again",
366
+ icon: "refresh-cw",
367
+ onPress: experience.retry,
368
+ theme: theme
369
+ }) : null, experience.goBack ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
370
+ label: "Choose another environment",
371
+ icon: "arrow-left",
372
+ onPress: experience.goBack,
373
+ theme: theme,
374
+ secondary: true
375
+ }) : null, experience.signOut ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Action, {
376
+ label: "Use another account",
377
+ icon: "user",
378
+ onPress: () => {
379
+ void experience.signOut?.();
380
+ },
381
+ theme: theme,
382
+ secondary: true
383
+ }) : null]
384
+ })]
385
+ });
386
+ case 'ready':
387
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PowerAppsExperience.PowerAppsRuntimeGate, {
388
+ children: children
389
+ });
390
+ }
391
+ }
392
+ const styles = _reactNative.StyleSheet.create({
393
+ background: {
394
+ flex: 1,
395
+ overflow: 'hidden'
396
+ },
397
+ topBand: {
398
+ position: 'absolute',
399
+ top: 0,
400
+ right: 0,
401
+ left: 0,
402
+ height: 8
403
+ },
404
+ sideBand: {
405
+ position: 'absolute',
406
+ top: 80,
407
+ right: -24,
408
+ width: 72,
409
+ height: 220,
410
+ transform: [{
411
+ rotate: '8deg'
412
+ }]
413
+ },
414
+ frame: {
415
+ flex: 1,
416
+ width: '100%',
417
+ maxWidth: 560,
418
+ alignSelf: 'center',
419
+ justifyContent: 'space-between',
420
+ paddingTop: 54,
421
+ paddingRight: 28,
422
+ paddingBottom: 28,
423
+ paddingLeft: 28
424
+ },
425
+ scrollFrame: {
426
+ flexGrow: 1,
427
+ width: '100%',
428
+ maxWidth: 560,
429
+ alignSelf: 'center',
430
+ justifyContent: 'space-between',
431
+ paddingTop: 54,
432
+ paddingRight: 28,
433
+ paddingBottom: 28,
434
+ paddingLeft: 28
435
+ },
436
+ brandRow: {
437
+ minHeight: 48,
438
+ flexDirection: 'row',
439
+ alignItems: 'center',
440
+ gap: 12
441
+ },
442
+ brandMark: {
443
+ width: 44,
444
+ height: 44,
445
+ borderRadius: 8,
446
+ alignItems: 'center',
447
+ justifyContent: 'center'
448
+ },
449
+ brandName: {
450
+ flex: 1,
451
+ fontSize: 17,
452
+ lineHeight: 22,
453
+ fontWeight: '700'
454
+ },
455
+ content: {
456
+ width: '100%',
457
+ gap: 18,
458
+ paddingVertical: 40
459
+ },
460
+ eyebrow: {
461
+ fontSize: 13,
462
+ lineHeight: 18,
463
+ fontWeight: '700',
464
+ textTransform: 'uppercase'
465
+ },
466
+ title: {
467
+ maxWidth: 470,
468
+ fontSize: 30,
469
+ lineHeight: 38,
470
+ fontWeight: '700'
471
+ },
472
+ body: {
473
+ maxWidth: 460,
474
+ fontSize: 16,
475
+ lineHeight: 24
476
+ },
477
+ statusRow: {
478
+ minHeight: 48,
479
+ flexDirection: 'row',
480
+ alignItems: 'center',
481
+ gap: 14
482
+ },
483
+ actions: {
484
+ width: '100%',
485
+ maxWidth: 380,
486
+ gap: 10,
487
+ paddingTop: 4
488
+ },
489
+ action: {
490
+ minHeight: 52,
491
+ width: '100%',
492
+ borderWidth: 1,
493
+ borderColor: 'transparent',
494
+ borderRadius: 6,
495
+ flexDirection: 'row',
496
+ alignItems: 'center',
497
+ justifyContent: 'center',
498
+ gap: 10,
499
+ paddingHorizontal: 18
500
+ },
501
+ actionLabel: {
502
+ flexShrink: 1,
503
+ fontSize: 16,
504
+ lineHeight: 21,
505
+ fontWeight: '600',
506
+ textAlign: 'center'
507
+ },
508
+ pressed: {
509
+ opacity: 0.78
510
+ },
511
+ notice: {
512
+ maxWidth: 460,
513
+ borderWidth: 1,
514
+ borderRadius: 6,
515
+ flexDirection: 'row',
516
+ alignItems: 'flex-start',
517
+ gap: 10,
518
+ padding: 14
519
+ },
520
+ noticeText: {
521
+ flex: 1,
522
+ fontSize: 14,
523
+ lineHeight: 20
524
+ },
525
+ environmentList: {
526
+ width: '100%',
527
+ gap: 10,
528
+ paddingTop: 4
529
+ },
530
+ environment: {
531
+ minHeight: 64,
532
+ borderWidth: 1,
533
+ borderRadius: 6,
534
+ flexDirection: 'row',
535
+ alignItems: 'center',
536
+ gap: 12,
537
+ paddingHorizontal: 14,
538
+ paddingVertical: 10
539
+ },
540
+ environmentIcon: {
541
+ width: 38,
542
+ height: 38,
543
+ borderRadius: 6,
544
+ alignItems: 'center',
545
+ justifyContent: 'center'
546
+ },
547
+ environmentLabel: {
548
+ flex: 1,
549
+ fontSize: 16,
550
+ lineHeight: 22,
551
+ fontWeight: '600'
552
+ },
553
+ stateIcon: {
554
+ width: 52,
555
+ height: 52,
556
+ borderRadius: 8,
557
+ alignItems: 'center',
558
+ justifyContent: 'center'
559
+ },
560
+ footer: {
561
+ fontSize: 12,
562
+ lineHeight: 18
563
+ }
564
+ });
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PowerAppsExperienceBoundary = PowerAppsExperienceBoundary;
7
+ exports.PowerAppsRuntimeGate = PowerAppsRuntimeGate;
8
+ exports.usePowerAppsExperience = usePowerAppsExperience;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ const PowerAppsExperienceContext = /*#__PURE__*/(0, _react.createContext)(undefined);
13
+ function usePowerAppsExperience() {
14
+ const experience = (0, _react.useContext)(PowerAppsExperienceContext);
15
+ if (!experience) {
16
+ throw new Error('usePowerAppsExperience must be used by a multi-tenant experience component.');
17
+ }
18
+ return experience;
19
+ }
20
+ function PowerAppsRuntimeGate({
21
+ children
22
+ }) {
23
+ return usePowerAppsExperience().status === 'ready' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
24
+ children: children
25
+ }) : null;
26
+ }
27
+ function PowerAppsExperienceBoundary({
28
+ experience,
29
+ appDisplayName,
30
+ component: Component,
31
+ children,
32
+ fallback
33
+ }) {
34
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(PowerAppsExperienceContext.Provider, {
35
+ value: experience,
36
+ children: Component ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
37
+ appDisplayName: appDisplayName,
38
+ children: children
39
+ }) : fallback
40
+ });
41
+ }