@multiplatform.one/keycloak 0.1.10 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/esm/Authenticated.mjs +25 -0
  2. package/dist/esm/Authenticated.mjs.map +7 -0
  3. package/dist/esm/authConfig.mjs +10 -0
  4. package/dist/esm/authConfig.mjs.map +7 -0
  5. package/dist/esm/hooks/index.mjs +4 -0
  6. package/dist/esm/hooks/index.mjs.map +7 -0
  7. package/dist/esm/hooks/useAuthConfig.mjs +9 -0
  8. package/dist/esm/hooks/useAuthConfig.mjs.map +7 -0
  9. package/dist/esm/hooks/useCurrentRouteName/index.mjs +17 -0
  10. package/dist/esm/hooks/useCurrentRouteName/index.mjs.map +7 -0
  11. package/dist/esm/hooks/useCurrentRouteName/index.native.mjs +12 -0
  12. package/dist/esm/hooks/useCurrentRouteName/index.native.mjs.map +7 -0
  13. package/dist/esm/hooks/useKeycloak/index.mjs +2 -0
  14. package/dist/esm/hooks/useKeycloak/index.mjs.map +7 -0
  15. package/dist/esm/hooks/useKeycloak/useKeycloak.mjs +81 -0
  16. package/dist/esm/hooks/useKeycloak/useKeycloak.mjs.map +7 -0
  17. package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs +108 -0
  18. package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs.map +7 -0
  19. package/dist/esm/hooks/useLogin.mjs +35 -0
  20. package/dist/esm/hooks/useLogin.mjs.map +7 -0
  21. package/dist/esm/index.mjs +5 -0
  22. package/dist/esm/index.mjs.map +7 -0
  23. package/dist/esm/provider/afterAuth.mjs +29 -0
  24. package/dist/esm/provider/afterAuth.mjs.map +7 -0
  25. package/dist/esm/provider/index.mjs +73 -0
  26. package/dist/esm/provider/index.mjs.map +7 -0
  27. package/dist/esm/provider/keycloakProvider.mjs +273 -0
  28. package/dist/esm/provider/keycloakProvider.mjs.map +7 -0
  29. package/dist/esm/provider/keycloakProvider.native.mjs +69 -0
  30. package/dist/esm/provider/keycloakProvider.native.mjs.map +7 -0
  31. package/dist/esm/state/index.mjs +14 -0
  32. package/dist/esm/state/index.mjs.map +7 -0
  33. package/dist/esm/types.mjs +5 -0
  34. package/dist/esm/types.mjs.map +7 -0
  35. package/dist/jsx/Authenticated.mjs +20 -0
  36. package/dist/jsx/Authenticated.mjs.map +7 -0
  37. package/dist/jsx/authConfig.mjs +10 -0
  38. package/dist/jsx/authConfig.mjs.map +7 -0
  39. package/dist/jsx/hooks/index.mjs +4 -0
  40. package/dist/jsx/hooks/index.mjs.map +7 -0
  41. package/dist/jsx/hooks/useAuthConfig.mjs +9 -0
  42. package/dist/jsx/hooks/useAuthConfig.mjs.map +7 -0
  43. package/dist/jsx/hooks/useCurrentRouteName/index.mjs +17 -0
  44. package/dist/jsx/hooks/useCurrentRouteName/index.mjs.map +7 -0
  45. package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs +12 -0
  46. package/dist/jsx/hooks/useCurrentRouteName/index.native.mjs.map +7 -0
  47. package/dist/jsx/hooks/useKeycloak/index.mjs +2 -0
  48. package/dist/jsx/hooks/useKeycloak/index.mjs.map +7 -0
  49. package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs +25 -0
  50. package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs.map +7 -0
  51. package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs +58 -0
  52. package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs.map +7 -0
  53. package/dist/jsx/hooks/useLogin.mjs +33 -0
  54. package/dist/jsx/hooks/useLogin.mjs.map +7 -0
  55. package/dist/jsx/index.mjs +5 -0
  56. package/dist/jsx/index.mjs.map +7 -0
  57. package/dist/jsx/provider/afterAuth.mjs +28 -0
  58. package/dist/jsx/provider/afterAuth.mjs.map +7 -0
  59. package/dist/jsx/provider/index.mjs +20 -0
  60. package/dist/jsx/provider/index.mjs.map +7 -0
  61. package/dist/jsx/provider/keycloakProvider.mjs +158 -0
  62. package/dist/jsx/provider/keycloakProvider.mjs.map +7 -0
  63. package/dist/jsx/provider/keycloakProvider.native.mjs +14 -0
  64. package/dist/jsx/provider/keycloakProvider.native.mjs.map +7 -0
  65. package/dist/jsx/state/index.mjs +17 -0
  66. package/dist/jsx/state/index.mjs.map +7 -0
  67. package/dist/jsx/types.mjs +5 -0
  68. package/dist/jsx/types.mjs.map +7 -0
  69. package/{lib → dist/lib}/Authenticated.d.ts +1 -1
  70. package/dist/lib/Authenticated.js +60 -0
  71. package/dist/lib/Authenticated.js.map +7 -0
  72. package/dist/lib/authConfig.js +35 -0
  73. package/dist/lib/authConfig.js.map +7 -0
  74. package/{lib → dist/lib}/hooks/index.d.ts +3 -3
  75. package/dist/lib/hooks/index.js +27 -0
  76. package/dist/lib/hooks/index.js.map +7 -0
  77. package/dist/lib/hooks/useAuthConfig.js +33 -0
  78. package/dist/lib/hooks/useAuthConfig.js.map +7 -0
  79. package/{lib/hooks/useCurrentRouteName.d.ts → dist/lib/hooks/useCurrentRouteName/index.d.ts} +5 -5
  80. package/dist/lib/hooks/useCurrentRouteName/index.js +41 -0
  81. package/dist/lib/hooks/useCurrentRouteName/index.js.map +7 -0
  82. package/{esm/types.js → dist/lib/hooks/useCurrentRouteName/index.native.d.ts} +5 -7
  83. package/dist/lib/hooks/useCurrentRouteName/index.native.js +36 -0
  84. package/dist/lib/hooks/useCurrentRouteName/index.native.js.map +7 -0
  85. package/{lib → dist/lib}/hooks/useKeycloak/index.d.ts +11 -4
  86. package/dist/lib/hooks/useKeycloak/index.js +23 -0
  87. package/dist/lib/hooks/useKeycloak/index.js.map +7 -0
  88. package/{lib → dist/lib}/hooks/useKeycloak/useKeycloak.d.ts +2 -2
  89. package/dist/lib/hooks/useKeycloak/useKeycloak.js +63 -0
  90. package/dist/lib/hooks/useKeycloak/useKeycloak.js.map +7 -0
  91. package/{lib → dist/lib}/hooks/useKeycloak/useKeycloak.native.d.ts +4 -4
  92. package/dist/lib/hooks/useKeycloak/useKeycloak.native.js +93 -0
  93. package/dist/lib/hooks/useKeycloak/useKeycloak.native.js.map +7 -0
  94. package/{lib → dist/lib}/hooks/useLogin.d.ts +1 -1
  95. package/dist/lib/hooks/useLogin.js +57 -0
  96. package/dist/lib/hooks/useLogin.js.map +7 -0
  97. package/{lib → dist/lib}/index.d.ts +4 -4
  98. package/dist/lib/index.js +29 -0
  99. package/dist/lib/index.js.map +7 -0
  100. package/{lib → dist/lib}/provider/afterAuth.d.ts +1 -1
  101. package/dist/lib/provider/afterAuth.js +53 -0
  102. package/dist/lib/provider/afterAuth.js.map +7 -0
  103. package/{lib → dist/lib}/provider/index.d.ts +4 -4
  104. package/dist/lib/provider/index.js +62 -0
  105. package/dist/lib/provider/index.js.map +7 -0
  106. package/{lib → dist/lib}/provider/keycloakProvider.d.ts +2 -2
  107. package/dist/lib/provider/keycloakProvider.js +212 -0
  108. package/dist/lib/provider/keycloakProvider.js.map +7 -0
  109. package/{lib → dist/lib}/provider/keycloakProvider.native.d.ts +2 -2
  110. package/dist/lib/provider/keycloakProvider.native.js +55 -0
  111. package/dist/lib/provider/keycloakProvider.native.js.map +7 -0
  112. package/{esm/state/index.js → dist/lib/state/index.d.ts} +8 -13
  113. package/dist/lib/state/index.js +41 -0
  114. package/dist/lib/state/index.js.map +7 -0
  115. package/dist/lib/tsconfig.build.tsbuildinfo +1 -0
  116. package/dist/lib/types.js +25 -0
  117. package/dist/lib/types.js.map +7 -0
  118. package/package.json +44 -63
  119. package/src/@types/coreJsPure.d.ts +2 -2
  120. package/src/@types/expoKeycloakAuth.d.ts +1 -1
  121. package/src/Authenticated.tsx +5 -8
  122. package/src/authConfig.ts +1 -1
  123. package/src/hooks/index.ts +3 -3
  124. package/src/hooks/useAuthConfig.ts +2 -2
  125. package/{esm/hooks/useCurrentRouteName.js → src/hooks/useCurrentRouteName/index.native.ts} +8 -13
  126. package/src/hooks/{useCurrentRouteName.ts → useCurrentRouteName/index.ts} +8 -8
  127. package/src/hooks/useKeycloak/index.ts +12 -8
  128. package/src/hooks/useKeycloak/useKeycloak.native.ts +18 -32
  129. package/src/hooks/useKeycloak/useKeycloak.ts +7 -7
  130. package/src/hooks/useLogin.ts +7 -7
  131. package/src/index.ts +4 -4
  132. package/src/provider/afterAuth.tsx +10 -11
  133. package/src/provider/index.tsx +9 -12
  134. package/src/provider/keycloakProvider.native.tsx +8 -10
  135. package/src/provider/keycloakProvider.tsx +44 -61
  136. package/src/state/index.ts +13 -10
  137. package/esm/Authenticated.js +0 -42
  138. package/esm/Authenticated.js.map +0 -1
  139. package/esm/authConfig.js +0 -30
  140. package/esm/authConfig.js.map +0 -1
  141. package/esm/hooks/index.js +0 -28
  142. package/esm/hooks/index.js.map +0 -1
  143. package/esm/hooks/useAuthConfig.js +0 -30
  144. package/esm/hooks/useAuthConfig.js.map +0 -1
  145. package/esm/hooks/useCurrentRouteName.js.map +0 -1
  146. package/esm/hooks/useKeycloak/index.js +0 -27
  147. package/esm/hooks/useKeycloak/index.js.map +0 -1
  148. package/esm/hooks/useKeycloak/useKeycloak.js +0 -55
  149. package/esm/hooks/useKeycloak/useKeycloak.js.map +0 -1
  150. package/esm/hooks/useKeycloak/useKeycloak.native.js +0 -91
  151. package/esm/hooks/useKeycloak/useKeycloak.native.js.map +0 -1
  152. package/esm/hooks/useLogin.js +0 -50
  153. package/esm/hooks/useLogin.js.map +0 -1
  154. package/esm/index.js +0 -29
  155. package/esm/index.js.map +0 -1
  156. package/esm/package.json +0 -1
  157. package/esm/provider/afterAuth.js +0 -58
  158. package/esm/provider/afterAuth.js.map +0 -1
  159. package/esm/provider/index.js +0 -43
  160. package/esm/provider/index.js.map +0 -1
  161. package/esm/provider/keycloakProvider.js +0 -175
  162. package/esm/provider/keycloakProvider.js.map +0 -1
  163. package/esm/provider/keycloakProvider.native.js +0 -41
  164. package/esm/provider/keycloakProvider.native.js.map +0 -1
  165. package/esm/state/index.js.map +0 -1
  166. package/esm/types.js.map +0 -1
  167. package/lib/Authenticated.js +0 -64
  168. package/lib/Authenticated.js.map +0 -1
  169. package/lib/authConfig.js +0 -51
  170. package/lib/authConfig.js.map +0 -1
  171. package/lib/hooks/index.js +0 -50
  172. package/lib/hooks/index.js.map +0 -1
  173. package/lib/hooks/useAuthConfig.js +0 -48
  174. package/lib/hooks/useAuthConfig.js.map +0 -1
  175. package/lib/hooks/useCurrentRouteName.js +0 -54
  176. package/lib/hooks/useCurrentRouteName.js.map +0 -1
  177. package/lib/hooks/useKeycloak/index.js +0 -30
  178. package/lib/hooks/useKeycloak/index.js.map +0 -1
  179. package/lib/hooks/useKeycloak/useKeycloak.js +0 -71
  180. package/lib/hooks/useKeycloak/useKeycloak.js.map +0 -1
  181. package/lib/hooks/useKeycloak/useKeycloak.native.js +0 -112
  182. package/lib/hooks/useKeycloak/useKeycloak.native.js.map +0 -1
  183. package/lib/hooks/useLogin.js +0 -65
  184. package/lib/hooks/useLogin.js.map +0 -1
  185. package/lib/index.js +0 -60
  186. package/lib/index.js.map +0 -1
  187. package/lib/package.json +0 -1
  188. package/lib/provider/afterAuth.js +0 -78
  189. package/lib/provider/afterAuth.js.map +0 -1
  190. package/lib/provider/index.js +0 -77
  191. package/lib/provider/index.js.map +0 -1
  192. package/lib/provider/keycloakProvider.js +0 -193
  193. package/lib/provider/keycloakProvider.js.map +0 -1
  194. package/lib/provider/keycloakProvider.native.js +0 -61
  195. package/lib/provider/keycloakProvider.native.js.map +0 -1
  196. package/lib/state/index.d.ts +0 -34
  197. package/lib/state/index.js +0 -55
  198. package/lib/state/index.js.map +0 -1
  199. package/lib/tsconfig.build.tsbuildinfo +0 -1
  200. package/lib/types.js +0 -46
  201. package/lib/types.js.map +0 -1
  202. /package/{lib → dist/lib}/authConfig.d.ts +0 -0
  203. /package/{lib → dist/lib}/hooks/useAuthConfig.d.ts +0 -0
  204. /package/{lib → dist/lib}/types.d.ts +0 -0
@@ -1,50 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "./useCurrentRouteName", "./useKeycloak", "./useLogin"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("./useCurrentRouteName"), require("./useKeycloak"), require("./useLogin"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.useCurrentRouteName, global.useKeycloak, global.useLogin);
11
- global.index = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _useCurrentRouteName, _useKeycloak, _useLogin) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- Object.keys(_useCurrentRouteName).forEach(function (key) {
20
- if (key === "default" || key === "__esModule") return;
21
- if (key in _exports && _exports[key] === _useCurrentRouteName[key]) return;
22
- Object.defineProperty(_exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _useCurrentRouteName[key];
26
- }
27
- });
28
- });
29
- Object.keys(_useKeycloak).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in _exports && _exports[key] === _useKeycloak[key]) return;
32
- Object.defineProperty(_exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _useKeycloak[key];
36
- }
37
- });
38
- });
39
- Object.keys(_useLogin).forEach(function (key) {
40
- if (key === "default" || key === "__esModule") return;
41
- if (key in _exports && _exports[key] === _useLogin[key]) return;
42
- Object.defineProperty(_exports, key, {
43
- enumerable: true,
44
- get: function () {
45
- return _useLogin[key];
46
- }
47
- });
48
- });
49
- });
50
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/hooks/index.ts"],"sourcesContent":["/**\n * File: /src/hooks/index.ts\n * Project: app\n * File Created: 08-11-2022 06:34:56\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 09:52:31\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./useCurrentRouteName\";\nexport * from \"./useKeycloak\";\nexport * from \"./useLogin\";\n"],"mappings":";;;;;;;;;;;;;;;;;;EAwBA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EACA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EACA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;AAA2B"}
@@ -1,48 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "react", "../authConfig"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("react"), require("../authConfig"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.react, global.authConfig);
11
- global.useAuthConfig = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _authConfig) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- _exports.useAuthConfig = useAuthConfig;
20
- /**
21
- * File: /src/hooks/useAuthConfig.ts
22
- * Project: app
23
- * File Created: 08-11-2022 09:20:41
24
- * Author: Clay Risser
25
- * -----
26
- * Last Modified: 25-11-2022 09:52:31
27
- * Modified By: Clay Risser
28
- * -----
29
- * Risser Labs LLC (c) Copyright 2021 - 2022
30
- *
31
- * Licensed under the Apache License, Version 2.0 (the "License");
32
- * you may not use this file except in compliance with the License.
33
- * You may obtain a copy of the License at
34
- *
35
- * http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing, software
38
- * distributed under the License is distributed on an "AS IS" BASIS,
39
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
- * See the License for the specific language governing permissions and
41
- * limitations under the License.
42
- */
43
-
44
- function useAuthConfig() {
45
- return (0, _react.useContext)(_authConfig.AuthConfigContext);
46
- }
47
- });
48
- //# sourceMappingURL=useAuthConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAuthConfig.js","names":["useAuthConfig","useContext","AuthConfigContext"],"sources":["../../src/hooks/useAuthConfig.ts"],"sourcesContent":["/**\n * File: /src/hooks/useAuthConfig.ts\n * Project: app\n * File Created: 08-11-2022 09:20:41\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 09:52:31\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useContext } from \"react\";\nimport { AuthConfigContext } from \"../authConfig\";\n\nexport function useAuthConfig() {\n return useContext(AuthConfigContext);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAKO,SAASA,aAAa,GAAG;IAC9B,OAAO,IAAAC,iBAAU,EAACC,6BAAiB,CAAC;EACtC;AAAC"}
@@ -1,54 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "multiplatform.one", "@react-navigation/native", "next/router"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("multiplatform.one"), require("@react-navigation/native"), require("next/router"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.multiplatform, global.native, global.router);
11
- global.useCurrentRouteName = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _multiplatform, _native, _router) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- _exports.useCurrentRouteName = useCurrentRouteName;
20
- /**
21
- * File: /src/hooks/useCurrentRouteName.ts
22
- * Project: app
23
- * File Created: 08-11-2022 08:38:23
24
- * Author: Clay Risser
25
- * -----
26
- * Last Modified: 28-01-2023 13:47:18
27
- * Modified By: Clay Risser
28
- * -----
29
- * Risser Labs LLC (c) Copyright 2021 - 2022
30
- *
31
- * Licensed under the Apache License, Version 2.0 (the "License");
32
- * you may not use this file except in compliance with the License.
33
- * You may obtain a copy of the License at
34
- *
35
- * http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing, software
38
- * distributed under the License is distributed on an "AS IS" BASIS,
39
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
- * See the License for the specific language governing permissions and
41
- * limitations under the License.
42
- */
43
-
44
- function useCurrentRouteName() {
45
- if (_multiplatform.MultiPlatform.isStorybook) return null;
46
- if (_multiplatform.MultiPlatform.isNext) {
47
- const router = (0, _router.useRouter)();
48
- return router.route;
49
- }
50
- const route = (0, _native.useRoute)();
51
- return route.name;
52
- }
53
- });
54
- //# sourceMappingURL=useCurrentRouteName.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCurrentRouteName.js","names":["useCurrentRouteName","MultiPlatform","isStorybook","isNext","router","useRouter","route","useRoute","name"],"sources":["../../src/hooks/useCurrentRouteName.ts"],"sourcesContent":["/**\n * File: /src/hooks/useCurrentRouteName.ts\n * Project: app\n * File Created: 08-11-2022 08:38:23\n * Author: Clay Risser\n * -----\n * Last Modified: 28-01-2023 13:47:18\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiPlatform } from \"multiplatform.one\";\nimport { useRoute } from \"@react-navigation/native\";\nimport { useRouter } from \"next/router\";\n\nexport function useCurrentRouteName() {\n if (MultiPlatform.isStorybook) return null;\n if (MultiPlatform.isNext) {\n const router = useRouter();\n return router.route;\n }\n const route = useRoute();\n return route.name;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAMO,SAASA,mBAAmB,GAAG;IACpC,IAAIC,4BAAa,CAACC,WAAW,EAAE,OAAO,IAAI;IAC1C,IAAID,4BAAa,CAACE,MAAM,EAAE;MACxB,MAAMC,MAAM,GAAG,IAAAC,iBAAS,GAAE;MAC1B,OAAOD,MAAM,CAACE,KAAK;IACrB;IACA,MAAMA,KAAK,GAAG,IAAAC,gBAAQ,GAAE;IACxB,OAAOD,KAAK,CAACE,IAAI;EACnB;AAAC"}
@@ -1,30 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "./useKeycloak"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("./useKeycloak"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.useKeycloak);
11
- global.index = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _useKeycloak) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- Object.keys(_useKeycloak).forEach(function (key) {
20
- if (key === "default" || key === "__esModule") return;
21
- if (key in _exports && _exports[key] === _useKeycloak[key]) return;
22
- Object.defineProperty(_exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _useKeycloak[key];
26
- }
27
- });
28
- });
29
- });
30
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useKeycloak/index.ts"],"sourcesContent":["/**\n * File: /src/hooks/useKeycloak/index.ts\n * Project: app\n * File Created: 08-11-2022 14:10:44\n * Author: Clay Risser\n * -----\n * Last Modified: 28-11-2022 14:56:28\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n KeycloakResourceAccess,\n KeycloakRoles,\n KeycloakTokenParsed,\n} from \"keycloak-js\";\nexport * from \"./useKeycloak\";\n\nexport interface IKeycloak {\n authenticated?: boolean;\n realmAccess?: KeycloakRoles;\n refreshToken?: string;\n refreshTokenParsed?: KeycloakTokenParsed;\n resourceAccess?: KeycloakResourceAccess;\n subject?: string;\n token?: string;\n tokenParsed?: KeycloakTokenParsed;\n login: () => Promise<unknown> | unknown;\n logout: () => Promise<unknown> | unknown;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;EA6BA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;AAA8B"}
@@ -1,71 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "multiplatform.one", "@react-keycloak/web", "@react-keycloak/ssr", "../useAuthConfig"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("multiplatform.one"), require("@react-keycloak/web"), require("@react-keycloak/ssr"), require("../useAuthConfig"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.multiplatform, global.web, global.ssr, global.useAuthConfig);
11
- global.useKeycloak = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _multiplatform, _web, _ssr, _useAuthConfig) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- _exports.useKeycloak = useKeycloak;
20
- /**
21
- * File: /src/hooks/useKeycloak/useKeycloak.ts
22
- * Project: app
23
- * File Created: 08-11-2022 06:04:59
24
- * Author: Clay Risser
25
- * -----
26
- * Last Modified: 28-01-2023 13:48:24
27
- * Modified By: Clay Risser
28
- * -----
29
- * Risser Labs LLC (c) Copyright 2021 - 2022
30
- *
31
- * Licensed under the Apache License, Version 2.0 (the "License");
32
- * you may not use this file except in compliance with the License.
33
- * You may obtain a copy of the License at
34
- *
35
- * http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing, software
38
- * distributed under the License is distributed on an "AS IS" BASIS,
39
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
- * See the License for the specific language governing permissions and
41
- * limitations under the License.
42
- */
43
-
44
- function useKeycloak() {
45
- const authConfig = (0, _useAuthConfig.useAuthConfig)();
46
- if (_multiplatform.MultiPlatform.isStorybook) return {
47
- authenticated: true
48
- };
49
- if (_multiplatform.MultiPlatform.isNext && authConfig.ssr) {
50
- const {
51
- keycloak: ssrKeycloak,
52
- initialized
53
- } = (0, _ssr.useKeycloak)();
54
- const keycloak = {
55
- ...ssrKeycloak
56
- };
57
- if (!initialized) keycloak.authenticated = undefined;
58
- return keycloak;
59
- }
60
- const {
61
- keycloak: reactKeycloak,
62
- initialized
63
- } = (0, _web.useKeycloak)();
64
- const keycloak = {
65
- ...reactKeycloak
66
- };
67
- if (!initialized) keycloak.authenticated = undefined;
68
- return keycloak;
69
- }
70
- });
71
- //# sourceMappingURL=useKeycloak.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useKeycloak.js","names":["useKeycloak","authConfig","useAuthConfig","MultiPlatform","isStorybook","authenticated","isNext","ssr","keycloak","ssrKeycloak","initialized","useSsrKeycloak","undefined","reactKeycloak","useReactKeycloak"],"sources":["../../../src/hooks/useKeycloak/useKeycloak.ts"],"sourcesContent":["/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified: 28-01-2023 13:48:24\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Keycloak from \"keycloak-js\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport { useKeycloak as useReactKeycloak } from \"@react-keycloak/web\";\nimport { useKeycloak as useSsrKeycloak } from \"@react-keycloak/ssr\";\nimport { IKeycloak } from \"./index\";\nimport { useAuthConfig } from \"../useAuthConfig\";\n\nexport function useKeycloak() {\n const authConfig = useAuthConfig();\n if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;\n if (MultiPlatform.isNext && authConfig.ssr) {\n const { keycloak: ssrKeycloak, initialized } = useSsrKeycloak();\n const keycloak = { ...ssrKeycloak } as Keycloak;\n if (!initialized) keycloak.authenticated = undefined;\n return keycloak as IKeycloak;\n }\n const { keycloak: reactKeycloak, initialized } = useReactKeycloak();\n const keycloak = { ...reactKeycloak } as Keycloak;\n if (!initialized) keycloak.authenticated = undefined;\n return keycloak as IKeycloak;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EASO,SAASA,WAAW,GAAG;IAC5B,MAAMC,UAAU,GAAG,IAAAC,4BAAa,GAAE;IAClC,IAAIC,4BAAa,CAACC,WAAW,EAAE,OAAO;MAAEC,aAAa,EAAE;IAAK,CAAC;IAC7D,IAAIF,4BAAa,CAACG,MAAM,IAAIL,UAAU,CAACM,GAAG,EAAE;MAC1C,MAAM;QAAEC,QAAQ,EAAEC,WAAW;QAAEC;MAAY,CAAC,GAAG,IAAAC,gBAAc,GAAE;MAC/D,MAAMH,QAAQ,GAAG;QAAE,GAAGC;MAAY,CAAa;MAC/C,IAAI,CAACC,WAAW,EAAEF,QAAQ,CAACH,aAAa,GAAGO,SAAS;MACpD,OAAOJ,QAAQ;IACjB;IACA,MAAM;MAAEA,QAAQ,EAAEK,aAAa;MAAEH;IAAY,CAAC,GAAG,IAAAI,gBAAgB,GAAE;IACnE,MAAMN,QAAQ,GAAG;MAAE,GAAGK;IAAc,CAAa;IACjD,IAAI,CAACH,WAAW,EAAEF,QAAQ,CAACH,aAAa,GAAGO,SAAS;IACpD,OAAOJ,QAAQ;EACjB;AAAC"}
@@ -1,112 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "core-js-pure/stable/atob", "core-js-pure/stable/escape", "multiplatform.one", "expo-keycloak-auth"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("core-js-pure/stable/atob"), require("core-js-pure/stable/escape"), require("multiplatform.one"), require("expo-keycloak-auth"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.atob, global.escape, global.multiplatform, global.expoKeycloakAuth);
11
- global.useKeycloakNative = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _atob, _escape, _multiplatform, _expoKeycloakAuth) {
14
- "use strict";
15
-
16
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
17
- Object.defineProperty(_exports, "__esModule", {
18
- value: true
19
- });
20
- _exports.ExpoKeycloak = void 0;
21
- _exports.useKeycloak = useKeycloak;
22
- _atob = _interopRequireDefault(_atob);
23
- _escape = _interopRequireDefault(_escape);
24
- /**
25
- * File: /src/hooks/useKeycloak/useKeycloak.native.ts
26
- * Project: app
27
- * File Created: 08-11-2022 14:10:25
28
- * Author: Clay Risser
29
- * -----
30
- * Last Modified: 28-01-2023 13:47:33
31
- * Modified By: Clay Risser
32
- * -----
33
- * Risser Labs LLC (c) Copyright 2021 - 2022
34
- *
35
- * Licensed under the Apache License, Version 2.0 (the "License");
36
- * you may not use this file except in compliance with the License.
37
- * You may obtain a copy of the License at
38
- *
39
- * http://www.apache.org/licenses/LICENSE-2.0
40
- *
41
- * Unless required by applicable law or agreed to in writing, software
42
- * distributed under the License is distributed on an "AS IS" BASIS,
43
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
- * See the License for the specific language governing permissions and
45
- * limitations under the License.
46
- */
47
-
48
- function useKeycloak() {
49
- if (_multiplatform.MultiPlatform.isStorybook) return {
50
- authenticated: true
51
- };
52
- const {
53
- ready,
54
- login,
55
- isLoggedIn,
56
- token,
57
- logout,
58
- refreshToken
59
- } = (0, _expoKeycloakAuth.useKeycloak)();
60
- const keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || undefined, refreshToken || undefined);
61
- return keycloak;
62
- }
63
- class ExpoKeycloak {
64
- constructor(ready, isLoggedIn, login, logout, token, refreshToken) {
65
- this.logout = logout;
66
- this.token = token;
67
- this.refreshToken = refreshToken;
68
- this.authenticated = void 0;
69
- this.tokenParsed = void 0;
70
- this.refreshTokenParsed = void 0;
71
- this.subject = void 0;
72
- this.realmAccess = void 0;
73
- this.resourceAccess = void 0;
74
- this.login = void 0;
75
- if (ready) this.authenticated = isLoggedIn;
76
- if (this.authenticated) {
77
- if (this.token) this.tokenParsed = decodeToken(this.token);
78
- if (this.refreshToken) {
79
- this.refreshTokenParsed = decodeToken(this.refreshToken);
80
- }
81
- if (this.tokenParsed) {
82
- this.subject = this.tokenParsed.sub;
83
- this.realmAccess = this.tokenParsed.realm_access;
84
- this.resourceAccess = this.tokenParsed.resource_access;
85
- }
86
- }
87
- this.login = () => login();
88
- }
89
- }
90
- _exports.ExpoKeycloak = ExpoKeycloak;
91
- function decodeToken(str) {
92
- str = str.split(".")[1];
93
- str = str.replace(/-/g, "+");
94
- str = str.replace(/_/g, "/");
95
- switch (str.length % 4) {
96
- case 0:
97
- break;
98
- case 2:
99
- str += "==";
100
- break;
101
- case 3:
102
- str += "=";
103
- break;
104
- default:
105
- throw "Invalid token";
106
- }
107
- str = decodeURIComponent((0, _escape.default)((0, _atob.default)(str)));
108
- str = JSON.parse(str);
109
- return str;
110
- }
111
- });
112
- //# sourceMappingURL=useKeycloak.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useKeycloak.native.js","names":["useKeycloak","MultiPlatform","isStorybook","authenticated","ready","login","isLoggedIn","token","logout","refreshToken","useExpoKeycloak","keycloak","ExpoKeycloak","undefined","constructor","tokenParsed","refreshTokenParsed","subject","realmAccess","resourceAccess","decodeToken","sub","realm_access","resource_access","str","split","replace","length","decodeURIComponent","escape","atob","JSON","parse"],"sources":["../../../src/hooks/useKeycloak/useKeycloak.native.ts"],"sourcesContent":["/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified: 28-01-2023 13:47:33\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport atob from \"core-js-pure/stable/atob\";\nimport escape from \"core-js-pure/stable/escape\";\nimport { AuthRequestPromptOptions, AuthSessionResult } from \"expo-auth-session\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport {\n KeycloakResourceAccess,\n KeycloakRoles,\n KeycloakTokenParsed,\n} from \"keycloak-js\";\nimport { useKeycloak as useExpoKeycloak } from \"expo-keycloak-auth\";\nimport { IKeycloak } from \"./index\";\n\nexport function useKeycloak() {\n if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;\n const { ready, login, isLoggedIn, token, logout, refreshToken } =\n useExpoKeycloak();\n const keycloak = new ExpoKeycloak(\n ready,\n isLoggedIn,\n login,\n logout,\n token || undefined,\n refreshToken || undefined\n );\n return keycloak as IKeycloak;\n}\n\nexport class ExpoKeycloak implements IKeycloak {\n authenticated?: boolean;\n\n tokenParsed?: KeycloakTokenParsed;\n\n refreshTokenParsed?: KeycloakTokenParsed;\n\n subject?: string;\n\n realmAccess?: KeycloakRoles;\n\n resourceAccess?: KeycloakResourceAccess;\n\n login: () => Promise<unknown> | unknown;\n\n constructor(\n ready: boolean,\n isLoggedIn: boolean | undefined,\n login: (\n options?: AuthRequestPromptOptions\n ) => Promise<AuthSessionResult | undefined>,\n public logout: () => unknown,\n public token?: string,\n public refreshToken?: string\n ) {\n if (ready) this.authenticated = isLoggedIn;\n if (this.authenticated) {\n if (this.token) this.tokenParsed = decodeToken(this.token);\n if (this.refreshToken) {\n this.refreshTokenParsed = decodeToken(this.refreshToken);\n }\n if (this.tokenParsed) {\n this.subject = this.tokenParsed.sub;\n this.realmAccess = this.tokenParsed.realm_access;\n this.resourceAccess = this.tokenParsed.resource_access;\n }\n }\n this.login = () => login();\n }\n}\n\nfunction decodeToken(str: string) {\n str = str.split(\".\")[1];\n str = str.replace(/-/g, \"+\");\n str = str.replace(/_/g, \"/\");\n switch (str.length % 4) {\n case 0:\n break;\n case 2:\n str += \"==\";\n break;\n case 3:\n str += \"=\";\n break;\n default:\n throw \"Invalid token\";\n }\n str = decodeURIComponent(escape(atob(str)));\n str = JSON.parse(str);\n return str as unknown as KeycloakTokenParsed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAcO,SAASA,WAAW,GAAG;IAC5B,IAAIC,4BAAa,CAACC,WAAW,EAAE,OAAO;MAAEC,aAAa,EAAE;IAAK,CAAC;IAC7D,MAAM;MAAEC,KAAK;MAAEC,KAAK;MAAEC,UAAU;MAAEC,KAAK;MAAEC,MAAM;MAAEC;IAAa,CAAC,GAC7D,IAAAC,6BAAe,GAAE;IACnB,MAAMC,QAAQ,GAAG,IAAIC,YAAY,CAC/BR,KAAK,EACLE,UAAU,EACVD,KAAK,EACLG,MAAM,EACND,KAAK,IAAIM,SAAS,EAClBJ,YAAY,IAAII,SAAS,CAC1B;IACD,OAAOF,QAAQ;EACjB;EAEO,MAAMC,YAAY,CAAsB;IAe7CE,WAAW,CACTV,KAAc,EACdE,UAA+B,EAC/BD,KAE2C,EACpCG,MAAqB,EACrBD,KAAc,EACdE,YAAqB,EAC5B;MAAA,KAHOD,MAAqB,GAArBA,MAAqB;MAAA,KACrBD,KAAc,GAAdA,KAAc;MAAA,KACdE,YAAqB,GAArBA,YAAqB;MAAA,KAtB9BN,aAAa;MAAA,KAEbY,WAAW;MAAA,KAEXC,kBAAkB;MAAA,KAElBC,OAAO;MAAA,KAEPC,WAAW;MAAA,KAEXC,cAAc;MAAA,KAEdd,KAAK;MAYH,IAAID,KAAK,EAAE,IAAI,CAACD,aAAa,GAAGG,UAAU;MAC1C,IAAI,IAAI,CAACH,aAAa,EAAE;QACtB,IAAI,IAAI,CAACI,KAAK,EAAE,IAAI,CAACQ,WAAW,GAAGK,WAAW,CAAC,IAAI,CAACb,KAAK,CAAC;QAC1D,IAAI,IAAI,CAACE,YAAY,EAAE;UACrB,IAAI,CAACO,kBAAkB,GAAGI,WAAW,CAAC,IAAI,CAACX,YAAY,CAAC;QAC1D;QACA,IAAI,IAAI,CAACM,WAAW,EAAE;UACpB,IAAI,CAACE,OAAO,GAAG,IAAI,CAACF,WAAW,CAACM,GAAG;UACnC,IAAI,CAACH,WAAW,GAAG,IAAI,CAACH,WAAW,CAACO,YAAY;UAChD,IAAI,CAACH,cAAc,GAAG,IAAI,CAACJ,WAAW,CAACQ,eAAe;QACxD;MACF;MACA,IAAI,CAAClB,KAAK,GAAG,MAAMA,KAAK,EAAE;IAC5B;EACF;EAAC;EAED,SAASe,WAAW,CAACI,GAAW,EAAE;IAChCA,GAAG,GAAGA,GAAG,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACvBD,GAAG,GAAGA,GAAG,CAACE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;IAC5BF,GAAG,GAAGA,GAAG,CAACE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC;IAC5B,QAAQF,GAAG,CAACG,MAAM,GAAG,CAAC;MACpB,KAAK,CAAC;QACJ;MACF,KAAK,CAAC;QACJH,GAAG,IAAI,IAAI;QACX;MACF,KAAK,CAAC;QACJA,GAAG,IAAI,GAAG;QACV;MACF;QACE,MAAM,eAAe;IAAC;IAE1BA,GAAG,GAAGI,kBAAkB,CAAC,IAAAC,eAAM,EAAC,IAAAC,aAAI,EAACN,GAAG,CAAC,CAAC,CAAC;IAC3CA,GAAG,GAAGO,IAAI,CAACC,KAAK,CAACR,GAAG,CAAC;IACrB,OAAOA,GAAG;EACZ;AAAC"}
@@ -1,65 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "solito/router", "multiplatform.one", "./useCurrentRouteName", "./useKeycloak/useKeycloak", "./useAuthConfig"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("solito/router"), require("multiplatform.one"), require("./useCurrentRouteName"), require("./useKeycloak/useKeycloak"), require("./useAuthConfig"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.router, global.multiplatform, global.useCurrentRouteName, global.useKeycloak, global.useAuthConfig);
11
- global.useLogin = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _router, _multiplatform, _useCurrentRouteName, _useKeycloak, _useAuthConfig) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- _exports.useLogin = useLogin;
20
- /**
21
- * File: /src/hooks/useLogin.ts
22
- * Project: app
23
- * File Created: 08-11-2022 08:49:14
24
- * Author: Clay Risser
25
- * -----
26
- * Last Modified: 28-01-2023 13:47:42
27
- * Modified By: Clay Risser
28
- * -----
29
- * Risser Labs LLC (c) Copyright 2021 - 2022
30
- *
31
- * Licensed under the Apache License, Version 2.0 (the "License");
32
- * you may not use this file except in compliance with the License.
33
- * You may obtain a copy of the License at
34
- *
35
- * http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing, software
38
- * distributed under the License is distributed on an "AS IS" BASIS,
39
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
- * See the License for the specific language governing permissions and
41
- * limitations under the License.
42
- */
43
-
44
- function useLogin(loginRoute) {
45
- if (_multiplatform.MultiPlatform.isStorybook) return () => null;
46
- const keycloak = (0, _useKeycloak.useKeycloak)();
47
- const authConfig = (0, _useAuthConfig.useAuthConfig)();
48
- const currentRouteName = (0, _useCurrentRouteName.useCurrentRouteName)();
49
- const router = (0, _router.useRouter)();
50
- return () => {
51
- if (!loginRoute) loginRoute = authConfig.loginRoute;
52
- if (!loginRoute) {
53
- keycloak.login();
54
- return;
55
- }
56
- const url = new URL(`x://${loginRoute}`);
57
- const searchParams = new URLSearchParams(url.search);
58
- if (currentRouteName) searchParams.append("backTo", currentRouteName);
59
- let query = searchParams.toString();
60
- if (query.length) query = `?${query}`;
61
- router.push(`${url.pathname.substring(2)}${query}`);
62
- };
63
- }
64
- });
65
- //# sourceMappingURL=useLogin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLogin.js","names":["useLogin","loginRoute","MultiPlatform","isStorybook","keycloak","useKeycloak","authConfig","useAuthConfig","currentRouteName","useCurrentRouteName","router","useRouter","login","url","URL","searchParams","URLSearchParams","search","append","query","toString","length","push","pathname","substring"],"sources":["../../src/hooks/useLogin.ts"],"sourcesContent":["/**\n * File: /src/hooks/useLogin.ts\n * Project: app\n * File Created: 08-11-2022 08:49:14\n * Author: Clay Risser\n * -----\n * Last Modified: 28-01-2023 13:47:42\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useRouter } from \"solito/router\";\nimport { MultiPlatform } from \"multiplatform.one\";\nimport { useCurrentRouteName } from \"./useCurrentRouteName\";\nimport { useKeycloak } from \"./useKeycloak/useKeycloak\";\nimport { useAuthConfig } from \"./useAuthConfig\";\n\nexport function useLogin(loginRoute?: string) {\n if (MultiPlatform.isStorybook) return () => null;\n const keycloak = useKeycloak();\n const authConfig = useAuthConfig();\n const currentRouteName = useCurrentRouteName();\n const router = useRouter();\n return () => {\n if (!loginRoute) loginRoute = authConfig.loginRoute;\n if (!loginRoute) {\n keycloak.login();\n return;\n }\n const url = new URL(`x://${loginRoute}`);\n const searchParams = new URLSearchParams(url.search);\n if (currentRouteName) searchParams.append(\"backTo\", currentRouteName);\n let query = searchParams.toString();\n if (query.length) query = `?${query}`;\n router.push(`${url.pathname.substring(2)}${query}`);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAQO,SAASA,QAAQ,CAACC,UAAmB,EAAE;IAC5C,IAAIC,4BAAa,CAACC,WAAW,EAAE,OAAO,MAAM,IAAI;IAChD,MAAMC,QAAQ,GAAG,IAAAC,wBAAW,GAAE;IAC9B,MAAMC,UAAU,GAAG,IAAAC,4BAAa,GAAE;IAClC,MAAMC,gBAAgB,GAAG,IAAAC,wCAAmB,GAAE;IAC9C,MAAMC,MAAM,GAAG,IAAAC,iBAAS,GAAE;IAC1B,OAAO,MAAM;MACX,IAAI,CAACV,UAAU,EAAEA,UAAU,GAAGK,UAAU,CAACL,UAAU;MACnD,IAAI,CAACA,UAAU,EAAE;QACfG,QAAQ,CAACQ,KAAK,EAAE;QAChB;MACF;MACA,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAE,OAAMb,UAAW,EAAC,CAAC;MACxC,MAAMc,YAAY,GAAG,IAAIC,eAAe,CAACH,GAAG,CAACI,MAAM,CAAC;MACpD,IAAIT,gBAAgB,EAAEO,YAAY,CAACG,MAAM,CAAC,QAAQ,EAAEV,gBAAgB,CAAC;MACrE,IAAIW,KAAK,GAAGJ,YAAY,CAACK,QAAQ,EAAE;MACnC,IAAID,KAAK,CAACE,MAAM,EAAEF,KAAK,GAAI,IAAGA,KAAM,EAAC;MACrCT,MAAM,CAACY,IAAI,CAAE,GAAET,GAAG,CAACU,QAAQ,CAACC,SAAS,CAAC,CAAC,CAAE,GAAEL,KAAM,EAAC,CAAC;IACrD,CAAC;EACH;AAAC"}
package/lib/index.js DELETED
@@ -1,60 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "./Authenticated", "./authConfig", "./hooks", "./provider"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("./Authenticated"), require("./authConfig"), require("./hooks"), require("./provider"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.Authenticated, global.authConfig, global.hooks, global.provider);
11
- global.index = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _Authenticated, _authConfig, _hooks, _provider) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- Object.keys(_Authenticated).forEach(function (key) {
20
- if (key === "default" || key === "__esModule") return;
21
- if (key in _exports && _exports[key] === _Authenticated[key]) return;
22
- Object.defineProperty(_exports, key, {
23
- enumerable: true,
24
- get: function () {
25
- return _Authenticated[key];
26
- }
27
- });
28
- });
29
- Object.keys(_authConfig).forEach(function (key) {
30
- if (key === "default" || key === "__esModule") return;
31
- if (key in _exports && _exports[key] === _authConfig[key]) return;
32
- Object.defineProperty(_exports, key, {
33
- enumerable: true,
34
- get: function () {
35
- return _authConfig[key];
36
- }
37
- });
38
- });
39
- Object.keys(_hooks).forEach(function (key) {
40
- if (key === "default" || key === "__esModule") return;
41
- if (key in _exports && _exports[key] === _hooks[key]) return;
42
- Object.defineProperty(_exports, key, {
43
- enumerable: true,
44
- get: function () {
45
- return _hooks[key];
46
- }
47
- });
48
- });
49
- Object.keys(_provider).forEach(function (key) {
50
- if (key === "default" || key === "__esModule") return;
51
- if (key in _exports && _exports[key] === _provider[key]) return;
52
- Object.defineProperty(_exports, key, {
53
- enumerable: true,
54
- get: function () {
55
- return _provider[key];
56
- }
57
- });
58
- });
59
- });
60
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * File: /src/index.ts\n * Project: @multiplatform.one/keycloak\n * File Created: 25-11-2022 09:51:55\n * Author: Clay Risser\n * -----\n * Last Modified: 25-11-2022 09:52:06\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./Authenticated\";\nexport * from \"./authConfig\";\nexport * from \"./hooks\";\nexport * from \"./provider\";\n"],"mappings":";;;;;;;;;;;;;;;;;;EAwBA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EACA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EACA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;EACA;IAAA;IAAA;IAAA;MAAA;MAAA;QAAA;MAAA;IAAA;EAAA;AAA2B"}
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type": "commonjs"}
@@ -1,78 +0,0 @@
1
- (function (global, factory) {
2
- if (typeof define === "function" && define.amd) {
3
- define(["exports", "react", "../hooks", "../hooks/useAuthConfig", "../state"], factory);
4
- } else if (typeof exports !== "undefined") {
5
- factory(exports, require("react"), require("../hooks"), require("../hooks/useAuthConfig"), require("../state"));
6
- } else {
7
- var mod = {
8
- exports: {}
9
- };
10
- factory(mod.exports, global.react, global.hooks, global.useAuthConfig, global.state);
11
- global.afterAuth = mod.exports;
12
- }
13
- })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _react, _hooks, _useAuthConfig, _state) {
14
- "use strict";
15
-
16
- Object.defineProperty(_exports, "__esModule", {
17
- value: true
18
- });
19
- _exports.AfterAuth = void 0;
20
- _react = _interopRequireWildcard(_react);
21
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
- /**
24
- * File: /auth/provider/afterAuth.tsx
25
- * Project: app
26
- * File Created: 22-11-2022 17:49:58
27
- * Author: Clay Risser
28
- * -----
29
- * Last Modified: 22-11-2022 18:00:39
30
- * Modified By: Clay Risser
31
- * -----
32
- * Risser Labs LLC (c) Copyright 2021 - 2022
33
- *
34
- * Licensed under the Apache License, Version 2.0 (the "License");
35
- * you may not use this file except in compliance with the License.
36
- * You may obtain a copy of the License at
37
- *
38
- * http://www.apache.org/licenses/LICENSE-2.0
39
- *
40
- * Unless required by applicable law or agreed to in writing, software
41
- * distributed under the License is distributed on an "AS IS" BASIS,
42
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43
- * See the License for the specific language governing permissions and
44
- * limitations under the License.
45
- */
46
-
47
- const logger = console;
48
- const AfterAuth = _ref => {
49
- let {
50
- children
51
- } = _ref;
52
- const authConfig = (0, _useAuthConfig.useAuthConfig)();
53
- const {
54
- token,
55
- refreshToken,
56
- authenticated
57
- } = (0, _hooks.useKeycloak)();
58
- const [, setAuth] = (0, _state.useAuthState)();
59
- (0, _react.useEffect)(() => {
60
- if (!authenticated) return;
61
- if (token) {
62
- setAuth({
63
- token,
64
- ...(refreshToken ? {
65
- refreshToken
66
- } : {})
67
- });
68
- }
69
- }, [token, refreshToken]);
70
- if (authConfig.debug) {
71
- logger.debug("authenticated", authenticated);
72
- logger.debug("token", token);
73
- }
74
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
75
- };
76
- _exports.AfterAuth = AfterAuth;
77
- });
78
- //# sourceMappingURL=afterAuth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"afterAuth.js","names":["logger","console","AfterAuth","children","authConfig","useAuthConfig","token","refreshToken","authenticated","useKeycloak","setAuth","useAuthState","useEffect","debug"],"sources":["../../src/provider/afterAuth.tsx"],"sourcesContent":["/**\n * File: /auth/provider/afterAuth.tsx\n * Project: app\n * File Created: 22-11-2022 17:49:58\n * Author: Clay Risser\n * -----\n * Last Modified: 22-11-2022 18:00:39\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { FC, ReactNode, useEffect } from \"react\";\nimport { useKeycloak } from \"../hooks\";\nimport { useAuthConfig } from \"../hooks/useAuthConfig\";\nimport { useAuthState } from \"../state\";\n\nexport interface AfterAuthProps {\n children: ReactNode;\n}\n\nconst logger = console;\n\nexport const AfterAuth: FC<AfterAuthProps> = ({ children }: AfterAuthProps) => {\n const authConfig = useAuthConfig();\n const { token, refreshToken, authenticated } = useKeycloak();\n const [, setAuth] = useAuthState();\n\n useEffect(() => {\n if (!authenticated) return;\n if (token) {\n setAuth({\n token,\n ...(refreshToken ? { refreshToken } : {}),\n });\n }\n }, [token, refreshToken]);\n\n if (authConfig.debug) {\n logger.debug(\"authenticated\", authenticated);\n logger.debug(\"token\", token);\n }\n return <>{children}</>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;EAWA,MAAMA,MAAM,GAAGC,OAAO;EAEf,MAAMC,SAA6B,GAAG,QAAkC;IAAA,IAAjC;MAAEC;IAAyB,CAAC;IACxE,MAAMC,UAAU,GAAG,IAAAC,4BAAa,GAAE;IAClC,MAAM;MAAEC,KAAK;MAAEC,YAAY;MAAEC;IAAc,CAAC,GAAG,IAAAC,kBAAW,GAAE;IAC5D,MAAM,GAAGC,OAAO,CAAC,GAAG,IAAAC,mBAAY,GAAE;IAElC,IAAAC,gBAAS,EAAC,MAAM;MACd,IAAI,CAACJ,aAAa,EAAE;MACpB,IAAIF,KAAK,EAAE;QACTI,OAAO,CAAC;UACNJ,KAAK;UACL,IAAIC,YAAY,GAAG;YAAEA;UAAa,CAAC,GAAG,CAAC,CAAC;QAC1C,CAAC,CAAC;MACJ;IACF,CAAC,EAAE,CAACD,KAAK,EAAEC,YAAY,CAAC,CAAC;IAEzB,IAAIH,UAAU,CAACS,KAAK,EAAE;MACpBb,MAAM,CAACa,KAAK,CAAC,eAAe,EAAEL,aAAa,CAAC;MAC5CR,MAAM,CAACa,KAAK,CAAC,OAAO,EAAEP,KAAK,CAAC;IAC9B;IACA,oBAAO,4DAAGH,QAAQ,CAAI;EACxB,CAAC;EAAC;AAAA"}