@opexa/portal-sdk 0.59.78 → 0.59.80
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-5WRVWQBT.js → chunk-7APXFZ5G.js} +3 -3
- package/dist/chunk-7APXFZ5G.js.map +1 -0
- package/dist/{chunk-YL46WJBV.js → chunk-CBF46HKK.js} +27 -9
- package/dist/chunk-CBF46HKK.js.map +1 -0
- package/dist/{chunk-ROBGEUSE.js → chunk-WVFSGB7Y.js} +2 -2
- package/dist/chunk-WVFSGB7Y.js.map +1 -0
- package/dist/index.cjs +25 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +24 -6
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +2 -2
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +2 -2
- package/dist/{types-kTe_j8tm.d.cts → types-CLOj9j8f.d.cts} +6 -2
- package/dist/{types-lZQpMvHU.d.ts → types-vlbILiF3.d.ts} +6 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-5WRVWQBT.js.map +0 -1
- package/dist/chunk-ROBGEUSE.js.map +0 -1
- package/dist/chunk-YL46WJBV.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-WVFSGB7Y.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-WVFSGB7Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/gql.ts","../src/utils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BAAA;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-WVFSGB7Y.js","sourcesContent":["export function gql(strings: TemplateStringsArray, ...values: unknown[]) {\r\n\tlet result = '';\r\n\r\n\tfor (const [index, string] of strings.entries()) {\r\n\t\tconst value = values.at(index) ?? '';\r\n\r\n\t\tresult = `${result}${string}${value}`;\r\n\t}\r\n\r\n\treturn result.trim();\r\n}\r\n","import type { HttpError, OperationError } from '../types/index.js';\r\n\r\nexport function statusCodeToOperationError(\r\n\tvalue: number,\r\n\tmessage?: string,\r\n): OperationError<HttpError> {\r\n\tconst e = ERROR_MAP[value] ? ERROR_MAP[value] : ERROR_MAP[500];\r\n\r\n\treturn {\r\n\t\tname: e.name,\r\n\t\tmessage: message ?? e.message,\r\n\t};\r\n}\r\n\r\nconst ERROR_MAP: Record<number, OperationError<HttpError>> = {\r\n\t400: { name: 'HttpBadRequest', message: 'Bad Request' },\r\n\t401: { name: 'HttpUnauthorized', message: 'Unauthorized' },\r\n\t403: { name: 'HttpForbidden', message: 'Forbidden' },\r\n\t404: { name: 'HttpNotFound', message: 'Not Found' },\r\n\t408: { name: 'HttpRequestTimeout', message: 'Request Timeout' },\r\n\t429: { name: 'HttpTooManyRequests', message: 'Too Many Requests' },\r\n\t500: { name: 'HttpInternalServerError', message: 'Internal Server Error' },\r\n};\r\n","function isFunction<Return, Args = never>(\r\n\tvalue: unknown | ((...args: Args[]) => Return),\r\n): value is (...args: Args[]) => Return {\r\n\treturn typeof value === 'function';\r\n}\r\n\r\nexport function callIfFn<Return, Args = never>(\r\n\tvalue: Return | ((...args: Args[]) => Return),\r\n\t...args: Args[]\r\n) {\r\n\tif (isFunction<Return, Args>(value)) {\r\n\t\treturn value(...args);\r\n\t} else {\r\n\t\treturn value;\r\n\t}\r\n}\r\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -3380,13 +3380,13 @@ var RECENT_GAMES_QUERY = gql`
|
|
|
3380
3380
|
}
|
|
3381
3381
|
`;
|
|
3382
3382
|
var ADD_FAVORITE_GAME_MUTATION = gql`
|
|
3383
|
-
mutation AddFavoriteGame($
|
|
3384
|
-
addFavoriteGame(input:
|
|
3383
|
+
mutation AddFavoriteGame($input: AddFavoriteGameInput!) {
|
|
3384
|
+
addFavoriteGame(input: $input)
|
|
3385
3385
|
}
|
|
3386
3386
|
`;
|
|
3387
3387
|
var REMOVE_FAVORITE_GAME_MUTATION = gql`
|
|
3388
|
-
mutation RemoveFavoriteGame($
|
|
3389
|
-
removeFavoriteGame(input:
|
|
3388
|
+
mutation RemoveFavoriteGame($input: RemoveFavoriteGameInput!) {
|
|
3389
|
+
removeFavoriteGame(input: $input)
|
|
3390
3390
|
}
|
|
3391
3391
|
`;
|
|
3392
3392
|
var WALLET_GAMES_QUERY = gql`
|
|
@@ -4485,6 +4485,13 @@ var ERROR_MAP = {
|
|
|
4485
4485
|
};
|
|
4486
4486
|
|
|
4487
4487
|
// src/services/auth.service.ts
|
|
4488
|
+
function isWebPlatform() {
|
|
4489
|
+
try {
|
|
4490
|
+
return core.Capacitor.getPlatform() === "web";
|
|
4491
|
+
} catch {
|
|
4492
|
+
return false;
|
|
4493
|
+
}
|
|
4494
|
+
}
|
|
4488
4495
|
var AuthService = class {
|
|
4489
4496
|
url;
|
|
4490
4497
|
options;
|
|
@@ -4538,7 +4545,9 @@ var AuthService = class {
|
|
|
4538
4545
|
headers.set("test-pass", input.testPass);
|
|
4539
4546
|
}
|
|
4540
4547
|
try {
|
|
4541
|
-
const
|
|
4548
|
+
const isWeb = isWebPlatform();
|
|
4549
|
+
const queryParam = isWeb && version === 4 ? "?type=web" : "";
|
|
4550
|
+
const res = await fetch(`${this.url}${version !== 1 ? `/v${version}/sessions` : "/sessions"}${queryParam}`, {
|
|
4542
4551
|
method: "POST",
|
|
4543
4552
|
headers,
|
|
4544
4553
|
body: JSON.stringify(input),
|
|
@@ -4636,8 +4645,10 @@ var AuthService = class {
|
|
|
4636
4645
|
}
|
|
4637
4646
|
}
|
|
4638
4647
|
try {
|
|
4648
|
+
const isWeb = isWebPlatform();
|
|
4649
|
+
const queryParam = isWeb && version === 4 ? "?type=web" : "";
|
|
4639
4650
|
const res = await fetch(
|
|
4640
|
-
`${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}`,
|
|
4651
|
+
`${this.url}${version !== 1 ? `/v${version}/session/refresh` : "/session:refresh"}${queryParam}`,
|
|
4641
4652
|
{
|
|
4642
4653
|
method: "POST",
|
|
4643
4654
|
headers,
|
|
@@ -4683,6 +4694,12 @@ var AuthService = class {
|
|
|
4683
4694
|
async destroySession(accessToken, version = 1) {
|
|
4684
4695
|
const headers = new Headers(this.headers);
|
|
4685
4696
|
headers.append("Authorization", `Bearer ${accessToken}`);
|
|
4697
|
+
if (version === 3 || version === 4) {
|
|
4698
|
+
const fingerprint = await getFingerPrint();
|
|
4699
|
+
if (fingerprint) {
|
|
4700
|
+
headers.append("Fingerprint", fingerprint);
|
|
4701
|
+
}
|
|
4702
|
+
}
|
|
4686
4703
|
try {
|
|
4687
4704
|
const res = await fetch(
|
|
4688
4705
|
`${this.url}${version !== 1 ? `/v${version}/session` : "/session"}`,
|
|
@@ -11832,10 +11849,10 @@ var Sdk = class {
|
|
|
11832
11849
|
};
|
|
11833
11850
|
}
|
|
11834
11851
|
async addFavoriteGame(input) {
|
|
11835
|
-
return await this.portalService.addFavoriteGame(input);
|
|
11852
|
+
return await this.portalService.addFavoriteGame({ input });
|
|
11836
11853
|
}
|
|
11837
11854
|
async removeFavoriteGame(input) {
|
|
11838
|
-
return await this.portalService.removeFavoriteGame(input);
|
|
11855
|
+
return await this.portalService.removeFavoriteGame({ input });
|
|
11839
11856
|
}
|
|
11840
11857
|
/*
|
|
11841
11858
|
*=============================================
|