track dist dir

Seto committed Nov 26, 2025 at 11:54 UTC c038cfe83fc5d8a476410d8da3610e3df4d3e12c
8 files changed +382 -4
.gitignore
-4
@@ -14,10 +14,6 @@ yarn.lock
14 Cargo.lock
15 node_modules/
16
17 -# Added this directory to the git repo, bcz the plugin is not published yet to any registery
18 -dist-js
19 -dist
20 -
17 # Project exclude paths
18 /android/.gradle/
19
dist-js/ads/banner.d.ts new
+14
@@ -0,0 +1,14 @@
1 +import { MobileAd, type MobileAdOptions } from "./common";
2 +export declare class BannerAd extends MobileAd<BannerAdOptions> {
3 + #private;
4 + static cls: string;
5 + constructor(opts: BannerAdOptions);
6 + isLoaded(): Promise<unknown>;
7 + load(): Promise<void>;
8 + show(): Promise<void>;
9 + hide(): Promise<void>;
10 +}
11 +export type BannerPosition = "top" | "bottom";
12 +export interface BannerAdOptions extends MobileAdOptions {
13 + position?: BannerPosition;
14 +}
dist-js/ads/common.d.ts new
+20
@@ -0,0 +1,20 @@
1 +export declare function isPrivacyOptionsRequired(): Promise<boolean>;
2 +export declare function showPrivacyOptionsForm(): Promise<void>;
3 +export declare class MobileAd<T extends MobileAdOptions = MobileAdOptions> {
4 + #private;
5 + private static allAdds;
6 + private static idCounter;
7 + readonly id: number;
8 + protected readonly opts: T;
9 + constructor(opts: T);
10 + private static nextId;
11 + get adUnitId(): string;
12 + protected isLoaded(): Promise<unknown>;
13 + protected load(): Promise<void>;
14 + protected show(): Promise<void>;
15 + protected hide(): Promise<void>;
16 + protected init(): Promise<void>;
17 +}
18 +export interface MobileAdOptions {
19 + adUnitId: string;
20 +}
dist-js/ads/interstitial.d.ts new
+7
@@ -0,0 +1,7 @@
1 +import { MobileAd } from "./common";
2 +export declare class InterstitialAd extends MobileAd {
3 + static cls: string;
4 + isLoaded(): Promise<unknown>;
5 + load(): Promise<void>;
6 + show(): Promise<void>;
7 +}
dist-js/ads/rewarded.d.ts new
+22
@@ -0,0 +1,22 @@
1 +import { MobileAd, type MobileAdOptions } from "./common";
2 +import { PluginListener } from "@tauri-apps/api/core";
3 +export declare class RewardedAd extends MobileAd<RewardedAdOptions> {
4 + static cls: string;
5 + isLoaded(): Promise<unknown>;
6 + load(): Promise<void>;
7 + show(): Promise<void>;
8 + onRewarded(handler: (payload: any) => void): Promise<PluginListener>;
9 +}
10 +export declare function onRewarded(handler: (payload: any) => void): Promise<PluginListener>;
11 +export declare class RewardedInterstitialAd extends MobileAd<RewardedAdOptions> {
12 + static cls: string;
13 + isLoaded(): Promise<unknown>;
14 + load(): Promise<void>;
15 + show(): Promise<void>;
16 +}
17 +export interface RewardedAdOptions extends MobileAdOptions {
18 + serverSideVerification?: {
19 + userId?: string;
20 + customData?: string;
21 + };
22 +}
dist-js/index.cjs new
+161
@@ -0,0 +1,161 @@
1 +let __tauri_apps_api_core = require("@tauri-apps/api/core");
2 +
3 +//#region node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@2.79.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js
4 +function __classPrivateFieldGet(receiver, state, kind, f) {
5 + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6 + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
7 + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8 +}
9 +function __classPrivateFieldSet(receiver, state, value, kind, f) {
10 + if (kind === "m") throw new TypeError("Private method is not writable");
11 + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
12 + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
13 + return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
14 +}
15 +
16 +//#endregion
17 +//#region guest-js/ads/common.ts
18 +var _MobileAd_created, _MobileAd_init;
19 +async function isPrivacyOptionsRequired() {
20 + return (await (0, __tauri_apps_api_core.invoke)("plugin:admob|isPrivacyOptionsRequired")).isPrivacyOptionsRequired;
21 +}
22 +async function showPrivacyOptionsForm() {
23 + await (0, __tauri_apps_api_core.invoke)("plugin:admob|showPrivacyOptionsForm");
24 +}
25 +var MobileAd = class MobileAd {
26 + constructor(opts) {
27 + _MobileAd_created.set(this, false);
28 + _MobileAd_init.set(this, null);
29 + this.opts = opts;
30 + this.id = MobileAd.nextId();
31 + MobileAd.allAdds[this.id] = this;
32 + }
33 + static nextId() {
34 + return MobileAd.idCounter++;
35 + }
36 + get adUnitId() {
37 + return this.opts.adUnitId;
38 + }
39 + async isLoaded() {
40 + await this.init();
41 + return await (0, __tauri_apps_api_core.invoke)("plugin:admob|adIsLoaded", { id: this.id });
42 + }
43 + async load() {
44 + await this.init();
45 + await (0, __tauri_apps_api_core.invoke)("plugin:admob|adLoad", {
46 + ...this.opts,
47 + id: this.id
48 + });
49 + }
50 + async show() {
51 + await this.init();
52 + await (0, __tauri_apps_api_core.invoke)("plugin:admob|adShow", { id: this.id });
53 + }
54 + async hide() {
55 + await this.init();
56 + await (0, __tauri_apps_api_core.invoke)("plugin:admob|adHide", { id: this.id });
57 + }
58 + async init() {
59 + if (__classPrivateFieldGet(this, _MobileAd_created, "f")) return;
60 + if (__classPrivateFieldGet(this, _MobileAd_init, "f") === null) {
61 + const cls = this.constructor.cls ?? this.constructor.name;
62 + await (0, __tauri_apps_api_core.invoke)("plugin:admob|adCreate", {
63 + ...this.opts,
64 + id: this.id,
65 + cls
66 + });
67 + }
68 + await __classPrivateFieldGet(this, _MobileAd_init, "f");
69 + __classPrivateFieldSet(this, _MobileAd_created, true, "f");
70 + }
71 +};
72 +_MobileAd_created = /* @__PURE__ */ new WeakMap(), _MobileAd_init = /* @__PURE__ */ new WeakMap();
73 +MobileAd.allAdds = {};
74 +MobileAd.idCounter = 0;
75 +
76 +//#endregion
77 +//#region guest-js/ads/banner.ts
78 +var _BannerAd_loaded;
79 +var BannerAd = class extends MobileAd {
80 + constructor(opts) {
81 + super({
82 + position: "bottom",
83 + ...opts
84 + });
85 + _BannerAd_loaded.set(this, false);
86 + }
87 + isLoaded() {
88 + return super.isLoaded();
89 + }
90 + async load() {
91 + await super.load();
92 + __classPrivateFieldSet(this, _BannerAd_loaded, true, "f");
93 + }
94 + async show() {
95 + if (!__classPrivateFieldGet(this, _BannerAd_loaded, "f")) await this.load();
96 + await super.show();
97 + }
98 + hide() {
99 + return super.hide();
100 + }
101 +};
102 +_BannerAd_loaded = /* @__PURE__ */ new WeakMap();
103 +BannerAd.cls = "BannerAd";
104 +
105 +//#endregion
106 +//#region guest-js/ads/interstitial.ts
107 +var InterstitialAd = class extends MobileAd {
108 + isLoaded() {
109 + return super.isLoaded();
110 + }
111 + async load() {
112 + return super.load();
113 + }
114 + async show() {
115 + return super.show();
116 + }
117 +};
118 +InterstitialAd.cls = "InterstitialAd";
119 +
120 +//#endregion
121 +//#region guest-js/ads/rewarded.ts
122 +var RewardedAd = class extends MobileAd {
123 + isLoaded() {
124 + return super.isLoaded();
125 + }
126 + async load() {
127 + return super.load();
128 + }
129 + async show() {
130 + return super.show();
131 + }
132 + async onRewarded(handler) {
133 + return await (0, __tauri_apps_api_core.addPluginListener)("admob", "rewarded_reward", handler);
134 + }
135 +};
136 +RewardedAd.cls = "RewardedAd";
137 +async function onRewarded(handler) {
138 + return await (0, __tauri_apps_api_core.addPluginListener)("admob", "rewarded/reward", handler);
139 +}
140 +var RewardedInterstitialAd = class extends MobileAd {
141 + isLoaded() {
142 + return super.isLoaded();
143 + }
144 + async load() {
145 + return super.load();
146 + }
147 + async show() {
148 + return super.show();
149 + }
150 +};
151 +RewardedInterstitialAd.cls = "RewardedInterstitialAd";
152 +
153 +//#endregion
154 +exports.BannerAd = BannerAd;
155 +exports.InterstitialAd = InterstitialAd;
156 +exports.MobileAd = MobileAd;
157 +exports.RewardedAd = RewardedAd;
158 +exports.RewardedInterstitialAd = RewardedInterstitialAd;
159 +exports.isPrivacyOptionsRequired = isPrivacyOptionsRequired;
160 +exports.onRewarded = onRewarded;
161 +exports.showPrivacyOptionsForm = showPrivacyOptionsForm;
\ No newline at end of file
dist-js/index.d.ts new
+4
@@ -0,0 +1,4 @@
1 +export * from "./ads/common";
2 +export * from "./ads/banner";
3 +export * from "./ads/interstitial";
4 +export * from "./ads/rewarded";
dist-js/index.js new
+154
@@ -0,0 +1,154 @@
1 +import { addPluginListener, invoke } from "@tauri-apps/api/core";
2 +
3 +//#region node_modules/.pnpm/@rollup+plugin-typescript@11.1.6_rollup@2.79.2_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js
4 +function __classPrivateFieldGet(receiver, state, kind, f) {
5 + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
6 + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
7 + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
8 +}
9 +function __classPrivateFieldSet(receiver, state, value, kind, f) {
10 + if (kind === "m") throw new TypeError("Private method is not writable");
11 + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
12 + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
13 + return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
14 +}
15 +
16 +//#endregion
17 +//#region guest-js/ads/common.ts
18 +var _MobileAd_created, _MobileAd_init;
19 +async function isPrivacyOptionsRequired() {
20 + return (await invoke("plugin:admob|isPrivacyOptionsRequired")).isPrivacyOptionsRequired;
21 +}
22 +async function showPrivacyOptionsForm() {
23 + await invoke("plugin:admob|showPrivacyOptionsForm");
24 +}
25 +var MobileAd = class MobileAd {
26 + constructor(opts) {
27 + _MobileAd_created.set(this, false);
28 + _MobileAd_init.set(this, null);
29 + this.opts = opts;
30 + this.id = MobileAd.nextId();
31 + MobileAd.allAdds[this.id] = this;
32 + }
33 + static nextId() {
34 + return MobileAd.idCounter++;
35 + }
36 + get adUnitId() {
37 + return this.opts.adUnitId;
38 + }
39 + async isLoaded() {
40 + await this.init();
41 + return await invoke("plugin:admob|adIsLoaded", { id: this.id });
42 + }
43 + async load() {
44 + await this.init();
45 + await invoke("plugin:admob|adLoad", {
46 + ...this.opts,
47 + id: this.id
48 + });
49 + }
50 + async show() {
51 + await this.init();
52 + await invoke("plugin:admob|adShow", { id: this.id });
53 + }
54 + async hide() {
55 + await this.init();
56 + await invoke("plugin:admob|adHide", { id: this.id });
57 + }
58 + async init() {
59 + if (__classPrivateFieldGet(this, _MobileAd_created, "f")) return;
60 + if (__classPrivateFieldGet(this, _MobileAd_init, "f") === null) {
61 + const cls = this.constructor.cls ?? this.constructor.name;
62 + await invoke("plugin:admob|adCreate", {
63 + ...this.opts,
64 + id: this.id,
65 + cls
66 + });
67 + }
68 + await __classPrivateFieldGet(this, _MobileAd_init, "f");
69 + __classPrivateFieldSet(this, _MobileAd_created, true, "f");
70 + }
71 +};
72 +_MobileAd_created = /* @__PURE__ */ new WeakMap(), _MobileAd_init = /* @__PURE__ */ new WeakMap();
73 +MobileAd.allAdds = {};
74 +MobileAd.idCounter = 0;
75 +
76 +//#endregion
77 +//#region guest-js/ads/banner.ts
78 +var _BannerAd_loaded;
79 +var BannerAd = class extends MobileAd {
80 + constructor(opts) {
81 + super({
82 + position: "bottom",
83 + ...opts
84 + });
85 + _BannerAd_loaded.set(this, false);
86 + }
87 + isLoaded() {
88 + return super.isLoaded();
89 + }
90 + async load() {
91 + await super.load();
92 + __classPrivateFieldSet(this, _BannerAd_loaded, true, "f");
93 + }
94 + async show() {
95 + if (!__classPrivateFieldGet(this, _BannerAd_loaded, "f")) await this.load();
96 + await super.show();
97 + }
98 + hide() {
99 + return super.hide();
100 + }
101 +};
102 +_BannerAd_loaded = /* @__PURE__ */ new WeakMap();
103 +BannerAd.cls = "BannerAd";
104 +
105 +//#endregion
106 +//#region guest-js/ads/interstitial.ts
107 +var InterstitialAd = class extends MobileAd {
108 + isLoaded() {
109 + return super.isLoaded();
110 + }
111 + async load() {
112 + return super.load();
113 + }
114 + async show() {
115 + return super.show();
116 + }
117 +};
118 +InterstitialAd.cls = "InterstitialAd";
119 +
120 +//#endregion
121 +//#region guest-js/ads/rewarded.ts
122 +var RewardedAd = class extends MobileAd {
123 + isLoaded() {
124 + return super.isLoaded();
125 + }
126 + async load() {
127 + return super.load();
128 + }
129 + async show() {
130 + return super.show();
131 + }
132 + async onRewarded(handler) {
133 + return await addPluginListener("admob", "rewarded_reward", handler);
134 + }
135 +};
136 +RewardedAd.cls = "RewardedAd";
137 +async function onRewarded(handler) {
138 + return await addPluginListener("admob", "rewarded/reward", handler);
139 +}
140 +var RewardedInterstitialAd = class extends MobileAd {
141 + isLoaded() {
142 + return super.isLoaded();
143 + }
144 + async load() {
145 + return super.load();
146 + }
147 + async show() {
148 + return super.show();
149 + }
150 +};
151 +RewardedInterstitialAd.cls = "RewardedInterstitialAd";
152 +
153 +//#endregion
154 +export { BannerAd, InterstitialAd, MobileAd, RewardedAd, RewardedInterstitialAd, isPrivacyOptionsRequired, onRewarded, showPrivacyOptionsForm };
\ No newline at end of file