@betorigami/game-ui-shared 4.0.0 → 4.1.1
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 +21 -0
- package/dist/components/shared/BetDetailsComponent/BetDetailsComponent.d.ts +1 -1
- package/dist/components/shared/GameProviderWrapper.d.ts +2 -0
- package/dist/components/shared/context/slices/services.context.d.ts +2 -0
- package/dist/controllers/history.controller.d.ts +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +6671 -4254
- package/dist/shared/bet.types.d.ts +24 -43
- package/dist/shared/create-api-factory.d.ts +3 -6
- package/dist/shared/provider-api/error-codes.d.ts +1 -0
- package/dist/shared/provider-api/generated/client/client.gen.d.ts +2 -0
- package/dist/shared/provider-api/generated/client/index.d.ts +10 -0
- package/dist/shared/provider-api/generated/client/types.gen.d.ts +120 -0
- package/dist/shared/provider-api/generated/client/utils.gen.d.ts +37 -0
- package/dist/shared/provider-api/generated/client.gen.d.ts +12 -0
- package/dist/shared/provider-api/generated/core/auth.gen.d.ts +25 -0
- package/dist/shared/provider-api/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/shared/provider-api/generated/core/params.gen.d.ts +43 -0
- package/dist/shared/provider-api/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/shared/provider-api/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/shared/provider-api/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/shared/provider-api/generated/core/types.gen.d.ts +83 -0
- package/dist/shared/provider-api/generated/core/utils.gen.d.ts +19 -0
- package/dist/shared/provider-api/generated/index.d.ts +2 -0
- package/dist/shared/provider-api/generated/sdk.gen.d.ts +42 -0
- package/dist/shared/provider-api/generated/types.gen.d.ts +1143 -0
- package/dist/shared/provider-api/generated/zod.gen.d.ts +1271 -0
- package/dist/shared/provider-api/provider-api-client.d.ts +8 -0
- package/dist/translations/ar.json.d.ts +0 -1
- package/dist/translations/de.json.d.ts +0 -1
- package/dist/translations/en-soc.json.d.ts +0 -1
- package/dist/translations/en.json.d.ts +0 -1
- package/dist/translations/es.json.d.ts +0 -1
- package/dist/translations/fi.json.d.ts +0 -1
- package/dist/translations/fr.json.d.ts +0 -1
- package/dist/translations/hi.json.d.ts +0 -1
- package/dist/translations/id.json.d.ts +0 -1
- package/dist/translations/index.d.ts +0 -17
- package/dist/translations/ja.json.d.ts +0 -1
- package/dist/translations/ko.json.d.ts +0 -1
- package/dist/translations/pl.json.d.ts +0 -1
- package/dist/translations/pt.json.d.ts +0 -1
- package/dist/translations/ru.json.d.ts +0 -1
- package/dist/translations/tr.json.d.ts +0 -1
- package/dist/translations/vi.json.d.ts +0 -1
- package/dist/translations/zh.json.d.ts +0 -1
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -34,6 +34,27 @@ declare module '@betorigami/game-ui-shared' {
|
|
|
34
34
|
|
|
35
35
|
The package does not read environment variables. A host that wants a different provably-fair verifier calls `setVerifierBaseUrl` with that URL at startup; a host that does not leaves the built-in default in place.
|
|
36
36
|
|
|
37
|
+
## Provider API client
|
|
38
|
+
|
|
39
|
+
`ProviderApi` is a client for provider-api, generated with [hey-api](https://heyapi.dev) from provider-api's OpenAPI spec. Every response is checked against the spec with zod/mini before the caller sees it.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { ProviderApi } from '@betorigami/game-ui-shared';
|
|
43
|
+
|
|
44
|
+
const client = ProviderApi.createProviderApiClient({ baseUrl, authToken });
|
|
45
|
+
const { data, error } = await ProviderApi.postGamesDicePlay({ client, body });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`createProviderApiClient` adds the auth token, a fresh `X-Origami-Trace` id and a `REQUEST_TIMEOUT_MS` timeout to every request. `data` is set when the request succeeds and the response matches the spec. Otherwise `error` holds the error body, which `resolveApiErrorCode` turns into an `ErrorCode`. A response that doesn't match the spec throws. Inside this package, import from `src/shared/provider-api/provider-api-client` instead.
|
|
49
|
+
|
|
50
|
+
To regenerate it after provider-api's endpoints change:
|
|
51
|
+
|
|
52
|
+
1. Start provider-api locally from the backend repo with `ENABLE_OPENAPI_DOCS=true`, the default in its `.env.template`. It serves the spec at `http://localhost:3000/openapi.json`.
|
|
53
|
+
2. Run `pnpm run generate:provider-api` in this package.
|
|
54
|
+
3. Commit the changes under `src/shared/provider-api/generated/`.
|
|
55
|
+
|
|
56
|
+
The settings, including the excluded `/internal/*` routes, are in `openapi-ts.config.ts`. Don't edit the generated files by hand.
|
|
57
|
+
|
|
37
58
|
## Pinning
|
|
38
59
|
|
|
39
60
|
`@betorigami/game-calculations` supplies the enums of the games that have not yet been extracted. A host must pin the same version of it as this package, or two copies of the engine end up in one bundle and enum identity breaks.
|
|
@@ -2,7 +2,7 @@ import { default as OrigamiElement } from '../../../shared/origami-element';
|
|
|
2
2
|
import { Language } from '../../../translations/language.context';
|
|
3
3
|
import { TemplateResult } from 'lit';
|
|
4
4
|
export declare class BetDetailsComponent extends OrigamiElement {
|
|
5
|
-
static styles: import('lit').CSSResult;
|
|
5
|
+
static styles: import('lit').CSSResult[];
|
|
6
6
|
baseUrl: string;
|
|
7
7
|
betId: string;
|
|
8
8
|
language: Language;
|
|
@@ -76,6 +76,7 @@ export declare class GameProviderWrapper extends OrigamiElement {
|
|
|
76
76
|
private scale;
|
|
77
77
|
language: Language;
|
|
78
78
|
private _soundEffects;
|
|
79
|
+
private _providerApi;
|
|
79
80
|
private _historyController;
|
|
80
81
|
private _haptics;
|
|
81
82
|
private _resizeObserver;
|
|
@@ -90,6 +91,7 @@ export declare class GameProviderWrapper extends OrigamiElement {
|
|
|
90
91
|
firstUpdated(_changed: PropertyValues): Promise<void>;
|
|
91
92
|
disconnectedCallback(): void;
|
|
92
93
|
updated(changedProperties: PropertyValues): void;
|
|
94
|
+
private get providerApi();
|
|
93
95
|
private get isDemoMode();
|
|
94
96
|
private get isDesktop();
|
|
95
97
|
private createLocale;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { HapticsController } from '../../../../controllers/haptics.controller';
|
|
2
2
|
import { HistoryController } from '../../../../controllers/history.controller';
|
|
3
3
|
import { SoundEffectsController } from '../../../../controllers/sound/sound-effects.controller';
|
|
4
|
+
import { Client } from '../../../../shared/provider-api/generated/client';
|
|
4
5
|
export type ServicesContextType = {
|
|
5
6
|
soundEffects: SoundEffectsController;
|
|
6
7
|
haptics: HapticsController;
|
|
7
8
|
historyController: HistoryController;
|
|
9
|
+
providerApi: Client;
|
|
8
10
|
};
|
|
9
11
|
export declare const servicesContext: {
|
|
10
12
|
__context__: ServicesContextType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Currency } from '../shared/constants';
|
|
2
|
-
import {
|
|
2
|
+
import { Client } from '../shared/provider-api/provider-api-client';
|
|
3
3
|
export interface HistoryItem {
|
|
4
4
|
id: string;
|
|
5
5
|
fullId: string;
|
|
@@ -21,7 +21,7 @@ export declare class NonceChangedEvent extends Event {
|
|
|
21
21
|
constructor(nonce: number | null);
|
|
22
22
|
}
|
|
23
23
|
export declare class HistoryController extends EventTarget {
|
|
24
|
-
private readonly
|
|
24
|
+
private readonly getClient;
|
|
25
25
|
private _historyData;
|
|
26
26
|
private _hasData;
|
|
27
27
|
private _isInitialized;
|
|
@@ -33,7 +33,7 @@ export declare class HistoryController extends EventTarget {
|
|
|
33
33
|
private _activeBetNonce;
|
|
34
34
|
private _hasLoadedClientSeed;
|
|
35
35
|
private _provablyFairInfoAbortController;
|
|
36
|
-
constructor(
|
|
36
|
+
constructor(getClient: () => Client | null);
|
|
37
37
|
get historyData(): HistoryItem[];
|
|
38
38
|
get hasData(): boolean | null;
|
|
39
39
|
get isInitialized(): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -175,6 +175,7 @@ export * from './shared/provably-fair-verifier';
|
|
|
175
175
|
export * from './shared/provider-api/bet-result';
|
|
176
176
|
export * from './shared/provider-api/error-codes';
|
|
177
177
|
export * from './shared/provider-api/request-timeout';
|
|
178
|
+
export * as ProviderApi from './shared/provider-api/provider-api-client';
|
|
178
179
|
export * from './shared/retry-once';
|
|
179
180
|
export * from './shared/sleep';
|
|
180
181
|
export * from './shared/utils/format-autobet-settings';
|