@hellocoop/react 3.1.9 → 3.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/README.md +2 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +10 -4
- package/dist/buttons.d.ts.map +1 -1
- package/dist/buttons.js +39 -25
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -19
- package/dist/login-status.d.ts.map +1 -1
- package/dist/login-status.js +3 -0
- package/dist/logout.d.ts.map +1 -1
- package/dist/logout.js +4 -3
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +19 -7
- package/package.json +55 -55
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
[Hellō](https://hello.dev) is an identity network that provides login and registration using the standard OpenID Connect protocol. Hellō offers your users choice between all popular social login providers.
|
|
4
4
|
|
|
5
5
|
This [React](https://react.dev/) package provides:
|
|
6
|
+
|
|
6
7
|
- React components for buttons and logged in context
|
|
7
8
|
|
|
8
9
|
See the [React SDK documentation](https://www.hello.dev/docs/sdks/react) for details.
|
|
9
10
|
|
|
10
|
-
The [Hellō Next.js Starter](https://github.com/hellocoop/hello-nextjs-starter) is a sample app that uses this package and [npx `@hellocoop/quickstart --nextjs`](https://www.hello.dev/docs/sdks/quickstart#nextjs) to be configured in seconds. Check it out deployed on [Vercel](https://hello-netjs-starter.vercel.app) or [Netlify](https://hello-nextjs-starter.netlify.app).
|
|
11
|
+
The [Hellō Next.js Starter](https://github.com/hellocoop/hello-nextjs-starter) is a sample app that uses this package and [npx `@hellocoop/quickstart --nextjs`](https://www.hello.dev/docs/sdks/quickstart#nextjs) to be configured in seconds. Check it out deployed on [Vercel](https://hello-netjs-starter.vercel.app) or [Netlify](https://hello-nextjs-starter.netlify.app).
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAelD,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,IAAI,GAAG,EAAE,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;CAClC,CAAA;AAED,eAAO,MAAM,OAAO,QAAO,SAe1B,CAAA"}
|
package/dist/auth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -18,14 +19,19 @@ const fetcher = async (url) => {
|
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
const useAuth = () => {
|
|
22
|
+
// TBD type: Auth | any -- TS complaints without any
|
|
21
23
|
const defaultAuth = (0, provider_1.useHelloProviderContext)();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
if (defaultAuth)
|
|
25
|
+
return {
|
|
26
|
+
auth: defaultAuth,
|
|
27
|
+
isLoading: false,
|
|
28
|
+
isLoggedIn: defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.isLoggedIn,
|
|
29
|
+
};
|
|
30
|
+
const { data: auth, isLoading } = (0, swr_1.default)(provider_1.routeConfig.auth, fetcher);
|
|
25
31
|
return {
|
|
26
32
|
auth: auth || {},
|
|
27
33
|
isLoading,
|
|
28
|
-
isLoggedIn: auth === null || auth === void 0 ? void 0 : auth.isLoggedIn
|
|
34
|
+
isLoggedIn: auth === null || auth === void 0 ? void 0 : auth.isLoggedIn,
|
|
29
35
|
};
|
|
30
36
|
};
|
|
31
37
|
exports.useAuth = useAuth;
|
package/dist/buttons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../src/buttons.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../src/buttons.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAM/C,UAAU,iBAAiB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,YAAY,EAAE,GAAG,MAAM,CAAA;IACtC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACtD,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IACxB,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACvD,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IACxD,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB;AA+FD,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,qBAIrD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBAIlD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,qBAQ3D"}
|
package/dist/buttons.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
@@ -15,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
16
|
}) : function(o, v) {
|
|
16
17
|
o["default"] = v;
|
|
17
18
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
25
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
37
|
exports.ContinueButton = ContinueButton;
|
|
27
38
|
exports.LoginButton = LoginButton;
|
|
@@ -30,7 +41,7 @@ const react_1 = __importStar(require("react"));
|
|
|
30
41
|
const definitions_1 = require("@hellocoop/definitions");
|
|
31
42
|
const provider_1 = require("./provider");
|
|
32
43
|
let checkedForStylesheet = false;
|
|
33
|
-
function BaseButton({ scope, update = false, targetURI, providerHint, label, style, color =
|
|
44
|
+
function BaseButton({ scope, update = false, targetURI, providerHint, label, style, color = 'black', theme = 'ignore-light', hover = 'pop', showLoader = false, disabled = false, promptLogin = false, promptConsent = false, loginHint, domainHint, }) {
|
|
34
45
|
var _a;
|
|
35
46
|
//check if dev has added Hellō stylesheet to pages with Hellō buttons
|
|
36
47
|
if (typeof window != 'undefined' && !checkedForStylesheet) {
|
|
@@ -45,50 +56,53 @@ function BaseButton({ scope, update = false, targetURI, providerHint, label, sty
|
|
|
45
56
|
}
|
|
46
57
|
const helloBtnClass = (_a = definitions_1.Button.CLASS_MAPPING[color]) === null || _a === void 0 ? void 0 : _a[theme];
|
|
47
58
|
const [clicked, setClicked] = (0, react_1.useState)(false);
|
|
48
|
-
const loginRoute = new URL(provider_1.routeConfig.login,
|
|
59
|
+
const loginRoute = new URL(provider_1.routeConfig.login, 'https://example.com'); // hack so we can use URL()
|
|
49
60
|
if (scope) {
|
|
50
61
|
if (typeof scope == 'string')
|
|
51
|
-
loginRoute.searchParams.set(
|
|
62
|
+
loginRoute.searchParams.set('scope', scope);
|
|
52
63
|
else
|
|
53
|
-
loginRoute.searchParams.set(
|
|
64
|
+
loginRoute.searchParams.set('scope', scope.join(' '));
|
|
54
65
|
}
|
|
55
|
-
targetURI =
|
|
66
|
+
targetURI =
|
|
67
|
+
targetURI ||
|
|
68
|
+
(typeof window != 'undefined' && window.location.pathname) ||
|
|
69
|
+
'';
|
|
56
70
|
//window can be undefined when running server-side
|
|
57
|
-
loginRoute.searchParams.set(
|
|
71
|
+
loginRoute.searchParams.set('target_uri', targetURI);
|
|
58
72
|
if (update)
|
|
59
|
-
loginRoute.searchParams.set(
|
|
73
|
+
loginRoute.searchParams.set('prompt', 'consent');
|
|
60
74
|
if (loginHint)
|
|
61
|
-
loginRoute.searchParams.set(
|
|
75
|
+
loginRoute.searchParams.set('login_hint', loginHint);
|
|
62
76
|
if (domainHint)
|
|
63
|
-
loginRoute.searchParams.set(
|
|
77
|
+
loginRoute.searchParams.set('domain_hint', domainHint);
|
|
64
78
|
if (providerHint) {
|
|
65
79
|
if (typeof providerHint == 'string')
|
|
66
|
-
loginRoute.searchParams.set(
|
|
80
|
+
loginRoute.searchParams.set('provider_hint', providerHint);
|
|
67
81
|
else
|
|
68
|
-
loginRoute.searchParams.set(
|
|
82
|
+
loginRoute.searchParams.set('provider_hint', providerHint.join(' '));
|
|
69
83
|
}
|
|
70
84
|
if (promptLogin && promptConsent) {
|
|
71
|
-
loginRoute.searchParams.set(
|
|
85
|
+
loginRoute.searchParams.set('prompt', 'login consent');
|
|
72
86
|
}
|
|
73
87
|
else if (promptLogin) {
|
|
74
|
-
loginRoute.searchParams.set(
|
|
88
|
+
loginRoute.searchParams.set('prompt', 'login');
|
|
75
89
|
}
|
|
76
90
|
else if (promptConsent) {
|
|
77
|
-
loginRoute.searchParams.set(
|
|
91
|
+
loginRoute.searchParams.set('prompt', 'consent');
|
|
78
92
|
}
|
|
79
93
|
const onClickHandler = () => {
|
|
80
94
|
setClicked(true);
|
|
81
95
|
if (typeof window !== 'undefined')
|
|
82
96
|
window.location.href = loginRoute.pathname + loginRoute.search;
|
|
83
97
|
};
|
|
84
|
-
return (react_1.default.createElement("button", { onClick: onClickHandler, disabled: disabled || clicked, style: style, className: `hello-btn ${helloBtnClass} ${definitions_1.Button.HOVER_MAPPING[hover]} ${
|
|
98
|
+
return (react_1.default.createElement("button", { onClick: onClickHandler, disabled: disabled || clicked, style: style, className: `hello-btn ${helloBtnClass} ${definitions_1.Button.HOVER_MAPPING[hover]} ${showLoader || clicked ? 'hello-btn-loader' : ''}` }, label));
|
|
85
99
|
}
|
|
86
100
|
function ContinueButton(props) {
|
|
87
|
-
return react_1.default.createElement(BaseButton, { label: "\u014D\u00A0\u00A0\u00A0Continue with Hell\u014D", ...props });
|
|
101
|
+
return (react_1.default.createElement(BaseButton, { label: "\u014D\u00A0\u00A0\u00A0Continue with Hell\u014D", ...props }));
|
|
88
102
|
}
|
|
89
103
|
function LoginButton(props) {
|
|
90
|
-
return react_1.default.createElement(BaseButton, { label: "\u014D\u00A0\u00A0\u00A0Log in with Hell\u014D", ...props });
|
|
104
|
+
return (react_1.default.createElement(BaseButton, { label: "\u014D\u00A0\u00A0\u00A0Log in with Hell\u014D", ...props }));
|
|
91
105
|
}
|
|
92
106
|
function UpdateProfileButton(props) {
|
|
93
|
-
return react_1.default.createElement(BaseButton, { label: "\u014D\u00A0\u00A0\u00A0Update Profile with Hell\u014D", ...props, update: true });
|
|
107
|
+
return (react_1.default.createElement(BaseButton, { label: "\u014D\u00A0\u00A0\u00A0Update Profile with Hell\u014D", ...props, update: true }));
|
|
94
108
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { AuthState, useAuth } from './auth';
|
|
2
|
+
export { getLogOutRoute, logOut } from './logout';
|
|
3
|
+
export { BaseButtonProps, LoginButtonProps, UpdateButtonProps, ContinueButton, LoginButton, UpdateProfileButton, } from './buttons';
|
|
4
|
+
export { LoggedIn, LoggedOut } from './login-status';
|
|
5
|
+
export { RouteConfig, routeConfig, HelloProvider, useHelloProviderContext, } from './provider';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EACH,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,mBAAmB,GACtB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EACH,WAAW,EACX,WAAW,EACX,aAAa,EACb,uBAAuB,GAC1B,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
exports.useHelloProviderContext = exports.HelloProvider = exports.routeConfig = exports.LoggedOut = exports.LoggedIn = exports.UpdateProfileButton = exports.LoginButton = exports.ContinueButton = exports.logOut = exports.getLogOutRoute = exports.useAuth = void 0;
|
|
4
|
+
var auth_1 = require("./auth");
|
|
5
|
+
Object.defineProperty(exports, "useAuth", { enumerable: true, get: function () { return auth_1.useAuth; } });
|
|
6
|
+
var logout_1 = require("./logout");
|
|
7
|
+
Object.defineProperty(exports, "getLogOutRoute", { enumerable: true, get: function () { return logout_1.getLogOutRoute; } });
|
|
8
|
+
Object.defineProperty(exports, "logOut", { enumerable: true, get: function () { return logout_1.logOut; } });
|
|
9
|
+
var buttons_1 = require("./buttons");
|
|
10
|
+
Object.defineProperty(exports, "ContinueButton", { enumerable: true, get: function () { return buttons_1.ContinueButton; } });
|
|
11
|
+
Object.defineProperty(exports, "LoginButton", { enumerable: true, get: function () { return buttons_1.LoginButton; } });
|
|
12
|
+
Object.defineProperty(exports, "UpdateProfileButton", { enumerable: true, get: function () { return buttons_1.UpdateProfileButton; } });
|
|
13
|
+
var login_status_1 = require("./login-status");
|
|
14
|
+
Object.defineProperty(exports, "LoggedIn", { enumerable: true, get: function () { return login_status_1.LoggedIn; } });
|
|
15
|
+
Object.defineProperty(exports, "LoggedOut", { enumerable: true, get: function () { return login_status_1.LoggedOut; } });
|
|
16
|
+
var provider_1 = require("./provider");
|
|
17
|
+
Object.defineProperty(exports, "routeConfig", { enumerable: true, get: function () { return provider_1.routeConfig; } });
|
|
18
|
+
Object.defineProperty(exports, "HelloProvider", { enumerable: true, get: function () { return provider_1.HelloProvider; } });
|
|
19
|
+
Object.defineProperty(exports, "useHelloProviderContext", { enumerable: true, get: function () { return provider_1.useHelloProviderContext; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-status.d.ts","sourceRoot":"","sources":["../src/login-status.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login-status.d.ts","sourceRoot":"","sources":["../src/login-status.tsx"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,GAAG,CAAA;CAAE,OAGvD;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,GAAG,CAAA;CAAE,OAGxD"}
|
package/dist/login-status.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.LoggedIn = LoggedIn;
|
|
@@ -5,10 +6,12 @@ exports.LoggedOut = LoggedOut;
|
|
|
5
6
|
const auth_1 = require("./auth");
|
|
6
7
|
const isLoggedIn = () => { var _a; return ((_a = (0, auth_1.useAuth)()) === null || _a === void 0 ? void 0 : _a.isLoggedIn) || false; };
|
|
7
8
|
function LoggedIn({ children }) {
|
|
9
|
+
//TBD type: any
|
|
8
10
|
if (isLoggedIn())
|
|
9
11
|
return children;
|
|
10
12
|
}
|
|
11
13
|
function LoggedOut({ children }) {
|
|
14
|
+
//TBD type: any
|
|
12
15
|
if (!isLoggedIn())
|
|
13
16
|
return children;
|
|
14
17
|
}
|
package/dist/logout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../src/logout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../src/logout.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc,WAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,WAC/B,CAAA;AAE3B,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAGjD"}
|
package/dist/logout.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.getLogOutRoute = void 0;
|
|
@@ -6,13 +7,13 @@ const provider_1 = require("./provider");
|
|
|
6
7
|
const makeLogoutRoute = (params) => {
|
|
7
8
|
if (!params || !Object.keys(params).length)
|
|
8
9
|
return provider_1.routeConfig.logout;
|
|
9
|
-
const logoutRoute = new URL(provider_1.routeConfig.logout,
|
|
10
|
-
for (
|
|
10
|
+
const logoutRoute = new URL(provider_1.routeConfig.logout, 'https://example.com'); // hack so we can use URL()
|
|
11
|
+
for (const key in params) {
|
|
11
12
|
logoutRoute.searchParams.set(key, params[key]);
|
|
12
13
|
}
|
|
13
14
|
return logoutRoute.pathname + logoutRoute.search;
|
|
14
15
|
};
|
|
15
|
-
const loginRoute = new URL(
|
|
16
|
+
// const loginRoute = new URL(routeConfig.login, 'https://example.com') // hack so we can use URL()
|
|
16
17
|
const getLogOutRoute = (params) => makeLogoutRoute(params);
|
|
17
18
|
exports.getLogOutRoute = getLogOutRoute;
|
|
18
19
|
function logOut(params) {
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAExD,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACjB,CAAA;AACD,eAAO,MAAM,WAAW,EAAE,WAIzB,CAAA;AAID,QAAA,MAAM,aAAa,+BAAgC,GAAG,sBAQrD,CAAA;AAED,QAAA,MAAM,uBAAuB,iBAE5B,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,CAAA"}
|
package/dist/provider.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
@@ -15,13 +16,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
16
|
}) : function(o, v) {
|
|
16
17
|
o["default"] = v;
|
|
17
18
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
25
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
37
|
exports.useHelloProviderContext = exports.HelloProvider = exports.routeConfig = void 0;
|
|
27
38
|
const react_1 = __importStar(require("react"));
|
|
@@ -32,6 +43,7 @@ exports.routeConfig = {
|
|
|
32
43
|
};
|
|
33
44
|
const HelloContext = (0, react_1.createContext)(undefined);
|
|
34
45
|
const HelloProvider = ({ children, auth, config }) => {
|
|
46
|
+
//TBD any
|
|
35
47
|
if (config === null || config === void 0 ? void 0 : config.login)
|
|
36
48
|
exports.routeConfig.login = config.login;
|
|
37
49
|
if (config === null || config === void 0 ? void 0 : config.auth)
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
2
|
+
"name": "@hellocoop/react",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "React SDK for Hellō https://hello.dev",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/hellocoop/packages.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://www.hello.dev/docs/sdks/react",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"reactjs",
|
|
17
|
+
"react",
|
|
18
|
+
"react.js",
|
|
19
|
+
"hello",
|
|
20
|
+
"openid",
|
|
21
|
+
"oidc",
|
|
22
|
+
"sso"
|
|
23
|
+
],
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "Hello Identity Co-op",
|
|
26
|
+
"email": "contact@hello.coop",
|
|
27
|
+
"url": "https://hello.coop"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/hellocoop/packages/issues"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"watch": "tsc --watch --declaration",
|
|
35
|
+
"prebuild": "rimraf dist/",
|
|
36
|
+
"build": "tsc --declaration"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": ">=17",
|
|
40
|
+
"react-dom": ">=17"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/react": "^18.2.21",
|
|
44
|
+
"react": "^19.0.0",
|
|
45
|
+
"react-dom": "^19.0.0",
|
|
46
|
+
"rimraf": "^5.0.1",
|
|
47
|
+
"typescript": "^5.2.2"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=18"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@hellocoop/definitions": "^1.0.9",
|
|
54
|
+
"swr": "^2.2.2"
|
|
55
|
+
},
|
|
56
|
+
"gitHead": "96cc2f3fa1a3724a4a96b19cc7c5d97f04cc49f8"
|
|
57
57
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 Hellō
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|