@01tech/sportsbook-vue 0.64.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/README.md ADDED
File without changes
@@ -0,0 +1,178 @@
1
+ import * as vue from 'vue';
2
+
3
+ type SportsFramePlatformType = 'mobile' | 'tablet' | 'desktop';
4
+
5
+ type SportsFrameColorSchemeType = 'light' | 'dark';
6
+
7
+ type SportsFrameColorSchemeModalType = SportsFrameColorSchemeType | 'auto';
8
+
9
+ interface SportsFrameNotificationEventPayload {
10
+ variant: 'success' | 'info' | 'error';
11
+ title: string;
12
+ text?: string;
13
+ }
14
+
15
+ interface SportsFrameImageVariant {
16
+ url: string;
17
+ /**
18
+ * Mostly used to avoid unnecessary layout shift; in most cases, recommended to use.
19
+ */
20
+ height?: number;
21
+ width?: number;
22
+ // srcset?: [];
23
+ }
24
+
25
+ type SportsFrameCoefFormat =
26
+ | 'decimal'
27
+ | 'fractional'
28
+ | 'american'
29
+ | 'hong_kong'
30
+ | 'indonesian'
31
+ | 'malay';
32
+
33
+ interface SportsFrameNavigationModeSync {
34
+ type: 'sync';
35
+ initialPath: string;
36
+ push(path: string): Promise<void>;
37
+ replace(path: string): Promise<void>;
38
+ back(): void;
39
+ forward(): void;
40
+ }
41
+
42
+ interface SportsFrameNavigationModeAuto {
43
+ type: 'auto';
44
+ }
45
+
46
+ type SportsFrameNavigation = SportsFrameNavigationModeSync | SportsFrameNavigationModeAuto;
47
+
48
+ interface SportsFrameThemeConfig {
49
+ readonly preset?: {
50
+ readonly name: string;
51
+ readonly env?: 'prod' | 'preprod';
52
+ };
53
+ }
54
+
55
+ interface SportsFrameBonusWalletOptions {
56
+ readonly bonusId: string;
57
+ readonly amount: number;
58
+ /**
59
+ * The bonus has its own currency and does not use the system-defined currency.
60
+ */
61
+ readonly currencyCode: string;
62
+ }
63
+
64
+ interface SportsFrameGraphicsConfig {
65
+ readonly betslipEmpty?: SportsFrameImageVariant;
66
+ readonly betslipSuccess?: SportsFrameImageVariant;
67
+ readonly freebetPromoBanner?: SportsFrameImageVariant;
68
+ readonly watermarkLogo?: SportsFrameImageVariant;
69
+ }
70
+
71
+ interface SportsFrameFeaturesConfig {
72
+ readonly sharedBet?: boolean;
73
+ readonly broadcast?: boolean;
74
+ /**
75
+ * Enables the ability to switch themes within the frame.
76
+ * This is a stateless setting — you must manually subscribe to theme change events
77
+ * and update the corresponding parameter inside the frame accordingly.
78
+ */
79
+ readonly colorThemeSwitcher?: boolean;
80
+ readonly trends?: boolean;
81
+ }
82
+
83
+ interface SportsFrameAppearanceConfig {
84
+ /**
85
+ * z-index values for different floating UI elements.
86
+ * Accepts either a number or a string. The string can be a raw value (like '1000'),
87
+ * a CSS variable (e.g., 'var(--z-modal)'), or any custom value as needed.
88
+ * Used to control the stacking order of UI elements like popups, modals, and tooltips.
89
+ */
90
+ readonly index?: {
91
+ /**
92
+ * z-index for popup elements.
93
+ */
94
+ readonly popup?: number | string;
95
+
96
+ /**
97
+ * z-index for modal windows.
98
+ */
99
+ readonly modal?: number | string;
100
+
101
+ /**
102
+ * z-index for tooltip components.
103
+ */
104
+ readonly tooltip?: number | string;
105
+ };
106
+
107
+ /**
108
+ * Safe area offsets used when positioning floating elements that stick to the
109
+ * top or bottom edges of the screen. Helps ensure elements like top popups, match score board
110
+ * or bottom-fixed buttons (e.g. a betslip trigger above a tab bar)
111
+ */
112
+ readonly safeArea?: {
113
+ /**
114
+ * Safe spacing from the top edge — useful for floating elements that appear from the top.
115
+ */
116
+ readonly top?: number | string;
117
+
118
+ /**
119
+ * Safe spacing from the bottom edge — useful for sticky buttons or
120
+ * bottom-aligned elements that must avoid overlapping with the tab bar or similar UI.
121
+ */
122
+ readonly bottom?: number | string;
123
+ };
124
+ }
125
+
126
+ interface SportsFrameInitOptions {
127
+ /**
128
+ * Api Url
129
+ */
130
+ baseUrl: string;
131
+ navigation?: SportsFrameNavigation;
132
+ apiUrl: string;
133
+ cdnUrl?: string;
134
+ partnerId: string;
135
+ token?: string;
136
+ authed: boolean;
137
+ languageCode?: string;
138
+ rtl?: boolean;
139
+ currencyCode?: string;
140
+ balanceAmount?: number;
141
+ bonusWallet?: SportsFrameBonusWalletOptions;
142
+ platform: SportsFramePlatformType;
143
+ colorScheme?: SportsFrameColorSchemeType;
144
+ colorSchemeModal?: SportsFrameColorSchemeModalType;
145
+ theme?: SportsFrameThemeConfig;
146
+ inert?: boolean;
147
+ appearance?: SportsFrameAppearanceConfig;
148
+ features?: SportsFrameFeaturesConfig;
149
+ graphics?: SportsFrameGraphicsConfig;
150
+ shareLinkBehavior?: 'native' | 'manual' | 'hidden';
151
+ defaultCoefFormat?: SportsFrameCoefFormat;
152
+ }
153
+
154
+ declare const _default: vue.DefineComponent<SportsFrameInitOptions, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
155
+ ready: () => any;
156
+ login: () => any;
157
+ renewToken: () => any;
158
+ notify: (options: SportsFrameNotificationEventPayload) => any;
159
+ changeModalState: (options: {
160
+ opened: boolean;
161
+ }) => any;
162
+ topUpBalance: () => any;
163
+ changeColorScheme: (options: "light" | "dark") => any;
164
+ shareLink: (options: string) => any;
165
+ }, string, vue.PublicProps, Readonly<SportsFrameInitOptions> & Readonly<{
166
+ onReady?: (() => any) | undefined;
167
+ onLogin?: (() => any) | undefined;
168
+ onRenewToken?: (() => any) | undefined;
169
+ onNotify?: ((options: SportsFrameNotificationEventPayload) => any) | undefined;
170
+ onChangeModalState?: ((options: {
171
+ opened: boolean;
172
+ }) => any) | undefined;
173
+ onTopUpBalance?: (() => any) | undefined;
174
+ onChangeColorScheme?: ((options: "light" | "dark") => any) | undefined;
175
+ onShareLink?: ((options: string) => any) | undefined;
176
+ }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
177
+
178
+ export { _default as SportsbookFrame };
package/dist/index.js ADDED
@@ -0,0 +1,192 @@
1
+ import { watch as s, nextTick as f, shallowRef as h, getCurrentInstance as v, onMounted as k, defineComponent as y, useTemplateRef as b, effectScope as g, ref as S, computed as U, onScopeDispose as C, createElementBlock as w, openBlock as L } from "vue";
2
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
3
+ function E(a, n, e) {
4
+ const r = s(a, (l, i, c) => {
5
+ l && (e?.once && f(() => r()), n(l, i, c));
6
+ }, {
7
+ ...e,
8
+ once: !1
9
+ });
10
+ return r;
11
+ }
12
+ // @__NO_SIDE_EFFECTS__
13
+ function B() {
14
+ const a = h(!1), n = v();
15
+ return n && k(() => {
16
+ a.value = !0;
17
+ }, n), a;
18
+ }
19
+ async function _(a) {
20
+ const n = `${a.cdnUrl}/manifest/v1/stable/sportsbook/manifest.json`, e = await fetch(n);
21
+ if (!e.ok)
22
+ throw new Error(`Failed to fetch manifest: ${e.status} ${e.statusText}`);
23
+ return await e.json();
24
+ }
25
+ const A = "1.0.0-rc.1", F = "https://01-sports-frame-cdn.com";
26
+ async function M(a, n) {
27
+ return {
28
+ createSportsbookFrame: (await import(
29
+ /* @vite-ignore */
30
+ `${a}/sportsbook/v1/core/v/${n}/esm/entry.js`
31
+ )).createSportsbookFrame
32
+ };
33
+ }
34
+ async function T(a) {
35
+ const n = a, { cdnUrl: e = F } = n;
36
+ let r;
37
+ try {
38
+ r = (await _({
39
+ cdnUrl: e,
40
+ stage: "stable"
41
+ })).v1.main.version;
42
+ } catch (c) {
43
+ throw console.error("Error loading manifest:", c), c;
44
+ }
45
+ console.log("Version:", r);
46
+ const l = `${e}/sportsbook/v1/core/v/${r}/esm/style.css`, i = await M(e, r);
47
+ return {
48
+ createApp: (c) => {
49
+ const d = c;
50
+ return i.createSportsbookFrame({
51
+ ...d,
52
+ // TODO: add path resolver
53
+ assetsUrl: d.cdnUrl + "/sportsbook/v1/static/",
54
+ cdnUrl: d.cdnUrl ?? e,
55
+ __sdk: {
56
+ stage: "stable",
57
+ version: A,
58
+ cssStyleUrl: l
59
+ }
60
+ });
61
+ }
62
+ };
63
+ }
64
+ const W = ["dir"], x = /* @__PURE__ */ y({
65
+ inheritAttrs: !1,
66
+ __name: "SportsbookFrame",
67
+ props: {
68
+ baseUrl: {},
69
+ navigation: {},
70
+ apiUrl: {},
71
+ cdnUrl: {},
72
+ partnerId: {},
73
+ token: {},
74
+ authed: { type: Boolean },
75
+ languageCode: {},
76
+ rtl: { type: Boolean },
77
+ currencyCode: {},
78
+ balanceAmount: {},
79
+ bonusWallet: {},
80
+ platform: {},
81
+ colorScheme: {},
82
+ colorSchemeModal: {},
83
+ theme: {},
84
+ inert: { type: Boolean },
85
+ appearance: {},
86
+ features: {},
87
+ graphics: {},
88
+ shareLinkBehavior: {},
89
+ defaultCoefFormat: {}
90
+ },
91
+ emits: ["ready", "login", "renewToken", "notify", "changeModalState", "topUpBalance", "changeColorScheme", "shareLink"],
92
+ setup(a, { emit: n }) {
93
+ const e = a, r = n, l = b("el"), i = g(), c = /* @__PURE__ */ B(), d = S(!1), p = U(() => e.rtl ? "rtl" : "ltr");
94
+ let u;
95
+ return C(() => {
96
+ u?.destroy();
97
+ }), i.run(async () => {
98
+ const o = (await T({ cdnUrl: e.cdnUrl })).createApp({
99
+ // assetsUrl: props.assetUrl,
100
+ baseUrl: e.baseUrl,
101
+ navigation: { type: "auto" },
102
+ partnerId: e.partnerId ?? "",
103
+ apiUrl: e.apiUrl,
104
+ cdnUrl: e.cdnUrl ?? "",
105
+ token: e.token ?? "",
106
+ authed: e.authed ?? !1,
107
+ balanceAmount: e.balanceAmount,
108
+ bonusWallet: e.bonusWallet,
109
+ languageCode: e.languageCode,
110
+ rtl: e.rtl,
111
+ currencyCode: e.currencyCode,
112
+ platform: e.platform,
113
+ colorScheme: e.colorScheme,
114
+ // colorSchemeModal: props.modalColorScheme,
115
+ theme: e.theme,
116
+ appearance: e.appearance,
117
+ features: e.features,
118
+ shareLinkBehavior: e.shareLinkBehavior,
119
+ defaultCoefFormat: e.defaultCoefFormat
120
+ // _experiments: props.experiments,
121
+ // _debug: props.debug,
122
+ // _contentResourcesPrefix: props.contentResourcesPrefix,
123
+ // _trackEvent(payload) {
124
+ // emit('trackEvent', payload);
125
+ // },
126
+ });
127
+ o.addEventListener("ready", () => {
128
+ d.value = !0;
129
+ }), u = o, o.addEventListener("shareLink", (t) => {
130
+ r("shareLink", t);
131
+ }), o.addEventListener("ready", () => {
132
+ d.value = !0, r("ready");
133
+ }), o.addEventListener("login", () => {
134
+ r("login");
135
+ }), o.addEventListener("deposit", () => {
136
+ r("topUpBalance");
137
+ }), o.addEventListener("notify", (t) => {
138
+ r("notify", t);
139
+ }), o.addEventListener("renewToken", () => {
140
+ r("renewToken");
141
+ }), o.addEventListener("setModalState", ({ opened: t }) => {
142
+ r("changeModalState", { opened: t });
143
+ }), o.addEventListener("setColorScheme", (t) => {
144
+ r("changeColorScheme", t);
145
+ }), s(
146
+ () => e.languageCode,
147
+ (t) => o.setLanguageCode(t)
148
+ ), s(
149
+ () => e.rtl,
150
+ (t) => o.setRtl(t)
151
+ ), s(
152
+ () => e.platform,
153
+ (t) => o.setPlatform(t)
154
+ ), s(
155
+ () => e.token,
156
+ (t) => o.setToken(t)
157
+ ), s(
158
+ () => e.authed,
159
+ (t) => o.setAuthed(t)
160
+ ), s(
161
+ () => e.colorScheme,
162
+ (t) => o.setColorScheme(t ?? "dark")
163
+ ), s(
164
+ () => e.currencyCode,
165
+ (t) => o.setCurrencyCode(t)
166
+ ), s(
167
+ () => e.balanceAmount,
168
+ (t) => o.setBalanceAmount(t)
169
+ ), s(
170
+ () => e.bonusWallet,
171
+ (t) => o.setBonusWallet(t)
172
+ );
173
+ }), E(
174
+ () => c.value && d.value,
175
+ () => {
176
+ if (!l.value || !u)
177
+ throw new Error("unexpected error");
178
+ u.mount(l.value);
179
+ },
180
+ { once: !0 }
181
+ ), (m, o) => (L(), w("div", {
182
+ id: "sport-frame",
183
+ ref_key: "el",
184
+ ref: l,
185
+ dir: p.value,
186
+ "data-sport-frame": ""
187
+ }, null, 8, W));
188
+ }
189
+ });
190
+ export {
191
+ x as SportsbookFrame
192
+ };
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@01tech/sportsbook-vue",
3
+ "private": false,
4
+ "version": "0.64.0",
5
+ "publishConfig": { "access": "public" },
6
+ "scripts": {
7
+ "sdk:build:prepare": "rm -rf ./dist",
8
+ "dts-compile": "vue-tsc --project ./tsconfig.dts.json",
9
+ "dts-resolve": "rollup -c rollup.dts.config.mjs",
10
+ "sdk:build:dts": "npm run dts-compile && npm run dts-resolve",
11
+ "sdk:build:js": "NODE_ENV=production vite build --config vite.config.ts",
12
+ "sdk:build": "npm run sdk:build:prepare && npm run sdk:build:dts && npm run sdk:build:js",
13
+ "sdk:dev": "NODE_ENV=development vite build --watch --config vite.config.ts"
14
+ },
15
+ "devDependencies": {
16
+ "@01tech/sportsbook-web": "*"
17
+ },
18
+ "peerDependencies": {
19
+ "vue": "^3.5.13",
20
+ "vue-router": "~4.5.1"
21
+ },
22
+ "peerDependenciesMeta": {
23
+ "vue-router": {
24
+ "optional": true
25
+ }
26
+ },
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ }
32
+ }
33
+ }