@opexa/portal-sdk 0.51.1 → 0.51.2
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/index.cjs +22 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -15
package/dist/index.d.cts
CHANGED
|
@@ -596,6 +596,7 @@ interface Account {
|
|
|
596
596
|
currentMonthlyTurnover?: number;
|
|
597
597
|
turnoverLevelUpProgressPercentage?: number;
|
|
598
598
|
googleId?: string;
|
|
599
|
+
domain?: string | null;
|
|
599
600
|
}
|
|
600
601
|
type AccountReturn = OperationResult<never, Account>;
|
|
601
602
|
type VerificationDetailsStatus = UnionAlias<MemberVerificationStatus>;
|
|
@@ -1817,6 +1818,10 @@ interface SdkConfig {
|
|
|
1817
1818
|
fetch?: typeof globalThis.fetch;
|
|
1818
1819
|
}
|
|
1819
1820
|
declare class Sdk {
|
|
1821
|
+
/**
|
|
1822
|
+
* Initializes the SDK by fetching and assigning the member domain.
|
|
1823
|
+
*/
|
|
1824
|
+
init(): Promise<void>;
|
|
1820
1825
|
private cmsPortalService;
|
|
1821
1826
|
private authService;
|
|
1822
1827
|
private gameService;
|
|
@@ -1833,6 +1838,10 @@ declare class Sdk {
|
|
|
1833
1838
|
private logger;
|
|
1834
1839
|
private cache;
|
|
1835
1840
|
private config;
|
|
1841
|
+
/**
|
|
1842
|
+
* Stores the member domain for use in future mutations/queries
|
|
1843
|
+
*/
|
|
1844
|
+
memberDomain: string | null;
|
|
1836
1845
|
constructor(config: SdkConfig);
|
|
1837
1846
|
private _fetch;
|
|
1838
1847
|
private _middleware;
|
package/dist/index.d.ts
CHANGED
|
@@ -596,6 +596,7 @@ interface Account {
|
|
|
596
596
|
currentMonthlyTurnover?: number;
|
|
597
597
|
turnoverLevelUpProgressPercentage?: number;
|
|
598
598
|
googleId?: string;
|
|
599
|
+
domain?: string | null;
|
|
599
600
|
}
|
|
600
601
|
type AccountReturn = OperationResult<never, Account>;
|
|
601
602
|
type VerificationDetailsStatus = UnionAlias<MemberVerificationStatus>;
|
|
@@ -1817,6 +1818,10 @@ interface SdkConfig {
|
|
|
1817
1818
|
fetch?: typeof globalThis.fetch;
|
|
1818
1819
|
}
|
|
1819
1820
|
declare class Sdk {
|
|
1821
|
+
/**
|
|
1822
|
+
* Initializes the SDK by fetching and assigning the member domain.
|
|
1823
|
+
*/
|
|
1824
|
+
init(): Promise<void>;
|
|
1820
1825
|
private cmsPortalService;
|
|
1821
1826
|
private authService;
|
|
1822
1827
|
private gameService;
|
|
@@ -1833,6 +1838,10 @@ declare class Sdk {
|
|
|
1833
1838
|
private logger;
|
|
1834
1839
|
private cache;
|
|
1835
1840
|
private config;
|
|
1841
|
+
/**
|
|
1842
|
+
* Stores the member domain for use in future mutations/queries
|
|
1843
|
+
*/
|
|
1844
|
+
memberDomain: string | null;
|
|
1836
1845
|
constructor(config: SdkConfig);
|
|
1837
1846
|
private _fetch;
|
|
1838
1847
|
private _middleware;
|
package/dist/index.js
CHANGED
|
@@ -1528,6 +1528,7 @@ var MEMBER_ACCOUNT_QUERY = gql`
|
|
|
1528
1528
|
secretAnswerSubmitted
|
|
1529
1529
|
dateTimeCreated
|
|
1530
1530
|
dateTimeLastUpdated
|
|
1531
|
+
domain
|
|
1531
1532
|
}
|
|
1532
1533
|
}
|
|
1533
1534
|
}
|
|
@@ -7094,7 +7095,8 @@ var Transformer = class {
|
|
|
7094
7095
|
achievementPointsLevelUpProgressPercentage: data.achievementPointsLevelUpProgressPercentage,
|
|
7095
7096
|
currentMonthlyTurnover: data.currentMonthlyTurnover,
|
|
7096
7097
|
turnoverLevelUpProgressPercentage: data.turnoverLevelUpProgressPercentage,
|
|
7097
|
-
googleId: data.googleId
|
|
7098
|
+
googleId: data.googleId,
|
|
7099
|
+
domain: data.domain ?? null
|
|
7098
7100
|
};
|
|
7099
7101
|
return compact(o);
|
|
7100
7102
|
}
|
|
@@ -7708,6 +7710,16 @@ var defaultConfig = {
|
|
|
7708
7710
|
logs: false
|
|
7709
7711
|
};
|
|
7710
7712
|
var Sdk = class {
|
|
7713
|
+
/**
|
|
7714
|
+
* Initializes the SDK by fetching and assigning the member domain.
|
|
7715
|
+
*/
|
|
7716
|
+
async init() {
|
|
7717
|
+
const res = await this.accountService.memberAccount();
|
|
7718
|
+
if (res.ok) {
|
|
7719
|
+
const accountData = this.transformer.transform.account(res.data);
|
|
7720
|
+
this.memberDomain = accountData?.domain ?? null;
|
|
7721
|
+
}
|
|
7722
|
+
}
|
|
7711
7723
|
cmsPortalService;
|
|
7712
7724
|
authService;
|
|
7713
7725
|
gameService;
|
|
@@ -7724,6 +7736,10 @@ var Sdk = class {
|
|
|
7724
7736
|
logger;
|
|
7725
7737
|
cache;
|
|
7726
7738
|
config;
|
|
7739
|
+
/**
|
|
7740
|
+
* Stores the member domain for use in future mutations/queries
|
|
7741
|
+
*/
|
|
7742
|
+
memberDomain = null;
|
|
7727
7743
|
constructor(config) {
|
|
7728
7744
|
const {
|
|
7729
7745
|
/**/
|
|
@@ -7921,10 +7937,14 @@ var Sdk = class {
|
|
|
7921
7937
|
*/
|
|
7922
7938
|
get domainMiddleware() {
|
|
7923
7939
|
return async (request) => {
|
|
7924
|
-
if (this.sessionManager.onMaya
|
|
7940
|
+
if (this.sessionManager.onMaya) {
|
|
7925
7941
|
request.headers.delete("Domain");
|
|
7926
7942
|
return request;
|
|
7927
7943
|
}
|
|
7944
|
+
if (this.memberDomain && this.memberDomain.includes("cabinet")) {
|
|
7945
|
+
request.headers.set("Domain", this.memberDomain);
|
|
7946
|
+
return request;
|
|
7947
|
+
}
|
|
7928
7948
|
const domain = typeof window === "undefined" ? null : !Capacitor.isNativePlatform() ? null : Capacitor.getPlatform() === "ios" ? `ios/${this.config.platform}`.toLowerCase() : Capacitor.getPlatform() === "android" ? `android/${this.config.platform}`.toLowerCase() : null;
|
|
7929
7949
|
if (domain) {
|
|
7930
7950
|
request.headers.set("Domain", domain);
|