@apvee/spfx-react-toolkit 1.3.0 → 2.0.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.
- package/lib/core/atoms.internal.js +1 -1
- package/lib/core/atoms.internal.js.map +1 -1
- package/lib/core/context.internal.js +2 -2
- package/lib/core/context.internal.js.map +1 -1
- package/lib/core/provider-base.internal.js +29 -29
- package/lib/core/provider-base.internal.js.map +1 -1
- package/lib/extensions/spFxReactToolkitTest/SpFxReactToolkitTestApplicationCustomizer.js +8 -29
- package/lib/extensions/spFxReactToolkitTest/SpFxReactToolkitTestApplicationCustomizer.js.map +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useAppCatalogUrl.internal.d.ts +26 -0
- package/lib/hooks/useAppCatalogUrl.internal.d.ts.map +1 -0
- package/lib/hooks/useAppCatalogUrl.internal.js +72 -0
- package/lib/hooks/useAppCatalogUrl.internal.js.map +1 -0
- package/lib/hooks/useAsyncInvoke.internal.js +27 -75
- package/lib/hooks/useAsyncInvoke.internal.js.map +1 -1
- package/lib/hooks/useSPFxAadHttpClient.js +27 -27
- package/lib/hooks/useSPFxAadHttpClient.js.map +1 -1
- package/lib/hooks/useSPFxContainerInfo.js +5 -5
- package/lib/hooks/useSPFxContainerInfo.js.map +1 -1
- package/lib/hooks/useSPFxContainerSize.js +9 -10
- package/lib/hooks/useSPFxContainerSize.js.map +1 -1
- package/lib/hooks/useSPFxCorrelationInfo.js +6 -7
- package/lib/hooks/useSPFxCorrelationInfo.js.map +1 -1
- package/lib/hooks/useSPFxCrossSitePermissions.js +48 -58
- package/lib/hooks/useSPFxCrossSitePermissions.js.map +1 -1
- package/lib/hooks/useSPFxDisplayMode.js +8 -8
- package/lib/hooks/useSPFxDisplayMode.js.map +1 -1
- package/lib/hooks/useSPFxEnvironmentInfo.js +17 -18
- package/lib/hooks/useSPFxEnvironmentInfo.js.map +1 -1
- package/lib/hooks/useSPFxFluent9ThemeInfo.js +4 -4
- package/lib/hooks/useSPFxFluent9ThemeInfo.js.map +1 -1
- package/lib/hooks/useSPFxHttpClient.js +10 -10
- package/lib/hooks/useSPFxHttpClient.js.map +1 -1
- package/lib/hooks/useSPFxHubSiteInfo.js +21 -24
- package/lib/hooks/useSPFxHubSiteInfo.js.map +1 -1
- package/lib/hooks/useSPFxInstanceInfo.js +2 -2
- package/lib/hooks/useSPFxInstanceInfo.js.map +1 -1
- package/lib/hooks/useSPFxListInfo.js +8 -9
- package/lib/hooks/useSPFxListInfo.js.map +1 -1
- package/lib/hooks/useSPFxLocaleInfo.js +10 -10
- package/lib/hooks/useSPFxLocaleInfo.js.map +1 -1
- package/lib/hooks/useSPFxLogger.js +26 -26
- package/lib/hooks/useSPFxLogger.js.map +1 -1
- package/lib/hooks/useSPFxMSGraphClient.js +25 -25
- package/lib/hooks/useSPFxMSGraphClient.js.map +1 -1
- package/lib/hooks/useSPFxOneDriveAppData.js +148 -209
- package/lib/hooks/useSPFxOneDriveAppData.js.map +1 -1
- package/lib/hooks/useSPFxPageContext.js +2 -2
- package/lib/hooks/useSPFxPageContext.js.map +1 -1
- package/lib/hooks/useSPFxPageType.js +19 -20
- package/lib/hooks/useSPFxPageType.js.map +1 -1
- package/lib/hooks/useSPFxPerformance.js +33 -87
- package/lib/hooks/useSPFxPerformance.js.map +1 -1
- package/lib/hooks/useSPFxPermissions.js +14 -15
- package/lib/hooks/useSPFxPermissions.js.map +1 -1
- package/lib/hooks/useSPFxPnP.js +62 -119
- package/lib/hooks/useSPFxPnP.js.map +1 -1
- package/lib/hooks/useSPFxPnPContext.js +22 -25
- package/lib/hooks/useSPFxPnPContext.js.map +1 -1
- package/lib/hooks/useSPFxPnPList.js +307 -451
- package/lib/hooks/useSPFxPnPList.js.map +1 -1
- package/lib/hooks/useSPFxPnPSearch.js +262 -353
- package/lib/hooks/useSPFxPnPSearch.js.map +1 -1
- package/lib/hooks/useSPFxProperties.js +12 -20
- package/lib/hooks/useSPFxProperties.js.map +1 -1
- package/lib/hooks/useSPFxSPHttpClient.js +19 -19
- package/lib/hooks/useSPFxSPHttpClient.js.map +1 -1
- package/lib/hooks/useSPFxServiceScope.js +6 -6
- package/lib/hooks/useSPFxServiceScope.js.map +1 -1
- package/lib/hooks/useSPFxSiteInfo.js +7 -8
- package/lib/hooks/useSPFxSiteInfo.js.map +1 -1
- package/lib/hooks/useSPFxStorage.js +22 -22
- package/lib/hooks/useSPFxStorage.js.map +1 -1
- package/lib/hooks/useSPFxTeams.js +37 -92
- package/lib/hooks/useSPFxTeams.js.map +1 -1
- package/lib/hooks/useSPFxTenantKeyValueStore.d.ts +252 -0
- package/lib/hooks/useSPFxTenantKeyValueStore.d.ts.map +1 -0
- package/lib/hooks/useSPFxTenantKeyValueStore.js +572 -0
- package/lib/hooks/useSPFxTenantKeyValueStore.js.map +1 -0
- package/lib/hooks/useSPFxTenantProperty.d.ts +23 -244
- package/lib/hooks/useSPFxTenantProperty.d.ts.map +1 -1
- package/lib/hooks/useSPFxTenantProperty.js +85 -559
- package/lib/hooks/useSPFxTenantProperty.js.map +1 -1
- package/lib/hooks/useSPFxUserInfo.js +3 -4
- package/lib/hooks/useSPFxUserInfo.js.map +1 -1
- package/lib/hooks/useSPFxUserPhoto.js +76 -123
- package/lib/hooks/useSPFxUserPhoto.js.map +1 -1
- package/lib/utils/resize-observer.internal.js +6 -7
- package/lib/utils/resize-observer.internal.js.map +1 -1
- package/lib/utils/theme-subscription.internal.js +8 -8
- package/lib/utils/theme-subscription.internal.js.map +1 -1
- package/lib/utils/type-guards.internal.js +6 -6
- package/lib/utils/type-guards.internal.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/SpFxReactToolkitTestWebPart.js +12 -37
- package/lib/webparts/spFxReactToolkitTest/SpFxReactToolkitTestWebPart.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.d.ts.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.js +277 -336
- package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.module.scss.js +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.module.scss.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/HttpClientDemo.js +26 -86
- package/lib/webparts/spFxReactToolkitTest/components/demos/HttpClientDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPContextDemo.js +53 -113
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPContextDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPListDemo.js +49 -121
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPListDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPOperationsDemo.js +44 -103
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPOperationsDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchAdvancedDemo.js +15 -15
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchAdvancedDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchBasicDemo.js +18 -66
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchBasicDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchRefinersDemo.js +9 -9
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchRefinersDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchSuggestionsDemo.js +37 -86
- package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchSuggestionsDemo.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/shared/InfoRow.js +6 -9
- package/lib/webparts/spFxReactToolkitTest/components/shared/InfoRow.js.map +1 -1
- package/lib/webparts/spFxReactToolkitTest/components/shared/StatusBadge.js +3 -6
- package/lib/webparts/spFxReactToolkitTest/components/shared/StatusBadge.js.map +1 -1
- package/package.json +1 -1
|
@@ -19,27 +19,12 @@ export interface SPFxTenantPropertyResult<T> {
|
|
|
19
19
|
readonly isLoading: boolean;
|
|
20
20
|
/**
|
|
21
21
|
* Last error from read operations.
|
|
22
|
-
* Cleared on successful load
|
|
22
|
+
* Cleared on successful load.
|
|
23
23
|
*/
|
|
24
24
|
readonly error: Error | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Loading state for write operations.
|
|
27
|
-
* True during write() calls.
|
|
28
|
-
*/
|
|
29
|
-
readonly isWriting: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Last error from write operations.
|
|
32
|
-
* Cleared on successful write or load.
|
|
33
|
-
*/
|
|
34
|
-
readonly writeError: Error | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Whether the current user has permission to write tenant properties.
|
|
37
|
-
* False if user lacks Manage Web permissions on tenant app catalog.
|
|
38
|
-
*/
|
|
39
|
-
readonly canWrite: boolean;
|
|
40
25
|
/**
|
|
41
26
|
* Manually load/reload the property from tenant app catalog.
|
|
42
|
-
* Updates data, description,
|
|
27
|
+
* Updates data, description, isLoading, and error states.
|
|
43
28
|
*
|
|
44
29
|
* @returns Promise that resolves when load completes
|
|
45
30
|
*
|
|
@@ -52,48 +37,6 @@ export interface SPFxTenantPropertyResult<T> {
|
|
|
52
37
|
* ```
|
|
53
38
|
*/
|
|
54
39
|
readonly load: () => Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* Write property to tenant app catalog.
|
|
57
|
-
* Creates property if it doesn't exist, updates if it does.
|
|
58
|
-
* Updates isWriting and writeError states.
|
|
59
|
-
*
|
|
60
|
-
* Smart serialization:
|
|
61
|
-
* - Primitives (string, number, boolean, null, bigint) → String(content)
|
|
62
|
-
* - Date objects → ISO string
|
|
63
|
-
* - Objects/arrays → JSON.stringify(content)
|
|
64
|
-
*
|
|
65
|
-
* @param content - Data to write
|
|
66
|
-
* @param description - Optional description metadata (SharePoint only supports description, not comment)
|
|
67
|
-
* @returns Promise that resolves when write completes
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```tsx
|
|
71
|
-
* const { write, isWriting } = useSPFxTenantProperty<string>('apiEndpoint');
|
|
72
|
-
*
|
|
73
|
-
* const handleSave = async () => {
|
|
74
|
-
* await write('https://api.example.com', 'Production API endpoint');
|
|
75
|
-
* };
|
|
76
|
-
* ```
|
|
77
|
-
*/
|
|
78
|
-
readonly write: (content: T, description?: string) => Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Remove property from tenant app catalog.
|
|
81
|
-
* Requires Manage Web permissions.
|
|
82
|
-
*
|
|
83
|
-
* @returns Promise that resolves when removal completes
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* ```tsx
|
|
87
|
-
* const { remove } = useSPFxTenantProperty<string>('oldSetting');
|
|
88
|
-
*
|
|
89
|
-
* const handleDelete = async () => {
|
|
90
|
-
* if (confirm('Delete this property?')) {
|
|
91
|
-
* await remove();
|
|
92
|
-
* }
|
|
93
|
-
* };
|
|
94
|
-
* ```
|
|
95
|
-
*/
|
|
96
|
-
readonly remove: () => Promise<void>;
|
|
97
40
|
/**
|
|
98
41
|
* Computed state: true if data is loaded successfully.
|
|
99
42
|
* Equivalent to: !isLoading && !error && data !== undefined
|
|
@@ -107,111 +50,48 @@ export interface SPFxTenantPropertyResult<T> {
|
|
|
107
50
|
readonly isReady: boolean;
|
|
108
51
|
}
|
|
109
52
|
/**
|
|
110
|
-
* Hook to
|
|
53
|
+
* Hook to read tenant-wide properties using SharePoint StorageEntity API (read-only)
|
|
111
54
|
*
|
|
112
|
-
* Provides read
|
|
113
|
-
*
|
|
114
|
-
*
|
|
55
|
+
* Provides read access to tenant-scoped properties stored in the SharePoint tenant
|
|
56
|
+
* app catalog. Properties are accessible across all sites in the tenant.
|
|
57
|
+
*
|
|
58
|
+
* **Note:** Write and remove operations have been removed because Microsoft has
|
|
59
|
+
* blocked the SetStorageEntity and RemoveStorageEntity REST API endpoints.
|
|
60
|
+
* Tenant properties can only be managed via PowerShell (Set-PnPStorageEntity,
|
|
61
|
+
* Remove-PnPStorageEntity) or the SharePoint Management Shell.
|
|
62
|
+
* For a read/write key-value store at tenant level, use `useSPFxTenantKeyValueStore`.
|
|
115
63
|
*
|
|
116
64
|
* Features:
|
|
117
65
|
* - Tenant-wide centralized storage (not site-specific)
|
|
118
|
-
* - Smart
|
|
119
|
-
* - Permission checking (canWrite flag)
|
|
66
|
+
* - Smart deserialization for primitives and complex objects
|
|
120
67
|
* - Optional metadata (description only - SharePoint limitation)
|
|
121
68
|
* - Type-safe with TypeScript generics
|
|
122
69
|
* - Memory leak safe with mounted state tracking
|
|
123
70
|
* - Automatic app catalog URL discovery
|
|
124
|
-
* - Remove operation for cleanup
|
|
125
71
|
*
|
|
126
72
|
* Requirements:
|
|
127
73
|
* - Tenant app catalog must be provisioned
|
|
128
|
-
* -
|
|
129
|
-
* - Write/Remove: Site Collection Administrator role on tenant app catalog site
|
|
130
|
-
*
|
|
131
|
-
* Permission Notes:
|
|
132
|
-
* - Being a Tenant Admin is NOT sufficient for write operations
|
|
133
|
-
* - You must be explicitly added as Site Collection Administrator to the tenant app catalog
|
|
134
|
-
* - Navigate to the app catalog site → Site Settings → Site Collection Administrators
|
|
135
|
-
* - Add your user account if write operations fail with permission errors
|
|
136
|
-
*
|
|
137
|
-
* Storage Format:
|
|
138
|
-
* - Primitives (string, number, boolean, null) → stored as string
|
|
139
|
-
* - Date → stored as ISO 8601 string
|
|
140
|
-
* - Objects/arrays → stored as JSON string
|
|
74
|
+
* - Any authenticated user can read tenant properties
|
|
141
75
|
*
|
|
142
76
|
* @param key - Unique property key (e.g., 'appVersion', 'apiEndpoint', 'featureFlags')
|
|
143
77
|
* @param autoFetch - Whether to automatically load property on mount. Default: true
|
|
144
78
|
*
|
|
145
|
-
* @returns Object with data, metadata, loading
|
|
79
|
+
* @returns Object with data, metadata, loading state, error state, and load function
|
|
146
80
|
*
|
|
147
81
|
* @example Basic usage - string property
|
|
148
82
|
* ```tsx
|
|
149
83
|
* function VersionDisplay() {
|
|
150
|
-
* const { data, isLoading, error
|
|
151
|
-
* useSPFxTenantProperty<string>('appVersion');
|
|
84
|
+
* const { data, isLoading, error } = useSPFxTenantProperty<string>('appVersion');
|
|
152
85
|
*
|
|
153
86
|
* if (isLoading) return <Spinner label="Loading version..." />;
|
|
154
87
|
* if (error) return <MessageBar messageBarType={MessageBarType.error}>
|
|
155
88
|
* Failed to load: {error.message}
|
|
156
89
|
* </MessageBar>;
|
|
157
90
|
*
|
|
158
|
-
*
|
|
159
|
-
* if (!canWrite) {
|
|
160
|
-
* alert('Insufficient permissions');
|
|
161
|
-
* return;
|
|
162
|
-
* }
|
|
163
|
-
*
|
|
164
|
-
* try {
|
|
165
|
-
* await write('2.0.1', 'Current application version');
|
|
166
|
-
* console.log('Version updated!');
|
|
167
|
-
* } catch (err) {
|
|
168
|
-
* console.error('Update failed:', err);
|
|
169
|
-
* }
|
|
170
|
-
* };
|
|
171
|
-
*
|
|
172
|
-
* return (
|
|
173
|
-
* <div>
|
|
174
|
-
* <Text>Current Version: {data ?? 'Not Set'}</Text>
|
|
175
|
-
* {canWrite && <PrimaryButton onClick={handleUpdate}>Update Version</PrimaryButton>}
|
|
176
|
-
* </div>
|
|
177
|
-
* );
|
|
178
|
-
* }
|
|
179
|
-
* ```
|
|
180
|
-
*
|
|
181
|
-
* @example Number property
|
|
182
|
-
* ```tsx
|
|
183
|
-
* const { data, write } = useSPFxTenantProperty<number>('maxUploadSize');
|
|
184
|
-
*
|
|
185
|
-
* // Stored as "10485760" (10MB in bytes)
|
|
186
|
-
* await write(10485760, 'Maximum file upload size in bytes');
|
|
187
|
-
*
|
|
188
|
-
* // Read returns: 10485760 (number)
|
|
189
|
-
* console.log(typeof data); // "number"
|
|
190
|
-
* ```
|
|
191
|
-
*
|
|
192
|
-
* @example Boolean flag
|
|
193
|
-
* ```tsx
|
|
194
|
-
* const { data: maintenanceMode, write } = useSPFxTenantProperty<boolean>('maintenanceMode');
|
|
195
|
-
*
|
|
196
|
-
* // Stored as "true" or "false"
|
|
197
|
-
* await write(true, 'Maintenance mode enabled');
|
|
198
|
-
*
|
|
199
|
-
* if (maintenanceMode) {
|
|
200
|
-
* return <MessageBar>System is under maintenance</MessageBar>;
|
|
91
|
+
* return <Text>Current Version: {data ?? 'Not Set'}</Text>;
|
|
201
92
|
* }
|
|
202
93
|
* ```
|
|
203
94
|
*
|
|
204
|
-
* @example Date property
|
|
205
|
-
* ```tsx
|
|
206
|
-
* const { data, write } = useSPFxTenantProperty<string>('lastDeployment');
|
|
207
|
-
*
|
|
208
|
-
* // Write date as ISO string
|
|
209
|
-
* await write(new Date().toISOString(), 'Last deployment timestamp');
|
|
210
|
-
*
|
|
211
|
-
* // Read and convert back to Date
|
|
212
|
-
* const lastDeploy = data ? new Date(data) : undefined;
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
95
|
* @example Complex object with JSON
|
|
216
96
|
* ```tsx
|
|
217
97
|
* interface FeatureFlags {
|
|
@@ -220,74 +100,14 @@ export interface SPFxTenantPropertyResult<T> {
|
|
|
220
100
|
* maxUsers: number;
|
|
221
101
|
* }
|
|
222
102
|
*
|
|
223
|
-
* const { data,
|
|
224
|
-
*
|
|
225
|
-
* // Stored as JSON string
|
|
226
|
-
* await write({
|
|
227
|
-
* enableChat: true,
|
|
228
|
-
* enableAnalytics: false,
|
|
229
|
-
* maxUsers: 1000
|
|
230
|
-
* }, 'Global feature flags configuration');
|
|
103
|
+
* const { data, isLoading } = useSPFxTenantProperty<FeatureFlags>('featureFlags');
|
|
231
104
|
*
|
|
232
|
-
* //
|
|
105
|
+
* // Returns parsed object (stored as JSON string via PowerShell)
|
|
233
106
|
* if (data?.enableChat) {
|
|
234
107
|
* return <ChatPanel />;
|
|
235
108
|
* }
|
|
236
109
|
* ```
|
|
237
110
|
*
|
|
238
|
-
* @example Permission-aware UI
|
|
239
|
-
* ```tsx
|
|
240
|
-
* function TenantConfigPanel() {
|
|
241
|
-
* const { data, canWrite, write, isWriting, error, writeError } =
|
|
242
|
-
* useSPFxTenantProperty<string>('apiEndpoint');
|
|
243
|
-
*
|
|
244
|
-
* const [editValue, setEditValue] = React.useState(data ?? '');
|
|
245
|
-
*
|
|
246
|
-
* React.useEffect(() => {
|
|
247
|
-
* setEditValue(data ?? '');
|
|
248
|
-
* }, [data]);
|
|
249
|
-
*
|
|
250
|
-
* if (!canWrite) {
|
|
251
|
-
* return (
|
|
252
|
-
* <MessageBar messageBarType={MessageBarType.info}>
|
|
253
|
-
* You don't have permission to edit tenant properties.
|
|
254
|
-
* Contact your SharePoint administrator.
|
|
255
|
-
* </MessageBar>
|
|
256
|
-
* );
|
|
257
|
-
* }
|
|
258
|
-
*
|
|
259
|
-
* const handleSave = async () => {
|
|
260
|
-
* try {
|
|
261
|
-
* await write(editValue, 'Production API endpoint URL');
|
|
262
|
-
* } catch (err) {
|
|
263
|
-
* console.error('Save failed:', err);
|
|
264
|
-
* }
|
|
265
|
-
* };
|
|
266
|
-
*
|
|
267
|
-
* return (
|
|
268
|
-
* <Stack tokens={{ childrenGap: 10 }}>
|
|
269
|
-
* <TextField
|
|
270
|
-
* label="API Endpoint"
|
|
271
|
-
* value={editValue}
|
|
272
|
-
* onChange={(_, val) => setEditValue(val ?? '')}
|
|
273
|
-
* disabled={isWriting}
|
|
274
|
-
* />
|
|
275
|
-
* <PrimaryButton
|
|
276
|
-
* onClick={handleSave}
|
|
277
|
-
* disabled={isWriting || editValue === data}
|
|
278
|
-
* >
|
|
279
|
-
* {isWriting ? 'Saving...' : 'Save'}
|
|
280
|
-
* </PrimaryButton>
|
|
281
|
-
* {writeError && (
|
|
282
|
-
* <MessageBar messageBarType={MessageBarType.error}>
|
|
283
|
-
* {writeError.message}
|
|
284
|
-
* </MessageBar>
|
|
285
|
-
* )}
|
|
286
|
-
* </Stack>
|
|
287
|
-
* );
|
|
288
|
-
* }
|
|
289
|
-
* ```
|
|
290
|
-
*
|
|
291
111
|
* @example With metadata viewing
|
|
292
112
|
* ```tsx
|
|
293
113
|
* function PropertyViewer() {
|
|
@@ -307,7 +127,7 @@ export interface SPFxTenantPropertyResult<T> {
|
|
|
307
127
|
*
|
|
308
128
|
* @example Lazy loading with manual trigger
|
|
309
129
|
* ```tsx
|
|
310
|
-
* const { data, load, isLoading
|
|
130
|
+
* const { data, load, isLoading } = useSPFxTenantProperty<Config>(
|
|
311
131
|
* 'appConfig',
|
|
312
132
|
* false // Don't auto-fetch
|
|
313
133
|
* );
|
|
@@ -322,64 +142,23 @@ export interface SPFxTenantPropertyResult<T> {
|
|
|
322
142
|
* );
|
|
323
143
|
* ```
|
|
324
144
|
*
|
|
325
|
-
* @example Property removal
|
|
326
|
-
* ```tsx
|
|
327
|
-
* function PropertyManager() {
|
|
328
|
-
* const { data, remove, canWrite } = useSPFxTenantProperty<string>('deprecatedSetting');
|
|
329
|
-
*
|
|
330
|
-
* const handleDelete = async () => {
|
|
331
|
-
* if (!confirm('Delete this property? This cannot be undone.')) return;
|
|
332
|
-
*
|
|
333
|
-
* try {
|
|
334
|
-
* await remove();
|
|
335
|
-
* console.log('Property deleted');
|
|
336
|
-
* } catch (err) {
|
|
337
|
-
* console.error('Delete failed:', err);
|
|
338
|
-
* }
|
|
339
|
-
* };
|
|
340
|
-
*
|
|
341
|
-
* if (!data) return <Text>Property not found</Text>;
|
|
342
|
-
*
|
|
343
|
-
* return (
|
|
344
|
-
* <Stack tokens={{ childrenGap: 10 }}>
|
|
345
|
-
* <Text>Value: {data}</Text>
|
|
346
|
-
* {canWrite && (
|
|
347
|
-
* <DefaultButton onClick={handleDelete} text="Delete Property" />
|
|
348
|
-
* )}
|
|
349
|
-
* </Stack>
|
|
350
|
-
* );
|
|
351
|
-
* }
|
|
352
|
-
* ```
|
|
353
|
-
*
|
|
354
145
|
* @example Multi-property dashboard
|
|
355
146
|
* ```tsx
|
|
356
147
|
* function TenantDashboard() {
|
|
357
148
|
* const version = useSPFxTenantProperty<string>('appVersion');
|
|
358
149
|
* const maintenance = useSPFxTenantProperty<boolean>('maintenanceMode');
|
|
359
|
-
* const lastUpdate = useSPFxTenantProperty<string>('lastUpdate');
|
|
360
150
|
* const config = useSPFxTenantProperty<AppConfig>('appConfig');
|
|
361
151
|
*
|
|
362
|
-
* const isLoading = version.isLoading || maintenance.isLoading ||
|
|
363
|
-
* lastUpdate.isLoading || config.isLoading;
|
|
152
|
+
* const isLoading = version.isLoading || maintenance.isLoading || config.isLoading;
|
|
364
153
|
*
|
|
365
154
|
* if (isLoading) return <Spinner label="Loading dashboard..." />;
|
|
366
155
|
*
|
|
367
156
|
* return (
|
|
368
157
|
* <Stack tokens={{ childrenGap: 20 }}>
|
|
369
158
|
* <Text variant="xxLarge">Tenant Configuration</Text>
|
|
370
|
-
*
|
|
371
|
-
* <
|
|
372
|
-
*
|
|
373
|
-
* <Label>Maintenance Mode: {maintenance.data ? 'ON' : 'OFF'}</Label>
|
|
374
|
-
* <Label>Last Update: {lastUpdate.data ? new Date(lastUpdate.data).toLocaleString() : 'Never'}</Label>
|
|
375
|
-
* </Stack>
|
|
376
|
-
*
|
|
377
|
-
* {config.data && (
|
|
378
|
-
* <Stack tokens={{ childrenGap: 5 }}>
|
|
379
|
-
* <Text variant="large">Configuration</Text>
|
|
380
|
-
* <pre>{JSON.stringify(config.data, null, 2)}</pre>
|
|
381
|
-
* </Stack>
|
|
382
|
-
* )}
|
|
159
|
+
* <Label>App Version: {version.data ?? 'Not Set'}</Label>
|
|
160
|
+
* <Label>Maintenance Mode: {maintenance.data ? 'ON' : 'OFF'}</Label>
|
|
161
|
+
* {config.data && <pre>{JSON.stringify(config.data, null, 2)}</pre>}
|
|
383
162
|
* </Stack>
|
|
384
163
|
* );
|
|
385
164
|
* }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSPFxTenantProperty.d.ts","sourceRoot":"","sources":["../../src/hooks/useSPFxTenantProperty.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSPFxTenantProperty.d.ts","sourceRoot":"","sources":["../../src/hooks/useSPFxTenantProperty.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IAElC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkHG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,OAAO,EAC/C,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,OAAc,GACxB,wBAAwB,CAAC,CAAC,CAAC,CAmG7B"}
|