@opexa/portal-sdk 0.59.131 → 0.59.132

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 CHANGED
@@ -1836,6 +1836,16 @@ var CLAIM_REBATE_MUTATION = gql`
1836
1836
  }
1837
1837
  }
1838
1838
  `;
1839
+ var BRANCHES_QUERY = gql`
1840
+ query GetBranches {
1841
+ branches {
1842
+ id
1843
+ name
1844
+ code
1845
+ description
1846
+ }
1847
+ }
1848
+ `;
1839
1849
  var MEMBER_QUERY = gql`
1840
1850
  query Member {
1841
1851
  member {
@@ -4183,6 +4193,10 @@ var AccountService = class {
4183
4193
  data: res.data.memberAccount
4184
4194
  };
4185
4195
  }
4196
+ async branches() {
4197
+ const res = await this.client.request(BRANCHES_QUERY);
4198
+ return res.ok ? { ok: true, data: res.data.branches } : res;
4199
+ }
4186
4200
  async registerMemberAccount(variables) {
4187
4201
  const { reCAPTCHAResponse, domain, ...others } = variables;
4188
4202
  const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_MUTATION, others, {
@@ -10990,6 +11004,7 @@ var Sdk = class {
10990
11004
  walletService;
10991
11005
  extensionService;
10992
11006
  accountService;
11007
+ publicAccountService;
10993
11008
  reportService;
10994
11009
  portalService;
10995
11010
  triggerService;
@@ -11072,6 +11087,24 @@ var Sdk = class {
11072
11087
  new GraphQLClient(accountUrl, graphqlClientConfig),
11073
11088
  environment
11074
11089
  );
11090
+ const publicAccountService = new AccountService(
11091
+ new GraphQLClient(accountUrl, () => ({
11092
+ middlewares: [
11093
+ this.fingerprintMiddleware,
11094
+ this.miscMiddleware,
11095
+ this.middleware,
11096
+ this.publicRequestMiddleware
11097
+ ],
11098
+ fetch: this.getFetch(),
11099
+ fetchOptions: {
11100
+ headers: {
11101
+ Role: "MEMBER",
11102
+ "Platform-Code": platform
11103
+ }
11104
+ }
11105
+ })),
11106
+ environment
11107
+ );
11075
11108
  const reportService = new ReportService(
11076
11109
  new GraphQLClient(reportUrl, graphqlClientConfig)
11077
11110
  );
@@ -11116,6 +11149,7 @@ var Sdk = class {
11116
11149
  this.fileService = fileService;
11117
11150
  this.walletService = walletService;
11118
11151
  this.accountService = accountService;
11152
+ this.publicAccountService = publicAccountService;
11119
11153
  this.reportService = reportService;
11120
11154
  this.portalService = portalService;
11121
11155
  this.triggerService = triggerService;
@@ -11309,6 +11343,12 @@ var Sdk = class {
11309
11343
  return request;
11310
11344
  };
11311
11345
  }
11346
+ get publicRequestMiddleware() {
11347
+ return (request) => {
11348
+ request.headers.delete("Authorization");
11349
+ return request;
11350
+ };
11351
+ }
11312
11352
  collectMetaDetails() {
11313
11353
  if (typeof window === "undefined") return;
11314
11354
  const searchParams = new URLSearchParams(window.location.search);
@@ -11642,6 +11682,10 @@ var Sdk = class {
11642
11682
  data: this.transformer.transform.account({ ...a.data, ...c })
11643
11683
  };
11644
11684
  }
11685
+ /** Retrieve account branches without requiring a member session. */
11686
+ async branches() {
11687
+ return await this.publicAccountService.branches();
11688
+ }
11645
11689
  /**
11646
11690
  * @deprecated use `createAccount__next`
11647
11691
  */