@cap-kit/test-plugin 0.1.2 → 1.0.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.
Files changed (32) hide show
  1. package/README.md +63 -31
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/io/capkit/test/Test.kt +61 -0
  4. package/android/src/main/java/io/capkit/test/TestConfig.kt +51 -0
  5. package/android/src/main/java/io/capkit/test/TestPlugin.kt +116 -0
  6. package/android/src/main/java/io/capkit/test/utils/Logger.kt +85 -0
  7. package/android/src/main/java/io/capkit/test/utils/TestUtils.kt +14 -0
  8. package/dist/docs.json +57 -21
  9. package/dist/esm/definitions.d.ts +137 -35
  10. package/dist/esm/definitions.js +23 -1
  11. package/dist/esm/definitions.js.map +1 -1
  12. package/dist/esm/index.d.ts +4 -4
  13. package/dist/esm/index.js +4 -16
  14. package/dist/esm/index.js.map +1 -1
  15. package/dist/esm/web.d.ts +16 -27
  16. package/dist/esm/web.js +25 -28
  17. package/dist/esm/web.js.map +1 -1
  18. package/dist/plugin.cjs.js +54 -39
  19. package/dist/plugin.cjs.js.map +1 -1
  20. package/dist/plugin.js +54 -39
  21. package/dist/plugin.js.map +1 -1
  22. package/ios/Sources/TestPlugin/Test.swift +40 -8
  23. package/ios/Sources/TestPlugin/TestConfig.swift +52 -9
  24. package/ios/Sources/TestPlugin/TestPlugin.swift +83 -34
  25. package/ios/Sources/TestPlugin/Utils/Logging.swift +57 -0
  26. package/ios/Sources/TestPlugin/Utils/TestUtils.swift +12 -0
  27. package/package.json +9 -9
  28. package/android/src/main/java/com/capkit/test/Logger.kt +0 -25
  29. package/android/src/main/java/com/capkit/test/Test.kt +0 -20
  30. package/android/src/main/java/com/capkit/test/TestConfig.kt +0 -16
  31. package/android/src/main/java/com/capkit/test/TestPlugin.kt +0 -60
  32. package/ios/Sources/TestPlugin/Logging.swift +0 -32
package/dist/docs.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "api": {
3
3
  "name": "TestPlugin",
4
4
  "slug": "testplugin",
5
- "docs": "Capacitor Test plugin interface.",
5
+ "docs": "Public JavaScript API for the Test Capacitor plugin.\n\nThis interface defines a stable, platform-agnostic API.\nAll methods behave consistently across Android, iOS, and Web.",
6
6
  "tags": [],
7
7
  "methods": [
8
8
  {
@@ -11,7 +11,7 @@
11
11
  "parameters": [
12
12
  {
13
13
  "name": "options",
14
- "docs": "- The options containing the value to echo.",
14
+ "docs": "Object containing the value to echo.",
15
15
  "type": "EchoOptions"
16
16
  }
17
17
  ],
@@ -19,28 +19,43 @@
19
19
  "tags": [
20
20
  {
21
21
  "name": "param",
22
- "text": "options - The options containing the value to echo."
22
+ "text": "options Object containing the value to echo."
23
23
  },
24
24
  {
25
25
  "name": "returns",
26
- "text": "A promise resolving to the echo result."
26
+ "text": "A promise resolving to the echoed value."
27
27
  },
28
28
  {
29
29
  "name": "example",
30
- "text": "```typescript\nimport { Test } from '@cap-kit/test-plugin';\n\nconst result = await Test.echo({ value: 'Hello, World!' });\nconsole.log(result.value); // Output: 'Hello, World!'\n```"
30
+ "text": "```ts\nconst { value } = await Test.echo({ value: 'Hello' });\nconsole.log(value);\n```"
31
31
  },
32
32
  {
33
33
  "name": "since",
34
34
  "text": "0.0.1"
35
35
  }
36
36
  ],
37
- "docs": "Echoes the provided value.\n\nIf the plugin is configured with a `customMessage`, it will be appended\nto the response.",
37
+ "docs": "Echoes the provided value.\n\nIf the plugin is configured with a `customMessage`, that value\nwill be appended to the returned string.\n\nThis method is primarily intended as an example demonstrating\nnative ↔ JavaScript communication.",
38
38
  "complexTypes": [
39
39
  "EchoResult",
40
40
  "EchoOptions"
41
41
  ],
42
42
  "slug": "echo"
43
43
  },
44
+ {
45
+ "name": "openAppSettings",
46
+ "signature": "() => Promise<void>",
47
+ "parameters": [],
48
+ "returns": "Promise<void>",
49
+ "tags": [
50
+ {
51
+ "name": "since",
52
+ "text": "1.0.0"
53
+ }
54
+ ],
55
+ "docs": "Opens the operating system's application settings page.\n\nThis is typically used when a permission has been permanently\ndenied and the user must enable it manually.\n\nOn Web, this method is not supported.",
56
+ "complexTypes": [],
57
+ "slug": "openappsettings"
58
+ },
44
59
  {
45
60
  "name": "getPluginVersion",
46
61
  "signature": "() => Promise<PluginVersionResult>",
@@ -49,22 +64,18 @@
49
64
  "tags": [
50
65
  {
51
66
  "name": "returns",
52
- "text": "A promise resolving to an object containing the version string."
53
- },
54
- {
55
- "name": "throws",
56
- "text": "Error if getting the version fails."
67
+ "text": "A promise resolving to the plugin version."
57
68
  },
58
69
  {
59
70
  "name": "example",
60
- "text": "```typescript\nimport { Test } from '@cap-kit/test-plugin';\n\nconst { version } = await Test.getPluginVersion();\nconsole.log('Plugin version:', version); // Output: Plugin version: 0.0.1\n```"
71
+ "text": "```ts\nconst { version } = await Test.getPluginVersion();\n```"
61
72
  },
62
73
  {
63
74
  "name": "since",
64
75
  "text": "0.0.1"
65
76
  }
66
77
  ],
67
- "docs": "Get the native Capacitor plugin version.",
78
+ "docs": "Returns the native plugin version.\n\nThe returned version corresponds to the native implementation\nbundled with the application.",
68
79
  "complexTypes": [
69
80
  "PluginVersionResult"
70
81
  ],
@@ -77,14 +88,14 @@
77
88
  {
78
89
  "name": "EchoResult",
79
90
  "slug": "echoresult",
80
- "docs": "Result returned by the echo method.",
91
+ "docs": "Result object returned by the `echo` method.\n\nThis object represents the resolved value of the echo operation\nafter native processing has completed.",
81
92
  "tags": [],
82
93
  "methods": [],
83
94
  "properties": [
84
95
  {
85
96
  "name": "value",
86
97
  "tags": [],
87
- "docs": "The echoed value.",
98
+ "docs": "The echoed string value.\n\nIf a `customMessage` is configured, it will be appended\nto the original input value.",
88
99
  "complexTypes": [],
89
100
  "type": "string"
90
101
  }
@@ -93,14 +104,19 @@
93
104
  {
94
105
  "name": "EchoOptions",
95
106
  "slug": "echooptions",
96
- "docs": "Options for the echo method.",
107
+ "docs": "Options object for the `echo` method.\n\nThis object defines the input payload sent from JavaScript\nto the native plugin implementation.",
97
108
  "tags": [],
98
109
  "methods": [],
99
110
  "properties": [
100
111
  {
101
112
  "name": "value",
102
- "tags": [],
103
- "docs": "The value to be echoed.",
113
+ "tags": [
114
+ {
115
+ "text": "\"Hello, World!\"",
116
+ "name": "example"
117
+ }
118
+ ],
119
+ "docs": "The string value to be echoed back by the plugin.\n\nThis value is passed to the native layer and returned\nunchanged, optionally with a configuration-based suffix.",
104
120
  "complexTypes": [],
105
121
  "type": "string"
106
122
  }
@@ -109,14 +125,14 @@
109
125
  {
110
126
  "name": "PluginVersionResult",
111
127
  "slug": "pluginversionresult",
112
- "docs": "Result returned by the getPluginVersion method.",
128
+ "docs": "Result object returned by the `getPluginVersion()` method.",
113
129
  "tags": [],
114
130
  "methods": [],
115
131
  "properties": [
116
132
  {
117
133
  "name": "version",
118
134
  "tags": [],
119
- "docs": "The native version string of the plugin.",
135
+ "docs": "The native plugin version string.",
120
136
  "complexTypes": [],
121
137
  "type": "string"
122
138
  }
@@ -146,9 +162,29 @@
146
162
  "name": "since"
147
163
  }
148
164
  ],
149
- "docs": "A custom message to append to the echo response.\nThis demonstrates how to pass data from `capacitor.config.ts` to the plugin.",
165
+ "docs": "Custom message appended to the echoed value.\n\nThis option exists mainly as an example showing how to pass\nstatic configuration data from JavaScript to native platforms.",
150
166
  "complexTypes": [],
151
167
  "type": "string | undefined"
168
+ },
169
+ {
170
+ "name": "verboseLogging",
171
+ "tags": [
172
+ {
173
+ "text": "false",
174
+ "name": "default"
175
+ },
176
+ {
177
+ "text": "true",
178
+ "name": "example"
179
+ },
180
+ {
181
+ "text": "1.0.0",
182
+ "name": "since"
183
+ }
184
+ ],
185
+ "docs": "Enables verbose native logging.\n\nWhen enabled, additional debug information is printed\nto the native console (Logcat on Android, Xcode on iOS).\n\nThis option affects native logging behavior only and\nhas no impact on the JavaScript API.",
186
+ "complexTypes": [],
187
+ "type": "boolean | undefined"
152
188
  }
153
189
  ],
154
190
  "docs": "Configuration options for the Test plugin."
@@ -1,87 +1,189 @@
1
1
  /**
2
- * Extend the PluginsConfig interface to include configuration options for the Test plugin.
2
+ * Capacitor configuration extension for the Test plugin.
3
+ *
4
+ * Configuration values defined here can be provided under the `plugins.Test`
5
+ * key inside `capacitor.config.ts`.
6
+ *
7
+ * These values are:
8
+ * - read natively at build/runtime
9
+ * - NOT accessible from JavaScript at runtime
10
+ * - treated as read-only static configuration
3
11
  */
4
12
  declare module '@capacitor/cli' {
5
13
  interface PluginsConfig {
6
14
  /**
7
15
  * Configuration options for the Test plugin.
8
16
  */
9
- Test?: {
10
- /**
11
- * A custom message to append to the echo response.
12
- * This demonstrates how to pass data from `capacitor.config.ts` to the plugin.
13
- *
14
- * @default " (from config)"
15
- * @example " - Hello from Config!"
16
- * @since 0.0.1
17
- */
18
- customMessage?: string;
19
- };
17
+ Test?: TestConfig;
20
18
  }
21
19
  }
22
20
  /**
23
- * Options for the echo method.
21
+ * Static configuration options for the Test plugin.
22
+ *
23
+ * These values are defined in `capacitor.config.ts` and consumed
24
+ * exclusively by native code during plugin initialization.
25
+ *
26
+ * Configuration values:
27
+ * - do NOT change the JavaScript API shape
28
+ * - do NOT enable/disable methods
29
+ * - are applied once during plugin load
30
+ */
31
+ export interface TestConfig {
32
+ /**
33
+ * Custom message appended to the echoed value.
34
+ *
35
+ * This option exists mainly as an example showing how to pass
36
+ * static configuration data from JavaScript to native platforms.
37
+ *
38
+ * @default " (from config)"
39
+ * @example " - Hello from Config!"
40
+ * @since 0.0.1
41
+ */
42
+ customMessage?: string;
43
+ /**
44
+ * Enables verbose native logging.
45
+ *
46
+ * When enabled, additional debug information is printed
47
+ * to the native console (Logcat on Android, Xcode on iOS).
48
+ *
49
+ * This option affects native logging behavior only and
50
+ * has no impact on the JavaScript API.
51
+ *
52
+ * @default false
53
+ * @example true
54
+ * @since 1.0.0
55
+ */
56
+ verboseLogging?: boolean;
57
+ }
58
+ /**
59
+ * Standardized error codes used by the Test plugin.
60
+ *
61
+ * These codes are returned as part of structured error objects
62
+ * and allow consumers to implement programmatic error handling.
63
+ *
64
+ * Note:
65
+ * On iOS (Swift Package Manager), errors are returned as data
66
+ * objects rather than rejected Promises.
67
+ *
68
+ * @since 1.0.0
69
+ */
70
+ export declare enum TestErrorCode {
71
+ /** The device does not have the requested hardware. */
72
+ UNAVAILABLE = "UNAVAILABLE",
73
+ /** The user denied the permission or the feature is disabled in settings. */
74
+ PERMISSION_DENIED = "PERMISSION_DENIED",
75
+ /** The test plugin failed to initialize (e.g., runtime error or Looper failure). */
76
+ INIT_FAILED = "INIT_FAILED",
77
+ /** The requested test plugin type is not valid or not supported by the plugin. */
78
+ UNKNOWN_TYPE = "UNKNOWN_TYPE"
79
+ }
80
+ /**
81
+ * Options object for the `echo` method.
82
+ *
83
+ * This object defines the input payload sent from JavaScript
84
+ * to the native plugin implementation.
24
85
  */
25
86
  export interface EchoOptions {
26
87
  /**
27
- * The value to be echoed.
88
+ * The string value to be echoed back by the plugin.
89
+ *
90
+ * This value is passed to the native layer and returned
91
+ * unchanged, optionally with a configuration-based suffix.
92
+ *
93
+ * @example "Hello, World!"
28
94
  */
29
95
  value: string;
30
96
  }
31
97
  /**
32
- * Result returned by the echo method.
98
+ * Result object returned by the `echo` method.
99
+ *
100
+ * This object represents the resolved value of the echo operation
101
+ * after native processing has completed.
33
102
  */
34
103
  export interface EchoResult {
35
104
  /**
36
- * The echoed value.
105
+ * The echoed string value.
106
+ *
107
+ * If a `customMessage` is configured, it will be appended
108
+ * to the original input value.
37
109
  */
38
110
  value: string;
39
111
  }
40
112
  /**
41
- * Result returned by the getPluginVersion method.
113
+ * Result object returned by the `getPluginVersion()` method.
42
114
  */
43
115
  export interface PluginVersionResult {
44
116
  /**
45
- * The native version string of the plugin.
117
+ * The native plugin version string.
46
118
  */
47
119
  version: string;
48
120
  }
49
121
  /**
50
- * Capacitor Test plugin interface.
122
+ * Structured error object returned by Test plugin operations.
123
+ *
124
+ * This object allows consumers to handle errors without relying
125
+ * on exception-based control flow.
126
+ */
127
+ export interface TestError {
128
+ /**
129
+ * Human-readable error description.
130
+ */
131
+ message: string;
132
+ /**
133
+ * Machine-readable error code.
134
+ */
135
+ code: TestErrorCode;
136
+ }
137
+ /**
138
+ * Public JavaScript API for the Test Capacitor plugin.
139
+ *
140
+ * This interface defines a stable, platform-agnostic API.
141
+ * All methods behave consistently across Android, iOS, and Web.
51
142
  */
52
143
  export interface TestPlugin {
53
144
  /**
54
145
  * Echoes the provided value.
55
146
  *
56
- * If the plugin is configured with a `customMessage`, it will be appended
57
- * to the response.
147
+ * If the plugin is configured with a `customMessage`, that value
148
+ * will be appended to the returned string.
58
149
  *
59
- * @param options - The options containing the value to echo.
60
- * @returns A promise resolving to the echo result.
150
+ * This method is primarily intended as an example demonstrating
151
+ * native JavaScript communication.
61
152
  *
62
- * @example
63
- * ```typescript
64
- * import { Test } from '@cap-kit/test-plugin';
153
+ * @param options Object containing the value to echo.
154
+ * @returns A promise resolving to the echoed value.
65
155
  *
66
- * const result = await Test.echo({ value: 'Hello, World!' });
67
- * console.log(result.value); // Output: 'Hello, World!'
156
+ * @example
157
+ * ```ts
158
+ * const { value } = await Test.echo({ value: 'Hello' });
159
+ * console.log(value);
68
160
  * ```
69
161
  *
70
162
  * @since 0.0.1
71
163
  */
72
164
  echo(options: EchoOptions): Promise<EchoResult>;
73
165
  /**
74
- * Get the native Capacitor plugin version.
166
+ * Opens the operating system's application settings page.
75
167
  *
76
- * @returns A promise resolving to an object containing the version string.
77
- * @throws Error if getting the version fails.
168
+ * This is typically used when a permission has been permanently
169
+ * denied and the user must enable it manually.
78
170
  *
79
- * @example
80
- * ```typescript
81
- * import { Test } from '@cap-kit/test-plugin';
171
+ * On Web, this method is not supported.
172
+ *
173
+ * @since 1.0.0
174
+ */
175
+ openAppSettings(): Promise<void>;
176
+ /**
177
+ * Returns the native plugin version.
178
+ *
179
+ * The returned version corresponds to the native implementation
180
+ * bundled with the application.
82
181
  *
182
+ * @returns A promise resolving to the plugin version.
183
+ *
184
+ * @example
185
+ * ```ts
83
186
  * const { version } = await Test.getPluginVersion();
84
- * console.log('Plugin version:', version); // Output: Plugin version: 0.0.1
85
187
  * ```
86
188
  *
87
189
  * @since 0.0.1
@@ -1,3 +1,25 @@
1
1
  /// <reference types="@capacitor/cli" />
2
- export {};
2
+ /**
3
+ * Standardized error codes used by the Test plugin.
4
+ *
5
+ * These codes are returned as part of structured error objects
6
+ * and allow consumers to implement programmatic error handling.
7
+ *
8
+ * Note:
9
+ * On iOS (Swift Package Manager), errors are returned as data
10
+ * objects rather than rejected Promises.
11
+ *
12
+ * @since 1.0.0
13
+ */
14
+ export var TestErrorCode;
15
+ (function (TestErrorCode) {
16
+ /** The device does not have the requested hardware. */
17
+ TestErrorCode["UNAVAILABLE"] = "UNAVAILABLE";
18
+ /** The user denied the permission or the feature is disabled in settings. */
19
+ TestErrorCode["PERMISSION_DENIED"] = "PERMISSION_DENIED";
20
+ /** The test plugin failed to initialize (e.g., runtime error or Looper failure). */
21
+ TestErrorCode["INIT_FAILED"] = "INIT_FAILED";
22
+ /** The requested test plugin type is not valid or not supported by the plugin. */
23
+ TestErrorCode["UNKNOWN_TYPE"] = "UNKNOWN_TYPE";
24
+ })(TestErrorCode || (TestErrorCode = {}));
3
25
  //# sourceMappingURL=definitions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC"}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA,wCAAwC;AA8DxC;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,aASX;AATD,WAAY,aAAa;IACvB,uDAAuD;IACvD,4CAA2B,CAAA;IAC3B,6EAA6E;IAC7E,wDAAuC,CAAA;IACvC,oFAAoF;IACpF,4CAA2B,CAAA;IAC3B,kFAAkF;IAClF,8CAA6B,CAAA;AAC/B,CAAC,EATW,aAAa,KAAb,aAAa,QASxB"}
@@ -6,10 +6,10 @@
6
6
  */
7
7
  import type { TestPlugin } from './definitions';
8
8
  /**
9
- * Test Capacitor plugin instance.
10
- * This instance is registered with Capacitor using the `registerPlugin` function,
11
- * making it accessible through the Capacitor runtime. It dynamically loads the
12
- * web implementation when needed.
9
+ * Main entry point for the Test Capacitor plugin.
10
+ *
11
+ * This file registers the plugin with Capacitor and exports
12
+ * both the runtime instance and the public TypeScript types.
13
13
  */
14
14
  declare const Test: TestPlugin;
15
15
  export * from './definitions';
package/dist/esm/index.js CHANGED
@@ -6,26 +6,14 @@
6
6
  */
7
7
  import { registerPlugin } from '@capacitor/core';
8
8
  /**
9
- * Test Capacitor plugin instance.
10
- * This instance is registered with Capacitor using the `registerPlugin` function,
11
- * making it accessible through the Capacitor runtime. It dynamically loads the
12
- * web implementation when needed.
9
+ * Main entry point for the Test Capacitor plugin.
10
+ *
11
+ * This file registers the plugin with Capacitor and exports
12
+ * both the runtime instance and the public TypeScript types.
13
13
  */
14
14
  const Test = registerPlugin('Test', {
15
- /**
16
- * Dynamically imports the web implementation of the plugin.
17
- * The `web` option provides a fallback for web environments,
18
- * ensuring platform-specific implementations can be used seamlessly.
19
- *
20
- * @returns A promise resolving to the web implementation of the plugin.
21
- */
22
15
  web: () => import('./web').then((m) => new m.TestWeb()),
23
16
  });
24
- // Export the definitions from 'definitions.ts' for external use.
25
- // These exports allow users to directly use the types and interfaces
26
- // defined for the TestPlugin.
27
17
  export * from './definitions';
28
- // Export the registered TestPlugin instance.
29
- // This makes the plugin instance available for import in other modules.
30
18
  export { Test };
31
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;;;GAKG;AACH,MAAM,IAAI,GAAG,cAAc,CAAa,MAAM,EAAE;IAC9C;;;;;;OAMG;IACH,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;CACxD,CAAC,CAAC;AAEH,iEAAiE;AACjE,qEAAqE;AACrE,8BAA8B;AAC9B,cAAc,eAAe,CAAC;AAE9B,6CAA6C;AAC7C,wEAAwE;AACxE,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;;;GAKG;AACH,MAAM,IAAI,GAAG,cAAc,CAAa,MAAM,EAAE;IAC9C,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;CACxD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/dist/esm/web.d.ts CHANGED
@@ -1,17 +1,16 @@
1
- /**
2
- * @file web.ts
3
- * This file contains the web implementation of the TestPlugin.
4
- * It defines a class that extends the WebPlugin class and implements the
5
- * TestPlugin interface, providing the required functionality for web platforms.
6
- */
7
1
  import { WebPlugin } from '@capacitor/core';
8
2
  import type { TestPlugin } from './definitions';
9
3
  /**
10
- * Class representing the web implementation of the TestPlugin.
11
- * This class extends the WebPlugin class and implements the TestPlugin interface.
12
- * It provides a base implementation for web-based functionality of the plugin.
4
+ * Web implementation of the Test plugin.
5
+ *
6
+ * This implementation exists primarily to satisfy Capacitor's
7
+ * multi-platform contract and to allow usage in browser-based
8
+ * environments.
9
+ *
10
+ * Native-only features may be unavailable on Web.
13
11
  */
14
12
  export declare class TestWeb extends WebPlugin implements TestPlugin {
13
+ constructor();
15
14
  /**
16
15
  * Echoes a value back for the web platform.
17
16
  * This method is a basic implementation example, primarily for testing
@@ -19,14 +18,6 @@ export declare class TestWeb extends WebPlugin implements TestPlugin {
19
18
  *
20
19
  * @param options - An object containing a `value` property to be echoed back.
21
20
  * @returns A promise resolving to an object containing the echoed `value`.
22
- *
23
- * @example
24
- * ```typescript
25
- * import { Test } from '@cap-kit/test-plugin';
26
- *
27
- * const result = await Test.echo({ value: 'Hello, World!' });
28
- * console.log(result.value); // Output: 'Hello, World!'
29
- * ```
30
21
  */
31
22
  echo(options: {
32
23
  value: string;
@@ -34,18 +25,16 @@ export declare class TestWeb extends WebPlugin implements TestPlugin {
34
25
  value: string;
35
26
  }>;
36
27
  /**
37
- * Get the native Capacitor plugin version.
28
+ * Opens the app settings page.
29
+ * On Web, this is not applicable.
38
30
  *
39
- * @returns Promise that resolves with the plugin version
40
- * @throws Error if getting the version fails
41
- *
42
- * @example
43
- * ```typescript
44
- * import { Test } from '@cap-kit/test-plugin';
31
+ * @returns A promise that resolves when the operation is complete.
32
+ */
33
+ openAppSettings(): Promise<void>;
34
+ /**
35
+ * Returns the plugin version.
45
36
  *
46
- * const version = await Test.getPluginVersion();
47
- * console.log(version.version); // Output: 'web'
48
- * ```
37
+ * @returns The current plugin version.
49
38
  */
50
39
  getPluginVersion(): Promise<{
51
40
  version: string;
package/dist/esm/web.js CHANGED
@@ -1,16 +1,18 @@
1
- /**
2
- * @file web.ts
3
- * This file contains the web implementation of the TestPlugin.
4
- * It defines a class that extends the WebPlugin class and implements the
5
- * TestPlugin interface, providing the required functionality for web platforms.
6
- */
7
1
  import { WebPlugin } from '@capacitor/core';
8
2
  /**
9
- * Class representing the web implementation of the TestPlugin.
10
- * This class extends the WebPlugin class and implements the TestPlugin interface.
11
- * It provides a base implementation for web-based functionality of the plugin.
3
+ * Web implementation of the Test plugin.
4
+ *
5
+ * This implementation exists primarily to satisfy Capacitor's
6
+ * multi-platform contract and to allow usage in browser-based
7
+ * environments.
8
+ *
9
+ * Native-only features may be unavailable on Web.
12
10
  */
13
11
  export class TestWeb extends WebPlugin {
12
+ constructor() {
13
+ super();
14
+ }
15
+ // --- Echo Method ---
14
16
  /**
15
17
  * Echoes a value back for the web platform.
16
18
  * This method is a basic implementation example, primarily for testing
@@ -18,14 +20,6 @@ export class TestWeb extends WebPlugin {
18
20
  *
19
21
  * @param options - An object containing a `value` property to be echoed back.
20
22
  * @returns A promise resolving to an object containing the echoed `value`.
21
- *
22
- * @example
23
- * ```typescript
24
- * import { Test } from '@cap-kit/test-plugin';
25
- *
26
- * const result = await Test.echo({ value: 'Hello, World!' });
27
- * console.log(result.value); // Output: 'Hello, World!'
28
- * ```
29
23
  */
30
24
  async echo(options) {
31
25
  console.log('ECHO', options);
@@ -34,22 +28,25 @@ export class TestWeb extends WebPlugin {
34
28
  // from a global config object if your app exposes one.
35
29
  return options;
36
30
  }
31
+ // --- App Settings ---
37
32
  /**
38
- * Get the native Capacitor plugin version.
33
+ * Opens the app settings page.
34
+ * On Web, this is not applicable.
39
35
  *
40
- * @returns Promise that resolves with the plugin version
41
- * @throws Error if getting the version fails
42
- *
43
- * @example
44
- * ```typescript
45
- * import { Test } from '@cap-kit/test-plugin';
36
+ * @returns A promise that resolves when the operation is complete.
37
+ */
38
+ async openAppSettings() {
39
+ console.warn('Test: openAppSettings is not available on Web.');
40
+ return this.unimplemented('Not implemented on Web.');
41
+ }
42
+ // --- Plugin Info ---
43
+ /**
44
+ * Returns the plugin version.
46
45
  *
47
- * const version = await Test.getPluginVersion();
48
- * console.log(version.version); // Output: 'web'
49
- * ```
46
+ * @returns The current plugin version.
50
47
  */
51
48
  async getPluginVersion() {
52
- return { version: 'web' };
49
+ return { version: 'web-1.0.0' };
53
50
  }
54
51
  }
55
52
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;;;GAIG;AACH,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,kFAAkF;QAClF,iFAAiF;QACjF,uDAAuD;QACvD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF"}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C;;;;;;;;GAQG;AACH,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACpC;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,sBAAsB;IAEtB;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,kFAAkF;QAClF,iFAAiF;QACjF,uDAAuD;QACvD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,uBAAuB;IAEvB;;;;;OAKG;IACH,KAAK,CAAC,eAAe;QACnB,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAU,CAAC;IAChE,CAAC;IAED,sBAAsB;IAEtB;;;;OAIG;IACH,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAClC,CAAC;CACF"}