glitch-javascript-sdk 3.10.7 → 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 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
  }