@restorehub/widget 1.0.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 +109 -0
- package/dist/react.esm.js +219 -0
- package/dist/react.esm.js.map +1 -0
- package/dist/react.js +221 -0
- package/dist/react.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/popup.d.ts +13 -0
- package/dist/types/popup.d.ts.map +1 -0
- package/dist/types/react.d.ts +12 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types.d.ts +49 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/widget.d.ts +13 -0
- package/dist/types/widget.d.ts.map +1 -0
- package/dist/widget.esm.js +197 -0
- package/dist/widget.esm.js.map +1 -0
- package/dist/widget.js +208 -0
- package/dist/widget.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../src/popup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAO/C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,IAAI,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,WAAW,GAAG,IAAI,CAmEvE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKzF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { type ButtonHTMLAttributes } from "react";
|
|
2
|
+
import type { WidgetSuccessResult, WidgetError } from "./types";
|
|
3
|
+
export interface RestoreHubButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "onError"> {
|
|
4
|
+
serverSlug: string;
|
|
5
|
+
onSuccess?: (result: WidgetSuccessResult) => void;
|
|
6
|
+
onError?: (error: WidgetError) => void;
|
|
7
|
+
buttonText?: string;
|
|
8
|
+
buttonColor?: string;
|
|
9
|
+
buttonTextColor?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function RestoreHubButton({ serverSlug, onSuccess, onError, buttonText, buttonColor, buttonTextColor, style, children, ...buttonProps }: RestoreHubButtonProps): React.JSX.Element;
|
|
12
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAqB,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EAAqB,mBAAmB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnF,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAiC,EACjC,WAAuB,EACvB,eAA2B,EAC3B,KAAK,EACL,QAAQ,EACR,GAAG,WAAW,EACf,EAAE,qBAAqB,qBAmDvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.object.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.string.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.array.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.collection.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.promise.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.float16.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../src/types.ts","../../src/popup.ts","../../src/widget.ts","../../src/index.ts","../../../../node_modules/.pnpm/@types+react@18.3.28/node_modules/@types/react/global.d.ts","../../../../node_modules/.pnpm/csstype@3.2.3/node_modules/csstype/index.d.ts","../../../../node_modules/.pnpm/@types+prop-types@15.7.15/node_modules/@types/prop-types/index.d.ts","../../../../node_modules/.pnpm/@types+react@18.3.28/node_modules/@types/react/index.d.ts","../../src/react.tsx"],"fileIdsList":[[86,87,88],[82,84],[82],[82,84,89],[82,83]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"2ab096661c711e4a81cc464fa1e6feb929a54f5340b46b0a07ac6bbf857471f0","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"73f78680d4c08509933daf80947902f6ff41b6230f94dd002ae372620adb0f60","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5239f5c01bcfa9cd32f37c496cf19c61d69d37e48be9de612b541aac915805b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},"46aa28d9d944dbd72aaf73ae93ed1cbe90e57d7a89013e9e8c9880befb184558","3977a6540f183919ea522c98a943a91d8fb205cb004ce844e68205ab42850aaf",{"version":"7b2d5faeb1e4d46190fa6c8797daa88d86fcac9e68ae266877a9c3d073380a11","signature":"be2e4ae18ebeb4993a24ee691eeebb981e57d3a5678b011c25e1c1050373e1f4"},{"version":"9185c0acf13455d1d212ca25c0a59cc52ab5e3c26c690e1e408edfde39906cf0","signature":"4f55470b2d20a73e2d3ccb22f6d03f627e80ecbf1d1c4f0b16d81ca813deca48"},{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc","impliedFormat":1},{"version":"035312d4945d13efa134ae482f6dc56a1a9346f7ac3be7ccbad5741058ce87f3","affectsGlobalScope":true,"impliedFormat":1},"a722e95a67050935b12656356cc2546f14dfd9c0ec5bae4788c9e11a72fd0d25"],"root":[[82,85],90],"options":{"declaration":true,"declarationMap":true,"emitDeclarationOnly":false,"esModuleInterop":true,"importHelpers":true,"jsx":2,"module":99,"noEmitHelpers":true,"outDir":"./","skipLibCheck":true,"sourceMap":true,"strict":true,"target":6},"referencedMap":[[89,1],[85,2],[83,3],[90,4],[84,5]],"version":"5.9.3"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface WidgetInitOptions {
|
|
2
|
+
/** The server's RestoreHub UUID (found in the dashboard widget settings) */
|
|
3
|
+
serverSlug: string;
|
|
4
|
+
/** Called when verification succeeds, with a JWT token and basic user info */
|
|
5
|
+
onSuccess?: (result: WidgetSuccessResult) => void;
|
|
6
|
+
/** Called when verification fails or the popup is closed without completing */
|
|
7
|
+
onError?: (error: WidgetError) => void;
|
|
8
|
+
/** Optional theme overrides */
|
|
9
|
+
theme?: WidgetTheme;
|
|
10
|
+
}
|
|
11
|
+
export interface WidgetSuccessResult {
|
|
12
|
+
token: string;
|
|
13
|
+
user: {
|
|
14
|
+
id: string;
|
|
15
|
+
username: string;
|
|
16
|
+
avatar: string | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface WidgetError {
|
|
20
|
+
code: WidgetErrorCode;
|
|
21
|
+
message: string;
|
|
22
|
+
}
|
|
23
|
+
export type WidgetErrorCode = "POPUP_BLOCKED" | "POPUP_CLOSED" | "ORIGIN_NOT_ALLOWED" | "VERIFICATION_FAILED" | "NETWORK_ERROR" | "TIMEOUT";
|
|
24
|
+
export interface WidgetTheme {
|
|
25
|
+
buttonText?: string;
|
|
26
|
+
buttonColor?: string;
|
|
27
|
+
buttonTextColor?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface WidgetState {
|
|
30
|
+
initialized: boolean;
|
|
31
|
+
serverSlug: string | null;
|
|
32
|
+
options: WidgetInitOptions | null;
|
|
33
|
+
}
|
|
34
|
+
export interface PostMessageSuccess {
|
|
35
|
+
type: "RESTOREHUB_SUCCESS";
|
|
36
|
+
token: string;
|
|
37
|
+
user: {
|
|
38
|
+
id: string;
|
|
39
|
+
username: string;
|
|
40
|
+
avatar: string | null;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export interface PostMessageError {
|
|
44
|
+
type: "RESTOREHUB_ERROR";
|
|
45
|
+
code: WidgetErrorCode;
|
|
46
|
+
message: string;
|
|
47
|
+
}
|
|
48
|
+
export type PostMessageEvent = PostMessageSuccess | PostMessageError;
|
|
49
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,eAAe,GACvB,eAAe,GACf,cAAc,GACd,oBAAoB,GACpB,qBAAqB,GACrB,eAAe,GACf,SAAS,CAAC;AAEd,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WidgetInitOptions, WidgetSuccessResult } from "./types";
|
|
2
|
+
export declare function init(options: WidgetInitOptions): void;
|
|
3
|
+
export declare function open(): void;
|
|
4
|
+
/**
|
|
5
|
+
* One-liner: init + open in a single call. Returns a promise.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* const result = await RestoreHub.verify("my-server");
|
|
9
|
+
* console.log(result.user.username, result.token);
|
|
10
|
+
*/
|
|
11
|
+
export declare function verify(serverSlug: string): Promise<WidgetSuccessResult>;
|
|
12
|
+
export declare function destroy(): void;
|
|
13
|
+
//# sourceMappingURL=widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/widget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EAEjB,mBAAmB,EAGpB,MAAM,SAAS,CAAC;AAsCjB,wBAAgB,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAQrD;AAED,wBAAgB,IAAI,IAAI,IAAI,CAwD3B;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAUvE;AAED,wBAAgB,OAAO,IAAI,IAAI,CAS9B"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
const POPUP_WIDTH = 520;
|
|
2
|
+
const POPUP_HEIGHT = 700;
|
|
3
|
+
const POPUP_CLOSE_POLL_MS = 500;
|
|
4
|
+
const POPUP_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
|
|
5
|
+
function openPopup(options) {
|
|
6
|
+
const { url, onClose } = options;
|
|
7
|
+
// Center the popup on the screen
|
|
8
|
+
const left = Math.max(0, Math.round(window.screenX + (window.outerWidth - POPUP_WIDTH) / 2));
|
|
9
|
+
const top = Math.max(0, Math.round(window.screenY + (window.outerHeight - POPUP_HEIGHT) / 2));
|
|
10
|
+
const features = [
|
|
11
|
+
`width=${POPUP_WIDTH}`,
|
|
12
|
+
`height=${POPUP_HEIGHT}`,
|
|
13
|
+
`left=${left}`,
|
|
14
|
+
`top=${top}`,
|
|
15
|
+
"menubar=no",
|
|
16
|
+
"toolbar=no",
|
|
17
|
+
"location=no",
|
|
18
|
+
"status=no",
|
|
19
|
+
"scrollbars=yes",
|
|
20
|
+
"resizable=yes",
|
|
21
|
+
].join(",");
|
|
22
|
+
const popup = window.open(url, "restorehub_sso", features);
|
|
23
|
+
if (!popup || popup.closed || typeof popup.closed === "undefined") {
|
|
24
|
+
// Popup was blocked
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
let pollInterval = null;
|
|
28
|
+
let timeoutHandle = null;
|
|
29
|
+
let settled = false;
|
|
30
|
+
function cleanup() {
|
|
31
|
+
if (pollInterval)
|
|
32
|
+
clearInterval(pollInterval);
|
|
33
|
+
if (timeoutHandle)
|
|
34
|
+
clearTimeout(timeoutHandle);
|
|
35
|
+
}
|
|
36
|
+
function settle(reason) {
|
|
37
|
+
if (settled)
|
|
38
|
+
return;
|
|
39
|
+
settled = true;
|
|
40
|
+
cleanup();
|
|
41
|
+
onClose(reason);
|
|
42
|
+
}
|
|
43
|
+
// Poll for popup closure (user closed without completing)
|
|
44
|
+
pollInterval = setInterval(() => {
|
|
45
|
+
if (popup.closed) {
|
|
46
|
+
settle("POPUP_CLOSED");
|
|
47
|
+
}
|
|
48
|
+
}, POPUP_CLOSE_POLL_MS);
|
|
49
|
+
// Absolute timeout — if the user takes more than 10 minutes, give up
|
|
50
|
+
timeoutHandle = setTimeout(() => {
|
|
51
|
+
if (!popup.closed)
|
|
52
|
+
popup.close();
|
|
53
|
+
settle("TIMEOUT");
|
|
54
|
+
}, POPUP_TIMEOUT_MS);
|
|
55
|
+
return {
|
|
56
|
+
window: popup,
|
|
57
|
+
close() {
|
|
58
|
+
cleanup();
|
|
59
|
+
settled = true;
|
|
60
|
+
if (!popup.closed)
|
|
61
|
+
popup.close();
|
|
62
|
+
},
|
|
63
|
+
isClosed() {
|
|
64
|
+
return popup.closed;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function buildPopupUrl(baseUrl, serverSlug, origin) {
|
|
69
|
+
const url = new URL(`${baseUrl}/verify/${serverSlug}`);
|
|
70
|
+
url.searchParams.set("mode", "widget");
|
|
71
|
+
url.searchParams.set("origin", encodeURIComponent(origin));
|
|
72
|
+
return url.toString();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const RESTOREHUB_BASE_URL = "https://restorehub.net";
|
|
76
|
+
const state = {
|
|
77
|
+
initialized: false,
|
|
78
|
+
serverSlug: null,
|
|
79
|
+
options: null,
|
|
80
|
+
};
|
|
81
|
+
let activeMessageHandler = null;
|
|
82
|
+
let activePopup = null;
|
|
83
|
+
function removeMessageHandler() {
|
|
84
|
+
if (activeMessageHandler) {
|
|
85
|
+
window.removeEventListener("message", activeMessageHandler);
|
|
86
|
+
activeMessageHandler = null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function handleSuccess(result) {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
removeMessageHandler();
|
|
92
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
93
|
+
activePopup.close();
|
|
94
|
+
}
|
|
95
|
+
activePopup = null;
|
|
96
|
+
(_b = (_a = state.options) === null || _a === void 0 ? void 0 : _a.onSuccess) === null || _b === void 0 ? void 0 : _b.call(_a, result);
|
|
97
|
+
}
|
|
98
|
+
function handleError(code, message) {
|
|
99
|
+
var _a, _b;
|
|
100
|
+
removeMessageHandler();
|
|
101
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
102
|
+
activePopup.close();
|
|
103
|
+
}
|
|
104
|
+
activePopup = null;
|
|
105
|
+
(_b = (_a = state.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, { code, message });
|
|
106
|
+
}
|
|
107
|
+
function init(options) {
|
|
108
|
+
if (state.initialized) {
|
|
109
|
+
console.warn("[RestoreHub] init() called more than once. Ignoring.");
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
state.initialized = true;
|
|
113
|
+
state.serverSlug = options.serverSlug;
|
|
114
|
+
state.options = options;
|
|
115
|
+
}
|
|
116
|
+
function open() {
|
|
117
|
+
if (!state.initialized || !state.serverSlug || !state.options) {
|
|
118
|
+
throw new Error("[RestoreHub] Call RestoreHub.init() before RestoreHub.open()");
|
|
119
|
+
}
|
|
120
|
+
// Close any existing popup
|
|
121
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
122
|
+
activePopup.close();
|
|
123
|
+
}
|
|
124
|
+
removeMessageHandler();
|
|
125
|
+
const origin = window.location.origin;
|
|
126
|
+
const popupUrl = buildPopupUrl(RESTOREHUB_BASE_URL, state.serverSlug, origin);
|
|
127
|
+
// Set up the postMessage listener BEFORE opening the popup
|
|
128
|
+
const messageHandler = (event) => {
|
|
129
|
+
// Only accept messages from the RestoreHub domain
|
|
130
|
+
if (event.origin !== RESTOREHUB_BASE_URL)
|
|
131
|
+
return;
|
|
132
|
+
const data = event.data;
|
|
133
|
+
if (!data || typeof data.type !== "string")
|
|
134
|
+
return;
|
|
135
|
+
if (data.type === "RESTOREHUB_SUCCESS") {
|
|
136
|
+
handleSuccess({ token: data.token, user: data.user });
|
|
137
|
+
}
|
|
138
|
+
else if (data.type === "RESTOREHUB_ERROR") {
|
|
139
|
+
handleError(data.code, data.message);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
window.addEventListener("message", messageHandler);
|
|
143
|
+
activeMessageHandler = messageHandler;
|
|
144
|
+
const popup = openPopup({
|
|
145
|
+
url: popupUrl,
|
|
146
|
+
onClose(reason) {
|
|
147
|
+
// Only fire error if we haven't already settled via postMessage
|
|
148
|
+
if (activeMessageHandler) {
|
|
149
|
+
removeMessageHandler();
|
|
150
|
+
activePopup = null;
|
|
151
|
+
handleError(reason, `Popup closed: ${reason}`);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
if (!popup) {
|
|
156
|
+
// Popup was blocked — fall back to redirect
|
|
157
|
+
removeMessageHandler();
|
|
158
|
+
console.warn("[RestoreHub] Popup blocked. Falling back to redirect.");
|
|
159
|
+
const redirectUrl = new URL(popupUrl);
|
|
160
|
+
redirectUrl.searchParams.delete("mode");
|
|
161
|
+
redirectUrl.searchParams.delete("origin");
|
|
162
|
+
window.location.href = redirectUrl.toString();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
activePopup = popup;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* One-liner: init + open in a single call. Returns a promise.
|
|
169
|
+
*
|
|
170
|
+
* Usage:
|
|
171
|
+
* const result = await RestoreHub.verify("my-server");
|
|
172
|
+
* console.log(result.user.username, result.token);
|
|
173
|
+
*/
|
|
174
|
+
function verify(serverSlug) {
|
|
175
|
+
return new Promise((resolve, reject) => {
|
|
176
|
+
destroy(); // clean up any previous instance
|
|
177
|
+
init({
|
|
178
|
+
serverSlug,
|
|
179
|
+
onSuccess: (result) => { destroy(); resolve(result); },
|
|
180
|
+
onError: (err) => { destroy(); reject(err); },
|
|
181
|
+
});
|
|
182
|
+
open();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function destroy() {
|
|
186
|
+
removeMessageHandler();
|
|
187
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
188
|
+
activePopup.close();
|
|
189
|
+
}
|
|
190
|
+
activePopup = null;
|
|
191
|
+
state.initialized = false;
|
|
192
|
+
state.serverSlug = null;
|
|
193
|
+
state.options = null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export { destroy, init, open, verify };
|
|
197
|
+
//# sourceMappingURL=widget.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.esm.js","sources":["../src/popup.ts","../src/widget.ts"],"sourcesContent":[null,null],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,GAAG;AACvB,MAAM,YAAY,GAAG,GAAG;AACxB,MAAM,mBAAmB,GAAG,GAAG;AAC/B,MAAM,gBAAgB,GAAG,EAAE,GAAG,E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,oBAAoB,EAAE;IACtB,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAE;QAC1C,WAAW,CAAC,KAAK,EAAE;IACrB;IACA,WAAW,GAAG,IAAI;AAClB,IAAA,KAAK,CAAC,WAAW,GAAG,KAAK;AACzB,IAAA,KAAK,CAAC,UAAU,GAAG,IAAI;AACvB,IAAA,KAAK,CAAC,OAAO,GAAG,IAAI;AACtB;;;;"}
|
package/dist/widget.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RestoreHub = {}));
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
|
+
|
|
7
|
+
const POPUP_WIDTH = 520;
|
|
8
|
+
const POPUP_HEIGHT = 700;
|
|
9
|
+
const POPUP_CLOSE_POLL_MS = 500;
|
|
10
|
+
const POPUP_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
|
|
11
|
+
function openPopup(options) {
|
|
12
|
+
const { url, onClose } = options;
|
|
13
|
+
// Center the popup on the screen
|
|
14
|
+
const left = Math.max(0, Math.round(window.screenX + (window.outerWidth - POPUP_WIDTH) / 2));
|
|
15
|
+
const top = Math.max(0, Math.round(window.screenY + (window.outerHeight - POPUP_HEIGHT) / 2));
|
|
16
|
+
const features = [
|
|
17
|
+
`width=${POPUP_WIDTH}`,
|
|
18
|
+
`height=${POPUP_HEIGHT}`,
|
|
19
|
+
`left=${left}`,
|
|
20
|
+
`top=${top}`,
|
|
21
|
+
"menubar=no",
|
|
22
|
+
"toolbar=no",
|
|
23
|
+
"location=no",
|
|
24
|
+
"status=no",
|
|
25
|
+
"scrollbars=yes",
|
|
26
|
+
"resizable=yes",
|
|
27
|
+
].join(",");
|
|
28
|
+
const popup = window.open(url, "restorehub_sso", features);
|
|
29
|
+
if (!popup || popup.closed || typeof popup.closed === "undefined") {
|
|
30
|
+
// Popup was blocked
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
let pollInterval = null;
|
|
34
|
+
let timeoutHandle = null;
|
|
35
|
+
let settled = false;
|
|
36
|
+
function cleanup() {
|
|
37
|
+
if (pollInterval)
|
|
38
|
+
clearInterval(pollInterval);
|
|
39
|
+
if (timeoutHandle)
|
|
40
|
+
clearTimeout(timeoutHandle);
|
|
41
|
+
}
|
|
42
|
+
function settle(reason) {
|
|
43
|
+
if (settled)
|
|
44
|
+
return;
|
|
45
|
+
settled = true;
|
|
46
|
+
cleanup();
|
|
47
|
+
onClose(reason);
|
|
48
|
+
}
|
|
49
|
+
// Poll for popup closure (user closed without completing)
|
|
50
|
+
pollInterval = setInterval(() => {
|
|
51
|
+
if (popup.closed) {
|
|
52
|
+
settle("POPUP_CLOSED");
|
|
53
|
+
}
|
|
54
|
+
}, POPUP_CLOSE_POLL_MS);
|
|
55
|
+
// Absolute timeout — if the user takes more than 10 minutes, give up
|
|
56
|
+
timeoutHandle = setTimeout(() => {
|
|
57
|
+
if (!popup.closed)
|
|
58
|
+
popup.close();
|
|
59
|
+
settle("TIMEOUT");
|
|
60
|
+
}, POPUP_TIMEOUT_MS);
|
|
61
|
+
return {
|
|
62
|
+
window: popup,
|
|
63
|
+
close() {
|
|
64
|
+
cleanup();
|
|
65
|
+
settled = true;
|
|
66
|
+
if (!popup.closed)
|
|
67
|
+
popup.close();
|
|
68
|
+
},
|
|
69
|
+
isClosed() {
|
|
70
|
+
return popup.closed;
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function buildPopupUrl(baseUrl, serverSlug, origin) {
|
|
75
|
+
const url = new URL(`${baseUrl}/verify/${serverSlug}`);
|
|
76
|
+
url.searchParams.set("mode", "widget");
|
|
77
|
+
url.searchParams.set("origin", encodeURIComponent(origin));
|
|
78
|
+
return url.toString();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const RESTOREHUB_BASE_URL = "https://restorehub.net";
|
|
82
|
+
const state = {
|
|
83
|
+
initialized: false,
|
|
84
|
+
serverSlug: null,
|
|
85
|
+
options: null,
|
|
86
|
+
};
|
|
87
|
+
let activeMessageHandler = null;
|
|
88
|
+
let activePopup = null;
|
|
89
|
+
function removeMessageHandler() {
|
|
90
|
+
if (activeMessageHandler) {
|
|
91
|
+
window.removeEventListener("message", activeMessageHandler);
|
|
92
|
+
activeMessageHandler = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function handleSuccess(result) {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
removeMessageHandler();
|
|
98
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
99
|
+
activePopup.close();
|
|
100
|
+
}
|
|
101
|
+
activePopup = null;
|
|
102
|
+
(_b = (_a = state.options) === null || _a === void 0 ? void 0 : _a.onSuccess) === null || _b === void 0 ? void 0 : _b.call(_a, result);
|
|
103
|
+
}
|
|
104
|
+
function handleError(code, message) {
|
|
105
|
+
var _a, _b;
|
|
106
|
+
removeMessageHandler();
|
|
107
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
108
|
+
activePopup.close();
|
|
109
|
+
}
|
|
110
|
+
activePopup = null;
|
|
111
|
+
(_b = (_a = state.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, { code, message });
|
|
112
|
+
}
|
|
113
|
+
function init(options) {
|
|
114
|
+
if (state.initialized) {
|
|
115
|
+
console.warn("[RestoreHub] init() called more than once. Ignoring.");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
state.initialized = true;
|
|
119
|
+
state.serverSlug = options.serverSlug;
|
|
120
|
+
state.options = options;
|
|
121
|
+
}
|
|
122
|
+
function open() {
|
|
123
|
+
if (!state.initialized || !state.serverSlug || !state.options) {
|
|
124
|
+
throw new Error("[RestoreHub] Call RestoreHub.init() before RestoreHub.open()");
|
|
125
|
+
}
|
|
126
|
+
// Close any existing popup
|
|
127
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
128
|
+
activePopup.close();
|
|
129
|
+
}
|
|
130
|
+
removeMessageHandler();
|
|
131
|
+
const origin = window.location.origin;
|
|
132
|
+
const popupUrl = buildPopupUrl(RESTOREHUB_BASE_URL, state.serverSlug, origin);
|
|
133
|
+
// Set up the postMessage listener BEFORE opening the popup
|
|
134
|
+
const messageHandler = (event) => {
|
|
135
|
+
// Only accept messages from the RestoreHub domain
|
|
136
|
+
if (event.origin !== RESTOREHUB_BASE_URL)
|
|
137
|
+
return;
|
|
138
|
+
const data = event.data;
|
|
139
|
+
if (!data || typeof data.type !== "string")
|
|
140
|
+
return;
|
|
141
|
+
if (data.type === "RESTOREHUB_SUCCESS") {
|
|
142
|
+
handleSuccess({ token: data.token, user: data.user });
|
|
143
|
+
}
|
|
144
|
+
else if (data.type === "RESTOREHUB_ERROR") {
|
|
145
|
+
handleError(data.code, data.message);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
window.addEventListener("message", messageHandler);
|
|
149
|
+
activeMessageHandler = messageHandler;
|
|
150
|
+
const popup = openPopup({
|
|
151
|
+
url: popupUrl,
|
|
152
|
+
onClose(reason) {
|
|
153
|
+
// Only fire error if we haven't already settled via postMessage
|
|
154
|
+
if (activeMessageHandler) {
|
|
155
|
+
removeMessageHandler();
|
|
156
|
+
activePopup = null;
|
|
157
|
+
handleError(reason, `Popup closed: ${reason}`);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
if (!popup) {
|
|
162
|
+
// Popup was blocked — fall back to redirect
|
|
163
|
+
removeMessageHandler();
|
|
164
|
+
console.warn("[RestoreHub] Popup blocked. Falling back to redirect.");
|
|
165
|
+
const redirectUrl = new URL(popupUrl);
|
|
166
|
+
redirectUrl.searchParams.delete("mode");
|
|
167
|
+
redirectUrl.searchParams.delete("origin");
|
|
168
|
+
window.location.href = redirectUrl.toString();
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
activePopup = popup;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* One-liner: init + open in a single call. Returns a promise.
|
|
175
|
+
*
|
|
176
|
+
* Usage:
|
|
177
|
+
* const result = await RestoreHub.verify("my-server");
|
|
178
|
+
* console.log(result.user.username, result.token);
|
|
179
|
+
*/
|
|
180
|
+
function verify(serverSlug) {
|
|
181
|
+
return new Promise((resolve, reject) => {
|
|
182
|
+
destroy(); // clean up any previous instance
|
|
183
|
+
init({
|
|
184
|
+
serverSlug,
|
|
185
|
+
onSuccess: (result) => { destroy(); resolve(result); },
|
|
186
|
+
onError: (err) => { destroy(); reject(err); },
|
|
187
|
+
});
|
|
188
|
+
open();
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function destroy() {
|
|
192
|
+
removeMessageHandler();
|
|
193
|
+
if (activePopup && !activePopup.isClosed()) {
|
|
194
|
+
activePopup.close();
|
|
195
|
+
}
|
|
196
|
+
activePopup = null;
|
|
197
|
+
state.initialized = false;
|
|
198
|
+
state.serverSlug = null;
|
|
199
|
+
state.options = null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
exports.destroy = destroy;
|
|
203
|
+
exports.init = init;
|
|
204
|
+
exports.open = open;
|
|
205
|
+
exports.verify = verify;
|
|
206
|
+
|
|
207
|
+
}));
|
|
208
|
+
//# sourceMappingURL=widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.js","sources":["../src/popup.ts","../src/widget.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;;;;IAEA,MAAM,WAAW,GAAG,GAAG;IACvB,MAAM,YAAY,GAAG,GAAG;IACxB,MAAM,mBAAmB,GAAG,GAAG;IAC/B,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAalC,SAAU,SAAS,CAAC,OAAyB,EAAA;IACjD,IAAA,MAAM,EAAE,GA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,EAAE;YAC1C,WAAW,CAAC,KAAK,EAAE;QACrB;QACA,WAAW,GAAG,IAAI;IAClB,IAAA,KAAK,CAAC,WAAW,GAAG,KAAK;IACzB,IAAA,KAAK,CAAC,UAAU,GAAG,IAAI;IACvB,IAAA,KAAK,CAAC,OAAO,GAAG,IAAI;IACtB;;;;;;;;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@restorehub/widget",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Embeddable Discord verification widget for Restore Hub. Add Discord SSO and member verification to any website with one line of code.",
|
|
5
|
+
"main": "./dist/widget.js",
|
|
6
|
+
"module": "./dist/widget.esm.js",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/widget.esm.js",
|
|
11
|
+
"require": "./dist/widget.js",
|
|
12
|
+
"types": "./dist/types/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./react": {
|
|
15
|
+
"import": "./dist/react.esm.js",
|
|
16
|
+
"require": "./dist/react.js",
|
|
17
|
+
"types": "./dist/types/react.d.ts"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": ["dist"],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"discord",
|
|
23
|
+
"verification",
|
|
24
|
+
"sso",
|
|
25
|
+
"oauth",
|
|
26
|
+
"widget",
|
|
27
|
+
"restorehub",
|
|
28
|
+
"restore-hub",
|
|
29
|
+
"discord-verification",
|
|
30
|
+
"discord-sso",
|
|
31
|
+
"member-verification",
|
|
32
|
+
"embed",
|
|
33
|
+
"react"
|
|
34
|
+
],
|
|
35
|
+
"author": "Restore Hub <support@restorehub.net>",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"homepage": "https://restorehub.net",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/alphajew420/restorehub"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/alphajew420/restorehub/issues"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "rollup -c rollup.config.ts --configPlugin typescript",
|
|
47
|
+
"prepublishOnly": "npm run build",
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"react": ">=18.0.0",
|
|
53
|
+
"react-dom": ">=18.0.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"react": { "optional": true },
|
|
57
|
+
"react-dom": { "optional": true }
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
61
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
62
|
+
"@types/react": "^18.3.18",
|
|
63
|
+
"rollup": "^4.30.1",
|
|
64
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
65
|
+
"typescript": "^5.7.0",
|
|
66
|
+
"vitest": "^3.0.0",
|
|
67
|
+
"jsdom": "^25.0.1",
|
|
68
|
+
"@vitest/browser": "^3.0.0"
|
|
69
|
+
}
|
|
70
|
+
}
|