@explorins/pers-shared 2.1.184 → 2.1.185

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.
@@ -18,4 +18,17 @@ export type LocationType = typeof LOCATION_TYPES[number];
18
18
  * Keeping for backward compatibility during migration.
19
19
  */
20
20
  export type BookingSource = 'manual' | 'api' | 'import' | 'migration';
21
+ /**
22
+ * Check if a booking status satisfies a requirement type.
23
+ *
24
+ * @param status - Current booking status ('past', 'active', 'future')
25
+ * @param requirement - Required booking status for eligibility
26
+ * @returns true if the status satisfies the requirement
27
+ *
28
+ * @example
29
+ * isBookingStatusValid('active', 'active_future'); // true
30
+ * isBookingStatusValid('past', 'active_future'); // false
31
+ * isBookingStatusValid('future', 'any'); // true
32
+ */
33
+ export declare function isBookingStatusValid(status: BookingStatus, requirement: BookingRequirementType): boolean;
21
34
  //# sourceMappingURL=booking.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"booking.type.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,eAAe,GACf,KAAK,CAAC;AAEV;;;GAGG;AACH,eAAO,MAAM,cAAc,wEAMjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC"}
1
+ {"version":3,"file":"booking.type.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,eAAe,GACf,KAAK,CAAC;AAEV;;;GAGG;AACH,eAAO,MAAM,cAAc,wEAMjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAeT"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LOCATION_TYPES = void 0;
4
+ exports.isBookingStatusValid = isBookingStatusValid;
4
5
  /**
5
6
  * Location types for bookings.
6
7
  * Broad categories for different booking contexts.
@@ -12,4 +13,32 @@ exports.LOCATION_TYPES = [
12
13
  'experience', // Experience package (multi-activity, bundle)
13
14
  'destination', // Destination/location-based (city pass, area access)
14
15
  ];
16
+ /**
17
+ * Check if a booking status satisfies a requirement type.
18
+ *
19
+ * @param status - Current booking status ('past', 'active', 'future')
20
+ * @param requirement - Required booking status for eligibility
21
+ * @returns true if the status satisfies the requirement
22
+ *
23
+ * @example
24
+ * isBookingStatusValid('active', 'active_future'); // true
25
+ * isBookingStatusValid('past', 'active_future'); // false
26
+ * isBookingStatusValid('future', 'any'); // true
27
+ */
28
+ function isBookingStatusValid(status, requirement) {
29
+ switch (requirement) {
30
+ case 'active':
31
+ return status === 'active';
32
+ case 'future':
33
+ return status === 'future';
34
+ case 'past':
35
+ return status === 'past';
36
+ case 'active_future':
37
+ return status === 'active' || status === 'future';
38
+ case 'any':
39
+ return true;
40
+ default:
41
+ return false;
42
+ }
43
+ }
15
44
  //# sourceMappingURL=booking.type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"booking.type.js","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":";;;AAgBA;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,UAAU,EAAM,qDAAqD;IACrE,SAAS,EAAO,iDAAiD;IACjE,OAAO,EAAS,gDAAgD;IAChE,YAAY,EAAI,8CAA8C;IAC9D,aAAa,EAAG,sDAAsD;CAC9D,CAAC"}
1
+ {"version":3,"file":"booking.type.js","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":";;;AAgDA,oDAkBC;AAlDD;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,UAAU,EAAM,qDAAqD;IACrE,SAAS,EAAO,iDAAiD;IACjE,OAAO,EAAS,gDAAgD;IAChE,YAAY,EAAI,8CAA8C;IAC9D,aAAa,EAAG,sDAAsD;CAC9D,CAAC;AAUX;;;;;;;;;;;GAWG;AACH,SAAgB,oBAAoB,CAClC,MAAqB,EACrB,WAAmC;IAEnC,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,OAAO,MAAM,KAAK,QAAQ,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,MAAM,KAAK,QAAQ,CAAC;QAC7B,KAAK,MAAM;YACT,OAAO,MAAM,KAAK,MAAM,CAAC;QAC3B,KAAK,eAAe;YAClB,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,CAAC;QACpD,KAAK,KAAK;YACR,OAAO,IAAI,CAAC;QACd;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -18,4 +18,17 @@ export type LocationType = typeof LOCATION_TYPES[number];
18
18
  * Keeping for backward compatibility during migration.
19
19
  */
20
20
  export type BookingSource = 'manual' | 'api' | 'import' | 'migration';
21
+ /**
22
+ * Check if a booking status satisfies a requirement type.
23
+ *
24
+ * @param status - Current booking status ('past', 'active', 'future')
25
+ * @param requirement - Required booking status for eligibility
26
+ * @returns true if the status satisfies the requirement
27
+ *
28
+ * @example
29
+ * isBookingStatusValid('active', 'active_future'); // true
30
+ * isBookingStatusValid('past', 'active_future'); // false
31
+ * isBookingStatusValid('future', 'any'); // true
32
+ */
33
+ export declare function isBookingStatusValid(status: BookingStatus, requirement: BookingRequirementType): boolean;
21
34
  //# sourceMappingURL=booking.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"booking.type.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,eAAe,GACf,KAAK,CAAC;AAEV;;;GAGG;AACH,eAAO,MAAM,cAAc,wEAMjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC"}
1
+ {"version":3,"file":"booking.type.d.ts","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,eAAe,GACf,KAAK,CAAC;AAEV;;;GAGG;AACH,eAAO,MAAM,cAAc,wEAMjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAeT"}
@@ -9,4 +9,32 @@ export const LOCATION_TYPES = [
9
9
  'experience', // Experience package (multi-activity, bundle)
10
10
  'destination', // Destination/location-based (city pass, area access)
11
11
  ];
12
+ /**
13
+ * Check if a booking status satisfies a requirement type.
14
+ *
15
+ * @param status - Current booking status ('past', 'active', 'future')
16
+ * @param requirement - Required booking status for eligibility
17
+ * @returns true if the status satisfies the requirement
18
+ *
19
+ * @example
20
+ * isBookingStatusValid('active', 'active_future'); // true
21
+ * isBookingStatusValid('past', 'active_future'); // false
22
+ * isBookingStatusValid('future', 'any'); // true
23
+ */
24
+ export function isBookingStatusValid(status, requirement) {
25
+ switch (requirement) {
26
+ case 'active':
27
+ return status === 'active';
28
+ case 'future':
29
+ return status === 'future';
30
+ case 'past':
31
+ return status === 'past';
32
+ case 'active_future':
33
+ return status === 'active' || status === 'future';
34
+ case 'any':
35
+ return true;
36
+ default:
37
+ return false;
38
+ }
39
+ }
12
40
  //# sourceMappingURL=booking.type.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"booking.type.js","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAM,qDAAqD;IACrE,SAAS,EAAO,iDAAiD;IACjE,OAAO,EAAS,gDAAgD;IAChE,YAAY,EAAI,8CAA8C;IAC9D,aAAa,EAAG,sDAAsD;CAC9D,CAAC"}
1
+ {"version":3,"file":"booking.type.js","sourceRoot":"","sources":["../../../../src/shared-lib/types/booking.type.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,UAAU,EAAM,qDAAqD;IACrE,SAAS,EAAO,iDAAiD;IACjE,OAAO,EAAS,gDAAgD;IAChE,YAAY,EAAI,8CAA8C;IAC9D,aAAa,EAAG,sDAAsD;CAC9D,CAAC;AAUX;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAAqB,EACrB,WAAmC;IAEnC,QAAQ,WAAW,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,OAAO,MAAM,KAAK,QAAQ,CAAC;QAC7B,KAAK,QAAQ;YACX,OAAO,MAAM,KAAK,QAAQ,CAAC;QAC7B,KAAK,MAAM;YACT,OAAO,MAAM,KAAK,MAAM,CAAC;QAC3B,KAAK,eAAe;YAClB,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,CAAC;QACpD,KAAK,KAAK;YACR,OAAO,IAAI,CAAC;QACd;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorins/pers-shared",
3
- "version": "2.1.184",
3
+ "version": "2.1.185",
4
4
  "scripts": {
5
5
  "clean": "find dist -type f -delete 2>/dev/null || true",
6
6
  "build:esm": "tsc -p tsconfig.esm.json && node scripts/add-js-extensions.js",