glitch-javascript-sdk 3.10.8 → 3.15.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 +7 -1
- package/dist/browser/hosting-runtime.js +12 -2
- package/dist/browser/hosting-runtime.js.map +1 -1
- package/dist/cjs/index.js +871 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/FestivalNetworking.d.ts +286 -0
- package/dist/esm/api/Messages.d.ts +4 -1
- package/dist/esm/api/Microtransactions.d.ts +554 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.js +761 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/FestivalNetworkingRoute.d.ts +7 -0
- package/dist/esm/routes/MicrotransactionsRoute.d.ts +8 -0
- package/dist/esm/util/MicrotransactionBridge.d.ts +93 -0
- package/dist/esm/util/MicrotransactionOverlay.d.ts +59 -0
- package/dist/esm/util/Requests.d.ts +5 -3
- package/dist/index.d.ts +1003 -5
- package/guides/microtransactions.md +385 -0
- package/package.json +7 -4
- package/src/api/FestivalNetworking.ts +216 -0
- package/src/api/Messages.ts +4 -1
- package/src/api/Microtransactions.ts +509 -0
- package/src/api/index.ts +2 -0
- package/src/index.ts +8 -0
- package/src/routes/FestivalNetworkingRoute.ts +33 -0
- package/src/routes/MicrotransactionsRoute.ts +46 -0
- package/src/util/MicrotransactionBridge.ts +193 -0
- package/src/util/MicrotransactionOverlay.ts +302 -0
- package/src/util/Requests.ts +14 -2
package/README.md
CHANGED
|
@@ -64,4 +64,10 @@ Glitch.api.Auth.login("john@example.com", "abc123").then(()=> {
|
|
|
64
64
|
## Documentation
|
|
65
65
|
Documentation is produced via typedoc as the code comments are extensive and turned in readable documentation.
|
|
66
66
|
|
|
67
|
-
[https://glitch-gaming-platform.github.io/Glitch-Javascript-SDK/](https://glitch-gaming-platform.github.io/Glitch-Javascript-SDK/)
|
|
67
|
+
[https://glitch-gaming-platform.github.io/Glitch-Javascript-SDK/](https://glitch-gaming-platform.github.io/Glitch-Javascript-SDK/)
|
|
68
|
+
# Game microtransactions
|
|
69
|
+
|
|
70
|
+
Use `Glitch.api.Microtransactions` for title-scoped products, existing Media uploads,
|
|
71
|
+
game-branded hosted checkout, verified account handoff, inventory and refunds.
|
|
72
|
+
Read [the integration guide](guides/microtransactions.md) before handling purchases.
|
|
73
|
+
Never treat a browser message as payment proof or ship an administrative token.
|
|
@@ -5883,7 +5883,7 @@
|
|
|
5883
5883
|
}
|
|
5884
5884
|
return Requests.request('DELETE', url);
|
|
5885
5885
|
}
|
|
5886
|
-
static uploadFile(url, filename, file, data, params, onUploadProgress) {
|
|
5886
|
+
static uploadFile(url, filename, file, data, params, onUploadProgress, options) {
|
|
5887
5887
|
// Process URL and params
|
|
5888
5888
|
if (params && Object.keys(params).length > 0) {
|
|
5889
5889
|
const queryString = Object.entries(params)
|
|
@@ -5914,6 +5914,8 @@
|
|
|
5914
5914
|
data: formData,
|
|
5915
5915
|
headers,
|
|
5916
5916
|
onUploadProgress,
|
|
5917
|
+
signal: options === null || options === void 0 ? void 0 : options.signal,
|
|
5918
|
+
timeout: options === null || options === void 0 ? void 0 : options.timeout,
|
|
5917
5919
|
});
|
|
5918
5920
|
}
|
|
5919
5921
|
static postFormData(url, formData, params, onUploadProgress) {
|
|
@@ -6027,13 +6029,21 @@
|
|
|
6027
6029
|
}
|
|
6028
6030
|
});
|
|
6029
6031
|
}
|
|
6030
|
-
static processRoute(route, data, routeReplace, params) {
|
|
6032
|
+
static processRoute(route, data, routeReplace, params, options) {
|
|
6031
6033
|
let url = route.url;
|
|
6032
6034
|
if (routeReplace) {
|
|
6033
6035
|
for (let key in routeReplace) {
|
|
6034
6036
|
url = url.replace("{" + key + "}", routeReplace[key]);
|
|
6035
6037
|
}
|
|
6036
6038
|
}
|
|
6039
|
+
if (options) {
|
|
6040
|
+
const query = Object.assign(Object.assign({}, params), (Requests.community_id && !options.excludeCommunityContext ? { community_id: Requests.community_id } : {}));
|
|
6041
|
+
return axios({
|
|
6042
|
+
method: route.method, url: Requests.buildUrl(url, query), data,
|
|
6043
|
+
headers: Object.assign(Object.assign({ 'Content-Type': 'application/json' }, (Requests.authToken ? { Authorization: `Bearer ${Requests.authToken}` } : {})), options.headers),
|
|
6044
|
+
signal: options.signal, timeout: options.timeout,
|
|
6045
|
+
});
|
|
6046
|
+
}
|
|
6037
6047
|
if (route.method == HTTP_METHODS.GET) {
|
|
6038
6048
|
return Requests.get(url, params);
|
|
6039
6049
|
}
|