@overlayed/ads 0.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.
package/LICENSE.md ADDED
@@ -0,0 +1,16 @@
1
+ # Proprietary License
2
+
3
+ Copyright (c) 2023-present OVERLAYED LLC. All rights reserved.
4
+
5
+ This software and associated documentation files (the "Software") are the proprietary and confidential information of
6
+ OVERLAYED LLC. You may not use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software
7
+ without explicit written permission from OVERLAYED LLC.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
10
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
11
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
12
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+
14
+ Unauthorized copying, transfer, or reproduction of the contents of this Software, via any medium is strictly prohibited.
15
+
16
+ All rights not expressly granted herein are reserved by OVERLAYED LLC.
package/README.md ADDED
File without changes
@@ -0,0 +1,66 @@
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 { }
package/dist/index.js ADDED
@@ -0,0 +1,70 @@
1
+ function o(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 s(e, n) {
8
+ return e(), setInterval(e, n);
9
+ }
10
+ function v(e, n) {
11
+ if (e === "app_id") {
12
+ o("[Overlayed] app_id is a reserved key");
13
+ return;
14
+ }
15
+ i((t) => {
16
+ t.setKv(e, n);
17
+ });
18
+ }
19
+ function l(e, n) {
20
+ i((t) => {
21
+ t.setKv(e, n);
22
+ });
23
+ }
24
+ function f(e) {
25
+ if (e.app_id) {
26
+ o("[Overlayed] app_id is a reserved key");
27
+ return;
28
+ }
29
+ i((n) => {
30
+ n.setKvs(e);
31
+ });
32
+ }
33
+ function c(e) {
34
+ i((n) => {
35
+ n.setAdsEnabled(e);
36
+ });
37
+ }
38
+ function a(e) {
39
+ i((n) => {
40
+ n.setUid(e);
41
+ });
42
+ }
43
+ function p() {
44
+ i((e) => {
45
+ e.showConsent();
46
+ });
47
+ }
48
+ let r = null;
49
+ function y() {
50
+ r && clearInterval(r), r = s(() => {
51
+ console.log("[Overlayed] Attempting to intiailize ads..."), d() && (r && clearInterval(r), u(window.overlayed));
52
+ }, 1e3);
53
+ }
54
+ function d() {
55
+ return !(typeof window > "u" || !("overlayed" in window) || !window.overlayed);
56
+ }
57
+ function u(e) {
58
+ const { appSlug: n, userId: t } = e;
59
+ l("app_id", n), a({
60
+ u: t
61
+ }), console.log("[Overlayed] Ads initialized!");
62
+ }
63
+ export {
64
+ y as init,
65
+ c as setAdsEnabled,
66
+ v as setKv,
67
+ f as setKvs,
68
+ a as setUid,
69
+ p as showConsent
70
+ };
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@overlayed/ads",
3
+ "author": "overlayed.gg",
4
+ "homepage": "https://overlayed.gg",
5
+ "version": "0.0.1",
6
+ "description": "Overlayed ads",
7
+ "packageManager": "pnpm@10.6.3",
8
+ "license": "BSD-3-Clause",
9
+ "repository": {
10
+ "url": "https://github.com/overlayed-gg/overlayed-typescript",
11
+ "type": "git"
12
+ },
13
+ "keywords": [
14
+ "typescript"
15
+ ],
16
+ "type": "module",
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ "./package.json": "./package.json",
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js",
24
+ "default": "./dist/index.js"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist/**/*"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "typescript": {
35
+ "optional": true
36
+ }
37
+ },
38
+ "devDependencies": {
39
+ "@ark/attest": "catalog:",
40
+ "rollup-plugin-node-externals": "catalog:",
41
+ "typescript": "catalog:",
42
+ "vite": "catalog:",
43
+ "vite-plugin-dts": "catalog:",
44
+ "vite-plugin-static-copy": "catalog:",
45
+ "vitest": "catalog:"
46
+ },
47
+ "engines": {
48
+ "node": ">=20.10.0"
49
+ }
50
+ }