@aippy/runtime 0.2.3-dev.0 → 0.2.3
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/core/index.js +3 -3
- package/dist/index/index.js +41 -70
- package/dist/leaderboard/index.js +42 -0
- package/dist/leaderboard/report.d.ts +12 -1
- package/dist/leaderboard.d.ts +2 -0
- package/package.json +26 -25
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as d, E as v, c as _ } from "../errors-CDEBaBxB.js";
|
|
2
2
|
const o = {
|
|
3
3
|
mode: "development",
|
|
4
4
|
debug: !1,
|
|
@@ -22,7 +22,7 @@ function a(e) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
const s = "0.2.3
|
|
25
|
+
const s = "0.2.3", t = {
|
|
26
26
|
version: s
|
|
27
27
|
}, i = t.version, c = "@aippy/runtime";
|
|
28
28
|
function p() {
|
|
@@ -33,7 +33,7 @@ function p() {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
d as AippyRuntimeError,
|
|
37
37
|
o as DEFAULT_CONFIG,
|
|
38
38
|
v as ERROR_CODES,
|
|
39
39
|
c as SDK_NAME,
|
package/dist/index/index.js
CHANGED
|
@@ -1,73 +1,44 @@
|
|
|
1
|
-
import { DEFAULT_CONFIG as
|
|
2
|
-
import { A as
|
|
3
|
-
import { CameraAPI as
|
|
4
|
-
import { c as
|
|
5
|
-
import { a as
|
|
6
|
-
import { c as
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
if (window.parent && window.parent !== window) {
|
|
10
|
-
const a = {
|
|
11
|
-
__aippyGame: !0,
|
|
12
|
-
payload: e
|
|
13
|
-
};
|
|
14
|
-
window.parent.postMessage(a, "*");
|
|
15
|
-
}
|
|
16
|
-
const o = window.webkit?.messageHandlers?.aippyListener;
|
|
17
|
-
o && o.postMessage({
|
|
18
|
-
command: "game.event",
|
|
19
|
-
parameters: JSON.stringify(e)
|
|
20
|
-
});
|
|
21
|
-
} catch (o) {
|
|
22
|
-
console.warn("[Aippy Leaderboard] Failed to send game event:", o);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function t(e) {
|
|
26
|
-
r({
|
|
27
|
-
type: "score",
|
|
28
|
-
score: e
|
|
29
|
-
}), console.log(`[Aippy Leaderboard] Score reported: ${e}`);
|
|
30
|
-
}
|
|
31
|
-
function s(e, o) {
|
|
32
|
-
const a = {
|
|
33
|
-
type: e,
|
|
34
|
-
...o
|
|
35
|
-
};
|
|
36
|
-
r(a), console.log(`[Aippy Leaderboard] Event sent: ${e}`, o);
|
|
37
|
-
}
|
|
1
|
+
import { DEFAULT_CONFIG as r, SDK_NAME as a, VERSION as t, getConfigFromEnv as s, getVersionInfo as i, mergeConfig as n } from "../core/index.js";
|
|
2
|
+
import { A as m, E as c, c as f } from "../errors-CDEBaBxB.js";
|
|
3
|
+
import { CameraAPI as A, FileSystemAPI as E, GeolocationAPI as S, SensorsAPI as l, camera as u, fileSystem as x, geolocation as I, sensors as P, vibrate as C } from "../device/index.js";
|
|
4
|
+
import { c as R, a as y, P as D, b as M, p as O, d as b } from "../pwa-8DGmPqLV.js";
|
|
5
|
+
import { a as F, b as w } from "../useTweaks-QxMRmg7i.js";
|
|
6
|
+
import { c as T, a as V, i as _, b as k, p as G, u as H } from "../useAudioContext-BKgy28A1.js";
|
|
7
|
+
import { reportScore as h, sendEvent as K, updateScore as L } from "../leaderboard/index.js";
|
|
38
8
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
9
|
+
m as AippyRuntimeError,
|
|
10
|
+
A as CameraAPI,
|
|
11
|
+
r as DEFAULT_CONFIG,
|
|
12
|
+
c as ERROR_CODES,
|
|
13
|
+
E as FileSystemAPI,
|
|
14
|
+
S as GeolocationAPI,
|
|
15
|
+
R as PWAUtils,
|
|
16
|
+
y as PerformanceMonitor,
|
|
47
17
|
D as PlatformDetector,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
18
|
+
a as SDK_NAME,
|
|
19
|
+
l as SensorsAPI,
|
|
20
|
+
t as VERSION,
|
|
21
|
+
F as aippyTweaks,
|
|
22
|
+
w as aippyTweaksRuntime,
|
|
23
|
+
u as camera,
|
|
24
|
+
f as createError,
|
|
25
|
+
T as createHiddenMediaElement,
|
|
26
|
+
V as createHiddenVideoElement,
|
|
27
|
+
x as fileSystem,
|
|
28
|
+
I as geolocation,
|
|
29
|
+
s as getConfigFromEnv,
|
|
30
|
+
i as getVersionInfo,
|
|
31
|
+
_ as isIOSDevice,
|
|
32
|
+
k as isMediaStreamAudioSupported,
|
|
33
|
+
n as mergeConfig,
|
|
34
|
+
G as patchAudioContext,
|
|
35
|
+
M as performanceMonitor,
|
|
36
|
+
O as platform,
|
|
37
|
+
b as pwa,
|
|
38
|
+
h as reportScore,
|
|
39
|
+
K as sendEvent,
|
|
40
|
+
P as sensors,
|
|
41
|
+
L as updateScore,
|
|
42
|
+
H as useAudioContext,
|
|
43
|
+
C as vibrate
|
|
73
44
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function r(e, o) {
|
|
2
|
+
try {
|
|
3
|
+
if (window.parent && window.parent !== window) {
|
|
4
|
+
const n = {
|
|
5
|
+
__aippyGame: !0,
|
|
6
|
+
payload: e
|
|
7
|
+
};
|
|
8
|
+
window.parent.postMessage(n, "*");
|
|
9
|
+
}
|
|
10
|
+
const a = window.webkit?.messageHandlers?.aippyListener;
|
|
11
|
+
a && a.postMessage({
|
|
12
|
+
command: o,
|
|
13
|
+
parameters: JSON.stringify(e)
|
|
14
|
+
});
|
|
15
|
+
} catch (a) {
|
|
16
|
+
console.warn("[Aippy Leaderboard] Failed to send game event:", a);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function t(e) {
|
|
20
|
+
r({
|
|
21
|
+
type: "score",
|
|
22
|
+
score: e
|
|
23
|
+
}, "leaderboard.reportScore"), console.log(`[Aippy Leaderboard] Score reported: ${e}`);
|
|
24
|
+
}
|
|
25
|
+
function p(e) {
|
|
26
|
+
r({
|
|
27
|
+
type: "score",
|
|
28
|
+
score: e
|
|
29
|
+
}, "leaderboard.updateScore"), console.log(`[Aippy Leaderboard] Score updated: ${e}`);
|
|
30
|
+
}
|
|
31
|
+
function d(e, o) {
|
|
32
|
+
const a = {
|
|
33
|
+
type: e,
|
|
34
|
+
...o
|
|
35
|
+
};
|
|
36
|
+
r(a, "leaderboard.event"), console.log(`[Aippy Leaderboard] Event sent: ${e}`, o);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
t as reportScore,
|
|
40
|
+
d as sendEvent,
|
|
41
|
+
p as updateScore
|
|
42
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Leaderboard reporting functionality for score submission and game events
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Report game score to parent window or iOS app
|
|
5
|
+
* Report final game score to parent window or iOS app (used when game ends)
|
|
6
6
|
* @param score - The score value to report
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -12,6 +12,17 @@
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
export declare function reportScore(score: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* Update current game score to parent window or iOS app (used during gameplay)
|
|
17
|
+
* @param score - The current score value to update
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* updateScore(50);
|
|
22
|
+
* updateScore(currentScore);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function updateScore(score: number): void;
|
|
15
26
|
/**
|
|
16
27
|
* Send a custom game event
|
|
17
28
|
* @param eventType - The event type
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aippy/runtime",
|
|
3
|
-
"version": "0.2.3
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Aippy Runtime SDK - Runtime SDK for Aippy projects",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -44,6 +44,30 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"dev": "vite build --watch",
|
|
49
|
+
"build": "vite build && find dist -name '*.d.ts.map' -delete",
|
|
50
|
+
"type-check": "tsc --noEmit",
|
|
51
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
52
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
53
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
54
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
55
|
+
"clean": "rm -rf dist",
|
|
56
|
+
"prepublishOnly": "pnpm run clean && pnpm run type-check && pnpm run build",
|
|
57
|
+
"publish:patch": "pnpm prepublishOnly && pnpm version patch && pnpm publish --no-git-checks",
|
|
58
|
+
"publish:minor": "pnpm prepublishOnly && pnpm version minor && pnpm publish --no-git-checks",
|
|
59
|
+
"publish:major": "pnpm prepublishOnly && pnpm version major && pnpm publish --no-git-checks",
|
|
60
|
+
"publish:alpha": "pnpm prepublishOnly && pnpm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks",
|
|
61
|
+
"publish:beta": "pnpm prepublishOnly && pnpm version prerelease --preid=beta && pnpm publish --tag beta --no-git-checks",
|
|
62
|
+
"publish:rc": "pnpm prepublishOnly && pnpm version prerelease --preid=rc && pnpm publish --tag rc --no-git-checks",
|
|
63
|
+
"publish:dev": "pnpm prepublishOnly && pnpm version prerelease --preid=dev && pnpm publish --tag dev --no-git-checks",
|
|
64
|
+
"audit": "pnpm audit --audit-level moderate",
|
|
65
|
+
"audit:fix": "pnpm audit --fix",
|
|
66
|
+
"security:check": "pnpm audit && pnpm outdated",
|
|
67
|
+
"prerelease": "pnpm run audit && pnpm run type-check && pnpm run lint && pnpm run build",
|
|
68
|
+
"release:dry": "npm publish --dry-run",
|
|
69
|
+
"test:build": "node -e \"require('./dist/index.js')\""
|
|
70
|
+
},
|
|
47
71
|
"keywords": [
|
|
48
72
|
"aippy",
|
|
49
73
|
"runtime",
|
|
@@ -82,28 +106,5 @@
|
|
|
82
106
|
"engines": {
|
|
83
107
|
"node": ">=20.0.0",
|
|
84
108
|
"pnpm": ">=10.0.0"
|
|
85
|
-
},
|
|
86
|
-
"scripts": {
|
|
87
|
-
"dev": "vite build --watch",
|
|
88
|
-
"build": "vite build && find dist -name '*.d.ts.map' -delete",
|
|
89
|
-
"type-check": "tsc --noEmit",
|
|
90
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
91
|
-
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
92
|
-
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
93
|
-
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
94
|
-
"clean": "rm -rf dist",
|
|
95
|
-
"publish:patch": "pnpm prepublishOnly && pnpm version patch && pnpm publish --no-git-checks",
|
|
96
|
-
"publish:minor": "pnpm prepublishOnly && pnpm version minor && pnpm publish --no-git-checks",
|
|
97
|
-
"publish:major": "pnpm prepublishOnly && pnpm version major && pnpm publish --no-git-checks",
|
|
98
|
-
"publish:alpha": "pnpm prepublishOnly && pnpm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks",
|
|
99
|
-
"publish:beta": "pnpm prepublishOnly && pnpm version prerelease --preid=beta && pnpm publish --tag beta --no-git-checks",
|
|
100
|
-
"publish:rc": "pnpm prepublishOnly && pnpm version prerelease --preid=rc && pnpm publish --tag rc --no-git-checks",
|
|
101
|
-
"publish:dev": "pnpm prepublishOnly && pnpm version prerelease --preid=dev && pnpm publish --tag dev --no-git-checks",
|
|
102
|
-
"audit": "pnpm audit --audit-level moderate",
|
|
103
|
-
"audit:fix": "pnpm audit --fix",
|
|
104
|
-
"security:check": "pnpm audit && pnpm outdated",
|
|
105
|
-
"prerelease": "pnpm run audit && pnpm run type-check && pnpm run lint && pnpm run build",
|
|
106
|
-
"release:dry": "npm publish --dry-run",
|
|
107
|
-
"test:build": "node -e \"require('./dist/index.js')\""
|
|
108
109
|
}
|
|
109
|
-
}
|
|
110
|
+
}
|