@01tech/sportsbook-vue 0.71.0 → 1.0.0-rc.2

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +430 -106
  2. package/dist/index.js +178 -111
  3. package/package.json +11 -22
package/dist/index.d.ts CHANGED
@@ -1,16 +1,284 @@
1
1
  import * as vue from 'vue';
2
+ import { ComputedRef } from 'vue';
2
3
 
3
- type SportsbookPlatformType = 'mobile' | 'tablet' | 'desktop';
4
+ type SportsbookDeviceType$1 = 'mobile' | 'tablet' | 'desktop';
5
+ type SportsbookColorScheme$1 = 'light' | 'dark';
6
+ type SportsbookSportsCoefFormat$1 = 'decimal' | 'fractional' | 'american' | 'hong_kong' | 'indonesian' | 'malay';
7
+ type SportsbookNotificationMessage$1 = {
8
+ variant: 'success' | 'info' | 'error';
9
+ title: string;
10
+ text?: string;
11
+ };
4
12
 
5
- type SportsbookColorScheme = 'light' | 'dark';
13
+ type SportsbookNavigationModeManual$1 = {
14
+ type: 'manual';
15
+ initialPath: string;
16
+ push(path: string): Promise<void>;
17
+ replace(path: string): Promise<void>;
18
+ back(): void;
19
+ forward(): void;
20
+ };
21
+ type SportsbookNavigationModeHistory$1 = {
22
+ type: 'web-history';
23
+ };
24
+ type SportsbookNavigationModeMemory$1 = {
25
+ type: 'memory';
26
+ initialPath?: string;
27
+ };
28
+ type SportsbookNavigation$1 = SportsbookNavigationModeManual$1 | SportsbookNavigationModeHistory$1 | SportsbookNavigationModeMemory$1;
6
29
 
7
- type SportsbookNotificationPayload = {
8
- variant: 'success' | 'info' | 'error';
9
- title: string;
10
- text?: string;
30
+ type SportsbookAppearance$1 = {
31
+ /**
32
+ * z-index values for different floating UI elements.
33
+ * Accepts either a number or a string. The string can be a raw value (like '1000'),
34
+ * a CSS variable (e.g., 'var(--z-modal)'), or any custom value as needed.
35
+ * Used to control the stacking order of UI elements like popups, modals, and tooltips.
36
+ */
37
+ readonly index?: {
38
+ /**
39
+ * z-index for popup elements.
40
+ */
41
+ readonly popup?: number | string;
42
+ /**
43
+ * z-index for modal windows.
44
+ */
45
+ readonly modal?: number | string;
46
+ /**
47
+ * z-index for tooltip components.
48
+ */
49
+ readonly tooltip?: number | string;
50
+ };
51
+ /**
52
+ * Defines custom spacing between floating elements and the edges of `floatSafeArea`.
53
+ * Use this to fine-tune how close floating UI elements can get to the safe area boundaries.
54
+ */
55
+ readonly floatOffset?: {
56
+ /**
57
+ * Additional spacing from the `floatSafeArea.top` boundary.
58
+ *
59
+ * @default 8
60
+ */
61
+ readonly top?: number | string;
62
+ /**
63
+ * Additional spacing from the `floatSafeArea.bottom` boundary.
64
+ *
65
+ * @default 8
66
+ */
67
+ readonly bottom?: number | string;
68
+ };
69
+ /**
70
+ * Defines the safe area boundaries for floating elements within the sportsbook.
71
+ * Does not stack with `safeAreaInset` — overrides it instead. Inherits from `safeAreaInset` by default.
72
+ *
73
+ * Useful when your application has fixed or sticky UI elements (e.g. a header or tab bar)
74
+ * that would otherwise overlap floating sportsbook elements.
75
+ */
76
+ readonly floatSafeArea?: {
77
+ /**
78
+ * Distance from the top edge of the viewport.
79
+ * Set this to the height of a fixed header to prevent floating elements from appearing behind it.
80
+ */
81
+ readonly top?: number | string;
82
+ /**
83
+ * Distance from the bottom edge of the viewport.
84
+ * Set this to the height of a sticky tab bar or bottom navigation to prevent overlap.
85
+ */
86
+ readonly bottom?: number | string;
87
+ };
88
+ /**
89
+ * Overrides the safe area inset values used for content layout.
90
+ *
91
+ * In most cases you do not need to set this — the sportsbook automatically reads the browser's
92
+ * built-in environment variables (`env(safe-area-inset-*)`) as defined in the CSS spec:
93
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/env
94
+ *
95
+ * This is intended for custom WebView environments that do not expose standard safe area env
96
+ * variables — for example, mini-apps or embedded WebViews.
97
+ *
98
+ * @draft
99
+ * @experimental
100
+ */
101
+ readonly safeAreaInset?: {
102
+ /**
103
+ * Overrides the top safe area inset (replaces `env(safe-area-inset-top)`).
104
+ */
105
+ readonly top?: number | string;
106
+ /**
107
+ * Overrides the bottom safe area inset (replaces `env(safe-area-inset-bottom)`).
108
+ */
109
+ readonly bottom?: number | string;
110
+ };
111
+ /**
112
+ * will be removed in v1.4.0
113
+ * @deprecated use `appearance.floatOffset` and `appearance.safeAreaInset`
114
+ */
115
+ readonly safeArea?: {
116
+ readonly top?: number | string;
117
+ readonly bottom?: number | string;
118
+ };
119
+ };
120
+
121
+ type SportsbookTheme$1 = {
122
+ readonly preset?: {
123
+ readonly name: string;
124
+ readonly env?: 'prod' | 'preprod';
125
+ };
126
+ };
127
+
128
+ type OnNavigateEventPayload$1 = {
129
+ fullPath: string;
130
+ };
131
+ type OnSendNotificationPayload$1 = SportsbookNotificationMessage$1;
132
+
133
+ type SportsbookFeatures$1 = {
134
+ /**
135
+ * @default true
136
+ */
137
+ sharedBet?: boolean;
138
+ /**
139
+ * @default true
140
+ */
141
+ broadcast?: boolean;
142
+ /**
143
+ * @deprecated
144
+ * @default true
145
+ */
146
+ expressBonus?: boolean;
147
+ };
148
+ /**
149
+ * TODO: rename to SportsbookInitConfigPublic
150
+ */
151
+ type SportsbookInitConfig$1$1 = {
152
+ /**
153
+ * The base path relative to which the sportsbook is rendered. This will be used for navigating and generating promo links.
154
+ */
155
+ readonly baseUrl?: string;
156
+ readonly apiUrl: string;
157
+ readonly cdnUrl?: string;
158
+ readonly partnerId: string;
159
+ /**
160
+ * @default '01tech_sportsbook'
161
+ */
162
+ readonly storagePrefix?: string;
163
+ features?: SportsbookFeatures$1;
164
+ token?: string;
165
+ authed?: boolean;
166
+ languageCode?: string;
167
+ countryCode?: string;
168
+ rtl?: boolean;
169
+ currencyCode?: string;
170
+ balanceAmount?: number;
171
+ platform: SportsbookDeviceType$1;
172
+ colorScheme?: SportsbookColorScheme$1;
173
+ /**
174
+ * Attribute indicating that the sportsbook are not interactive.
175
+ *
176
+ * @default false
177
+ */
178
+ inert?: boolean;
179
+ /**
180
+ * Default sports coefficient format
181
+ *
182
+ * @default 'decimal'
183
+ */
184
+ readonly defaultCoefFormat?: SportsbookSportsCoefFormat$1;
185
+ /**
186
+ * @default false
187
+ */
188
+ readonly production?: boolean;
189
+ navigation?: SportsbookNavigation$1;
190
+ theme?: SportsbookTheme$1;
191
+ appearance?: SportsbookAppearance$1;
192
+ readonly onReady?: () => void;
193
+ readonly onError?: (err?: Error) => void;
194
+ readonly onLogin?: (place?: string) => void;
195
+ readonly onDeposit?: () => void;
196
+ readonly onRenewToken?: () => void;
197
+ readonly onNavigate?: (payload?: OnNavigateEventPayload$1) => void;
198
+ readonly onSendNotification?: (payload: OnSendNotificationPayload$1) => void;
199
+ };
200
+
201
+ type IsEqual<A, B> = (<G>() => G extends (A & G) | G ? 1 : 2) extends <G>() => G extends (B & G) | G ? 1 : 2 ? true : false;
202
+ type WritableKeysOf<T> = T extends unknown ? keyof {
203
+ [P in keyof T as IsEqual<{
204
+ [Q in P]: T[P];
205
+ }, {
206
+ readonly [Q in P]: T[P];
207
+ }> extends false ? P : never]: never;
208
+ } & keyof T : never;
209
+
210
+ type SportsbookAppWithUpdate<TConfig> = {
211
+ update: <TKey extends WritableKeysOf<TConfig>>(key: TKey, value: TConfig[TKey]) => void;
212
+ getWritable?: (this: unknown) => WritableKeysOf<TConfig>[];
213
+ };
214
+ interface SportsbookAppBase<TInitialConfig> extends SportsbookAppWithUpdate<TInitialConfig> {
215
+ mount(el: HTMLElement): void;
216
+ destroy(): void;
217
+ navigateTo(path: string, type?: 'push' | 'replace'): void;
218
+ /**
219
+ * @deprecated. use client.update('token', value)
220
+ */
221
+ setToken(token: string | undefined): void;
222
+ /**
223
+ * @deprecated. use client.update('platform', value)
224
+ */
225
+ setPlatform(platform: SportsbookDeviceType$1): void;
226
+ /**
227
+ * @deprecated. use client.update('languageCode', value)
228
+ */
229
+ setLanguageCode(languageCode: string | undefined): void;
230
+ /**
231
+ * @deprecated. use client.update('rtl', value)
232
+ */
233
+ setRtl(rtl: boolean | undefined): void;
234
+ /**
235
+ * @deprecated. use client.update('colorScheme', value)
236
+ */
237
+ setColorScheme(colorScheme: SportsbookColorScheme$1): void;
238
+ /**
239
+ * @deprecated. use client.update('authed', value)
240
+ */
241
+ setAuthed(authed: boolean): void;
242
+ /**
243
+ * @deprecated. use client.update('inert', value)
244
+ */
245
+ setInert(inert: boolean): void;
246
+ /**
247
+ * @deprecated. use client.update('currencyCode', value)
248
+ */
249
+ setCurrencyCode(currencyCode: string | undefined): void;
250
+ /**
251
+ * @deprecated. use client.update('balanceAmount', value)
252
+ */
253
+ setBalanceAmount(balance: number | undefined): void;
254
+ /**
255
+ * @deprecated. use client.update('countryCode', value)
256
+ */
257
+ setCountryCode(path: string, type?: 'push' | 'replace'): void;
258
+ /**
259
+ * @deprecated. use client.update('appearance', value)
260
+ */
261
+ setAppearance(appearance: SportsbookAppearance$1 | undefined): void;
262
+ }
263
+
264
+ type SportsbookInitConfig$2 = SportsbookInitConfig$1$1;
265
+ type SportsbookApp = SportsbookAppBase<SportsbookInitConfig$2>;
266
+
267
+ declare const SDK_VERSION: string;
268
+
269
+ declare const SPORTSBOOK_APP_ROUTES: {
270
+ readonly home: "/";
271
+ readonly live: "/live";
272
+ readonly prematch: "/prematch";
273
+ readonly esport: "/esport";
274
+ readonly history: "/bets-history";
11
275
  };
12
276
 
13
- type SportsbookCoefFormat =
277
+ type SportsbookDeviceType = 'mobile' | 'tablet' | 'desktop';
278
+
279
+ type SportsbookColorScheme = 'light' | 'dark';
280
+
281
+ type SportsbookSportsCoefFormat =
14
282
  | 'decimal'
15
283
  | 'fractional'
16
284
  | 'american'
@@ -18,14 +286,20 @@ type SportsbookCoefFormat =
18
286
  | 'indonesian'
19
287
  | 'malay';
20
288
 
21
- interface SportsbookNavigationModeManual {
289
+ type SportsbookNotificationMessage = {
290
+ variant: 'success' | 'info' | 'error';
291
+ title: string;
292
+ text?: string;
293
+ };
294
+
295
+ type SportsbookNavigationModeManual = {
22
296
  type: 'manual';
23
297
  initialPath: string;
24
298
  push(path: string): Promise<void>;
25
299
  replace(path: string): Promise<void>;
26
300
  back(): void;
27
301
  forward(): void;
28
- }
302
+ };
29
303
 
30
304
  type SportsbookNavigationModeHistory = {
31
305
  type: 'web-history';
@@ -41,39 +315,6 @@ type SportsbookNavigation =
41
315
  | SportsbookNavigationModeHistory
42
316
  | SportsbookNavigationModeMemory;
43
317
 
44
- type SportsbookFeatures = {
45
- /**
46
- * @default true
47
- */
48
- readonly sharedBet?: boolean;
49
- /**
50
- * @default true
51
- */
52
- readonly broadcast?: boolean;
53
- /**
54
- * @deprecated
55
- * @default true
56
- */
57
- readonly expressBonus?: boolean;
58
- };
59
-
60
- type OnNavigateEventPayload = {
61
- fullPath: string;
62
- };
63
-
64
- /**
65
- * @public
66
- */
67
- type SportsbookThemeConfig = {
68
- readonly preset?: {
69
- readonly name: string;
70
- readonly env?: 'prod' | 'preprod';
71
- };
72
- };
73
-
74
- /**
75
- * @public
76
- */
77
318
  type SportsbookAppearance = {
78
319
  /**
79
320
  * z-index values for different floating UI elements.
@@ -99,36 +340,126 @@ type SportsbookAppearance = {
99
340
  };
100
341
 
101
342
  /**
102
- * Safe area offsets used when positioning floating elements that stick to the
103
- * top or bottom edges of the screen. Helps ensure elements like top popups, match score board
104
- * or bottom-fixed buttons (e.g. a betslip trigger above a tab bar)
343
+ * Defines custom spacing between floating elements and the edges of `floatSafeArea`.
344
+ * Use this to fine-tune how close floating UI elements can get to the safe area boundaries.
105
345
  */
106
- readonly safeArea?: {
346
+ readonly floatOffset?: {
107
347
  /**
108
- * Safe spacing from the top edge — useful for floating elements that appear from the top.
348
+ * Additional spacing from the `floatSafeArea.top` boundary.
349
+ *
350
+ * @default 8
109
351
  */
110
352
  readonly top?: number | string;
111
353
 
112
354
  /**
113
- * Safe spacing from the bottom edge — useful for sticky buttons or
114
- * bottom-aligned elements that must avoid overlapping with the tab bar or similar UI.
355
+ * Additional spacing from the `floatSafeArea.bottom` boundary.
356
+ *
357
+ * @default 8
115
358
  */
116
359
  readonly bottom?: number | string;
117
360
  };
361
+
362
+ /**
363
+ * Defines the safe area boundaries for floating elements within the sportsbook.
364
+ * Does not stack with `safeAreaInset` — overrides it instead. Inherits from `safeAreaInset` by default.
365
+ *
366
+ * Useful when your application has fixed or sticky UI elements (e.g. a header or tab bar)
367
+ * that would otherwise overlap floating sportsbook elements.
368
+ */
369
+ readonly floatSafeArea?: {
370
+ /**
371
+ * Distance from the top edge of the viewport.
372
+ * Set this to the height of a fixed header to prevent floating elements from appearing behind it.
373
+ */
374
+ readonly top?: number | string;
375
+
376
+ /**
377
+ * Distance from the bottom edge of the viewport.
378
+ * Set this to the height of a sticky tab bar or bottom navigation to prevent overlap.
379
+ */
380
+ readonly bottom?: number | string;
381
+ };
382
+
383
+ /**
384
+ * Overrides the safe area inset values used for content layout.
385
+ *
386
+ * In most cases you do not need to set this — the sportsbook automatically reads the browser's
387
+ * built-in environment variables (`env(safe-area-inset-*)`) as defined in the CSS spec:
388
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/env
389
+ *
390
+ * This is intended for custom WebView environments that do not expose standard safe area env
391
+ * variables — for example, mini-apps or embedded WebViews.
392
+ *
393
+ * @draft
394
+ * @experimental
395
+ */
396
+ readonly safeAreaInset?: {
397
+ /**
398
+ * Overrides the top safe area inset (replaces `env(safe-area-inset-top)`).
399
+ */
400
+ readonly top?: number | string;
401
+
402
+ /**
403
+ * Overrides the bottom safe area inset (replaces `env(safe-area-inset-bottom)`).
404
+ */
405
+ readonly bottom?: number | string;
406
+ };
407
+
408
+ /**
409
+ * will be removed in v1.4.0
410
+ * @deprecated use `appearance.floatOffset` and `appearance.safeAreaInset`
411
+ */
412
+ readonly safeArea?: {
413
+ readonly top?: number | string;
414
+ readonly bottom?: number | string;
415
+ };
416
+ };
417
+
418
+ type SportsbookTheme = {
419
+ readonly preset?: {
420
+ readonly name: string;
421
+ readonly env?: 'prod' | 'preprod';
422
+ };
423
+ };
424
+
425
+ type OnNavigateEventPayload = {
426
+ fullPath: string;
427
+ };
428
+
429
+ type OnSendNotificationPayload = SportsbookNotificationMessage;
430
+
431
+ type SportsbookFeatures = {
432
+ /**
433
+ * @default true
434
+ */
435
+ sharedBet?: boolean;
436
+ /**
437
+ * @default true
438
+ */
439
+ broadcast?: boolean;
440
+ /**
441
+ * @deprecated
442
+ * @default true
443
+ */
444
+ expressBonus?: boolean;
118
445
  };
119
446
 
120
447
  /**
121
- * @public
448
+ * TODO: rename to SportsbookInitConfigPublic
122
449
  */
123
- type SportsbookInitOptions = {
450
+ type SportsbookInitConfig$1 = {
124
451
  /**
125
452
  * The base path relative to which the sportsbook is rendered. This will be used for navigating and generating promo links.
126
453
  */
127
- baseUrl?: string;
128
- navigation?: SportsbookNavigation;
129
- apiUrl: string;
130
- cdnUrl?: string;
131
- partnerId: string;
454
+ readonly baseUrl?: string;
455
+ readonly apiUrl: string;
456
+ readonly cdnUrl?: string; // TODO: setup fallbacks and update to string[]
457
+ readonly partnerId: string;
458
+ /**
459
+ * @default '01tech_sportsbook'
460
+ */
461
+ readonly storagePrefix?: string;
462
+ features?: SportsbookFeatures;
132
463
  token?: string;
133
464
  authed?: boolean;
134
465
  languageCode?: string;
@@ -136,69 +467,62 @@ type SportsbookInitOptions = {
136
467
  rtl?: boolean;
137
468
  currencyCode?: string;
138
469
  balanceAmount?: number;
139
- platform: SportsbookPlatformType;
470
+ platform: SportsbookDeviceType;
140
471
  colorScheme?: SportsbookColorScheme;
141
- theme?: SportsbookThemeConfig;
142
472
  /**
473
+ * Attribute indicating that the sportsbook are not interactive.
474
+ *
143
475
  * @default false
144
476
  */
145
477
  inert?: boolean;
146
- appearance?: SportsbookAppearance;
147
478
  /**
479
+ * Default sports coefficient format
480
+ *
148
481
  * @default 'decimal'
149
482
  */
150
- defaultCoefFormat?: SportsbookCoefFormat;
483
+ readonly defaultCoefFormat?: SportsbookSportsCoefFormat;
151
484
  /**
152
485
  * @default false
153
486
  */
154
- production?: boolean;
155
- /**
156
- * @default '01tech-sportsbook'
157
- */
158
- localStoragePrefix?: string;
159
- features?: SportsbookFeatures;
487
+ readonly production?: boolean;
488
+ navigation?: SportsbookNavigation;
489
+ theme?: SportsbookTheme;
490
+ appearance?: SportsbookAppearance;
491
+
160
492
  // handlers
161
- onReady?: () => void;
162
- onError?: (err?: Error) => void;
163
- onLogin?: (place?: 'bets' | 'wheel' | undefined) => void;
164
- onDeposit?: () => void;
165
- onRenewToken?: () => void;
166
- onNavigate?: (options?: OnNavigateEventPayload) => void;
167
- onSendNotification?: (payload: SportsbookNotificationPayload) => void;
168
- };
169
-
170
- interface SportsbookBonusWalletOptions {
171
- readonly bonusId: string;
172
- readonly amount: number;
173
- /**
174
- * The bonus has its own currency and does not use the system-defined currency.
175
- */
176
- readonly currencyCode: string;
177
- }
178
493
 
179
- /**
180
- * @public
181
- */
182
- interface SportsbookApp {
183
- mount(el: HTMLElement): void;
184
- destroy(): void;
185
- setToken(token: string | undefined): void;
186
- setPlatform(platform: SportsbookPlatformType): void;
187
- setLanguageCode(languageCode: string | undefined): void;
188
- setRtl(rtl: boolean | undefined): void;
189
- setColorScheme(colorScheme: SportsbookColorScheme): void;
190
- setAuthed(authed: boolean): void;
191
- setInert(inert: boolean): void;
192
- setCurrencyCode(currencyCode: string | undefined): void;
193
- setBalanceAmount(balance: number | undefined): void;
194
- setCountryCode(path: string, type?: 'push' | 'replace'): void;
195
- setBonusWallet(wallet: SportsbookBonusWalletOptions | undefined): void;
196
- setAppearance(appearance: SportsbookAppearance | undefined): void;
197
- navigateTo(path: string, type?: 'push' | 'replace'): void;
198
- }
494
+ readonly onReady?: () => void;
495
+ readonly onError?: (err?: Error) => void;
496
+ readonly onLogin?: (place?: string) => void;
497
+ readonly onDeposit?: () => void;
498
+ readonly onRenewToken?: () => void;
499
+ readonly onNavigate?: (payload?: OnNavigateEventPayload) => void;
500
+ readonly onSendNotification?: (payload: OnSendNotificationPayload) => void;
501
+ };
502
+
503
+ type SportsbookInitConfig = SportsbookInitConfig$1;
504
+
505
+ type VueSdkSportsbookNavigationModeHistory = SportsbookNavigationModeHistory;
506
+ type VueSdkSportsbookNavigationModeMemory = SportsbookNavigationModeMemory;
507
+ type VueSdkSportsbookNavigationModeManual = {
508
+ type: 'manual';
509
+ path: ComputedRef<string>;
510
+ push(path: string): Promise<void>;
511
+ replace(path: string): Promise<void>;
512
+ back(): void;
513
+ forward(): void;
514
+ };
515
+ type VueSdkSportsbookNavigation = VueSdkSportsbookNavigationModeManual | VueSdkSportsbookNavigationModeHistory | VueSdkSportsbookNavigationModeMemory;
516
+
517
+ type SportsbookProps = Omit<SportsbookInitConfig, 'navigation'> & {
518
+ navigation?: VueSdkSportsbookNavigation;
519
+ __override?: Record<string, unknown>;
520
+ };
199
521
 
200
- declare const _default: vue.DefineComponent<SportsbookInitOptions, {
522
+ declare const __VLS_export: vue.DefineComponent<SportsbookProps, {
201
523
  app: Readonly<vue.Ref<vue.ShallowRef<SportsbookApp | undefined, SportsbookApp | undefined>, vue.ShallowRef<SportsbookApp | undefined, SportsbookApp | undefined>>>;
202
- }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<SportsbookInitOptions> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
524
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<SportsbookProps> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
525
+ declare const _default: typeof __VLS_export;
203
526
 
204
- export { _default as SportsbookFrame };
527
+ export { SDK_VERSION, SPORTSBOOK_APP_ROUTES, _default as SportsbookFrame };
528
+ export type { SportsbookApp, SportsbookInitConfig$2 as SportsbookInitConfig };
package/dist/index.js CHANGED
@@ -1,89 +1,178 @@
1
- import { watch as s, nextTick as h, shallowRef as d, getCurrentInstance as k, onMounted as b, defineComponent as g, useAttrs as S, useTemplateRef as F, effectScope as w, ref as C, computed as U, onScopeDispose as _, toRef as A, createElementBlock as R, openBlock as B } from "vue";
1
+ import { watch as f, nextTick as _, shallowRef as p, getCurrentInstance as m, onMounted as S, isRef as h, toValue as v, defineComponent as g, useTemplateRef as w, effectScope as U, onScopeDispose as R, toRef as C, markRaw as O, openBlock as P, createElementBlock as F } from "vue";
2
2
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
3
- function x(o, t, e) {
4
- const c = s(o, (r, l, u) => {
5
- r && (e?.once && h(() => c()), t(r, l, u));
3
+ function E(e, t, o) {
4
+ const s = f(e, (a, r, n) => {
5
+ a && (o?.once && _(() => s()), t(a, r, n));
6
6
  }, {
7
- ...e,
7
+ ...o,
8
8
  once: !1
9
9
  });
10
- return c;
10
+ return s;
11
11
  }
12
12
  // @__NO_SIDE_EFFECTS__
13
13
  function T() {
14
- const o = d(!1), t = k();
15
- return t && b(() => {
16
- o.value = !0;
17
- }, t), o;
14
+ const e = p(!1), t = m();
15
+ return t && S(() => {
16
+ e.value = !0;
17
+ }, t), e;
18
18
  }
19
- function m(o) {
20
- return o.endsWith("/") ? o.slice(0, -1) : o;
19
+ const A = "https://01-sports-frame-cdn.com", M = "1.0.0-rc.2", X = {
20
+ home: "/",
21
+ live: "/live",
22
+ prematch: "/prematch",
23
+ esport: "/esport",
24
+ history: "/bets-history"
25
+ };
26
+ async function B(e) {
27
+ return {
28
+ createSportsbookFrame: (await import(
29
+ /* @vite-ignore */
30
+ e
31
+ )).createSportsbookFrame
32
+ };
33
+ }
34
+ async function N(e) {
35
+ const t = await fetch(e);
36
+ if (!t.ok)
37
+ throw new Error(`Failed to fetch manifest: ${t.status} ${t.statusText}`);
38
+ return await t.json();
21
39
  }
22
- function $(o) {
23
- let t = o;
40
+ function b(e) {
41
+ return e.endsWith("/") ? e.slice(0, -1) : e;
42
+ }
43
+ function $(e) {
44
+ let t = e;
24
45
  for (; t.startsWith("/"); ) t = t.slice(1);
25
46
  return t;
26
47
  }
27
- function p(o, ...t) {
28
- let e = m(o);
29
- for (const c of t) {
30
- const r = $(c);
31
- r && (e = e + "/" + r);
48
+ function l(e, ...t) {
49
+ let o = b(e);
50
+ for (const s of t) {
51
+ const a = $(s);
52
+ a && (o = o + "/" + a);
32
53
  }
33
- return e;
34
- }
35
- async function M(o) {
36
- const t = p(o.cdnUrl, `manifest/v1/${o.stage}/sportsbook/manifest.json`), e = await fetch(t);
37
- if (!e.ok)
38
- throw new Error(`Failed to fetch manifest: ${e.status} ${e.statusText}`);
39
- return await e.json();
54
+ return o;
40
55
  }
41
- const E = "0.71.0", W = "https://01-sports-frame-cdn.com";
42
- async function j(o, t) {
56
+ function j(e) {
43
57
  return {
44
- createSportsbookFrame: (await import(
45
- /* @vite-ignore */
46
- `${o}/sportsbook/v1/core/v/${t}/esm/entry.js`
47
- )).createSportsbookFrame
58
+ getManifestPath: () => l(e.cdnUrl, `manifest/v1/${e.channel}/sportsbook/manifest.json`),
59
+ getEntryPath: (t) => l(e.cdnUrl, `sportsbook/v1/core/v/${t}/esm/entry.js`),
60
+ getEntryCssPath: (t) => l(e.cdnUrl, `sportsbook/v1/core/v/${t}/esm/style.css`),
61
+ getRootStaticPath: () => l(e.cdnUrl, "sportsbook/v1/static")
48
62
  };
49
63
  }
50
- async function L(o = {}) {
51
- const t = m(o.cdnUrl ?? W);
52
- let e;
53
- try {
54
- e = (await M({
55
- cdnUrl: t,
56
- stage: "stable"
57
- })).v1.main.version;
58
- } catch (l) {
59
- throw console.error("Error loading manifest:", l), l;
60
- }
61
- const c = p(t, `sportsbook/v1/core/v/${e}/esm/style.css`), r = await j(t, e);
64
+ async function x(e) {
65
+ const { preloaded: t } = e, o = b(e.cdnUrl ?? A);
66
+ if (t)
67
+ return {
68
+ createApp: (n) => t.createSportsbookFrame({
69
+ ...n,
70
+ cdnUrl: o
71
+ })
72
+ };
73
+ const s = j({
74
+ cdnUrl: o,
75
+ channel: e.releaseChannel ?? "stable"
76
+ }), a = (await N(s.getManifestPath())).v1.main.version, r = await B(s.getEntryPath(a));
62
77
  return {
63
- createApp: (l) => {
64
- const u = l;
65
- return r.createSportsbookFrame({
66
- ...u,
67
- assetsUrl: p(t, "sportsbook/v1/static"),
68
- cdnUrl: t,
69
- __sdk: {
70
- stage: "stable",
71
- version: E,
72
- cssStyleUrl: c
78
+ createApp: (n) => r.createSportsbookFrame({
79
+ ...n,
80
+ cdnUrl: o,
81
+ assetsUrl: s.getRootStaticPath(),
82
+ __sdk: {
83
+ version: M,
84
+ cssStyleUrl: s.getEntryCssPath(a)
85
+ }
86
+ })
87
+ };
88
+ }
89
+ const K = (e = {}) => x(e), W = K;
90
+ function D(e) {
91
+ return e?.__passLoaderConfigOverride;
92
+ }
93
+ function L() {
94
+ const e = m();
95
+ if (e?.type)
96
+ return D(e.type);
97
+ }
98
+ const I = /* @__PURE__ */ new Set(["__override", "navigation"]);
99
+ // @__NO_SIDE_EFFECTS__
100
+ function y(e) {
101
+ return I.has(e);
102
+ }
103
+ // @__NO_SIDE_EFFECTS__
104
+ function z(e) {
105
+ if (e)
106
+ return Object.fromEntries(
107
+ Object.entries(e).map(([t, o]) => [t, h(o) ? o.value : o])
108
+ );
109
+ }
110
+ function G(e, t, o) {
111
+ e.run(() => {
112
+ const s = Object.keys(o).filter((r) => !/* @__PURE__ */ y(r)), a = t.getWritable?.call(!0) ?? s;
113
+ for (const r of a)
114
+ if (!/* @__PURE__ */ y(r)) {
115
+ if (o.__override) {
116
+ const n = o.__override[r];
117
+ if (n !== void 0 && h(n)) {
118
+ f(
119
+ () => n.value,
120
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
+ (i) => {
122
+ console.log(`[sportsbook] override prop "${r}" updated`, i), t.update(r, i);
123
+ }
124
+ );
125
+ continue;
126
+ }
73
127
  }
74
- });
128
+ V(o, r) && f(
129
+ () => o[r],
130
+ (n) => {
131
+ console.log(`[sportsbook] prop "${r}" updated`, n), t.update(r, n);
132
+ }
133
+ );
134
+ }
135
+ });
136
+ }
137
+ function V(e, t) {
138
+ return t in e;
139
+ }
140
+ function H(e, t) {
141
+ t?.type === "manual" && f(
142
+ () => t.path.value,
143
+ (o) => {
144
+ v(e)?.navigateTo(o);
75
145
  }
76
- };
146
+ );
147
+ }
148
+ function Y(e) {
149
+ if (e) {
150
+ if (e.type === "manual")
151
+ return {
152
+ type: "manual",
153
+ initialPath: v(e.path),
154
+ push: e.push,
155
+ replace: e.replace,
156
+ back: e.back,
157
+ forward: e.forward
158
+ };
159
+ if (e.type === "memory" || e.type === "web-history")
160
+ return e;
161
+ }
77
162
  }
78
- const D = ["dir"], I = /* @__PURE__ */ g({
163
+ const q = {
164
+ id: "sportsbook-app",
165
+ ref: "root"
166
+ }, Z = /* @__PURE__ */ g({
79
167
  inheritAttrs: !1,
80
168
  __name: "SportsbookFrame",
81
169
  props: {
82
170
  baseUrl: {},
83
- navigation: {},
84
171
  apiUrl: {},
85
172
  cdnUrl: {},
86
173
  partnerId: {},
174
+ storagePrefix: {},
175
+ features: {},
87
176
  token: {},
88
177
  authed: { type: Boolean },
89
178
  languageCode: {},
@@ -93,78 +182,56 @@ const D = ["dir"], I = /* @__PURE__ */ g({
93
182
  balanceAmount: {},
94
183
  platform: {},
95
184
  colorScheme: {},
96
- theme: {},
97
185
  inert: { type: Boolean },
98
- appearance: {},
99
186
  defaultCoefFormat: {},
100
187
  production: { type: Boolean },
101
- localStoragePrefix: {},
102
- features: {},
188
+ theme: {},
189
+ appearance: {},
103
190
  onReady: { type: Function },
104
191
  onError: { type: Function },
105
192
  onLogin: { type: Function },
106
193
  onDeposit: { type: Function },
107
194
  onRenewToken: { type: Function },
108
195
  onNavigate: { type: Function },
109
- onSendNotification: { type: Function }
196
+ onSendNotification: { type: Function },
197
+ navigation: {},
198
+ __override: {}
110
199
  },
111
- setup(o, { expose: t }) {
112
- const e = o, c = S(), r = F("el"), l = w(), u = /* @__PURE__ */ T(), f = C(!1), y = U(() => e.rtl ? "rtl" : "ltr"), i = d();
113
- return _(() => {
114
- i.value?.destroy();
200
+ setup(e, { expose: t }) {
201
+ const o = e, s = w("root"), a = U(), r = p(!1), n = p(), i = /* @__PURE__ */ T(), k = L();
202
+ return R(() => {
203
+ n.value?.destroy(), a.stop();
204
+ }), a.run(() => {
205
+ H(n, o.navigation);
115
206
  }), t({
116
- app: A(() => i)
117
- }), l.run(async () => {
118
- const a = (await L({ cdnUrl: e.cdnUrl })).createApp({
119
- ...e,
207
+ app: C(() => n)
208
+ }), a.run(async () => {
209
+ const c = /* @__PURE__ */ z(o.__override);
210
+ let u = o.cdnUrl;
211
+ !u && c && "cdnUrl" in c && (u = String(c.cdnUrl) || void 0);
212
+ const d = (await W({
213
+ cdnUrl: u,
214
+ ...k
215
+ })).createApp({
216
+ ...o,
120
217
  ...c,
218
+ navigation: Y(o.navigation),
121
219
  onReady() {
122
- f.value = !0, e.onReady?.();
220
+ r.value = !0, o.onReady?.();
123
221
  }
124
222
  });
125
- i.value = a, s(
126
- () => e.languageCode,
127
- (n) => a.setLanguageCode(n)
128
- ), s(
129
- () => e.appearance,
130
- (n) => a.setAppearance(n)
131
- ), s(
132
- () => e.rtl,
133
- (n) => a.setRtl(n)
134
- ), s(
135
- () => e.platform,
136
- (n) => a.setPlatform(n)
137
- ), s(
138
- () => e.token,
139
- (n) => a.setToken(n)
140
- ), s(
141
- () => e.authed,
142
- (n) => a.setAuthed(n)
143
- ), s(
144
- () => e.colorScheme,
145
- (n) => a.setColorScheme(n ?? "dark")
146
- ), s(
147
- () => e.currencyCode,
148
- (n) => a.setCurrencyCode(n)
149
- ), s(
150
- () => e.balanceAmount,
151
- (n) => a.setBalanceAmount(n)
152
- );
153
- }), x(
154
- () => u.value && f.value,
223
+ n.value = O(d), G(a, d, o);
224
+ }), E(
225
+ () => i.value && r.value,
155
226
  () => {
156
- !r.value || !i.value || i.value.mount(r.value);
227
+ s.value && n.value && n.value.mount(s.value);
157
228
  },
158
229
  { once: !0 }
159
- ), (v, a) => (B(), R("div", {
160
- id: "sport-frame",
161
- ref_key: "el",
162
- ref: r,
163
- dir: y.value,
164
- "data-sport-frame": ""
165
- }, null, 8, D));
230
+ ), (c, u) => (P(), F("div", q, null, 512));
166
231
  }
167
232
  });
168
233
  export {
169
- I as SportsbookFrame
234
+ M as SDK_VERSION,
235
+ X as SPORTSBOOK_APP_ROUTES,
236
+ Z as SportsbookFrame
170
237
  };
package/package.json CHANGED
@@ -1,30 +1,19 @@
1
1
  {
2
2
  "name": "@01tech/sportsbook-vue",
3
+ "version": "1.0.0-rc.2",
4
+ "type": "module",
3
5
  "private": false,
4
- "version": "0.71.0",
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "scripts": {
9
- "sdk:build:prepare": "rm -rf ./dist",
10
- "dts-compile": "vue-tsc --project ./tsconfig.dts.json",
11
- "dts-resolve": "rollup -c rollup.dts.config.mjs",
12
- "dev:micro": "rollup -c rollup.dts.config.mjs --watch",
13
- "sdk:build:dts": "npm run dts-compile && npm run dts-resolve",
14
- "sdk:build:js": "NODE_ENV=production vite build --config vite.config.ts",
15
- "sdk:build": "npm run sdk:build:prepare && npm run sdk:build:dts && npm run sdk:build:js",
16
- "sdk:dev": "NODE_ENV=development vite build --watch --config vite.config.ts"
17
- },
6
+ "keywords": [
7
+ "@01tech",
8
+ "sportsbook"
9
+ ],
10
+ "files": [
11
+ "dist",
12
+ "package.json"
13
+ ],
18
14
  "peerDependencies": {
19
- "vue": "^3.5.0",
20
- "vue-router": "~4.5.1"
21
- },
22
- "peerDependenciesMeta": {
23
- "vue-router": {
24
- "optional": true
25
- }
15
+ "vue": "^3.5.0"
26
16
  },
27
- "types": "./dist/index.d.ts",
28
17
  "exports": {
29
18
  ".": {
30
19
  "types": "./dist/index.d.ts",