@thangved/callback-window 1.0.1-1

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.
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,p,f)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of x(o))!a.call(r,e)&&e!==p&&m(r,e,{get:()=>o[e],enumerable:!(f=t(o,e))||f.enumerable});return r};var c=r=>b(m({},"__esModule",{value:!0}),r);var d={};module.exports=c(d);
@@ -0,0 +1,28 @@
1
+ interface IStartCallbackWindowOptions {
2
+ /**
3
+ * Url to open
4
+ */
5
+ url: string;
6
+ /**
7
+ * Time to close window in milliseconds
8
+ */
9
+ timeout?: number;
10
+ /**
11
+ * The window checker should be closed. By default, the window will close when the origin of the window equals the origin of the parent window.
12
+ * @param currentUrl - current url of the opened window
13
+ */
14
+ shouldClose?: (currentUrl: string) => boolean | Promise<boolean>;
15
+ /**
16
+ * What to do when browser does not allow opening new windows, by default will change the current window address to the destination address
17
+ * @param url
18
+ */
19
+ onBrowserNotAllowed?: (url: string) => {};
20
+ }
21
+ interface IStartCallbackWindowResult {
22
+ redirectedUrl: string;
23
+ }
24
+ interface IStartCallbackWindow {
25
+ (options: IStartCallbackWindowOptions): Promise<IStartCallbackWindowResult>;
26
+ }
27
+
28
+ export type { IStartCallbackWindow, IStartCallbackWindowOptions, IStartCallbackWindowResult };
@@ -0,0 +1,28 @@
1
+ interface IStartCallbackWindowOptions {
2
+ /**
3
+ * Url to open
4
+ */
5
+ url: string;
6
+ /**
7
+ * Time to close window in milliseconds
8
+ */
9
+ timeout?: number;
10
+ /**
11
+ * The window checker should be closed. By default, the window will close when the origin of the window equals the origin of the parent window.
12
+ * @param currentUrl - current url of the opened window
13
+ */
14
+ shouldClose?: (currentUrl: string) => boolean | Promise<boolean>;
15
+ /**
16
+ * What to do when browser does not allow opening new windows, by default will change the current window address to the destination address
17
+ * @param url
18
+ */
19
+ onBrowserNotAllowed?: (url: string) => {};
20
+ }
21
+ interface IStartCallbackWindowResult {
22
+ redirectedUrl: string;
23
+ }
24
+ interface IStartCallbackWindow {
25
+ (options: IStartCallbackWindowOptions): Promise<IStartCallbackWindowResult>;
26
+ }
27
+
28
+ export type { IStartCallbackWindow, IStartCallbackWindowOptions, IStartCallbackWindowResult };
File without changes
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "author": "Kim Minh Thang (thangved)",
3
+ "browser": "./dist/esm/index.js",
4
+ "bugs": {
5
+ "url": "https://github.com/thangved/callback-window/issues"
6
+ },
7
+ "description": "A simple handler for external website window callback",
8
+ "devDependencies": {
9
+ "@arethetypeswrong/cli": "^0.18.2",
10
+ "tsup": "^8.5.0"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "browser": {
15
+ "default": "./dist/esm/index.js",
16
+ "types": "./dist/esm/index.d.ts"
17
+ },
18
+ "import": {
19
+ "default": "./dist/esm/index.js",
20
+ "types": "./dist/esm/index.d.ts"
21
+ },
22
+ "require": {
23
+ "default": "./dist/cjs/index.cjs",
24
+ "types": "./dist/cjs/index.d.cts"
25
+ }
26
+ }
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "homepage": "https://github.com/thangved/callback-window#readme",
32
+ "keywords": [
33
+ "js"
34
+ ],
35
+ "license": "MIT",
36
+ "main": "dist/cjs/index.js",
37
+ "name": "@thangved/callback-window",
38
+ "private": false,
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "repository": {
43
+ "directory": "packages/callback-window",
44
+ "type": "git",
45
+ "url": "git+https://github.com/thangved/callback-window.git"
46
+ },
47
+ "scripts": {
48
+ "build": "NODE_ENV=production tsup && npm run check-exports",
49
+ "check-exports": "attw --pack .",
50
+ "dev": "tsup --watch"
51
+ },
52
+ "sideEffects": false,
53
+ "type": "module",
54
+ "types": "./dist/esm/index.d.ts",
55
+ "version": "1.0.1-1"
56
+ }