@rich-automation/lotto 2.0.5 → 2.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.
Files changed (35) hide show
  1. package/README.md +1 -0
  2. package/lib/cjs/controllers/factory.js +7 -0
  3. package/lib/cjs/controllers/playwright/playwright.page.js +3 -2
  4. package/lib/cjs/controllers/puppeteer/puppeteer.page.js +3 -2
  5. package/lib/cjs/controllers/webview/bridgeScript.js +125 -0
  6. package/lib/cjs/controllers/webview/index.js +35 -0
  7. package/lib/cjs/controllers/webview/types.js +2 -0
  8. package/lib/cjs/controllers/webview/webview.page.js +106 -0
  9. package/lib/cjs/index.js +1 -1
  10. package/lib/cjs/{lottoService.js → services/lottoService.core.js} +20 -22
  11. package/lib/cjs/services/lottoService.js +17 -0
  12. package/lib/esm/controllers/factory.js +7 -0
  13. package/lib/esm/controllers/playwright/playwright.page.js +3 -2
  14. package/lib/esm/controllers/puppeteer/puppeteer.page.js +3 -2
  15. package/lib/esm/controllers/webview/bridgeScript.js +122 -0
  16. package/lib/esm/controllers/webview/index.js +31 -0
  17. package/lib/esm/controllers/webview/types.js +1 -0
  18. package/lib/esm/controllers/webview/webview.page.js +102 -0
  19. package/lib/esm/index.js +1 -1
  20. package/lib/esm/index.native.js +163 -0
  21. package/lib/esm/{lottoService.js → services/lottoService.core.js} +18 -20
  22. package/lib/esm/services/lottoService.js +10 -0
  23. package/lib/tsconfig.native.tsbuildinfo +1 -0
  24. package/lib/typescript/controllers/playwright/playwright.page.d.ts +3 -1
  25. package/lib/typescript/controllers/puppeteer/puppeteer.page.d.ts +3 -1
  26. package/lib/typescript/controllers/webview/bridgeScript.d.ts +1 -0
  27. package/lib/typescript/controllers/webview/index.d.ts +12 -0
  28. package/lib/typescript/controllers/webview/types.d.ts +11 -0
  29. package/lib/typescript/controllers/webview/webview.page.d.ts +22 -0
  30. package/lib/typescript/index.d.ts +1 -1
  31. package/lib/typescript/index.native.d.ts +19 -0
  32. package/lib/typescript/{lottoService.d.ts → services/lottoService.core.d.ts} +4 -4
  33. package/lib/typescript/services/lottoService.d.ts +5 -0
  34. package/lib/typescript/types.d.ts +5 -2
  35. package/package.json +32 -6
@@ -1,6 +1,7 @@
1
1
  import type { LogLevel } from './logger';
2
2
  import type { PuppeteerNode } from 'puppeteer';
3
3
  import type { BrowserType } from 'playwright-core';
4
+ import type { WebViewBridge } from './controllers/webview/types';
4
5
  export interface LottoServiceInterface {
5
6
  destroy(): Promise<void>;
6
7
  signIn(id: string, password: string): Promise<string>;
@@ -12,7 +13,7 @@ export interface LottoServiceInterface {
12
13
  purchase(amount: number): Promise<number[][]>;
13
14
  getCheckWinningLink(numbers: number[][], round: number): string;
14
15
  }
15
- export type BrowserController = PuppeteerNode | BrowserType | 'api';
16
+ export type BrowserController = PuppeteerNode | BrowserType | WebViewBridge | 'api';
16
17
  export interface BrowserConfigs<T extends BrowserController = BrowserController> {
17
18
  controller: T;
18
19
  logLevel?: LogLevel;
@@ -32,7 +33,9 @@ export interface BrowserControllerInterface<T extends BrowserController = Browse
32
33
  }
33
34
  export interface BrowserPageInterface {
34
35
  url(): Promise<string>;
35
- goto(url: string): Promise<void>;
36
+ goto(url: string, options?: {
37
+ waitUntil?: 'load' | 'idle';
38
+ }): Promise<void>;
36
39
  fill(selector: string, value: string | number): Promise<void>;
37
40
  click(selector: string, domDirect?: boolean): Promise<void>;
38
41
  select(selector: string, value: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rich-automation/lotto",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "Lotto module",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -19,6 +19,17 @@
19
19
  "main": "lib/cjs/index",
20
20
  "module": "lib/esm/index",
21
21
  "types": "lib/typescript/index.d.ts",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./lib/typescript/index.d.ts",
25
+ "import": "./lib/esm/index.js",
26
+ "require": "./lib/cjs/index.js"
27
+ },
28
+ "./react-native": {
29
+ "types": "./lib/typescript/index.native.d.ts",
30
+ "import": "./lib/esm/index.native.js"
31
+ }
32
+ },
22
33
  "files": [
23
34
  "lib",
24
35
  "package.json",
@@ -29,11 +40,12 @@
29
40
  "prepack": "yarn build",
30
41
  "release:ci": "release-it --ci --npm.skipChecks",
31
42
  "release:ci:test": "release-it --ci --npm.skipChecks --dry-run",
32
- "start": "ts-node ./example/app",
33
- "build": "rm -rf lib && yarn build:cjs && yarn build:esm && yarn build:dts",
43
+ "start": "TS_NODE_PROJECT=tsconfig.base.json ts-node ./example/app",
44
+ "build": "rm -rf lib && yarn build:cjs && yarn build:esm && yarn build:dts && yarn build:native",
34
45
  "build:cjs": "tsc --project tsconfig.cjs.json --verbatimModuleSyntax false && echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json",
35
46
  "build:esm": "tsc --project tsconfig.esm.json && echo '{\"type\": \"module\"}' > lib/esm/package.json",
36
- "build:dts": "tsc --project tsconfig.json --emitDeclarationOnly --declaration --declarationDir lib/typescript",
47
+ "build:dts": "tsc --project tsconfig.base.json --emitDeclarationOnly --declaration --declarationDir lib/typescript",
48
+ "build:native": "tsc --project tsconfig.native.json",
37
49
  "test": "jest --forceExit --detectOpenHandles",
38
50
  "install:puppeteer": "node ./node_modules/puppeteer/install.mjs",
39
51
  "install:playwright": "npx playwright install chromium --with-deps",
@@ -41,7 +53,7 @@
41
53
  "fix:eslint": "eslint --fix src --ext js,jsx,ts,tsx ",
42
54
  "fix:prettier": "prettier --write \"src/**/*.{ts,tsx,js}\"",
43
55
  "lint": "yarn lint:ts && yarn lint:eslint && yarn lint:prettier",
44
- "lint:ts": "tsc --noEmit",
56
+ "lint:ts": "tsc --noEmit -p tsconfig.base.json && tsc --noEmit -p tsconfig.native.json",
45
57
  "lint:eslint": "eslint src --ext js,jsx,ts,tsx ",
46
58
  "lint:prettier": "prettier --check \"src/**/*.{ts,tsx,js}\""
47
59
  },
@@ -51,7 +63,9 @@
51
63
  },
52
64
  "peerDependencies": {
53
65
  "playwright": "^1.35.0",
54
- "puppeteer": "^20.5.0"
66
+ "puppeteer": "^20.5.0",
67
+ "react": "^19.1.0",
68
+ "react-native-webview": "^13.0.0"
55
69
  },
56
70
  "peerDependenciesMeta": {
57
71
  "playwright": {
@@ -59,6 +73,15 @@
59
73
  },
60
74
  "puppeteer": {
61
75
  "optional": true
76
+ },
77
+ "react": {
78
+ "optional": true
79
+ },
80
+ "react-native": {
81
+ "optional": true
82
+ },
83
+ "react-native-webview": {
84
+ "optional": true
62
85
  }
63
86
  },
64
87
  "devDependencies": {
@@ -66,6 +89,7 @@
66
89
  "@babel/preset-env": "^7.21.4",
67
90
  "@babel/preset-typescript": "^7.21.4",
68
91
  "@types/jest": "^29.5.0",
92
+ "@types/react": "^19.2.14",
69
93
  "@typescript-eslint/eslint-plugin": "^5.58.0",
70
94
  "@typescript-eslint/parser": "^5.58.0",
71
95
  "babel-jest": "^29.5.0",
@@ -77,6 +101,8 @@
77
101
  "playwright": "^1.51.1",
78
102
  "prettier": "^2.8.7",
79
103
  "puppeteer": "^24.6.1",
104
+ "react-native": "^0.84.0",
105
+ "react-native-webview": "^13.16.0",
80
106
  "release-it": "^15.10.3",
81
107
  "ts-node": "^10.9.1",
82
108
  "typescript": "^5.0.4"