@apolitical/auth 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("auth0-js")):"function"==typeof define&&define.amd?define(["auth0-js"],n):"object"==typeof exports?exports.ApoliticalAuth=n(require("auth0-js")):e.ApoliticalAuth=n(e["auth0-js"])}(this,(function(e){return function(){"use strict";var n={852:function(n){n.exports=e}},t={};function r(e){var o=t[e];if(void 0!==o)return o.exports;var i=t[e]={exports:{}};return n[e](i,i.exports,r),i.exports}r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,{a:n}),n},r.d=function(e,n){for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){r.r(o),r.d(o,{getContext:function(){return E},passwordlessLogin:function(){return C},sendVerificationEmail:function(){return T},setContext:function(){return u}});var e=r(852),n=r.n(e),t={PLACEHOLDERS:{ORIGIN:"{{ORIGIN}}"},ENVIRONMENTS:{BETA:"beta",RC:"rc"},AUTH0:{CONNECTION:"email",DEFAULT_REDIRECT_URI:"user-onboarding/authorisation",DEFAULT_PAGE:"authorisation",RESPONSE_TYPE:"token id_token",PASSWORDLESS_LOGIN:{SIGNUP_PAGE:"signup-authorisation"},PASSWORDLESS_START:{SEND:"code",REDIRECT_URI:"signup/verify-email"},SCOPE:"openid profile email"}};const{PLACEHOLDERS:{ORIGIN:i},ENVIRONMENTS:{BETA:s,RC:c}}=t;let a=null;const u=({configs:e,environment:n,origin:t})=>{if(!n)throw new Error("Cannot set context: Environment not defined");if(!e)throw new Error("Cannot set context: REACT_APP_AUTH0_CONFIGS not defined");if(!e[n])throw new Error(`Cannot set context: REACT_APP_AUTH0_CONFIGS not defined for environment - ${JSON.stringify({configs:e,environment:n})}`);if(a=e[n],n===s||n===c){if(!t)throw new Error(`Cannot set context: Origin not defined - ${JSON.stringify(t)}`);a.audience=a.audience.replace(i,t),a.redirectUri=a.redirectUri.replace(i,t)}},E=()=>a,{AUTH0:{CONNECTION:d,DEFAULT_REDIRECT_URI:f,DEFAULT_PAGE:p,RESPONSE_TYPE:S,PASSWORDLESS_LOGIN:{SIGNUP_PAGE:l},PASSWORDLESS_START:{REDIRECT_URI:O,SEND:A},SCOPE:R}}=t,T=async e=>{const t=E(),r=new(n().WebAuth)(Object.assign({},t,{redirectUri:t.redirectUri.replace(f,O),responseType:S,scope:R}));try{return new Promise(((n,t)=>{r.passwordlessStart({connection:d,send:A,email:e.toLowerCase()},(function(e,r){e&&t(e),n(r)}))}))}catch(e){throw new Error(`Cannot start passwordless login: ${e.message}`)}},C=(e,t)=>{const r=E(),o=new(n().WebAuth)(Object.assign({},r,{redirectUri:r.redirectUri.replace(p,l),responseType:S,scope:R}));try{return new Promise(((n,r)=>{o.passwordlessLogin({connection:d,email:e,verificationCode:t},(function(e,t){e&&("access_denied"===e.code?r(new Error(`Wrong code, access denied: ${e}`)):r(new Error(e))),n(t)}))}))}catch(e){throw new Error(`Cannot complete passwordless login: ${e.message}`)}}}(),o}()}));
1
+ !function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("auth0-js")):"function"==typeof define&&define.amd?define(["auth0-js"],n):"object"==typeof exports?exports.ApoliticalAuth=n(require("auth0-js")):e.ApoliticalAuth=n(e["auth0-js"])}(this,function(e){return function(){"use strict";var n={738:function(n){n.exports=e}},t={};function r(e){var o=t[e];if(void 0!==o)return o.exports;var i=t[e]={exports:{}};return n[e](i,i.exports,r),i.exports}r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,{a:n}),n},r.d=function(e,n){for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{getContext:function(){return p},passwordlessLogin:function(){return N},sendVerificationEmail:function(){return _},setContext:function(){return f}});var i=r(738),s=r.n(i),c={PLACEHOLDERS:{ORIGIN:"{{ORIGIN}}"},ENVIRONMENTS:{BETA:"beta",RC:"rc"},AUTH0:{CONNECTION:"email",DEFAULT_REDIRECT_URI:"user-onboarding/authorisation",DEFAULT_PAGE:"authorisation",RESPONSE_TYPE:"token id_token",PASSWORDLESS_LOGIN:{SIGNUP_PAGE:"signup-authorisation"},PASSWORDLESS_START:{SEND:"code",REDIRECT_URI:"signup/verify-email"},SCOPE:"openid profile email"}};const{PLACEHOLDERS:{ORIGIN:a},ENVIRONMENTS:{BETA:u,RC:E}}=c;let d=null;const f=({configs:e,environment:n,origin:t})=>{if(!n)throw new Error("Cannot set context: Environment not defined");if(!e)throw new Error("Cannot set context: REACT_APP_AUTH0_CONFIGS not defined");if(!e[n])throw new Error(`Cannot set context: REACT_APP_AUTH0_CONFIGS not defined for environment - ${JSON.stringify({configs:e,environment:n})}`);if(d=e[n],n===u||n===E){if(!t)throw new Error(`Cannot set context: Origin not defined - ${JSON.stringify(t)}`);d.audience=d.audience.replace(a,t),d.redirectUri=d.redirectUri.replace(a,t)}},p=()=>d,{AUTH0:{CONNECTION:S,DEFAULT_REDIRECT_URI:l,DEFAULT_PAGE:O,RESPONSE_TYPE:A,PASSWORDLESS_LOGIN:{SIGNUP_PAGE:R},PASSWORDLESS_START:{REDIRECT_URI:T,SEND:C},SCOPE:P}}=c,_=async e=>{const n=p(),t=new(s().WebAuth)(Object.assign({},n,{redirectUri:n.redirectUri.replace(l,T),responseType:A,scope:P}));try{return new Promise((n,r)=>{t.passwordlessStart({connection:S,send:C,email:e.toLowerCase()},function(e,t){e&&r(e),n(t)})})}catch(e){throw new Error(`Cannot start passwordless login: ${e.message}`)}},N=(e,n)=>{const t=p(),r=new(s().WebAuth)(Object.assign({},t,{redirectUri:t.redirectUri.replace(O,R),responseType:A,scope:P}));try{return new Promise((t,o)=>{r.passwordlessLogin({connection:S,email:e,verificationCode:n},function(e,n){e&&("access_denied"===e.code?o(new Error(`Wrong code, access denied: ${e}`)):o(new Error(e))),t(n)})})}catch(e){throw new Error(`Cannot complete passwordless login: ${e.message}`)}};return o}()});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/auth",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Browser (and Node.js) library to manage authentication using Auth0",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -16,7 +16,6 @@
16
16
  "lint": "eslint --ext .js ./lib",
17
17
  "format": "prettier --write 'lib/**/*.+(js|json)'",
18
18
  "lint-format": "lint-staged",
19
- "prepare": "husky install",
20
19
  "prepack": "yarn build"
21
20
  },
22
21
  "keywords": [
@@ -25,22 +24,22 @@
25
24
  "Auth"
26
25
  ],
27
26
  "dependencies": {
28
- "auth0-js": "9.19.0"
27
+ "auth0-js": "10.2.1"
29
28
  },
30
29
  "peerDependencies": {
31
- "auth0-js": "9.19.0"
30
+ "auth0-js": "10.2.1"
32
31
  },
33
32
  "devDependencies": {
34
33
  "@apolitical/eslint-config": "2.0.1",
35
34
  "@babel/core": "7.17.10",
36
35
  "@babel/eslint-parser": "7.17.0",
37
36
  "@babel/plugin-transform-runtime": "7.17.10",
37
+ "@babel/runtime": "7.29.7",
38
38
  "@babel/preset-env": "7.17.10",
39
- "husky": "8.0.1",
40
39
  "jest": "28.1.0",
41
40
  "jest-junit": "13.2.0",
42
41
  "lint-staged": "12.4.1",
43
- "webpack": "5.72.1",
42
+ "webpack": "5.94.0",
44
43
  "webpack-cli": "4.9.2"
45
44
  },
46
45
  "eslintConfig": {
@@ -93,7 +92,7 @@
93
92
  }
94
93
  },
95
94
  "engines": {
96
- "node": ">=16.13.0"
95
+ "node": ">=20.14.0"
97
96
  },
98
97
  "lint-staged": {
99
98
  "*.js": "eslint --cache --fix --ignore-path .gitignore",
package/CHANGELOG.md DELETED
@@ -1,34 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [0.1.3] - 2023-01-31
9
- ### Added
10
- - Renovate config file
11
-
12
- ## [0.1.2] - 2022-06-29
13
- ### Changed
14
- - Pipelines ref
15
-
16
- ## [0.1.1] - 2021-05-13
17
- ### Fixed
18
- - Set context function error handling
19
-
20
- ## [0.1.0] - 2021-05-11
21
- ### Changed
22
- - The `environment` is now defined externally
23
-
24
- ## [0.0.3] - 2021-04-21
25
- ### Changed
26
- - Remove `postSignup` and `changedEmail` logic, management API will handle that
27
-
28
- ## [0.0.2] - 2021-03-08
29
- ### Fixed
30
- - Case sensitivity for sendVerificationEmail
31
-
32
- ## [0.0.1] - 2021-02-22
33
- ### Added
34
- - Initial setup