@fleetbridge/ui 1.4.0 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbridge/ui",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "FleetBridge customer UI (search, results, booking, manage booking) for WordPress and custom sites.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/server.js CHANGED
@@ -255,6 +255,7 @@ function bookingForm(post) {
255
255
  estimated_total: number("estimatedTotal"),
256
256
  vehicle_amount: number("vehicleAmount"),
257
257
  deposit: number("deposit"),
258
+ excess: number("excess"),
258
259
  drop_off_fee: number("dropOffFee"),
259
260
  rate_package_label: text("ratePackageLabel", 40),
260
261
  terms_id: text("termsId", 64),
@@ -534,7 +535,8 @@ function notification(request, supplierName, timeZone) {
534
535
  dropoffBranchName: request.dropoff_location,
535
536
  rentalDays: request.days || null,
536
537
  ratePackageLabel: request.rate_package_label,
537
- depositAmount: request.deposit > 0 ? cents(request.deposit) : null
538
+ depositAmount: request.deposit > 0 ? cents(request.deposit) : null,
539
+ excessAmount: request.excess > 0 ? cents(request.excess) : null
538
540
  };
539
541
  for (const [key, value] of Object.entries(optional)) if (value !== null && value !== "") out[key] = value;
540
542
  if (request.unlimited_mileage) out.unlimitedMileage = true;
@@ -1322,9 +1324,9 @@ function createPublicHandler(opts) {
1322
1324
  supplierId = found.supplierId;
1323
1325
  credentials = found.credentials;
1324
1326
  supplierName = found.name || supplierName;
1325
- note = mapped(() => notification(request, supplierName, timeZone));
1327
+ note = withManageLink(mapped(() => notification(request, supplierName, timeZone)));
1326
1328
  } else if (isEmail(request.email)) {
1327
- note = mapped(() => notification(request, supplierName, timeZone));
1329
+ note = withManageLink(mapped(() => notification(request, supplierName, timeZone)));
1328
1330
  }
1329
1331
  const input = mapped(() => bookingInput(request, supplierId, credentials, timeZone, note, ctx.channel));
1330
1332
  if (request.pay_online) input.payOnline = true;
@@ -1426,6 +1428,10 @@ function createPublicHandler(opts) {
1426
1428
  if (!id) fail({ message: "This payment link is not valid. Please contact us with your booking details." }, 400);
1427
1429
  return id;
1428
1430
  }
1431
+ function withManageLink(note) {
1432
+ const url = tenant.manageBookingUrl("__RESERVATION__", "__PIN__");
1433
+ return url && isWebAddress(url) && !note.manageBookingUrl ? { ...note, manageBookingUrl: url } : note;
1434
+ }
1429
1435
  function bookingLookup(number, pin) {
1430
1436
  const typed = number.trim().replace(/^[\s.]+|[\s.]+$/g, "");
1431
1437
  const upper = typed.toUpperCase();