@accelbyte/sdk 1.2.0 → 2.0.0-experimental.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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/node/{index.node.js → index.cjs} +28 -38
  3. package/dist/cjs/node/index.cjs.map +1 -0
  4. package/dist/es/browser/index.browser.js +27 -37
  5. package/dist/es/browser/index.browser.js.map +1 -1
  6. package/dist/es/node/index.node.js +27 -37
  7. package/dist/es/node/index.node.js.map +1 -1
  8. package/dist/index.d.ts +12 -25
  9. package/package.json +3 -3
  10. package/dist/cjs/node/index.node.js.map +0 -1
  11. package/examples/next/README.md +0 -46
  12. package/examples/next/package.json +0 -22
  13. package/examples/next/pages/_app.tsx +0 -12
  14. package/examples/next/pages/_document.tsx +0 -19
  15. package/examples/next/pages/index.tsx +0 -124
  16. package/examples/next/public/favicon.ico +0 -0
  17. package/examples/next/public/next.svg +0 -1
  18. package/examples/next/public/thirteen.svg +0 -1
  19. package/examples/next/public/vercel.svg +0 -1
  20. package/examples/next/src/sdk.ts +0 -32
  21. package/examples/next/styles/Home.module.css +0 -274
  22. package/examples/next/styles/globals.css +0 -112
  23. package/examples/next/yarn.lock +0 -420
  24. package/examples/node/README.md +0 -29
  25. package/examples/node/index.js +0 -58
  26. package/examples/node/index.mjs +0 -56
  27. package/examples/node/package.json +0 -13
  28. package/examples/node/yarn.lock +0 -197
  29. package/examples/vite/README.md +0 -46
  30. package/examples/vite/index.html +0 -13
  31. package/examples/vite/package.json +0 -24
  32. package/examples/vite/public/vite.svg +0 -1
  33. package/examples/vite/src/App.css +0 -43
  34. package/examples/vite/src/App.tsx +0 -67
  35. package/examples/vite/src/Sdk.ts +0 -53
  36. package/examples/vite/src/assets/react.svg +0 -1
  37. package/examples/vite/src/index.css +0 -75
  38. package/examples/vite/src/main.tsx +0 -15
  39. package/examples/vite/src/vite-env.d.ts +0 -1
  40. package/examples/vite/yarn.lock +0 -890
@@ -1,197 +0,0 @@
1
- # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
- # yarn lockfile v1
3
-
4
-
5
- "@accelbyte/sdk@1.1.3":
6
- version "1.1.3"
7
- resolved "https://registry.yarnpkg.com/@accelbyte/sdk/-/sdk-1.1.3.tgz#93de5299c99b12a79a4e04a918989d4c7ce124dd"
8
- integrity sha512-DL0JXLeBL7yJs+EWATEuftSghpfOeGZMG2dGUjQD6sly+RsBi3UJVSjxAHRv/fo/nlW7yr4lTt2XQ2XbRDJeeg==
9
- dependencies:
10
- "@accelbyte/validator" "0.2.0-beta.2"
11
- axios "0.27.2"
12
- buffer "6.0.3"
13
- crypto-js "4.1.1"
14
- lodash "4.17.21"
15
- nanoid "3.1.31"
16
- platform "1.3.6"
17
- query-string "7.1.1"
18
- uuid "8.3.2"
19
- validator "13.7.0"
20
- zod "3.17.3"
21
-
22
- "@accelbyte/validator@0.2.0-beta.2":
23
- version "0.2.0-beta.2"
24
- resolved "https://registry.yarnpkg.com/@accelbyte/validator/-/validator-0.2.0-beta.2.tgz#b0c858cee77e4e175e617091db1514084673d146"
25
- integrity sha512-Jq5SlGC3j7ltv4hNUI3mRHx5PLa26ERs9ZJpyl2DrCQRfpeG0LjF6Mr8KYz68X6iu/FNpk8IOoOp/V6XtvJlzQ==
26
- dependencies:
27
- naughty-words "1.2.0"
28
- xregexp "5.1.0"
29
-
30
- "@babel/runtime-corejs3@^7.14.9":
31
- version "7.21.0"
32
- resolved "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.21.0.tgz"
33
- integrity sha512-TDD4UJzos3JJtM+tHX+w2Uc+KWj7GV+VKKFdMVd2Rx8sdA19hcc3P3AHFYd5LVOw+pYuSd5lICC3gm52B6Rwxw==
34
- dependencies:
35
- core-js-pure "^3.25.1"
36
- regenerator-runtime "^0.13.11"
37
-
38
- asynckit@^0.4.0:
39
- version "0.4.0"
40
- resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
41
- integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
42
-
43
- axios@0.27.2:
44
- version "0.27.2"
45
- resolved "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz"
46
- integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
47
- dependencies:
48
- follow-redirects "^1.14.9"
49
- form-data "^4.0.0"
50
-
51
- base64-js@^1.3.1:
52
- version "1.5.1"
53
- resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
54
- integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
55
-
56
- buffer@6.0.3:
57
- version "6.0.3"
58
- resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz"
59
- integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
60
- dependencies:
61
- base64-js "^1.3.1"
62
- ieee754 "^1.2.1"
63
-
64
- combined-stream@^1.0.8:
65
- version "1.0.8"
66
- resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz"
67
- integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
68
- dependencies:
69
- delayed-stream "~1.0.0"
70
-
71
- core-js-pure@^3.25.1:
72
- version "3.28.0"
73
- resolved "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.28.0.tgz"
74
- integrity sha512-DSOVleA9/v3LNj/vFxAPfUHttKTzrB2RXhAPvR5TPXn4vrra3Z2ssytvRyt8eruJwAfwAiFADEbrjcRdcvPLQQ==
75
-
76
- crypto-js@4.1.1:
77
- version "4.1.1"
78
- resolved "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz"
79
- integrity sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==
80
-
81
- decode-uri-component@^0.2.0:
82
- version "0.2.2"
83
- resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz"
84
- integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==
85
-
86
- delayed-stream@~1.0.0:
87
- version "1.0.0"
88
- resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
89
- integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
90
-
91
- dotenv@16.0.3:
92
- version "16.0.3"
93
- resolved "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz"
94
- integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==
95
-
96
- filter-obj@^1.1.0:
97
- version "1.1.0"
98
- resolved "https://registry.npmjs.org/filter-obj/-/filter-obj-1.1.0.tgz"
99
- integrity sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ==
100
-
101
- follow-redirects@^1.14.9:
102
- version "1.15.2"
103
- resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz"
104
- integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
105
-
106
- form-data@^4.0.0:
107
- version "4.0.0"
108
- resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz"
109
- integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
110
- dependencies:
111
- asynckit "^0.4.0"
112
- combined-stream "^1.0.8"
113
- mime-types "^2.1.12"
114
-
115
- ieee754@^1.2.1:
116
- version "1.2.1"
117
- resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz"
118
- integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
119
-
120
- lodash@4.17.21:
121
- version "4.17.21"
122
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
123
- integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
124
-
125
- mime-db@1.52.0:
126
- version "1.52.0"
127
- resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz"
128
- integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
129
-
130
- mime-types@^2.1.12:
131
- version "2.1.35"
132
- resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz"
133
- integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
134
- dependencies:
135
- mime-db "1.52.0"
136
-
137
- nanoid@3.1.31:
138
- version "3.1.31"
139
- resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.1.31.tgz"
140
- integrity sha512-ZivnJm0o9bb13p2Ot5CpgC2rQdzB9Uxm/mFZweqm5eMViqOJe3PV6LU2E30SiLgheesmcPrjquqraoolONSA0A==
141
-
142
- naughty-words@1.2.0:
143
- version "1.2.0"
144
- resolved "https://registry.npmjs.org/naughty-words/-/naughty-words-1.2.0.tgz"
145
- integrity sha512-0iadX6fN+3NsfvIRtWmmpEX9VsoIQ6n9FwyIxmew9w5yzFNqMgs/Ky0eAC/z5xXSHtqlVoByiovdROikwH9SXQ==
146
-
147
- platform@1.3.6:
148
- version "1.3.6"
149
- resolved "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz"
150
- integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
151
-
152
- query-string@7.1.1:
153
- version "7.1.1"
154
- resolved "https://registry.npmjs.org/query-string/-/query-string-7.1.1.tgz"
155
- integrity sha512-MplouLRDHBZSG9z7fpuAAcI7aAYjDLhtsiVZsevsfaHWDS2IDdORKbSd1kWUA+V4zyva/HZoSfpwnYMMQDhb0w==
156
- dependencies:
157
- decode-uri-component "^0.2.0"
158
- filter-obj "^1.1.0"
159
- split-on-first "^1.0.0"
160
- strict-uri-encode "^2.0.0"
161
-
162
- regenerator-runtime@^0.13.11:
163
- version "0.13.11"
164
- resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz"
165
- integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
166
-
167
- split-on-first@^1.0.0:
168
- version "1.1.0"
169
- resolved "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz"
170
- integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==
171
-
172
- strict-uri-encode@^2.0.0:
173
- version "2.0.0"
174
- resolved "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz"
175
- integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==
176
-
177
- uuid@8.3.2:
178
- version "8.3.2"
179
- resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
180
- integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
181
-
182
- validator@13.7.0:
183
- version "13.7.0"
184
- resolved "https://registry.npmjs.org/validator/-/validator-13.7.0.tgz"
185
- integrity sha512-nYXQLCBkpJ8X6ltALua9dRrZDHVYxjJ1wgskNt1lH9fzGjs3tgojGSCBjmEPwkWS1y29+DrizMTW19Pr9uB2nw==
186
-
187
- xregexp@5.1.0:
188
- version "5.1.0"
189
- resolved "https://registry.npmjs.org/xregexp/-/xregexp-5.1.0.tgz"
190
- integrity sha512-PynwUWtXnSZr8tpQlDPMZfPTyv78EYuA4oI959ukxcQ0a9O/lvndLVKy5wpImzzA26eMxpZmnAXJYiQA13AtWA==
191
- dependencies:
192
- "@babel/runtime-corejs3" "^7.14.9"
193
-
194
- zod@3.17.3:
195
- version "3.17.3"
196
- resolved "https://registry.npmjs.org/zod/-/zod-3.17.3.tgz"
197
- integrity sha512-4oKP5zvG6GGbMlqBkI5FESOAweldEhSOZ6LI6cG+JzUT7ofj1ZOC0PJudpQOpT1iqOFpYYtX5Pw0+o403y4bcg==
@@ -1,46 +0,0 @@
1
- # SDK Usage Example: vite
2
-
3
- This is a sample usage of SDK using [vite](https://vitejs.dev/).
4
-
5
- ## How to Run
6
-
7
- This folder should be ready to run without any changes as it is pointing to the [AccelByte's demo environment](https://demo.accelbyte.io) by default.
8
-
9
- ```sh
10
- # Install the dependencies.
11
- yarn install
12
-
13
- # Run the dev server.
14
- yarn dev
15
- ```
16
-
17
- After that, open http://localhost:3030. There will be few requests fired on the background, which then you could inspect the response by collapsing the `<details>` element.
18
-
19
- There will be also a `<details>` element with the title `currentUser`, which will contain your user information. By default, if you aren't logged in, then you will get `401 Unauthorized` in the network response.
20
-
21
- If you want to log in, you can click on the "Log in" button and it will redirect you to the Login website. After you submit with the valid credentials, you will be redirected back to http://localhost:3030 with some query parameters in it. These query parameters will be processed by this function `exchangeAuthorizationCode`, which will exchange the code passed in the query parameters to cookies.
22
-
23
- ## How to Point to Other Environments
24
-
25
- If you want to use this example folder for other environments, do these steps:
26
-
27
- 1. Change the [proxy target](https://github.com/AccelByte/accelbyte-web-sdk/blob/main/packages/sdk/examples/vite/vite.config.ts#L16-L22). It is required because otherwise during local development, we will be blocked by [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
28
- 2. Change the [client ID, namespace, and redirect URI](https://github.com/AccelByte/accelbyte-web-sdk/blob/main/packages/sdk/examples/vite/src/Sdk.ts#L11-L13) of the SDK options. You can get these from Admin Portal's IAM Clients page. As for the redirect URI, ensure that it is a subset of the redirect URIs listed in the IAM Client.
29
-
30
- ## Production builds
31
-
32
- For production builds, please ensure that you have added conditionals to the `baseURL`. As mentioned in the section above, the default `baseURL` is the local development's origin with `/api` suffix to bypass CORS. However, we won't need it in production builds, because the default proxy server doesn't exist when we run in production mode.
33
-
34
- As such, what we can do is to have something like this:
35
-
36
- ```ts
37
- const BASE_URL = process.env.VITE_BASE_URL
38
- const SDK_CONFIG = {
39
- baseURL: process.env.NODE_ENV === 'production' ? BASE_URL : 'http://localhost:3030/api',
40
- clientId: '77f88506b6174c3ea4d925f5b4096ce8',
41
- namespace: 'accelbyte',
42
- redirectURI: process.env.NODE_ENV === 'production' ? BASE_URL : 'http://localhost:3030'
43
- }
44
- ```
45
-
46
- So, when we are building for production, it will use `VITE_BASE_URL` environment variable instead of the `localhost:3030` one.
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + React + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>
@@ -1,24 +0,0 @@
1
- {
2
- "name": "sdk-demo-vite",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "vite",
8
- "build": "tsc && vite build",
9
- "preview": "vite preview"
10
- },
11
- "dependencies": {
12
- "@accelbyte/sdk": "1.1.3",
13
- "dotenv": "16.0.3",
14
- "react": "18.2.0",
15
- "react-dom": "18.2.0"
16
- },
17
- "devDependencies": {
18
- "@types/react": "18.0.26",
19
- "@types/react-dom": "18.0.9",
20
- "@vitejs/plugin-react": "3.0.0",
21
- "typescript": "4.9.3",
22
- "vite": "4.0.0"
23
- }
24
- }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -1,43 +0,0 @@
1
- #root {
2
- width: 100%;
3
- text-align: center;
4
- }
5
-
6
- .logo {
7
- height: 6em;
8
- padding: 1.5em;
9
- will-change: filter;
10
- }
11
- .logo:hover {
12
- filter: drop-shadow(0 0 2em #646cffaa);
13
- }
14
- .logo.react:hover {
15
- filter: drop-shadow(0 0 2em #61dafbaa);
16
- }
17
-
18
- @keyframes logo-spin {
19
- from {
20
- transform: rotate(0deg);
21
- }
22
- to {
23
- transform: rotate(360deg);
24
- }
25
- }
26
-
27
- @media (prefers-reduced-motion: no-preference) {
28
- a:nth-of-type(2) .logo {
29
- animation: logo-spin infinite 20s linear;
30
- }
31
- }
32
-
33
- .card {
34
- padding: 2em;
35
- }
36
-
37
- .read-the-docs {
38
- color: #888;
39
- }
40
-
41
- .responses {
42
- text-align: left;
43
- }
@@ -1,67 +0,0 @@
1
- /*
2
- * Copyright (c) 2018-2023 AccelByte Inc. All Rights Reserved
3
- * This is licensed software from AccelByte Inc, for limitations
4
- * and restrictions contact your company contract manager.
5
- */
6
- import React, { useEffect, useState } from 'react'
7
- import './App.css'
8
- import { exchangeAuthorizationCode, getSdkTestValues, login } from './Sdk'
9
-
10
- function App() {
11
- const [responses, setResponses] = useState<any>(null)
12
-
13
- useEffect(() => {
14
- async function initialize() {
15
- // Exchange authorization code first, so that by the time we fetch the stuff, we already have the cookie.
16
- await exchangeAuthorizationCode()
17
-
18
- // After that, fetch the stuff.
19
- setResponses(null)
20
- setResponses(await getSdkTestValues())
21
- }
22
-
23
- initialize()
24
- }, [])
25
-
26
- return (
27
- <>
28
- <div className="App">
29
- <h1>Vite + React</h1>
30
- <div className="card">
31
- <p>
32
- Edit <code>src/App.tsx</code> and save to test HMR
33
- </p>
34
- </div>
35
- </div>
36
-
37
- {!responses?.currentUser?.response?.data && (
38
- <div>
39
- <button onClick={login}>Log in</button>
40
- </div>
41
- )}
42
-
43
- {responses === null ? (
44
- 'No responses yet'
45
- ) : (
46
- <div className="responses">
47
- {Object.keys(responses).map(key => (
48
- <Collapsible key={key} json={responses[key]} title={key} />
49
- ))}
50
- </div>
51
- )}
52
- </>
53
- )
54
- }
55
-
56
- export default App
57
-
58
- // composing components.
59
- function Collapsible(props: { title: string; json: any }) {
60
- return (
61
- <details id={'toogle' + props.title}>
62
- <summary>{props.title}</summary>
63
-
64
- <pre id={props.title}>{JSON.stringify(props.json, null, 2)}</pre>
65
- </details>
66
- )
67
- }
@@ -1,53 +0,0 @@
1
- /*
2
- * Copyright (c) 2023 AccelByte Inc. All Rights Reserved
3
- * This is licensed software from AccelByte Inc, for limitations
4
- * and restrictions contact your company contract manager.
5
- */
6
-
7
- import { Accelbyte } from '@accelbyte/sdk'
8
-
9
- const SDK_CONFIG = {
10
- baseURL: 'http://localhost:3030/api',
11
- clientId: '77f88506b6174c3ea4d925f5b4096ce8',
12
- namespace: 'accelbyte',
13
- redirectURI: 'http://localhost:3030'
14
- }
15
-
16
- const sdk = Accelbyte.SDK({
17
- options: SDK_CONFIG
18
- })
19
-
20
- export async function getSdkTestValues() {
21
- const [currentUser, listDiscoveryConfigs, listOfCurrencies, listOfItems] = await Promise.all([
22
- sdk.IAM.User().getCurrentUser(),
23
- sdk.AccelbyteConfig.PublicTemplate().getDiscoveryTemplateConfigs(),
24
-
25
- sdk.Platform.Currency().getCurrencies(),
26
- sdk.Platform.Item().fetchItemsByCriteria({})
27
- ])
28
-
29
- return {
30
- currentUser,
31
- listDiscoveryConfigs,
32
- listOfCurrencies,
33
- listOfItems
34
- }
35
- }
36
-
37
- export function login() {
38
- const url = sdk.IAM.UserAuthorization().createLoginURL()
39
- window.location.replace(url)
40
- }
41
-
42
- export async function exchangeAuthorizationCode() {
43
- const searchParams = new URL(window.location.href).searchParams
44
- const { code, error, state } = Object.fromEntries(searchParams.entries())
45
- if (!code) return
46
-
47
- try {
48
- await sdk.IAM.UserAuthorization().exchangeAuthorizationCode({ code, error, state })
49
- window.history.pushState({}, '', window.location.origin)
50
- } catch (err) {
51
- console.error(err)
52
- }
53
- }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -1,75 +0,0 @@
1
- /*
2
- * Copyright (c) 2018-2023 AccelByte Inc. All Rights Reserved
3
- * This is licensed software from AccelByte Inc, for limitations
4
- * and restrictions contact your company contract manager.
5
- */
6
- :root {
7
- font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
8
- font-size: 16px;
9
- line-height: 24px;
10
- font-weight: 400;
11
-
12
- color-scheme: light dark;
13
- color: rgba(255, 255, 255, 0.87);
14
- background-color: #242424;
15
-
16
- font-synthesis: none;
17
- text-rendering: optimizeLegibility;
18
- -webkit-font-smoothing: antialiased;
19
- -moz-osx-font-smoothing: grayscale;
20
- -webkit-text-size-adjust: 100%;
21
- }
22
-
23
- a {
24
- font-weight: 500;
25
- color: #646cff;
26
- text-decoration: inherit;
27
- }
28
- a:hover {
29
- color: #535bf2;
30
- }
31
-
32
- body {
33
- margin: 0;
34
- display: flex;
35
- place-items: center;
36
- min-width: 320px;
37
- min-height: 100vh;
38
- }
39
-
40
- h1 {
41
- font-size: 3.2em;
42
- line-height: 1.1;
43
- }
44
-
45
- button {
46
- border-radius: 8px;
47
- border: 1px solid transparent;
48
- padding: 0.6em 1.2em;
49
- font-size: 1em;
50
- font-weight: 500;
51
- font-family: inherit;
52
- background-color: #1a1a1a;
53
- cursor: pointer;
54
- transition: border-color 0.25s;
55
- }
56
- button:hover {
57
- border-color: #646cff;
58
- }
59
- button:focus,
60
- button:focus-visible {
61
- outline: 4px auto -webkit-focus-ring-color;
62
- }
63
-
64
- @media (prefers-color-scheme: light) {
65
- :root {
66
- color: #213547;
67
- background-color: #ffffff;
68
- }
69
- a:hover {
70
- color: #747bff;
71
- }
72
- button {
73
- background-color: #f9f9f9;
74
- }
75
- }
@@ -1,15 +0,0 @@
1
- /*
2
- * Copyright (c) 2018-2023 AccelByte Inc. All Rights Reserved
3
- * This is licensed software from AccelByte Inc, for limitations
4
- * and restrictions contact your company contract manager.
5
- */
6
- import React from 'react'
7
- import ReactDOM from 'react-dom/client'
8
- import App from './App'
9
- import './index.css'
10
-
11
- ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
12
- <React.StrictMode>
13
- <App />
14
- </React.StrictMode>
15
- )
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />