@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/README.md CHANGED
@@ -43,6 +43,35 @@ function Page() {
43
43
  }
44
44
  ```
45
45
 
46
+ ### Mobile-number registration
47
+
48
+ Standard mobile registration supports branch IDs:
49
+
50
+ ```ts
51
+ await sdk.createAccount__next({
52
+ type: 'MOBILE_NUMBER',
53
+ mobileNumber: '09190000000',
54
+ verificationCode: '123456',
55
+ branch: selectedBranch.id,
56
+ });
57
+ ```
58
+
59
+ Mobile-next registration also supports branch IDs:
60
+
61
+ ```ts
62
+ await sdk.createAccount__next({
63
+ type: 'MOBILE_NUMBER[NEXT]',
64
+ mobileNumber: '09190000000',
65
+ mobileNumberVerificationCode: '123456',
66
+ branch: selectedBranch.id,
67
+ });
68
+ ```
69
+
70
+ For both registration types, use `branch` for a branch ID or `branchCode` for a legacy branch code. A nonblank
71
+ `branch` takes precedence and omits `branchCode` from the mutation; a missing,
72
+ empty, or whitespace-only `branch` falls back to `branchCode`. The consumer
73
+ chooses which field to supply; no SDK feature flag is required.
74
+
46
75
  ## API
47
76
 
48
77
  ### `Sdk`
@@ -200,6 +229,24 @@ function Page() {
200
229
  };
201
230
  ```
202
231
 
232
+ - `branches` - Retrieve the configured platform's account branches. This is a
233
+ public request and does not require or send a member session.
234
+
235
+ ```ts
236
+ branches(): Promise<BranchesReturn>
237
+ ```
238
+
239
+ ```ts
240
+ interface Branch {
241
+ id: string;
242
+ name: string;
243
+ code: string;
244
+ description?: string | null;
245
+ }
246
+
247
+ type BranchesReturn = OperationResult<never, Branch[]>;
248
+ ```
249
+
203
250
  - `createAccount` - Create new user account
204
251
 
205
252
  ```ts
@@ -1805,6 +1805,16 @@ var CLAIM_REBATE_MUTATION = gql`
1805
1805
  }
1806
1806
  }
1807
1807
  `;
1808
+ var BRANCHES_QUERY = gql`
1809
+ query GetBranches {
1810
+ branches {
1811
+ id
1812
+ name
1813
+ code
1814
+ description
1815
+ }
1816
+ }
1817
+ `;
1808
1818
  var MEMBER_QUERY = gql`
1809
1819
  query Member {
1810
1820
  member {
@@ -4152,6 +4162,10 @@ var AccountService = class {
4152
4162
  data: res.data.memberAccount
4153
4163
  };
4154
4164
  }
4165
+ async branches() {
4166
+ const res = await this.client.request(BRANCHES_QUERY);
4167
+ return res.ok ? { ok: true, data: res.data.branches } : res;
4168
+ }
4155
4169
  async registerMemberAccount(variables) {
4156
4170
  const { reCAPTCHAResponse, domain, ...others } = variables;
4157
4171
  const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_MUTATION, others, {
@@ -4177,6 +4191,11 @@ var AccountService = class {
4177
4191
  }
4178
4192
  async registerMemberAccountViaMobile(variables) {
4179
4193
  const { reCAPTCHAResponse, domain, testPass, ...others } = variables;
4194
+ const { branch, branchCode, ...input } = others.input;
4195
+ others.input = {
4196
+ ...input,
4197
+ ...branch?.trim() ? { branch } : { branchCode }
4198
+ };
4180
4199
  const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_VIA_MOBILE_MUTATION, others, {
4181
4200
  headers: {
4182
4201
  ...reCAPTCHAResponse && {
@@ -4618,6 +4637,11 @@ var AccountService = class {
4618
4637
  }
4619
4638
  async registerMemberAccountByMobileNumber__next(variables) {
4620
4639
  const { reCAPTCHAResponse, domain, testPass, fingerprint, ...others } = variables;
4640
+ const { branch, branchCode, ...input } = others.input;
4641
+ others.input = {
4642
+ ...input,
4643
+ ...branch?.trim() ? { branch } : { branchCode }
4644
+ };
4621
4645
  const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_MUTATION__NEXT, others, {
4622
4646
  headers: {
4623
4647
  ...reCAPTCHAResponse && {
@@ -7118,5 +7142,5 @@ var ExtensionService = class {
7118
7142
  };
7119
7143
 
7120
7144
  export { AccountService, AuthService, CmsPortalService, ExtensionService, FileService, GameService, PortalService, ReportService, TriggerService, WalletService, getFingerPrint, isIOSPlatform };
7121
- //# sourceMappingURL=chunk-BFON53GD.js.map
7122
- //# sourceMappingURL=chunk-BFON53GD.js.map
7145
+ //# sourceMappingURL=chunk-ISVV44MD.js.map
7146
+ //# sourceMappingURL=chunk-ISVV44MD.js.map