@masterunoco/casinowebengine-api 0.1.0 â 0.1.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.
- package/README.md +17 -93
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
# đšī¸
|
|
1
|
+
# đšī¸ Casino Web Engine API SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@masterunoco/casinowebengine-api)
|
|
4
|
+
[](https://www.npmjs.com/package/@masterunoco/casinowebengine-api)
|
|
5
|
+
|
|
6
|
+
A **TypeScript front-end SDK** for interacting with the casino web-engine API across casino front-end projects.
|
|
4
7
|
It provides a unified interface for games, authentication, content, player preferences, website settings, and more â all with full type safety and automatic JWT handling.
|
|
5
8
|
|
|
6
9
|
---
|
|
@@ -10,7 +13,7 @@ It provides a unified interface for games, authentication, content, player prefe
|
|
|
10
13
|
- 𤊠**Typed API layer** â all endpoints return strongly-typed responses.
|
|
11
14
|
- đ **Built-in JWT auth** â automatically attaches `Authorization: JWT <token>` to protected requests.
|
|
12
15
|
- đ **Public + private endpoints** â transparent auth handling (`none`, `optional`, `required`).
|
|
13
|
-
- âī¸ **Configurable** â base URL
|
|
16
|
+
- âī¸ **Configurable** â base URL and timeout.
|
|
14
17
|
- đž **Persistent storage** â stores tokens and user data via localStorage helper.
|
|
15
18
|
- đ§ **Framework-agnostic** â works with any front-end (React, Vue, Next.js, etc.).
|
|
16
19
|
- đĨˇ **Ready for npm** â ships with ESM + CJS + `.d.ts` types.
|
|
@@ -19,9 +22,8 @@ It provides a unified interface for games, authentication, content, player prefe
|
|
|
19
22
|
|
|
20
23
|
## đĻ Installation
|
|
21
24
|
|
|
22
|
-
### From npm (when published)
|
|
23
25
|
```bash
|
|
24
|
-
npm install @
|
|
26
|
+
npm install @masterunoco/casinowebengine-api
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
### Local development
|
|
@@ -31,17 +33,9 @@ If the SDK is cloned locally:
|
|
|
31
33
|
npm run build
|
|
32
34
|
|
|
33
35
|
# In your front-end project
|
|
34
|
-
npm install ../path-to/
|
|
36
|
+
npm install ../path-to/casinowebengine-api
|
|
35
37
|
# or
|
|
36
|
-
npm i file:../
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Workspace monorepo
|
|
40
|
-
If both live in the same repo:
|
|
41
|
-
```json
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@cwe/frontend-sdk": "workspace:*"
|
|
44
|
-
}
|
|
38
|
+
npm i file:../path-to/casinowebengine-api
|
|
45
39
|
```
|
|
46
40
|
|
|
47
41
|
---
|
|
@@ -49,15 +43,11 @@ If both live in the same repo:
|
|
|
49
43
|
## đ§° Basic Setup
|
|
50
44
|
|
|
51
45
|
```ts
|
|
52
|
-
import { createGameSDK } from '@
|
|
46
|
+
import { createGameSDK } from '@masterunoco/casinowebengine-api';
|
|
53
47
|
|
|
54
48
|
const sdk = createGameSDK({
|
|
55
49
|
baseUrl: import.meta.env.VITE_GAMESERVICE_URL,
|
|
56
|
-
|
|
57
|
-
defaultLanguage: 'en',
|
|
58
|
-
defaultCurrency: 'USD',
|
|
59
|
-
storage: localStorage,
|
|
60
|
-
storageKey: 'gp.jwt',
|
|
50
|
+
timeoutMs: 15000,
|
|
61
51
|
});
|
|
62
52
|
```
|
|
63
53
|
|
|
@@ -130,83 +120,18 @@ src/
|
|
|
130
120
|
ââ http/client.ts # Fetch wrapper with timeout & authPolicy
|
|
131
121
|
ââ auth/jwtAuth.ts # JWT lifecycle (login, store, clear)
|
|
132
122
|
ââ apis/
|
|
133
|
-
â ââ games.ts
|
|
134
|
-
â ââ settings.ts
|
|
135
|
-
â ââ geo.ts
|
|
136
|
-
â ââ ...
|
|
123
|
+
â ââ games.ts
|
|
124
|
+
â ââ settings.ts
|
|
125
|
+
â ââ geo.ts
|
|
126
|
+
â ââ ...
|
|
137
127
|
ââ types/
|
|
138
128
|
â ââ auth.ts
|
|
139
129
|
â ââ gamesSearch.ts
|
|
140
130
|
â ââ settings.ts
|
|
141
131
|
â ââ signup.ts
|
|
142
|
-
ââ localStorage.ts
|
|
132
|
+
ââ localStorage.ts
|
|
143
133
|
```
|
|
144
134
|
|
|
145
|
-
Each API module uses the shared `HttpClient` and defines its own types and interfaces.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## đž Configuration Options
|
|
150
|
-
|
|
151
|
-
| Option | Type | Description |
|
|
152
|
-
|--------|------|-------------|
|
|
153
|
-
| `baseUrl` | `string` | Base API URL for gameService |
|
|
154
|
-
| `brand` | `string` | Optional brand name for `X-Brand` header |
|
|
155
|
-
| `defaultLanguage` | `string` | Default language header |
|
|
156
|
-
| `defaultCurrency` | `string` | Default currency header |
|
|
157
|
-
| `storage` | `Storage` | Browser storage (e.g., `localStorage`) |
|
|
158
|
-
| `storageKey` | `string` | Key under which JWT is stored |
|
|
159
|
-
| `timeoutMs` | `number` | Request timeout in milliseconds |
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
## đĨĒ Development
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# Build for production
|
|
167
|
-
npm run build
|
|
168
|
-
|
|
169
|
-
# Watch mode
|
|
170
|
-
npm run dev
|
|
171
|
-
|
|
172
|
-
# Type-check only
|
|
173
|
-
npm run typecheck
|
|
174
|
-
|
|
175
|
-
# Lint
|
|
176
|
-
npm run lint
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## đĨą Local Testing with Front-end
|
|
182
|
-
|
|
183
|
-
In your front-end project:
|
|
184
|
-
|
|
185
|
-
```ts
|
|
186
|
-
import { createGameSDK } from '@cwe/frontend-sdk';
|
|
187
|
-
|
|
188
|
-
const sdk = createGameSDK({
|
|
189
|
-
baseUrl: 'https://api.yourdomain.com/game-service',
|
|
190
|
-
storage: localStorage,
|
|
191
|
-
storageKey: 'gp.jwt',
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
const games = await sdk.games.searchGames({ category: 'slots' });
|
|
195
|
-
console.log(games.results.length);
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## 𤊠Building Blocks (Available APIs)
|
|
201
|
-
|
|
202
|
-
| Module | Description |
|
|
203
|
-
|---------|-------------|
|
|
204
|
-
| `auth` | Handles login, token management, user retrieval |
|
|
205
|
-
| `games` | Search, list, and launch games |
|
|
206
|
-
| `settings` | Content pages, banners, preferences, currencies, and website settings |
|
|
207
|
-
| `geolocation` | Detect and cache player location |
|
|
208
|
-
| `localStorage` | Utility for token, user, and geo persistence |
|
|
209
|
-
|
|
210
135
|
---
|
|
211
136
|
|
|
212
137
|
## đž Build Output
|
|
@@ -222,6 +147,5 @@ dist/
|
|
|
222
147
|
|
|
223
148
|
## đž License
|
|
224
149
|
|
|
225
|
-
MIT Š 2025
|
|
226
|
-
Developed by **Eyal (Venus Technology / Gaming Platform)**
|
|
150
|
+
MIT Š 2025
|
|
227
151
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@masterunoco/casinowebengine-api",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Typed front-end SDK for casino
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Typed front-end SDK for casino web-engine API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
9
12
|
"exports": {
|
|
10
13
|
".": {
|
|
11
14
|
"import": "./dist/index.js",
|
|
@@ -13,7 +16,10 @@
|
|
|
13
16
|
"types": "./dist/index.d.ts"
|
|
14
17
|
}
|
|
15
18
|
},
|
|
16
|
-
"files": [
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
17
23
|
"sideEffects": false,
|
|
18
24
|
"dependencies": {
|
|
19
25
|
"@mui/material": "^7.3.5",
|