@bzbs/react-api-client 2.0.1 → 2.0.3

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.d.mts CHANGED
@@ -501,6 +501,11 @@ interface RedeemResponse {
501
501
  ExpireIn?: number;
502
502
  Points?: number;
503
503
  UpdatedPoints?: UpdatedPoints | null;
504
+ PointServiceUnit?: string;
505
+ PointServiceAmount?: number;
506
+ PointServiceTranId?: string;
507
+ PointServiceRef?: string;
508
+ PointServiceBalance?: number;
504
509
  PrivilegeMessage?: string;
505
510
  PrivilegeMessageEN?: string;
506
511
  PrivilegeMessageFormat?: string;
@@ -1587,7 +1592,7 @@ declare class AuthenticateApi extends BaseService {
1587
1592
  options?: {
1588
1593
  [key: string]: unknown;
1589
1594
  };
1590
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<ForgetPasswordResponse>>;
1595
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<ForgetPasswordResponse>>;
1591
1596
  /**
1592
1597
  * Resets the password for a user.
1593
1598
  *
@@ -1608,7 +1613,7 @@ declare class AuthenticateApi extends BaseService {
1608
1613
  options?: {
1609
1614
  [key: string]: unknown;
1610
1615
  };
1611
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<StatusResponse>>;
1616
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<StatusResponse>>;
1612
1617
  /**
1613
1618
  * Sends an OTP (One-Time Password) to the user for authentication (GET method).
1614
1619
  *
@@ -2485,7 +2490,7 @@ declare class ProfileApi extends BaseService {
2485
2490
  options?: {
2486
2491
  [key: string]: unknown;
2487
2492
  };
2488
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<StatusResponse>>;
2493
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<StatusResponse>>;
2489
2494
  /**
2490
2495
  * Updates the shipping information for the user.
2491
2496
  *
@@ -2717,7 +2722,7 @@ declare class RegistrationApi extends BaseService {
2717
2722
  options: {
2718
2723
  [key: string]: unknown;
2719
2724
  };
2720
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<RegistrationResponse>>;
2725
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<RegistrationResponse>>;
2721
2726
  }
2722
2727
 
2723
2728
  declare class AddressApi extends BaseService {
package/dist/index.d.ts CHANGED
@@ -501,6 +501,11 @@ interface RedeemResponse {
501
501
  ExpireIn?: number;
502
502
  Points?: number;
503
503
  UpdatedPoints?: UpdatedPoints | null;
504
+ PointServiceUnit?: string;
505
+ PointServiceAmount?: number;
506
+ PointServiceTranId?: string;
507
+ PointServiceRef?: string;
508
+ PointServiceBalance?: number;
504
509
  PrivilegeMessage?: string;
505
510
  PrivilegeMessageEN?: string;
506
511
  PrivilegeMessageFormat?: string;
@@ -1587,7 +1592,7 @@ declare class AuthenticateApi extends BaseService {
1587
1592
  options?: {
1588
1593
  [key: string]: unknown;
1589
1594
  };
1590
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<ForgetPasswordResponse>>;
1595
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<ForgetPasswordResponse>>;
1591
1596
  /**
1592
1597
  * Resets the password for a user.
1593
1598
  *
@@ -1608,7 +1613,7 @@ declare class AuthenticateApi extends BaseService {
1608
1613
  options?: {
1609
1614
  [key: string]: unknown;
1610
1615
  };
1611
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<StatusResponse>>;
1616
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<StatusResponse>>;
1612
1617
  /**
1613
1618
  * Sends an OTP (One-Time Password) to the user for authentication (GET method).
1614
1619
  *
@@ -2485,7 +2490,7 @@ declare class ProfileApi extends BaseService {
2485
2490
  options?: {
2486
2491
  [key: string]: unknown;
2487
2492
  };
2488
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<StatusResponse>>;
2493
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<StatusResponse>>;
2489
2494
  /**
2490
2495
  * Updates the shipping information for the user.
2491
2496
  *
@@ -2717,7 +2722,7 @@ declare class RegistrationApi extends BaseService {
2717
2722
  options: {
2718
2723
  [key: string]: unknown;
2719
2724
  };
2720
- }, requestOptions?: RequestOptions): Promise<ServiceResponse<RegistrationResponse>>;
2725
+ }, requestOptions?: RequestOptions, version?: number): Promise<ServiceResponse<RegistrationResponse>>;
2721
2726
  }
2722
2727
 
2723
2728
  declare class AddressApi extends BaseService {
package/dist/index.js CHANGED
@@ -100,9 +100,26 @@ var BaseService = class {
100
100
  };
101
101
  }
102
102
  if (error.response && error.response.data) {
103
+ const data = error.response.data;
104
+ if (data["Success"]) {
105
+ return {
106
+ type: "server-error",
107
+ error: {
108
+ requestId: data.RequestId || "",
109
+ error: {
110
+ id: data.Code || data.code || error.response.status,
111
+ message: data.Message || data.message || error.response.statusText,
112
+ code: data.Code || data.code || error.response.status,
113
+ type: "buzzebees"
114
+ }
115
+ },
116
+ statusCode: error.response.status,
117
+ response: error.response
118
+ };
119
+ }
103
120
  return {
104
121
  type: "server-error",
105
- error: error.response.data,
122
+ error: data,
106
123
  statusCode: error.response.status,
107
124
  response: error.response
108
125
  };
@@ -611,10 +628,10 @@ var AuthenticateApi = class extends BaseService {
611
628
  * @param requestOptions - Optional request options.
612
629
  * @returns A promise that resolves to a ServiceResponse containing the forget password response.
613
630
  */
614
- forgetPassword(params, requestOptions) {
631
+ forgetPassword(params, requestOptions, version = 2) {
615
632
  return __async(this, null, function* () {
616
633
  return yield this.get(
617
- "profile/forget_password",
634
+ `profile/forget_password${version}`,
618
635
  __spreadValues({
619
636
  id: params.contact,
620
637
  type: params.type
@@ -635,10 +652,10 @@ var AuthenticateApi = class extends BaseService {
635
652
  * @param requestOptions - (Optional) Additional options for the request.
636
653
  * @returns A promise that resolves to a ServiceResponse containing the status response.
637
654
  */
638
- resetPassword(params, requestOptions) {
655
+ resetPassword(params, requestOptions, version = 2) {
639
656
  return __async(this, null, function* () {
640
657
  return yield this.post(
641
- "profile/forget_password",
658
+ `profile/forget_password${version}`,
642
659
  __spreadValues({
643
660
  id: params.contact,
644
661
  refcode: params.refCode,
@@ -1771,10 +1788,10 @@ var ProfileApi = class extends BaseService {
1771
1788
  * @param requestOptions - Optional request options.
1772
1789
  * @returns A promise that resolves to a ServiceResponse containing the status response.
1773
1790
  */
1774
- changePassword(params, requestOptions) {
1791
+ changePassword(params, requestOptions, version = 2) {
1775
1792
  return __async(this, null, function* () {
1776
1793
  return yield this.post(
1777
- "profile/change_password",
1794
+ `profile/change_password${version}`,
1778
1795
  __spreadValues({
1779
1796
  current: params.current,
1780
1797
  change: params.change
@@ -2037,10 +2054,10 @@ var RegistrationApi = class extends BaseService {
2037
2054
  * @param requestOptions - The optional request options.
2038
2055
  * @returns A promise that resolves to a service response containing the registration response.
2039
2056
  */
2040
- register(params, requestOptions) {
2057
+ register(params, requestOptions, version = 2) {
2041
2058
  return __async(this, null, function* () {
2042
2059
  return yield this.post(
2043
- "auth/register",
2060
+ `auth/register${version}`,
2044
2061
  __spreadValues({
2045
2062
  app_id: params.appId,
2046
2063
  uuid: params.uuid,