squarefi-bff-api-module 1.10.10 → 1.10.11

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.
@@ -12,7 +12,7 @@ export declare const auth: {
12
12
  signin: {
13
13
  omni: {
14
14
  email: (data: API.Auth.SignIn.Email.OTP.Request) => Promise<unknown>;
15
- phone: (data: API.Auth.SignIn.Phone.OTP.Request) => Promise<unknown>;
15
+ phone: ({ phone, ...data }: API.Auth.SignIn.Phone.OTP.Request) => Promise<unknown>;
16
16
  };
17
17
  telegram: (data: API.Auth.Telegram.Signin) => Promise<API.Auth.Tokens>;
18
18
  password: (email: string, password: string) => Promise<API.Auth.Tokens>;
package/dist/api/auth.js CHANGED
@@ -1,7 +1,19 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.auth = exports.refreshTokenPath = exports.telegramSignUpPath = exports.telegramSignInPath = void 0;
4
15
  const apiClientFactory_1 = require("../utils/apiClientFactory");
16
+ const converters_1 = require("../utils/converters");
5
17
  exports.telegramSignInPath = '/auth/sign-in/telegram';
6
18
  exports.telegramSignUpPath = '/auth/sign-up/telegram';
7
19
  exports.refreshTokenPath = '/auth/refresh/refresh-token';
@@ -12,14 +24,19 @@ exports.auth = {
12
24
  data: { email, token, type: 'email' },
13
25
  }),
14
26
  phone: (phone, token) => apiClientFactory_1.apiClientV2.postRequest('/auth/verify/phone/otp', {
15
- data: { phone, token, type: 'sms' },
27
+ data: { phone: (0, converters_1.convertPhoneToSupabaseFormat)(phone), token, type: 'sms' },
16
28
  }),
17
29
  },
18
30
  },
19
31
  signin: {
20
32
  omni: {
21
33
  email: (data) => apiClientFactory_1.apiClientV2.postRequest('/auth/sign-in/omni/email/otp', { data }),
22
- phone: (data) => apiClientFactory_1.apiClientV2.postRequest('/auth/sign-in/omni/phone/otp', { data }),
34
+ phone: (_a) => {
35
+ var { phone } = _a, data = __rest(_a, ["phone"]);
36
+ return apiClientFactory_1.apiClientV2.postRequest('/auth/sign-in/omni/phone/otp', {
37
+ data: Object.assign({ phone: (0, converters_1.convertPhoneToSupabaseFormat)(phone) }, data),
38
+ });
39
+ },
23
40
  },
24
41
  telegram: (data) => apiClientFactory_1.apiClientV2.postRequest(exports.telegramSignInPath, { data }),
25
42
  password: (email, password // check on backend V2
@@ -0,0 +1 @@
1
+ export declare const convertPhoneToSupabaseFormat: (phone: string) => string;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertPhoneToSupabaseFormat = void 0;
4
+ const convertPhoneToSupabaseFormat = (phone) => phone.replace(/\D/g, '');
5
+ exports.convertPhoneToSupabaseFormat = convertPhoneToSupabaseFormat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squarefi-bff-api-module",
3
- "version": "1.10.10",
3
+ "version": "1.10.11",
4
4
  "description": "Squarefi BFF API client module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/api/auth.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { API } from './types';
2
2
 
3
3
  import { apiClientV2 } from '../utils/apiClientFactory';
4
+ import { convertPhoneToSupabaseFormat } from '../utils/converters';
4
5
 
5
6
  export const telegramSignInPath = '/auth/sign-in/telegram';
6
7
  export const telegramSignUpPath = '/auth/sign-up/telegram';
@@ -15,7 +16,7 @@ export const auth = {
15
16
  }),
16
17
  phone: (phone: string, token: string) =>
17
18
  apiClientV2.postRequest<API.Auth.VerifyOtp.Response>('/auth/verify/phone/otp', {
18
- data: { phone, token, type: 'sms' },
19
+ data: { phone: convertPhoneToSupabaseFormat(phone), token, type: 'sms' },
19
20
  }),
20
21
  },
21
22
  },
@@ -23,8 +24,10 @@ export const auth = {
23
24
  omni: {
24
25
  email: (data: API.Auth.SignIn.Email.OTP.Request) =>
25
26
  apiClientV2.postRequest('/auth/sign-in/omni/email/otp', { data }),
26
- phone: (data: API.Auth.SignIn.Phone.OTP.Request) =>
27
- apiClientV2.postRequest('/auth/sign-in/omni/phone/otp', { data }),
27
+ phone: ({ phone, ...data }: API.Auth.SignIn.Phone.OTP.Request) =>
28
+ apiClientV2.postRequest('/auth/sign-in/omni/phone/otp', {
29
+ data: { phone: convertPhoneToSupabaseFormat(phone), ...data },
30
+ }),
28
31
  },
29
32
  telegram: (data: API.Auth.Telegram.Signin) =>
30
33
  apiClientV2.postRequest<API.Auth.Tokens>(telegramSignInPath, { data }),
@@ -0,0 +1 @@
1
+ export const convertPhoneToSupabaseFormat = (phone: string) => phone.replace(/\D/g, '');