scordi-extension 1.14.6 → 1.14.8

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 (86) hide show
  1. package/dist/assets/loading-page-1924caaa.js +51 -0
  2. package/dist/blocks/ClearValueFormBlock.d.ts +8 -8
  3. package/dist/blocks/DataExtractBlock.d.ts +2 -2
  4. package/dist/blocks/ElementExistsBlock.d.ts +8 -8
  5. package/dist/blocks/EventClickBlock.d.ts +12 -12
  6. package/dist/blocks/FetchApiBlock.d.ts +2 -2
  7. package/dist/blocks/GetAttributeValueBlock.d.ts +8 -8
  8. package/dist/blocks/GetElementDataBlock.d.ts +14 -14
  9. package/dist/blocks/GetTextBlock.d.ts +10 -10
  10. package/dist/blocks/GetValueFormBlock.d.ts +8 -8
  11. package/dist/blocks/SaveAssetsBlock.d.ts +8 -8
  12. package/dist/blocks/ScrollBlock.d.ts +8 -8
  13. package/dist/blocks/SetValueFormBlock.d.ts +8 -8
  14. package/dist/blocks/WaitForConditionBlock.d.ts +176 -0
  15. package/dist/blocks/WaitForConditionBlock.d.ts.map +1 -0
  16. package/dist/blocks/index.d.ts +232 -96
  17. package/dist/blocks/index.d.ts.map +1 -1
  18. package/dist/blocks/types.d.ts +25 -8
  19. package/dist/blocks/types.d.ts.map +1 -1
  20. package/dist/logo.png +0 -0
  21. package/dist/manifest.json +55 -0
  22. package/dist/public/logo.png +0 -0
  23. package/dist/sdk/index.cjs +4 -1
  24. package/dist/sdk/index.d.ts +1 -0
  25. package/dist/sdk/index.d.ts.map +1 -1
  26. package/dist/sdk/index.js +5569 -1437
  27. package/dist/sdk/types.d.ts +3 -3
  28. package/dist/sdk/types.d.ts.map +1 -1
  29. package/dist/service-worker-loader.js +3 -0
  30. package/dist/src/blocks/AiParseDataBlock.ts.js +101 -0
  31. package/dist/src/blocks/ClearValueFormBlock.ts.js +55 -0
  32. package/dist/src/blocks/DataExtractBlock.ts.js +28 -0
  33. package/dist/src/blocks/ElementExistsBlock.ts.js +26 -0
  34. package/dist/src/blocks/EventClickBlock.ts.js +143 -0
  35. package/dist/src/blocks/FetchApiBlock.ts.js +50 -0
  36. package/dist/src/blocks/GetAttributeValueBlock.ts.js +33 -0
  37. package/dist/src/blocks/GetElementDataBlock.ts.js +114 -0
  38. package/dist/src/blocks/GetTextBlock.ts.js +152 -0
  39. package/dist/src/blocks/GetValueFormBlock.ts.js +52 -0
  40. package/dist/src/blocks/KeypressBlock.ts.js +89 -0
  41. package/dist/src/blocks/SaveAssetsBlock.ts.js +35 -0
  42. package/dist/src/blocks/ScrollBlock.ts.js +111 -0
  43. package/dist/src/blocks/SetValueFormBlock.ts.js +56 -0
  44. package/dist/src/blocks/WaitBlock.ts.js +24 -0
  45. package/dist/src/blocks/WaitForConditionBlock.ts.js +187 -0
  46. package/dist/src/blocks/index.ts.js +174 -0
  47. package/dist/src/blocks/types.ts.js +12 -0
  48. package/dist/src/content/components/ConfirmationUI.tsx.js +236 -0
  49. package/dist/src/content/elements/finders/CssSelector.ts.js +51 -0
  50. package/dist/src/content/elements/finders/ElementSelector.ts.js +20 -0
  51. package/dist/src/content/elements/finders/IframeSelector.ts.js +32 -0
  52. package/dist/src/content/elements/finders/ShadowDOMSelector.ts.js +38 -0
  53. package/dist/src/content/elements/finders/XPathFinder.ts.js +32 -0
  54. package/dist/src/content/elements/index.ts.js +26 -0
  55. package/dist/src/content/elements/utils/CSSSelectorGenerator.ts.js +72 -0
  56. package/dist/src/content/elements/utils/XPathGenerator.ts.js +62 -0
  57. package/dist/src/content/handler/ExternalMessageHandler.ts.js +78 -0
  58. package/dist/src/content/handler/InternalMessageHandler.ts.js +18 -0
  59. package/dist/src/content/kernel/MessageKernel.ts.js +83 -0
  60. package/dist/src/content/main.tsx-loader.js +22 -0
  61. package/dist/src/content/main.tsx.js +27 -0
  62. package/dist/src/content/utils/index.ts.js +1 -0
  63. package/dist/src/content/utils/synchronizedLock.ts.js +35 -0
  64. package/dist/src/popup/index.html +12 -0
  65. package/dist/src/types/internal-messages.ts.js +15 -0
  66. package/dist/vendor/.vite-deps-chunk-2TUXWMP5.js__v--9054997c.js +45 -0
  67. package/dist/vendor/.vite-deps-chunk-2TUXWMP5.js__v--e2a1f584.js +45 -0
  68. package/dist/vendor/.vite-deps-chunk-EL3BNLGW.js__v--e2a1f584.js +975 -0
  69. package/dist/vendor/.vite-deps-chunk-QIBDMRD4.js__v--9054997c.js +4158 -0
  70. package/dist/vendor/.vite-deps-chunk-QIBDMRD4.js__v--e2a1f584.js +4158 -0
  71. package/dist/vendor/.vite-deps-chunk-XHY3JSIG.js__v--e2a1f584.js +280 -0
  72. package/dist/vendor/.vite-deps-jsonata.js__v--d602c657.js +5761 -0
  73. package/dist/vendor/.vite-deps-jsonata.js__v--e2a1f584.js +5761 -0
  74. package/dist/vendor/.vite-deps-react-dom.js__v--e2a1f584.js +6 -0
  75. package/dist/vendor/.vite-deps-react-dom_client.js__v--e2a1f584.js +18108 -0
  76. package/dist/vendor/.vite-deps-react.js__v--e2a1f584.js +5 -0
  77. package/dist/vendor/.vite-deps-react_jsx-dev-runtime.js__v--e2a1f584.js +281 -0
  78. package/dist/vendor/.vite-deps-zod.js__v--9e0f4cc1.js +219 -0
  79. package/dist/vendor/.vite-deps-zod.js__v--e2a1f584.js +219 -0
  80. package/dist/vendor/crx-client-port.js +66 -0
  81. package/dist/vendor/crx-client-preamble.js +4 -0
  82. package/dist/vendor/react-refresh.js +670 -0
  83. package/dist/vendor/vite-client.js +1134 -0
  84. package/dist/vendor/vite-dist-client-env.mjs.js +24 -0
  85. package/dist/vendor/webcomponents-custom-elements.js +47 -0
  86. package/package.json +1 -1
@@ -0,0 +1,187 @@
1
+ import z from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
2
+ export const WaitForConditionBlockSchema = z.object({
3
+ name: z.literal("wait-for-condition"),
4
+ conditions: z.object({
5
+ urlPattern: z.string().optional(),
6
+ elementExists: z.object({
7
+ selector: z.string(),
8
+ findBy: z.enum(["cssSelector", "xpath"])
9
+ }).optional(),
10
+ cookieExists: z.string().optional(),
11
+ storageKey: z.object({
12
+ type: z.enum(["localStorage", "sessionStorage"]),
13
+ key: z.string()
14
+ }).optional(),
15
+ userConfirmation: z.boolean().optional(),
16
+ message: z.string().optional(),
17
+ buttonText: z.string().optional()
18
+ }).refine(
19
+ (data) => {
20
+ return data.urlPattern !== void 0 || data.elementExists !== void 0 || data.cookieExists !== void 0 || data.storageKey !== void 0 || data.userConfirmation === true;
21
+ },
22
+ {
23
+ message: "At least one condition must be specified"
24
+ }
25
+ ),
26
+ mode: z.enum(["auto", "manual", "auto-or-manual"]).optional(),
27
+ pollingIntervalMs: z.number().min(100).optional(),
28
+ timeoutMs: z.number().min(1e3).optional(),
29
+ position: z.enum(["top-left", "top-right", "bottom-left", "bottom-right"]).optional()
30
+ });
31
+ export function validateWaitForConditionBlock(data) {
32
+ return WaitForConditionBlockSchema.parse(data);
33
+ }
34
+ export async function handlerWaitForCondition(data) {
35
+ try {
36
+ const {
37
+ conditions,
38
+ mode = "auto-or-manual",
39
+ pollingIntervalMs = 1e3,
40
+ timeoutMs = 3e5,
41
+ position = "bottom-right"
42
+ } = data;
43
+ console.log("[WaitForCondition] Starting wait with conditions:", conditions);
44
+ console.log("[WaitForCondition] Mode:", mode, "Timeout:", timeoutMs);
45
+ const hasAutoConditions = !!(conditions.urlPattern || conditions.elementExists || conditions.cookieExists || conditions.storageKey);
46
+ const hasManualConfirmation = conditions.userConfirmation === true;
47
+ let userConfirmedPromise = null;
48
+ let confirmResolve = null;
49
+ if ((mode === "manual" || mode === "auto-or-manual") && hasManualConfirmation) {
50
+ userConfirmedPromise = new Promise((resolve) => {
51
+ confirmResolve = resolve;
52
+ });
53
+ window.dispatchEvent(
54
+ new CustomEvent("8g-show-confirmation-ui", {
55
+ detail: {
56
+ message: conditions.message || "작업을 완료하셨나요?",
57
+ buttonText: conditions.buttonText || "완료",
58
+ position,
59
+ onConfirm: confirmResolve
60
+ }
61
+ })
62
+ );
63
+ }
64
+ const checkAutoConditions = async () => {
65
+ if (conditions.urlPattern) {
66
+ try {
67
+ const regex = new RegExp(conditions.urlPattern);
68
+ if (regex.test(window.location.href)) {
69
+ return {
70
+ success: true,
71
+ reason: "urlPattern",
72
+ message: `URL matches pattern: ${conditions.urlPattern}`
73
+ };
74
+ }
75
+ } catch (error) {
76
+ console.warn("[WaitForCondition] Invalid URL pattern:", error);
77
+ }
78
+ }
79
+ if (conditions.elementExists) {
80
+ const { selector, findBy } = conditions.elementExists;
81
+ let element = null;
82
+ if (findBy === "cssSelector") {
83
+ element = document.querySelector(selector);
84
+ } else if (findBy === "xpath") {
85
+ const xpathResult = document.evaluate(
86
+ selector,
87
+ document,
88
+ null,
89
+ XPathResult.FIRST_ORDERED_NODE_TYPE,
90
+ null
91
+ );
92
+ element = xpathResult.singleNodeValue;
93
+ }
94
+ if (element) {
95
+ return {
96
+ success: true,
97
+ reason: "elementExists",
98
+ message: `Element found: ${selector}`
99
+ };
100
+ }
101
+ }
102
+ if (conditions.cookieExists) {
103
+ const cookies = document.cookie.split(";");
104
+ const cookieExists = cookies.some((cookie) => {
105
+ const [name] = cookie.trim().split("=");
106
+ return name === conditions.cookieExists;
107
+ });
108
+ if (cookieExists) {
109
+ return {
110
+ success: true,
111
+ reason: "cookieExists",
112
+ message: `Cookie found: ${conditions.cookieExists}`
113
+ };
114
+ }
115
+ }
116
+ if (conditions.storageKey) {
117
+ const { type, key } = conditions.storageKey;
118
+ const storage = type === "localStorage" ? window.localStorage : window.sessionStorage;
119
+ const value = storage.getItem(key);
120
+ if (value !== null) {
121
+ return {
122
+ success: true,
123
+ reason: "storageKey",
124
+ message: `Storage key found: ${type}.${key}`
125
+ };
126
+ }
127
+ }
128
+ return null;
129
+ };
130
+ return new Promise((resolve) => {
131
+ let intervalId = null;
132
+ let resolved = false;
133
+ const cleanup = () => {
134
+ if (intervalId) {
135
+ clearInterval(intervalId);
136
+ intervalId = null;
137
+ }
138
+ window.dispatchEvent(new CustomEvent("8g-hide-confirmation-ui"));
139
+ };
140
+ const resolveWith = (result) => {
141
+ if (resolved) return;
142
+ resolved = true;
143
+ cleanup();
144
+ console.log("[WaitForCondition] Resolved with:", result);
145
+ resolve({ data: result });
146
+ };
147
+ const timeoutId = setTimeout(() => {
148
+ resolveWith({
149
+ success: false,
150
+ reason: "timeout",
151
+ message: `Timeout after ${timeoutMs}ms`
152
+ });
153
+ }, timeoutMs);
154
+ if ((mode === "auto" || mode === "auto-or-manual") && hasAutoConditions) {
155
+ intervalId = setInterval(async () => {
156
+ const result = await checkAutoConditions();
157
+ if (result) {
158
+ clearTimeout(timeoutId);
159
+ resolveWith(result);
160
+ }
161
+ }, pollingIntervalMs);
162
+ }
163
+ if ((mode === "manual" || mode === "auto-or-manual") && userConfirmedPromise) {
164
+ userConfirmedPromise.then(() => {
165
+ clearTimeout(timeoutId);
166
+ resolveWith({
167
+ success: true,
168
+ reason: "userConfirmation",
169
+ message: "User confirmed completion"
170
+ });
171
+ });
172
+ }
173
+ if (mode === "manual" && !hasAutoConditions) {
174
+ }
175
+ });
176
+ } catch (error) {
177
+ console.error("[WaitForCondition] Error:", error);
178
+ return {
179
+ hasError: true,
180
+ message: error instanceof Error ? error.message : "Unknown error in wait-for-condition handler",
181
+ data: {
182
+ success: false,
183
+ message: error instanceof Error ? error.message : "Unknown error"
184
+ }
185
+ };
186
+ }
187
+ }
@@ -0,0 +1,174 @@
1
+ export { BaseBlockSchema } from "/src/blocks/types.ts.js";
2
+ export { createSchema, createArraySchema, Schema } from "/src/blocks/AiParseDataBlock.ts.js";
3
+ export { GetTextBlockSchema } from "/src/blocks/GetTextBlock.ts.js";
4
+ export { GetAttributeValueBlockSchema } from "/src/blocks/GetAttributeValueBlock.ts.js";
5
+ export { GetValueFormsBlockSchema } from "/src/blocks/GetValueFormBlock.ts.js";
6
+ export { SetValueFormsBlockSchema } from "/src/blocks/SetValueFormBlock.ts.js";
7
+ export { ClearValueFormsBlockSchema } from "/src/blocks/ClearValueFormBlock.ts.js";
8
+ export { ElementExistsBlockSchema } from "/src/blocks/ElementExistsBlock.ts.js";
9
+ export { EventClickBlockSchema } from "/src/blocks/EventClickBlock.ts.js";
10
+ export { KeypressBlockSchema } from "/src/blocks/KeypressBlock.ts.js";
11
+ export { WaitBlockSchema } from "/src/blocks/WaitBlock.ts.js";
12
+ export { WaitForConditionBlockSchema } from "/src/blocks/WaitForConditionBlock.ts.js";
13
+ export { SaveAssetsBlockSchema } from "/src/blocks/SaveAssetsBlock.ts.js";
14
+ export { GetElementDataBlockSchema } from "/src/blocks/GetElementDataBlock.ts.js";
15
+ export { ScrollBlockSchema } from "/src/blocks/ScrollBlock.ts.js";
16
+ export { AiParseDataBlockSchema } from "/src/blocks/AiParseDataBlock.ts.js";
17
+ export { FetchApiBlockSchema } from "/src/blocks/FetchApiBlock.ts.js";
18
+ export { DataExtractBlockSchema } from "/src/blocks/DataExtractBlock.ts.js";
19
+ import { handlerGetText, validateGetTextBlock } from "/src/blocks/GetTextBlock.ts.js";
20
+ import {
21
+ handlerGetAttributeValue,
22
+ validateGetAttributeValueBlock
23
+ } from "/src/blocks/GetAttributeValueBlock.ts.js";
24
+ import {
25
+ handlerGetValueForm,
26
+ validateGetValueFormsBlock
27
+ } from "/src/blocks/GetValueFormBlock.ts.js";
28
+ import {
29
+ handlerSetValueForm,
30
+ validateSetValueFormsBlock
31
+ } from "/src/blocks/SetValueFormBlock.ts.js";
32
+ import {
33
+ handlerClearValueForm,
34
+ validateClearValueFormsBlock
35
+ } from "/src/blocks/ClearValueFormBlock.ts.js";
36
+ import {
37
+ handlerElementExists,
38
+ validateElementExistsBlock
39
+ } from "/src/blocks/ElementExistsBlock.ts.js";
40
+ import { handlerEventClick, validateEventClickBlock } from "/src/blocks/EventClickBlock.ts.js";
41
+ import { handlerKeypress, validateKeypressBlock } from "/src/blocks/KeypressBlock.ts.js";
42
+ import { handlerWait, validateWaitBlock } from "/src/blocks/WaitBlock.ts.js";
43
+ import {
44
+ handlerWaitForCondition,
45
+ validateWaitForConditionBlock
46
+ } from "/src/blocks/WaitForConditionBlock.ts.js";
47
+ import { handlerSaveAssets, validateSaveAssetsBlock } from "/src/blocks/SaveAssetsBlock.ts.js";
48
+ import {
49
+ handlerGetElementData,
50
+ validateGetElementDataBlock
51
+ } from "/src/blocks/GetElementDataBlock.ts.js";
52
+ import { handlerScroll, validateScrollBlock } from "/src/blocks/ScrollBlock.ts.js";
53
+ import { handlerAiParseData, validateAiParseDataBlock } from "/src/blocks/AiParseDataBlock.ts.js";
54
+ import { handlerFetchApi, validateFetchApiBlock } from "/src/blocks/FetchApiBlock.ts.js";
55
+ import { handlerDataExtract, validateDataExtractBlock } from "/src/blocks/DataExtractBlock.ts.js";
56
+ import { GetTextBlockSchema as GetTextBlockSchema2 } from "/src/blocks/GetTextBlock.ts.js";
57
+ import { GetAttributeValueBlockSchema as GetAttributeValueBlockSchema2 } from "/src/blocks/GetAttributeValueBlock.ts.js";
58
+ import { GetValueFormsBlockSchema as GetValueFormsBlockSchema2 } from "/src/blocks/GetValueFormBlock.ts.js";
59
+ import { SetValueFormsBlockSchema as SetValueFormsBlockSchema2 } from "/src/blocks/SetValueFormBlock.ts.js";
60
+ import { ClearValueFormsBlockSchema as ClearValueFormsBlockSchema2 } from "/src/blocks/ClearValueFormBlock.ts.js";
61
+ import { ElementExistsBlockSchema as ElementExistsBlockSchema2 } from "/src/blocks/ElementExistsBlock.ts.js";
62
+ import { EventClickBlockSchema as EventClickBlockSchema2 } from "/src/blocks/EventClickBlock.ts.js";
63
+ import { KeypressBlockSchema as KeypressBlockSchema2 } from "/src/blocks/KeypressBlock.ts.js";
64
+ import { WaitBlockSchema as WaitBlockSchema2 } from "/src/blocks/WaitBlock.ts.js";
65
+ import { WaitForConditionBlockSchema as WaitForConditionBlockSchema2 } from "/src/blocks/WaitForConditionBlock.ts.js";
66
+ import { SaveAssetsBlockSchema as SaveAssetsBlockSchema2 } from "/src/blocks/SaveAssetsBlock.ts.js";
67
+ import { GetElementDataBlockSchema as GetElementDataBlockSchema2 } from "/src/blocks/GetElementDataBlock.ts.js";
68
+ import { ScrollBlockSchema as ScrollBlockSchema2 } from "/src/blocks/ScrollBlock.ts.js";
69
+ import { AiParseDataBlockSchema as AiParseDataBlockSchema2 } from "/src/blocks/AiParseDataBlock.ts.js";
70
+ import { FetchApiBlockSchema as FetchApiBlockSchema2 } from "/src/blocks/FetchApiBlock.ts.js";
71
+ import { DataExtractBlockSchema as DataExtractBlockSchema2 } from "/src/blocks/DataExtractBlock.ts.js";
72
+ export const AllBlockSchemas = {
73
+ "get-text": GetTextBlockSchema2,
74
+ "attribute-value": GetAttributeValueBlockSchema2,
75
+ "get-value-form": GetValueFormsBlockSchema2,
76
+ "set-value-form": SetValueFormsBlockSchema2,
77
+ "clear-value-form": ClearValueFormsBlockSchema2,
78
+ "element-exists": ElementExistsBlockSchema2,
79
+ "event-click": EventClickBlockSchema2,
80
+ "keypress": KeypressBlockSchema2,
81
+ "wait": WaitBlockSchema2,
82
+ "wait-for-condition": WaitForConditionBlockSchema2,
83
+ "save-assets": SaveAssetsBlockSchema2,
84
+ "get-element-data": GetElementDataBlockSchema2,
85
+ "scroll": ScrollBlockSchema2,
86
+ "ai-parse-data": AiParseDataBlockSchema2,
87
+ "fetch-api": FetchApiBlockSchema2,
88
+ "data-extract": DataExtractBlockSchema2
89
+ };
90
+ export class BlockHandler {
91
+ // Implementation
92
+ static async executeBlock(block) {
93
+ try {
94
+ switch (block.name) {
95
+ case "get-text": {
96
+ const validatedBlock = validateGetTextBlock(block);
97
+ return await handlerGetText(validatedBlock);
98
+ }
99
+ case "attribute-value": {
100
+ const validatedBlock = validateGetAttributeValueBlock(block);
101
+ return await handlerGetAttributeValue(validatedBlock);
102
+ }
103
+ case "get-value-form": {
104
+ const validatedBlock = validateGetValueFormsBlock(block);
105
+ return await handlerGetValueForm(validatedBlock);
106
+ }
107
+ case "set-value-form": {
108
+ const validatedBlock = validateSetValueFormsBlock(block);
109
+ return await handlerSetValueForm(validatedBlock);
110
+ }
111
+ case "clear-value-form": {
112
+ const validatedBlock = validateClearValueFormsBlock(block);
113
+ return await handlerClearValueForm(validatedBlock);
114
+ }
115
+ case "element-exists": {
116
+ const validatedBlock = validateElementExistsBlock(block);
117
+ return await handlerElementExists(validatedBlock);
118
+ }
119
+ case "event-click": {
120
+ const validatedBlock = validateEventClickBlock(block);
121
+ return await handlerEventClick(validatedBlock);
122
+ }
123
+ case "keypress": {
124
+ const validatedBlock = validateKeypressBlock(block);
125
+ return await handlerKeypress(validatedBlock);
126
+ }
127
+ case "wait": {
128
+ const validatedBlock = validateWaitBlock(block);
129
+ return await handlerWait(validatedBlock);
130
+ }
131
+ case "wait-for-condition": {
132
+ const validatedBlock = validateWaitForConditionBlock(block);
133
+ return await handlerWaitForCondition(validatedBlock);
134
+ }
135
+ case "save-assets": {
136
+ const validatedBlock = validateSaveAssetsBlock(block);
137
+ return await handlerSaveAssets(validatedBlock);
138
+ }
139
+ case "get-element-data": {
140
+ const validatedBlock = validateGetElementDataBlock(block);
141
+ return await handlerGetElementData(validatedBlock);
142
+ }
143
+ case "scroll": {
144
+ const validatedBlock = validateScrollBlock(block);
145
+ return await handlerScroll(validatedBlock);
146
+ }
147
+ case "ai-parse-data": {
148
+ const validatedBlock = validateAiParseDataBlock(block);
149
+ return await handlerAiParseData(validatedBlock);
150
+ }
151
+ case "fetch-api": {
152
+ const validatedBlock = validateFetchApiBlock(block);
153
+ return await handlerFetchApi(validatedBlock);
154
+ }
155
+ case "data-extract": {
156
+ const validatedBlock = validateDataExtractBlock(block);
157
+ return await handlerDataExtract(validatedBlock);
158
+ }
159
+ default:
160
+ return {
161
+ hasError: true,
162
+ message: `Unknown block type: ${block.name}`,
163
+ data: null
164
+ };
165
+ }
166
+ } catch (error) {
167
+ return {
168
+ hasError: true,
169
+ message: error instanceof Error ? error.message : "Unknown error in block execution",
170
+ data: null
171
+ };
172
+ }
173
+ }
174
+ }
@@ -0,0 +1,12 @@
1
+ import { z } from "/vendor/.vite-deps-zod.js__v--e2a1f584.js";
2
+ export const BaseBlockSchema = z.object({
3
+ name: z.string(),
4
+ selector: z.string(),
5
+ findBy: z.enum(["cssSelector", "xpath"]),
6
+ option: z.object({
7
+ waitForSelector: z.boolean().optional(),
8
+ waitSelectorTimeout: z.number().optional(),
9
+ multiple: z.boolean().optional()
10
+ })
11
+ });
12
+ export { AllBlockSchemas } from "/src/blocks/index.ts.js";
@@ -0,0 +1,236 @@
1
+ import { createHotContext as __vite__createHotContext } from "/vendor/vite-client.js";import.meta.hot = __vite__createHotContext("/src/content/components/ConfirmationUI.tsx.js");import __vite__cjsImport0_react_jsxDevRuntime from "/vendor/.vite-deps-react_jsx-dev-runtime.js__v--e2a1f584.js"; const jsxDEV = __vite__cjsImport0_react_jsxDevRuntime["jsxDEV"];
2
+ import * as RefreshRuntime from "/vendor/react-refresh.js";
3
+ const inWebWorker = typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
4
+ let prevRefreshReg;
5
+ let prevRefreshSig;
6
+ if (import.meta.hot && !inWebWorker) {
7
+ if (!window.$RefreshReg$) {
8
+ throw new Error(
9
+ "@vitejs/plugin-react can't detect preamble. Something is wrong."
10
+ );
11
+ }
12
+ prevRefreshReg = window.$RefreshReg$;
13
+ prevRefreshSig = window.$RefreshSig$;
14
+ window.$RefreshReg$ = RefreshRuntime.getRefreshReg("/Users/kerry/Documents/GitHub/8g-extension/src/content/components/ConfirmationUI.tsx");
15
+ window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform;
16
+ }
17
+ var _s = $RefreshSig$(), _s2 = $RefreshSig$();
18
+ import __vite__cjsImport3_react from "/vendor/.vite-deps-react.js__v--e2a1f584.js"; const useEffect = __vite__cjsImport3_react["useEffect"]; const useState = __vite__cjsImport3_react["useState"];
19
+ import __vite__cjsImport4_reactDom from "/vendor/.vite-deps-react-dom.js__v--e2a1f584.js"; const createPortal = __vite__cjsImport4_reactDom["createPortal"];
20
+ const positionStyles = {
21
+ "top-left": {
22
+ top: "20px",
23
+ left: "20px"
24
+ },
25
+ "top-right": {
26
+ top: "20px",
27
+ right: "20px"
28
+ },
29
+ "bottom-left": {
30
+ bottom: "20px",
31
+ left: "20px"
32
+ },
33
+ "bottom-right": {
34
+ bottom: "20px",
35
+ right: "20px"
36
+ }
37
+ };
38
+ export function ConfirmationUI({
39
+ message,
40
+ buttonText,
41
+ position,
42
+ onConfirm,
43
+ visible
44
+ }) {
45
+ _s();
46
+ const [isAnimating, setIsAnimating] = useState(false);
47
+ useEffect(() => {
48
+ if (visible) {
49
+ setTimeout(() => setIsAnimating(true), 10);
50
+ } else {
51
+ setIsAnimating(false);
52
+ }
53
+ }, [visible]);
54
+ if (!visible) return null;
55
+ const handleConfirm = () => {
56
+ setIsAnimating(false);
57
+ setTimeout(() => {
58
+ onConfirm();
59
+ }, 200);
60
+ };
61
+ const containerStyle = {
62
+ position: "fixed",
63
+ ...positionStyles[position],
64
+ zIndex: 2147483647,
65
+ // Maximum z-index
66
+ backgroundColor: "#ffffff",
67
+ border: "2px solid #4f46e5",
68
+ borderRadius: "12px",
69
+ padding: "16px 20px",
70
+ boxShadow: "0 10px 25px rgba(0, 0, 0, 0.2)",
71
+ display: "flex",
72
+ flexDirection: "column",
73
+ gap: "12px",
74
+ minWidth: "280px",
75
+ maxWidth: "400px",
76
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
77
+ transform: isAnimating ? "scale(1)" : "scale(0.9)",
78
+ opacity: isAnimating ? 1 : 0,
79
+ transition: "transform 0.2s ease-out, opacity 0.2s ease-out"
80
+ };
81
+ const messageStyle = {
82
+ margin: 0,
83
+ fontSize: "14px",
84
+ lineHeight: "1.5",
85
+ color: "#1f2937",
86
+ fontWeight: 500
87
+ };
88
+ const buttonStyle = {
89
+ backgroundColor: "#4f46e5",
90
+ color: "#ffffff",
91
+ border: "none",
92
+ borderRadius: "8px",
93
+ padding: "10px 16px",
94
+ fontSize: "14px",
95
+ fontWeight: 600,
96
+ cursor: "pointer",
97
+ transition: "background-color 0.2s ease",
98
+ outline: "none"
99
+ };
100
+ const buttonHoverStyle = {
101
+ backgroundColor: "#4338ca"
102
+ };
103
+ return createPortal(
104
+ /* @__PURE__ */ jsxDEV(
105
+ "div",
106
+ {
107
+ style: containerStyle,
108
+ onClick: (e) => e.stopPropagation(),
109
+ children: [
110
+ /* @__PURE__ */ jsxDEV("p", { style: messageStyle, children: message }, void 0, false, {
111
+ fileName: "/Users/kerry/Documents/GitHub/8g-extension/src/content/components/ConfirmationUI.tsx",
112
+ lineNumber: 132,
113
+ columnNumber: 7
114
+ }, this),
115
+ /* @__PURE__ */ jsxDEV(
116
+ "button",
117
+ {
118
+ style: buttonStyle,
119
+ onMouseEnter: (e) => {
120
+ e.currentTarget.style.backgroundColor = buttonHoverStyle.backgroundColor;
121
+ },
122
+ onMouseLeave: (e) => {
123
+ e.currentTarget.style.backgroundColor = buttonStyle.backgroundColor;
124
+ },
125
+ onClick: handleConfirm,
126
+ children: buttonText
127
+ },
128
+ void 0,
129
+ false,
130
+ {
131
+ fileName: "/Users/kerry/Documents/GitHub/8g-extension/src/content/components/ConfirmationUI.tsx",
132
+ lineNumber: 133,
133
+ columnNumber: 7
134
+ },
135
+ this
136
+ )
137
+ ]
138
+ },
139
+ void 0,
140
+ true,
141
+ {
142
+ fileName: "/Users/kerry/Documents/GitHub/8g-extension/src/content/components/ConfirmationUI.tsx",
143
+ lineNumber: 128,
144
+ columnNumber: 5
145
+ },
146
+ this
147
+ ),
148
+ document.body
149
+ );
150
+ }
151
+ _s(ConfirmationUI, "U13FD0PO4FR4rREA5Sq0cx8yDCA=");
152
+ _c = ConfirmationUI;
153
+ export function ConfirmationUIContainer() {
154
+ _s2();
155
+ const [uiState, setUiState] = useState({
156
+ visible: false,
157
+ message: "",
158
+ buttonText: "",
159
+ position: "bottom-right",
160
+ onConfirm: null
161
+ });
162
+ useEffect(() => {
163
+ const handleShow = (event) => {
164
+ const customEvent = event;
165
+ const { message, buttonText, position, onConfirm } = customEvent.detail;
166
+ console.log("[ConfirmationUI] Show event received:", { message, buttonText, position });
167
+ setUiState({
168
+ visible: true,
169
+ message,
170
+ buttonText,
171
+ position,
172
+ onConfirm
173
+ });
174
+ };
175
+ const handleHide = () => {
176
+ console.log("[ConfirmationUI] Hide event received");
177
+ setUiState((prev) => ({
178
+ ...prev,
179
+ visible: false
180
+ }));
181
+ };
182
+ window.addEventListener("8g-show-confirmation-ui", handleShow);
183
+ window.addEventListener("8g-hide-confirmation-ui", handleHide);
184
+ return () => {
185
+ window.removeEventListener("8g-show-confirmation-ui", handleShow);
186
+ window.removeEventListener("8g-hide-confirmation-ui", handleHide);
187
+ };
188
+ }, []);
189
+ const handleConfirm = () => {
190
+ console.log("[ConfirmationUI] User confirmed");
191
+ if (uiState.onConfirm) {
192
+ uiState.onConfirm();
193
+ }
194
+ setUiState((prev) => ({
195
+ ...prev,
196
+ visible: false
197
+ }));
198
+ };
199
+ return /* @__PURE__ */ jsxDEV(
200
+ ConfirmationUI,
201
+ {
202
+ message: uiState.message,
203
+ buttonText: uiState.buttonText,
204
+ position: uiState.position,
205
+ onConfirm: handleConfirm,
206
+ visible: uiState.visible
207
+ },
208
+ void 0,
209
+ false,
210
+ {
211
+ fileName: "/Users/kerry/Documents/GitHub/8g-extension/src/content/components/ConfirmationUI.tsx",
212
+ lineNumber: 213,
213
+ columnNumber: 5
214
+ },
215
+ this
216
+ );
217
+ }
218
+ _s2(ConfirmationUIContainer, "UwvSFkkcpfVXM3XMbs+084GMpNI=");
219
+ _c2 = ConfirmationUIContainer;
220
+ var _c, _c2;
221
+ $RefreshReg$(_c, "ConfirmationUI");
222
+ $RefreshReg$(_c2, "ConfirmationUIContainer");
223
+ if (import.meta.hot && !inWebWorker) {
224
+ window.$RefreshReg$ = prevRefreshReg;
225
+ window.$RefreshSig$ = prevRefreshSig;
226
+ }
227
+ if (import.meta.hot && !inWebWorker) {
228
+ RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
229
+ RefreshRuntime.registerExportsForReactRefresh("/Users/kerry/Documents/GitHub/8g-extension/src/content/components/ConfirmationUI.tsx", currentExports);
230
+ import.meta.hot.accept((nextExports) => {
231
+ if (!nextExports) return;
232
+ const invalidateMessage = RefreshRuntime.validateRefreshBoundaryAndEnqueueUpdate("/Users/kerry/Documents/GitHub/8g-extension/src/content/components/ConfirmationUI.tsx", currentExports, nextExports);
233
+ if (invalidateMessage) import.meta.hot.invalidate(invalidateMessage);
234
+ });
235
+ });
236
+ }
@@ -0,0 +1,51 @@
1
+ import { ElementSelector } from "/src/content/elements/finders/ElementSelector.ts.js";
2
+ export class CssSelector extends ElementSelector {
3
+ async find(data, documentCtx = document) {
4
+ const { selector, option } = data;
5
+ const { multiple = false } = option || {};
6
+ try {
7
+ const processedSelector = this.processCustomPseudoSelectors(selector, documentCtx);
8
+ if (multiple) {
9
+ return Array.from(documentCtx.querySelectorAll(processedSelector));
10
+ } else {
11
+ return documentCtx.querySelector(processedSelector);
12
+ }
13
+ } catch (error) {
14
+ console.error("CSS Selector error:", error);
15
+ return null;
16
+ }
17
+ }
18
+ processCustomPseudoSelectors(selector, documentCtx) {
19
+ const containsRegex = /:contains\(['"]([^'"]*)['"]\)/g;
20
+ if (containsRegex.test(selector)) {
21
+ this.markElementsWithText(documentCtx);
22
+ return selector.replace(
23
+ /:contains\(['"]([^'"]*)['"]\)/g,
24
+ (_match, text) => `[data-contains="${text}"]`
25
+ );
26
+ }
27
+ const equalRegex = /:equal\(['"]([^'"]*)['"]\)/g;
28
+ if (equalRegex.test(selector)) {
29
+ this.markElementsWithText(documentCtx);
30
+ return selector.replace(
31
+ /:equal\(['"]([^'"]*)['"]\)/g,
32
+ (_match, text) => `[data-equal="${text}"]`
33
+ );
34
+ }
35
+ return selector;
36
+ }
37
+ markElementsWithText(documentCtx) {
38
+ const allElements = documentCtx.querySelectorAll("*");
39
+ allElements.forEach((element) => {
40
+ const text = element.textContent?.trim() || "";
41
+ if (text) {
42
+ element.setAttribute("data-contains", text);
43
+ const childNodes = Array.from(element.childNodes);
44
+ const directText = childNodes.filter((node) => node.nodeType === Node.TEXT_NODE).map((node) => node.textContent?.trim() || "").join(" ").trim();
45
+ if (directText && directText === text || element.children.length === 0 && text) {
46
+ element.setAttribute("data-equal", text);
47
+ }
48
+ }
49
+ });
50
+ }
51
+ }
@@ -0,0 +1,20 @@
1
+ export class ElementSelector {
2
+ async waitForElement(data, documentCtx, timeout) {
3
+ return new Promise((resolve) => {
4
+ const startTime = Date.now();
5
+ const checkElement = async () => {
6
+ const element = await this.find(data, documentCtx);
7
+ if (element && (Array.isArray(element) ? element.length > 0 : true)) {
8
+ resolve(element);
9
+ return;
10
+ }
11
+ if (Date.now() - startTime >= timeout) {
12
+ resolve(null);
13
+ return;
14
+ }
15
+ setTimeout(checkElement, 100);
16
+ };
17
+ checkElement();
18
+ });
19
+ }
20
+ }