@opexa/portal-sdk 0.59.131 → 0.59.133

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, {
@@ -4208,6 +4222,11 @@ var AccountService = class {
4208
4222
  }
4209
4223
  async registerMemberAccountViaMobile(variables) {
4210
4224
  const { reCAPTCHAResponse, domain, testPass, ...others } = variables;
4225
+ const { branch, branchCode, ...input } = others.input;
4226
+ others.input = {
4227
+ ...input,
4228
+ ...branch?.trim() ? { branch } : { branchCode }
4229
+ };
4211
4230
  const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_VIA_MOBILE_MUTATION, others, {
4212
4231
  headers: {
4213
4232
  ...reCAPTCHAResponse && {
@@ -4649,6 +4668,11 @@ var AccountService = class {
4649
4668
  }
4650
4669
  async registerMemberAccountByMobileNumber__next(variables) {
4651
4670
  const { reCAPTCHAResponse, domain, testPass, fingerprint, ...others } = variables;
4671
+ const { branch, branchCode, ...input } = others.input;
4672
+ others.input = {
4673
+ ...input,
4674
+ ...branch?.trim() ? { branch } : { branchCode }
4675
+ };
4652
4676
  const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_MUTATION__NEXT, others, {
4653
4677
  headers: {
4654
4678
  ...reCAPTCHAResponse && {
@@ -10990,6 +11014,7 @@ var Sdk = class {
10990
11014
  walletService;
10991
11015
  extensionService;
10992
11016
  accountService;
11017
+ publicAccountService;
10993
11018
  reportService;
10994
11019
  portalService;
10995
11020
  triggerService;
@@ -11072,6 +11097,24 @@ var Sdk = class {
11072
11097
  new GraphQLClient(accountUrl, graphqlClientConfig),
11073
11098
  environment
11074
11099
  );
11100
+ const publicAccountService = new AccountService(
11101
+ new GraphQLClient(accountUrl, () => ({
11102
+ middlewares: [
11103
+ this.fingerprintMiddleware,
11104
+ this.miscMiddleware,
11105
+ this.middleware,
11106
+ this.publicRequestMiddleware
11107
+ ],
11108
+ fetch: this.getFetch(),
11109
+ fetchOptions: {
11110
+ headers: {
11111
+ Role: "MEMBER",
11112
+ "Platform-Code": platform
11113
+ }
11114
+ }
11115
+ })),
11116
+ environment
11117
+ );
11075
11118
  const reportService = new ReportService(
11076
11119
  new GraphQLClient(reportUrl, graphqlClientConfig)
11077
11120
  );
@@ -11116,6 +11159,7 @@ var Sdk = class {
11116
11159
  this.fileService = fileService;
11117
11160
  this.walletService = walletService;
11118
11161
  this.accountService = accountService;
11162
+ this.publicAccountService = publicAccountService;
11119
11163
  this.reportService = reportService;
11120
11164
  this.portalService = portalService;
11121
11165
  this.triggerService = triggerService;
@@ -11309,6 +11353,12 @@ var Sdk = class {
11309
11353
  return request;
11310
11354
  };
11311
11355
  }
11356
+ get publicRequestMiddleware() {
11357
+ return (request) => {
11358
+ request.headers.delete("Authorization");
11359
+ return request;
11360
+ };
11361
+ }
11312
11362
  collectMetaDetails() {
11313
11363
  if (typeof window === "undefined") return;
11314
11364
  const searchParams = new URLSearchParams(window.location.search);
@@ -11642,6 +11692,10 @@ var Sdk = class {
11642
11692
  data: this.transformer.transform.account({ ...a.data, ...c })
11643
11693
  };
11644
11694
  }
11695
+ /** Retrieve account branches without requiring a member session. */
11696
+ async branches() {
11697
+ return await this.publicAccountService.branches();
11698
+ }
11645
11699
  /**
11646
11700
  * @deprecated use `createAccount__next`
11647
11701
  */
@@ -11681,6 +11735,7 @@ var Sdk = class {
11681
11735
  mobileNumber: addAreaCode(input.mobileNumber, await this.locale),
11682
11736
  realName: input.realName,
11683
11737
  birthDay: input.dateOfBirth,
11738
+ branch: input.branch,
11684
11739
  branchCode: input.branchCode,
11685
11740
  agentCode: input.agentCode,
11686
11741
  ...this.cxd && {
@@ -11743,6 +11798,7 @@ var Sdk = class {
11743
11798
  mobileNumber: addAreaCode(input.mobileNumber, await this.locale),
11744
11799
  mobileNumberVerificationCode: input.mobileNumberVerificationCode,
11745
11800
  emailAddress: input.emailAddress,
11801
+ branch: input.branch,
11746
11802
  branchCode: input.branchCode,
11747
11803
  agentCode: input.agentCode,
11748
11804
  gigRewardsQuestDetails: input.gigRewardsQuestDetails,