@dv4resi/dvss-backend-module-offering-im 0.0.4 → 0.0.6
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 +53 -79
- package/dist/index.d.ts +418 -18
- package/dist/index.js +712 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -603,10 +603,10 @@ var BaseAuth = class {
|
|
|
603
603
|
}
|
|
604
604
|
};
|
|
605
605
|
|
|
606
|
-
// ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/wellness/
|
|
607
|
-
var
|
|
606
|
+
// ../../packages/dvss-integration-libs/src/integration-operation-skeletons/capabilities/wellness/wellness-management.base.ts
|
|
607
|
+
var BaseWellnessManagement = class {
|
|
608
608
|
static {
|
|
609
|
-
__name(this, "
|
|
609
|
+
__name(this, "BaseWellnessManagement");
|
|
610
610
|
}
|
|
611
611
|
};
|
|
612
612
|
|
|
@@ -739,6 +739,29 @@ var INTEGRATION_PROVIDER_ENUM = /* @__PURE__ */ (function(INTEGRATION_PROVIDER_E
|
|
|
739
739
|
INTEGRATION_PROVIDER_ENUM2["TRYBE"] = "TRYBE";
|
|
740
740
|
return INTEGRATION_PROVIDER_ENUM2;
|
|
741
741
|
})({});
|
|
742
|
+
|
|
743
|
+
// ../../packages/dvss-integration-libs/src/integration-common-utils/models/wellness-management.model.ts
|
|
744
|
+
var BOOKABLE_ITEM_TYPE_ENUM = /* @__PURE__ */ (function(BOOKABLE_ITEM_TYPE_ENUM2) {
|
|
745
|
+
BOOKABLE_ITEM_TYPE_ENUM2["APPOINTMENT"] = "APPOINTMENT";
|
|
746
|
+
BOOKABLE_ITEM_TYPE_ENUM2["SESSION"] = "SESSION";
|
|
747
|
+
BOOKABLE_ITEM_TYPE_ENUM2["COURSE"] = "COURSE";
|
|
748
|
+
return BOOKABLE_ITEM_TYPE_ENUM2;
|
|
749
|
+
})({});
|
|
750
|
+
var BOOKABLE_ITEM_STATUS_ENUM = /* @__PURE__ */ (function(BOOKABLE_ITEM_STATUS_ENUM2) {
|
|
751
|
+
BOOKABLE_ITEM_STATUS_ENUM2["ACTIVE"] = "ACTIVE";
|
|
752
|
+
BOOKABLE_ITEM_STATUS_ENUM2["INACTIVE"] = "INACTIVE";
|
|
753
|
+
return BOOKABLE_ITEM_STATUS_ENUM2;
|
|
754
|
+
})({});
|
|
755
|
+
var DAY_OF_WEEK = /* @__PURE__ */ (function(DAY_OF_WEEK2) {
|
|
756
|
+
DAY_OF_WEEK2["MON"] = "MON";
|
|
757
|
+
DAY_OF_WEEK2["TUE"] = "TUE";
|
|
758
|
+
DAY_OF_WEEK2["WED"] = "WED";
|
|
759
|
+
DAY_OF_WEEK2["THU"] = "THU";
|
|
760
|
+
DAY_OF_WEEK2["FRI"] = "FRI";
|
|
761
|
+
DAY_OF_WEEK2["SAT"] = "SAT";
|
|
762
|
+
DAY_OF_WEEK2["SUN"] = "SUN";
|
|
763
|
+
return DAY_OF_WEEK2;
|
|
764
|
+
})({});
|
|
742
765
|
function _ts_decorate11(decorators, target, key, desc) {
|
|
743
766
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
744
767
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -959,10 +982,12 @@ function mapTrybeCreditsToSystem(res, integration) {
|
|
|
959
982
|
groups.set(key, list);
|
|
960
983
|
}
|
|
961
984
|
const records = [];
|
|
985
|
+
let index = 0;
|
|
962
986
|
for (const [, items] of groups) {
|
|
963
987
|
const first = items[0];
|
|
964
988
|
const couponCodes = items.map((i) => i.coupon_code);
|
|
965
989
|
records.push({
|
|
990
|
+
id: BigInt(index + 1),
|
|
966
991
|
capabilityIntegrationId: integration.id,
|
|
967
992
|
projectId: integration.projectId,
|
|
968
993
|
name: first.coupon_name,
|
|
@@ -986,6 +1011,7 @@ function mapTrybeCreditsToSystem(res, integration) {
|
|
|
986
1011
|
}
|
|
987
1012
|
}
|
|
988
1013
|
});
|
|
1014
|
+
index++;
|
|
989
1015
|
}
|
|
990
1016
|
return {
|
|
991
1017
|
totalCount: records.length,
|
|
@@ -1073,7 +1099,434 @@ exports.TrybeCreditBooking = _ts_decorate13([
|
|
|
1073
1099
|
])
|
|
1074
1100
|
], exports.TrybeCreditBooking);
|
|
1075
1101
|
|
|
1076
|
-
// ../../packages/dvss-integration-trybe/src/
|
|
1102
|
+
// ../../packages/dvss-integration-trybe/src/utils/date.util.ts
|
|
1103
|
+
function formatDateForTrybe(date, isStartOfDay) {
|
|
1104
|
+
const year = date.getFullYear();
|
|
1105
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
1106
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
1107
|
+
const hours = isStartOfDay ? "00" : "23";
|
|
1108
|
+
const minutes = isStartOfDay ? "00" : "59";
|
|
1109
|
+
const seconds = isStartOfDay ? "00" : "59";
|
|
1110
|
+
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}-05:00`;
|
|
1111
|
+
}
|
|
1112
|
+
__name(formatDateForTrybe, "formatDateForTrybe");
|
|
1113
|
+
function extractTimeFromIsoString(isoString) {
|
|
1114
|
+
const timeMatch = isoString.match(/T(\d{2}:\d{2})/);
|
|
1115
|
+
return timeMatch ? timeMatch[1] : "";
|
|
1116
|
+
}
|
|
1117
|
+
__name(extractTimeFromIsoString, "extractTimeFromIsoString");
|
|
1118
|
+
function snakeToCamel(str) {
|
|
1119
|
+
return str.replaceAll(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
1120
|
+
}
|
|
1121
|
+
__name(snakeToCamel, "snakeToCamel");
|
|
1122
|
+
function convertKeysToCamelCase(object) {
|
|
1123
|
+
if (object === null || object === void 0) {
|
|
1124
|
+
return object;
|
|
1125
|
+
}
|
|
1126
|
+
if (Array.isArray(object)) {
|
|
1127
|
+
return object.map((item) => convertKeysToCamelCase(item));
|
|
1128
|
+
}
|
|
1129
|
+
if (typeof object === "object") {
|
|
1130
|
+
const converted = {};
|
|
1131
|
+
for (const [key, value] of Object.entries(object)) {
|
|
1132
|
+
converted[snakeToCamel(key)] = convertKeysToCamelCase(value);
|
|
1133
|
+
}
|
|
1134
|
+
return converted;
|
|
1135
|
+
}
|
|
1136
|
+
return object;
|
|
1137
|
+
}
|
|
1138
|
+
__name(convertKeysToCamelCase, "convertKeysToCamelCase");
|
|
1139
|
+
|
|
1140
|
+
// ../../packages/dvss-integration-trybe/src/utils/pagination.util.ts
|
|
1141
|
+
var fetchAllPages = /* @__PURE__ */ __name(async (firstPageResponse, shouldFetchAll, fetchPage) => {
|
|
1142
|
+
const items = [];
|
|
1143
|
+
items.push(...firstPageResponse.data);
|
|
1144
|
+
if (!shouldFetchAll) {
|
|
1145
|
+
return items;
|
|
1146
|
+
}
|
|
1147
|
+
const lastPage = firstPageResponse.meta.last_page;
|
|
1148
|
+
for (let page = 2; page <= lastPage; page += 1) {
|
|
1149
|
+
const pageResponse = await fetchPage(page);
|
|
1150
|
+
items.push(...pageResponse.data);
|
|
1151
|
+
}
|
|
1152
|
+
return items;
|
|
1153
|
+
}, "fetchAllPages");
|
|
1154
|
+
|
|
1155
|
+
// ../../packages/dvss-integration-trybe/src/models/wellness-management.model.ts
|
|
1156
|
+
var TRYBE_OFFERING_TYPE_ENUM = /* @__PURE__ */ (function(TRYBE_OFFERING_TYPE_ENUM2) {
|
|
1157
|
+
TRYBE_OFFERING_TYPE_ENUM2["APPOINTMENT"] = "APPOINTMENT";
|
|
1158
|
+
TRYBE_OFFERING_TYPE_ENUM2["SESSION"] = "SESSION";
|
|
1159
|
+
TRYBE_OFFERING_TYPE_ENUM2["COURSE"] = "COURSE";
|
|
1160
|
+
return TRYBE_OFFERING_TYPE_ENUM2;
|
|
1161
|
+
})({});
|
|
1162
|
+
|
|
1163
|
+
// ../../packages/dvss-integration-trybe/src/capabilities/wellness/wellness-management.mapper.ts
|
|
1164
|
+
var TRYBE_WEEKDAYS_MAPPING = {
|
|
1165
|
+
monday: DAY_OF_WEEK.MON,
|
|
1166
|
+
tuesday: DAY_OF_WEEK.TUE,
|
|
1167
|
+
wednesday: DAY_OF_WEEK.WED,
|
|
1168
|
+
thursday: DAY_OF_WEEK.THU,
|
|
1169
|
+
friday: DAY_OF_WEEK.FRI,
|
|
1170
|
+
saturday: DAY_OF_WEEK.SAT,
|
|
1171
|
+
sunday: DAY_OF_WEEK.SUN
|
|
1172
|
+
};
|
|
1173
|
+
function mapTrybeImageToMedia(image) {
|
|
1174
|
+
if (!image) return void 0;
|
|
1175
|
+
return {
|
|
1176
|
+
id: image.id,
|
|
1177
|
+
url: image.url,
|
|
1178
|
+
originalUrl: image.original_url,
|
|
1179
|
+
fileName: image.file_name,
|
|
1180
|
+
mimeType: image.mime_type
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
__name(mapTrybeImageToMedia, "mapTrybeImageToMedia");
|
|
1184
|
+
function mapTrybeWeekdays(weekdays) {
|
|
1185
|
+
return weekdays.map((day) => TRYBE_WEEKDAYS_MAPPING[day.toLowerCase()]);
|
|
1186
|
+
}
|
|
1187
|
+
__name(mapTrybeWeekdays, "mapTrybeWeekdays");
|
|
1188
|
+
function mapTrybePriceRuleToPriceMeta(priceRule, currency, index) {
|
|
1189
|
+
const normalizedCurrency = currency ? currency.toUpperCase() : "USD";
|
|
1190
|
+
if (!priceRule.weekdays || priceRule.weekdays.length === 0) {
|
|
1191
|
+
return [
|
|
1192
|
+
{
|
|
1193
|
+
id: BigInt(index),
|
|
1194
|
+
externalId: priceRule.id,
|
|
1195
|
+
status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,
|
|
1196
|
+
price: priceRule.price,
|
|
1197
|
+
currency: normalizedCurrency,
|
|
1198
|
+
config: priceRule
|
|
1199
|
+
}
|
|
1200
|
+
];
|
|
1201
|
+
}
|
|
1202
|
+
return [
|
|
1203
|
+
{
|
|
1204
|
+
id: BigInt(index),
|
|
1205
|
+
externalId: priceRule.id,
|
|
1206
|
+
status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,
|
|
1207
|
+
price: priceRule.price,
|
|
1208
|
+
currency: normalizedCurrency,
|
|
1209
|
+
configuredForDays: mapTrybeWeekdays(priceRule.weekdays)
|
|
1210
|
+
}
|
|
1211
|
+
];
|
|
1212
|
+
}
|
|
1213
|
+
__name(mapTrybePriceRuleToPriceMeta, "mapTrybePriceRuleToPriceMeta");
|
|
1214
|
+
function mapTrybePriceRulesToPrices(priceRules, currency, externalResourceId) {
|
|
1215
|
+
const normalizedCurrency = currency ? currency.toUpperCase() : "USD";
|
|
1216
|
+
return priceRules.map((priceRule, index) => ({
|
|
1217
|
+
id: BigInt(index + 1),
|
|
1218
|
+
label: void 0,
|
|
1219
|
+
currency: normalizedCurrency,
|
|
1220
|
+
price: priceRule.price,
|
|
1221
|
+
externalResourceId,
|
|
1222
|
+
configuredForDays: priceRule.weekdays ? mapTrybeWeekdays(priceRule.weekdays) : void 0,
|
|
1223
|
+
pricesMeta: mapTrybePriceRuleToPriceMeta(priceRule, currency, index + 1),
|
|
1224
|
+
config: priceRule
|
|
1225
|
+
}));
|
|
1226
|
+
}
|
|
1227
|
+
__name(mapTrybePriceRulesToPrices, "mapTrybePriceRulesToPrices");
|
|
1228
|
+
function mapTrybeAppointmentToBookableItem(appointment, index, linkedItems) {
|
|
1229
|
+
return {
|
|
1230
|
+
id: BigInt(index + 1),
|
|
1231
|
+
externalId: appointment.id,
|
|
1232
|
+
name: appointment.name,
|
|
1233
|
+
description: appointment.description,
|
|
1234
|
+
type: BOOKABLE_ITEM_TYPE_ENUM.APPOINTMENT,
|
|
1235
|
+
status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,
|
|
1236
|
+
icon: mapTrybeImageToMedia(appointment.image),
|
|
1237
|
+
primaryAsset: mapTrybeImageToMedia(appointment.image),
|
|
1238
|
+
prices: mapTrybePriceRulesToPrices(appointment.price_rules, appointment.currency, appointment.id),
|
|
1239
|
+
linkedBookableItems: linkedItems,
|
|
1240
|
+
updatedAt: appointment.updated_at ? new Date(appointment.updated_at) : void 0,
|
|
1241
|
+
meta: {
|
|
1242
|
+
// All Trybe-specific fields that don't map to system response
|
|
1243
|
+
externalId: appointment.id,
|
|
1244
|
+
productCode: appointment.product_code,
|
|
1245
|
+
siteIds: appointment.site_ids,
|
|
1246
|
+
roomIds: appointment.room_ids,
|
|
1247
|
+
equipmentIds: appointment.equipment_ids,
|
|
1248
|
+
practitionerIds: appointment.practitioner_ids,
|
|
1249
|
+
durations: appointment.durations,
|
|
1250
|
+
endBuffer: appointment.end_buffer,
|
|
1251
|
+
startTimeInterval: appointment.start_time_interval,
|
|
1252
|
+
maxAdvanceBookingsInterval: appointment.max_advance_bookings_interval,
|
|
1253
|
+
minAdvanceBookingsInterval: appointment.min_advance_bookings_interval,
|
|
1254
|
+
tagIds: appointment.tag_ids,
|
|
1255
|
+
tags: appointment.tags,
|
|
1256
|
+
categoryIds: appointment.category_ids,
|
|
1257
|
+
offeredOnline: appointment.offered_online,
|
|
1258
|
+
private: appointment.private,
|
|
1259
|
+
visibility: appointment.visibility,
|
|
1260
|
+
customersOnly: appointment.customers_only,
|
|
1261
|
+
membersOnly: appointment.members_only,
|
|
1262
|
+
membershipBookingWindowsEnabled: appointment.membership_booking_windows_enabled,
|
|
1263
|
+
membershipBookingWindows: appointment.membership_booking_windows,
|
|
1264
|
+
trybeMeta: appointment.meta,
|
|
1265
|
+
upsellOfferings: appointment.upsell_offerings,
|
|
1266
|
+
crossSellOfferings: appointment.cross_sell_offerings,
|
|
1267
|
+
relatedRetailOfferings: appointment.related_retail_offerings,
|
|
1268
|
+
customerCancellationPermitted: appointment.customer_cancellation_permitted,
|
|
1269
|
+
customerCancellationMinDuration: appointment.customer_cancellation_min_duration,
|
|
1270
|
+
minGuests: appointment.min_guests,
|
|
1271
|
+
maxGuests: appointment.max_guests,
|
|
1272
|
+
allocateMultiCapacityRooms: appointment.allocate_multi_capacity_rooms,
|
|
1273
|
+
enquiriesEnabled: appointment.enquiries_enabled,
|
|
1274
|
+
revenueCentre: appointment.revenue_centre,
|
|
1275
|
+
includePricingOnCalendar: appointment.include_pricing_on_calendar,
|
|
1276
|
+
maxPerBasket: appointment.max_per_basket,
|
|
1277
|
+
maxPerGuest: appointment.max_per_guest,
|
|
1278
|
+
shopPractitionerSelectionEnabled: appointment.shop_practitioner_selection_enabled,
|
|
1279
|
+
deletedAt: appointment.deleted_at
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
__name(mapTrybeAppointmentToBookableItem, "mapTrybeAppointmentToBookableItem");
|
|
1284
|
+
function mapTrybeSessionToBookableItem(session, index, linkedItems) {
|
|
1285
|
+
return {
|
|
1286
|
+
id: BigInt(index + 1),
|
|
1287
|
+
externalId: session.id,
|
|
1288
|
+
name: session.name,
|
|
1289
|
+
description: session.description,
|
|
1290
|
+
type: BOOKABLE_ITEM_TYPE_ENUM.SESSION,
|
|
1291
|
+
status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,
|
|
1292
|
+
icon: mapTrybeImageToMedia(session.image),
|
|
1293
|
+
primaryAsset: mapTrybeImageToMedia(session.image),
|
|
1294
|
+
prices: mapTrybePriceRulesToPrices(session.price_rules, session.currency, session.id),
|
|
1295
|
+
linkedBookableItems: linkedItems,
|
|
1296
|
+
updatedAt: session.updated_at ? new Date(session.updated_at) : void 0,
|
|
1297
|
+
meta: {
|
|
1298
|
+
// All Trybe-specific fields
|
|
1299
|
+
externalId: session.id,
|
|
1300
|
+
productCode: session.product_code,
|
|
1301
|
+
siteId: session.site_id,
|
|
1302
|
+
duration: session.duration,
|
|
1303
|
+
categoryIds: session.category_ids,
|
|
1304
|
+
offeredOnline: session.offered_online,
|
|
1305
|
+
private: session.private,
|
|
1306
|
+
visibility: session.visibility,
|
|
1307
|
+
customersOnly: session.customers_only,
|
|
1308
|
+
membersOnly: session.members_only,
|
|
1309
|
+
membershipBookingWindowsEnabled: session.membership_booking_windows_enabled,
|
|
1310
|
+
membershipBookingWindows: session.membership_booking_windows,
|
|
1311
|
+
maxBookingsPerMember: session.max_bookings_per_member,
|
|
1312
|
+
trybeMeta: session.meta,
|
|
1313
|
+
upsellOfferings: session.upsell_offerings,
|
|
1314
|
+
crossSellOfferings: session.cross_sell_offerings,
|
|
1315
|
+
relatedRetailOfferings: session.related_retail_offerings,
|
|
1316
|
+
customerCancellationPermitted: session.customer_cancellation_permitted,
|
|
1317
|
+
customerCancellationMinDuration: session.customer_cancellation_min_duration,
|
|
1318
|
+
waitlistEnabled: session.waitlist_enabled,
|
|
1319
|
+
maxAdvanceBookingsInterval: session.max_advance_bookings_interval,
|
|
1320
|
+
minAdvanceBookingsInterval: session.min_advance_bookings_interval,
|
|
1321
|
+
minGuests: session.min_guests,
|
|
1322
|
+
maxGuests: session.max_guests,
|
|
1323
|
+
maxBasketsPerSession: session.max_baskets_per_session,
|
|
1324
|
+
recurrenceGroups: session.recurrence_groups,
|
|
1325
|
+
revenueCentre: session.revenue_centre,
|
|
1326
|
+
includePricingOnCalendar: session.include_pricing_on_calendar,
|
|
1327
|
+
maxPerBasket: session.max_per_basket,
|
|
1328
|
+
maxPerGuest: session.max_per_guest,
|
|
1329
|
+
deletedAt: session.deleted_at
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
__name(mapTrybeSessionToBookableItem, "mapTrybeSessionToBookableItem");
|
|
1334
|
+
function mapTrybeCourseToBookableItem(course, index) {
|
|
1335
|
+
return {
|
|
1336
|
+
id: BigInt(index + 1),
|
|
1337
|
+
externalId: course.id,
|
|
1338
|
+
name: course.name,
|
|
1339
|
+
description: course.description,
|
|
1340
|
+
type: BOOKABLE_ITEM_TYPE_ENUM.COURSE,
|
|
1341
|
+
status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE,
|
|
1342
|
+
icon: mapTrybeImageToMedia(course.image),
|
|
1343
|
+
primaryAsset: mapTrybeImageToMedia(course.image),
|
|
1344
|
+
prices: mapTrybePriceRulesToPrices(course.price_rules, course.currency, course.id),
|
|
1345
|
+
updatedAt: course.updated_at ? new Date(course.updated_at) : void 0,
|
|
1346
|
+
meta: {
|
|
1347
|
+
// All Trybe-specific fields
|
|
1348
|
+
externalId: course.id,
|
|
1349
|
+
productCode: course.product_code,
|
|
1350
|
+
couponId: course.coupon_id,
|
|
1351
|
+
offerings: course.offerings.map((offering) => ({
|
|
1352
|
+
offeringType: offering.offering_type,
|
|
1353
|
+
offeringId: offering.offering_id,
|
|
1354
|
+
offeringName: offering.offering_name
|
|
1355
|
+
})),
|
|
1356
|
+
offeringType: course.offering_type,
|
|
1357
|
+
offeringId: course.offering_id,
|
|
1358
|
+
quantity: course.quantity,
|
|
1359
|
+
creditsValidityInterval: course.credits_validity_interval,
|
|
1360
|
+
siteId: course.site_id,
|
|
1361
|
+
categoryIds: course.category_ids,
|
|
1362
|
+
offeredOnline: course.offered_online,
|
|
1363
|
+
private: course.private,
|
|
1364
|
+
visibility: course.visibility,
|
|
1365
|
+
customersOnly: course.customers_only,
|
|
1366
|
+
membersOnly: course.members_only,
|
|
1367
|
+
trybeMeta: course.meta,
|
|
1368
|
+
upsellOfferings: course.upsell_offerings,
|
|
1369
|
+
crossSellOfferings: course.cross_sell_offerings,
|
|
1370
|
+
relatedRetailOfferings: course.related_retail_offerings,
|
|
1371
|
+
availabilityRules: course.availability_rules,
|
|
1372
|
+
revenueCentre: course.revenue_centre,
|
|
1373
|
+
deletedAt: course.deleted_at
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
__name(mapTrybeCourseToBookableItem, "mapTrybeCourseToBookableItem");
|
|
1378
|
+
function mapTrybeCategoryToBookableItemCategory(category, index) {
|
|
1379
|
+
return {
|
|
1380
|
+
id: BigInt(index + 1),
|
|
1381
|
+
externalId: category.id,
|
|
1382
|
+
name: category.name,
|
|
1383
|
+
meta: {
|
|
1384
|
+
voucherApplicable: category.voucher_applicable
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
__name(mapTrybeCategoryToBookableItemCategory, "mapTrybeCategoryToBookableItemCategory");
|
|
1389
|
+
function mapTrybeAppointmentsToSystemResponse(appointments, totalCount, courseLookup) {
|
|
1390
|
+
const records = appointments.map((apt, index) => {
|
|
1391
|
+
const linkedCourses = courseLookup?.get(apt.id) ?? [];
|
|
1392
|
+
const linkedItems = linkedCourses.map((course, courseIndex) => mapTrybeCourseToBookableItem(course, courseIndex));
|
|
1393
|
+
return mapTrybeAppointmentToBookableItem(apt, index, linkedItems.length > 0 ? linkedItems : void 0);
|
|
1394
|
+
});
|
|
1395
|
+
return {
|
|
1396
|
+
totalCount,
|
|
1397
|
+
records
|
|
1398
|
+
};
|
|
1399
|
+
}
|
|
1400
|
+
__name(mapTrybeAppointmentsToSystemResponse, "mapTrybeAppointmentsToSystemResponse");
|
|
1401
|
+
function mapTrybeSessionsToSystemResponse(sessions, totalCount, courseLookup) {
|
|
1402
|
+
const records = sessions.map((session, index) => {
|
|
1403
|
+
const linkedCourses = courseLookup?.get(session.id) ?? [];
|
|
1404
|
+
const linkedItems = linkedCourses.map((course, courseIndex) => mapTrybeCourseToBookableItem(course, courseIndex));
|
|
1405
|
+
return mapTrybeSessionToBookableItem(session, index, linkedItems.length > 0 ? linkedItems : void 0);
|
|
1406
|
+
});
|
|
1407
|
+
return {
|
|
1408
|
+
totalCount,
|
|
1409
|
+
records
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
__name(mapTrybeSessionsToSystemResponse, "mapTrybeSessionsToSystemResponse");
|
|
1413
|
+
function mapTrybeCoursesToSystemResponse(courses, totalCount) {
|
|
1414
|
+
const records = courses.map((course, index) => mapTrybeCourseToBookableItem(course, index));
|
|
1415
|
+
return {
|
|
1416
|
+
totalCount,
|
|
1417
|
+
records
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
__name(mapTrybeCoursesToSystemResponse, "mapTrybeCoursesToSystemResponse");
|
|
1421
|
+
function mapTrybeCategoriesToSystemResponse(categories, totalCount) {
|
|
1422
|
+
const records = categories.map((category, index) => mapTrybeCategoryToBookableItemCategory(category, index));
|
|
1423
|
+
return {
|
|
1424
|
+
totalCount,
|
|
1425
|
+
records
|
|
1426
|
+
};
|
|
1427
|
+
}
|
|
1428
|
+
__name(mapTrybeCategoriesToSystemResponse, "mapTrybeCategoriesToSystemResponse");
|
|
1429
|
+
function mapTrybeOfferingTypeToBookableItemType(offeringType) {
|
|
1430
|
+
switch (offeringType) {
|
|
1431
|
+
case TRYBE_OFFERING_TYPE_ENUM.APPOINTMENT:
|
|
1432
|
+
return BOOKABLE_ITEM_TYPE_ENUM.APPOINTMENT;
|
|
1433
|
+
case TRYBE_OFFERING_TYPE_ENUM.SESSION:
|
|
1434
|
+
return BOOKABLE_ITEM_TYPE_ENUM.SESSION;
|
|
1435
|
+
case TRYBE_OFFERING_TYPE_ENUM.COURSE:
|
|
1436
|
+
return BOOKABLE_ITEM_TYPE_ENUM.COURSE;
|
|
1437
|
+
default:
|
|
1438
|
+
return BOOKABLE_ITEM_TYPE_ENUM.APPOINTMENT;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
__name(mapTrybeOfferingTypeToBookableItemType, "mapTrybeOfferingTypeToBookableItemType");
|
|
1442
|
+
function mapTrybeCouponCodeOfferingToBookableItem(offering, index) {
|
|
1443
|
+
return {
|
|
1444
|
+
id: BigInt(index + 1),
|
|
1445
|
+
externalId: offering.offering_id,
|
|
1446
|
+
name: offering.offering_name,
|
|
1447
|
+
type: mapTrybeOfferingTypeToBookableItemType(offering.offering_type),
|
|
1448
|
+
status: BOOKABLE_ITEM_STATUS_ENUM.ACTIVE
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
__name(mapTrybeCouponCodeOfferingToBookableItem, "mapTrybeCouponCodeOfferingToBookableItem");
|
|
1452
|
+
function mapTrybeCouponCodeOfferingsToSystemResponse(offerings) {
|
|
1453
|
+
const records = offerings.map((offering, index) => mapTrybeCouponCodeOfferingToBookableItem(offering, index));
|
|
1454
|
+
return {
|
|
1455
|
+
totalCount: records.length,
|
|
1456
|
+
records
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
__name(mapTrybeCouponCodeOfferingsToSystemResponse, "mapTrybeCouponCodeOfferingsToSystemResponse");
|
|
1460
|
+
function groupByDate(items, getDateKey) {
|
|
1461
|
+
const result = {};
|
|
1462
|
+
for (const item of items) {
|
|
1463
|
+
const key = getDateKey(item);
|
|
1464
|
+
if (!result[key]) result[key] = [];
|
|
1465
|
+
result[key].push(item);
|
|
1466
|
+
}
|
|
1467
|
+
return result;
|
|
1468
|
+
}
|
|
1469
|
+
__name(groupByDate, "groupByDate");
|
|
1470
|
+
function mapTrybeSessionAvailabilityToSystemResponse(sessions) {
|
|
1471
|
+
const filtered = sessions.filter((s) => s.remaining_capacity > 0);
|
|
1472
|
+
const grouped = groupByDate(filtered, (s) => {
|
|
1473
|
+
const dateMatch = s.start_time.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
1474
|
+
return dateMatch ? dateMatch[1] : "";
|
|
1475
|
+
});
|
|
1476
|
+
const dates = Object.entries(grouped).filter(([date]) => date !== "").map(([date, sessionList]) => {
|
|
1477
|
+
const time = sessionList.map((session) => {
|
|
1478
|
+
const fromTime = extractTimeFromIsoString(session.start_time);
|
|
1479
|
+
const toTime = extractTimeFromIsoString(session.end_time);
|
|
1480
|
+
const { start_time: _s, end_time: _e, ...meta } = session;
|
|
1481
|
+
const camelCaseMeta = convertKeysToCamelCase(meta);
|
|
1482
|
+
return {
|
|
1483
|
+
fromTime,
|
|
1484
|
+
toTime,
|
|
1485
|
+
meta: camelCaseMeta
|
|
1486
|
+
};
|
|
1487
|
+
});
|
|
1488
|
+
return {
|
|
1489
|
+
date: new Date(date),
|
|
1490
|
+
meta: {},
|
|
1491
|
+
time
|
|
1492
|
+
};
|
|
1493
|
+
}).sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
1494
|
+
return {
|
|
1495
|
+
dates
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
__name(mapTrybeSessionAvailabilityToSystemResponse, "mapTrybeSessionAvailabilityToSystemResponse");
|
|
1499
|
+
function mapTrybeAppointmentAvailabilityToSystemResponse(slots) {
|
|
1500
|
+
const filtered = slots.filter((s) => s.quantity_available > 0);
|
|
1501
|
+
const grouped = groupByDate(filtered, (s) => {
|
|
1502
|
+
const dateMatch = s.start_time.match(/^(\d{4}-\d{2}-\d{2})/);
|
|
1503
|
+
return dateMatch ? dateMatch[1] : "";
|
|
1504
|
+
});
|
|
1505
|
+
const dates = Object.entries(grouped).filter(([date]) => date !== "").map(([date, slotList]) => {
|
|
1506
|
+
const time = slotList.map((slot) => {
|
|
1507
|
+
const fromTime = extractTimeFromIsoString(slot.start_time);
|
|
1508
|
+
const toTime = extractTimeFromIsoString(slot.end_time);
|
|
1509
|
+
const { start_time: _s, end_time: _e, ...meta } = slot;
|
|
1510
|
+
const camelCaseMeta = convertKeysToCamelCase(meta);
|
|
1511
|
+
return {
|
|
1512
|
+
fromTime,
|
|
1513
|
+
toTime,
|
|
1514
|
+
meta: camelCaseMeta
|
|
1515
|
+
};
|
|
1516
|
+
});
|
|
1517
|
+
return {
|
|
1518
|
+
date: new Date(date),
|
|
1519
|
+
meta: {},
|
|
1520
|
+
time
|
|
1521
|
+
};
|
|
1522
|
+
}).sort((a, b) => a.date.getTime() - b.date.getTime());
|
|
1523
|
+
return {
|
|
1524
|
+
dates
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
__name(mapTrybeAppointmentAvailabilityToSystemResponse, "mapTrybeAppointmentAvailabilityToSystemResponse");
|
|
1528
|
+
|
|
1529
|
+
// ../../packages/dvss-integration-trybe/src/capabilities/wellness/wellness-management.service.ts
|
|
1077
1530
|
function _ts_decorate14(decorators, target, key, desc) {
|
|
1078
1531
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1079
1532
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1081,12 +1534,250 @@ function _ts_decorate14(decorators, target, key, desc) {
|
|
|
1081
1534
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1082
1535
|
}
|
|
1083
1536
|
__name(_ts_decorate14, "_ts_decorate");
|
|
1537
|
+
function _ts_metadata11(k, v) {
|
|
1538
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1539
|
+
}
|
|
1540
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1541
|
+
exports.TrybeWellnessManagement = class _TrybeWellnessManagement {
|
|
1542
|
+
static {
|
|
1543
|
+
__name(this, "TrybeWellnessManagement");
|
|
1544
|
+
}
|
|
1545
|
+
logger;
|
|
1546
|
+
trafficGatewayService;
|
|
1547
|
+
trybeAuthService;
|
|
1548
|
+
fileName = "wellness-management.service";
|
|
1549
|
+
constructor(logger, trafficGatewayService, trybeAuthService) {
|
|
1550
|
+
this.logger = logger;
|
|
1551
|
+
this.trafficGatewayService = trafficGatewayService;
|
|
1552
|
+
this.trybeAuthService = trybeAuthService;
|
|
1553
|
+
}
|
|
1554
|
+
fetchPractitioners() {
|
|
1555
|
+
throw new Error("Method not implemented.");
|
|
1556
|
+
}
|
|
1557
|
+
fetchWellnessAppointmentSession() {
|
|
1558
|
+
throw new Error("Method not implemented.");
|
|
1559
|
+
}
|
|
1560
|
+
checkWellnessAppointmentSessionAvailability() {
|
|
1561
|
+
throw new Error("Method not implemented.");
|
|
1562
|
+
}
|
|
1563
|
+
createWellnessAppointmentSessionOrder() {
|
|
1564
|
+
throw new Error("Method not implemented.");
|
|
1565
|
+
}
|
|
1566
|
+
addWellnessAppointmentSessionOrderItems() {
|
|
1567
|
+
throw new Error("Method not implemented.");
|
|
1568
|
+
}
|
|
1569
|
+
confirmWellnessAppointmentSessionOrder() {
|
|
1570
|
+
throw new Error("Method not implemented.");
|
|
1571
|
+
}
|
|
1572
|
+
async fetchAppointments(request, integration, loggedInUserId) {
|
|
1573
|
+
this.logger.info(loggedInUserId, this.fetchAppointments.name, this.fileName, `${_TrybeWellnessManagement.name} -> ${this.fetchAppointments.name} Called`, {
|
|
1574
|
+
request
|
|
1575
|
+
});
|
|
1576
|
+
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
1577
|
+
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
1578
|
+
if (request.shouldFetchAllAppointments && request.options?.page !== void 0) {
|
|
1579
|
+
throw new Error("Pagination options are not supported when fetching all appointments.");
|
|
1580
|
+
}
|
|
1581
|
+
const query = new URLSearchParams();
|
|
1582
|
+
if (request.options?.page != null) {
|
|
1583
|
+
query.set("page", String(request.options.page));
|
|
1584
|
+
}
|
|
1585
|
+
if (request.options?.count != null) {
|
|
1586
|
+
query.set("per_page", String(request.options.count));
|
|
1587
|
+
}
|
|
1588
|
+
const queryString = query.toString();
|
|
1589
|
+
const apiUrl = `/shop/appointment-types?site_id=${siteId}` + (request.practitionerIds && request.practitionerIds.length > 0 ? `&practitioner_id=${request.practitionerIds.join(",")}` : "") + (queryString ? `&${queryString}` : "");
|
|
1590
|
+
const firstPageResponse = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1591
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1592
|
+
url: apiUrl,
|
|
1593
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1594
|
+
headers: validatedIntegration.headers
|
|
1595
|
+
}, validatedIntegration, loggedInUserId);
|
|
1596
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllAppointments, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
1597
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1598
|
+
url: `${apiUrl}&page=${page}`,
|
|
1599
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1600
|
+
headers: validatedIntegration.headers
|
|
1601
|
+
}, validatedIntegration, loggedInUserId));
|
|
1602
|
+
return mapTrybeAppointmentsToSystemResponse(records, firstPageResponse.meta.total);
|
|
1603
|
+
}
|
|
1604
|
+
async fetchSessions(request, integration, loggedInUserId) {
|
|
1605
|
+
this.logger.info(loggedInUserId, this.fetchSessions.name, this.fileName, `${_TrybeWellnessManagement.name} -> ${this.fetchSessions.name} Called`, {
|
|
1606
|
+
request
|
|
1607
|
+
});
|
|
1608
|
+
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
1609
|
+
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
1610
|
+
if (request.shouldFetchAllSessions && request.options?.page !== void 0) {
|
|
1611
|
+
throw new Error("Pagination options are not supported when fetching all sessions.");
|
|
1612
|
+
}
|
|
1613
|
+
const query = new URLSearchParams();
|
|
1614
|
+
if (request.options?.page != null) {
|
|
1615
|
+
query.set("page", String(request.options.page));
|
|
1616
|
+
}
|
|
1617
|
+
if (request.options?.count != null) {
|
|
1618
|
+
query.set("per_page", String(request.options.count));
|
|
1619
|
+
}
|
|
1620
|
+
const queryString = query.toString();
|
|
1621
|
+
const apiUrl = `/shop/session-types?site_id=${siteId}` + (request.practitionerIds && request.practitionerIds.length > 0 ? `&practitioner_id=${request.practitionerIds.join(",")}` : "") + (queryString ? `&${queryString}` : "");
|
|
1622
|
+
const firstPageResponse = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1623
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1624
|
+
url: apiUrl,
|
|
1625
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1626
|
+
headers: validatedIntegration.headers
|
|
1627
|
+
}, validatedIntegration, loggedInUserId);
|
|
1628
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllSessions, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
1629
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1630
|
+
url: `${apiUrl}&page=${page}`,
|
|
1631
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1632
|
+
headers: validatedIntegration.headers
|
|
1633
|
+
}, validatedIntegration, loggedInUserId));
|
|
1634
|
+
return mapTrybeSessionsToSystemResponse(records, firstPageResponse.meta.total);
|
|
1635
|
+
}
|
|
1636
|
+
async fetchCourses(request, integration, loggedInUserId) {
|
|
1637
|
+
this.logger.info(loggedInUserId, this.fetchCourses.name, this.fileName, `${_TrybeWellnessManagement.name} -> ${this.fetchCourses.name} Called`, {
|
|
1638
|
+
request
|
|
1639
|
+
});
|
|
1640
|
+
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
1641
|
+
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
1642
|
+
if (request.shouldFetchAllCourses && request.options?.page !== void 0) {
|
|
1643
|
+
throw new Error("Pagination options are not supported when fetching all courses.");
|
|
1644
|
+
}
|
|
1645
|
+
const query = new URLSearchParams();
|
|
1646
|
+
if (request.options?.page != null) {
|
|
1647
|
+
query.set("page", String(request.options.page));
|
|
1648
|
+
}
|
|
1649
|
+
if (request.options?.count != null) {
|
|
1650
|
+
query.set("per_page", String(request.options.count));
|
|
1651
|
+
}
|
|
1652
|
+
const queryString = query.toString();
|
|
1653
|
+
const apiUrl = `/shop/course-types?organisation_id=${organisationId}` + (queryString ? `&${queryString}` : "");
|
|
1654
|
+
const firstPageResponse = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1655
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1656
|
+
url: apiUrl,
|
|
1657
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1658
|
+
headers: validatedIntegration.headers
|
|
1659
|
+
}, validatedIntegration, loggedInUserId);
|
|
1660
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCourses, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
1661
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1662
|
+
url: `${apiUrl}&page=${page}`,
|
|
1663
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1664
|
+
headers: validatedIntegration.headers
|
|
1665
|
+
}, validatedIntegration, loggedInUserId));
|
|
1666
|
+
return mapTrybeCoursesToSystemResponse(records, firstPageResponse.meta.total);
|
|
1667
|
+
}
|
|
1668
|
+
async fetchCategories(request, integration, loggedInUserId) {
|
|
1669
|
+
this.logger.info(loggedInUserId, this.fetchCategories.name, this.fileName, `${_TrybeWellnessManagement.name} -> ${this.fetchCategories.name} Called`, {
|
|
1670
|
+
request
|
|
1671
|
+
});
|
|
1672
|
+
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
1673
|
+
const organisationId = validatedIntegration.config.integrationConfig.organisationId;
|
|
1674
|
+
if (request.shouldFetchAllCategories && request.options?.page !== void 0) {
|
|
1675
|
+
throw new Error("Pagination options are not supported when fetching all categories.");
|
|
1676
|
+
}
|
|
1677
|
+
const query = new URLSearchParams();
|
|
1678
|
+
if (request.options?.page != null) {
|
|
1679
|
+
query.set("page", String(request.options.page));
|
|
1680
|
+
}
|
|
1681
|
+
if (request.options?.count != null) {
|
|
1682
|
+
query.set("per_page", String(request.options.count));
|
|
1683
|
+
}
|
|
1684
|
+
const queryString = query.toString();
|
|
1685
|
+
const apiUrl = `/shop/organisations/${organisationId}/categories` + (queryString ? `?${queryString}` : "");
|
|
1686
|
+
const firstPageResponse = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1687
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1688
|
+
url: apiUrl,
|
|
1689
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1690
|
+
headers: validatedIntegration.headers
|
|
1691
|
+
}, validatedIntegration, loggedInUserId);
|
|
1692
|
+
const records = await fetchAllPages(firstPageResponse, request.shouldFetchAllCategories, (page) => this.trafficGatewayService.executeIntegrationRequest({
|
|
1693
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1694
|
+
url: `${apiUrl}${apiUrl.includes("?") ? "&" : "?"}page=${page}`,
|
|
1695
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1696
|
+
headers: validatedIntegration.headers
|
|
1697
|
+
}, validatedIntegration, loggedInUserId));
|
|
1698
|
+
return mapTrybeCategoriesToSystemResponse(records, firstPageResponse.meta.total);
|
|
1699
|
+
}
|
|
1700
|
+
async fetchBookableItemsFromCredit(request, integration, loggedInUserId) {
|
|
1701
|
+
this.logger.info(loggedInUserId, this.fetchBookableItemsFromCredit.name, this.fileName, `${_TrybeWellnessManagement.name} -> ${this.fetchBookableItemsFromCredit.name} Called`, {
|
|
1702
|
+
request
|
|
1703
|
+
});
|
|
1704
|
+
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
1705
|
+
const query = new URLSearchParams();
|
|
1706
|
+
if (request.options?.page != null) {
|
|
1707
|
+
query.set("page", String(request.options.page));
|
|
1708
|
+
}
|
|
1709
|
+
if (request.options?.count != null) {
|
|
1710
|
+
query.set("per_page", String(request.options.count));
|
|
1711
|
+
}
|
|
1712
|
+
const queryString = query.toString();
|
|
1713
|
+
const apiUrl = `/shop/coupon-codes/${request.couponCodeId}/offering-discounts` + (queryString ? `?${queryString}` : "");
|
|
1714
|
+
const response = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1715
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1716
|
+
url: apiUrl,
|
|
1717
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1718
|
+
headers: validatedIntegration.headers
|
|
1719
|
+
}, validatedIntegration, loggedInUserId);
|
|
1720
|
+
return mapTrybeCouponCodeOfferingsToSystemResponse(response.data.offerings);
|
|
1721
|
+
}
|
|
1722
|
+
async fetchSessionAvailabilityForOffering(request, integration, loggedInUserId) {
|
|
1723
|
+
this.logger.info(loggedInUserId, this.fetchSessionAvailabilityForOffering.name, this.fileName, `${_TrybeWellnessManagement.name} -> ${this.fetchSessionAvailabilityForOffering.name} Called`, {
|
|
1724
|
+
request
|
|
1725
|
+
});
|
|
1726
|
+
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
1727
|
+
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
1728
|
+
const formattedDateTimeFrom = formatDateForTrybe(request.dateTimeFrom, true);
|
|
1729
|
+
const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false);
|
|
1730
|
+
const apiUrl = `/shop/item-availability/sessions/${siteId}/${request.externalOfferingBookableItemId}?date_time_from=${encodeURIComponent(formattedDateTimeFrom)}&date_time_to=${encodeURIComponent(formattedDateTimeTo)}&offeringId=${request.externalOfferingBookableItemId}`;
|
|
1731
|
+
const response = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1732
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1733
|
+
url: apiUrl,
|
|
1734
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1735
|
+
headers: validatedIntegration.headers
|
|
1736
|
+
}, validatedIntegration, loggedInUserId);
|
|
1737
|
+
return mapTrybeSessionAvailabilityToSystemResponse(response.data);
|
|
1738
|
+
}
|
|
1739
|
+
async fetchAppointmentAvailabilityForOffering(request, integration, loggedInUserId) {
|
|
1740
|
+
this.logger.info(loggedInUserId, this.fetchAppointmentAvailabilityForOffering.name, this.fileName, `${_TrybeWellnessManagement.name} -> ${this.fetchAppointmentAvailabilityForOffering.name} Called`, {
|
|
1741
|
+
request
|
|
1742
|
+
});
|
|
1743
|
+
const validatedIntegration = this.trybeAuthService.validateConfig(integration, loggedInUserId);
|
|
1744
|
+
const siteId = validatedIntegration.config.integrationConfig.siteId;
|
|
1745
|
+
const formattedDateTimeFrom = formatDateForTrybe(request.dateTimeFrom, true);
|
|
1746
|
+
const formattedDateTimeTo = formatDateForTrybe(request.dateTimeTo, false);
|
|
1747
|
+
const apiUrl = `/shop/item-availability/appointment-slots/${siteId}/${request.externalOfferingBookableItemId}?date_time_from=${encodeURIComponent(formattedDateTimeFrom)}&date_time_to=${encodeURIComponent(formattedDateTimeTo)}&OfferingID=${request.externalOfferingBookableItemId}`;
|
|
1748
|
+
const response = await this.trafficGatewayService.executeIntegrationRequest({
|
|
1749
|
+
apiMethod: HTTP_METHOD.GET,
|
|
1750
|
+
url: apiUrl,
|
|
1751
|
+
baseUrl: validatedIntegration.config.platformConfig.baseUrl,
|
|
1752
|
+
headers: validatedIntegration.headers
|
|
1753
|
+
}, validatedIntegration, loggedInUserId);
|
|
1754
|
+
return mapTrybeAppointmentAvailabilityToSystemResponse(response.data);
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
exports.TrybeWellnessManagement = _ts_decorate14([
|
|
1758
|
+
common.Injectable(),
|
|
1759
|
+
_ts_metadata11("design:type", Function),
|
|
1760
|
+
_ts_metadata11("design:paramtypes", [
|
|
1761
|
+
typeof dvssBackendModuleUtility.LoggerService === "undefined" ? Object : dvssBackendModuleUtility.LoggerService,
|
|
1762
|
+
typeof exports.TrafficGatewayService === "undefined" ? Object : exports.TrafficGatewayService,
|
|
1763
|
+
typeof exports.TrybeAuthService === "undefined" ? Object : exports.TrybeAuthService
|
|
1764
|
+
])
|
|
1765
|
+
], exports.TrybeWellnessManagement);
|
|
1766
|
+
|
|
1767
|
+
// ../../packages/dvss-integration-trybe/src/app.module.ts
|
|
1768
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
1769
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1770
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1771
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1772
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1773
|
+
}
|
|
1774
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
1084
1775
|
exports.IntegrationTrybeModule = class AppModule2 {
|
|
1085
1776
|
static {
|
|
1086
1777
|
__name(this, "AppModule");
|
|
1087
1778
|
}
|
|
1088
1779
|
};
|
|
1089
|
-
exports.IntegrationTrybeModule =
|
|
1780
|
+
exports.IntegrationTrybeModule = _ts_decorate15([
|
|
1090
1781
|
common.Module({
|
|
1091
1782
|
imports: [
|
|
1092
1783
|
// Load environment variables from root .env file
|
|
@@ -1105,44 +1796,32 @@ exports.IntegrationTrybeModule = _ts_decorate14([
|
|
|
1105
1796
|
AppService2,
|
|
1106
1797
|
exports.TrybeAuthService,
|
|
1107
1798
|
exports.TrybeCustomerManagement,
|
|
1108
|
-
exports.TrybeCreditBooking
|
|
1799
|
+
exports.TrybeCreditBooking,
|
|
1800
|
+
exports.TrybeWellnessManagement
|
|
1109
1801
|
],
|
|
1110
1802
|
exports: [
|
|
1111
1803
|
exports.TrybeAuthService,
|
|
1112
1804
|
exports.TrybeCustomerManagement,
|
|
1113
|
-
exports.TrybeCreditBooking
|
|
1805
|
+
exports.TrybeCreditBooking,
|
|
1806
|
+
exports.TrybeWellnessManagement
|
|
1114
1807
|
]
|
|
1115
1808
|
})
|
|
1116
1809
|
], exports.IntegrationTrybeModule);
|
|
1117
1810
|
|
|
1118
|
-
// ../../packages/dvss-integration-trybe/src/capabilities/package-management/package-management.service.ts
|
|
1119
|
-
var TrybePackageManagement = class {
|
|
1120
|
-
static {
|
|
1121
|
-
__name(this, "TrybePackageManagement");
|
|
1122
|
-
}
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
|
-
// ../../packages/dvss-integration-trybe/src/capabilities/wellness/appointment-booking.service.ts
|
|
1126
|
-
var TrybeWellnessAppointmentBooking = class extends BaseWellnessAppointmentBooking {
|
|
1127
|
-
static {
|
|
1128
|
-
__name(this, "TrybeWellnessAppointmentBooking");
|
|
1129
|
-
}
|
|
1130
|
-
};
|
|
1131
|
-
|
|
1132
1811
|
// src/app.module.ts
|
|
1133
|
-
function
|
|
1812
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
1134
1813
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1135
1814
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1136
1815
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1137
1816
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1138
1817
|
}
|
|
1139
|
-
__name(
|
|
1818
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
1140
1819
|
exports.OfferingIntegrationManager = class AppModule3 {
|
|
1141
1820
|
static {
|
|
1142
1821
|
__name(this, "AppModule");
|
|
1143
1822
|
}
|
|
1144
1823
|
};
|
|
1145
|
-
exports.OfferingIntegrationManager =
|
|
1824
|
+
exports.OfferingIntegrationManager = _ts_decorate16([
|
|
1146
1825
|
common.Module({
|
|
1147
1826
|
imports: [
|
|
1148
1827
|
exports.IntegrationTrybeModule,
|
|
@@ -1163,6 +1842,8 @@ exports.OfferingIntegrationManager = _ts_decorate15([
|
|
|
1163
1842
|
})
|
|
1164
1843
|
], exports.OfferingIntegrationManager);
|
|
1165
1844
|
|
|
1845
|
+
exports.BOOKABLE_ITEM_STATUS_ENUM = BOOKABLE_ITEM_STATUS_ENUM;
|
|
1846
|
+
exports.BOOKABLE_ITEM_TYPE_ENUM = BOOKABLE_ITEM_TYPE_ENUM;
|
|
1166
1847
|
exports.BaseAccountingContactManagement = BaseAccountingContactManagement;
|
|
1167
1848
|
exports.BaseAccountingCreditNoteManagement = BaseAccountingCreditNoteManagement;
|
|
1168
1849
|
exports.BaseAccountingCustomerManagement = BaseAccountingCustomerManagement;
|
|
@@ -1179,14 +1860,18 @@ exports.BasePackageManagement = BasePackageManagement;
|
|
|
1179
1860
|
exports.BasePayment = BasePayment;
|
|
1180
1861
|
exports.BasePaymentMethodManagement = BasePaymentMethodManagement;
|
|
1181
1862
|
exports.BasePaymentUserManagement = BasePaymentUserManagement;
|
|
1182
|
-
exports.
|
|
1863
|
+
exports.BaseWellnessManagement = BaseWellnessManagement;
|
|
1183
1864
|
exports.CREDIT_FILTER_BY_ENUM = CREDIT_FILTER_BY_ENUM;
|
|
1184
1865
|
exports.CREDIT_STATUS_ENUM = CREDIT_STATUS_ENUM;
|
|
1185
1866
|
exports.CREDIT_TYPE_ENUM = CREDIT_TYPE_ENUM;
|
|
1867
|
+
exports.DAY_OF_WEEK = DAY_OF_WEEK;
|
|
1186
1868
|
exports.HTTP_METHOD = HTTP_METHOD;
|
|
1187
1869
|
exports.INTEGRATION_PROVIDER_ENUM = INTEGRATION_PROVIDER_ENUM;
|
|
1188
1870
|
exports.TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY = TRAFFIC_ROUTER_CONFIGURATION_STORE_KEY;
|
|
1189
|
-
exports.
|
|
1190
|
-
exports.
|
|
1871
|
+
exports.TRYBE_OFFERING_TYPE_ENUM = TRYBE_OFFERING_TYPE_ENUM;
|
|
1872
|
+
exports.convertKeysToCamelCase = convertKeysToCamelCase;
|
|
1873
|
+
exports.extractTimeFromIsoString = extractTimeFromIsoString;
|
|
1874
|
+
exports.fetchAllPages = fetchAllPages;
|
|
1875
|
+
exports.formatDateForTrybe = formatDateForTrybe;
|
|
1191
1876
|
//# sourceMappingURL=index.js.map
|
|
1192
1877
|
//# sourceMappingURL=index.js.map
|