glitch-javascript-sdk 1.3.9 → 1.4.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/dist/cjs/index.js +152 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Funnel.d.ts +66 -0
- package/dist/esm/api/Media.d.ts +3 -3
- package/dist/esm/api/Scheduler.d.ts +11 -0
- package/dist/esm/api/Titles.d.ts +8 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +152 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/FunnelRoutes.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +3 -3
- package/dist/index.d.ts +89 -5
- package/package.json +1 -1
- package/src/api/Funnel.ts +92 -0
- package/src/api/Media.ts +5 -5
- package/src/api/Scheduler.ts +14 -0
- package/src/api/Titles.ts +14 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +2 -0
- package/src/routes/FunnelRoutes.ts +18 -0
- package/src/routes/SchedulerRoute.ts +2 -0
- package/src/routes/TitlesRoute.ts +2 -0
- package/src/util/Requests.ts +39 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosPromise } from 'axios';
|
|
1
|
+
import { AxiosPromise, AxiosProgressEvent } from 'axios';
|
|
2
2
|
import Config from '../config/Config';
|
|
3
3
|
import Route from '../routes/interface';
|
|
4
4
|
import Response from './Response';
|
|
@@ -16,8 +16,8 @@ declare class Requests {
|
|
|
16
16
|
static post<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
17
17
|
static put<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
18
18
|
static delete<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
19
|
-
static uploadFile<T>(url: string, filename: string, file: File | Blob, data?: any, params?: Record<string, any
|
|
20
|
-
static uploadBlob<T>(url: string, filename: string, blob: Blob, data?: any, params?: Record<string, any
|
|
19
|
+
static uploadFile<T>(url: string, filename: string, file: File | Blob, data?: any, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
20
|
+
static uploadBlob<T>(url: string, filename: string, blob: Blob, data?: any, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
21
21
|
static uploadFileInChunks<T>(file: File, uploadUrl: string, onProgress?: (totalSize: number, amountUploaded: number) => void, data?: any, chunkSize?: number): Promise<void>;
|
|
22
22
|
static processRoute<T>(route: Route, data?: object, routeReplace?: {
|
|
23
23
|
[key: string]: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosPromise } from 'axios';
|
|
1
|
+
import { AxiosPromise, AxiosProgressEvent } from 'axios';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Config
|
|
@@ -2792,6 +2792,14 @@ declare class Titles {
|
|
|
2792
2792
|
* @returns promise
|
|
2793
2793
|
*/
|
|
2794
2794
|
static uploadBannerImageBlob<T>(title_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2795
|
+
/**
|
|
2796
|
+
* Add media to a title.
|
|
2797
|
+
*/
|
|
2798
|
+
static addMedia<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2799
|
+
/**
|
|
2800
|
+
* Remove media from a title.
|
|
2801
|
+
*/
|
|
2802
|
+
static removeMedia<T>(title_id: string, media_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
2795
2803
|
}
|
|
2796
2804
|
|
|
2797
2805
|
declare class Campaigns {
|
|
@@ -3901,7 +3909,7 @@ declare class Media {
|
|
|
3901
3909
|
*
|
|
3902
3910
|
* @returns promise
|
|
3903
3911
|
*/
|
|
3904
|
-
static uploadFile<T>(file: File, data?: object, params?: Record<string, any
|
|
3912
|
+
static uploadFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
3905
3913
|
/**
|
|
3906
3914
|
* Upload media content using a Blob.
|
|
3907
3915
|
*
|
|
@@ -3912,7 +3920,7 @@ declare class Media {
|
|
|
3912
3920
|
*
|
|
3913
3921
|
* @returns promise
|
|
3914
3922
|
*/
|
|
3915
|
-
static uploadBlob<T>(blob: Blob, data?: object, params?: Record<string, any
|
|
3923
|
+
static uploadBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
3916
3924
|
/**
|
|
3917
3925
|
* Get media details.
|
|
3918
3926
|
*
|
|
@@ -3975,6 +3983,17 @@ declare class Scheduler {
|
|
|
3975
3983
|
* @returns promise
|
|
3976
3984
|
*/
|
|
3977
3985
|
static deleteSchedule<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3986
|
+
/**
|
|
3987
|
+
* Test the tone of the scheduler.
|
|
3988
|
+
*
|
|
3989
|
+
* @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitlePromotionSchedule
|
|
3990
|
+
*
|
|
3991
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
3992
|
+
* @param data The data to update.
|
|
3993
|
+
*
|
|
3994
|
+
* @returns promise
|
|
3995
|
+
*/
|
|
3996
|
+
static testTone<T>(scheduler_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
3978
3997
|
/**
|
|
3979
3998
|
* Get social media posts related to a promotion schedule.
|
|
3980
3999
|
*
|
|
@@ -4176,6 +4195,70 @@ declare class Scheduler {
|
|
|
4176
4195
|
static getDiscordChannels<T>(scheduler_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4177
4196
|
}
|
|
4178
4197
|
|
|
4198
|
+
declare class Funnel {
|
|
4199
|
+
/**
|
|
4200
|
+
* Get funnel metrics.
|
|
4201
|
+
*
|
|
4202
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels
|
|
4203
|
+
*
|
|
4204
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
4205
|
+
* @returns Promise with funnel metrics data
|
|
4206
|
+
*/
|
|
4207
|
+
static index<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4208
|
+
/**
|
|
4209
|
+
* Get funnel-optimized metrics.
|
|
4210
|
+
*
|
|
4211
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_funnel
|
|
4212
|
+
*
|
|
4213
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
4214
|
+
* @returns Promise with funnel data optimized for visual funnels
|
|
4215
|
+
*/
|
|
4216
|
+
static funnel<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4217
|
+
/**
|
|
4218
|
+
* Get available metrics.
|
|
4219
|
+
*
|
|
4220
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_metrics
|
|
4221
|
+
*
|
|
4222
|
+
* @returns Promise with list of available metrics
|
|
4223
|
+
*/
|
|
4224
|
+
static metrics<T>(): AxiosPromise<Response<T>>;
|
|
4225
|
+
/**
|
|
4226
|
+
* Get available stages.
|
|
4227
|
+
*
|
|
4228
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_stages
|
|
4229
|
+
*
|
|
4230
|
+
* @returns Promise with list of available stages
|
|
4231
|
+
*/
|
|
4232
|
+
static stages<T>(): AxiosPromise<Response<T>>;
|
|
4233
|
+
/**
|
|
4234
|
+
* Get daily funnel metrics.
|
|
4235
|
+
*
|
|
4236
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_daily
|
|
4237
|
+
*
|
|
4238
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
4239
|
+
* @returns Promise with daily funnel metrics data
|
|
4240
|
+
*/
|
|
4241
|
+
static daily<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4242
|
+
/**
|
|
4243
|
+
* Get monthly funnel metrics.
|
|
4244
|
+
*
|
|
4245
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_monthly
|
|
4246
|
+
*
|
|
4247
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
4248
|
+
* @returns Promise with monthly funnel metrics data
|
|
4249
|
+
*/
|
|
4250
|
+
static monthly<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4251
|
+
/**
|
|
4252
|
+
* Get yearly funnel metrics.
|
|
4253
|
+
*
|
|
4254
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_yearly
|
|
4255
|
+
*
|
|
4256
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
4257
|
+
* @returns Promise with yearly funnel metrics data
|
|
4258
|
+
*/
|
|
4259
|
+
static yearly<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4260
|
+
}
|
|
4261
|
+
|
|
4179
4262
|
interface Route {
|
|
4180
4263
|
url: string;
|
|
4181
4264
|
method: string;
|
|
@@ -4195,8 +4278,8 @@ declare class Requests {
|
|
|
4195
4278
|
static post<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4196
4279
|
static put<T>(url: string, data: any, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4197
4280
|
static delete<T>(url: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
4198
|
-
static uploadFile<T>(url: string, filename: string, file: File | Blob, data?: any, params?: Record<string, any
|
|
4199
|
-
static uploadBlob<T>(url: string, filename: string, blob: Blob, data?: any, params?: Record<string, any
|
|
4281
|
+
static uploadFile<T>(url: string, filename: string, file: File | Blob, data?: any, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
4282
|
+
static uploadBlob<T>(url: string, filename: string, blob: Blob, data?: any, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>>;
|
|
4200
4283
|
static uploadFileInChunks<T>(file: File, uploadUrl: string, onProgress?: (totalSize: number, amountUploaded: number) => void, data?: any, chunkSize?: number): Promise<void>;
|
|
4201
4284
|
static processRoute<T>(route: Route, data?: object, routeReplace?: {
|
|
4202
4285
|
[key: string]: any;
|
|
@@ -4504,6 +4587,7 @@ declare class Glitch {
|
|
|
4504
4587
|
PlayTests: typeof PlayTests;
|
|
4505
4588
|
Media: typeof Media;
|
|
4506
4589
|
Scheduler: typeof Scheduler;
|
|
4590
|
+
Funnel: typeof Funnel;
|
|
4507
4591
|
};
|
|
4508
4592
|
static util: {
|
|
4509
4593
|
Requests: typeof Requests;
|
package/package.json
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// src/controllers/Funnel.tsx
|
|
2
|
+
|
|
3
|
+
import FunnelRoutes from "../routes/FunnelRoutes";
|
|
4
|
+
import Requests from "../util/Requests";
|
|
5
|
+
import Response from "../util/Response";
|
|
6
|
+
import { AxiosPromise } from "axios";
|
|
7
|
+
|
|
8
|
+
class Funnel {
|
|
9
|
+
/**
|
|
10
|
+
* Get funnel metrics.
|
|
11
|
+
*
|
|
12
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels
|
|
13
|
+
*
|
|
14
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
15
|
+
* @returns Promise with funnel metrics data
|
|
16
|
+
*/
|
|
17
|
+
public static index<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
18
|
+
return Requests.processRoute(FunnelRoutes.routes.index, undefined, undefined, params);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Get funnel-optimized metrics.
|
|
23
|
+
*
|
|
24
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_funnel
|
|
25
|
+
*
|
|
26
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
27
|
+
* @returns Promise with funnel data optimized for visual funnels
|
|
28
|
+
*/
|
|
29
|
+
public static funnel<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
30
|
+
return Requests.processRoute(FunnelRoutes.routes.funnel, undefined, undefined, params);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get available metrics.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_metrics
|
|
37
|
+
*
|
|
38
|
+
* @returns Promise with list of available metrics
|
|
39
|
+
*/
|
|
40
|
+
public static metrics<T>(): AxiosPromise<Response<T>> {
|
|
41
|
+
return Requests.processRoute(FunnelRoutes.routes.metrics);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get available stages.
|
|
46
|
+
*
|
|
47
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_stages
|
|
48
|
+
*
|
|
49
|
+
* @returns Promise with list of available stages
|
|
50
|
+
*/
|
|
51
|
+
public static stages<T>(): AxiosPromise<Response<T>> {
|
|
52
|
+
return Requests.processRoute(FunnelRoutes.routes.stages);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get daily funnel metrics.
|
|
57
|
+
*
|
|
58
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_daily
|
|
59
|
+
*
|
|
60
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
61
|
+
* @returns Promise with daily funnel metrics data
|
|
62
|
+
*/
|
|
63
|
+
public static daily<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
64
|
+
return Requests.processRoute(FunnelRoutes.routes.daily, undefined, undefined, params);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get monthly funnel metrics.
|
|
69
|
+
*
|
|
70
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_monthly
|
|
71
|
+
*
|
|
72
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
73
|
+
* @returns Promise with monthly funnel metrics data
|
|
74
|
+
*/
|
|
75
|
+
public static monthly<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
76
|
+
return Requests.processRoute(FunnelRoutes.routes.monthly, undefined, undefined, params);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get yearly funnel metrics.
|
|
81
|
+
*
|
|
82
|
+
* @see https://api.glitch.fun/api/documentation#/Funnel%20Metrics/get_funnels_yearly
|
|
83
|
+
*
|
|
84
|
+
* @param params Query parameters for filtering (title_id, community_id, start_date, end_date)
|
|
85
|
+
* @returns Promise with yearly funnel metrics data
|
|
86
|
+
*/
|
|
87
|
+
public static yearly<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
88
|
+
return Requests.processRoute(FunnelRoutes.routes.yearly, undefined, undefined, params);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default Funnel;
|
package/src/api/Media.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import MediaRoute from "../routes/MediaRoute";
|
|
2
2
|
import Requests from "../util/Requests";
|
|
3
3
|
import Response from "../util/Response";
|
|
4
|
-
import { AxiosPromise } from "axios";
|
|
4
|
+
import { AxiosProgressEvent, AxiosPromise } from "axios";
|
|
5
5
|
|
|
6
6
|
class Media {
|
|
7
7
|
/**
|
|
@@ -14,8 +14,8 @@ class Media {
|
|
|
14
14
|
*
|
|
15
15
|
* @returns promise
|
|
16
16
|
*/
|
|
17
|
-
public static uploadFile<T>(file: File, data?: object, params?: Record<string, any
|
|
18
|
-
return Requests.uploadFile(MediaRoute.routes.upload.url, 'media', file, data, params);
|
|
17
|
+
public static uploadFile<T>(file: File, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>> {
|
|
18
|
+
return Requests.uploadFile(MediaRoute.routes.upload.url, 'media', file, data, params, onUploadProgress);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -28,8 +28,8 @@ class Media {
|
|
|
28
28
|
*
|
|
29
29
|
* @returns promise
|
|
30
30
|
*/
|
|
31
|
-
public static uploadBlob<T>(blob: Blob, data?: object, params?: Record<string, any
|
|
32
|
-
return Requests.uploadBlob(MediaRoute.routes.upload.url, 'media', blob, data, params);
|
|
31
|
+
public static uploadBlob<T>(blob: Blob, data?: object, params?: Record<string, any>, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): AxiosPromise<Response<T>> {
|
|
32
|
+
return Requests.uploadBlob(MediaRoute.routes.upload.url, 'media', blob, data, params, onUploadProgress);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
package/src/api/Scheduler.ts
CHANGED
|
@@ -68,6 +68,20 @@ class Scheduler {
|
|
|
68
68
|
return Requests.processRoute(SchedulerRoute.routes.deleteSchedule, {}, { scheduler_id }, params);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Test the tone of the scheduler.
|
|
73
|
+
*
|
|
74
|
+
* @see https://api.glitch.fun/api/documentation#/Scheduler/updateTitlePromotionSchedule
|
|
75
|
+
*
|
|
76
|
+
* @param scheduler_id The ID of the promotion schedule.
|
|
77
|
+
* @param data The data to update.
|
|
78
|
+
*
|
|
79
|
+
* @returns promise
|
|
80
|
+
*/
|
|
81
|
+
public static testTone<T>(scheduler_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
82
|
+
return Requests.processRoute(SchedulerRoute.routes.testTone, data, { scheduler_id }, params);
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
/**
|
|
72
86
|
* Get social media posts related to a promotion schedule.
|
|
73
87
|
*
|
package/src/api/Titles.ts
CHANGED
|
@@ -196,6 +196,20 @@ class Titles {
|
|
|
196
196
|
return Requests.uploadBlob(url, 'image', blob, data);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Add media to a title.
|
|
201
|
+
*/
|
|
202
|
+
public static addMedia<T>(title_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
203
|
+
return Requests.processRoute(TitlesRoute.routes.addMedia, data, { title_id: title_id }, params);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Remove media from a title.
|
|
208
|
+
*/
|
|
209
|
+
public static removeMedia<T>(title_id: string, media_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
|
|
210
|
+
return Requests.processRoute(TitlesRoute.routes.removeMedia, {}, { title_id: title_id, media_id: media_id }, params);
|
|
211
|
+
}
|
|
212
|
+
|
|
199
213
|
}
|
|
200
214
|
|
|
201
215
|
export default Titles;
|
package/src/api/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ import Newsletters from "./Newsletters"
|
|
|
27
27
|
import PlayTests from "./PlayTests";
|
|
28
28
|
import Media from "./Media";
|
|
29
29
|
import Scheduler from "./Scheduler";
|
|
30
|
+
import Funnel from "./Funnel";
|
|
30
31
|
|
|
31
32
|
export {Auth};
|
|
32
33
|
export {Competitions};
|
|
@@ -56,4 +57,5 @@ export {GameShows};
|
|
|
56
57
|
export {Newsletters};
|
|
57
58
|
export {PlayTests};
|
|
58
59
|
export {Media};
|
|
59
|
-
export {Scheduler};
|
|
60
|
+
export {Scheduler};
|
|
61
|
+
export {Funnel};
|
package/src/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {Newsletters} from "./api";
|
|
|
31
31
|
import {PlayTests} from "./api";
|
|
32
32
|
import {Media} from "./api";
|
|
33
33
|
import {Scheduler} from "./api";
|
|
34
|
+
import {Funnel} from "./api";
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
|
|
@@ -93,6 +94,7 @@ class Glitch {
|
|
|
93
94
|
PlayTests : PlayTests,
|
|
94
95
|
Media : Media,
|
|
95
96
|
Scheduler : Scheduler,
|
|
97
|
+
Funnel: Funnel,
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
public static util = {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/routes/FunnelRoutes.tsx
|
|
2
|
+
|
|
3
|
+
import Route from "./interface";
|
|
4
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
5
|
+
|
|
6
|
+
class FunnelRoutes {
|
|
7
|
+
public static routes: { [key: string]: Route } = {
|
|
8
|
+
index: { url: '/funnels', method: HTTP_METHODS.GET },
|
|
9
|
+
funnel: { url: '/funnels/funnel', method: HTTP_METHODS.GET },
|
|
10
|
+
metrics: { url: '/funnels/metrics', method: HTTP_METHODS.GET },
|
|
11
|
+
stages: { url: '/funnels/stages', method: HTTP_METHODS.GET },
|
|
12
|
+
daily: { url: '/funnels/daily', method: HTTP_METHODS.GET },
|
|
13
|
+
monthly: { url: '/funnels/monthly', method: HTTP_METHODS.GET },
|
|
14
|
+
yearly: { url: '/funnels/yearly', method: HTTP_METHODS.GET },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default FunnelRoutes;
|
|
@@ -18,6 +18,8 @@ class SchedulerRoute {
|
|
|
18
18
|
updateUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}', method: HTTP_METHODS.PUT },
|
|
19
19
|
deleteUpdate: { url: '/schedulers/{scheduler_id}/updates/{update_id}', method: HTTP_METHODS.DELETE },
|
|
20
20
|
|
|
21
|
+
testTone: { url: '/schedulers/{scheduler_id}/tone', method: HTTP_METHODS.POST },
|
|
22
|
+
|
|
21
23
|
// Clear OAuth Routes
|
|
22
24
|
clearTwitterAuth: { url: '/schedulers/{scheduler_id}/clearTwitterAuth', method: HTTP_METHODS.DELETE },
|
|
23
25
|
clearFacebookAuth: { url: '/schedulers/{scheduler_id}/clearFacebookAuth', method: HTTP_METHODS.DELETE },
|
|
@@ -15,6 +15,8 @@ class TitlesRoute {
|
|
|
15
15
|
uploadBannerImage : {url : '/titles/{title_id}/uploadBannerImage', method: HTTP_METHODS.POST},
|
|
16
16
|
addAdministrator : { url: '/titles/{title_id}/addAdministrator', method: HTTP_METHODS.POST },
|
|
17
17
|
removeAdministrator : { url: '/titles/{title_id}/removeAdministrator/{user_id}', method: HTTP_METHODS.DELETE },
|
|
18
|
+
addMedia: { url: '/titles/{title_id}/addMedia', method: HTTP_METHODS.POST },
|
|
19
|
+
removeMedia: { url: '/titles/{title_id}/removeMedia/{media_id}', method: HTTP_METHODS.DELETE },
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
}
|
package/src/util/Requests.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import axios, { AxiosPromise } from 'axios';
|
|
1
|
+
import axios, { AxiosPromise, AxiosRequestConfig, AxiosProgressEvent } from 'axios';
|
|
2
2
|
import Config from '../config/Config';
|
|
3
3
|
import HTTP_METHODS from '../constants/HttpMethods';
|
|
4
4
|
import Route from '../routes/interface';
|
|
@@ -140,7 +140,8 @@ class Requests {
|
|
|
140
140
|
filename: string,
|
|
141
141
|
file: File | Blob,
|
|
142
142
|
data?: any,
|
|
143
|
-
params?: Record<string, any
|
|
143
|
+
params?: Record<string, any>,
|
|
144
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void // Correct type here
|
|
144
145
|
): AxiosPromise<Response<T>> {
|
|
145
146
|
if (params && Object.keys(params).length > 0) {
|
|
146
147
|
const queryString = Object.entries(params)
|
|
@@ -148,31 +149,43 @@ class Requests {
|
|
|
148
149
|
.join('&');
|
|
149
150
|
url = `${url}?${queryString}`;
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
+
|
|
152
153
|
const formData = new FormData();
|
|
153
|
-
|
|
154
154
|
formData.append(filename, file);
|
|
155
|
-
|
|
155
|
+
|
|
156
156
|
if (Requests.community_id) {
|
|
157
157
|
data = {
|
|
158
158
|
...data,
|
|
159
159
|
communities: [Requests.community_id],
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
|
|
163
163
|
for (let key in data) {
|
|
164
164
|
formData.append(key, data[key]);
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
|
|
167
|
+
const config: AxiosRequestConfig = {
|
|
168
|
+
method: 'POST',
|
|
169
|
+
url,
|
|
170
|
+
data: formData,
|
|
171
|
+
headers: {
|
|
172
|
+
'Content-Type': 'multipart/form-data',
|
|
173
|
+
...(Requests.authToken && { Authorization: `Bearer ${Requests.authToken}` }),
|
|
174
|
+
},
|
|
175
|
+
onUploadProgress, // Pass directly, as the type now matches
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return axios(config);
|
|
168
179
|
}
|
|
169
180
|
|
|
181
|
+
// Modify uploadBlob method
|
|
170
182
|
public static uploadBlob<T>(
|
|
171
183
|
url: string,
|
|
172
184
|
filename: string,
|
|
173
185
|
blob: Blob,
|
|
174
186
|
data?: any,
|
|
175
|
-
params?: Record<string, any
|
|
187
|
+
params?: Record<string, any>,
|
|
188
|
+
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void // Corrected type
|
|
176
189
|
): AxiosPromise<Response<T>> {
|
|
177
190
|
if (params && Object.keys(params).length > 0) {
|
|
178
191
|
const queryString = Object.entries(params)
|
|
@@ -180,25 +193,35 @@ class Requests {
|
|
|
180
193
|
.join('&');
|
|
181
194
|
url = `${url}?${queryString}`;
|
|
182
195
|
}
|
|
183
|
-
|
|
196
|
+
|
|
184
197
|
const formData = new FormData();
|
|
185
|
-
|
|
186
198
|
formData.append(filename, blob);
|
|
187
|
-
|
|
199
|
+
|
|
188
200
|
if (Requests.community_id) {
|
|
189
201
|
data = {
|
|
190
202
|
...data,
|
|
191
203
|
communities: [Requests.community_id],
|
|
192
204
|
};
|
|
193
205
|
}
|
|
194
|
-
|
|
206
|
+
|
|
195
207
|
for (let key in data) {
|
|
196
208
|
formData.append(key, data[key]);
|
|
197
209
|
}
|
|
198
|
-
|
|
199
|
-
|
|
210
|
+
|
|
211
|
+
const config: AxiosRequestConfig = {
|
|
212
|
+
method: 'POST',
|
|
213
|
+
url,
|
|
214
|
+
data: formData,
|
|
215
|
+
headers: {
|
|
216
|
+
'Content-Type': 'multipart/form-data',
|
|
217
|
+
...(Requests.authToken && { Authorization: `Bearer ${Requests.authToken}` }),
|
|
218
|
+
},
|
|
219
|
+
onUploadProgress, // Pass directly
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
return axios(config);
|
|
200
223
|
}
|
|
201
|
-
|
|
224
|
+
|
|
202
225
|
// Method adapted for browser environments
|
|
203
226
|
|
|
204
227
|
public static async uploadFileInChunks<T>(
|