@bzbs/react-api-client 2.1.0 → 2.1.1

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  A TypeScript library providing a type-safe API client for Buzzebees loyalty and reward services. Supports authentication, campaigns, user profiles, shopping carts, notifications, stamps, consent management, and more.
4
4
 
5
- **Version:** 1.4.15 | **License:** ISC | **Author:** Buzzebees Co., Ltd.
5
+ **Version:** 2.1.0 | **License:** ISC | **Author:** Buzzebees Co., Ltd.
6
6
  **Repository:** [Azure DevOps](https://dev.azure.com/buzzebees/Buzzebees/_git/React_API_Client)
7
7
 
8
8
  ---
@@ -34,6 +34,7 @@ A TypeScript library providing a type-safe API client for Buzzebees loyalty and
34
34
  - [LineApi](#lineapi)
35
35
  - [PlaceApi](#placeapi)
36
36
  - [PointLogApi](#pointlogapi)
37
+ - [PointApi](#pointapi)
37
38
  - [StampApi](#stampapi)
38
39
  - [RequestHelpApi (Forum)](#requesthelpapi-forum)
39
40
  - [SettingApi](#settingapi)
@@ -180,6 +181,7 @@ BzbsService (entry point)
180
181
  ├── NotificationApi → notification/
181
182
  ├── PlaceApi → place/
182
183
  ├── PointLogApi → log/points
184
+ ├── PointApi → point/
183
185
  ├── ProfileApi → profile/
184
186
  ├── RegistrationApi → auth/register
185
187
  ├── AddressApi → profile/address, address/
@@ -224,6 +226,7 @@ src/
224
226
  │ ├── notification/notification-api.ts
225
227
  │ ├── place/place-api.ts
226
228
  │ ├── point-log/point-log-api.ts
229
+ │ ├── points/point-api.ts
227
230
  │ ├── profile/profile-api.ts
228
231
  │ ├── registration/registration-api.ts
229
232
  │ ├── request-help/request-help-api.ts
@@ -252,6 +255,7 @@ src/
252
255
  | `notificationApi` | `NotificationApi` | Push notifications |
253
256
  | `placeApi` | `PlaceApi` | Locations / stores |
254
257
  | `pointLogApi` | `PointLogApi` | Point transaction logs |
258
+ | `pointApi` | `PointApi` | Multi-unit point balances and transaction history |
255
259
  | `profileApi` | `ProfileApi` | User profile, points, account |
256
260
  | `registerApi` | `RegistrationApi` | User registration |
257
261
  | `addressApi` | `AddressApi` | Addresses, provinces, districts |
@@ -396,6 +400,9 @@ const response = await bzbsService.profileApi.profile(undefined, {
396
400
  | `placeApi` | `addToFavourite` | POST | `place/{id}/favourite` | id | `unknown` | `#place` |
397
401
  | `placeApi` | `removeFromFavourite` | POST | `place/{id}/unfavourite` | id | `unknown` | `#place` |
398
402
  | `pointLogApi` | `getPointLog` | GET | `log/points` | month; opt: type, lastRowKey, top | `PointLog[]` | `#points #profile` |
403
+ | `pointApi` | `balance` | GET | `point/balance` | opt: units, boxIds, onlyVisible | `PointBalance[]` | `#points` |
404
+ | `pointApi` | `detail` | GET | `point/detail` | opt: units, boxIds, onlyVisible | `PointBalance[]` | `#points` |
405
+ | `pointApi` | `history` | GET | `point/history` | start, end; opt: onlyVisible, skip, top, sortType, units, boxIds, references, transactionIds, includeActions, excludeActions, includeTypes, excludeTypes | `PointHistory[]` | `#points` |
399
406
  | `profileApi` | `profile` | GET | `profile/info` | opt: options | `ProfileResponse` | `#profile` |
400
407
  | `profileApi` | `updateProfile` | POST | `profile/info` | opt: firstName, lastName, contactNumber, email, notification, locale, title, gender, birthDate, address, subdistrictCode, districtCode, provinceCode, countryCode, zipCode, idCard, passport, maritalStatus, displayName, latitude, longitude, income, interests, region, occupation, remark, ... (JSON body) | `ProfileResponse` | `#profile` |
401
408
  | `profileApi` | `updateProfileImage` | POST | `profile/picture` | image (File or `{uri, name, type}`, sent as `multipart/form-data` with key `data`) | `ProfileResponse` | `#profile` |
@@ -910,6 +917,65 @@ const logs = await bzbsService.pointLogApi.getPointLog({
910
917
 
911
918
  ---
912
919
 
920
+ ### PointApi
921
+
922
+ `bzbsService.pointApi` — Multi-unit point balances, breakdowns, and transaction history (earn/burn/transfer).
923
+
924
+ | Method | Description | Returns |
925
+ |---|---|---|
926
+ | `balance(params?)` | Current point balance for the user across requested units | `PointBalance[]` |
927
+ | `detail(params?)` | Point balance with `Currents` and `Expires` breakdowns keyed by date | `PointBalance[]` |
928
+ | `history(params)` | Paginated list of earn/burn/transfer transactions in a date range | `PointHistory[]` |
929
+
930
+ **Common params (`balance` / `detail`):**
931
+
932
+ | Param | Type | Required | Description |
933
+ |---|---|---|---|
934
+ | `units` | `string` | No | Point unit codes (e.g. `Point`, `Coin`). Omit for all configured units. Sent as `units[]`. |
935
+ | `boxIds` | `string` | No | Box (sub-bucket) identifiers. Sent as `boxIds[]`. |
936
+ | `onlyVisible` | `boolean` | No | When `true` (default), only units marked visible for the app are considered. |
937
+
938
+ **`history` params:**
939
+
940
+ | Param | Type | Required | Description |
941
+ |---|---|---|---|
942
+ | `start` | `string` | Yes | Start of the range (inclusive), ISO-8601 with offset |
943
+ | `end` | `string` | Yes | End of the range (inclusive), ISO-8601 with offset |
944
+ | `skip` | `number` | No | Offset pagination |
945
+ | `top` | `number` | No | Maximum records to return |
946
+ | `sortType` | `'Asc' \| 'Desc'` | No | Sort direction by `Timestamp` |
947
+ | `units` | `string` | No | Filter by point unit codes (sent as `units[]`) |
948
+ | `boxIds` | `string` | No | Filter by box ids (sent as `boxIds[]`) |
949
+ | `references` | `string` | No | Filter by transaction reference (sent as `references[]`) |
950
+ | `transactionIds` | `string` | No | Filter by exact transaction ids (sent as `transactionIds[]`) |
951
+ | `includeActions` | `string` | No | Only include actions (e.g. `Earn`, `Burn`, `Transfer`) — sent as `includeActions[]` |
952
+ | `excludeActions` | `string` | No | Exclude actions — sent as `excludeActions[]` |
953
+ | `includeTypes` | `string` | No | Only include types — sent as `includeTypes[]` |
954
+ | `excludeTypes` | `string` | No | Exclude types — sent as `excludeTypes[]` |
955
+ | `onlyVisible` | `boolean` | No | Restrict to visible units (default `true`) |
956
+
957
+ ```typescript
958
+ // Current balance across all configured units
959
+ const balance = await bzbsService.pointApi.balance();
960
+
961
+ // Specific units only
962
+ const coinBalance = await bzbsService.pointApi.balance({ units: 'Coin' });
963
+
964
+ // Balance with current/expiring breakdowns
965
+ const detail = await bzbsService.pointApi.detail({ onlyVisible: true });
966
+
967
+ // Paginated transaction history
968
+ const history = await bzbsService.pointApi.history({
969
+ start: '2025-01-01T00:00:00+07:00',
970
+ end: '2025-01-31T23:59:59+07:00',
971
+ top: 50,
972
+ sortType: 'Desc',
973
+ includeActions: 'Earn',
974
+ });
975
+ ```
976
+
977
+ ---
978
+
913
979
  ### StampApi
914
980
 
915
981
  `bzbsService.stampApi` — Stamp card system.
@@ -1064,6 +1130,8 @@ import {
1064
1130
  | `Badge` | badgeId, name, description, imageUrl, missions (Mission[]) |
1065
1131
  | `Mission` | missionId, name, current, target, isCompleted |
1066
1132
  | `PointLog` | UserId, Info, Detail, Points, Type, Timestamp |
1133
+ | `PointBalance` | Unit, Balance, Currents (date → amount map), Expires (date → amount map) |
1134
+ | `PointHistory` | Unit, TransactionId, Reference, Timestamp, TotalChange, Action, Type, Message, Data |
1067
1135
 
1068
1136
  ### Address & Location Models
1069
1137
 
package/dist/index.js CHANGED
@@ -1715,8 +1715,8 @@ var PointApi = class extends BaseService {
1715
1715
  return yield this.get(
1716
1716
  "point/balance",
1717
1717
  __spreadValues({
1718
- units: params == null ? void 0 : params.units,
1719
- boxIds: params == null ? void 0 : params.boxIds,
1718
+ "units[]": params == null ? void 0 : params.units,
1719
+ "boxIds[]": params == null ? void 0 : params.boxIds,
1720
1720
  onlyVisible: params == null ? void 0 : params.onlyVisible
1721
1721
  }, params == null ? void 0 : params.options),
1722
1722
  requestOptions
@@ -1739,8 +1739,8 @@ var PointApi = class extends BaseService {
1739
1739
  return yield this.get(
1740
1740
  "point/detail",
1741
1741
  __spreadValues({
1742
- units: params == null ? void 0 : params.units,
1743
- boxIds: params == null ? void 0 : params.boxIds,
1742
+ "units[]": params == null ? void 0 : params.units,
1743
+ "boxIds[]": params == null ? void 0 : params.boxIds,
1744
1744
  onlyVisible: params == null ? void 0 : params.onlyVisible
1745
1745
  }, params == null ? void 0 : params.options),
1746
1746
  requestOptions
@@ -1780,14 +1780,14 @@ var PointApi = class extends BaseService {
1780
1780
  skip: params.skip,
1781
1781
  top: params.top,
1782
1782
  sortType: params.sortType,
1783
- units: params.units,
1784
- boxIds: params.boxIds,
1785
- references: params.references,
1786
- transactionIds: params.transactionIds,
1787
- includeActions: params.includeActions,
1788
- excludeActions: params.excludeActions,
1789
- includeTypes: params.includeTypes,
1790
- excludeTypes: params.excludeTypes
1783
+ "units[]": params.units,
1784
+ "boxIds[]": params.boxIds,
1785
+ "references[]": params.references,
1786
+ "transactionIds[]": params.transactionIds,
1787
+ "includeActions[]": params.includeActions,
1788
+ "excludeActions[]": params.excludeActions,
1789
+ "includeTypes[]": params.includeTypes,
1790
+ "excludeTypes[]": params.excludeTypes
1791
1791
  }, params.options),
1792
1792
  requestOptions
1793
1793
  );