@aippy/runtime 0.2.2 → 0.2.3-dev.0
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 +70 -37
- package/dist/index.d.ts +1 -0
- package/dist/leaderboard/index.d.ts +2 -0
- package/dist/leaderboard/report.d.ts +25 -0
- package/dist/leaderboard/types.d.ts +34 -0
- package/package.json +12 -8
package/dist/core/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as f, 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.
|
|
25
|
+
const s = "0.2.3-dev.0", 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
|
+
f 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,40 +1,73 @@
|
|
|
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
|
|
1
|
+
import { DEFAULT_CONFIG as p, SDK_NAME as d, VERSION as m, getConfigFromEnv as c, getVersionInfo as f, mergeConfig as l } from "../core/index.js";
|
|
2
|
+
import { A as g, E as w, c as A } from "../errors-CDEBaBxB.js";
|
|
3
|
+
import { CameraAPI as u, FileSystemAPI as S, GeolocationAPI as x, SensorsAPI as b, camera as I, fileSystem as P, geolocation as v, sensors as C, vibrate as M } from "../device/index.js";
|
|
4
|
+
import { c as O, a as R, P as D, b as F, p as _, d as G } from "../pwa-8DGmPqLV.js";
|
|
5
|
+
import { a as k, b as H } from "../useTweaks-QxMRmg7i.js";
|
|
6
|
+
import { c as h, a as T, i as U, b as $, p as J, u as K } from "../useAudioContext-BKgy28A1.js";
|
|
7
|
+
function r(e) {
|
|
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
|
+
}
|
|
7
38
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
g as AippyRuntimeError,
|
|
40
|
+
u as CameraAPI,
|
|
41
|
+
p as DEFAULT_CONFIG,
|
|
42
|
+
w as ERROR_CODES,
|
|
43
|
+
S as FileSystemAPI,
|
|
44
|
+
x as GeolocationAPI,
|
|
45
|
+
O as PWAUtils,
|
|
46
|
+
R as PerformanceMonitor,
|
|
16
47
|
D as PlatformDetector,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
C as
|
|
48
|
+
d as SDK_NAME,
|
|
49
|
+
b as SensorsAPI,
|
|
50
|
+
m as VERSION,
|
|
51
|
+
k as aippyTweaks,
|
|
52
|
+
H as aippyTweaksRuntime,
|
|
53
|
+
I as camera,
|
|
54
|
+
A as createError,
|
|
55
|
+
h as createHiddenMediaElement,
|
|
56
|
+
T as createHiddenVideoElement,
|
|
57
|
+
P as fileSystem,
|
|
58
|
+
v as geolocation,
|
|
59
|
+
c as getConfigFromEnv,
|
|
60
|
+
f as getVersionInfo,
|
|
61
|
+
U as isIOSDevice,
|
|
62
|
+
$ as isMediaStreamAudioSupported,
|
|
63
|
+
l as mergeConfig,
|
|
64
|
+
J as patchAudioContext,
|
|
65
|
+
F as performanceMonitor,
|
|
66
|
+
_ as platform,
|
|
67
|
+
G as pwa,
|
|
68
|
+
t as reportScore,
|
|
69
|
+
s as sendEvent,
|
|
70
|
+
C as sensors,
|
|
71
|
+
K as useAudioContext,
|
|
72
|
+
M as vibrate
|
|
40
73
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Leaderboard reporting functionality for score submission and game events
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Report game score to parent window or iOS app
|
|
6
|
+
* @param score - The score value to report
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* reportScore(100);
|
|
11
|
+
* reportScore(1500);
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function reportScore(score: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* Send a custom game event
|
|
17
|
+
* @param eventType - The event type
|
|
18
|
+
* @param data - Additional event data
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* sendEvent('level-complete', { level: 5, time: 120 });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function sendEvent(eventType: string, data?: Record<string, unknown>): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Leaderboard SDK type definitions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Score report payload
|
|
6
|
+
*/
|
|
7
|
+
export interface ScorePayload {
|
|
8
|
+
/** Message type, fixed as 'score' */
|
|
9
|
+
type: 'score';
|
|
10
|
+
/** The score value */
|
|
11
|
+
score: number;
|
|
12
|
+
/** Score unit (e.g., 'points', 'coins') */
|
|
13
|
+
unit?: string;
|
|
14
|
+
/** Whether bigger score is better for leaderboard ranking */
|
|
15
|
+
'bigger-is-better'?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Generic game event payload
|
|
19
|
+
*/
|
|
20
|
+
export interface GameEventPayload {
|
|
21
|
+
/** Event type */
|
|
22
|
+
type: string;
|
|
23
|
+
/** Additional event data */
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Message format for postMessage communication
|
|
28
|
+
*/
|
|
29
|
+
export interface AippyGameMessage {
|
|
30
|
+
/** Message identifier */
|
|
31
|
+
__aippyGame: true;
|
|
32
|
+
/** Event payload */
|
|
33
|
+
payload: ScorePayload | GameEventPayload;
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aippy/runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3-dev.0",
|
|
4
4
|
"description": "Aippy Runtime SDK - Runtime SDK for Aippy projects",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"./audio": {
|
|
32
32
|
"import": "./dist/audio/index.js",
|
|
33
33
|
"types": "./dist/audio/index.d.ts"
|
|
34
|
+
},
|
|
35
|
+
"./leaderboard": {
|
|
36
|
+
"import": "./dist/leaderboard/index.js",
|
|
37
|
+
"types": "./dist/leaderboard/index.d.ts"
|
|
34
38
|
}
|
|
35
39
|
},
|
|
36
40
|
"files": [
|
|
@@ -88,13 +92,13 @@
|
|
|
88
92
|
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
89
93
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
90
94
|
"clean": "rm -rf dist",
|
|
91
|
-
"publish:patch": "pnpm version patch && pnpm publish --no-git-checks",
|
|
92
|
-
"publish:minor": "pnpm version minor && pnpm publish --no-git-checks",
|
|
93
|
-
"publish:major": "pnpm version major && pnpm publish --no-git-checks",
|
|
94
|
-
"publish:alpha": "pnpm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks",
|
|
95
|
-
"publish:beta": "pnpm version prerelease --preid=beta && pnpm publish --tag beta --no-git-checks",
|
|
96
|
-
"publish:rc": "pnpm version prerelease --preid=rc && pnpm publish --tag rc --no-git-checks",
|
|
97
|
-
"publish:dev": "pnpm version prerelease --preid=dev && pnpm publish --tag dev --no-git-checks",
|
|
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",
|
|
98
102
|
"audit": "pnpm audit --audit-level moderate",
|
|
99
103
|
"audit:fix": "pnpm audit --fix",
|
|
100
104
|
"security:check": "pnpm audit && pnpm outdated",
|