@opexa/portal-sdk 0.59.85 → 0.59.87

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.
@@ -39,5 +39,5 @@ function callIfFn(value, ...args) {
39
39
  }
40
40
 
41
41
  export { callIfFn, gql, statusCodeToOperationError };
42
- //# sourceMappingURL=chunk-WVFSGB7Y.js.map
43
- //# sourceMappingURL=chunk-WVFSGB7Y.js.map
42
+ //# sourceMappingURL=chunk-ROBGEUSE.js.map
43
+ //# sourceMappingURL=chunk-ROBGEUSE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/gql.ts","../src/utils/status-code-to-operation-error.ts","../src/utils/call-if-fn.ts"],"names":[],"mappings":";AAAO,SAAS,GAAA,CAAI,YAAkC,MAAA,EAAmB;AACxE,EAAA,IAAI,MAAA,GAAS,EAAA;AAEb,EAAA,KAAA,MAAW,CAAC,KAAA,EAAO,MAAM,CAAA,IAAK,OAAA,CAAQ,SAAQ,EAAG;AAChD,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,EAAA,CAAG,KAAK,CAAA,IAAK,EAAA;AAElC,IAAA,MAAA,GAAS,CAAA,EAAG,MAAM,CAAA,EAAG,MAAM,GAAG,KAAK,CAAA,CAAA;AAAA,EACpC;AAEA,EAAA,OAAO,OAAO,IAAA,EAAK;AACpB;;;ACRO,SAAS,0BAAA,CACf,OACA,OAAA,EAC4B;AAC5B,EAAA,MAAM,CAAA,GAAI,UAAU,KAAK,CAAA,GAAI,UAAU,KAAK,CAAA,GAAI,UAAU,GAAG,CAAA;AAE7D,EAAA,OAAO;AAAA,IACN,MAAM,CAAA,CAAE,IAAA;AAAA,IACR,OAAA,EAAS,WAAW,CAAA,CAAE;AAAA,GACvB;AACD;AAEA,IAAM,SAAA,GAAuD;AAAA,EAC5D,GAAA,EAAK,EAAE,IAAA,EAAM,gBAAA,EAAkB,SAAS,aAAA,EAAc;AAAA,EACtD,GAAA,EAAK,EAAE,IAAA,EAAM,kBAAA,EAAoB,SAAS,cAAA,EAAe;AAAA,EACzD,GAAA,EAAK,EAAE,IAAA,EAAM,eAAA,EAAiB,SAAS,WAAA,EAAY;AAAA,EACnD,GAAA,EAAK,EAAE,IAAA,EAAM,cAAA,EAAgB,SAAS,WAAA,EAAY;AAAA,EAClD,GAAA,EAAK,EAAE,IAAA,EAAM,oBAAA,EAAsB,SAAS,iBAAA,EAAkB;AAAA,EAC9D,GAAA,EAAK,EAAE,IAAA,EAAM,qBAAA,EAAuB,SAAS,mBAAA,EAAoB;AAAA,EACjE,GAAA,EAAK,EAAE,IAAA,EAAM,yBAAA,EAA2B,SAAS,uBAAA;AAClD,CAAA;;;ACtBA,SAAS,WACR,KAAA,EACuC;AACvC,EAAA,OAAO,OAAO,KAAA,KAAU,UAAA;AACzB;AAEO,SAAS,QAAA,CACf,UACG,IAAA,EACF;AACD,EAAA,IAAI,UAAA,CAAyB,KAAK,CAAA,EAAG;AACpC,IAAA,OAAO,KAAA,CAAM,GAAG,IAAI,CAAA;AAAA,EACrB,CAAA,MAAO;AACN,IAAA,OAAO,KAAA;AAAA,EACR;AACD","file":"chunk-ROBGEUSE.js","sourcesContent":["export function gql(strings: TemplateStringsArray, ...values: unknown[]) {\n\tlet result = '';\n\n\tfor (const [index, string] of strings.entries()) {\n\t\tconst value = values.at(index) ?? '';\n\n\t\tresult = `${result}${string}${value}`;\n\t}\n\n\treturn result.trim();\n}\n","import type { HttpError, OperationError } from '../types/index.js';\n\nexport function statusCodeToOperationError(\n\tvalue: number,\n\tmessage?: string,\n): OperationError<HttpError> {\n\tconst e = ERROR_MAP[value] ? ERROR_MAP[value] : ERROR_MAP[500];\n\n\treturn {\n\t\tname: e.name,\n\t\tmessage: message ?? e.message,\n\t};\n}\n\nconst ERROR_MAP: Record<number, OperationError<HttpError>> = {\n\t400: { name: 'HttpBadRequest', message: 'Bad Request' },\n\t401: { name: 'HttpUnauthorized', message: 'Unauthorized' },\n\t403: { name: 'HttpForbidden', message: 'Forbidden' },\n\t404: { name: 'HttpNotFound', message: 'Not Found' },\n\t408: { name: 'HttpRequestTimeout', message: 'Request Timeout' },\n\t429: { name: 'HttpTooManyRequests', message: 'Too Many Requests' },\n\t500: { name: 'HttpInternalServerError', message: 'Internal Server Error' },\n};\n","function isFunction<Return, Args = never>(\n\tvalue: unknown | ((...args: Args[]) => Return),\n): value is (...args: Args[]) => Return {\n\treturn typeof value === 'function';\n}\n\nexport function callIfFn<Return, Args = never>(\n\tvalue: Return | ((...args: Args[]) => Return),\n\t...args: Args[]\n) {\n\tif (isFunction<Return, Args>(value)) {\n\t\treturn value(...args);\n\t} else {\n\t\treturn value;\n\t}\n}\n"]}
package/dist/index.cjs CHANGED
@@ -2129,6 +2129,11 @@ var RESET_PASSWORD_MUTATION = gql`
2129
2129
  }
2130
2130
  }
2131
2131
  `;
2132
+ var UPDATE_PASSWORD_MUTATION = gql`
2133
+ mutation UpdatePassword($input: UpdatePasswordInput!) {
2134
+ updatePassword(input: $input)
2135
+ }
2136
+ `;
2132
2137
  var DELETE_MEMBER_ACCOUNT_MUTATION = gql`
2133
2138
  mutation DeleteMemberAccount($input: DeleteMemberAccountInput!) {
2134
2139
  deleteMemberAccount(input: $input)
@@ -4155,6 +4160,22 @@ var AccountService = class {
4155
4160
  ok: true
4156
4161
  };
4157
4162
  }
4163
+ async updatePassword(variables) {
4164
+ const res = await this.client.request(UPDATE_PASSWORD_MUTATION, variables);
4165
+ if (!res.ok) return res;
4166
+ if (!res.data.updatePassword) {
4167
+ return {
4168
+ ok: false,
4169
+ error: {
4170
+ name: "UnknownError",
4171
+ message: "Something went wrong."
4172
+ }
4173
+ };
4174
+ }
4175
+ return {
4176
+ ok: true
4177
+ };
4178
+ }
4158
4179
  async profileCompletion() {
4159
4180
  const res = await this.client.request(
4160
4181
  PROFILE_COMPLETION_QUERY
@@ -4708,13 +4729,13 @@ var AuthService = class {
4708
4729
  if (version !== 4) {
4709
4730
  headers.append("Authorization", `Bearer ${refreshToken}`);
4710
4731
  }
4711
- if (version === 3 || version === 4) {
4712
- const fingerprint = await getFingerPrint();
4713
- if (fingerprint) {
4714
- headers.append("Fingerprint", fingerprint);
4715
- }
4716
- }
4717
4732
  try {
4733
+ if (version === 3 || version === 4) {
4734
+ const fingerprint = await getFingerPrint();
4735
+ if (fingerprint) {
4736
+ headers.append("Fingerprint", fingerprint);
4737
+ }
4738
+ }
4718
4739
  const isWeb = isWebPlatform();
4719
4740
  const queryParam = isWeb && version === 4 ? "?type=web" : "";
4720
4741
  const res = await fetch(
@@ -10402,8 +10423,13 @@ var Sdk = class {
10402
10423
  const assignTimeout = () => {
10403
10424
  return setTimeout(async () => {
10404
10425
  if (isForeground) {
10405
- const v = await this.sessionManager.verify();
10406
- if (!v) {
10426
+ let res;
10427
+ try {
10428
+ res = await this.sessionManager.verify();
10429
+ } catch {
10430
+ res = false;
10431
+ }
10432
+ if (!res) {
10407
10433
  await input.onInvalid();
10408
10434
  }
10409
10435
  }
@@ -10873,6 +10899,13 @@ var Sdk = class {
10873
10899
  verificationCode: input.verificationCode
10874
10900
  });
10875
10901
  }
10902
+ async updatePassword(input) {
10903
+ return await this.accountService.updatePassword({
10904
+ input: {
10905
+ password: await sha256(input.password)
10906
+ }
10907
+ });
10908
+ }
10876
10909
  async verifyMobileNumber(verificationCode) {
10877
10910
  return await this.accountService.verifyMobileNumber({
10878
10911
  input: {