@bzbs/react-api-client 0.0.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 +54 -0
- package/dist/index.d.mts +1092 -0
- package/dist/index.d.ts +1092 -0
- package/dist/index.js +894 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +869 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +59 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,894 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var __async = (__this, __arguments, generator) => {
|
|
34
|
+
return new Promise((resolve, reject) => {
|
|
35
|
+
var fulfilled = (value) => {
|
|
36
|
+
try {
|
|
37
|
+
step(generator.next(value));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
reject(e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var rejected = (value) => {
|
|
43
|
+
try {
|
|
44
|
+
step(generator.throw(value));
|
|
45
|
+
} catch (e) {
|
|
46
|
+
reject(e);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
50
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/index.ts
|
|
55
|
+
var src_exports = {};
|
|
56
|
+
__export(src_exports, {
|
|
57
|
+
BaseService: () => BaseService,
|
|
58
|
+
BzbsService: () => BzbsService
|
|
59
|
+
});
|
|
60
|
+
module.exports = __toCommonJS(src_exports);
|
|
61
|
+
|
|
62
|
+
// src/api/base-service.ts
|
|
63
|
+
var BaseService = class {
|
|
64
|
+
constructor(client, baseUrl) {
|
|
65
|
+
this.client = client;
|
|
66
|
+
this.baseUrl = baseUrl;
|
|
67
|
+
if (!this.baseUrl) {
|
|
68
|
+
throw "Please check base_URL";
|
|
69
|
+
}
|
|
70
|
+
if (!this.client) {
|
|
71
|
+
throw "Please check client";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
get(path, params, requestOptions) {
|
|
75
|
+
return __async(this, null, function* () {
|
|
76
|
+
var _a, _b;
|
|
77
|
+
try {
|
|
78
|
+
const response = yield this.client.get(
|
|
79
|
+
this.joinUrl((_a = requestOptions == null ? void 0 : requestOptions.baseUrl) != null ? _a : this.baseUrl, path),
|
|
80
|
+
{
|
|
81
|
+
params: __spreadValues(__spreadValues({}, params ? params : {}), (requestOptions == null ? void 0 : requestOptions.params) ? requestOptions.params : {}),
|
|
82
|
+
headers: requestOptions == null ? void 0 : requestOptions.headers,
|
|
83
|
+
data: requestOptions == null ? void 0 : requestOptions.data
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
return {
|
|
87
|
+
model: response == null ? void 0 : response.data,
|
|
88
|
+
response,
|
|
89
|
+
error: void 0
|
|
90
|
+
};
|
|
91
|
+
} catch (error) {
|
|
92
|
+
return {
|
|
93
|
+
model: void 0,
|
|
94
|
+
response: void 0,
|
|
95
|
+
error: error.response ? error.response.data : (_b = error.response) != null ? _b : error
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
post(path, data, requestOptions) {
|
|
101
|
+
return __async(this, null, function* () {
|
|
102
|
+
var _a, _b;
|
|
103
|
+
try {
|
|
104
|
+
const response = yield this.client.post(
|
|
105
|
+
this.joinUrl((_a = requestOptions == null ? void 0 : requestOptions.baseUrl) != null ? _a : this.baseUrl, path),
|
|
106
|
+
data,
|
|
107
|
+
requestOptions
|
|
108
|
+
);
|
|
109
|
+
return {
|
|
110
|
+
model: response == null ? void 0 : response.data,
|
|
111
|
+
response,
|
|
112
|
+
error: void 0
|
|
113
|
+
};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
return {
|
|
116
|
+
model: void 0,
|
|
117
|
+
response: void 0,
|
|
118
|
+
error: error.response ? error.response.data : (_b = error.response) != null ? _b : error
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
put(path, data, requestOptions) {
|
|
124
|
+
return __async(this, null, function* () {
|
|
125
|
+
var _a, _b;
|
|
126
|
+
try {
|
|
127
|
+
const response = yield this.client.put(
|
|
128
|
+
this.joinUrl((_a = requestOptions == null ? void 0 : requestOptions.baseUrl) != null ? _a : this.baseUrl, path),
|
|
129
|
+
data,
|
|
130
|
+
requestOptions
|
|
131
|
+
);
|
|
132
|
+
return {
|
|
133
|
+
model: response == null ? void 0 : response.data,
|
|
134
|
+
response,
|
|
135
|
+
error: void 0
|
|
136
|
+
};
|
|
137
|
+
} catch (error) {
|
|
138
|
+
return {
|
|
139
|
+
model: void 0,
|
|
140
|
+
response: void 0,
|
|
141
|
+
error: error.response ? error.response.data : (_b = error.response) != null ? _b : error
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
delete(path, requestOptions) {
|
|
147
|
+
return __async(this, null, function* () {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
try {
|
|
150
|
+
const response = yield this.client.delete(
|
|
151
|
+
this.joinUrl((_a = requestOptions == null ? void 0 : requestOptions.baseUrl) != null ? _a : this.baseUrl, path),
|
|
152
|
+
requestOptions
|
|
153
|
+
);
|
|
154
|
+
return {
|
|
155
|
+
model: response == null ? void 0 : response.data,
|
|
156
|
+
response,
|
|
157
|
+
error: void 0
|
|
158
|
+
};
|
|
159
|
+
} catch (error) {
|
|
160
|
+
return {
|
|
161
|
+
model: void 0,
|
|
162
|
+
response: void 0,
|
|
163
|
+
error: error.response ? error.response.data : (_b = error.response) != null ? _b : error
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
patch(path, data, requestOptions) {
|
|
169
|
+
return __async(this, null, function* () {
|
|
170
|
+
var _a, _b;
|
|
171
|
+
try {
|
|
172
|
+
const response = yield this.client.patch(
|
|
173
|
+
this.joinUrl((_a = requestOptions == null ? void 0 : requestOptions.baseUrl) != null ? _a : this.baseUrl, path),
|
|
174
|
+
data,
|
|
175
|
+
requestOptions
|
|
176
|
+
);
|
|
177
|
+
return {
|
|
178
|
+
model: response == null ? void 0 : response.data,
|
|
179
|
+
response,
|
|
180
|
+
error: void 0
|
|
181
|
+
};
|
|
182
|
+
} catch (error) {
|
|
183
|
+
return {
|
|
184
|
+
model: void 0,
|
|
185
|
+
response: void 0,
|
|
186
|
+
error: error.response ? error.response.data : (_b = error.response) != null ? _b : error
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
joinUrl(baseUrl, path) {
|
|
192
|
+
const url = new URL(path, baseUrl);
|
|
193
|
+
return url.toString();
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/api/auth/auth-api.ts
|
|
198
|
+
var AuthenticateApi = class extends BaseService {
|
|
199
|
+
constructor(client, baseUrl) {
|
|
200
|
+
super(client, baseUrl);
|
|
201
|
+
}
|
|
202
|
+
deviceLogin(appId, requestOptions) {
|
|
203
|
+
return __async(this, null, function* () {
|
|
204
|
+
return yield this.post(
|
|
205
|
+
"auth/device_login",
|
|
206
|
+
{
|
|
207
|
+
app_id: appId,
|
|
208
|
+
device_noti_enable: "true"
|
|
209
|
+
},
|
|
210
|
+
requestOptions
|
|
211
|
+
);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
usernamePasswordLogin(username, password, appId, requestOptions) {
|
|
215
|
+
return __async(this, null, function* () {
|
|
216
|
+
return yield this.post(
|
|
217
|
+
"auth/bzbs_login",
|
|
218
|
+
{
|
|
219
|
+
app_id: appId,
|
|
220
|
+
device_noti_enable: "true",
|
|
221
|
+
username,
|
|
222
|
+
password
|
|
223
|
+
},
|
|
224
|
+
requestOptions
|
|
225
|
+
);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// src/api/badge/badge-api.ts
|
|
231
|
+
var BadgeApi = class extends BaseService {
|
|
232
|
+
constructor(client, baseUrl) {
|
|
233
|
+
super(client, baseUrl);
|
|
234
|
+
}
|
|
235
|
+
// Get user badge
|
|
236
|
+
getBadge(params, requestOptions) {
|
|
237
|
+
return __async(this, null, function* () {
|
|
238
|
+
var _a;
|
|
239
|
+
return yield this.get(
|
|
240
|
+
"profile/me/badges",
|
|
241
|
+
{
|
|
242
|
+
params: __spreadValues({
|
|
243
|
+
badge_id: (_a = params.badgeId) != null ? _a : ""
|
|
244
|
+
}, params.option ? params.option : {})
|
|
245
|
+
},
|
|
246
|
+
requestOptions
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// src/api/campaign/campaign-api.ts
|
|
253
|
+
var CampaignApi = class extends BaseService {
|
|
254
|
+
constructor(client, baseUrl) {
|
|
255
|
+
super(client, baseUrl);
|
|
256
|
+
}
|
|
257
|
+
campaign(params, requestOptions) {
|
|
258
|
+
return __async(this, null, function* () {
|
|
259
|
+
return yield this.get(
|
|
260
|
+
"campaign",
|
|
261
|
+
__spreadValues({
|
|
262
|
+
config: params.config,
|
|
263
|
+
cat: params.cat,
|
|
264
|
+
byConfig: params.byConfig,
|
|
265
|
+
skip: params.skip,
|
|
266
|
+
top: params.top,
|
|
267
|
+
device_locale: params.deviceLocale,
|
|
268
|
+
locale: params.locale,
|
|
269
|
+
q: params.keyword,
|
|
270
|
+
startdate: params.startDate,
|
|
271
|
+
sponsorId: params.sponsorId,
|
|
272
|
+
maxpoints: params.maxPoints,
|
|
273
|
+
minpoints: params.minPoints,
|
|
274
|
+
sortBy: params.sortBy,
|
|
275
|
+
center: params.center,
|
|
276
|
+
tags: params.hashTags,
|
|
277
|
+
locationAgencyId: params.locationAgencyId
|
|
278
|
+
}, params.option ? params.option : {}),
|
|
279
|
+
requestOptions
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
favoriteCampaigns(params, requestOptions) {
|
|
284
|
+
return __async(this, null, function* () {
|
|
285
|
+
return yield this.get(
|
|
286
|
+
"profile/me/favourite_campaign",
|
|
287
|
+
{
|
|
288
|
+
params: __spreadValues({
|
|
289
|
+
skip: params.skip,
|
|
290
|
+
top: params.top,
|
|
291
|
+
locale: params.locale
|
|
292
|
+
}, params.option ? params.option : {})
|
|
293
|
+
},
|
|
294
|
+
requestOptions
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
campaignDetails(param, requestOptions) {
|
|
299
|
+
return __async(this, null, function* () {
|
|
300
|
+
return yield this == null ? void 0 : this.get(
|
|
301
|
+
`campaign/${param.id}`,
|
|
302
|
+
{
|
|
303
|
+
params: {
|
|
304
|
+
device_locale: param.deviceLocale
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
requestOptions
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
addToFavorite(id, requestOptions) {
|
|
312
|
+
return __async(this, null, function* () {
|
|
313
|
+
return yield this.post(`campaign/${id}/favourite`, {}, requestOptions);
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
removeFromFavorite(id, requestOptions) {
|
|
317
|
+
return __async(this, null, function* () {
|
|
318
|
+
return yield this.delete(`campaign/${id}/favourite`, requestOptions);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
redeem(params, requestOptions) {
|
|
322
|
+
return __async(this, null, function* () {
|
|
323
|
+
return yield this.post(
|
|
324
|
+
`campaign/${params.id}/redeem`,
|
|
325
|
+
{
|
|
326
|
+
address_key: params.addressKey,
|
|
327
|
+
contact_number: params.contactNumber
|
|
328
|
+
},
|
|
329
|
+
requestOptions
|
|
330
|
+
);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
bulkRedeem(id, quantity, requestOptions) {
|
|
334
|
+
return __async(this, null, function* () {
|
|
335
|
+
return yield this.post(
|
|
336
|
+
`campaign/${id}/bulkredeem`,
|
|
337
|
+
{
|
|
338
|
+
quantity
|
|
339
|
+
},
|
|
340
|
+
requestOptions
|
|
341
|
+
);
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// src/api/cart/cart-api.ts
|
|
347
|
+
var CartApi = class extends BaseService {
|
|
348
|
+
constructor(client, baseUrl) {
|
|
349
|
+
super(client, baseUrl);
|
|
350
|
+
}
|
|
351
|
+
// Get user cart
|
|
352
|
+
addCart(params, requestOptions) {
|
|
353
|
+
return __async(this, null, function* () {
|
|
354
|
+
return yield this.post(
|
|
355
|
+
`cart/${params.id}/add`,
|
|
356
|
+
{
|
|
357
|
+
data: {
|
|
358
|
+
mode: params.mode,
|
|
359
|
+
qty: params.qty,
|
|
360
|
+
sideCampaignJson: params.sideCampaignJson
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
requestOptions
|
|
364
|
+
);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
/// Get user cart item count
|
|
368
|
+
cartCount(requestOptions) {
|
|
369
|
+
return __async(this, null, function* () {
|
|
370
|
+
return yield this.get(this.baseUrl + "cart/count", {}, requestOptions);
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
// src/api/category/category-api.ts
|
|
376
|
+
var CategoryApi = class extends BaseService {
|
|
377
|
+
constructor(client, baseUrl) {
|
|
378
|
+
super(client, baseUrl);
|
|
379
|
+
}
|
|
380
|
+
// Get category list
|
|
381
|
+
categories(params, requestOptions) {
|
|
382
|
+
return __async(this, null, function* () {
|
|
383
|
+
return yield this.get(
|
|
384
|
+
"campaigncat/menu",
|
|
385
|
+
{
|
|
386
|
+
params: {
|
|
387
|
+
byConfig: params.byConfig,
|
|
388
|
+
config: params.config
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
requestOptions
|
|
392
|
+
);
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
// src/api/consent/consent-api.ts
|
|
398
|
+
var ConsentApi = class extends BaseService {
|
|
399
|
+
constructor(client, baseUrl) {
|
|
400
|
+
super(client, baseUrl);
|
|
401
|
+
}
|
|
402
|
+
// Get consent
|
|
403
|
+
getConsent(params, requestOptions) {
|
|
404
|
+
return __async(this, null, function* () {
|
|
405
|
+
return yield this.get(
|
|
406
|
+
"consent",
|
|
407
|
+
{
|
|
408
|
+
data: {
|
|
409
|
+
termandcondition: params.termsAndConditions,
|
|
410
|
+
dataprivacy: params.dataPrivacy,
|
|
411
|
+
marketingoption: params.marketingOption,
|
|
412
|
+
email: params.email,
|
|
413
|
+
sms: params.sms,
|
|
414
|
+
notification: params.notification,
|
|
415
|
+
line: params.line,
|
|
416
|
+
analyticsBuzzebeesCookies: params.analyticsBuzzebeesCookies,
|
|
417
|
+
analyticsFirebaseCookies: params.analyticsFirebaseCookies,
|
|
418
|
+
analyticsGoogleCookies: params.analyticsGoogleCookies,
|
|
419
|
+
analyticsMetaCookies: params.analyticsMetaCookies,
|
|
420
|
+
analyticsOtherCookies: params.analyticsOtherCookies,
|
|
421
|
+
functionalCookies: params.functionalCookies,
|
|
422
|
+
marketingCookies: params.marketingCookies,
|
|
423
|
+
necessaryCookies: params.necessaryCookies
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
requestOptions
|
|
427
|
+
);
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
// Unconsent
|
|
431
|
+
unconsent(requestOptions) {
|
|
432
|
+
return __async(this, null, function* () {
|
|
433
|
+
return yield this.post("consent/unconsent", {}, requestOptions);
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
// src/api/coupon/coupon-api.ts
|
|
439
|
+
var CouponApi = class extends BaseService {
|
|
440
|
+
constructor(client, baseUrl) {
|
|
441
|
+
super(client, baseUrl);
|
|
442
|
+
}
|
|
443
|
+
// Get coupon list
|
|
444
|
+
processCodes(params, requestOptions) {
|
|
445
|
+
return __async(this, null, function* () {
|
|
446
|
+
return yield this.post(
|
|
447
|
+
"coupon/process",
|
|
448
|
+
{
|
|
449
|
+
data: {
|
|
450
|
+
"codes[]": params.codes
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
requestOptions
|
|
454
|
+
);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
// src/api/dashboard/dashboard-api.ts
|
|
460
|
+
var DashboardApi = class extends BaseService {
|
|
461
|
+
constructor(client, baseUrl) {
|
|
462
|
+
super(client, baseUrl);
|
|
463
|
+
}
|
|
464
|
+
mainDashboard(appName, locale, requestOptions) {
|
|
465
|
+
return __async(this, null, function* () {
|
|
466
|
+
return yield this.get(
|
|
467
|
+
"dashboard/main",
|
|
468
|
+
{
|
|
469
|
+
params: {
|
|
470
|
+
app_name: appName,
|
|
471
|
+
locale
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
requestOptions
|
|
475
|
+
);
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
subDashboard(params, requestOptions) {
|
|
479
|
+
return __async(this, null, function* () {
|
|
480
|
+
return yield this.get(
|
|
481
|
+
`dashboard/${params.dashboardName}`,
|
|
482
|
+
{
|
|
483
|
+
params: {
|
|
484
|
+
locale: params.locale
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
requestOptions
|
|
488
|
+
);
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
// src/api/history/history-api.ts
|
|
494
|
+
var HistoryApi = class extends BaseService {
|
|
495
|
+
constructor(client, baseUrl) {
|
|
496
|
+
super(client, baseUrl);
|
|
497
|
+
}
|
|
498
|
+
redeemHistories(params, requestOptions) {
|
|
499
|
+
return __async(this, null, function* () {
|
|
500
|
+
return yield this.get(
|
|
501
|
+
"redeem",
|
|
502
|
+
{
|
|
503
|
+
params: {
|
|
504
|
+
byConfig: params.byConfig,
|
|
505
|
+
config: params.config,
|
|
506
|
+
skip: params.skip,
|
|
507
|
+
top: params.top,
|
|
508
|
+
locale: params.locale,
|
|
509
|
+
startdate: params.startDate,
|
|
510
|
+
enddate: params.endDate
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
requestOptions
|
|
514
|
+
);
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
use(params, requestOptions) {
|
|
518
|
+
return __async(this, null, function* () {
|
|
519
|
+
return yield this.post(`redeem/${params.redeemKey}/use`, {}, requestOptions);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
|
|
524
|
+
// src/api/line/line-api.ts
|
|
525
|
+
var LineApi = class extends BaseService {
|
|
526
|
+
constructor(client, baseUrl) {
|
|
527
|
+
super(client, baseUrl);
|
|
528
|
+
}
|
|
529
|
+
//Create Line Auth
|
|
530
|
+
lineAuth(params, requestOptions) {
|
|
531
|
+
return __async(this, null, function* () {
|
|
532
|
+
return yield this.post(
|
|
533
|
+
"oauth2/v2.1/token",
|
|
534
|
+
{
|
|
535
|
+
grant_type: params.grantType,
|
|
536
|
+
code: params.code,
|
|
537
|
+
client_id: params.clientId,
|
|
538
|
+
client_secret: params.clientSecret,
|
|
539
|
+
redirect_uri: params.redirectUrl
|
|
540
|
+
},
|
|
541
|
+
requestOptions
|
|
542
|
+
);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
// src/api/notification/notification-api.ts
|
|
548
|
+
var NotificationApi = class extends BaseService {
|
|
549
|
+
constructor(client, baseUrl) {
|
|
550
|
+
super(client, baseUrl);
|
|
551
|
+
}
|
|
552
|
+
notifications(params, requestOptions) {
|
|
553
|
+
return __async(this, null, function* () {
|
|
554
|
+
return yield this.get(
|
|
555
|
+
"noti",
|
|
556
|
+
{
|
|
557
|
+
params: {
|
|
558
|
+
mode: params.mode,
|
|
559
|
+
sortBy: params.sortBy
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
requestOptions
|
|
563
|
+
);
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
read(params, requestOptions) {
|
|
567
|
+
return __async(this, null, function* () {
|
|
568
|
+
return yield this.post(
|
|
569
|
+
"noti/read",
|
|
570
|
+
{
|
|
571
|
+
ids: params.ids
|
|
572
|
+
},
|
|
573
|
+
requestOptions
|
|
574
|
+
);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
// src/api/place/place-api.ts
|
|
580
|
+
var PlaceApi = class extends BaseService {
|
|
581
|
+
constructor(client, baseUrl) {
|
|
582
|
+
super(client, baseUrl);
|
|
583
|
+
}
|
|
584
|
+
placeList(params, requestOptions) {
|
|
585
|
+
return __async(this, null, function* () {
|
|
586
|
+
return yield this.get(
|
|
587
|
+
"place",
|
|
588
|
+
{
|
|
589
|
+
params: {
|
|
590
|
+
agencyId: params.agencyId,
|
|
591
|
+
center: params.center,
|
|
592
|
+
distance: params.distance,
|
|
593
|
+
top: params.top,
|
|
594
|
+
province_code: params.provinceCode,
|
|
595
|
+
category: params.category,
|
|
596
|
+
mode: params.mode,
|
|
597
|
+
require_campaign: params.requiredCampaign,
|
|
598
|
+
q: params.keyword,
|
|
599
|
+
isFavourite: params.isFavourite
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
requestOptions
|
|
603
|
+
);
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
//Create api from above snippet
|
|
607
|
+
place(params, requestOptions) {
|
|
608
|
+
return __async(this, null, function* () {
|
|
609
|
+
return yield this.get(
|
|
610
|
+
`place/${params.id}`,
|
|
611
|
+
{
|
|
612
|
+
params: {
|
|
613
|
+
agencyId: params.agencyId,
|
|
614
|
+
require_campaign: params.requiredCampaign,
|
|
615
|
+
isFavourite: params.isFavourite
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
requestOptions
|
|
619
|
+
);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
addToFavourite(params, requestOptions) {
|
|
623
|
+
return __async(this, null, function* () {
|
|
624
|
+
return yield this.post(`place/${params.id}/favourite`, {}, requestOptions);
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
removeFromFavourite(params, requestOptions) {
|
|
628
|
+
return __async(this, null, function* () {
|
|
629
|
+
return yield this.post(`place/${params.id}/unfavourite`, {}, requestOptions);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
// src/api/point-log/point-log-api.ts
|
|
635
|
+
var PointLogApi = class extends BaseService {
|
|
636
|
+
constructor(client, baseUrl) {
|
|
637
|
+
super(client, baseUrl);
|
|
638
|
+
}
|
|
639
|
+
getPointLog(month, options, requestOption) {
|
|
640
|
+
return __async(this, null, function* () {
|
|
641
|
+
return yield this.get(
|
|
642
|
+
"log/points",
|
|
643
|
+
{
|
|
644
|
+
params: {
|
|
645
|
+
month,
|
|
646
|
+
type: options == null ? void 0 : options.type,
|
|
647
|
+
lastRowKey: options == null ? void 0 : options.lastRowKey,
|
|
648
|
+
top: options == null ? void 0 : options.top
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
requestOption
|
|
652
|
+
);
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
// src/api/profile/profile-api.ts
|
|
658
|
+
var ProfileApi = class extends BaseService {
|
|
659
|
+
constructor(client, baseUrl) {
|
|
660
|
+
super(client, baseUrl);
|
|
661
|
+
}
|
|
662
|
+
updateProfile(params, requestOptions) {
|
|
663
|
+
return __async(this, null, function* () {
|
|
664
|
+
return yield this.post(
|
|
665
|
+
"profile/me",
|
|
666
|
+
{
|
|
667
|
+
data: params.profileImage,
|
|
668
|
+
firstname: params.firstName,
|
|
669
|
+
lastname: params.lastName,
|
|
670
|
+
contact_number: params.contactNumber,
|
|
671
|
+
email: params.email,
|
|
672
|
+
notification: params.notification,
|
|
673
|
+
locale: params.locale,
|
|
674
|
+
title: params.title,
|
|
675
|
+
gender: params.gender,
|
|
676
|
+
birthdate: params.birthDate,
|
|
677
|
+
address: params.address,
|
|
678
|
+
subdistrict_code: params.subdistrictCode,
|
|
679
|
+
subdistrict_name: params.subdistrictName,
|
|
680
|
+
district_code: params.districtCode,
|
|
681
|
+
district_name: params.districtName,
|
|
682
|
+
province_code: params.provinceCode,
|
|
683
|
+
province_name: params.provinceName,
|
|
684
|
+
country_code: params.countryCode,
|
|
685
|
+
country_name: params.countryName,
|
|
686
|
+
Zipcode: params.zipCode,
|
|
687
|
+
idCard: params.idCard,
|
|
688
|
+
passport: params.passport,
|
|
689
|
+
maritalstatus: params.maritalStatus,
|
|
690
|
+
village: params.village,
|
|
691
|
+
building: params.building,
|
|
692
|
+
number: params.number,
|
|
693
|
+
moo: params.moo,
|
|
694
|
+
room: params.room,
|
|
695
|
+
floor: params.floor,
|
|
696
|
+
soi: params.soi,
|
|
697
|
+
city: params.city,
|
|
698
|
+
road: params.road,
|
|
699
|
+
landmark: params.landmark,
|
|
700
|
+
alternate_contact_number: params.alternateContactNumber,
|
|
701
|
+
home_contact_number: params.homeContactNumber,
|
|
702
|
+
nationality: params.nationality,
|
|
703
|
+
religion: params.religion,
|
|
704
|
+
location: params.location,
|
|
705
|
+
latitude: params.latitude,
|
|
706
|
+
longitude: params.longitude,
|
|
707
|
+
income: params.income,
|
|
708
|
+
interests: params.interests,
|
|
709
|
+
region: params.region,
|
|
710
|
+
phonepurchase: params.phonepurchase,
|
|
711
|
+
highesteducation: params.highestEducation,
|
|
712
|
+
occupation: params.occupation,
|
|
713
|
+
remark: params.remark,
|
|
714
|
+
displayname: params.displayName
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
headers: __spreadValues({
|
|
718
|
+
"Content-Type": "multipart/form-data"
|
|
719
|
+
}, (requestOptions == null ? void 0 : requestOptions.headers) ? requestOptions.headers : {}),
|
|
720
|
+
params: requestOptions == null ? void 0 : requestOptions.params,
|
|
721
|
+
data: requestOptions == null ? void 0 : requestOptions.data
|
|
722
|
+
}
|
|
723
|
+
);
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
changePassword(current, change, requestOptions) {
|
|
727
|
+
return __async(this, null, function* () {
|
|
728
|
+
return yield this.post(
|
|
729
|
+
"profile/me/change_password",
|
|
730
|
+
{
|
|
731
|
+
current,
|
|
732
|
+
change
|
|
733
|
+
},
|
|
734
|
+
requestOptions
|
|
735
|
+
);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
//Create updateShipping api from above snippet
|
|
739
|
+
updateShipping(params, requestOptions) {
|
|
740
|
+
return __async(this, null, function* () {
|
|
741
|
+
return yield this.post(
|
|
742
|
+
"profile/me/shipping",
|
|
743
|
+
{
|
|
744
|
+
shippingfirstname: params.shippingFirstName,
|
|
745
|
+
shippinglastname: params.shippingLastName,
|
|
746
|
+
shipping_province_code: params.shippingProvinceCode,
|
|
747
|
+
shipping_district_code: params.shippingDistrictCode,
|
|
748
|
+
shipping_subdistrict_code: params.shippingSubDistrictCode,
|
|
749
|
+
shipping_zipcode: params.shippingZipCode,
|
|
750
|
+
shipping_address: params.shippingAddress,
|
|
751
|
+
shipping_province_name: params.shippingProvinceName,
|
|
752
|
+
shipping_district_name: params.shippingDistrictName,
|
|
753
|
+
shipping_subdistrict_name: params.shippingSubFDistrictName,
|
|
754
|
+
shipping_contact_number: params.shippingContactNumber
|
|
755
|
+
},
|
|
756
|
+
requestOptions
|
|
757
|
+
);
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
//Create changeContactNumber api from above snippet
|
|
761
|
+
changeContactNumber(contactNumber, otp, refCode, idCard, requestOptions) {
|
|
762
|
+
return __async(this, null, function* () {
|
|
763
|
+
return yield this.post(
|
|
764
|
+
"auth/change_authen",
|
|
765
|
+
{
|
|
766
|
+
contact_number: contactNumber,
|
|
767
|
+
otp,
|
|
768
|
+
refcode: refCode,
|
|
769
|
+
idcard: idCard
|
|
770
|
+
},
|
|
771
|
+
requestOptions
|
|
772
|
+
);
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
//Create changeContactNumberV2 api from above snippet
|
|
776
|
+
changeContactNumberV2(contactNumber, otp, refCode, requestOptions) {
|
|
777
|
+
return __async(this, null, function* () {
|
|
778
|
+
return yield this.post(
|
|
779
|
+
"profile/me/contact_number",
|
|
780
|
+
{
|
|
781
|
+
contact_number: contactNumber,
|
|
782
|
+
otp,
|
|
783
|
+
refcode: refCode
|
|
784
|
+
},
|
|
785
|
+
requestOptions
|
|
786
|
+
);
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
points(requestOptions) {
|
|
790
|
+
return __async(this, null, function* () {
|
|
791
|
+
return yield this.get("profile/me/updated_points", {}, requestOptions);
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
expiringPoints(requestOptions) {
|
|
795
|
+
return __async(this, null, function* () {
|
|
796
|
+
return yield this.get("profile/me/allexpiring_points", {}, requestOptions);
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
deactivate(requestOptions) {
|
|
800
|
+
return __async(this, null, function* () {
|
|
801
|
+
return yield this.post("profile/me/deactivate", {}, requestOptions);
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
// src/api/registration/registration-api.ts
|
|
807
|
+
var RegistrationApi = class extends BaseService {
|
|
808
|
+
constructor(client, baseUrl) {
|
|
809
|
+
super(client, baseUrl);
|
|
810
|
+
}
|
|
811
|
+
//Create register from above
|
|
812
|
+
register(params, requestOptions) {
|
|
813
|
+
return __async(this, null, function* () {
|
|
814
|
+
return yield this.post(
|
|
815
|
+
"auth/register",
|
|
816
|
+
{
|
|
817
|
+
app_id: params.appId,
|
|
818
|
+
uuid: params.uuid,
|
|
819
|
+
mac_address: params.macAddress,
|
|
820
|
+
os: params.os,
|
|
821
|
+
platform: params.platform,
|
|
822
|
+
client_version: params.clientVersion,
|
|
823
|
+
device_noti_enable: params.deviceNotificationEnable,
|
|
824
|
+
username: params.username,
|
|
825
|
+
password: params.password,
|
|
826
|
+
confirmpassword: params.confirmPassword,
|
|
827
|
+
firstname: params.firstName,
|
|
828
|
+
lastname: params.lastName,
|
|
829
|
+
contact_number: params.contactNumber,
|
|
830
|
+
otp: params.otp,
|
|
831
|
+
refcode: params.refCode,
|
|
832
|
+
address: params.address,
|
|
833
|
+
gender: params.gender,
|
|
834
|
+
birthdate: params.birthdate,
|
|
835
|
+
email: params.email,
|
|
836
|
+
refusercode: params.refUserCode,
|
|
837
|
+
info: params.info,
|
|
838
|
+
termandcondition: params.termAndConditionVersion,
|
|
839
|
+
dataprivacy: params.dataPrivacyVersion,
|
|
840
|
+
marketingOption: params.marketingOptionsVersion,
|
|
841
|
+
mktoption_email: params.emailMarketing,
|
|
842
|
+
mktoption_sms: params.smsMarketing,
|
|
843
|
+
mktoption_notification: params.notificationMarketing,
|
|
844
|
+
mktoption_line: params.lineMarketing,
|
|
845
|
+
mktoption_phone: params.phoneMarketing
|
|
846
|
+
},
|
|
847
|
+
requestOptions
|
|
848
|
+
);
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// src/api/init-service.ts
|
|
854
|
+
var BzbsService = class {
|
|
855
|
+
constructor(client, baseUrl, baseLineUrl) {
|
|
856
|
+
this.init(client, baseUrl, baseLineUrl);
|
|
857
|
+
}
|
|
858
|
+
init(client, baseUrl, baseLineUrl) {
|
|
859
|
+
var _a;
|
|
860
|
+
this.client = client;
|
|
861
|
+
this.baseUrl = baseUrl;
|
|
862
|
+
this.baseLineUrl = baseLineUrl;
|
|
863
|
+
if (!this.baseUrl) {
|
|
864
|
+
throw "BzbsService Please check baseURL";
|
|
865
|
+
}
|
|
866
|
+
if (!this.baseLineUrl) {
|
|
867
|
+
console.log("BzbsService Please check line lineBaseUrl");
|
|
868
|
+
}
|
|
869
|
+
if (!this.client) {
|
|
870
|
+
throw "BzbsService Please check client";
|
|
871
|
+
}
|
|
872
|
+
this.authApi = new AuthenticateApi(this.client, this.baseUrl);
|
|
873
|
+
this.badgeApi = new BadgeApi(this.client, this.baseUrl);
|
|
874
|
+
this.campaignApi = new CampaignApi(this.client, this.baseUrl);
|
|
875
|
+
this.cartApi = new CartApi(this.client, this.baseUrl);
|
|
876
|
+
this.categoryApi = new CategoryApi(this.client, this.baseUrl);
|
|
877
|
+
this.consentApi = new ConsentApi(this.client, this.baseUrl);
|
|
878
|
+
this.couponApi = new CouponApi(this.client, this.baseUrl);
|
|
879
|
+
this.dashboardApi = new DashboardApi(this.client, this.baseUrl);
|
|
880
|
+
this.historyApi = new HistoryApi(this.client, this.baseUrl);
|
|
881
|
+
this.lineApi = new LineApi(this.client, (_a = this.baseLineUrl) != null ? _a : "");
|
|
882
|
+
this.notificationApi = new NotificationApi(this.client, this.baseUrl);
|
|
883
|
+
this.placeApi = new PlaceApi(this.client, this.baseUrl);
|
|
884
|
+
this.pointLogApi = new PointLogApi(this.client, this.baseUrl);
|
|
885
|
+
this.profileApi = new ProfileApi(this.client, this.baseUrl);
|
|
886
|
+
this.registerApi = new RegistrationApi(this.client, this.baseUrl);
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
890
|
+
0 && (module.exports = {
|
|
891
|
+
BaseService,
|
|
892
|
+
BzbsService
|
|
893
|
+
});
|
|
894
|
+
//# sourceMappingURL=index.js.map
|