@apvee/spfx-react-toolkit 1.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.
Files changed (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2012 -0
  3. package/lib/core/atoms.internal.d.ts +53 -0
  4. package/lib/core/atoms.internal.d.ts.map +1 -0
  5. package/lib/core/atoms.internal.js +35 -0
  6. package/lib/core/atoms.internal.js.map +1 -0
  7. package/lib/core/context.internal.d.ts +23 -0
  8. package/lib/core/context.internal.d.ts.map +1 -0
  9. package/lib/core/context.internal.js +34 -0
  10. package/lib/core/context.internal.js.map +1 -0
  11. package/lib/core/index.d.ts +6 -0
  12. package/lib/core/index.d.ts.map +1 -0
  13. package/lib/core/index.js +6 -0
  14. package/lib/core/index.js.map +1 -0
  15. package/lib/core/provider-application-customizer.d.ts +57 -0
  16. package/lib/core/provider-application-customizer.d.ts.map +1 -0
  17. package/lib/core/provider-application-customizer.js +45 -0
  18. package/lib/core/provider-application-customizer.js.map +1 -0
  19. package/lib/core/provider-base.internal.d.ts +20 -0
  20. package/lib/core/provider-base.internal.d.ts.map +1 -0
  21. package/lib/core/provider-base.internal.js +126 -0
  22. package/lib/core/provider-base.internal.js.map +1 -0
  23. package/lib/core/provider-field-customizer.d.ts +58 -0
  24. package/lib/core/provider-field-customizer.d.ts.map +1 -0
  25. package/lib/core/provider-field-customizer.js +46 -0
  26. package/lib/core/provider-field-customizer.js.map +1 -0
  27. package/lib/core/provider-listview-commandset.d.ts +60 -0
  28. package/lib/core/provider-listview-commandset.d.ts.map +1 -0
  29. package/lib/core/provider-listview-commandset.js +48 -0
  30. package/lib/core/provider-listview-commandset.js.map +1 -0
  31. package/lib/core/provider-webpart.d.ts +48 -0
  32. package/lib/core/provider-webpart.d.ts.map +1 -0
  33. package/lib/core/provider-webpart.js +36 -0
  34. package/lib/core/provider-webpart.js.map +1 -0
  35. package/lib/core/types.d.ts +84 -0
  36. package/lib/core/types.d.ts.map +1 -0
  37. package/lib/core/types.js +4 -0
  38. package/lib/core/types.js.map +1 -0
  39. package/lib/hooks/index.d.ts +34 -0
  40. package/lib/hooks/index.d.ts.map +1 -0
  41. package/lib/hooks/index.js +34 -0
  42. package/lib/hooks/index.js.map +1 -0
  43. package/lib/hooks/useSPFxAadHttpClient.d.ts +231 -0
  44. package/lib/hooks/useSPFxAadHttpClient.d.ts.map +1 -0
  45. package/lib/hooks/useSPFxAadHttpClient.js +299 -0
  46. package/lib/hooks/useSPFxAadHttpClient.js.map +1 -0
  47. package/lib/hooks/useSPFxContainerInfo.d.ts +41 -0
  48. package/lib/hooks/useSPFxContainerInfo.d.ts.map +1 -0
  49. package/lib/hooks/useSPFxContainerInfo.js +47 -0
  50. package/lib/hooks/useSPFxContainerInfo.js.map +1 -0
  51. package/lib/hooks/useSPFxContainerSize.d.ts +119 -0
  52. package/lib/hooks/useSPFxContainerSize.d.ts.map +1 -0
  53. package/lib/hooks/useSPFxContainerSize.js +150 -0
  54. package/lib/hooks/useSPFxContainerSize.js.map +1 -0
  55. package/lib/hooks/useSPFxContext.d.ts +14 -0
  56. package/lib/hooks/useSPFxContext.d.ts.map +1 -0
  57. package/lib/hooks/useSPFxContext.js +16 -0
  58. package/lib/hooks/useSPFxContext.js.map +1 -0
  59. package/lib/hooks/useSPFxCorrelationInfo.d.ts +51 -0
  60. package/lib/hooks/useSPFxCorrelationInfo.d.ts.map +1 -0
  61. package/lib/hooks/useSPFxCorrelationInfo.js +58 -0
  62. package/lib/hooks/useSPFxCorrelationInfo.js.map +1 -0
  63. package/lib/hooks/useSPFxCrossSitePermissions.d.ts +81 -0
  64. package/lib/hooks/useSPFxCrossSitePermissions.d.ts.map +1 -0
  65. package/lib/hooks/useSPFxCrossSitePermissions.js +132 -0
  66. package/lib/hooks/useSPFxCrossSitePermissions.js.map +1 -0
  67. package/lib/hooks/useSPFxDisplayMode.d.ts +61 -0
  68. package/lib/hooks/useSPFxDisplayMode.d.ts.map +1 -0
  69. package/lib/hooks/useSPFxDisplayMode.js +69 -0
  70. package/lib/hooks/useSPFxDisplayMode.js.map +1 -0
  71. package/lib/hooks/useSPFxEnvironmentInfo.d.ts +63 -0
  72. package/lib/hooks/useSPFxEnvironmentInfo.d.ts.map +1 -0
  73. package/lib/hooks/useSPFxEnvironmentInfo.js +91 -0
  74. package/lib/hooks/useSPFxEnvironmentInfo.js.map +1 -0
  75. package/lib/hooks/useSPFxFluent9ThemeInfo.d.ts +105 -0
  76. package/lib/hooks/useSPFxFluent9ThemeInfo.d.ts.map +1 -0
  77. package/lib/hooks/useSPFxFluent9ThemeInfo.js +136 -0
  78. package/lib/hooks/useSPFxFluent9ThemeInfo.js.map +1 -0
  79. package/lib/hooks/useSPFxHubSiteInfo.d.ts +80 -0
  80. package/lib/hooks/useSPFxHubSiteInfo.d.ts.map +1 -0
  81. package/lib/hooks/useSPFxHubSiteInfo.js +127 -0
  82. package/lib/hooks/useSPFxHubSiteInfo.js.map +1 -0
  83. package/lib/hooks/useSPFxInstanceInfo.d.ts +41 -0
  84. package/lib/hooks/useSPFxInstanceInfo.d.ts.map +1 -0
  85. package/lib/hooks/useSPFxInstanceInfo.js +40 -0
  86. package/lib/hooks/useSPFxInstanceInfo.js.map +1 -0
  87. package/lib/hooks/useSPFxListInfo.d.ts +64 -0
  88. package/lib/hooks/useSPFxListInfo.d.ts.map +1 -0
  89. package/lib/hooks/useSPFxListInfo.js +70 -0
  90. package/lib/hooks/useSPFxListInfo.js.map +1 -0
  91. package/lib/hooks/useSPFxLocaleInfo.d.ts +123 -0
  92. package/lib/hooks/useSPFxLocaleInfo.d.ts.map +1 -0
  93. package/lib/hooks/useSPFxLocaleInfo.js +109 -0
  94. package/lib/hooks/useSPFxLocaleInfo.js.map +1 -0
  95. package/lib/hooks/useSPFxLogger.d.ts +108 -0
  96. package/lib/hooks/useSPFxLogger.d.ts.map +1 -0
  97. package/lib/hooks/useSPFxLogger.js +117 -0
  98. package/lib/hooks/useSPFxLogger.js.map +1 -0
  99. package/lib/hooks/useSPFxMSGraphClient.d.ts +200 -0
  100. package/lib/hooks/useSPFxMSGraphClient.d.ts.map +1 -0
  101. package/lib/hooks/useSPFxMSGraphClient.js +264 -0
  102. package/lib/hooks/useSPFxMSGraphClient.js.map +1 -0
  103. package/lib/hooks/useSPFxOneDriveAppData.d.ts +264 -0
  104. package/lib/hooks/useSPFxOneDriveAppData.d.ts.map +1 -0
  105. package/lib/hooks/useSPFxOneDriveAppData.js +395 -0
  106. package/lib/hooks/useSPFxOneDriveAppData.js.map +1 -0
  107. package/lib/hooks/useSPFxPageContext.d.ts +37 -0
  108. package/lib/hooks/useSPFxPageContext.d.ts.map +1 -0
  109. package/lib/hooks/useSPFxPageContext.js +49 -0
  110. package/lib/hooks/useSPFxPageContext.js.map +1 -0
  111. package/lib/hooks/useSPFxPageType.d.ts +82 -0
  112. package/lib/hooks/useSPFxPageType.d.ts.map +1 -0
  113. package/lib/hooks/useSPFxPageType.js +137 -0
  114. package/lib/hooks/useSPFxPageType.js.map +1 -0
  115. package/lib/hooks/useSPFxPerformance.d.ts +72 -0
  116. package/lib/hooks/useSPFxPerformance.d.ts.map +1 -0
  117. package/lib/hooks/useSPFxPerformance.js +167 -0
  118. package/lib/hooks/useSPFxPerformance.js.map +1 -0
  119. package/lib/hooks/useSPFxPermissions.d.ts +61 -0
  120. package/lib/hooks/useSPFxPermissions.d.ts.map +1 -0
  121. package/lib/hooks/useSPFxPermissions.js +73 -0
  122. package/lib/hooks/useSPFxPermissions.js.map +1 -0
  123. package/lib/hooks/useSPFxPnP.d.ts +539 -0
  124. package/lib/hooks/useSPFxPnP.d.ts.map +1 -0
  125. package/lib/hooks/useSPFxPnP.js +533 -0
  126. package/lib/hooks/useSPFxPnP.js.map +1 -0
  127. package/lib/hooks/useSPFxPnPContext.d.ts +290 -0
  128. package/lib/hooks/useSPFxPnPContext.d.ts.map +1 -0
  129. package/lib/hooks/useSPFxPnPContext.js +340 -0
  130. package/lib/hooks/useSPFxPnPContext.js.map +1 -0
  131. package/lib/hooks/useSPFxPnPList.d.ts +545 -0
  132. package/lib/hooks/useSPFxPnPList.d.ts.map +1 -0
  133. package/lib/hooks/useSPFxPnPList.js +906 -0
  134. package/lib/hooks/useSPFxPnPList.js.map +1 -0
  135. package/lib/hooks/useSPFxPnPSearch.d.ts +540 -0
  136. package/lib/hooks/useSPFxPnPSearch.d.ts.map +1 -0
  137. package/lib/hooks/useSPFxPnPSearch.js +672 -0
  138. package/lib/hooks/useSPFxPnPSearch.js.map +1 -0
  139. package/lib/hooks/useSPFxProperties.d.ts +80 -0
  140. package/lib/hooks/useSPFxProperties.d.ts.map +1 -0
  141. package/lib/hooks/useSPFxProperties.js +95 -0
  142. package/lib/hooks/useSPFxProperties.js.map +1 -0
  143. package/lib/hooks/useSPFxSPHttpClient.d.ts +218 -0
  144. package/lib/hooks/useSPFxSPHttpClient.d.ts.map +1 -0
  145. package/lib/hooks/useSPFxSPHttpClient.js +287 -0
  146. package/lib/hooks/useSPFxSPHttpClient.js.map +1 -0
  147. package/lib/hooks/useSPFxServiceScope.d.ts +107 -0
  148. package/lib/hooks/useSPFxServiceScope.d.ts.map +1 -0
  149. package/lib/hooks/useSPFxServiceScope.js +105 -0
  150. package/lib/hooks/useSPFxServiceScope.js.map +1 -0
  151. package/lib/hooks/useSPFxSiteInfo.d.ts +116 -0
  152. package/lib/hooks/useSPFxSiteInfo.d.ts.map +1 -0
  153. package/lib/hooks/useSPFxSiteInfo.js +109 -0
  154. package/lib/hooks/useSPFxSiteInfo.js.map +1 -0
  155. package/lib/hooks/useSPFxStorage.d.ts +81 -0
  156. package/lib/hooks/useSPFxStorage.d.ts.map +1 -0
  157. package/lib/hooks/useSPFxStorage.js +140 -0
  158. package/lib/hooks/useSPFxStorage.js.map +1 -0
  159. package/lib/hooks/useSPFxTeams.d.ts +63 -0
  160. package/lib/hooks/useSPFxTeams.d.ts.map +1 -0
  161. package/lib/hooks/useSPFxTeams.js +198 -0
  162. package/lib/hooks/useSPFxTeams.js.map +1 -0
  163. package/lib/hooks/useSPFxTenantProperty.d.ts +389 -0
  164. package/lib/hooks/useSPFxTenantProperty.d.ts.map +1 -0
  165. package/lib/hooks/useSPFxTenantProperty.js +683 -0
  166. package/lib/hooks/useSPFxTenantProperty.js.map +1 -0
  167. package/lib/hooks/useSPFxThemeInfo.d.ts +27 -0
  168. package/lib/hooks/useSPFxThemeInfo.d.ts.map +1 -0
  169. package/lib/hooks/useSPFxThemeInfo.js +33 -0
  170. package/lib/hooks/useSPFxThemeInfo.js.map +1 -0
  171. package/lib/hooks/useSPFxUserInfo.d.ts +47 -0
  172. package/lib/hooks/useSPFxUserInfo.d.ts.map +1 -0
  173. package/lib/hooks/useSPFxUserInfo.js +47 -0
  174. package/lib/hooks/useSPFxUserInfo.js.map +1 -0
  175. package/lib/hooks/useSPFxUserPhoto.d.ts +270 -0
  176. package/lib/hooks/useSPFxUserPhoto.d.ts.map +1 -0
  177. package/lib/hooks/useSPFxUserPhoto.js +346 -0
  178. package/lib/hooks/useSPFxUserPhoto.js.map +1 -0
  179. package/lib/index.d.ts +3 -0
  180. package/lib/index.d.ts.map +1 -0
  181. package/lib/index.js +3 -0
  182. package/lib/index.js.map +1 -0
  183. package/lib/utils/index.d.ts +1 -0
  184. package/lib/utils/index.d.ts.map +1 -0
  185. package/lib/utils/index.js +3 -0
  186. package/lib/utils/index.js.map +1 -0
  187. package/lib/utils/resize-observer.internal.d.ts +10 -0
  188. package/lib/utils/resize-observer.internal.d.ts.map +1 -0
  189. package/lib/utils/resize-observer.internal.js +34 -0
  190. package/lib/utils/resize-observer.internal.js.map +1 -0
  191. package/lib/utils/theme-subscription.internal.d.ts +11 -0
  192. package/lib/utils/theme-subscription.internal.d.ts.map +1 -0
  193. package/lib/utils/theme-subscription.internal.js +58 -0
  194. package/lib/utils/theme-subscription.internal.js.map +1 -0
  195. package/lib/utils/type-guards.internal.d.ts +35 -0
  196. package/lib/utils/type-guards.internal.d.ts.map +1 -0
  197. package/lib/utils/type-guards.internal.js +88 -0
  198. package/lib/utils/type-guards.internal.js.map +1 -0
  199. package/lib/webparts/spFxReactToolkitTest/SpFxReactToolkitTestWebPart.d.ts +13 -0
  200. package/lib/webparts/spFxReactToolkitTest/SpFxReactToolkitTestWebPart.d.ts.map +1 -0
  201. package/lib/webparts/spFxReactToolkitTest/SpFxReactToolkitTestWebPart.js +67 -0
  202. package/lib/webparts/spFxReactToolkitTest/SpFxReactToolkitTestWebPart.js.map +1 -0
  203. package/lib/webparts/spFxReactToolkitTest/SpFxReactToolkitTestWebPart.manifest.json +21 -0
  204. package/lib/webparts/spFxReactToolkitTest/assets/welcome-dark.png +0 -0
  205. package/lib/webparts/spFxReactToolkitTest/assets/welcome-light.png +0 -0
  206. package/lib/webparts/spFxReactToolkitTest/components/ISpFxReactToolkitTestProps.d.ts +8 -0
  207. package/lib/webparts/spFxReactToolkitTest/components/ISpFxReactToolkitTestProps.d.ts.map +1 -0
  208. package/lib/webparts/spFxReactToolkitTest/components/ISpFxReactToolkitTestProps.js +2 -0
  209. package/lib/webparts/spFxReactToolkitTest/components/ISpFxReactToolkitTestProps.js.map +1 -0
  210. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.d.ts +8 -0
  211. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.d.ts.map +1 -0
  212. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.js +1351 -0
  213. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.js.map +1 -0
  214. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.module.css +2 -0
  215. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.module.scss.d.ts +18 -0
  216. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.module.scss.d.ts.map +1 -0
  217. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.module.scss.js +19 -0
  218. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.module.scss.js.map +1 -0
  219. package/lib/webparts/spFxReactToolkitTest/loc/en-us.js +16 -0
  220. package/package.json +95 -0
@@ -0,0 +1,389 @@
1
+ /**
2
+ * Return type for useSPFxTenantProperty hook
3
+ */
4
+ export interface SPFxTenantPropertyResult<T> {
5
+ /**
6
+ * The loaded property value from tenant app catalog.
7
+ * Undefined if not loaded yet or on error.
8
+ */
9
+ readonly data: T | undefined;
10
+ /**
11
+ * Property description metadata (optional).
12
+ * SharePoint StorageEntity only supports description, not comment.
13
+ */
14
+ readonly description: string | undefined;
15
+ /**
16
+ * Loading state for read operations.
17
+ * True during initial load or manual load() calls.
18
+ */
19
+ readonly isLoading: boolean;
20
+ /**
21
+ * Last error from read operations.
22
+ * Cleared on successful load or write.
23
+ */
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
+ /**
41
+ * Manually load/reload the property from tenant app catalog.
42
+ * Updates data, description, comment, isLoading, and error states.
43
+ *
44
+ * @returns Promise that resolves when load completes
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * const { data, load } = useSPFxTenantProperty<string>('appVersion', false);
49
+ *
50
+ * // Load on button click
51
+ * <button onClick={load}>Refresh</button>
52
+ * ```
53
+ */
54
+ 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
+ /**
98
+ * Computed state: true if data is loaded successfully.
99
+ * Equivalent to: !isLoading && !error && data !== undefined
100
+ *
101
+ * Useful for conditional rendering:
102
+ * ```tsx
103
+ * if (!isReady) return <Spinner />;
104
+ * return <div>{data}</div>;
105
+ * ```
106
+ */
107
+ readonly isReady: boolean;
108
+ }
109
+ /**
110
+ * Hook to manage tenant-wide properties using SharePoint StorageEntity API
111
+ *
112
+ * Provides read/write operations for tenant-scoped properties stored in the
113
+ * SharePoint tenant app catalog. Properties are accessible across all sites
114
+ * in the tenant and support metadata (description only).
115
+ *
116
+ * Features:
117
+ * - Tenant-wide centralized storage (not site-specific)
118
+ * - Smart serialization for primitives, Date, and complex objects
119
+ * - Permission checking (canWrite flag)
120
+ * - Optional metadata (description only - SharePoint limitation)
121
+ * - Type-safe with TypeScript generics
122
+ * - Memory leak safe with mounted state tracking
123
+ * - Automatic app catalog URL discovery
124
+ * - Remove operation for cleanup
125
+ *
126
+ * Requirements:
127
+ * - Tenant app catalog must be provisioned
128
+ * - Read: Any authenticated user
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
141
+ *
142
+ * @param key - Unique property key (e.g., 'appVersion', 'apiEndpoint', 'featureFlags')
143
+ * @param autoFetch - Whether to automatically load property on mount. Default: true
144
+ *
145
+ * @returns Object with data, metadata, loading states, error states, and CRUD functions
146
+ *
147
+ * @example Basic usage - string property
148
+ * ```tsx
149
+ * function VersionDisplay() {
150
+ * const { data, isLoading, error, write, canWrite } =
151
+ * useSPFxTenantProperty<string>('appVersion');
152
+ *
153
+ * if (isLoading) return <Spinner label="Loading version..." />;
154
+ * if (error) return <MessageBar messageBarType={MessageBarType.error}>
155
+ * Failed to load: {error.message}
156
+ * </MessageBar>;
157
+ *
158
+ * const handleUpdate = async () => {
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>;
201
+ * }
202
+ * ```
203
+ *
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
+ * @example Complex object with JSON
216
+ * ```tsx
217
+ * interface FeatureFlags {
218
+ * enableChat: boolean;
219
+ * enableAnalytics: boolean;
220
+ * maxUsers: number;
221
+ * }
222
+ *
223
+ * const { data, write, isLoading } = useSPFxTenantProperty<FeatureFlags>('featureFlags');
224
+ *
225
+ * // Stored as JSON string
226
+ * await write({
227
+ * enableChat: true,
228
+ * enableAnalytics: false,
229
+ * maxUsers: 1000
230
+ * }, 'Global feature flags configuration');
231
+ *
232
+ * // Read returns parsed object
233
+ * if (data?.enableChat) {
234
+ * return <ChatPanel />;
235
+ * }
236
+ * ```
237
+ *
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
+ * @example With metadata viewing
292
+ * ```tsx
293
+ * function PropertyViewer() {
294
+ * const { data, description, isLoading } =
295
+ * useSPFxTenantProperty<string>('appConfig');
296
+ *
297
+ * if (isLoading) return <Spinner />;
298
+ *
299
+ * return (
300
+ * <Stack tokens={{ childrenGap: 5 }}>
301
+ * <Text variant="large">Value: {data}</Text>
302
+ * {description && <Text variant="small">Description: {description}</Text>}
303
+ * </Stack>
304
+ * );
305
+ * }
306
+ * ```
307
+ *
308
+ * @example Lazy loading with manual trigger
309
+ * ```tsx
310
+ * const { data, load, isLoading, write } = useSPFxTenantProperty<Config>(
311
+ * 'appConfig',
312
+ * false // Don't auto-fetch
313
+ * );
314
+ *
315
+ * return (
316
+ * <div>
317
+ * <button onClick={load} disabled={isLoading}>
318
+ * {isLoading ? 'Loading...' : 'Load Config'}
319
+ * </button>
320
+ * {data && <ConfigDisplay config={data} />}
321
+ * </div>
322
+ * );
323
+ * ```
324
+ *
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
+ * @example Multi-property dashboard
355
+ * ```tsx
356
+ * function TenantDashboard() {
357
+ * const version = useSPFxTenantProperty<string>('appVersion');
358
+ * const maintenance = useSPFxTenantProperty<boolean>('maintenanceMode');
359
+ * const lastUpdate = useSPFxTenantProperty<string>('lastUpdate');
360
+ * const config = useSPFxTenantProperty<AppConfig>('appConfig');
361
+ *
362
+ * const isLoading = version.isLoading || maintenance.isLoading ||
363
+ * lastUpdate.isLoading || config.isLoading;
364
+ *
365
+ * if (isLoading) return <Spinner label="Loading dashboard..." />;
366
+ *
367
+ * return (
368
+ * <Stack tokens={{ childrenGap: 20 }}>
369
+ * <Text variant="xxLarge">Tenant Configuration</Text>
370
+ *
371
+ * <Stack tokens={{ childrenGap: 10 }}>
372
+ * <Label>App Version: {version.data ?? 'Not Set'}</Label>
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
+ * )}
383
+ * </Stack>
384
+ * );
385
+ * }
386
+ * ```
387
+ */
388
+ export declare function useSPFxTenantProperty<T = unknown>(key: string, autoFetch?: boolean): SPFxTenantPropertyResult<T>;
389
+ //# sourceMappingURL=useSPFxTenantProperty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSPFxTenantProperty.d.ts","sourceRoot":"","sources":["../../src/hooks/useSPFxTenantProperty.ts"],"names":[],"mappings":"AASA;;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;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,KAAK,GAAG,SAAS,CAAC;IAEvC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAkBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsRG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,OAAO,EAC/C,GAAG,EAAE,MAAM,EACX,SAAS,GAAE,OAAc,GACxB,wBAAwB,CAAC,CAAC,CAAC,CA0V7B"}