@asgardeo/auth-spa 0.2.17 → 0.2.20

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 (115) hide show
  1. package/.eslintrc.js +1 -2
  2. package/README.md +12 -5
  3. package/babel.config.js +1 -2
  4. package/dist/asgardeo-spa.production.esm.js +100 -42
  5. package/dist/asgardeo-spa.production.esm.js.map +1 -1
  6. package/dist/asgardeo-spa.production.js +101 -43
  7. package/dist/asgardeo-spa.production.js.map +1 -1
  8. package/dist/asgardeo-spa.production.min.js +1 -1
  9. package/dist/asgardeo-spa.production.min.js.map +1 -1
  10. package/dist/polyfilled/asgardeo-spa.production.esm.js +98 -40
  11. package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
  12. package/dist/polyfilled/asgardeo-spa.production.js +98 -40
  13. package/dist/polyfilled/asgardeo-spa.production.js.map +1 -1
  14. package/dist/polyfilled/asgardeo-spa.production.min.js +1 -1
  15. package/dist/polyfilled/asgardeo-spa.production.min.js.map +1 -1
  16. package/dist/src/client.d.ts +3 -2
  17. package/dist/src/client.d.ts.map +1 -1
  18. package/dist/src/client.js +13 -4
  19. package/dist/src/client.js.map +1 -1
  20. package/dist/src/clients/main-thread-client.d.ts.map +1 -1
  21. package/dist/src/clients/main-thread-client.js +41 -25
  22. package/dist/src/clients/main-thread-client.js.map +1 -1
  23. package/dist/src/clients/web-worker-client.d.ts +1 -1
  24. package/dist/src/clients/web-worker-client.d.ts.map +1 -1
  25. package/dist/src/clients/web-worker-client.js +55 -30
  26. package/dist/src/clients/web-worker-client.js.map +1 -1
  27. package/dist/src/constants/errors.d.ts +19 -0
  28. package/dist/src/constants/errors.d.ts.map +1 -0
  29. package/dist/src/constants/errors.js +19 -0
  30. package/dist/src/constants/errors.js.map +1 -0
  31. package/dist/src/constants/hooks.d.ts +2 -1
  32. package/dist/src/constants/hooks.d.ts.map +1 -1
  33. package/dist/src/constants/hooks.js +1 -0
  34. package/dist/src/constants/hooks.js.map +1 -1
  35. package/dist/src/constants/index.d.ts +1 -0
  36. package/dist/src/constants/index.d.ts.map +1 -1
  37. package/dist/src/constants/index.js +1 -0
  38. package/dist/src/constants/index.js.map +1 -1
  39. package/dist/src/constants/parameters.d.ts +1 -0
  40. package/dist/src/constants/parameters.d.ts.map +1 -1
  41. package/dist/src/constants/parameters.js +1 -0
  42. package/dist/src/constants/parameters.js.map +1 -1
  43. package/dist/src/helpers/session-management-helper.d.ts +1 -1
  44. package/dist/src/helpers/session-management-helper.d.ts.map +1 -1
  45. package/dist/src/helpers/session-management-helper.js +33 -43
  46. package/dist/src/helpers/session-management-helper.js.map +1 -1
  47. package/dist/src/index-polyfill.d.ts +0 -1
  48. package/dist/src/index-polyfill.d.ts.map +1 -1
  49. package/dist/src/index-polyfill.js +0 -1
  50. package/dist/src/index-polyfill.js.map +1 -1
  51. package/dist/src/models/client.d.ts +3 -3
  52. package/dist/src/models/client.d.ts.map +1 -1
  53. package/dist/src/models/http-client.d.ts +1 -1
  54. package/dist/src/models/http-client.d.ts.map +1 -1
  55. package/dist/src/models/index.d.ts +1 -0
  56. package/dist/src/models/index.d.ts.map +1 -1
  57. package/dist/src/models/index.js +1 -0
  58. package/dist/src/models/index.js.map +1 -1
  59. package/dist/src/models/message.d.ts +1 -0
  60. package/dist/src/models/message.d.ts.map +1 -1
  61. package/dist/src/models/request-custom-grant.d.ts +25 -0
  62. package/dist/src/models/request-custom-grant.d.ts.map +1 -0
  63. package/dist/src/models/request-custom-grant.js +19 -0
  64. package/dist/src/models/request-custom-grant.js.map +1 -0
  65. package/dist/src/models/session-management-helper.d.ts +2 -1
  66. package/dist/src/models/session-management-helper.d.ts.map +1 -1
  67. package/dist/src/models/sign-out-error.d.ts +22 -0
  68. package/dist/src/models/sign-out-error.d.ts.map +1 -0
  69. package/dist/src/models/sign-out-error.js +19 -0
  70. package/dist/src/models/sign-out-error.js.map +1 -0
  71. package/dist/src/models/web-worker.d.ts +3 -3
  72. package/dist/src/models/web-worker.d.ts.map +1 -1
  73. package/dist/src/models/web-worker.js.map +1 -1
  74. package/dist/src/public-api.d.ts +1 -1
  75. package/dist/src/public-api.d.ts.map +1 -1
  76. package/dist/src/public-api.js +1 -1
  77. package/dist/src/public-api.js.map +1 -1
  78. package/dist/src/utils/crypto-utils.d.ts +35 -0
  79. package/dist/src/utils/crypto-utils.d.ts.map +1 -0
  80. package/dist/src/utils/crypto-utils.js +58 -0
  81. package/dist/src/utils/crypto-utils.js.map +1 -0
  82. package/dist/src/utils/spa-utils.d.ts +5 -3
  83. package/dist/src/utils/spa-utils.d.ts.map +1 -1
  84. package/dist/src/utils/spa-utils.js +26 -10
  85. package/dist/src/utils/spa-utils.js.map +1 -1
  86. package/dist/src/worker/client.worker.js +2 -2
  87. package/dist/src/worker/client.worker.js.map +1 -1
  88. package/dist/src/worker/worker-core.d.ts.map +1 -1
  89. package/dist/src/worker/worker-core.js +26 -26
  90. package/dist/src/worker/worker-core.js.map +1 -1
  91. package/dist/tsconfig.tsbuildinfo +1 -1
  92. package/package.json +31 -30
  93. package/rollup.config.js +3 -5
  94. package/src/client.ts +22 -8
  95. package/src/clients/main-thread-client.ts +52 -21
  96. package/src/clients/web-worker-client.ts +67 -26
  97. package/src/constants/errors.ts +19 -0
  98. package/src/constants/hooks.ts +2 -1
  99. package/src/constants/index.ts +1 -0
  100. package/src/constants/parameters.ts +1 -0
  101. package/src/helpers/session-management-helper.ts +31 -40
  102. package/src/index-polyfill.ts +0 -1
  103. package/src/models/client.ts +3 -2
  104. package/src/models/http-client.ts +3 -2
  105. package/src/models/index.ts +1 -0
  106. package/src/models/message.ts +1 -0
  107. package/src/models/request-custom-grant.ts +26 -0
  108. package/src/models/session-management-helper.ts +3 -2
  109. package/src/models/sign-out-error.ts +22 -0
  110. package/src/models/web-worker.ts +8 -2
  111. package/src/public-api.ts +2 -1
  112. package/src/utils/crypto-utils.ts +78 -0
  113. package/src/utils/spa-utils.ts +33 -10
  114. package/src/worker/client.worker.ts +1 -1
  115. package/src/worker/worker-core.ts +29 -27
package/.eslintrc.js CHANGED
@@ -27,8 +27,7 @@ module.exports = {
27
27
  "@typescript-eslint/explicit-function-return-type": 0,
28
28
  "@typescript-eslint/no-explicit-any": 0,
29
29
  "@typescript-eslint/no-inferrable-types": "off",
30
- "@typescript-eslint/no-unused-vars": "off",
31
- "@typescript-eslint/no-unused-vars-experimental": "warn",
30
+ "@typescript-eslint/no-unused-vars": "warn",
32
31
  "@typescript-eslint/no-use-before-define": ["warn", {
33
32
  classes: false,
34
33
  functions: false,
package/README.md CHANGED
@@ -145,15 +145,15 @@ auth.on("sign-in", (response) => {
145
145
  Before trying out the sample apps, you need to create an application in **Asgardeo**.
146
146
 
147
147
  1. Navigate to [**Asgardeo Console**](https://console.asgardeo.io/login) and click on **Applications** under **Develop** tab
148
-
148
+
149
149
  2. Click on **New Application** and then **Single Page Application**.
150
-
150
+
151
151
  3. Enter **Sample** as the name of the app and add the redirect URL(s). You can find the relevant redirect URL(s) of each sample app in the [Running the sample apps](#2-running-the-sample-apps) section.
152
-
152
+
153
153
  4. Click on Register. You will be navigated to management page of the **sample** application.
154
-
154
+
155
155
  5. Add `https://localhost:5000` to **Allowed Origins** under **Access** tab and check **Public client** option.
156
-
156
+
157
157
  6. Click on **Update** at the bottom.
158
158
 
159
159
  ### 2. Running the sample apps
@@ -725,6 +725,7 @@ If you are using TypeScript, you may want to use the `Hooks` enum that consists
725
725
  | `"http-request-success"` | `httpRequest()` (Called when an http requests returns a response successfully) |
726
726
  | `"revoke-access-token"` | `revokeAccessToken()` | A boolean value indicating if the process was successful or not |
727
727
  | `"custom-grant"` | `customGrant()` | Returns the response from the custom grant request. |
728
+ | `sign-out-failed` | `signOut()` (Called when sign out fails) | An object of type [`SignOutError`](#SignOutError).|
728
729
 
729
730
  **When the user signs out, the user is taken to the Asgardeo's logout page and then redirected back to the SPA on successful log out. Hence, developers should ensure that the `"sign-out"` hook is called when the page the user is redirected to loads.**
730
731
 
@@ -1016,6 +1017,12 @@ This extends the `AxiosRequestConfig` by providing an additional attribute that
1016
1017
  |--|--|--|
1017
1018
  |attachToken| `boolean`| Specifies if the access token should be attached to the header of the request.|
1018
1019
 
1020
+ ### SignOutError
1021
+ | Attribute | Type | Description |
1022
+ | ------------------ | ---------------------- | ---------------------------------------------- |
1023
+ | error | `string` | The error message. |
1024
+ | error_description | `string` | The error description. |
1025
+
1019
1026
  ## Develop
1020
1027
 
1021
1028
  ### Prerequisites
package/babel.config.js CHANGED
@@ -24,8 +24,7 @@ module.exports = {
24
24
  },
25
25
  plugins: [
26
26
  [ "@babel/plugin-proposal-decorators", { "legacy": true } ],
27
- "@babel/plugin-proposal-class-properties",
28
- "@babel/plugin-transform-runtime"
27
+ "@babel/plugin-proposal-class-properties"
29
28
  ],
30
29
  presets: [
31
30
  [