@bzbs/react-api-client 1.4.6 → 1.4.9

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
@@ -44,6 +44,11 @@ type RequestOptions = {
44
44
  data?: any;
45
45
  baseUrl?: string;
46
46
  };
47
+ type CrossPlatformFile = File | {
48
+ uri: string;
49
+ name: string;
50
+ type: string;
51
+ } | object;
47
52
  declare class BaseService {
48
53
  private client;
49
54
  private baseUrl;
@@ -62,6 +67,8 @@ declare class BaseService {
62
67
  }): {
63
68
  [key: string]: string;
64
69
  };
70
+ setBaseUrl(baseUrl: string): this;
71
+ static createFormData(data: Record<string, any>, fileKey?: string, file?: CrossPlatformFile): FormData;
65
72
  }
66
73
 
67
74
  interface LoginResponse {
@@ -3103,6 +3110,9 @@ declare class BzbsService {
3103
3110
  settingApi: SettingApi;
3104
3111
  blob: Blob;
3105
3112
  constructor(client: AxiosInstance, baseUrl: string, baseLineUrl: string | "", baseBlobUrl: string);
3113
+ setBaseUrl(baseUrl: string): this;
3114
+ setBlobUrl(blobUrl: string): this;
3115
+ setLineUrl(lineUrl: string): this;
3106
3116
  }
3107
3117
 
3108
- export { type AccessTokenResponse, type Address, AddressApi, type ApiResponse, type AppleToken, AuthenticateApi, type Badge, BadgeApi, BaseService, Blob, type Buzzebees, type BzbsErrorResponse, BzbsService, type Campaign, CampaignApi, type CampaignDetail, type CartAccessResponse, CartApi, type CartCountResponse, type Category, CategoryApi, type ChatMessage, type ClientError, type ConfirmOtpResponse, type Consent, ConsentApi, type ConsentVersion, type ConsentVersionValue, CouponApi, type CouponResponse, type CouponResponseData, type CreateStampResponse, type Dashboard, DashboardApi, type Detail, type District, type ErrorResponse, type ExpiringPoints, type FavoriteResponse, type ForgetPasswordResponse, HistoryApi, type LikeForumResponse, LineApi, type LineAuthResponse, type LoginResponse, type Maintenance, type Mission, type Notification, NotificationApi, type OtpResponse, type Picture, type Place, PlaceApi, type PlaceService, type PointLog, PointLogApi, type PointUnit, ProfileApi, type ProfileResponse, type Province, type Purchase, type RedeemResponse, RegistrationApi, type RegistrationResponse, RequestHelpApi, type RequestHelpCode, type RequestOptions, type ResumeResponse, type ServerError, type ServiceResponse, SettingApi, type Stamp, StampApi, type StampCampaign, type StampHistory, type StampProfileResponse, type StatusResponse, type Style, type SubCampaign, type SubCampaignStyle, type SubDistrict, type SuccessResponse, type Trace, type UpdatedPoints, type UseCampaignResponse, type ValidateOtpResponse, type Version, type ZipCode };
3118
+ export { type AccessTokenResponse, type Address, AddressApi, type ApiResponse, type AppleToken, AuthenticateApi, type Badge, BadgeApi, BaseService, Blob, type Buzzebees, type BzbsErrorResponse, BzbsService, type Campaign, CampaignApi, type CampaignDetail, type CartAccessResponse, CartApi, type CartCountResponse, type Category, CategoryApi, type ChatMessage, type ClientError, type ConfirmOtpResponse, type Consent, ConsentApi, type ConsentVersion, type ConsentVersionValue, CouponApi, type CouponResponse, type CouponResponseData, type CreateStampResponse, type CrossPlatformFile, type Dashboard, DashboardApi, type Detail, type District, type ErrorResponse, type ExpiringPoints, type FavoriteResponse, type ForgetPasswordResponse, HistoryApi, type LikeForumResponse, LineApi, type LineAuthResponse, type LoginResponse, type Maintenance, type Mission, type Notification, NotificationApi, type OtpResponse, type Picture, type Place, PlaceApi, type PlaceService, type PointLog, PointLogApi, type PointUnit, ProfileApi, type ProfileResponse, type Province, type Purchase, type RedeemResponse, RegistrationApi, type RegistrationResponse, RequestHelpApi, type RequestHelpCode, type RequestOptions, type ResumeResponse, type ServerError, type ServiceResponse, SettingApi, type Stamp, StampApi, type StampCampaign, type StampHistory, type StampProfileResponse, type StatusResponse, type Style, type SubCampaign, type SubCampaignStyle, type SubDistrict, type SuccessResponse, type Trace, type UpdatedPoints, type UseCampaignResponse, type ValidateOtpResponse, type Version, type ZipCode };
package/dist/index.d.ts CHANGED
@@ -44,6 +44,11 @@ type RequestOptions = {
44
44
  data?: any;
45
45
  baseUrl?: string;
46
46
  };
47
+ type CrossPlatformFile = File | {
48
+ uri: string;
49
+ name: string;
50
+ type: string;
51
+ } | object;
47
52
  declare class BaseService {
48
53
  private client;
49
54
  private baseUrl;
@@ -62,6 +67,8 @@ declare class BaseService {
62
67
  }): {
63
68
  [key: string]: string;
64
69
  };
70
+ setBaseUrl(baseUrl: string): this;
71
+ static createFormData(data: Record<string, any>, fileKey?: string, file?: CrossPlatformFile): FormData;
65
72
  }
66
73
 
67
74
  interface LoginResponse {
@@ -3103,6 +3110,9 @@ declare class BzbsService {
3103
3110
  settingApi: SettingApi;
3104
3111
  blob: Blob;
3105
3112
  constructor(client: AxiosInstance, baseUrl: string, baseLineUrl: string | "", baseBlobUrl: string);
3113
+ setBaseUrl(baseUrl: string): this;
3114
+ setBlobUrl(blobUrl: string): this;
3115
+ setLineUrl(lineUrl: string): this;
3106
3116
  }
3107
3117
 
3108
- export { type AccessTokenResponse, type Address, AddressApi, type ApiResponse, type AppleToken, AuthenticateApi, type Badge, BadgeApi, BaseService, Blob, type Buzzebees, type BzbsErrorResponse, BzbsService, type Campaign, CampaignApi, type CampaignDetail, type CartAccessResponse, CartApi, type CartCountResponse, type Category, CategoryApi, type ChatMessage, type ClientError, type ConfirmOtpResponse, type Consent, ConsentApi, type ConsentVersion, type ConsentVersionValue, CouponApi, type CouponResponse, type CouponResponseData, type CreateStampResponse, type Dashboard, DashboardApi, type Detail, type District, type ErrorResponse, type ExpiringPoints, type FavoriteResponse, type ForgetPasswordResponse, HistoryApi, type LikeForumResponse, LineApi, type LineAuthResponse, type LoginResponse, type Maintenance, type Mission, type Notification, NotificationApi, type OtpResponse, type Picture, type Place, PlaceApi, type PlaceService, type PointLog, PointLogApi, type PointUnit, ProfileApi, type ProfileResponse, type Province, type Purchase, type RedeemResponse, RegistrationApi, type RegistrationResponse, RequestHelpApi, type RequestHelpCode, type RequestOptions, type ResumeResponse, type ServerError, type ServiceResponse, SettingApi, type Stamp, StampApi, type StampCampaign, type StampHistory, type StampProfileResponse, type StatusResponse, type Style, type SubCampaign, type SubCampaignStyle, type SubDistrict, type SuccessResponse, type Trace, type UpdatedPoints, type UseCampaignResponse, type ValidateOtpResponse, type Version, type ZipCode };
3118
+ export { type AccessTokenResponse, type Address, AddressApi, type ApiResponse, type AppleToken, AuthenticateApi, type Badge, BadgeApi, BaseService, Blob, type Buzzebees, type BzbsErrorResponse, BzbsService, type Campaign, CampaignApi, type CampaignDetail, type CartAccessResponse, CartApi, type CartCountResponse, type Category, CategoryApi, type ChatMessage, type ClientError, type ConfirmOtpResponse, type Consent, ConsentApi, type ConsentVersion, type ConsentVersionValue, CouponApi, type CouponResponse, type CouponResponseData, type CreateStampResponse, type CrossPlatformFile, type Dashboard, DashboardApi, type Detail, type District, type ErrorResponse, type ExpiringPoints, type FavoriteResponse, type ForgetPasswordResponse, HistoryApi, type LikeForumResponse, LineApi, type LineAuthResponse, type LoginResponse, type Maintenance, type Mission, type Notification, NotificationApi, type OtpResponse, type Picture, type Place, PlaceApi, type PlaceService, type PointLog, PointLogApi, type PointUnit, ProfileApi, type ProfileResponse, type Province, type Purchase, type RedeemResponse, RegistrationApi, type RegistrationResponse, RequestHelpApi, type RequestHelpCode, type RequestOptions, type ResumeResponse, type ServerError, type ServiceResponse, SettingApi, type Stamp, StampApi, type StampCampaign, type StampHistory, type StampProfileResponse, type StatusResponse, type Style, type SubCampaign, type SubCampaignStyle, type SubDistrict, type SuccessResponse, type Trace, type UpdatedPoints, type UseCampaignResponse, type ValidateOtpResponse, type Version, type ZipCode };
package/dist/index.js CHANGED
@@ -195,6 +195,21 @@ var BaseService = class {
195
195
  "Content-Type": "application/json"
196
196
  }, customHeaders);
197
197
  }
198
+ setBaseUrl(baseUrl) {
199
+ if (baseUrl.length === 0) throw new Error("Base URL is required.");
200
+ this.baseUrl = baseUrl;
201
+ return this;
202
+ }
203
+ static createFormData(data, fileKey, file) {
204
+ const formData = new FormData();
205
+ for (const key in data) {
206
+ formData.append(key, data[key]);
207
+ }
208
+ if (file) {
209
+ formData.append(fileKey != null ? fileKey : "data", file);
210
+ }
211
+ return formData;
212
+ }
198
213
  };
199
214
 
200
215
  // src/api/auth/auth-api.ts
@@ -1804,8 +1819,7 @@ var ProfileApi = class extends BaseService {
1804
1819
  return __async(this, null, function* () {
1805
1820
  return yield this.post(
1806
1821
  "profile/me",
1807
- __spreadValues({
1808
- data: params.profileImage,
1822
+ BaseService.createFormData(__spreadValues({
1809
1823
  firstname: params.firstName,
1810
1824
  lastname: params.lastName,
1811
1825
  contact_number: params.contactNumber,
@@ -1853,7 +1867,7 @@ var ProfileApi = class extends BaseService {
1853
1867
  occupation: params.occupation,
1854
1868
  remark: params.remark,
1855
1869
  displayname: params.displayName
1856
- }, params.options),
1870
+ }, params.options), "profileImage", params.profileImage),
1857
1871
  {
1858
1872
  headers: __spreadValues({
1859
1873
  "Content-Type": "multipart/form-data"
@@ -2770,6 +2784,37 @@ var BzbsService = class {
2770
2784
  this.settingApi = new SettingApi(this.client, this.baseUrl);
2771
2785
  this.blob = new Blob(this.client, this.baseBlobUrl);
2772
2786
  }
2787
+ setBaseUrl(baseUrl) {
2788
+ this.baseUrl = baseUrl;
2789
+ this.authApi.setBaseUrl(baseUrl);
2790
+ this.badgeApi.setBaseUrl(baseUrl);
2791
+ this.campaignApi.setBaseUrl(baseUrl);
2792
+ this.cartApi.setBaseUrl(baseUrl);
2793
+ this.categoryApi.setBaseUrl(baseUrl);
2794
+ this.consentApi.setBaseUrl(baseUrl);
2795
+ this.couponApi.setBaseUrl(baseUrl);
2796
+ this.dashboardApi.setBaseUrl(baseUrl);
2797
+ this.historyApi.setBaseUrl(baseUrl);
2798
+ this.notificationApi.setBaseUrl(baseUrl);
2799
+ this.placeApi.setBaseUrl(baseUrl);
2800
+ this.pointLogApi.setBaseUrl(baseUrl);
2801
+ this.profileApi.setBaseUrl(baseUrl);
2802
+ this.registerApi.setBaseUrl(baseUrl);
2803
+ this.addressApi.setBaseUrl(baseUrl);
2804
+ this.stampApi.setBaseUrl(baseUrl);
2805
+ this.forumApi.setBaseUrl(baseUrl);
2806
+ this.settingApi.setBaseUrl(baseUrl);
2807
+ return this;
2808
+ }
2809
+ setBlobUrl(blobUrl) {
2810
+ this.blob.setBaseUrl(blobUrl);
2811
+ return this;
2812
+ }
2813
+ setLineUrl(lineUrl) {
2814
+ var _a;
2815
+ (_a = this.lineApi) == null ? void 0 : _a.setBaseUrl(lineUrl);
2816
+ return this;
2817
+ }
2773
2818
  };
2774
2819
  // Annotate the CommonJS export names for ESM import in node:
2775
2820
  0 && (module.exports = {