@opexa/portal-sdk 0.59.133 → 0.59.134

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.d.cts CHANGED
@@ -63,6 +63,7 @@ declare class Sdk {
63
63
  constructor(config: SdkConfig);
64
64
  private _fetch;
65
65
  private _middleware;
66
+ private _testHeader;
66
67
  /**
67
68
  * @deprecated use `setFetch` instead
68
69
  */
@@ -75,6 +76,12 @@ declare class Sdk {
75
76
  getFetch(): typeof fetch | null;
76
77
  set middleware(value: GraphQLClientMiddleware);
77
78
  get middleware(): GraphQLClientMiddleware;
79
+ /**
80
+ * Sets a header value appended to all outgoing requests (GraphQL, auth
81
+ * REST, and CMS portal REST). Pass `null` to remove it.
82
+ */
83
+ setTestHeader(value: string | null): void;
84
+ get testHeader(): string | null;
78
85
  initMarketDomain(): void;
79
86
  set marketDomain(value: string | null);
80
87
  get marketDomain(): string | null;
@@ -89,6 +96,7 @@ declare class Sdk {
89
96
  private get fingerprintMiddleware();
90
97
  fingerprint(): Promise<string | null>;
91
98
  private get miscMiddleware();
99
+ private get testHeaderMiddleware();
92
100
  private get publicRequestMiddleware();
93
101
  collectMetaDetails(): void;
94
102
  signIn(input: NameAndPasswordSignInInput, version?: 1 | 3 | 4): Promise<NameAndPasswordSignInReturn>;
package/dist/index.d.ts CHANGED
@@ -63,6 +63,7 @@ declare class Sdk {
63
63
  constructor(config: SdkConfig);
64
64
  private _fetch;
65
65
  private _middleware;
66
+ private _testHeader;
66
67
  /**
67
68
  * @deprecated use `setFetch` instead
68
69
  */
@@ -75,6 +76,12 @@ declare class Sdk {
75
76
  getFetch(): typeof fetch | null;
76
77
  set middleware(value: GraphQLClientMiddleware);
77
78
  get middleware(): GraphQLClientMiddleware;
79
+ /**
80
+ * Sets a header value appended to all outgoing requests (GraphQL, auth
81
+ * REST, and CMS portal REST). Pass `null` to remove it.
82
+ */
83
+ setTestHeader(value: string | null): void;
84
+ get testHeader(): string | null;
78
85
  initMarketDomain(): void;
79
86
  set marketDomain(value: string | null);
80
87
  get marketDomain(): string | null;
@@ -89,6 +96,7 @@ declare class Sdk {
89
96
  private get fingerprintMiddleware();
90
97
  fingerprint(): Promise<string | null>;
91
98
  private get miscMiddleware();
99
+ private get testHeaderMiddleware();
92
100
  private get publicRequestMiddleware();
93
101
  collectMetaDetails(): void;
94
102
  signIn(input: NameAndPasswordSignInInput, version?: 1 | 3 | 4): Promise<NameAndPasswordSignInReturn>;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { CmsPortalService, GameService, ExtensionService, FileService, WalletService, AccountService, ReportService, PortalService, TriggerService, AuthService, getFingerPrint, isIOSPlatform } from './chunk-ISVV44MD.js';
2
- import { GraphQLClient, isPlainObject } from './chunk-7APXFZ5G.js';
3
- import './chunk-WVFSGB7Y.js';
1
+ import { CmsPortalService, GameService, ExtensionService, FileService, WalletService, AccountService, ReportService, PortalService, TriggerService, AuthService, getFingerPrint, isIOSPlatform } from './chunk-SBPWGV33.js';
2
+ import { GraphQLClient, isPlainObject } from './chunk-7Y7FWND5.js';
3
+ import './chunk-BTV72WJH.js';
4
4
  import { ObjectId } from '@opexa/object-id';
5
5
  export { ObjectId } from '@opexa/object-id';
6
6
  import { Capacitor } from '@capacitor/core';
@@ -3656,7 +3656,12 @@ var Sdk = class {
3656
3656
  url: cmsPortalUrl,
3657
3657
  site,
3658
3658
  platform: sitePlatform,
3659
- fetch: this.getFetch()
3659
+ fetch: this.getFetch(),
3660
+ headers: {
3661
+ ...this._testHeader && {
3662
+ Test: this._testHeader
3663
+ }
3664
+ }
3660
3665
  }));
3661
3666
  this._fetch = config.fetch ?? null;
3662
3667
  this._middleware = config.middleware ?? ((req) => req);
@@ -3666,6 +3671,7 @@ var Sdk = class {
3666
3671
  this.authMiddleware,
3667
3672
  this.fingerprintMiddleware,
3668
3673
  this.miscMiddleware,
3674
+ this.testHeaderMiddleware,
3669
3675
  this.middleware
3670
3676
  ],
3671
3677
  fetch: this.getFetch(),
@@ -3698,6 +3704,7 @@ var Sdk = class {
3698
3704
  middlewares: [
3699
3705
  this.fingerprintMiddleware,
3700
3706
  this.miscMiddleware,
3707
+ this.testHeaderMiddleware,
3701
3708
  this.middleware,
3702
3709
  this.publicRequestMiddleware
3703
3710
  ],
@@ -3726,15 +3733,18 @@ var Sdk = class {
3726
3733
  `${authUrl}/graphql`,
3727
3734
  graphqlClientConfig
3728
3735
  ),
3729
- fetchOptions: {
3736
+ fetchOptions: () => ({
3730
3737
  headers: {
3731
3738
  Role: "MEMBER",
3732
3739
  "Platform-Code": platform,
3733
3740
  ...!production && {
3734
3741
  "Test-Pass": ""
3742
+ },
3743
+ ...this._testHeader && {
3744
+ Test: this._testHeader
3735
3745
  }
3736
3746
  }
3737
- }
3747
+ })
3738
3748
  });
3739
3749
  const sessionManager = config.sessionStorage === "cookie" ? new SessionManagerCookie({
3740
3750
  logger,
@@ -3774,6 +3784,7 @@ var Sdk = class {
3774
3784
  }
3775
3785
  _fetch = null;
3776
3786
  _middleware;
3787
+ _testHeader = null;
3777
3788
  /**
3778
3789
  * @deprecated use `setFetch` instead
3779
3790
  */
@@ -3801,6 +3812,16 @@ var Sdk = class {
3801
3812
  get middleware() {
3802
3813
  return this._middleware;
3803
3814
  }
3815
+ /**
3816
+ * Sets a header value appended to all outgoing requests (GraphQL, auth
3817
+ * REST, and CMS portal REST). Pass `null` to remove it.
3818
+ */
3819
+ setTestHeader(value) {
3820
+ this._testHeader = value;
3821
+ }
3822
+ get testHeader() {
3823
+ return this._testHeader;
3824
+ }
3804
3825
  initMarketDomain() {
3805
3826
  if (typeof window === "undefined") return;
3806
3827
  const searchParams = new URLSearchParams(window.location.search);
@@ -3949,6 +3970,14 @@ var Sdk = class {
3949
3970
  return request;
3950
3971
  };
3951
3972
  }
3973
+ get testHeaderMiddleware() {
3974
+ return (request) => {
3975
+ if (this._testHeader) {
3976
+ request.headers.set("Test", this._testHeader);
3977
+ }
3978
+ return request;
3979
+ };
3980
+ }
3952
3981
  get publicRequestMiddleware() {
3953
3982
  return (request) => {
3954
3983
  request.headers.delete("Authorization");