@hellocoop/react 2.1.0 → 2.1.2
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.d.ts +1 -1
- package/dist/buttons.d.ts.map +1 -1
- package/dist/buttons.js +4 -4
- package/package.json +3 -2
package/dist/buttons.d.ts
CHANGED
package/dist/buttons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../src/buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"buttons.d.ts","sourceRoot":"","sources":["../src/buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAM7C,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;CACzC;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACtD,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC,WAAW,CAAA;CACnC;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;IACvD,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;CAC3B;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC,WAAW,CAAA;CACnC;AAyDD,wBAAgB,cAAc,CAAC,KAAK,EAAE,gBAAgB,qBAErD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,qBAElD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,qBAEzD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,qBAE3D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,qBAE3D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,qBAE3D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,qBAE1D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,qBAE1D"}
|
package/dist/buttons.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.UpdateGitLabButton = exports.UpdateGitHubButton = exports.UpdateTwitterButton = exports.UpdateDiscordButton = exports.UpdatePictureButton = exports.UpdateEmailButton = exports.LoginButton = exports.ContinueButton = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const
|
|
28
|
+
const constants_1 = require("@hellocoop/constants");
|
|
29
29
|
const provider_1 = require("./provider");
|
|
30
30
|
let checkedForStylesheet = false;
|
|
31
31
|
function BaseButton({ scope, updateScope, targetURI, providerHint, label, style, color = "black", theme = "ignore-light", hover = "pop", showLoader = false, disabled = false }) {
|
|
@@ -35,13 +35,13 @@ function BaseButton({ scope, updateScope, targetURI, providerHint, label, style,
|
|
|
35
35
|
const hasStylesheet = Array.from(document.head.getElementsByTagName('link')).find((element) => {
|
|
36
36
|
var _a;
|
|
37
37
|
return element.getAttribute('rel') === 'stylesheet' &&
|
|
38
|
-
((_a = element.getAttribute('href')) === null || _a === void 0 ? void 0 : _a.startsWith(
|
|
38
|
+
((_a = element.getAttribute('href')) === null || _a === void 0 ? void 0 : _a.startsWith(constants_1.Button.STYLES_URL));
|
|
39
39
|
});
|
|
40
40
|
if (!hasStylesheet)
|
|
41
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
|
-
const helloBtnClass = (_a =
|
|
44
|
+
const helloBtnClass = (_a = constants_1.Button.CLASS_MAPPING[color]) === null || _a === void 0 ? void 0 : _a[theme];
|
|
45
45
|
const [clicked, setClicked] = (0, react_1.useState)(false);
|
|
46
46
|
const loginRoute = new URL(provider_1.routeConfig.login, "https://example.com"); // hack so we can use URL()
|
|
47
47
|
if (scope) {
|
|
@@ -66,7 +66,7 @@ function BaseButton({ scope, updateScope, targetURI, providerHint, label, style,
|
|
|
66
66
|
if (typeof window !== 'undefined')
|
|
67
67
|
window.location.href = loginRoute.pathname + loginRoute.search;
|
|
68
68
|
};
|
|
69
|
-
return (react_1.default.createElement("button", { onClick: onClickHandler, disabled: disabled || clicked, style: style, className: `hello-btn ${helloBtnClass} ${
|
|
69
|
+
return (react_1.default.createElement("button", { onClick: onClickHandler, disabled: disabled || clicked, style: style, className: `hello-btn ${helloBtnClass} ${constants_1.Button.HOVER_MAPPING[hover]} ${(showLoader || clicked) ? 'hello-btn-loader' : ''}` }, label));
|
|
70
70
|
}
|
|
71
71
|
function ContinueButton(props) {
|
|
72
72
|
return react_1.default.createElement(BaseButton, { ...props, label: "\u014D\u00A0\u00A0\u00A0Continue with Hell\u014D" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hellocoop/react",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "React SDK for Hellō https://hello.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"react-dom": ">=17"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
+
"@hellocoop/types": "*",
|
|
44
45
|
"@types/react": "^18.2.21",
|
|
45
46
|
"react": "^18.2.0",
|
|
46
47
|
"react-dom": "^18.2.0",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"node": ">=18"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@hellocoop/
|
|
55
|
+
"@hellocoop/constants": "*",
|
|
55
56
|
"swr": "^2.2.2"
|
|
56
57
|
}
|
|
57
58
|
}
|