@hellocoop/react 1.0.3 → 1.1.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/dist/buttons.js +2 -2
- package/dist/logout.d.ts +2 -2
- package/dist/logout.d.ts.map +1 -1
- package/dist/logout.js +13 -3
- package/package.json +1 -1
package/dist/buttons.js
CHANGED
|
@@ -32,13 +32,13 @@ function BaseButton({ scope, updateScope, targetURI, providerHint, label, style,
|
|
|
32
32
|
var _a;
|
|
33
33
|
//check if dev has added Hellō stylesheet to pages with Hellō buttons
|
|
34
34
|
if (typeof window != 'undefined' && !checkedForStylesheet) {
|
|
35
|
-
const hasStylesheet =
|
|
35
|
+
const hasStylesheet = Array.from(document.head.getElementsByTagName('link')).find((element) => {
|
|
36
36
|
var _a;
|
|
37
37
|
return element.getAttribute('rel') === 'stylesheet' &&
|
|
38
38
|
((_a = element.getAttribute('href')) === null || _a === void 0 ? void 0 : _a.startsWith(types_1.Button.STYLES_URL));
|
|
39
39
|
});
|
|
40
40
|
if (!hasStylesheet)
|
|
41
|
-
console.
|
|
41
|
+
console.warn('Could not find Hellō stylesheet. Please add to pages with Hellō buttons. See http://hello.dev/docs/buttons/#stylesheet for more info.');
|
|
42
42
|
checkedForStylesheet = true;
|
|
43
43
|
}
|
|
44
44
|
const helloBtnClass = (_a = types_1.Button.CLASS_MAPPING[color]) === null || _a === void 0 ? void 0 : _a[theme];
|
package/dist/logout.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const getLogOutRoute: () => string;
|
|
2
|
-
export declare function logOut(): void;
|
|
1
|
+
export declare const getLogOutRoute: (params: Record<string, any>) => string;
|
|
2
|
+
export declare function logOut(params: Record<string, any>): void;
|
|
3
3
|
//# sourceMappingURL=logout.d.ts.map
|
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":"AAeA,eAAO,MAAM,cAAc,WAAW,OAAO,MAAM,EAAE,GAAG,CAAC,WAAuB,CAAA;AAEhF,wBAAgB,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAEhD"}
|
package/dist/logout.js
CHANGED
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logOut = exports.getLogOutRoute = void 0;
|
|
4
4
|
const provider_1 = require("./provider");
|
|
5
|
-
const
|
|
5
|
+
const makeLogoutRoute = (params) => {
|
|
6
|
+
if (!params || !Object.keys(params).length)
|
|
7
|
+
return provider_1.routeConfig.logout;
|
|
8
|
+
const logoutRoute = new URL(provider_1.routeConfig.logout, "https://example.com"); // hack so we can use URL()
|
|
9
|
+
for (let key in params) {
|
|
10
|
+
logoutRoute.searchParams.set(key, params[key]);
|
|
11
|
+
}
|
|
12
|
+
return logoutRoute.pathname + logoutRoute.search;
|
|
13
|
+
};
|
|
14
|
+
const loginRoute = new URL(provider_1.routeConfig.login, "https://example.com"); // hack so we can use URL()
|
|
15
|
+
const getLogOutRoute = (params) => provider_1.routeConfig.logout;
|
|
6
16
|
exports.getLogOutRoute = getLogOutRoute;
|
|
7
|
-
function logOut() {
|
|
17
|
+
function logOut(params) {
|
|
8
18
|
if (typeof window !== 'undefined')
|
|
9
|
-
window.location.href =
|
|
19
|
+
window.location.href = makeLogoutRoute(params);
|
|
10
20
|
}
|
|
11
21
|
exports.logOut = logOut;
|