@opexa/portal-sdk 0.59.70 → 0.59.72
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 +1634 -1634
- package/dist/{chunk-7APXFZ5G.js → chunk-5WRVWQBT.js} +3 -3
- package/dist/chunk-5WRVWQBT.js.map +1 -0
- package/dist/{chunk-6HOHUQZK.js → chunk-MQC7EE6J.js} +129 -22
- package/dist/chunk-MQC7EE6J.js.map +1 -0
- package/dist/{chunk-WVFSGB7Y.js → chunk-ROBGEUSE.js} +2 -2
- package/dist/chunk-ROBGEUSE.js.map +1 -0
- package/dist/index.cjs +186 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +63 -3
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +126 -19
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +7 -3
- package/dist/services/index.d.ts +7 -3
- package/dist/services/index.js +2 -2
- package/dist/{types-BGlY5DyB.d.ts → types-B8RFcTu9.d.ts} +31 -3
- package/dist/{types-CACLx3DN.d.cts → types-BqFODW6R.d.cts} +31 -3
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-6HOHUQZK.js.map +0 -1
- package/dist/chunk-7APXFZ5G.js.map +0 -1
- package/dist/chunk-WVFSGB7Y.js.map +0 -1
|
@@ -39,5 +39,5 @@ function callIfFn(value, ...args) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export { callIfFn, gql, statusCodeToOperationError };
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-ROBGEUSE.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-ROBGEUSE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/gql.ts","../src/ut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uBAAA;AAClD,CAAA;;;ACtBA,SAAS,WACR,KAAA,EACuC;AACvC,EAAA,OAAO,OAAO,KAAA,KAAU,UAAA;AACzB;AAEO,SAAS,QAAA,CACf,UACG,IAAA,EACF;AACD,EAAA,IAAI,UAAA,CAAyB,KAAK,CAAA,EAAG;AACpC,IAAA,OAAO,KAAA,CAAM,GAAG,IAAI,CAAA;AAAA,EACrB,CAAA,MAAO;AACN,IAAA,OAAO,KAAA;AAAA,EACR;AACD","file":"chunk-ROBGEUSE.js","sourcesContent":["export function gql(strings: TemplateStringsArray, ...values: unknown[]) {\n\tlet result = '';\n\n\tfor (const [index, string] of strings.entries()) {\n\t\tconst value = values.at(index) ?? '';\n\n\t\tresult = `${result}${string}${value}`;\n\t}\n\n\treturn result.trim();\n}\n","import type { HttpError, OperationError } from '../types/index.js';\n\nexport function statusCodeToOperationError(\n\tvalue: number,\n\tmessage?: string,\n): OperationError<HttpError> {\n\tconst e = ERROR_MAP[value] ? ERROR_MAP[value] : ERROR_MAP[500];\n\n\treturn {\n\t\tname: e.name,\n\t\tmessage: message ?? e.message,\n\t};\n}\n\nconst ERROR_MAP: Record<number, OperationError<HttpError>> = {\n\t400: { name: 'HttpBadRequest', message: 'Bad Request' },\n\t401: { name: 'HttpUnauthorized', message: 'Unauthorized' },\n\t403: { name: 'HttpForbidden', message: 'Forbidden' },\n\t404: { name: 'HttpNotFound', message: 'Not Found' },\n\t408: { name: 'HttpRequestTimeout', message: 'Request Timeout' },\n\t429: { name: 'HttpTooManyRequests', message: 'Too Many Requests' },\n\t500: { name: 'HttpInternalServerError', message: 'Internal Server Error' },\n};\n","function isFunction<Return, Args = never>(\n\tvalue: unknown | ((...args: Args[]) => Return),\n): value is (...args: Args[]) => Return {\n\treturn typeof value === 'function';\n}\n\nexport function callIfFn<Return, Args = never>(\n\tvalue: Return | ((...args: Args[]) => Return),\n\t...args: Args[]\n) {\n\tif (isFunction<Return, Args>(value)) {\n\t\treturn value(...args);\n\t} else {\n\t\treturn value;\n\t}\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -925,9 +925,9 @@ var CREATE_GCASH_WEBPAY_DEPOSIT_MUTATION = gql`
|
|
|
925
925
|
... on WalletDoesNotExistError {
|
|
926
926
|
__typename
|
|
927
927
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
928
|
+
... on InsufficientAgentBalanceError {
|
|
929
|
+
__typename
|
|
930
|
+
}
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
933
|
`;
|
|
@@ -982,6 +982,9 @@ var CREATE_MAYA_DEPOSIT_MUTATION = gql`
|
|
|
982
982
|
... on WalletDoesNotExistError {
|
|
983
983
|
__typename
|
|
984
984
|
}
|
|
985
|
+
... on InsufficientAgentBalanceError {
|
|
986
|
+
__typename
|
|
987
|
+
}
|
|
985
988
|
}
|
|
986
989
|
}
|
|
987
990
|
`;
|
|
@@ -1009,9 +1012,9 @@ var CREATE_TEST_DEPOSIT_MUTATION = gql`
|
|
|
1009
1012
|
... on WalletDoesNotExistError {
|
|
1010
1013
|
__typename
|
|
1011
1014
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
+
... on InsufficientAgentBalanceError {
|
|
1016
|
+
__typename
|
|
1017
|
+
}
|
|
1015
1018
|
}
|
|
1016
1019
|
}
|
|
1017
1020
|
`;
|
|
@@ -1069,6 +1072,9 @@ var CREATE_AIO_QRPH_DEPOSIT_MUTATION = gql`
|
|
|
1069
1072
|
... on ReCAPTCHAVerificationFailedError {
|
|
1070
1073
|
__typename
|
|
1071
1074
|
}
|
|
1075
|
+
... on InsufficientAgentBalanceError {
|
|
1076
|
+
__typename
|
|
1077
|
+
}
|
|
1072
1078
|
}
|
|
1073
1079
|
}
|
|
1074
1080
|
`;
|
|
@@ -1096,9 +1102,9 @@ var CREATE_AIO_GCASH_DEPOSIT_MUTATION = gql`
|
|
|
1096
1102
|
... on WalletDoesNotExistError {
|
|
1097
1103
|
__typename
|
|
1098
1104
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1105
|
+
... on InsufficientAgentBalanceError {
|
|
1106
|
+
__typename
|
|
1107
|
+
}
|
|
1102
1108
|
}
|
|
1103
1109
|
}
|
|
1104
1110
|
`;
|
|
@@ -1126,9 +1132,9 @@ var CREATE_AIO_PAY_MAYA_DEPOSIT_MUTATION = gql`
|
|
|
1126
1132
|
... on WalletDoesNotExistError {
|
|
1127
1133
|
__typename
|
|
1128
1134
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1135
|
+
... on InsufficientAgentBalanceError {
|
|
1136
|
+
__typename
|
|
1137
|
+
}
|
|
1132
1138
|
}
|
|
1133
1139
|
}
|
|
1134
1140
|
`;
|
|
@@ -1156,9 +1162,9 @@ var CREATE_AIO_GRAB_PAY_DEPOSIT_MUTATION = gql`
|
|
|
1156
1162
|
... on WalletDoesNotExistError {
|
|
1157
1163
|
__typename
|
|
1158
1164
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1165
|
+
... on InsufficientAgentBalanceError {
|
|
1166
|
+
__typename
|
|
1167
|
+
}
|
|
1162
1168
|
}
|
|
1163
1169
|
}
|
|
1164
1170
|
`;
|
|
@@ -1188,9 +1194,9 @@ var CREATE_AIO_PALAWAN_PAY_DEPOSIT_MUTATION = gql`
|
|
|
1188
1194
|
... on WalletDoesNotExistError {
|
|
1189
1195
|
__typename
|
|
1190
1196
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1197
|
+
... on InsufficientAgentBalanceError {
|
|
1198
|
+
__typename
|
|
1199
|
+
}
|
|
1194
1200
|
}
|
|
1195
1201
|
}
|
|
1196
1202
|
`;
|
|
@@ -1220,6 +1226,9 @@ var CREATE_AIO_ONLINE_BANK_DEPOSIT_MUTATION = gql`
|
|
|
1220
1226
|
... on WalletDoesNotExistError {
|
|
1221
1227
|
__typename
|
|
1222
1228
|
}
|
|
1229
|
+
... on InsufficientAgentBalanceError {
|
|
1230
|
+
__typename
|
|
1231
|
+
}
|
|
1223
1232
|
}
|
|
1224
1233
|
}
|
|
1225
1234
|
`;
|
|
@@ -1253,6 +1262,9 @@ var CREATE_MANUAL_BANK_DEPOSIT_MUTATION = gql`
|
|
|
1253
1262
|
... on FileNotReadyError {
|
|
1254
1263
|
__typename
|
|
1255
1264
|
}
|
|
1265
|
+
... on InsufficientAgentBalanceError {
|
|
1266
|
+
__typename
|
|
1267
|
+
}
|
|
1256
1268
|
}
|
|
1257
1269
|
}
|
|
1258
1270
|
`;
|
|
@@ -1283,6 +1295,9 @@ var CREATE_MANUAL_UPI_DEPOSIT_MUTATION = gql`
|
|
|
1283
1295
|
... on UPIReferenceNotAvailableError {
|
|
1284
1296
|
__typename
|
|
1285
1297
|
}
|
|
1298
|
+
... on InsufficientAgentBalanceError {
|
|
1299
|
+
__typename
|
|
1300
|
+
}
|
|
1286
1301
|
}
|
|
1287
1302
|
}
|
|
1288
1303
|
`;
|
|
@@ -3325,6 +3340,30 @@ var FAVORITE_GAMES_QUERY = gql`
|
|
|
3325
3340
|
}
|
|
3326
3341
|
}
|
|
3327
3342
|
`;
|
|
3343
|
+
var FAVORITE_GAMES_QUERY__NEXT = gql`
|
|
3344
|
+
query FavoriteGames {
|
|
3345
|
+
favoriteGames {
|
|
3346
|
+
id
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
`;
|
|
3350
|
+
var RECENT_GAMES_QUERY = gql`
|
|
3351
|
+
query RecentGames {
|
|
3352
|
+
recentGames {
|
|
3353
|
+
id
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
`;
|
|
3357
|
+
var ADD_FAVORITE_GAME_MUTATION = gql`
|
|
3358
|
+
mutation AddFavoriteGame($game: ObjectId!) {
|
|
3359
|
+
addFavoriteGame(input: { game: $game })
|
|
3360
|
+
}
|
|
3361
|
+
`;
|
|
3362
|
+
var REMOVE_FAVORITE_GAME_MUTATION = gql`
|
|
3363
|
+
mutation RemoveFavoriteGame($game: ObjectId!) {
|
|
3364
|
+
removeFavoriteGame(input: { game: $game })
|
|
3365
|
+
}
|
|
3366
|
+
`;
|
|
3328
3367
|
var WALLET_GAMES_QUERY = gql`
|
|
3329
3368
|
query Games($first: Int $after: Cursor, $filter: GameFilterInput) {
|
|
3330
3369
|
games(first: $first, after: $after, filter: $filter) {
|
|
@@ -3759,7 +3798,7 @@ function createOperationError(code) {
|
|
|
3759
3798
|
RateLimitExceededError: "Maximum number of requests reached",
|
|
3760
3799
|
RewardAlreadyClaimedError: "Reward is already claimed",
|
|
3761
3800
|
ReCAPTCHAVerificationFailedError: "Invalid reCAPTCHA",
|
|
3762
|
-
|
|
3801
|
+
InsufficientAgentBalanceError: "Insufficient agent balance",
|
|
3763
3802
|
AccountSuspendedError: "Account is suspended",
|
|
3764
3803
|
TransactionPasswordNotSetError: "Transaction password is not set",
|
|
3765
3804
|
UPIReferenceNotAvailableError: "UPI reference is no longer available",
|
|
@@ -5063,6 +5102,74 @@ var PortalService = class {
|
|
|
5063
5102
|
data: res.data.recommendedGames
|
|
5064
5103
|
};
|
|
5065
5104
|
}
|
|
5105
|
+
async favoriteGames() {
|
|
5106
|
+
const res = await this.client.request(
|
|
5107
|
+
FAVORITE_GAMES_QUERY__NEXT
|
|
5108
|
+
);
|
|
5109
|
+
if (!res.ok) return res;
|
|
5110
|
+
if (!res.data.favoriteGames) {
|
|
5111
|
+
return {
|
|
5112
|
+
ok: false,
|
|
5113
|
+
error: {
|
|
5114
|
+
name: "UnknownError",
|
|
5115
|
+
message: "Something went wrong."
|
|
5116
|
+
}
|
|
5117
|
+
};
|
|
5118
|
+
}
|
|
5119
|
+
return {
|
|
5120
|
+
ok: true,
|
|
5121
|
+
data: res.data.favoriteGames
|
|
5122
|
+
};
|
|
5123
|
+
}
|
|
5124
|
+
async recentGames() {
|
|
5125
|
+
const res = await this.client.request(RECENT_GAMES_QUERY);
|
|
5126
|
+
if (!res.ok) return res;
|
|
5127
|
+
if (!res.data.recentGames) {
|
|
5128
|
+
return {
|
|
5129
|
+
ok: false,
|
|
5130
|
+
error: {
|
|
5131
|
+
name: "UnknownError",
|
|
5132
|
+
message: "Something went wrong."
|
|
5133
|
+
}
|
|
5134
|
+
};
|
|
5135
|
+
}
|
|
5136
|
+
return {
|
|
5137
|
+
ok: true,
|
|
5138
|
+
data: res.data.recentGames
|
|
5139
|
+
};
|
|
5140
|
+
}
|
|
5141
|
+
async addFavoriteGame(variables) {
|
|
5142
|
+
const res = await this.client.request(ADD_FAVORITE_GAME_MUTATION, variables);
|
|
5143
|
+
if (!res.ok) return res;
|
|
5144
|
+
if (!res.data.addFavoriteGame) {
|
|
5145
|
+
return {
|
|
5146
|
+
ok: false,
|
|
5147
|
+
error: {
|
|
5148
|
+
name: "UnknownError",
|
|
5149
|
+
message: "Something went wrong."
|
|
5150
|
+
}
|
|
5151
|
+
};
|
|
5152
|
+
}
|
|
5153
|
+
return {
|
|
5154
|
+
ok: true
|
|
5155
|
+
};
|
|
5156
|
+
}
|
|
5157
|
+
async removeFavoriteGame(variables) {
|
|
5158
|
+
const res = await this.client.request(REMOVE_FAVORITE_GAME_MUTATION, variables);
|
|
5159
|
+
if (!res.ok) return res;
|
|
5160
|
+
if (!res.data.removeFavoriteGame) {
|
|
5161
|
+
return {
|
|
5162
|
+
ok: false,
|
|
5163
|
+
error: {
|
|
5164
|
+
name: "UnknownError",
|
|
5165
|
+
message: "Something went wrong."
|
|
5166
|
+
}
|
|
5167
|
+
};
|
|
5168
|
+
}
|
|
5169
|
+
return {
|
|
5170
|
+
ok: true
|
|
5171
|
+
};
|
|
5172
|
+
}
|
|
5066
5173
|
async onboardingStatus() {
|
|
5067
5174
|
const res = await this.client.request(
|
|
5068
5175
|
ONBOARDING_STATUS_QUERY
|
|
@@ -11486,6 +11593,66 @@ var Sdk = class {
|
|
|
11486
11593
|
}).filter(Boolean) ?? []
|
|
11487
11594
|
};
|
|
11488
11595
|
}
|
|
11596
|
+
async favoriteGames__next() {
|
|
11597
|
+
const res0 = await this.portalService.favoriteGames();
|
|
11598
|
+
const ids = res0.data?.length ? [...new Set(res0.data.map((e) => e.id))] : [];
|
|
11599
|
+
if (ids.length <= 0) {
|
|
11600
|
+
return {
|
|
11601
|
+
ok: true,
|
|
11602
|
+
data: []
|
|
11603
|
+
};
|
|
11604
|
+
}
|
|
11605
|
+
const res1 = await this.cmsPortalService.games({
|
|
11606
|
+
filter: {
|
|
11607
|
+
reference: {
|
|
11608
|
+
in: ids
|
|
11609
|
+
}
|
|
11610
|
+
}
|
|
11611
|
+
});
|
|
11612
|
+
if (!res1.ok) return res1;
|
|
11613
|
+
return {
|
|
11614
|
+
ok: true,
|
|
11615
|
+
data: res0.data?.map(({ id }) => {
|
|
11616
|
+
const game = res1.data.edges.find(
|
|
11617
|
+
(e) => id === e.node.reference
|
|
11618
|
+
)?.node;
|
|
11619
|
+
return game ? this.transformer.transform.game(game) : null;
|
|
11620
|
+
}).filter(Boolean) ?? []
|
|
11621
|
+
};
|
|
11622
|
+
}
|
|
11623
|
+
async recentGames() {
|
|
11624
|
+
const res0 = await this.portalService.recentGames();
|
|
11625
|
+
const ids = res0.data?.length ? [...new Set(res0.data.map((e) => e.id))] : [];
|
|
11626
|
+
if (ids.length <= 0) {
|
|
11627
|
+
return {
|
|
11628
|
+
ok: true,
|
|
11629
|
+
data: []
|
|
11630
|
+
};
|
|
11631
|
+
}
|
|
11632
|
+
const res1 = await this.cmsPortalService.games({
|
|
11633
|
+
filter: {
|
|
11634
|
+
reference: {
|
|
11635
|
+
in: ids
|
|
11636
|
+
}
|
|
11637
|
+
}
|
|
11638
|
+
});
|
|
11639
|
+
if (!res1.ok) return res1;
|
|
11640
|
+
return {
|
|
11641
|
+
ok: true,
|
|
11642
|
+
data: res0.data?.map(({ id }) => {
|
|
11643
|
+
const game = res1.data.edges.find(
|
|
11644
|
+
(e) => id === e.node.reference
|
|
11645
|
+
)?.node;
|
|
11646
|
+
return game ? this.transformer.transform.game(game) : null;
|
|
11647
|
+
}).filter(Boolean) ?? []
|
|
11648
|
+
};
|
|
11649
|
+
}
|
|
11650
|
+
async addFavoriteGame(input) {
|
|
11651
|
+
return await this.portalService.addFavoriteGame(input);
|
|
11652
|
+
}
|
|
11653
|
+
async removeFavoriteGame(input) {
|
|
11654
|
+
return await this.portalService.removeFavoriteGame(input);
|
|
11655
|
+
}
|
|
11489
11656
|
/*
|
|
11490
11657
|
*=============================================
|
|
11491
11658
|
* FILE
|