@jolibox/sdk 1.1.3 → 1.1.4-beta.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/.eslintrc.js +3 -0
- package/.rush/temp/package-deps_build.json +28 -0
- package/.rush/temp/shrinkwrap-deps.json +76 -0
- package/README.md +1 -96
- package/dist/api/__tests__/canIUse.test.d.ts +1 -0
- package/dist/api/can-i-use.d.ts +1 -0
- package/dist/api/get-system-info.d.ts +3 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/errors.d.ts +2 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +19 -337
- package/dist/index.es.js +1 -0
- package/dist/index.iife.js +1 -12
- package/dist/loader/h5.d.ts +6 -0
- package/dist/loader/index.d.ts +16 -0
- package/dist/loader/native.d.ts +6 -0
- package/dist/loader/version.d.ts +2 -0
- package/dist/sdks/ads.d.ts +11 -0
- package/dist/sdks/keyboard.d.ts +34 -0
- package/dist/sdks/lifecycle.d.ts +16 -0
- package/dist/sdks/runtime.d.ts +1 -0
- package/dist/sdks/sdk.d.ts +11 -0
- package/dist/sdks/storage.d.ts +8 -0
- package/dist/utils/can-i-use.d.ts +2 -0
- package/dist/utils/report.d.ts +3 -0
- package/package.json +23 -33
- package/sdk.build.log +17 -0
- package/src/api/__tests__/canIUse.test.ts +76 -0
- package/src/api/can-i-use.ts +38 -0
- package/src/api/get-system-info.ts +14 -0
- package/src/api/index.ts +2 -0
- package/src/errors.ts +42 -0
- package/src/index.ts +29 -0
- package/src/loader/h5.ts +175 -0
- package/src/loader/index.ts +65 -0
- package/src/loader/native.ts +62 -0
- package/src/loader/version.ts +44 -0
- package/src/sdks/ads.ts +32 -0
- package/src/sdks/keyboard.ts +50 -0
- package/src/sdks/lifecycle.ts +32 -0
- package/src/sdks/runtime.ts +3 -0
- package/src/sdks/sdk.ts +22 -0
- package/src/sdks/storage.ts +35 -0
- package/src/utils/can-i-use.ts +24 -0
- package/src/utils/report.ts +23 -0
- package/tsconfig.json +12 -107
- package/README-zh_cn.md +0 -96
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -342
- package/dist/index.iife.js.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -106
- package/docs/assets/icons.js +0 -18
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -60
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1493
- package/docs/classes/ads.JoliboxAds.html +0 -41
- package/docs/classes/index.JoliboxSDK.html +0 -4
- package/docs/classes/loader.JoliboxSDKLoader.html +0 -7
- package/docs/classes/runtime.JoliboxRuntime.html +0 -8
- package/docs/documents/README.html +0 -38
- package/docs/enums/runtime.JoliboxRuntimeEvents.html +0 -7
- package/docs/index.html +0 -38
- package/docs/interfaces/ads.IAdConfigParams.html +0 -12
- package/docs/interfaces/ads.IAdUnitParams.html +0 -11
- package/docs/interfaces/ads.IAdsInitParams.html +0 -5
- package/docs/interfaces/ads.IInterstitialsParams.html +0 -15
- package/docs/interfaces/ads.IPlacementInfo.html +0 -59
- package/docs/interfaces/ads.IPrerollParams.html +0 -6
- package/docs/interfaces/ads.IRewardParams.html +0 -18
- package/docs/interfaces/index.IJoliboxConfig.html +0 -3
- package/docs/interfaces/loader.IJoliboxSDKLoaderConfig.html +0 -3
- package/docs/interfaces/loader.IRemoteVersionMetadata.html +0 -4
- package/docs/interfaces/loader.IVersionMetadata.html +0 -4
- package/docs/modules/ads.html +0 -12
- package/docs/modules/index.html +0 -4
- package/docs/modules/loader.html +0 -5
- package/docs/modules/runtime.html +0 -4
- package/docs/modules.html +0 -6
- package/docs/types/ads.AdUnitFormat.html +0 -2
- package/docs/types/ads.IAdBreakParams.html +0 -2
- package/tsup.config.ts +0 -27
- package/typedoc.config.mjs +0 -19
- package/vitest.config.ts +0 -10
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": {
|
|
3
|
+
"packages/sdk/.rush/temp/shrinkwrap-deps.json": "2dae37e4e0434d977846f6598de8fbcb9919efc5",
|
|
4
|
+
"packages/sdk/.eslintrc.js": "c11c589d14fe58bf4d37d259d8323b193bab6092",
|
|
5
|
+
"packages/sdk/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
|
|
6
|
+
"packages/sdk/package.json": "7391913e6052c099219764491dde1e7fc4c54f61",
|
|
7
|
+
"packages/sdk/src/api/__tests__/canIUse.test.ts": "27fbe5050ac2e95d6643ff5fec335ba4d22ceb93",
|
|
8
|
+
"packages/sdk/src/api/can-i-use.ts": "c6f9e896d05a63eabd754ab01d90711186eb8959",
|
|
9
|
+
"packages/sdk/src/api/get-system-info.ts": "20eed7f356c629708452bb6f61cc05774f054070",
|
|
10
|
+
"packages/sdk/src/api/index.ts": "d7390d30c9207b1450e018898a21cc458f6e613e",
|
|
11
|
+
"packages/sdk/src/errors.ts": "1e74d62516994468d8f402d3ad2de999d3b0bb86",
|
|
12
|
+
"packages/sdk/src/index.ts": "aab8ffff507dc63da0257e41460dd33b22dca7fd",
|
|
13
|
+
"packages/sdk/src/loader/h5.ts": "76be98a2ec6c1fc2ad585772b22042b4f41dbd64",
|
|
14
|
+
"packages/sdk/src/loader/index.ts": "43c8327f6d7aae9fe054891be0f7c5e21cd1c500",
|
|
15
|
+
"packages/sdk/src/loader/native.ts": "ae1261a36a77a215e9d01b3aaed49e5bab0afb06",
|
|
16
|
+
"packages/sdk/src/loader/version.ts": "8b584cf9c97198b6b6d1f728cc49f56260d7c02e",
|
|
17
|
+
"packages/sdk/src/sdks/ads.ts": "d12ffe12be857f216a59a742f54395e31888adb5",
|
|
18
|
+
"packages/sdk/src/sdks/keyboard.ts": "145d1c073ca6b0a3486f79979dd5430d8f4e553c",
|
|
19
|
+
"packages/sdk/src/sdks/lifecycle.ts": "d8f8dda41aec99c0c2cbf385c37df7e2c5fd69b5",
|
|
20
|
+
"packages/sdk/src/sdks/runtime.ts": "de05c8f898b3f5848c83e5c088fb720bd8217d99",
|
|
21
|
+
"packages/sdk/src/sdks/sdk.ts": "f2eb4647da7fe88933b06d9908b215b7a6de3ca9",
|
|
22
|
+
"packages/sdk/src/sdks/storage.ts": "e04fca273b640f2e1dfcc70f23eaa537145c3f36",
|
|
23
|
+
"packages/sdk/src/utils/can-i-use.ts": "10993f013cf26c07b60fe60fb7b458bbd6847244",
|
|
24
|
+
"packages/sdk/src/utils/report.ts": "d928d7456a5ba829216c41ea5b66afff6627c6be",
|
|
25
|
+
"packages/sdk/tsconfig.json": "0ecd9cf2b93d09e0376a098b5b662820bafcf7eb"
|
|
26
|
+
},
|
|
27
|
+
"arguments": "npm run clean && npm run build:cjs && npm run build:esm && npm run build:iife && tsc "
|
|
28
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"../../packages/sdk": "../../packages/sdk:HAl18E4lXgSYeou9nev56qfx967v8htQ49c1prjqnl8=:",
|
|
3
|
+
"/@esbuild/aix-ppc64/0.24.2": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==",
|
|
4
|
+
"/@esbuild/android-arm/0.24.2": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==",
|
|
5
|
+
"/@esbuild/android-arm64/0.24.2": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==",
|
|
6
|
+
"/@esbuild/android-x64/0.24.2": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==",
|
|
7
|
+
"/@esbuild/darwin-arm64/0.24.2": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==",
|
|
8
|
+
"/@esbuild/darwin-x64/0.24.2": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==",
|
|
9
|
+
"/@esbuild/freebsd-arm64/0.24.2": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==",
|
|
10
|
+
"/@esbuild/freebsd-x64/0.24.2": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==",
|
|
11
|
+
"/@esbuild/linux-arm/0.24.2": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==",
|
|
12
|
+
"/@esbuild/linux-arm64/0.24.2": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==",
|
|
13
|
+
"/@esbuild/linux-ia32/0.24.2": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==",
|
|
14
|
+
"/@esbuild/linux-loong64/0.24.2": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==",
|
|
15
|
+
"/@esbuild/linux-mips64el/0.24.2": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==",
|
|
16
|
+
"/@esbuild/linux-ppc64/0.24.2": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==",
|
|
17
|
+
"/@esbuild/linux-riscv64/0.24.2": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==",
|
|
18
|
+
"/@esbuild/linux-s390x/0.24.2": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==",
|
|
19
|
+
"/@esbuild/linux-x64/0.24.2": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==",
|
|
20
|
+
"/@esbuild/netbsd-arm64/0.24.2": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==",
|
|
21
|
+
"/@esbuild/netbsd-x64/0.24.2": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==",
|
|
22
|
+
"/@esbuild/openbsd-arm64/0.24.2": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==",
|
|
23
|
+
"/@esbuild/openbsd-x64/0.24.2": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==",
|
|
24
|
+
"/@esbuild/sunos-x64/0.24.2": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==",
|
|
25
|
+
"/@esbuild/win32-arm64/0.24.2": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==",
|
|
26
|
+
"/@esbuild/win32-ia32/0.24.2": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==",
|
|
27
|
+
"/@esbuild/win32-x64/0.24.2": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==",
|
|
28
|
+
"/@isaacs/cliui/8.0.2": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
|
|
29
|
+
"/@types/jest/28.1.1": "sha512-C2p7yqleUKtCkVjlOur9BWVA4HgUQmEj/HWCt5WzZ5mLXrWnyIfl0wGuArc+kBXsy0ZZfLp+7dywB4HtSVYGVA==",
|
|
30
|
+
"/ansi-regex/5.0.1": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
|
31
|
+
"/ansi-regex/6.1.0": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
|
|
32
|
+
"/ansi-styles/4.3.0": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
|
33
|
+
"/ansi-styles/5.2.0": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
|
|
34
|
+
"/ansi-styles/6.2.1": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
|
35
|
+
"/balanced-match/1.0.2": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
|
|
36
|
+
"/brace-expansion/2.0.1": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
|
|
37
|
+
"/chalk/4.1.2": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
|
38
|
+
"/color-convert/2.0.1": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
|
39
|
+
"/color-name/1.1.4": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
|
40
|
+
"/cross-spawn/7.0.6": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
|
41
|
+
"/diff-sequences/27.5.1": "sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ==",
|
|
42
|
+
"/eastasianwidth/0.2.0": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
|
|
43
|
+
"/emoji-regex/8.0.0": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
|
44
|
+
"/emoji-regex/9.2.2": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
|
|
45
|
+
"/esbuild/0.24.2": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==",
|
|
46
|
+
"/foreground-child/3.3.0": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==",
|
|
47
|
+
"/glob/11.0.1": "sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==",
|
|
48
|
+
"/has-flag/4.0.0": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
|
49
|
+
"/is-fullwidth-code-point/3.0.0": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
|
50
|
+
"/isexe/2.0.0": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
|
51
|
+
"/jackspeak/4.0.2": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==",
|
|
52
|
+
"/jest-diff/27.5.1": "sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw==",
|
|
53
|
+
"/jest-get-type/27.5.1": "sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw==",
|
|
54
|
+
"/jest-matcher-utils/27.5.1": "sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw==",
|
|
55
|
+
"/lru-cache/11.0.2": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==",
|
|
56
|
+
"/minimatch/10.0.1": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==",
|
|
57
|
+
"/minipass/7.1.2": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
|
58
|
+
"/package-json-from-dist/1.0.1": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
|
|
59
|
+
"/path-key/3.1.1": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
|
60
|
+
"/path-scurry/2.0.0": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==",
|
|
61
|
+
"/pretty-format/27.5.1": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
|
|
62
|
+
"/react-is/17.0.2": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
|
|
63
|
+
"/rimraf/6.0.1": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==",
|
|
64
|
+
"/shebang-command/2.0.0": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
|
65
|
+
"/shebang-regex/3.0.0": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
|
66
|
+
"/signal-exit/4.1.0": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
|
67
|
+
"/string-width/4.2.3": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
|
68
|
+
"/string-width/5.1.2": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
|
|
69
|
+
"/strip-ansi/6.0.1": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
|
70
|
+
"/strip-ansi/7.1.0": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
|
|
71
|
+
"/supports-color/7.2.0": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
|
72
|
+
"/typescript/5.7.3": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==",
|
|
73
|
+
"/which/2.0.2": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
|
74
|
+
"/wrap-ansi/7.0.0": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
|
75
|
+
"/wrap-ansi/8.1.0": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="
|
|
76
|
+
}
|
package/README.md
CHANGED
|
@@ -1,96 +1 @@
|
|
|
1
|
-
# Jolibox
|
|
2
|
-
|
|
3
|
-
Jolibox SDK is a JavaScript library that provides a simple way to integrate with Jolibox Ads, Runtime, and other services.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
We recommend using the SDK via CDN so that you can automatically get updates in future SDK versions.
|
|
8
|
-
|
|
9
|
-
### Via CDN
|
|
10
|
-
|
|
11
|
-
If you want to use the library via CDN, you add the following script tag to your HTML file.
|
|
12
|
-
|
|
13
|
-
In such case, you should not write the import statement in your JavaScript file.
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<script src="https://cdn.jsdelivr.net/npm/@jolibox/sdk@1/dist/index.iife.js"></script>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Via NPM
|
|
20
|
-
|
|
21
|
-
If you want to use the library via NPM, you can install it via the following command:
|
|
22
|
-
|
|
23
|
-
In such case, you should not include the script tag in your HTML file but write the import statement in your JavaScript file.
|
|
24
|
-
|
|
25
|
-
- npm
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install @jolibox/sdk
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
- pnpm
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
pnpm add @jolibox/sdk
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
- yarn
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
yarn add @jolibox/sdk
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Basic usage
|
|
44
|
-
|
|
45
|
-
- Initialization
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
// If you are importing the library via NPM, you can use the following import statement
|
|
49
|
-
// import { JoliboxSDK } from "@jolibox/sdk";
|
|
50
|
-
|
|
51
|
-
const jolibox = new JoliboxSDK();
|
|
52
|
-
const { ads, runtime } = jolibox;
|
|
53
|
-
|
|
54
|
-
// When your game is loading, call notifyLoadProgress to notify the loading progress
|
|
55
|
-
runtime.notifyLoadProgress(30);
|
|
56
|
-
runtime.notifyLoadProgress(60);
|
|
57
|
-
runtime.notifyLoadProgress(90);
|
|
58
|
-
|
|
59
|
-
// When your game is loaded, call loadFinished to notify the loading is finished
|
|
60
|
-
runtime.loadFinished();
|
|
61
|
-
|
|
62
|
-
// Initialize ads
|
|
63
|
-
ads.init();
|
|
64
|
-
|
|
65
|
-
// somewhere when you need to preload ads (e.g. in the game loading screen)
|
|
66
|
-
ads.adConfig({
|
|
67
|
-
preloadAdBreaks: "on",
|
|
68
|
-
sound: "off",
|
|
69
|
-
onReady: () => {
|
|
70
|
-
console.log("onReady");
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// Somewhere when you need a popup ads for reward
|
|
75
|
-
ads.adBreak({
|
|
76
|
-
type: "reward",
|
|
77
|
-
beforeReward(showAdFn) {
|
|
78
|
-
showAdFn();
|
|
79
|
-
},
|
|
80
|
-
adDismissed: () => {
|
|
81
|
-
console.log("adDismissed");
|
|
82
|
-
},
|
|
83
|
-
adViewed: () => {
|
|
84
|
-
console.log("adViewed");
|
|
85
|
-
},
|
|
86
|
-
adBreakDone: () => {
|
|
87
|
-
console.log("adBreakDone");
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// If you need to show a banner ad, you should call the following function when you start the App
|
|
92
|
-
// You have you make sure the element with the id "banner" is in your HTML file and it is together with the game canvas
|
|
93
|
-
ads.adUnit({
|
|
94
|
-
el: "#banner", // or document.getElementById("banner")
|
|
95
|
-
});
|
|
96
|
-
```
|
|
1
|
+
# Jolibox JSSDK Interface
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function canIUse(schema: string): boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function getSystemInfo(): Promise<import("@jolibox/types").StandardResponse<import("@jolibox/types").ISystemInfo>>;
|
|
2
|
+
export declare function getSystemInfoSync(): import("@jolibox/types").StandardResponse<import("@jolibox/types").ISystemInfo>;
|
|
3
|
+
export declare function env(): import("@jolibox/types").StandardResponse<Omit<Omit<import("@jolibox/types").Env, "hostUserInfo">, "schema">>;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var N=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Le=Object.prototype.hasOwnProperty;var we=(e,t)=>{for(var r in t)N(e,r,{get:t[r],enumerable:!0})},Ce=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ae(t))!Le.call(e,s)&&s!==r&&N(e,s,{get:()=>t[s],enumerable:!(n=Ue(t,s))||n.enumerable});return e};var Te=e=>Ce(N({},"__esModule",{value:!0}),e);var tt={};we(tt,{JoliboxSDK:()=>Q});module.exports=Te(tt);var Y=Object.defineProperty,De=Object.getOwnPropertyDescriptor,Oe=(e,t)=>{for(var r in t)Y(e,r,{get:t[r],enumerable:!0})},X=(e,t,r,n)=>{for(var s=n>1?void 0:n?De(t,r):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(n?i(t,r,s):i(s))||s);return n&&s&&Y(t,r,s),s};function Ne(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function j(e){return typeof e=="string"}function q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Ke(e){return typeof e>"u"}function Pe(e){return Ke(e)||e===null}function Me(e){return typeof e=="function"}function Z(e){let t=e,r=null,n=function(...s){return r||(r=new t(...s)),r};return n.prototype=t.prototype,n}var ke=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(ke||{}),je=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},ee=class extends je{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}};var te=class extends ee{constructor(){super(...arguments),this.name="INTERNAL_JS_MODULE_FETCH_ERROR",this.priority="P0"}},y=class extends ee{constructor(){super(...arguments),this.name="INTERNAL_JS_MODULE_EVAL_ERROR",this.priority="P0"}};function R(e){return(...t)=>{(globalThis.VConsole?.[e]??globalThis.console[e])(...t)}}var Je={log:R("log"),warn:R("warn"),info:R("info"),error:R("error"),debug:R("debug")};Object.assign(globalThis,{logger:Je});var re=Symbol.for("Jolibox.canIUseMap"),Fe={};globalThis[re]=Fe;var ne={get config(){return globalThis[re]}};function J(e,t,r){let n=0;if(e!==t){let s=e.split("."),o=t.split("."),i=Math.max(s.length,o.length);for(let l=0;l<i;l++){let _=parseInt(s[l],10)||0,c=parseInt(o[l],10)||0;if(_>c){n=1;break}else if(_<c){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}var a=class U{static{this.Undefined=new U(void 0)}constructor(t){this.element=t,this.next=U.Undefined,this.prev=U.Undefined}},Be=class{constructor(){this._first=a.Undefined,this._last=a.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===a.Undefined}clear(){let e=this._first;for(;e!==a.Undefined;){let t=e.next;e.prev=a.Undefined,e.next=a.Undefined,e=t}this._first=a.Undefined,this._last=a.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new a(e);if(this._first===a.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==a.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==a.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==a.Undefined&&e.next!==a.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===a.Undefined&&e.next===a.Undefined?(this._first=a.Undefined,this._last=a.Undefined):e.next===a.Undefined?(this._last=this._last.prev,this._last.next=a.Undefined):e.prev===a.Undefined&&(this._first=this._first.next,this._first.prev=a.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==a.Undefined;)yield e.element,e=e.next}},Ve=0,I=class{constructor(e){this.value=e,this.id=Ve++}},v=class{constructor(e){this.options=e,this._size=0}dispose(e){this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof I&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(t=>t?.value===e)):(this._listeners=void 0,this._size=0)),this.options?.onDidRemoveLastListener?.())}get event(){return this._event??=(e,t)=>{if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let r=new I(e);this._listeners?this._listeners instanceof I?this._listeners=[this._listeners,r]:this._listeners.push(r):(this.options?.onWillAddFirstListener?.(this),this._listeners=r,this.options?.onDidFirstListener?.(this)),this.options?.onDidAddListener?.(this),this._size++},this._event}_deliver(e,t){if(!e)return;let r=this.options?.onListenerError||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(n){r(n)}}fire(e){this._listeners&&(this._listeners instanceof I?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},F=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let r=this.listeners.get(e)??new v,n=o=>t(...o.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let s=this.cachedEventQueue.get(e);if(s)for(;s.size>0;)r.fire({event:e,...s.shift()})}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Be,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},M={};Oe(M,{None:()=>Ge,filter:()=>He,once:()=>se,toPromise:()=>$e});var Ge=()=>{console.log("[Jolibox SDK] None Event")};function $e(e){return new Promise(t=>se(e)(t))}function se(e){return(t,r=null)=>{let n=!1;return e(s=>{if(!n)return n=!0,t.call(r,s)},null)}}function He(e,t){return(r=>{let n,s={onWillAddFirstListener(){n=r(o.fire,o)}},o=new v(s);return o.event})((r,n=null)=>e(s=>t(s)&&r.call(n,s),null))}var K=Symbol.for("Jolibox.hostEmitter"),ze=()=>{let e=new F;return globalThis[K]||(globalThis[K]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[K]},oe=ze();function We(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Qe(e[n],t[n])}function Qe(e,t){if(j(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Me(t)){try{if(e instanceof t)return}catch{}if(!Pe(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}var A=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new v,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let s of e.metadata.args)r.push(s.constraint);let n=e.handler;e.handler=function(...s){return We(s,r),n(...s)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};A=X([Z],A);var k=class{constructor(){this._onWillExecuteCommand=new v,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new v,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new A,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Ne(3e4)),this._starActivation}async executeCommand(e,...t){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(await Promise.all([Promise.race([this._activateStar(),M.toPromise(M.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};k=X([Z],k);var P=Symbol.for("Jolibox.commands");function h(){if(globalThis[P])return globalThis[P];let e=new A,t=new k,r={registerCommand(n,s,o){e.registerCommand({id:n,handler:s,metadata:o})},executeCommand(n,...s){return t.executeCommand(n,...s)},excuteCommandSync(n,...s){return t.executeCommandThowErr(n,...s)}};return globalThis[P]=r,r}document.addEventListener("DOMContentLoaded",()=>oe.emit("onDocumentReady"));var ie=h(),B=e=>{ie.executeCommand("ReportSDK.traceSystem",{event:"global_js_error",info:{err:JSON.stringify(e)}}).catch(t=>{console.error(`Fallback report: ${t} ${JSON.stringify(e)}`)})},g=B;window.addEventListener("unhandledrejection",B.bind(void 0));window.addEventListener("error",B.bind(void 0));window.onerror=(e,t,r,n,s)=>{ie.executeCommand("ReportSDK.traceSystem",{event:"global_js_error",info:{err:JSON.stringify({message:e,source:t,lineno:r,colno:n,error:s})}}).catch(o=>{console.error(`Fallback report: ${o} ${JSON.stringify(e)}`)})};var V=e=>{let t=e.split("-")[1];t&&(e=e.replace(`-${t}`,""));let r=e.split("+")[1];r&&(e=e.replace(`+${r}`,""));let n=e.split(".").slice(0,3),[s,o,i]=[n[0]??"0",n[1]??"0",n[2]??"0"];return{major:s,minor:o,patch:i,prerelease:t,build:r}},S=e=>parseInt(V(e).major,10),b=(e,t)=>{let{major:r,minor:n,patch:s}=V(e),{major:o,minor:i,patch:l}=V(t);return r!==o?r>o?1:-1:n!==i?n>i?1:-1:s!==l?s>l?1:-1:0};var ae=h(),L=(e,t)=>{ae.executeCommand("ReportSDK.traceSystem",{event:e,info:t})},E=(e,t,r)=>{ae.executeCommand("ReportSDK.traceSystemTimeline",{event:e,duration:t,extra:r})};var le="jolibox-sdk-loadermeta",x=JSON.parse(localStorage.getItem(le)??"{}"),G=Date.now(),ce=(e,t)=>e>t&&Math.abs(e-t)/(1e3*60*60*24)>=7,me=e=>!/^(Failed to fetch version|Couldn't find the requested file)/.test(e);async function Ye(){let e="https://stg-api.jolibox.com/api/fe-configs/js-sdk/version_metadata";try{let t=await fetch(e,{method:"GET",headers:{"Content-Type":"application/json"}}),{implement_version:r,bootstrap_version:n}=await t.json(),s={...x,timestamp:G};if(n){let{bootstrap_version:o}=x;if(!(o&&b(o,n))){let i=await(await fetch($(n))).text();me(i)&&(s={...s,bootstrap_version:n,bootstrap_script:i})}}if(r){let{implement_version:o}=x;if(!(o&&b(o,r))){let i=await(await fetch(H(r))).text();me(i)&&(s={...s,implement_version:r,implement_script:i})}}localStorage.setItem(le,JSON.stringify(s))}catch(t){console.warn("Failed to fetch loader metadata: ",t)}}var de=e=>{let{currentMajorVersion:t,currentVersion:r,bootstrapUrl:n,implementUrl:s}=e;function o(){let{bootstrap_version:c,bootstrap_script:p,timestamp:d}=x;if(c&&p&&d&&!ce(G,d)&&S(c)==t&&b(c,r)>0)return{script:p,type:"localscript"};try{let m=new XMLHttpRequest;return m.open("GET",n,!1),m.send(),{script:m.responseText,type:"fetch_from_cdn"}}catch(m){g(new te(`Bootstrap module faile to fetch ${m}`))}}function i(){let c=Date.now();L("js_sdk_begin",{t:c});let{script:p,type:d}=o()??{};if(p){let m=document.createElement("script");m.type="text/javascript",m.innerHTML=p,document.head.appendChild(m),E("bootstrapModuleLoaded",Date.now()-c,{type:d})}}function l(c){(async d=>{try{let m=new Blob([d],{type:"application/javascript"}),f=URL.createObjectURL(m),Ie=await import(f);return URL.revokeObjectURL(f),Ie}catch(m){g(new y(`implement module evaluate error in h5:${m} `))}})(c)}function _(){let c=Date.now(),{implement_script:p,implement_version:d,timestamp:m}=x;if(p&&d&&m&&!ce(G,m)&&S(d)==t&&b(d,r)>0){l(p),E("implementModuleLoaded",Date.now()-c,{type:"loadscript"});return}let f=document.createElement("script");f.type="module",f.crossOrigin="anonymous",f.src=s,f.onload=()=>{E("bootstrapModuleLoaded",Date.now()-c,{type:"fetch_from_cdn"})},document.head.appendChild(f)}return()=>{try{i(),_(),Ye()}catch(c){g(new y(`module evaluate error: ${c}`))}}};var ue=(e,t)=>{let r=s=>{let o=e({path:s});if(!o)throw`module ${s} load failed ${o}`;return o};function n(s){(async i=>{try{let l=new Blob([i],{type:"application/javascript"}),_=URL.createObjectURL(l),c=await import(_);return URL.revokeObjectURL(_),c}catch(l){g(new y(`implement module evaluate error in native:${l} `))}})(s)}return()=>{try{let s=Date.now();L("js_sdk_begin",{t:s});let o=r(t.bootstrapUrl),i=document.createElement("script");i.type="text/javascript",i.innerHTML=o,document.head.appendChild(i),E("implementModuleLoaded",Date.now()-s,{type:"native"});let l=r(t.implementUrl);n(l),E("bootstrapModuleLoaded",Date.now()-s,{type:"native"})}catch(s){console.error(`native load script error: ${s}`),g(new y(`module load failed ${s}`))}}};var Xe="1.0.0",he=Xe,z=S(he),_e=window.webkit?e=>window.prompt("loadScript",JSON.stringify(e)):void 0,qe=typeof _e<"u",$=e=>`http://cdn.jsdelivr.net/npm/@jolibox/bootstrap@${e}/dist/index.js`,H=e=>`http://cdn.jsdelivr.net/npm/@jolibox/implement@${e}/dist/index.js`,pe=$(z),fe=H(z);function Ze(){qe?ue(_e,{bootstrapUrl:pe,implementUrl:fe})():de({bootstrapUrl:pe,implementUrl:fe,currentMajorVersion:z,currentVersion:he})()}Ze();var W=h();async function ge(){return await W.executeCommand("API.getSystemInfo")}function Ee(){return W.excuteCommandSync("API.getSystemInfoSync")}function ye(){return W.excuteCommandSync("API.env")}function Re(e,t){return ne.config[e]?.[t]}function ve(e,t,r){let n=Array.isArray(t)?t:t.replace(/\[(\d+)\]/g,".$1").split("."),s=e;for(let o of n)if(s&&(typeof s=="object"||Array.isArray(s)))s=s[o];else return r;return s===void 0?r:s}var be="1.0.0";function w(e){let r=ye().data?.deviceInfo?.platform;if(!r)return!1;let[n,...s]=e.split(":"),o=Re(r=="h5"?r:"native",n);if(!o)return!1;let i=o.version;return typeof i!="string"||J(be,i,"<")?!1:s.length===0?!0:Se(o,s)||Se(o.properties,s)}function Se(e,t){if(!e)return!1;let r=ve(e,t);return r?q(r)?!0:j(r)?J(be,r,">="):!1:!1}var xe=window.JoliboxRuntime;var u=class{constructor(){this.commands=h();this._emitter=new F}addEventListener(t,r){this._emitter.on(t,(...n)=>r(n[0]))}triggerEvent(t,r){this._emitter.emit(t,r)}canUse(t){return w(t)}};var et="LifecycleSDK.onReady",C=class extends u{constructor(){super()}onReady(t){let r=n=>{t.call(this,n),this.triggerEvent(et,n)};this.commands.executeCommand("LifecycleSDK.onReady",r.bind(this))}exitGame(t){this.commands.executeCommand("LifecycleSDK.exitGame",t.onBeforeExit)}onGameHide(t){this.commands.executeCommand("LifecycleSDK.onGameHide",t.bind(this))}onGameShow(t){this.commands.executeCommand("LifecycleSDK.onGameShow",t.bind(this))}};var T=class extends u{async getItem(t){return await this.commands.executeCommand("StorageSDK.getItem",t)}async setItem(t,r){if(t.length>128)return{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: length of key should be less than 128"};let n=typeof r=="string"?r:String(r);return t.length+n.length>1024?{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: length of key and value should be less than 1024"}:await this.commands.executeCommand("StorageSDK.setItem",t,r)}async removeItem(t){return this.commands.executeCommand("StorageSDK.removeItem",t)}async clear(){return this.commands.executeCommand("StorageSDK.clear")}};var D=class extends u{constructor(){super();this.init=r=>{this.commands.executeCommand("AdsSDK.init",r)};this.adConfig=r=>{this.commands.executeCommand("AdsSDK.adConfig",r)};this.adBreak=r=>{this.commands.executeCommand("AdsSDK.adBreak",r)};this.adUnit=r=>{this.commands.executeCommand("AdsSDK.adUnit",r)}}};var O=class extends u{showKeyboard(t){if(!this.canUse("keyboard.showKeyboard"))return{code:"FAILURE",message:"[Jolibox SDK] keyboard.showKeyboard is not supported in this platform"};this.commands.executeCommand("KeyboardSDK.showKeyboard",t)}updateKeyboard(t){if(!this.canUse("keyboard.updateKeyboard"))return{code:"FAILURE",message:"[Jolibox SDK] keyboard.updateKeyboard is not supported in this platform"};this.commands.executeCommand("KeyboardSDK.updateKeyboard",t)}hideKeyboard(){if(!this.canUse("keyboard.hideKeyboard"))return{code:"FAILURE",message:"[Jolibox SDK] keyboard.hideKeyboard is not supported in this platform"};this.commands.executeCommand("KeyboardSDK.hideKeyboard")}};var Q=class{constructor(){this.runtime=new xe;this.ads=new D;this.lifecycle=new C;this.storage=new T;this.keyboard=new O;this.getSystemInfo=ge.bind(this);this.getSystemInfoSync=Ee.bind(this);this.canIUse=w.bind(this)}};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,342 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
interface Window {
|
|
5
|
-
JOLIBOX_ENV: "WEB" | "IOS" | "ANDROID" | "WINDOWS" | "MACOS" | "LINUX";
|
|
6
|
-
JoliboxSDKLoader: typeof JoliboxSDKLoader;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
interface IVersionMetadata {
|
|
10
|
-
version: string;
|
|
11
|
-
syncScriptUrl?: string;
|
|
12
|
-
asyncScriptUrl?: string;
|
|
13
|
-
}
|
|
14
|
-
interface IJoliboxSDKLoaderConfig {
|
|
15
|
-
loaderMetadata?: IVersionMetadata;
|
|
16
|
-
}
|
|
17
|
-
declare class JoliboxSDKLoader {
|
|
18
|
-
loaderMetadata: IVersionMetadata;
|
|
19
|
-
constructor({ loaderMetadata }?: IJoliboxSDKLoaderConfig);
|
|
20
|
-
private get currentVersion();
|
|
21
|
-
private get defaultMetadata();
|
|
22
|
-
computeLoaderMetaData: () => IVersionMetadata;
|
|
23
|
-
loadScript: () => void;
|
|
24
|
-
fetchUpdateLoaderMetadata: (installedSDKVersion?: string, localSDKVersion?: string, env?: "WEB" | "IOS" | "ANDROID" | "WINDOWS" | "MACOS" | "LINUX") => Promise<void>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare global {
|
|
28
|
-
interface Window {
|
|
29
|
-
JoliboxAds: typeof JoliboxAds;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
interface IAdsInitParams {
|
|
33
|
-
/**
|
|
34
|
-
* (OPTIONAL) Game ID provided by Jolibox
|
|
35
|
-
*/
|
|
36
|
-
gameId?: string;
|
|
37
|
-
}
|
|
38
|
-
interface IAdConfigParams {
|
|
39
|
-
/**
|
|
40
|
-
* (OPTIONAL) Whether ads should always be preloaded before the first call to adBreak()
|
|
41
|
-
*
|
|
42
|
-
* The default value of auto leaves the decision up to the Ad Placement API. preloadAdBreaks can be set only once with adConfig(), and further values passed to preloadAdBreaks have no effect.
|
|
43
|
-
*
|
|
44
|
-
* Setting preloadAdBreaks after the first call to adBreak() has no effect.
|
|
45
|
-
*/
|
|
46
|
-
preloadAdBreaks?: "on" | "auto";
|
|
47
|
-
/**
|
|
48
|
-
* (OPTIONAL) Whether the game is currently playing sound.
|
|
49
|
-
*
|
|
50
|
-
* This call specifies whether your game is capable of sound, and whether the sound was enabled (ie unmuted) before the call to adBreak(). This helps the Ad Placement API to select the right kind of ad for your game.
|
|
51
|
-
*
|
|
52
|
-
* Call this function as soon as the sound state of your game changes, as the Ad Placement API may have to request new creatives, and this gives it the maximum amount of time to do so.
|
|
53
|
-
*
|
|
54
|
-
* The default value is sound on. So most games will need to make a call to adConfig() when they start to declare that they have sound enabled.
|
|
55
|
-
*/
|
|
56
|
-
sound?: "on" | "off";
|
|
57
|
-
/**
|
|
58
|
-
* (OPTIONAL) Called when the API has initialized and has finished preloading ads (if you requested preloading using the preloadAdBreaks above).
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
onReady?: () => void;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* PlacementInfo object passed by **adBreakDone** function
|
|
65
|
-
*/
|
|
66
|
-
interface IPlacementInfo {
|
|
67
|
-
/**
|
|
68
|
-
* the type argument passed to adBreak()
|
|
69
|
-
*/
|
|
70
|
-
breakType: string;
|
|
71
|
-
/**
|
|
72
|
-
* the name argument passed to adBreak()
|
|
73
|
-
*/
|
|
74
|
-
breakName: string;
|
|
75
|
-
breakFormat: "interstitial" | "reward";
|
|
76
|
-
/**
|
|
77
|
-
* the status of this placement and can be one of the following values:
|
|
78
|
-
*
|
|
79
|
-
* | breakStatus | Reason |
|
|
80
|
-
* | -------- | ------- |
|
|
81
|
-
* | 'notReady' | The Ad Placement API had not initialised |
|
|
82
|
-
* | 'timeout' | A placement timed out because the Ad Placement API took too long to respond |
|
|
83
|
-
* | 'invalid' | The placement was invalid and was ignored–for instance there should only be one preroll placement per page load, subsequent prerolls are failed with this status |
|
|
84
|
-
* | 'error' | There was a JavaScript error in a callback |
|
|
85
|
-
* | 'noAdPreloaded' | An ad had not been preloaded yet so this placement was skipped |
|
|
86
|
-
* | 'frequencyCapped' | An ad wasn't shown because the frequency cap was applied to this placement |
|
|
87
|
-
* | 'ignored' | The user didn't click on a reward prompt before they reached the next placement, that is showAdFn() wasn't called before the next adBreak(). |
|
|
88
|
-
* | 'other' | The ad was not shown for another reason. (e.g., The ad was still being fetched, or a previously cached ad was disposed because the screen was resized/rotated.) |
|
|
89
|
-
* | 'dismissed' | The user dismissed a rewarded ad before viewing it to completion |
|
|
90
|
-
* | 'viewed' | The ad was viewed by the user |
|
|
91
|
-
*/
|
|
92
|
-
breakStatus: "notReady" | "timeout" | "error" | "noAdPreloaded" | "frequencyCapped" | "ignored" | "other" | "dismissed" | "viewed";
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Parameter when calling adBreak
|
|
96
|
-
*/
|
|
97
|
-
type IAdBreakParams = IPrerollParams | IInterstitialsParams | IRewardParams;
|
|
98
|
-
/**
|
|
99
|
-
* Parameter when calling preroll type adBreak
|
|
100
|
-
*/
|
|
101
|
-
interface IPrerollParams {
|
|
102
|
-
/**
|
|
103
|
-
* 'preroll' before the game loads (before UI has rendered)
|
|
104
|
-
*/
|
|
105
|
-
type: "preroll";
|
|
106
|
-
/**
|
|
107
|
-
* (OPTIONAL) Always called as the last step in an adBreak(), even if there was no ad shown. Function takes as argument a placementInfo object
|
|
108
|
-
* @param placementInfo
|
|
109
|
-
* @returns
|
|
110
|
-
*/
|
|
111
|
-
adBreakDone?: (placementInfo: IPlacementInfo) => void;
|
|
112
|
-
}
|
|
113
|
-
interface IInterstitialsParams {
|
|
114
|
-
/**
|
|
115
|
-
* 'start' before the gameplay starts (after UI has rendered)
|
|
116
|
-
* 'pause' the player pauses the game
|
|
117
|
-
* 'next' player navigates to the next level
|
|
118
|
-
* 'browse' the player explores options outside of the gameplay
|
|
119
|
-
*/
|
|
120
|
-
type: "start" | "pause" | "next" | "browse";
|
|
121
|
-
/**
|
|
122
|
-
* (OPTIONAL) a name for this particular ad placement within your game. It is an internal identifier, and is not shown to the player. In future releases this identifier may be used to enable additional reporting and optimization features.
|
|
123
|
-
*
|
|
124
|
-
* We recommend you name all of your placements.
|
|
125
|
-
*/
|
|
126
|
-
name?: string;
|
|
127
|
-
/**
|
|
128
|
-
* (OPTIONAL) Called before the ad is displayed. The game should pause and mute the sound. These actions must be done synchronously. The ad will be displayed immediately after this callback finishes.
|
|
129
|
-
*
|
|
130
|
-
* @returns
|
|
131
|
-
*/
|
|
132
|
-
beforeAd?: () => void;
|
|
133
|
-
/**
|
|
134
|
-
* (OPTIONAL) Called after the ad is finished (for any reason). For rewarded ads, it is called after either adDismissed or adViewed, depending on player actions. This function should be used to resume game flow. For example, use to unmute the sound and start the next level.
|
|
135
|
-
* @returns
|
|
136
|
-
*/
|
|
137
|
-
afterAd?: () => void;
|
|
138
|
-
/**
|
|
139
|
-
* (OPTIONAL) Always called as the last step in an adBreak(), even if there was no ad shown. Function takes as argument a placementInfo object
|
|
140
|
-
*
|
|
141
|
-
* @param placementInfo
|
|
142
|
-
* @returns
|
|
143
|
-
*/
|
|
144
|
-
adBreakDone?: (placementInfo: IPlacementInfo) => void;
|
|
145
|
-
}
|
|
146
|
-
interface IRewardParams {
|
|
147
|
-
/**
|
|
148
|
-
* 'reward' a rewarded ad
|
|
149
|
-
*/
|
|
150
|
-
type: "reward";
|
|
151
|
-
/**
|
|
152
|
-
* (OPTIONAL) a name for this particular ad placement within your game. It is an internal identifier, and is not shown to the player. In future releases this identifier may be used to enable additional reporting and optimization features.
|
|
153
|
-
*
|
|
154
|
-
* We recommend you name all of your placements.
|
|
155
|
-
*/
|
|
156
|
-
name?: string;
|
|
157
|
-
/**
|
|
158
|
-
* (OPTIONAL) Called before the ad is displayed. The game should pause and mute the sound. These actions must be done synchronously. The ad will be displayed immediately after this callback finishes.
|
|
159
|
-
* @returns
|
|
160
|
-
*/
|
|
161
|
-
beforeAd?: () => void;
|
|
162
|
-
/**
|
|
163
|
-
* (OPTIONAL) Called after the ad is finished (for any reason). For rewarded ads, it is called after either adDismissed or adViewed, depending on player actions. This function should be used to resume game flow. For example, use to unmute the sound and start the next level.
|
|
164
|
-
* @returns
|
|
165
|
-
*/
|
|
166
|
-
afterAd?: () => void;
|
|
167
|
-
/**
|
|
168
|
-
* (OPTIONAL) Always called as the last step in an adBreak(), even if there was no ad shown. Function takes as argument a placementInfo object defined
|
|
169
|
-
* @param placementInfo
|
|
170
|
-
* @returns
|
|
171
|
-
*/
|
|
172
|
-
adBreakDone?: (placementInfo: IPlacementInfo) => void;
|
|
173
|
-
/**
|
|
174
|
-
* Called if a rewarded ad is available. The function should take a single argument–showAdFn() which must be called to display the rewarded ad.
|
|
175
|
-
* @param showAdFn
|
|
176
|
-
* @returns
|
|
177
|
-
*/
|
|
178
|
-
beforeReward: (showAdFn: () => void) => void;
|
|
179
|
-
/**
|
|
180
|
-
* Called only for rewarded ads when the player dismisses the ad. It is only called if the player dismisses the ad before it completes. In this case the reward should not be granted.
|
|
181
|
-
* @returns
|
|
182
|
-
*/
|
|
183
|
-
adDismissed: () => void;
|
|
184
|
-
/**
|
|
185
|
-
* Called only for rewarded ads when the player completes the ad and should be granted the reward.
|
|
186
|
-
* @returns
|
|
187
|
-
*/
|
|
188
|
-
adViewed: () => void;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Ad unit format, can be 'rectangle', 'vertical', 'horizontal'
|
|
192
|
-
*/
|
|
193
|
-
type AdUnitFormat = "rectangle" | "vertical" | "horizontal";
|
|
194
|
-
interface IAdUnitParams {
|
|
195
|
-
/**
|
|
196
|
-
* The element to attach the ad unit to, either an HTMLElement or a string selector. Should be the parent element of the ad unit (<ins> tag).
|
|
197
|
-
*/
|
|
198
|
-
el: HTMLElement | string;
|
|
199
|
-
/**
|
|
200
|
-
* (OPTIONAL) Reserved for future usage. The slot ID of the ad unit. Currently the slot ID is automatically set by the SDK.
|
|
201
|
-
*/
|
|
202
|
-
slot?: string;
|
|
203
|
-
/**
|
|
204
|
-
* (OPTIONAL) Ad format for the ad unit. Can be 'auto' or a single format or an array of formats. Default is 'auto'. If passed as an array, the array will be joined by ', ' and pass to the data-ad-format attribute.
|
|
205
|
-
*/
|
|
206
|
-
adFormat?: "auto" | AdUnitFormat | AdUnitFormat[];
|
|
207
|
-
/**
|
|
208
|
-
* (OPTIONAL) Whether the ad unit should be full width and responsive. Default is false.
|
|
209
|
-
*/
|
|
210
|
-
fullWidthResponsive?: "true" | "false";
|
|
211
|
-
/**
|
|
212
|
-
* (OPTIONAL) Custom style for the ad unit. Default is empty.
|
|
213
|
-
*/
|
|
214
|
-
style?: string;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Jolibox Ads SDK
|
|
218
|
-
*/
|
|
219
|
-
declare class JoliboxAds {
|
|
220
|
-
/**
|
|
221
|
-
* Internal constructor, should not be called directly
|
|
222
|
-
*/
|
|
223
|
-
constructor();
|
|
224
|
-
/**
|
|
225
|
-
* Init JoliboxAds. Must be called before any other ads functions.
|
|
226
|
-
* @param config
|
|
227
|
-
* @returns
|
|
228
|
-
*/
|
|
229
|
-
init: (config?: IAdsInitParams) => void;
|
|
230
|
-
/**
|
|
231
|
-
* The adConfig() call communicates the game's current configuration to the Ad Placement API. The Ad Placement API can use this to tune the way it preloads ads and to filter the kinds of ads it requests so they're suitable (eg. video ads that require sound).
|
|
232
|
-
* @param params
|
|
233
|
-
*/
|
|
234
|
-
adConfig: (params: IAdConfigParams) => void;
|
|
235
|
-
/**
|
|
236
|
-
* adBreak() is the key function for placing ads within your game. It defines an ad placement and takes an object called a placement config that specifies everything required to show an ad.
|
|
237
|
-
*
|
|
238
|
-
* The adBreak() function defines a placement where an ad could be shown. Whether an ad actually shows depends on factors such as the following:
|
|
239
|
-
*
|
|
240
|
-
* - The type of ad placement that you declared
|
|
241
|
-
* - Is this ad at the start of the game? Between levels? At a moment when the player has paused the game?
|
|
242
|
-
* - Whether a suitable ad exists for the current player
|
|
243
|
-
* - Is this ad relevant to them?
|
|
244
|
-
* - Is it consistent with their data privacy and consent settings?
|
|
245
|
-
* - The number of ads the player has seen recently
|
|
246
|
-
* - The control settings—for example, ad frequency, you've configured for this game
|
|
247
|
-
* - Either as hints in the tag, or,
|
|
248
|
-
* - Within AdSense—note that the controls available in AdSense will evolve over time.
|
|
249
|
-
*
|
|
250
|
-
* The kind of ad that shows also depends on similar factors.
|
|
251
|
-
*
|
|
252
|
-
* Note that a call to adBreak() might not show an ad at all. It simply declares a place where an ad could be shown.
|
|
253
|
-
*
|
|
254
|
-
* This is unlike traditional APIs in which your code always knows if an ad is available, and you decide within the game whether to show it. This approach of letting the Ad Placement API decide if an ad shows in a particular placement is a pattern that is sometimes referred to as "inversion of control".
|
|
255
|
-
*
|
|
256
|
-
* The reason we're transitioning our games API to this model is firstly, it shortens the code you have to write within your game. Secondly, it makes it easier to deliver policy compliant placements with a great user experience, which in turn has allowed us to deliver some of our highest performing formats to games publishers. Lastly, it more cleanly separates the process of placing ads in your game from the monetization decisions about the type and number of ads to show.
|
|
257
|
-
*
|
|
258
|
-
* We want you to be able to change your monetization settings and control the user experience without having to edit and release a new version of your game, initially by specifying hints in the tag. But in future releases, we will be able to provide controls directly in the AdSense and AdMob frontends.
|
|
259
|
-
* @param params
|
|
260
|
-
*/
|
|
261
|
-
adBreak: (params: IAdBreakParams) => void;
|
|
262
|
-
/**
|
|
263
|
-
* adUnit() is a function that creates an ad unit and attaches it to a parent element. The ad unit is a single ad placement that can be used to show ads.
|
|
264
|
-
*
|
|
265
|
-
* Currently we only provide support for creating ad units as `<ins>` tags with the class 'adsbygoogle'. This is the standard way to create ad units with Google AdSense.
|
|
266
|
-
*
|
|
267
|
-
* After calling this method, the ad unit is attached to the parent element you specify as el in the params object.
|
|
268
|
-
*
|
|
269
|
-
* By default, the client ID and channel ID are automatically set by the SDK. And the slot name is set to the position of the ad unit. You can override these values by passing the slot and channelId in the params object.
|
|
270
|
-
*
|
|
271
|
-
* @param params
|
|
272
|
-
* @returns
|
|
273
|
-
*/
|
|
274
|
-
adUnit: (params: IAdUnitParams) => Promise<void>;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
declare global {
|
|
278
|
-
interface Window {
|
|
279
|
-
JoliboxAnalytics: typeof JoliboxAnalytics;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
1
|
+
/** load implement at very first time */
|
|
282
2
|
/**
|
|
283
|
-
*
|
|
3
|
+
* global error catch
|
|
284
4
|
*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Track an event, will be sent to the analytics server
|
|
289
|
-
* Currently not open to the public
|
|
290
|
-
*
|
|
291
|
-
* @param eventName event name, must be a string
|
|
292
|
-
* @param extra (OPTIONAL) extra data, must be an object or null or undefined, must not have nested objects
|
|
293
|
-
*/
|
|
294
|
-
private trackEvent;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
declare global {
|
|
298
|
-
interface IJoliboxSDK extends JoliboxSDK {
|
|
299
|
-
_commandPipe: ICommandPipe[];
|
|
300
|
-
}
|
|
301
|
-
interface Window {
|
|
302
|
-
__JOLIBOX_LOCAL_SDK_VERSION__: string;
|
|
303
|
-
joliboxenv?: {
|
|
304
|
-
joliboxEnv: "staging" | "production";
|
|
305
|
-
testAdsMode: boolean;
|
|
306
|
-
apiBaseURL: string;
|
|
307
|
-
};
|
|
308
|
-
joliboxsdk: IJoliboxSDK;
|
|
309
|
-
JoliboxSDK: typeof JoliboxSDK;
|
|
310
|
-
}
|
|
311
|
-
interface ImportMeta {
|
|
312
|
-
env: {
|
|
313
|
-
JOLIBOX_SDK_VERSION: string;
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
}
|
|
5
|
+
import './errors';
|
|
6
|
+
import './loader';
|
|
317
7
|
/**
|
|
318
|
-
* Jolibox SDK
|
|
8
|
+
* @public Jolibox JS SDK Entry
|
|
319
9
|
*/
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
private anaytics;
|
|
335
|
-
runtime: JoliboxRuntime;
|
|
336
|
-
storage: JoliboxCloudStorage;
|
|
337
|
-
private hostToApiMap;
|
|
338
|
-
private setJoliboxEnv;
|
|
339
|
-
constructor({ useRuntimeSDK, loaderConfig, joliboxEnv, testAdsMode, apiBaseURL, }?: IJoliboxConfig);
|
|
10
|
+
import { getSystemInfo, getSystemInfoSync, canIUse } from './api';
|
|
11
|
+
import { LifecycleSDK } from './sdks/lifecycle';
|
|
12
|
+
import { StorageSDK } from './sdks/storage';
|
|
13
|
+
import { JoliboxAds } from './sdks/ads';
|
|
14
|
+
import { KeyboardSDK } from './sdks/keyboard';
|
|
15
|
+
export declare class JoliboxSDK {
|
|
16
|
+
readonly runtime: any;
|
|
17
|
+
readonly ads: JoliboxAds;
|
|
18
|
+
readonly lifecycle: LifecycleSDK;
|
|
19
|
+
readonly storage: StorageSDK;
|
|
20
|
+
readonly keyboard: KeyboardSDK;
|
|
21
|
+
getSystemInfo: typeof getSystemInfo;
|
|
22
|
+
getSystemInfoSync: typeof getSystemInfoSync;
|
|
23
|
+
canIUse: typeof canIUse;
|
|
340
24
|
}
|
|
341
|
-
|
|
342
|
-
export { type IJoliboxConfig, JoliboxSDK, JoliboxSDK as default };
|