@commercengine/pos 0.2.0 → 0.3.0

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.js CHANGED
@@ -1015,13 +1015,13 @@ var PosAPIClient = class PosAPIClient extends BaseAPIClient {
1015
1015
  */
1016
1016
  var PosClient = class extends PosAPIClient {
1017
1017
  /**
1018
- * Login with email address for POS device
1019
- * @param body - Login credentials containing device ID and email
1018
+ * Login with email address
1019
+ * @param body - Login credentials containing location ID and email
1020
1020
  * @returns Promise with OTP token and action
1021
1021
  * @example
1022
1022
  * ```typescript
1023
1023
  * const { data, error } = await pos.loginWithEmail({
1024
- * device_id: "pos-device-123",
1024
+ * location_id: "pos-location-123",
1025
1025
  * email: "staff@example.com"
1026
1026
  * });
1027
1027
  *
@@ -1038,13 +1038,13 @@ var PosClient = class extends PosAPIClient {
1038
1038
  return this.executeRequest(() => this.client.POST("/pos/auth/login/email", { body }));
1039
1039
  }
1040
1040
  /**
1041
- * Login with phone number for POS device
1042
- * @param body - Login credentials containing device ID and phone
1041
+ * Login with phone number
1042
+ * @param body - Login credentials containing location ID and phone
1043
1043
  * @returns Promise with OTP token and action
1044
1044
  * @example
1045
1045
  * ```typescript
1046
1046
  * const { data, error } = await pos.loginWithPhone({
1047
- * device_id: "pos-device-123",
1047
+ * location_id: "pos-location-123",
1048
1048
  * phone: "234567890",
1049
1049
  * country_code: "+91" // default is +91
1050
1050
  * });
@@ -1062,13 +1062,13 @@ var PosClient = class extends PosAPIClient {
1062
1062
  return this.executeRequest(() => this.client.POST("/pos/auth/login/phone", { body }));
1063
1063
  }
1064
1064
  /**
1065
- * Login with WhatsApp for POS device
1066
- * @param body - Login credentials containing device ID and phone
1065
+ * Login with WhatsApp
1066
+ * @param body - Login credentials containing location ID and phone
1067
1067
  * @returns Promise with OTP token and action
1068
1068
  * @example
1069
1069
  * ```typescript
1070
1070
  * const { data, error } = await pos.loginWithWhatsapp({
1071
- * device_id: "pos-device-123",
1071
+ * location_id: "pos-location-123",
1072
1072
  * phone: "234567890",
1073
1073
  * country_code: "+91" // default is +91
1074
1074
  * });
@@ -1086,29 +1086,7 @@ var PosClient = class extends PosAPIClient {
1086
1086
  return this.executeRequest(() => this.client.POST("/pos/auth/login/whatsapp", { body }));
1087
1087
  }
1088
1088
  /**
1089
- * Pair POS device with pairing code
1090
- * @param body - Pairing code received via phone/email
1091
- * @returns Promise with device information
1092
- * @example
1093
- * ```typescript
1094
- * const { data, error } = await pos.pairDevice({
1095
- * pairing_code: "ABC123"
1096
- * });
1097
- *
1098
- * if (error) {
1099
- * console.error("Device pairing failed:", error.message);
1100
- * } else {
1101
- * console.log("Device paired:", data.device.id);
1102
- * console.log("Device name:", data.device.name);
1103
- * // Store device_id for future use
1104
- * }
1105
- * ```
1106
- */
1107
- async pairDevice(body) {
1108
- return this.executeRequest(() => this.client.POST("/pos/auth/pair-device", { body }));
1109
- }
1110
- /**
1111
- * Verify OTP for POS login
1089
+ * Verify OTP
1112
1090
  * @param body - OTP verification data
1113
1091
  * @returns Promise with user info and tokens
1114
1092
  * @example
@@ -1155,7 +1133,7 @@ var PosClient = class extends PosAPIClient {
1155
1133
  return this.executeRequest(() => this.client.POST("/pos/auth/refresh-token", { body }));
1156
1134
  }
1157
1135
  /**
1158
- * Logout from POS device
1136
+ * Logout
1159
1137
  * @returns Promise with logout confirmation
1160
1138
  * @example
1161
1139
  * ```typescript
@@ -1174,6 +1152,100 @@ var PosClient = class extends PosAPIClient {
1174
1152
  return this.executeRequest(() => this.client.POST("/pos/auth/logout"));
1175
1153
  }
1176
1154
  /**
1155
+ * List store locations
1156
+ * @returns Promise with list of locations
1157
+ * @example
1158
+ * ```typescript
1159
+ * const { data, error } = await pos.listLocations();
1160
+ * if (error) {
1161
+ * console.error("Failed to list locations:", error.message);
1162
+ * } else {
1163
+ * console.log("Locations:", data.locations);
1164
+ * }
1165
+ * ```
1166
+ */
1167
+ async listLocations() {
1168
+ return this.executeRequest(() => this.client.GET("/pos/locations"));
1169
+ }
1170
+ /**
1171
+ * List devices
1172
+ * @returns Promise with list of devices
1173
+ * @example
1174
+ * ```typescript
1175
+ * const { data, error } = await pos.listDevices();
1176
+ * if (error) {
1177
+ * console.error("Failed to list devices:", error.message);
1178
+ * } else {
1179
+ * console.log("Devices:", data.devices);
1180
+ * }
1181
+ * ```
1182
+ */
1183
+ async listDevices() {
1184
+ return this.executeRequest(() => this.client.GET("/pos/devices"));
1185
+ }
1186
+ /**
1187
+ * Pair POS device with pairing code
1188
+ * @param body - Pairing code received via phone/email
1189
+ * @returns Promise with device information
1190
+ * @example
1191
+ * ```typescript
1192
+ * const { data, error } = await pos.pairDevice({
1193
+ * pairing_code: "ABC123"
1194
+ * });
1195
+ *
1196
+ * if (error) {
1197
+ * console.error("Device pairing failed:", error.message);
1198
+ * } else {
1199
+ * console.log("Device paired:", data.device.id);
1200
+ * console.log("Device name:", data.device.name);
1201
+ * // Store device_id for future use
1202
+ * }
1203
+ * ```
1204
+ */
1205
+ async pairDevice(body) {
1206
+ return this.executeRequest(() => this.client.POST("/pos/auth/pair-device", { body }));
1207
+ }
1208
+ /**
1209
+ * Unclaim POS device - Unlinks a device from the user session
1210
+ * @param pathParams - Device ID
1211
+ * @returns Promise with unclaim confirmation
1212
+ * @example
1213
+ * ```typescript
1214
+ * const { data, error } = await pos.unclaimDevice({
1215
+ * id: "01H9DEVICE12345ABCDE"
1216
+ * });
1217
+ *
1218
+ * if (error) {
1219
+ * console.error("Failed to unclaim device:", error.message);
1220
+ * } else {
1221
+ * console.log("Device unclaimed:", data.message);
1222
+ * }
1223
+ * ```
1224
+ */
1225
+ async unclaimDevice(pathParams) {
1226
+ return this.executeRequest(() => this.client.POST("/pos/devices/{id}/unclaim", { params: { path: pathParams } }));
1227
+ }
1228
+ /**
1229
+ * Claim POS device - Links a device to the user session
1230
+ * @param pathParams - Device ID
1231
+ * @returns Promise with claim confirmation
1232
+ * @example
1233
+ * ```typescript
1234
+ * const { data, error } = await pos.claimDevice({
1235
+ * id: "01H9DEVICE12345ABCDE"
1236
+ * });
1237
+ *
1238
+ * if (error) {
1239
+ * console.error("Failed to claim device:", error.message);
1240
+ * } else {
1241
+ * console.log("Device claimed:", data.message);
1242
+ * }
1243
+ * ```
1244
+ */
1245
+ async claimDevice(pathParams) {
1246
+ return this.executeRequest(() => this.client.POST("/pos/devices/{id}/claim", { params: { path: pathParams } }));
1247
+ }
1248
+ /**
1177
1249
  * Create a new cart
1178
1250
  * @param body - Cart creation data with items
1179
1251
  * @returns Promise with created cart