keycloakify 10.0.0-rc.22 → 10.0.0-rc.24

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 (236) hide show
  1. package/PUBLIC_URL.d.ts +1 -1
  2. package/PUBLIC_URL.js +1 -1
  3. package/PUBLIC_URL.js.map +1 -1
  4. package/account/Fallback.js.map +1 -1
  5. package/account/Template.js +3 -3
  6. package/account/Template.js.map +1 -1
  7. package/account/i18n/baseMessages/index.js.map +1 -1
  8. package/account/i18n/i18n.js.map +1 -1
  9. package/account/index.d.ts +2 -2
  10. package/account/index.js +1 -2
  11. package/account/index.js.map +1 -1
  12. package/account/kcContext/KcContext.d.ts +12 -0
  13. package/account/kcContext/KcContext.js.map +1 -1
  14. package/account/kcContext/getKcContextMock.d.ts +24 -0
  15. package/account/kcContext/getKcContextMock.js +28 -0
  16. package/account/kcContext/getKcContextMock.js.map +1 -0
  17. package/account/kcContext/index.d.ts +2 -1
  18. package/account/kcContext/index.js +1 -1
  19. package/account/kcContext/index.js.map +1 -1
  20. package/account/kcContext/kcContextMocks.js +23 -91
  21. package/account/kcContext/kcContextMocks.js.map +1 -1
  22. package/account/pages/Account.js +1 -1
  23. package/account/pages/Account.js.map +1 -1
  24. package/account/pages/Applications.js +2 -2
  25. package/account/pages/Applications.js.map +1 -1
  26. package/account/pages/FederatedIdentity.js +1 -1
  27. package/account/pages/FederatedIdentity.js.map +1 -1
  28. package/account/pages/Log.js +1 -1
  29. package/account/pages/Log.js.map +1 -1
  30. package/account/pages/Password.js +6 -4
  31. package/account/pages/Password.js.map +1 -1
  32. package/account/pages/Sessions.js +1 -1
  33. package/account/pages/Sessions.js.map +1 -1
  34. package/account/pages/Totp.js +1 -1
  35. package/account/pages/Totp.js.map +1 -1
  36. package/bin/main.js +174 -162
  37. package/lib/BASE_URL.js.map +1 -1
  38. package/login/Fallback.js.map +1 -1
  39. package/login/Template.js +7 -7
  40. package/login/Template.js.map +1 -1
  41. package/login/UserProfileFormFields.js +24 -68
  42. package/login/UserProfileFormFields.js.map +1 -1
  43. package/login/i18n/baseMessages/index.js.map +1 -1
  44. package/login/i18n/i18n.d.ts +1 -1
  45. package/login/i18n/i18n.js +1 -1
  46. package/login/i18n/i18n.js.map +1 -1
  47. package/login/index.d.ts +2 -3
  48. package/login/index.js +1 -2
  49. package/login/index.js.map +1 -1
  50. package/login/kcContext/KcContext.d.ts +23 -13
  51. package/login/kcContext/KcContext.js.map +1 -1
  52. package/login/kcContext/getKcContextMock.d.ts +24 -0
  53. package/login/kcContext/getKcContextMock.js +28 -0
  54. package/login/kcContext/getKcContextMock.js.map +1 -0
  55. package/login/kcContext/index.d.ts +2 -1
  56. package/login/kcContext/index.js +1 -1
  57. package/login/kcContext/index.js.map +1 -1
  58. package/login/kcContext/kcContextMocks.js +29 -103
  59. package/login/kcContext/kcContextMocks.js.map +1 -1
  60. package/login/lib/useDownloadTerms.js +8 -14
  61. package/login/lib/useDownloadTerms.js.map +1 -1
  62. package/login/lib/useGetClassName.js +1 -1
  63. package/login/lib/useGetClassName.js.map +1 -1
  64. package/login/lib/useUserProfileForm.d.ts +9 -1
  65. package/login/lib/useUserProfileForm.js +94 -15
  66. package/login/lib/useUserProfileForm.js.map +1 -1
  67. package/login/pages/Code.js +1 -1
  68. package/login/pages/Code.js.map +1 -1
  69. package/login/pages/DeleteAccountConfirm.js +2 -2
  70. package/login/pages/DeleteAccountConfirm.js.map +1 -1
  71. package/login/pages/DeleteCredential.js +1 -1
  72. package/login/pages/DeleteCredential.js.map +1 -1
  73. package/login/pages/Error.js +1 -1
  74. package/login/pages/Error.js.map +1 -1
  75. package/login/pages/FrontchannelLogout.js +1 -1
  76. package/login/pages/FrontchannelLogout.js.map +1 -1
  77. package/login/pages/IdpReviewUserProfile.js +1 -1
  78. package/login/pages/IdpReviewUserProfile.js.map +1 -1
  79. package/login/pages/Info.js +5 -5
  80. package/login/pages/Info.js.map +1 -1
  81. package/login/pages/Login.js +4 -4
  82. package/login/pages/Login.js.map +1 -1
  83. package/login/pages/LoginConfigTotp.js +2 -2
  84. package/login/pages/LoginConfigTotp.js.map +1 -1
  85. package/login/pages/LoginIdpLinkConfirm.js +1 -1
  86. package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
  87. package/login/pages/LoginIdpLinkEmail.js +1 -1
  88. package/login/pages/LoginIdpLinkEmail.js.map +1 -1
  89. package/login/pages/LoginOauth2DeviceVerifyUserCode.js +1 -1
  90. package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
  91. package/login/pages/LoginOauthGrant.js +2 -2
  92. package/login/pages/LoginOauthGrant.js.map +1 -1
  93. package/login/pages/LoginOtp.js +1 -1
  94. package/login/pages/LoginOtp.js.map +1 -1
  95. package/login/pages/LoginPageExpired.js +1 -1
  96. package/login/pages/LoginPageExpired.js.map +1 -1
  97. package/login/pages/LoginPassword.js +3 -3
  98. package/login/pages/LoginPassword.js.map +1 -1
  99. package/login/pages/LoginRecoveryAuthnCodeConfig.js +10 -10
  100. package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
  101. package/login/pages/LoginRecoveryAuthnCodeInput.js +1 -1
  102. package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
  103. package/login/pages/LoginResetOtp.js +1 -1
  104. package/login/pages/LoginResetOtp.js.map +1 -1
  105. package/login/pages/LoginResetPassword.js +2 -2
  106. package/login/pages/LoginResetPassword.js.map +1 -1
  107. package/login/pages/LoginUpdatePassword.js +3 -3
  108. package/login/pages/LoginUpdatePassword.js.map +1 -1
  109. package/login/pages/LoginUpdateProfile.js +4 -2
  110. package/login/pages/LoginUpdateProfile.js.map +1 -1
  111. package/login/pages/LoginUsername.js +3 -3
  112. package/login/pages/LoginUsername.js.map +1 -1
  113. package/login/pages/LoginVerifyEmail.js +1 -1
  114. package/login/pages/LoginVerifyEmail.js.map +1 -1
  115. package/login/pages/LoginX509Info.js +1 -1
  116. package/login/pages/LoginX509Info.js.map +1 -1
  117. package/login/pages/LogoutConfirm.js +1 -1
  118. package/login/pages/LogoutConfirm.js.map +1 -1
  119. package/login/pages/Register.js +8 -4
  120. package/login/pages/Register.js.map +1 -1
  121. package/login/pages/SamlPostForm.js +1 -1
  122. package/login/pages/SamlPostForm.js.map +1 -1
  123. package/login/pages/SelectAuthenticator.js +2 -2
  124. package/login/pages/SelectAuthenticator.js.map +1 -1
  125. package/login/pages/Terms.js +1 -1
  126. package/login/pages/Terms.js.map +1 -1
  127. package/login/pages/UpdateEmail.js +5 -3
  128. package/login/pages/UpdateEmail.js.map +1 -1
  129. package/login/pages/WebauthnAuthenticate.js +8 -8
  130. package/login/pages/WebauthnAuthenticate.js.map +1 -1
  131. package/login/pages/WebauthnError.js +2 -2
  132. package/login/pages/WebauthnError.js.map +1 -1
  133. package/login/pages/WebauthnRegister.js +5 -5
  134. package/login/pages/WebauthnRegister.js.map +1 -1
  135. package/package.json +26 -38
  136. package/src/PUBLIC_URL.ts +1 -1
  137. package/src/account/Template.tsx +2 -3
  138. package/src/account/index.ts +2 -2
  139. package/src/account/kcContext/KcContext.ts +19 -1
  140. package/src/account/kcContext/getKcContextMock.ts +80 -0
  141. package/src/account/kcContext/index.ts +2 -1
  142. package/src/account/kcContext/kcContextMocks.ts +26 -91
  143. package/src/bin/copy-keycloak-resources-to-public.ts +1 -4
  144. package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +19 -11
  145. package/src/bin/start-keycloak/start-keycloak.ts +18 -5
  146. package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +25 -25
  147. package/src/login/Template.tsx +4 -5
  148. package/src/login/UserProfileFormFields.tsx +28 -80
  149. package/src/login/i18n/i18n.tsx +3 -3
  150. package/src/login/index.ts +6 -3
  151. package/src/login/kcContext/KcContext.ts +43 -31
  152. package/src/login/kcContext/getKcContextMock.ts +80 -0
  153. package/src/login/kcContext/index.ts +7 -1
  154. package/src/login/kcContext/kcContextMocks.ts +92 -165
  155. package/src/login/lib/useDownloadTerms.ts +10 -24
  156. package/src/login/lib/useGetClassName.ts +1 -1
  157. package/src/login/lib/useUserProfileForm.tsx +117 -13
  158. package/src/login/pages/LoginConfigTotp.tsx +1 -1
  159. package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +7 -8
  160. package/src/login/pages/WebauthnAuthenticate.tsx +2 -3
  161. package/src/login/pages/WebauthnRegister.tsx +2 -3
  162. package/src/tools/ExtractAfterStartingWith.ts +4 -0
  163. package/src/tools/StatefulObservable/hooks/useRerenderOnChange.ts +4 -4
  164. package/src/tools/ValueOf.ts +2 -0
  165. package/src/tools/deepAssign.ts +51 -20
  166. package/src/tools/structuredCloneButFunctions.ts +24 -0
  167. package/src/tools/useInsertLinkTags.ts +78 -87
  168. package/src/tools/useInsertScriptTags.ts +69 -78
  169. package/src/tools/useOnFirstMount.ts +18 -0
  170. package/tools/Array.prototype.every.js.map +1 -1
  171. package/tools/ExtractAfterStartingWith.d.ts +1 -0
  172. package/tools/ExtractAfterStartingWith.js +2 -0
  173. package/tools/ExtractAfterStartingWith.js.map +1 -0
  174. package/tools/HTMLElement.prototype.prepend.js.map +1 -1
  175. package/tools/StatefulObservable/StatefulObservable.js.map +1 -1
  176. package/tools/StatefulObservable/hooks/useRerenderOnChange.d.ts +1 -1
  177. package/tools/StatefulObservable/hooks/useRerenderOnChange.js +4 -4
  178. package/tools/StatefulObservable/hooks/useRerenderOnChange.js.map +1 -1
  179. package/tools/ValueOf.d.ts +2 -0
  180. package/tools/ValueOf.js +2 -0
  181. package/tools/ValueOf.js.map +1 -0
  182. package/tools/clsx.js.map +1 -1
  183. package/tools/deepAssign.d.ts +1 -0
  184. package/tools/deepAssign.js +39 -16
  185. package/tools/deepAssign.js.map +1 -1
  186. package/tools/formatNumber.js.map +1 -1
  187. package/tools/structuredCloneButFunctions.d.ts +7 -0
  188. package/tools/structuredCloneButFunctions.js +19 -0
  189. package/tools/structuredCloneButFunctions.js.map +1 -0
  190. package/tools/useInsertLinkTags.d.ts +11 -6
  191. package/tools/useInsertLinkTags.js +53 -53
  192. package/tools/useInsertLinkTags.js.map +1 -1
  193. package/tools/useInsertScriptTags.d.ts +15 -6
  194. package/tools/useInsertScriptTags.js +56 -64
  195. package/tools/useInsertScriptTags.js.map +1 -1
  196. package/tools/useOnFirstMount.d.ts +2 -0
  197. package/tools/useOnFirstMount.js +15 -0
  198. package/tools/useOnFirstMount.js.map +1 -0
  199. package/tools/useSetClassName.js.map +1 -1
  200. package/vite-plugin/index.js +66 -64
  201. package/account/kcContext/createGetKcContext.d.ts +0 -19
  202. package/account/kcContext/createGetKcContext.js +0 -78
  203. package/account/kcContext/createGetKcContext.js.map +0 -1
  204. package/account/kcContext/getKcContext.d.ts +0 -13
  205. package/account/kcContext/getKcContext.js +0 -13
  206. package/account/kcContext/getKcContext.js.map +0 -1
  207. package/account/kcContext/getKcContextFromWindow.d.ts +0 -10
  208. package/account/kcContext/getKcContextFromWindow.js +0 -5
  209. package/account/kcContext/getKcContextFromWindow.js.map +0 -1
  210. package/login/kcContext/createGetKcContext.d.ts +0 -19
  211. package/login/kcContext/createGetKcContext.js +0 -117
  212. package/login/kcContext/createGetKcContext.js.map +0 -1
  213. package/login/kcContext/getKcContext.d.ts +0 -13
  214. package/login/kcContext/getKcContext.js +0 -13
  215. package/login/kcContext/getKcContext.js.map +0 -1
  216. package/login/kcContext/getKcContextFromWindow.d.ts +0 -10
  217. package/login/kcContext/getKcContextFromWindow.js +0 -5
  218. package/login/kcContext/getKcContextFromWindow.js.map +0 -1
  219. package/src/account/kcContext/createGetKcContext.ts +0 -134
  220. package/src/account/kcContext/getKcContext.ts +0 -23
  221. package/src/account/kcContext/getKcContextFromWindow.ts +0 -15
  222. package/src/login/kcContext/createGetKcContext.ts +0 -206
  223. package/src/login/kcContext/getKcContext.ts +0 -23
  224. package/src/login/kcContext/getKcContextFromWindow.ts +0 -15
  225. package/src/tools/AndByDiscriminatingKey.ts +0 -31
  226. package/src/tools/deepClone.ts +0 -19
  227. package/src/tools/memoize.ts +0 -55
  228. package/tools/AndByDiscriminatingKey.d.ts +0 -5
  229. package/tools/AndByDiscriminatingKey.js +0 -2
  230. package/tools/AndByDiscriminatingKey.js.map +0 -1
  231. package/tools/deepClone.d.ts +0 -2
  232. package/tools/deepClone.js +0 -14
  233. package/tools/deepClone.js.map +0 -1
  234. package/tools/memoize.d.ts +0 -7
  235. package/tools/memoize.js +0 -38
  236. package/tools/memoize.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keycloakify",
3
- "version": "10.0.0-rc.22",
3
+ "version": "10.0.0-rc.24",
4
4
  "description": "Create Keycloak themes using React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -130,15 +130,9 @@
130
130
  "account/kcContext/KcContext.d.ts",
131
131
  "account/kcContext/KcContext.js",
132
132
  "account/kcContext/KcContext.js.map",
133
- "account/kcContext/createGetKcContext.d.ts",
134
- "account/kcContext/createGetKcContext.js",
135
- "account/kcContext/createGetKcContext.js.map",
136
- "account/kcContext/getKcContext.d.ts",
137
- "account/kcContext/getKcContext.js",
138
- "account/kcContext/getKcContext.js.map",
139
- "account/kcContext/getKcContextFromWindow.d.ts",
140
- "account/kcContext/getKcContextFromWindow.js",
141
- "account/kcContext/getKcContextFromWindow.js.map",
133
+ "account/kcContext/getKcContextMock.d.ts",
134
+ "account/kcContext/getKcContextMock.js",
135
+ "account/kcContext/getKcContextMock.js.map",
142
136
  "account/kcContext/index.d.ts",
143
137
  "account/kcContext/index.js",
144
138
  "account/kcContext/index.js.map",
@@ -289,15 +283,9 @@
289
283
  "login/kcContext/KcContext.d.ts",
290
284
  "login/kcContext/KcContext.js",
291
285
  "login/kcContext/KcContext.js.map",
292
- "login/kcContext/createGetKcContext.d.ts",
293
- "login/kcContext/createGetKcContext.js",
294
- "login/kcContext/createGetKcContext.js.map",
295
- "login/kcContext/getKcContext.d.ts",
296
- "login/kcContext/getKcContext.js",
297
- "login/kcContext/getKcContext.js.map",
298
- "login/kcContext/getKcContextFromWindow.d.ts",
299
- "login/kcContext/getKcContextFromWindow.js",
300
- "login/kcContext/getKcContextFromWindow.js.map",
286
+ "login/kcContext/getKcContextMock.d.ts",
287
+ "login/kcContext/getKcContextMock.js",
288
+ "login/kcContext/getKcContextMock.js.map",
301
289
  "login/kcContext/index.d.ts",
302
290
  "login/kcContext/index.js",
303
291
  "login/kcContext/index.js.map",
@@ -454,9 +442,7 @@
454
442
  "src/account/i18n/index.ts",
455
443
  "src/account/index.ts",
456
444
  "src/account/kcContext/KcContext.ts",
457
- "src/account/kcContext/createGetKcContext.ts",
458
- "src/account/kcContext/getKcContext.ts",
459
- "src/account/kcContext/getKcContextFromWindow.ts",
445
+ "src/account/kcContext/getKcContextMock.ts",
460
446
  "src/account/kcContext/index.ts",
461
447
  "src/account/kcContext/kcContextMocks.ts",
462
448
  "src/account/lib/useGetClassName.ts",
@@ -581,9 +567,7 @@
581
567
  "src/login/i18n/index.ts",
582
568
  "src/login/index.ts",
583
569
  "src/login/kcContext/KcContext.ts",
584
- "src/login/kcContext/createGetKcContext.ts",
585
- "src/login/kcContext/getKcContext.ts",
586
- "src/login/kcContext/getKcContextFromWindow.ts",
570
+ "src/login/kcContext/getKcContextMock.ts",
587
571
  "src/login/kcContext/index.ts",
588
572
  "src/login/kcContext/kcContextMocks.ts",
589
573
  "src/login/lib/useDownloadTerms.ts",
@@ -624,9 +608,9 @@
624
608
  "src/login/pages/WebauthnAuthenticate.tsx",
625
609
  "src/login/pages/WebauthnError.tsx",
626
610
  "src/login/pages/WebauthnRegister.tsx",
627
- "src/tools/AndByDiscriminatingKey.ts",
628
611
  "src/tools/Array.prototype.every.ts",
629
612
  "src/tools/DeepPartial.ts",
613
+ "src/tools/ExtractAfterStartingWith.ts",
630
614
  "src/tools/HTMLElement.prototype.prepend.ts",
631
615
  "src/tools/LazyOrNot.ts",
632
616
  "src/tools/Markdown.ts",
@@ -636,32 +620,33 @@
636
620
  "src/tools/StatefulObservable/hooks/useObservable.ts",
637
621
  "src/tools/StatefulObservable/hooks/useRerenderOnChange.ts",
638
622
  "src/tools/StatefulObservable/index.ts",
623
+ "src/tools/ValueOf.ts",
639
624
  "src/tools/assert.ts",
640
625
  "src/tools/clsx.ts",
641
626
  "src/tools/deepAssign.ts",
642
- "src/tools/deepClone.ts",
643
627
  "src/tools/emailRegExp.ts",
644
628
  "src/tools/formatNumber.ts",
645
- "src/tools/memoize.ts",
646
629
  "src/tools/pathBasename.ts",
630
+ "src/tools/structuredCloneButFunctions.ts",
647
631
  "src/tools/useConst.ts",
648
632
  "src/tools/useConstCallback.ts",
649
633
  "src/tools/useInsertLinkTags.ts",
650
634
  "src/tools/useInsertScriptTags.ts",
635
+ "src/tools/useOnFirstMount.ts",
651
636
  "src/tools/useSetClassName.ts",
652
637
  "src/tsconfig.json",
653
638
  "src/vite-plugin/index.ts",
654
639
  "src/vite-plugin/tsconfig.json",
655
640
  "src/vite-plugin/vite-plugin.ts",
656
- "tools/AndByDiscriminatingKey.d.ts",
657
- "tools/AndByDiscriminatingKey.js",
658
- "tools/AndByDiscriminatingKey.js.map",
659
641
  "tools/Array.prototype.every.d.ts",
660
642
  "tools/Array.prototype.every.js",
661
643
  "tools/Array.prototype.every.js.map",
662
644
  "tools/DeepPartial.d.ts",
663
645
  "tools/DeepPartial.js",
664
646
  "tools/DeepPartial.js.map",
647
+ "tools/ExtractAfterStartingWith.d.ts",
648
+ "tools/ExtractAfterStartingWith.js",
649
+ "tools/ExtractAfterStartingWith.js.map",
665
650
  "tools/HTMLElement.prototype.prepend.d.ts",
666
651
  "tools/HTMLElement.prototype.prepend.js",
667
652
  "tools/HTMLElement.prototype.prepend.js.map",
@@ -686,6 +671,9 @@
686
671
  "tools/StatefulObservable/index.d.ts",
687
672
  "tools/StatefulObservable/index.js",
688
673
  "tools/StatefulObservable/index.js.map",
674
+ "tools/ValueOf.d.ts",
675
+ "tools/ValueOf.js",
676
+ "tools/ValueOf.js.map",
689
677
  "tools/assert.d.ts",
690
678
  "tools/assert.js",
691
679
  "tools/assert.js.map",
@@ -695,21 +683,18 @@
695
683
  "tools/deepAssign.d.ts",
696
684
  "tools/deepAssign.js",
697
685
  "tools/deepAssign.js.map",
698
- "tools/deepClone.d.ts",
699
- "tools/deepClone.js",
700
- "tools/deepClone.js.map",
701
686
  "tools/emailRegExp.d.ts",
702
687
  "tools/emailRegExp.js",
703
688
  "tools/emailRegExp.js.map",
704
689
  "tools/formatNumber.d.ts",
705
690
  "tools/formatNumber.js",
706
691
  "tools/formatNumber.js.map",
707
- "tools/memoize.d.ts",
708
- "tools/memoize.js",
709
- "tools/memoize.js.map",
710
692
  "tools/pathBasename.d.ts",
711
693
  "tools/pathBasename.js",
712
694
  "tools/pathBasename.js.map",
695
+ "tools/structuredCloneButFunctions.d.ts",
696
+ "tools/structuredCloneButFunctions.js",
697
+ "tools/structuredCloneButFunctions.js.map",
713
698
  "tools/useConst.d.ts",
714
699
  "tools/useConst.js",
715
700
  "tools/useConst.js.map",
@@ -722,6 +707,9 @@
722
707
  "tools/useInsertScriptTags.d.ts",
723
708
  "tools/useInsertScriptTags.js",
724
709
  "tools/useInsertScriptTags.js.map",
710
+ "tools/useOnFirstMount.d.ts",
711
+ "tools/useOnFirstMount.js",
712
+ "tools/useOnFirstMount.js.map",
725
713
  "tools/useSetClassName.d.ts",
726
714
  "tools/useSetClassName.js",
727
715
  "tools/useSetClassName.js.map",
@@ -803,7 +791,7 @@
803
791
  "ts-node": "^10.9.2",
804
792
  "tsc-alias": "^1.8.10",
805
793
  "tss-react": "^4.9.10",
806
- "typescript": "^5.4.5",
794
+ "typescript": "^4.9.1-beta",
807
795
  "vite": "^5.2.11",
808
796
  "vitest": "^0.29.8",
809
797
  "yauzl": "^2.10.0",
package/src/PUBLIC_URL.ts CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  import { assert } from "tsafe/assert";
6
6
 
7
7
  /**
8
- * This is an equivalent of process.env.PUBLIC_URL thay you can use in Webpack projects.
8
+ * This is an equivalent of process.env.PUBLIC_URL that you can use in Webpack projects.
9
9
  * This works both in your main app and in your Keycloak theme.
10
10
  */
11
11
  export const PUBLIC_URL = (() => {
@@ -2,14 +2,12 @@ import { useEffect } from "react";
2
2
  import { clsx } from "keycloakify/tools/clsx";
3
3
  import { type TemplateProps } from "keycloakify/account/TemplateProps";
4
4
  import { useGetClassName } from "keycloakify/account/lib/useGetClassName";
5
- import { createUseInsertLinkTags } from "keycloakify/tools/useInsertLinkTags";
5
+ import { useInsertLinkTags } from "keycloakify/tools/useInsertLinkTags";
6
6
  import { useSetClassName } from "keycloakify/tools/useSetClassName";
7
7
  import type { KcContext } from "./kcContext";
8
8
  import type { I18n } from "./i18n";
9
9
  import { assert } from "keycloakify/tools/assert";
10
10
 
11
- const { useInsertLinkTags } = createUseInsertLinkTags();
12
-
13
11
  export default function Template(props: TemplateProps<KcContext, I18n>) {
14
12
  const { kcContext, i18n, doUseDefaultCss, active, classes, children } = props;
15
13
 
@@ -46,6 +44,7 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
46
44
  }, []);
47
45
 
48
46
  const { areAllStyleSheetsLoaded } = useInsertLinkTags({
47
+ componentOrHookName: "Template",
49
48
  hrefs: !doUseDefaultCss
50
49
  ? []
51
50
  : [
@@ -2,9 +2,9 @@ import Fallback from "keycloakify/account/Fallback";
2
2
 
3
3
  export default Fallback;
4
4
 
5
- export { getKcContext } from "keycloakify/account/kcContext/getKcContext";
6
- export { createGetKcContext } from "keycloakify/account/kcContext/createGetKcContext";
7
5
  export type { AccountThemePageId as PageId } from "keycloakify/bin/shared/constants";
8
6
  export { createUseI18n } from "keycloakify/account/i18n/i18n";
7
+ export type { ExtendKcContext } from "keycloakify/account/kcContext";
8
+ export { createGetKcContextMock } from "keycloakify/account/kcContext";
9
9
 
10
10
  export type { PageProps } from "keycloakify/account/pages/PageProps";
@@ -1,6 +1,24 @@
1
+ import type { ThemeType, AccountThemePageId } from "keycloakify/bin/shared/constants";
2
+ import type { ValueOf } from "keycloakify/tools/ValueOf";
1
3
  import { assert } from "tsafe/assert";
2
4
  import type { Equals } from "tsafe";
3
- import type { ThemeType, AccountThemePageId } from "keycloakify/bin/shared/constants";
5
+
6
+ export type ExtendKcContext<
7
+ KcContextExtraProperties extends { properties?: Record<string, string | undefined> },
8
+ KcContextExtraPropertiesPerPage extends Record<string, Record<string, unknown>>
9
+ > = ValueOf<{
10
+ [PageId in keyof KcContextExtraPropertiesPerPage | KcContext["pageId"]]: Extract<
11
+ KcContext,
12
+ { pageId: PageId }
13
+ > extends never
14
+ ? KcContext.Common &
15
+ KcContextExtraProperties & {
16
+ pageId: PageId;
17
+ } & KcContextExtraPropertiesPerPage[PageId]
18
+ : Extract<KcContext, { pageId: PageId }> &
19
+ KcContextExtraProperties &
20
+ KcContextExtraPropertiesPerPage[PageId];
21
+ }>;
4
22
 
5
23
  export type KcContext =
6
24
  | KcContext.Password
@@ -0,0 +1,80 @@
1
+ import type { ExtendKcContext, KcContext as KcContextBase } from "./KcContext";
2
+ import type { AccountThemePageId } from "keycloakify/bin/shared/constants";
3
+ import type { DeepPartial } from "keycloakify/tools/DeepPartial";
4
+ import { deepAssign } from "keycloakify/tools/deepAssign";
5
+ import { structuredCloneButFunctions } from "keycloakify/tools/structuredCloneButFunctions";
6
+ import { kcContextMocks, kcContextCommonMock } from "./kcContextMocks";
7
+ import { exclude } from "tsafe/exclude";
8
+
9
+ export function createGetKcContextMock<
10
+ KcContextExtraProperties extends { properties?: Record<string, string | undefined> },
11
+ KcContextExtraPropertiesPerPage extends Record<
12
+ `${string}.ftl`,
13
+ Record<string, unknown>
14
+ >
15
+ >(params: {
16
+ kcContextExtraProperties: KcContextExtraProperties;
17
+ kcContextExtraPropertiesPerPage: KcContextExtraPropertiesPerPage;
18
+ overrides?: DeepPartial<KcContextExtraProperties & KcContextBase.Common>;
19
+ overridesPerPage?: {
20
+ [PageId in
21
+ | AccountThemePageId
22
+ | keyof KcContextExtraPropertiesPerPage]?: DeepPartial<
23
+ Extract<
24
+ ExtendKcContext<
25
+ KcContextExtraProperties,
26
+ KcContextExtraPropertiesPerPage
27
+ >,
28
+ { pageId: PageId }
29
+ >
30
+ >;
31
+ };
32
+ }) {
33
+ const {
34
+ kcContextExtraProperties,
35
+ kcContextExtraPropertiesPerPage,
36
+ overrides: overrides_global,
37
+ overridesPerPage: overridesPerPage_global
38
+ } = params;
39
+
40
+ type KcContext = ExtendKcContext<
41
+ KcContextExtraProperties,
42
+ KcContextExtraPropertiesPerPage
43
+ >;
44
+
45
+ function getKcContextMock<
46
+ PageId extends AccountThemePageId | keyof KcContextExtraPropertiesPerPage
47
+ >(params: {
48
+ pageId: PageId;
49
+ overrides?: DeepPartial<Extract<KcContext, { pageId: PageId }>>;
50
+ }): Extract<KcContext, { pageId: PageId }> {
51
+ const { pageId, overrides } = params;
52
+
53
+ const kcContextMock = structuredCloneButFunctions(
54
+ kcContextMocks.find(kcContextMock => kcContextMock.pageId === pageId) ?? {
55
+ ...kcContextCommonMock,
56
+ pageId
57
+ }
58
+ );
59
+
60
+ [
61
+ kcContextExtraProperties,
62
+ kcContextExtraPropertiesPerPage[pageId],
63
+ overrides_global,
64
+ overridesPerPage_global?.[pageId],
65
+ overrides
66
+ ]
67
+ .filter(exclude(undefined))
68
+ .forEach(overrides =>
69
+ deepAssign({
70
+ target: kcContextMock,
71
+ source: overrides
72
+ })
73
+ );
74
+
75
+ // @ts-expect-error
76
+ return kcContextMock;
77
+ }
78
+
79
+ return { getKcContextMock };
80
+ }
@@ -1 +1,2 @@
1
- export type { KcContext } from "./KcContext";
1
+ export type { ExtendKcContext, KcContext } from "./KcContext";
2
+ export { createGetKcContextMock } from "./getKcContextMock";
@@ -40,98 +40,33 @@ export const kcContextCommonMock: KcContext.Common = {
40
40
  locale: {
41
41
  supported: [
42
42
  /* spell-checker: disable */
43
- {
44
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=de",
45
- label: "Deutsch",
46
- languageTag: "de"
47
- },
48
- {
49
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=no",
50
- label: "Norsk",
51
- languageTag: "no"
52
- },
53
- {
54
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=ru",
55
- label: "Русский",
56
- languageTag: "ru"
57
- },
58
- {
59
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=sv",
60
- label: "Svenska",
61
- languageTag: "sv"
62
- },
63
- {
64
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=pt-BR",
65
- label: "Português (Brasil)",
66
- languageTag: "pt-BR"
67
- },
68
- {
69
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=lt",
70
- label: "Lietuvių",
71
- languageTag: "lt"
72
- },
73
- {
74
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=en",
75
- label: "English",
76
- languageTag: "en"
77
- },
78
- {
79
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=it",
80
- label: "Italiano",
81
- languageTag: "it"
82
- },
83
- {
84
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=fr",
85
- label: "Français",
86
- languageTag: "fr"
87
- },
88
- {
89
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=zh-CN",
90
- label: "中文简体",
91
- languageTag: "zh-CN"
92
- },
93
- {
94
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=es",
95
- label: "Español",
96
- languageTag: "es"
97
- },
98
- {
99
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=cs",
100
- label: "Čeština",
101
- languageTag: "cs"
102
- },
103
- {
104
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=ja",
105
- label: "日本語",
106
- languageTag: "ja"
107
- },
108
- {
109
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=sk",
110
- label: "Slovenčina",
111
- languageTag: "sk"
112
- },
113
- {
114
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=pl",
115
- label: "Polski",
116
- languageTag: "pl"
117
- },
118
- {
119
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=ca",
120
- label: "Català",
121
- languageTag: "ca"
122
- },
123
- {
124
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=nl",
125
- label: "Nederlands",
126
- languageTag: "nl"
127
- },
128
- {
129
- url: "/auth/realms/myrealm/login-actions/authenticate?client_id=account&tab_id=HoAx28ja4xg&execution=ee6c2834-46a4-4a20-a1b6-f6d6f6451b36&kc_locale=tr",
130
- label: "Türkçe",
131
- languageTag: "tr"
132
- }
43
+ ["de", "Deutsch"],
44
+ ["no", "Norsk"],
45
+ ["ru", "Русский"],
46
+ ["sv", "Svenska"],
47
+ ["pt-BR", "Português (Brasil)"],
48
+ ["lt", "Lietuvių"],
49
+ ["en", "English"],
50
+ ["it", "Italiano"],
51
+ ["fr", "Français"],
52
+ ["zh-CN", "中文简体"],
53
+ ["es", "Español"],
54
+ ["cs", "Čeština"],
55
+ ["ja", "日本語"],
56
+ ["sk", "Slovenčina"],
57
+ ["pl", "Polski"],
58
+ ["ca", "Català"],
59
+ ["nl", "Nederlands"],
60
+ ["tr", "Türkçe"]
133
61
  /* spell-checker: enable */
134
- ],
62
+ ].map(
63
+ ([languageTag, label]) =>
64
+ ({
65
+ languageTag,
66
+ label,
67
+ url: "https://gist.github.com/garronej/52baaca1bb925f2296ab32741e062b8e"
68
+ }) as const
69
+ ),
135
70
  currentLanguageTag: "en"
136
71
  },
137
72
  features: {
@@ -8,9 +8,6 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
8
8
  const buildOptions = readBuildOptions({ cliCommandOptions });
9
9
 
10
10
  await copyKeycloakResourcesToPublic({
11
- buildOptions: {
12
- ...buildOptions,
13
- publicDirPath: buildOptions.reactAppRootDirPath
14
- }
11
+ buildOptions
15
12
  });
16
13
  }
@@ -193,7 +193,7 @@ function decodeHtmlEntities(htmlStr){
193
193
  decodeHtmlEntities.element = element;
194
194
  }
195
195
  element.innerHTML = htmlStr;
196
- return textarea.value;
196
+ return element.value;
197
197
  }
198
198
 
199
199
  })();
@@ -266,26 +266,34 @@ function decodeHtmlEntities(htmlStr){
266
266
  !["name", "displayName", "displayNameHtml", "internationalizationEnabled", "registrationEmailAsUsername" ]?seq_contains(key)
267
267
  ) || (
268
268
  "applications.ftl" == pageId &&
269
- is_subpath(path, ["applications", "applications"]) &&
270
269
  (
271
270
  key == "realm" ||
272
271
  key == "container"
273
- )
272
+ ) &&
273
+ is_subpath(path, ["applications", "applications"])
274
274
  ) || (
275
- are_same_path(path, ["user"]) &&
276
- key == "delegateForUpdate"
275
+ key == "delegateForUpdate" &&
276
+ are_same_path(path, ["user"])
277
277
  ) || (
278
278
  <#-- Security audit forwarded by Garth (Gmail) -->
279
- are_same_path(path, ["client", "attributes"]) &&
280
- key == "saml.signing.private.key"
279
+ key == "saml.signing.private.key" &&
280
+ are_same_path(path, ["client", "attributes"])
281
281
  ) || (
282
282
  <#-- See: https://github.com/keycloakify/keycloakify/issues/534 -->
283
- are_same_path(path, ["login"]) &&
284
- key == "password"
283
+ key == "password" &&
284
+ are_same_path(path, ["login"])
285
285
  ) || (
286
286
  <#-- Remove realmAttributes added by https://github.com/jcputney/keycloak-theme-additional-info-extension for peace of mind. -->
287
- are_same_path(path, []) &&
288
- key == "realmAttributes"
287
+ key == "realmAttributes" &&
288
+ are_same_path(path, [])
289
+ ) || (
290
+ <#-- attributesByName adds a lot of noise to the output and is not needed -->
291
+ key == "attributes" &&
292
+ are_same_path(path, ["profile"])
293
+ ) || (
294
+ <#-- We already have the attributes in profile speedup the rendering by filtering it out from the register object -->
295
+ (key == "attributes" || key == "attributesByName") &&
296
+ are_same_path(path, ["register"])
289
297
  )
290
298
  >
291
299
  <#local out_seq += ["/*" + path?join(".") + "." + key + " excluded*/"]>
@@ -417,7 +417,7 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
417
417
  `- password: ${chalk.cyan.bold("password123")}`,
418
418
  "",
419
419
  `Watching for changes in ${chalk.bold(
420
- `.${pathSep}${pathRelative(process.cwd(), srcDirPath)}`
420
+ `.${pathSep}${pathRelative(process.cwd(), buildOptions.reactAppRootDirPath)}`
421
421
  )}`
422
422
  ].join("\n")
423
423
  );
@@ -455,10 +455,23 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
455
455
  const { waitForDebounce } = waitForDebounceFactory({ delay: 400 });
456
456
 
457
457
  chokidar
458
- .watch([srcDirPath, pathJoin(getThisCodebaseRootDirPath(), "src")], {
459
- ignoreInitial: true
460
- })
461
- .on("all", async () => {
458
+ .watch(
459
+ [
460
+ srcDirPath,
461
+ buildOptions.publicDirPath,
462
+ pathJoin(buildOptions.reactAppRootDirPath, "package.json"),
463
+ pathJoin(buildOptions.reactAppRootDirPath, "vite.config.ts"),
464
+ pathJoin(buildOptions.reactAppRootDirPath, "vite.config.js"),
465
+ pathJoin(buildOptions.reactAppRootDirPath, "index.html"),
466
+ pathJoin(getThisCodebaseRootDirPath(), "src")
467
+ ],
468
+ {
469
+ ignoreInitial: true
470
+ }
471
+ )
472
+ .on("all", async (...[, filePath]) => {
473
+ console.log(`Detected changes in ${filePath}`);
474
+
462
475
  await waitForDebounce();
463
476
 
464
477
  runFullBuild();
@@ -14,6 +14,8 @@ export function getNpmWorkspaceRootDirPath(params: {
14
14
  pathJoin(...[reactAppRootDirPath, ...Array(depth).fill("..")])
15
15
  );
16
16
 
17
+ assert(cwd !== pathSep, "NPM workspace not found");
18
+
17
19
  try {
18
20
  child_process.execSync("npm config get", {
19
21
  cwd,
@@ -21,48 +23,46 @@ export function getNpmWorkspaceRootDirPath(params: {
21
23
  });
22
24
  } catch (error) {
23
25
  if (String(error).includes("ENOWORKSPACES")) {
24
- assert(cwd !== pathSep, "NPM workspace not found");
25
-
26
26
  return callee(depth + 1);
27
27
  }
28
28
 
29
29
  throw error;
30
30
  }
31
31
 
32
- const { isExpectedDependencyFound } = (() => {
33
- const packageJsonFilePath = pathJoin(cwd, "package.json");
32
+ const packageJsonFilePath = pathJoin(cwd, "package.json");
34
33
 
35
- assert(fs.existsSync(packageJsonFilePath));
34
+ if (!fs.existsSync(packageJsonFilePath)) {
35
+ return callee(depth + 1);
36
+ }
36
37
 
37
- const parsedPackageJson = JSON.parse(
38
- fs.readFileSync(packageJsonFilePath).toString("utf8")
39
- );
38
+ assert(fs.existsSync(packageJsonFilePath));
40
39
 
41
- let isExpectedDependencyFound = false;
40
+ const parsedPackageJson = JSON.parse(
41
+ fs.readFileSync(packageJsonFilePath).toString("utf8")
42
+ );
42
43
 
43
- for (const dependenciesOrDevDependencies of [
44
- "dependencies",
45
- "devDependencies"
46
- ] as const) {
47
- const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
44
+ let isExpectedDependencyFound = false;
48
45
 
49
- if (dependencies === undefined) {
50
- continue;
51
- }
46
+ for (const dependenciesOrDevDependencies of [
47
+ "dependencies",
48
+ "devDependencies"
49
+ ] as const) {
50
+ const dependencies = parsedPackageJson[dependenciesOrDevDependencies];
52
51
 
53
- assert(dependencies instanceof Object);
52
+ if (dependencies === undefined) {
53
+ continue;
54
+ }
54
55
 
55
- if (dependencies[dependencyExpected] === undefined) {
56
- continue;
57
- }
56
+ assert(dependencies instanceof Object);
58
57
 
59
- isExpectedDependencyFound = true;
58
+ if (dependencies[dependencyExpected] === undefined) {
59
+ continue;
60
60
  }
61
61
 
62
- return { isExpectedDependencyFound };
63
- })();
62
+ isExpectedDependencyFound = true;
63
+ }
64
64
 
65
- if (!isExpectedDependencyFound) {
65
+ if (!isExpectedDependencyFound && parsedPackageJson.name !== dependencyExpected) {
66
66
  return callee(depth + 1);
67
67
  }
68
68