@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,64 @@
1
+ /**
2
+ * Return type for useSPFxListInfo hook
3
+ */
4
+ export interface SPFxListInfo {
5
+ /** List ID (GUID) */
6
+ readonly id: string;
7
+ /** List title */
8
+ readonly title: string;
9
+ /** List server relative URL */
10
+ readonly serverRelativeUrl: string;
11
+ /** List template type (e.g., 100 for Generic List, 101 for Document Library) */
12
+ readonly baseTemplate?: number;
13
+ /** Whether list is a document library */
14
+ readonly isDocumentLibrary?: boolean;
15
+ }
16
+ /**
17
+ * Hook to access list information
18
+ *
19
+ * Provides information about the current SharePoint list/library
20
+ * when component is rendered in a list context (e.g., list view,
21
+ * list web part, field customizer).
22
+ *
23
+ * Returns undefined if not in a list context.
24
+ *
25
+ * Information provided:
26
+ * - id: Unique identifier
27
+ * - title: List title
28
+ * - serverRelativeUrl: Server-relative URL
29
+ * - baseTemplate: List template type
30
+ * - isDocumentLibrary: Whether it's a document library
31
+ *
32
+ * Note: List context is available in Field Customizers and some
33
+ * List View WebParts. Standard page WebParts typically don't have
34
+ * list context. Always check for undefined return value.
35
+ *
36
+ * Useful for:
37
+ * - List-specific operations in Field Customizers
38
+ * - Conditional rendering based on list type
39
+ * - Building list URLs
40
+ * - List metadata display
41
+ *
42
+ * @returns List information or undefined if not in list context
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * function MyComponent() {
47
+ * const list = useSPFxListInfo();
48
+ *
49
+ * if (!list) {
50
+ * return <div>Not in list context</div>;
51
+ * }
52
+ *
53
+ * return (
54
+ * <div>
55
+ * <h2>{list.title}</h2>
56
+ * <p>List ID: {list.id}</p>
57
+ * {list.isDocumentLibrary && <p>Document Library</p>}
58
+ * </div>
59
+ * );
60
+ * }
61
+ * ```
62
+ */
63
+ export declare function useSPFxListInfo(): SPFxListInfo | undefined;
64
+ //# sourceMappingURL=useSPFxListInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSPFxListInfo.d.ts","sourceRoot":"","sources":["../../src/hooks/useSPFxListInfo.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,iBAAiB;IACjB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,+BAA+B;IAC/B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAEnC,gFAAgF;IAChF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B,yCAAyC;IACzC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,eAAe,IAAI,YAAY,GAAG,SAAS,CA4B1D"}
@@ -0,0 +1,70 @@
1
+ // useSPFxListInfo.ts
2
+ // Hook to access list information (when in list context)
3
+ import { useSPFxPageContext } from './useSPFxPageContext';
4
+ /**
5
+ * Hook to access list information
6
+ *
7
+ * Provides information about the current SharePoint list/library
8
+ * when component is rendered in a list context (e.g., list view,
9
+ * list web part, field customizer).
10
+ *
11
+ * Returns undefined if not in a list context.
12
+ *
13
+ * Information provided:
14
+ * - id: Unique identifier
15
+ * - title: List title
16
+ * - serverRelativeUrl: Server-relative URL
17
+ * - baseTemplate: List template type
18
+ * - isDocumentLibrary: Whether it's a document library
19
+ *
20
+ * Note: List context is available in Field Customizers and some
21
+ * List View WebParts. Standard page WebParts typically don't have
22
+ * list context. Always check for undefined return value.
23
+ *
24
+ * Useful for:
25
+ * - List-specific operations in Field Customizers
26
+ * - Conditional rendering based on list type
27
+ * - Building list URLs
28
+ * - List metadata display
29
+ *
30
+ * @returns List information or undefined if not in list context
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * function MyComponent() {
35
+ * const list = useSPFxListInfo();
36
+ *
37
+ * if (!list) {
38
+ * return <div>Not in list context</div>;
39
+ * }
40
+ *
41
+ * return (
42
+ * <div>
43
+ * <h2>{list.title}</h2>
44
+ * <p>List ID: {list.id}</p>
45
+ * {list.isDocumentLibrary && <p>Document Library</p>}
46
+ * </div>
47
+ * );
48
+ * }
49
+ * ```
50
+ */
51
+ export function useSPFxListInfo() {
52
+ var _a, _b;
53
+ var pageContext = useSPFxPageContext();
54
+ // Try to get list from page context
55
+ var list = pageContext.list;
56
+ if (!list || !list.id) {
57
+ return undefined;
58
+ }
59
+ // List template type 101 is Document Library
60
+ var baseTemplate = list.baseTemplate;
61
+ var isDocumentLibrary = baseTemplate === 101;
62
+ return {
63
+ id: list.id.toString(),
64
+ title: (_a = list.title) !== null && _a !== void 0 ? _a : 'Unknown List',
65
+ serverRelativeUrl: (_b = list.serverRelativeUrl) !== null && _b !== void 0 ? _b : '',
66
+ baseTemplate: baseTemplate,
67
+ isDocumentLibrary: isDocumentLibrary,
68
+ };
69
+ }
70
+ //# sourceMappingURL=useSPFxListInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSPFxListInfo.js","sourceRoot":"","sources":["../../src/hooks/useSPFxListInfo.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,yDAAyD;AAEzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAsB1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,UAAU,eAAe;;IAC7B,IAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;IAEzC,oCAAoC;IACpC,IAAM,IAAI,GAAI,WAOZ,CAAC,IAAI,CAAC;IAER,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,6CAA6C;IAC7C,IAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;IACvC,IAAM,iBAAiB,GAAG,YAAY,KAAK,GAAG,CAAC;IAE/C,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;QACtB,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,cAAc;QACnC,iBAAiB,EAAE,MAAA,IAAI,CAAC,iBAAiB,mCAAI,EAAE;QAC/C,YAAY,cAAA;QACZ,iBAAiB,mBAAA;KAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * SPTimeZone interface (preview API in SPFx)
3
+ * Based on Microsoft Learn documentation
4
+ * @see https://learn.microsoft.com/en-us/javascript/api/sp-page-context/sptimezone
5
+ *
6
+ * Note: This is a preview API that may change in future SPFx versions.
7
+ * Type definition based on official docs since it's not yet exported in @microsoft/sp-page-context.
8
+ */
9
+ export interface SPFxTimeZone {
10
+ /** Time zone ID (numeric identifier) */
11
+ readonly id: number;
12
+ /** Offset in minutes from UTC */
13
+ readonly offset: number;
14
+ /** Time zone description (e.g., "Pacific Standard Time") */
15
+ readonly description: string;
16
+ /** Daylight savings time offset in minutes from UTC */
17
+ readonly daylightOffset: number;
18
+ /** Standard time offset in minutes from UTC */
19
+ readonly standardOffset: number;
20
+ }
21
+ /**
22
+ * Return type for useSPFxLocaleInfo hook
23
+ */
24
+ export interface SPFxLocaleInfo {
25
+ /** Current locale (e.g., "en-US", "it-IT") */
26
+ readonly locale: string;
27
+ /** Current UI locale (may differ from content locale) */
28
+ readonly uiLocale: string;
29
+ /** Time zone information from SPWeb (preview API) */
30
+ readonly timeZone: SPFxTimeZone | undefined;
31
+ /** Whether the language is right-to-left */
32
+ readonly isRtl: boolean;
33
+ }
34
+ /**
35
+ * Hook for locale and regional settings
36
+ *
37
+ * Provides locale and regional information from SPFx PageContext:
38
+ * - locale: Current content locale (e.g., "en-US", "it-IT")
39
+ * - uiLocale: Current UI language locale
40
+ * - timeZone: Time zone information from SPWeb (preview API)
41
+ * - isRtl: Right-to-left language detection from CultureInfo
42
+ *
43
+ * Uses native SPFx properties (no legacy context):
44
+ * - cultureInfo.currentCultureName
45
+ * - cultureInfo.currentUICultureName
46
+ * - cultureInfo.isRightToLeft
47
+ * - web.timeZoneInfo (preview API)
48
+ *
49
+ * Useful for:
50
+ * - Internationalization (i18n) with Intl APIs
51
+ * - Date/time formatting with timezone awareness
52
+ * - Regional number/currency formatting
53
+ * - RTL layout detection
54
+ * - Calendar widget configuration
55
+ * - Multi-lingual applications
56
+ *
57
+ * The locale string can be used directly with JavaScript Intl APIs:
58
+ * - Intl.DateTimeFormat(locale, options)
59
+ * - Intl.NumberFormat(locale, options)
60
+ * - Intl.Collator(locale, options)
61
+ *
62
+ * @returns Locale and regional settings
63
+ *
64
+ * @example Basic locale usage
65
+ * ```tsx
66
+ * function MyComponent() {
67
+ * const { locale, isRtl } = useSPFxLocaleInfo();
68
+ *
69
+ * const formatDate = (date: Date) => {
70
+ * return new Intl.DateTimeFormat(locale, {
71
+ * dateStyle: 'full',
72
+ * timeStyle: 'long'
73
+ * }).format(date);
74
+ * };
75
+ *
76
+ * return (
77
+ * <div dir={isRtl ? 'rtl' : 'ltr'}>
78
+ * <p>{formatDate(new Date())}</p>
79
+ * </div>
80
+ * );
81
+ * }
82
+ * ```
83
+ *
84
+ * @example Time zone aware formatting
85
+ * ```tsx
86
+ * function Calendar() {
87
+ * const { locale, timeZone } = useSPFxLocaleInfo();
88
+ *
89
+ * if (!timeZone) return <div>No timezone info</div>;
90
+ *
91
+ * const formatWithTimeZone = (date: Date) => {
92
+ * return new Intl.DateTimeFormat(locale, {
93
+ * dateStyle: 'medium',
94
+ * timeStyle: 'short'
95
+ * }).format(date);
96
+ * };
97
+ *
98
+ * return (
99
+ * <div>
100
+ * <h3>Time Zone: {timeZone.description}</h3>
101
+ * <p>Offset: {timeZone.offset} minutes from UTC</p>
102
+ * <p>{formatWithTimeZone(new Date())}</p>
103
+ * </div>
104
+ * );
105
+ * }
106
+ * ```
107
+ *
108
+ * @example Multi-locale support
109
+ * ```tsx
110
+ * function PriceDisplay({ amount }: { amount: number }) {
111
+ * const { locale } = useSPFxLocaleInfo();
112
+ *
113
+ * const price = new Intl.NumberFormat(locale, {
114
+ * style: 'currency',
115
+ * currency: 'USD'
116
+ * }).format(amount);
117
+ *
118
+ * return <p>Price: {price}</p>;
119
+ * }
120
+ * ```
121
+ */
122
+ export declare function useSPFxLocaleInfo(): SPFxLocaleInfo;
123
+ //# sourceMappingURL=useSPFxLocaleInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSPFxLocaleInfo.d.ts","sourceRoot":"","sources":["../../src/hooks/useSPFxLocaleInfo.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,uDAAuD;IACvD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC,+CAA+C;IAC/C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,qDAAqD;IACrD,QAAQ,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IAE5C,4CAA4C;IAC5C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAmBlD"}
@@ -0,0 +1,109 @@
1
+ // useSPFxLocaleInfo.ts
2
+ // Hook for locale and regional settings
3
+ import { useSPFxPageContext } from './useSPFxPageContext';
4
+ /**
5
+ * Hook for locale and regional settings
6
+ *
7
+ * Provides locale and regional information from SPFx PageContext:
8
+ * - locale: Current content locale (e.g., "en-US", "it-IT")
9
+ * - uiLocale: Current UI language locale
10
+ * - timeZone: Time zone information from SPWeb (preview API)
11
+ * - isRtl: Right-to-left language detection from CultureInfo
12
+ *
13
+ * Uses native SPFx properties (no legacy context):
14
+ * - cultureInfo.currentCultureName
15
+ * - cultureInfo.currentUICultureName
16
+ * - cultureInfo.isRightToLeft
17
+ * - web.timeZoneInfo (preview API)
18
+ *
19
+ * Useful for:
20
+ * - Internationalization (i18n) with Intl APIs
21
+ * - Date/time formatting with timezone awareness
22
+ * - Regional number/currency formatting
23
+ * - RTL layout detection
24
+ * - Calendar widget configuration
25
+ * - Multi-lingual applications
26
+ *
27
+ * The locale string can be used directly with JavaScript Intl APIs:
28
+ * - Intl.DateTimeFormat(locale, options)
29
+ * - Intl.NumberFormat(locale, options)
30
+ * - Intl.Collator(locale, options)
31
+ *
32
+ * @returns Locale and regional settings
33
+ *
34
+ * @example Basic locale usage
35
+ * ```tsx
36
+ * function MyComponent() {
37
+ * const { locale, isRtl } = useSPFxLocaleInfo();
38
+ *
39
+ * const formatDate = (date: Date) => {
40
+ * return new Intl.DateTimeFormat(locale, {
41
+ * dateStyle: 'full',
42
+ * timeStyle: 'long'
43
+ * }).format(date);
44
+ * };
45
+ *
46
+ * return (
47
+ * <div dir={isRtl ? 'rtl' : 'ltr'}>
48
+ * <p>{formatDate(new Date())}</p>
49
+ * </div>
50
+ * );
51
+ * }
52
+ * ```
53
+ *
54
+ * @example Time zone aware formatting
55
+ * ```tsx
56
+ * function Calendar() {
57
+ * const { locale, timeZone } = useSPFxLocaleInfo();
58
+ *
59
+ * if (!timeZone) return <div>No timezone info</div>;
60
+ *
61
+ * const formatWithTimeZone = (date: Date) => {
62
+ * return new Intl.DateTimeFormat(locale, {
63
+ * dateStyle: 'medium',
64
+ * timeStyle: 'short'
65
+ * }).format(date);
66
+ * };
67
+ *
68
+ * return (
69
+ * <div>
70
+ * <h3>Time Zone: {timeZone.description}</h3>
71
+ * <p>Offset: {timeZone.offset} minutes from UTC</p>
72
+ * <p>{formatWithTimeZone(new Date())}</p>
73
+ * </div>
74
+ * );
75
+ * }
76
+ * ```
77
+ *
78
+ * @example Multi-locale support
79
+ * ```tsx
80
+ * function PriceDisplay({ amount }: { amount: number }) {
81
+ * const { locale } = useSPFxLocaleInfo();
82
+ *
83
+ * const price = new Intl.NumberFormat(locale, {
84
+ * style: 'currency',
85
+ * currency: 'USD'
86
+ * }).format(amount);
87
+ *
88
+ * return <p>Price: {price}</p>;
89
+ * }
90
+ * ```
91
+ */
92
+ export function useSPFxLocaleInfo() {
93
+ var pageContext = useSPFxPageContext();
94
+ // Extract culture info (native SPFx properties)
95
+ var cultureInfo = pageContext.cultureInfo;
96
+ var locale = cultureInfo.currentCultureName;
97
+ var uiLocale = cultureInfo.currentUICultureName;
98
+ var isRtl = cultureInfo.isRightToLeft;
99
+ // Extract time zone from web (preview API)
100
+ // Cast needed because timeZoneInfo is not yet in public types
101
+ var timeZone = pageContext.web.timeZoneInfo;
102
+ return {
103
+ locale: locale,
104
+ uiLocale: uiLocale,
105
+ timeZone: timeZone,
106
+ isRtl: isRtl,
107
+ };
108
+ }
109
+ //# sourceMappingURL=useSPFxLocaleInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSPFxLocaleInfo.js","sourceRoot":"","sources":["../../src/hooks/useSPFxLocaleInfo.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,wCAAwC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AA4C1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;IAEzC,gDAAgD;IAChD,IAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAC5C,IAAM,MAAM,GAAG,WAAW,CAAC,kBAAkB,CAAC;IAC9C,IAAM,QAAQ,GAAG,WAAW,CAAC,oBAAoB,CAAC;IAClD,IAAM,KAAK,GAAG,WAAW,CAAC,aAAa,CAAC;IAExC,2CAA2C;IAC3C,8DAA8D;IAC9D,IAAM,QAAQ,GAAI,WAAW,CAAC,GAAuC,CAAC,YAAY,CAAC;IAEnF,OAAO;QACL,MAAM,QAAA;QACN,QAAQ,UAAA;QACR,QAAQ,UAAA;QACR,KAAK,OAAA;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Log levels
3
+ */
4
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
5
+ /**
6
+ * Structured log entry
7
+ */
8
+ export interface LogEntry {
9
+ /** Log level */
10
+ readonly level: LogLevel;
11
+ /** Log message */
12
+ readonly message: string;
13
+ /** Timestamp ISO string */
14
+ readonly ts: string;
15
+ /** SPFx instance ID */
16
+ readonly instanceId: string;
17
+ /** Host kind */
18
+ readonly host: string;
19
+ /** Current user */
20
+ readonly user: string;
21
+ /** Site collection URL */
22
+ readonly siteUrl: string | undefined;
23
+ /** Web URL */
24
+ readonly webUrl: string | undefined;
25
+ /** Correlation ID */
26
+ readonly correlationId: string | undefined;
27
+ /** WebPart tag - only available for WebPart contexts */
28
+ readonly webPartTag?: string;
29
+ /** Extra metadata */
30
+ readonly extra?: Record<string, unknown>;
31
+ }
32
+ /**
33
+ * Return type for useSPFxLogger hook
34
+ */
35
+ export interface SPFxLoggerInfo {
36
+ /** Log debug message */
37
+ readonly debug: (message: string, extra?: Record<string, unknown>) => void;
38
+ /** Log info message */
39
+ readonly info: (message: string, extra?: Record<string, unknown>) => void;
40
+ /** Log warning message */
41
+ readonly warn: (message: string, extra?: Record<string, unknown>) => void;
42
+ /** Log error message */
43
+ readonly error: (message: string, extra?: Record<string, unknown>) => void;
44
+ }
45
+ /**
46
+ * Hook for structured logging with SPFx context
47
+ *
48
+ * Provides structured logging methods that automatically include:
49
+ * - SPFx instance ID
50
+ * - Host kind (WebPart, Extension, etc.)
51
+ * - Current user information
52
+ * - Site/web URLs
53
+ * - Correlation ID
54
+ * - Timestamp
55
+ *
56
+ * By default logs to console, but can be configured with custom handler
57
+ * for integration with Application Insights, Log Analytics, or other
58
+ * logging services.
59
+ *
60
+ * Useful for:
61
+ * - Diagnostic logging
62
+ * - Error tracking
63
+ * - Performance monitoring
64
+ * - User activity tracking
65
+ * - Support troubleshooting
66
+ *
67
+ * @param handler - Optional custom log handler
68
+ * @returns Logger methods
69
+ *
70
+ * @example
71
+ * ```tsx
72
+ * function MyComponent() {
73
+ * const logger = useSPFxLogger();
74
+ *
75
+ * const handleClick = () => {
76
+ * logger.info('Button clicked', { buttonId: 'save' });
77
+ * };
78
+ *
79
+ * const handleError = (error: Error) => {
80
+ * logger.error('Operation failed', {
81
+ * errorMessage: error.message,
82
+ * stack: error.stack
83
+ * });
84
+ * };
85
+ *
86
+ * return <button onClick={handleClick}>Click Me</button>;
87
+ * }
88
+ * ```
89
+ *
90
+ * @example Custom handler for Application Insights
91
+ * ```tsx
92
+ * const customHandler = (entry: LogEntry) => {
93
+ * appInsights.trackTrace({
94
+ * message: entry.message,
95
+ * severityLevel: entry.level,
96
+ * properties: {
97
+ * instanceId: entry.instanceId,
98
+ * correlationId: entry.correlationId,
99
+ * ...entry.extra
100
+ * }
101
+ * });
102
+ * };
103
+ *
104
+ * const logger = useSPFxLogger(customHandler);
105
+ * ```
106
+ */
107
+ export declare function useSPFxLogger(handler?: (entry: LogEntry) => void): SPFxLoggerInfo;
108
+ //# sourceMappingURL=useSPFxLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSPFxLogger.d.ts","sourceRoot":"","sources":["../../src/hooks/useSPFxLogger.ts"],"names":[],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CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAE1E,wBAAwB;IACxB,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;CAC5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAgB,aAAa,CAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAClC,cAAc,CAkDhB"}
@@ -0,0 +1,117 @@
1
+ // useSPFxLogger.ts
2
+ // Hook for structured logging with SPFx context
3
+ import { useSPFxContext } from './useSPFxContext';
4
+ import { useSPFxInstanceInfo } from './useSPFxInstanceInfo';
5
+ import { useSPFxUserInfo } from './useSPFxUserInfo';
6
+ import { useSPFxSiteInfo } from './useSPFxSiteInfo';
7
+ import { useSPFxCorrelationInfo } from './useSPFxCorrelationInfo';
8
+ /**
9
+ * Hook for structured logging with SPFx context
10
+ *
11
+ * Provides structured logging methods that automatically include:
12
+ * - SPFx instance ID
13
+ * - Host kind (WebPart, Extension, etc.)
14
+ * - Current user information
15
+ * - Site/web URLs
16
+ * - Correlation ID
17
+ * - Timestamp
18
+ *
19
+ * By default logs to console, but can be configured with custom handler
20
+ * for integration with Application Insights, Log Analytics, or other
21
+ * logging services.
22
+ *
23
+ * Useful for:
24
+ * - Diagnostic logging
25
+ * - Error tracking
26
+ * - Performance monitoring
27
+ * - User activity tracking
28
+ * - Support troubleshooting
29
+ *
30
+ * @param handler - Optional custom log handler
31
+ * @returns Logger methods
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * function MyComponent() {
36
+ * const logger = useSPFxLogger();
37
+ *
38
+ * const handleClick = () => {
39
+ * logger.info('Button clicked', { buttonId: 'save' });
40
+ * };
41
+ *
42
+ * const handleError = (error: Error) => {
43
+ * logger.error('Operation failed', {
44
+ * errorMessage: error.message,
45
+ * stack: error.stack
46
+ * });
47
+ * };
48
+ *
49
+ * return <button onClick={handleClick}>Click Me</button>;
50
+ * }
51
+ * ```
52
+ *
53
+ * @example Custom handler for Application Insights
54
+ * ```tsx
55
+ * const customHandler = (entry: LogEntry) => {
56
+ * appInsights.trackTrace({
57
+ * message: entry.message,
58
+ * severityLevel: entry.level,
59
+ * properties: {
60
+ * instanceId: entry.instanceId,
61
+ * correlationId: entry.correlationId,
62
+ * ...entry.extra
63
+ * }
64
+ * });
65
+ * };
66
+ *
67
+ * const logger = useSPFxLogger(customHandler);
68
+ * ```
69
+ */
70
+ export function useSPFxLogger(handler) {
71
+ var _a = useSPFxInstanceInfo(), instanceId = _a.id, kind = _a.kind;
72
+ var _b = useSPFxUserInfo(), displayName = _b.displayName, loginName = _b.loginName;
73
+ var _c = useSPFxSiteInfo(), siteUrl = _c.siteUrl, webUrl = _c.webUrl;
74
+ var correlationId = useSPFxCorrelationInfo().correlationId;
75
+ var spfxContext = useSPFxContext().spfxContext;
76
+ var emit = function (level, message, extra) {
77
+ // Extract webPartTag only if in WebPart context
78
+ var webPartTag;
79
+ if (kind === 'WebPart') {
80
+ var wpContext = spfxContext;
81
+ webPartTag = wpContext.webPartTag;
82
+ }
83
+ var entry = {
84
+ level: level,
85
+ message: message,
86
+ ts: new Date().toISOString(),
87
+ instanceId: instanceId,
88
+ host: kind,
89
+ user: displayName + ' (' + loginName + ')',
90
+ siteUrl: siteUrl,
91
+ webUrl: webUrl,
92
+ correlationId: correlationId,
93
+ webPartTag: webPartTag,
94
+ extra: extra,
95
+ };
96
+ if (handler) {
97
+ handler(entry);
98
+ }
99
+ else {
100
+ // Default: log to console
101
+ var levelUpper = level.toUpperCase();
102
+ // For WebPart contexts, display webPartTag instead of instanceId for better readability
103
+ var displayId = kind === 'WebPart' && webPartTag ? webPartTag : instanceId;
104
+ var line = '[' + levelUpper + '] ' + entry.ts + ' ' + kind + '/' + displayId + ' – ' + message;
105
+ // Use appropriate console method
106
+ var consoleFn = level === 'debug' ? console.log : console[level];
107
+ consoleFn(line, extra !== null && extra !== void 0 ? extra : {});
108
+ }
109
+ };
110
+ return {
111
+ debug: function (m, e) { return emit('debug', m, e); },
112
+ info: function (m, e) { return emit('info', m, e); },
113
+ warn: function (m, e) { return emit('warn', m, e); },
114
+ error: function (m, e) { return emit('error', m, e); },
115
+ };
116
+ }
117
+ //# sourceMappingURL=useSPFxLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSPFxLogger.js","sourceRoot":"","sources":["../../src/hooks/useSPFxLogger.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,gDAAgD;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AA+DlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAmC;IAE7B,IAAA,KAA2B,mBAAmB,EAAE,EAA1C,UAAU,QAAA,EAAE,IAAI,UAA0B,CAAC;IACjD,IAAA,KAA6B,eAAe,EAAE,EAA5C,WAAW,iBAAA,EAAE,SAAS,eAAsB,CAAC;IAC/C,IAAA,KAAsB,eAAe,EAAE,EAArC,OAAO,aAAA,EAAE,MAAM,YAAsB,CAAC;IACtC,IAAA,aAAa,GAAK,sBAAsB,EAAE,cAA7B,CAA8B;IAC3C,IAAA,WAAW,GAAK,cAAc,EAAE,YAArB,CAAsB;IAEzC,IAAM,IAAI,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