@overlayed/ads 0.1.2 → 0.1.4

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.
package/dist/index.d.ts CHANGED
@@ -1,66 +1,64 @@
1
- /**
2
- * Initializes the Overlayed Ads.
3
- * Overlayed must have been initialized on the electron side.
4
- *
5
- * This function only needs to be called once as it will retry initiailizing the ads until it succeeds.
6
- */
7
- export declare function init(): void;
8
-
9
- /**
10
- * Sets whether ads are enabled or not
11
- *
12
- * @param enabled - Whether ads are enabled or not.
13
- * @returns void
14
- */
15
- export declare function setAdsEnabled(enabled: boolean): void;
16
-
17
- /**
18
- * Sets a key-value pair for optional targeting
19
- *
20
- * WARNING: You may not pass any user-identifiable data (including names, addresses, or user IDs) in targeting.
21
- *
22
- * @param key - The key to set.
23
- * @param value - The value to set.
24
- * @returns void
25
- */
26
- export declare function setKv(key: string, value: string): void;
27
-
28
- /**
29
- * Sets multiple key-value pairs for optional targeting
30
- *
31
- * WARNING: You may not pass any user-identifiable data (including names, addresses, or user IDs) in targeting.
32
- *
33
- * @param kvs - The key-value pairs to set.
34
- * @returns void
35
- */
36
- export declare function setKvs(kvs: Record<string, string>): void;
37
-
38
- /**
39
- * Provide a user ID (uid) for targeting. Variadic.
40
- *
41
- * Providing a UID significantly improves ad performance. As such, it is optional, but highly recommended.
42
- *
43
- * We comply with all privacy regulations and do not store any user-identifiable data. Once passed to RevIQ, the UID is normalized and then hashed; we never store the original value.
44
- *
45
- * If the user has opted out of tracking, the UID will not be stored or transmitted. Thus it is safe to call this function regardless of the user’s tracking preferences.
46
- *
47
- * @param uid - The user ID to set.
48
- * @param uid.u - The username.
49
- * @param uid.e - The email.
50
- * @param uid.p - The phone.
51
- * @returns void
52
- */
53
- export declare function setUid(uid: {
54
- u?: string;
55
- e?: string;
56
- p?: string;
57
- }): void;
58
-
59
- /**
60
- * Shows the consent dialog
61
- *
62
- * @returns void
63
- */
64
- export declare function showConsent(): void;
65
-
66
- export { }
1
+ //#region src/reviq.d.ts
2
+ /**
3
+ * Sets a key-value pair for optional targeting
4
+ *
5
+ * WARNING: You may not pass any user-identifiable data (including names, addresses, or user IDs) in targeting.
6
+ *
7
+ * @param key - The key to set.
8
+ * @param value - The value to set.
9
+ * @returns void
10
+ */
11
+ declare function setKv(key: string, value: string): void;
12
+ /**
13
+ * Sets multiple key-value pairs for optional targeting
14
+ *
15
+ * WARNING: You may not pass any user-identifiable data (including names, addresses, or user IDs) in targeting.
16
+ *
17
+ * @param kvs - The key-value pairs to set.
18
+ * @returns void
19
+ */
20
+ declare function setKvs(kvs: Record<string, string>): void;
21
+ /**
22
+ * Sets whether ads are enabled or not
23
+ *
24
+ * @param enabled - Whether ads are enabled or not.
25
+ * @returns void
26
+ */
27
+ declare function setAdsEnabled(enabled: boolean): void;
28
+ /**
29
+ * Provide a user ID (uid) for targeting. Variadic.
30
+ *
31
+ * Providing a UID significantly improves ad performance. As such, it is optional, but highly recommended.
32
+ *
33
+ * We comply with all privacy regulations and do not store any user-identifiable data. Once passed to RevIQ, the UID is normalized and then hashed; we never store the original value.
34
+ *
35
+ * If the user has opted out of tracking, the UID will not be stored or transmitted. Thus it is safe to call this function regardless of the user’s tracking preferences.
36
+ *
37
+ * @param uid - The user ID to set.
38
+ * @param uid.u - The username.
39
+ * @param uid.e - The email.
40
+ * @param uid.p - The phone.
41
+ * @returns void
42
+ */
43
+ declare function setUid(uid: {
44
+ u?: string;
45
+ e?: string;
46
+ p?: string;
47
+ }): void;
48
+ /**
49
+ * Shows the consent dialog
50
+ *
51
+ * @returns void
52
+ */
53
+ declare function showConsent(): void;
54
+ //#endregion
55
+ //#region src/index.d.ts
56
+ /**
57
+ * Initializes the Overlayed Ads.
58
+ * Overlayed must have been initialized on the electron side.
59
+ *
60
+ * This function only needs to be called once as it will retry initiailizing the ads until it succeeds.
61
+ */
62
+ declare function init(): void;
63
+ //#endregion
64
+ export { init, setAdsEnabled, setKv, setKvs, setUid, showConsent };
package/dist/index.js CHANGED
@@ -1,70 +1 @@
1
- function r(e, ...n) {
2
- console.error(`[Overlayed] ${e}`, ...n);
3
- }
4
- function i(e) {
5
- globalThis.reviq = globalThis.reviq || [], globalThis.reviq.push(e);
6
- }
7
- function a(e, n) {
8
- return e(), setInterval(e, n);
9
- }
10
- function f(e, n) {
11
- if (e === "app_id") {
12
- r("[Overlayed] app_id is a reserved key");
13
- return;
14
- }
15
- i((o) => {
16
- o.setKv(e, n);
17
- });
18
- }
19
- function d(e, n) {
20
- i((o) => {
21
- o.setKv(e, n);
22
- });
23
- }
24
- function v(e) {
25
- if (e.app_id) {
26
- r("[Overlayed] app_id is a reserved key");
27
- return;
28
- }
29
- i((n) => {
30
- n.setKvs(e);
31
- });
32
- }
33
- function p(e) {
34
- i((n) => {
35
- n.setAdsEnabled(e);
36
- });
37
- }
38
- function s(e) {
39
- i((n) => {
40
- n.setUid(e);
41
- });
42
- }
43
- function c() {
44
- i((e) => {
45
- e.showConsent();
46
- });
47
- }
48
- let t = null;
49
- function y() {
50
- t && clearInterval(t), t = a(() => {
51
- console.log("[Overlayed] Attempting to intiailize ads..."), l() && (t && clearInterval(t), u(window.overlayed));
52
- }, 1e3);
53
- }
54
- function l() {
55
- return typeof window > "u" ? !1 : !("overlayed" in window) || !window.overlayed || !window.overlayed.getAppInfo ? (r("Could not find overlayed instance - did you import the preload script?"), !1) : !0;
56
- }
57
- async function u(e) {
58
- const n = await e.getAppInfo();
59
- d("app_id", n.slug), s({
60
- u: n.userId
61
- }), console.log("[Overlayed] Ads initialized!");
62
- }
63
- export {
64
- y as init,
65
- p as setAdsEnabled,
66
- f as setKv,
67
- v as setKvs,
68
- s as setUid,
69
- c as showConsent
70
- };
1
+ function e(e,...t){console.error(`[Overlayed] ${e}`,...t)}function t(e,...t){console.info(`[Overlayed] ${e}`,...t)}function n(e){globalThis.reviq=globalThis.reviq||[],globalThis.reviq.push(e)}function r(e,t){return e(),setInterval(e,t)}function i(){return typeof window>`u`?!1:!(`overlayed`in window)||!window.overlayed||!window.overlayed.getAppInfo?(e(`Could not find overlayed instance - did you import the preload script?`),!1):!0}function a(t,r){if(t===`app_id`){e(`[Overlayed] app_id is a reserved key`);return}n(e=>{e.setKv(t,r)})}function o(e,t){n(n=>{n.setKv(e,t)})}function s(t){if(t.app_id){e(`[Overlayed] app_id is a reserved key`);return}n(e=>{e.setKvs(t)})}function c(e){n(t=>{t.setAdsEnabled(e)})}function l(e){if(!i()||e.u){n(t=>{t.setUid(e)});return}window.overlayed.getAppInfo().then(t=>{n(n=>{n.setUid({...e,u:t.userId})})})}function u(){n(e=>{e.showConsent()})}let d=null;function f(){d&&clearInterval(d),d=r(()=>{t(`[Overlayed] Attempting to intiailize ads...`),i()&&(d&&clearInterval(d),p(window.overlayed))},1e3)}async function p(e){let n=await e.getAppInfo();o(`app_id`,n.slug),l({u:n.userId}),t(`[Overlayed] Ads initialized!`)}export{f as init,c as setAdsEnabled,a as setKv,s as setKvs,l as setUid,u as showConsent};
package/package.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@overlayed/ads",
3
3
  "author": "overlayed.gg",
4
4
  "homepage": "https://overlayed.gg",
5
- "version": "0.1.2",
5
+ "version": "0.1.4",
6
6
  "description": "Overlayed ads",
7
- "license": "BSD-3-Clause",
7
+ "license": "SEE LICENSE IN LICENSE.md",
8
8
  "repository": {
9
9
  "url": "https://github.com/overlayed-gg/overlayed-typescript",
10
10
  "type": "git"
@@ -35,13 +35,11 @@
35
35
  }
36
36
  },
37
37
  "devDependencies": {
38
- "@ark/attest": "^0.45.0",
39
- "rollup-plugin-node-externals": "^8.0.0",
40
- "typescript": "^5.8.2",
41
- "vite": "^6.2.6",
42
- "vite-plugin-dts": "^4.5.3",
43
- "vite-plugin-static-copy": "^2.3.1",
44
- "vitest": "^3.0.9"
38
+ "@ark/attest": "^0.48.2",
39
+ "happy-dom": "^18.0.1",
40
+ "tsdown": "^0.12.9",
41
+ "typescript": "^5.8.3",
42
+ "vitest": "^3.2.4"
45
43
  },
46
44
  "engines": {
47
45
  "node": ">=20.10.0"