@peektravel/app-utilities 0.9.3 → 0.9.4
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.cjs +57 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -33
- package/dist/index.d.ts +23 -33
- package/dist/index.js +57 -47
- package/dist/index.js.map +1 -1
- package/llms.txt +3 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -400,7 +400,12 @@ interface ProductMeetingLocation {
|
|
|
400
400
|
}
|
|
401
401
|
/** A single bookable sub-option (resource option or add-on item option). */
|
|
402
402
|
interface ProductTicket {
|
|
403
|
-
/**
|
|
403
|
+
/**
|
|
404
|
+
* Unique identifier of the ticket / option. This is also the
|
|
405
|
+
* **`resourceOptionId`** — the id passed as a ticket's `resourceOptionId` when
|
|
406
|
+
* creating a booking (see {@link CreateBookingTicket}) and reported per slot by
|
|
407
|
+
* {@link AvailabilityService.getAvailabilityTimes}.
|
|
408
|
+
*/
|
|
404
409
|
id: string;
|
|
405
410
|
/** Human-readable name of the ticket / option. */
|
|
406
411
|
name: string;
|
|
@@ -848,6 +853,11 @@ interface BookingTimeRangeSearch extends BookingReadOptions {
|
|
|
848
853
|
type NoteMode = "append" | "overwrite";
|
|
849
854
|
/** A requested ticket (resource option) and quantity for a new booking. */
|
|
850
855
|
interface CreateBookingTicket {
|
|
856
|
+
/**
|
|
857
|
+
* The resource option to book — this is the {@link ProductTicket.id} from the
|
|
858
|
+
* activity's `tickets` (also reported per slot by
|
|
859
|
+
* {@link AvailabilityService.getAvailabilityTimes}).
|
|
860
|
+
*/
|
|
851
861
|
resourceOptionId: string;
|
|
852
862
|
quantity: number;
|
|
853
863
|
}
|
|
@@ -991,56 +1001,44 @@ type MetaDataVolumeUnit = "GALLON";
|
|
|
991
1001
|
* `number`; `Decimal` values are kept as strings to avoid float-precision loss;
|
|
992
1002
|
* `Date`/`Time` values are ISO strings.
|
|
993
1003
|
*
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
* `html` variant's `displayValue` is HTML-escaped so it is safe to render as
|
|
997
|
-
* text.
|
|
1004
|
+
* A human-readable, display-safe rendering of the value lives on the parent
|
|
1005
|
+
* {@link MetaData.displayValue}, not here.
|
|
998
1006
|
*/
|
|
999
1007
|
type MetaDataValue = {
|
|
1000
1008
|
kind: "age";
|
|
1001
1009
|
age: number;
|
|
1002
|
-
displayValue: string;
|
|
1003
1010
|
} | {
|
|
1004
1011
|
kind: "attachment";
|
|
1005
1012
|
attachmentUrl: string;
|
|
1006
1013
|
mime: string | null;
|
|
1007
1014
|
name: string | null;
|
|
1008
1015
|
size: number | null;
|
|
1009
|
-
displayValue: string;
|
|
1010
1016
|
} | {
|
|
1011
1017
|
kind: "barcode";
|
|
1012
1018
|
barcodeType: MetaDataBarcodeType | null;
|
|
1013
1019
|
barcodeValue: string;
|
|
1014
|
-
displayValue: string;
|
|
1015
1020
|
} | {
|
|
1016
1021
|
kind: "boolean";
|
|
1017
1022
|
boolean: boolean;
|
|
1018
|
-
displayValue: string;
|
|
1019
1023
|
} | {
|
|
1020
1024
|
kind: "checkbox";
|
|
1021
1025
|
isChecked: boolean;
|
|
1022
|
-
displayValue: string;
|
|
1023
1026
|
} | {
|
|
1024
1027
|
kind: "currency";
|
|
1025
1028
|
currency: string;
|
|
1026
|
-
displayValue: string;
|
|
1027
1029
|
} | {
|
|
1028
1030
|
kind: "date";
|
|
1029
1031
|
date: string;
|
|
1030
|
-
displayValue: string;
|
|
1031
1032
|
} | {
|
|
1032
1033
|
kind: "decimal";
|
|
1033
1034
|
decimal: string | null;
|
|
1034
|
-
displayValue: string;
|
|
1035
1035
|
} | {
|
|
1036
1036
|
kind: "duration";
|
|
1037
1037
|
amount: number;
|
|
1038
1038
|
unit: MetaDataDurationUnit | null;
|
|
1039
|
-
displayValue: string;
|
|
1040
1039
|
} | {
|
|
1041
1040
|
kind: "email";
|
|
1042
1041
|
email: string | null;
|
|
1043
|
-
displayValue: string;
|
|
1044
1042
|
} | {
|
|
1045
1043
|
kind: "guest";
|
|
1046
1044
|
name: string | null;
|
|
@@ -1048,19 +1046,15 @@ type MetaDataValue = {
|
|
|
1048
1046
|
dateOfBirth: string | null;
|
|
1049
1047
|
notes: string | null;
|
|
1050
1048
|
waiverSigned: boolean | null;
|
|
1051
|
-
displayValue: string;
|
|
1052
1049
|
} | {
|
|
1053
1050
|
kind: "html";
|
|
1054
1051
|
html: string;
|
|
1055
|
-
displayValue: string;
|
|
1056
1052
|
} | {
|
|
1057
1053
|
kind: "imageUrl";
|
|
1058
1054
|
imageUrl: string;
|
|
1059
|
-
displayValue: string;
|
|
1060
1055
|
} | {
|
|
1061
1056
|
kind: "integer";
|
|
1062
1057
|
integer: number;
|
|
1063
|
-
displayValue: string;
|
|
1064
1058
|
} | {
|
|
1065
1059
|
kind: "location";
|
|
1066
1060
|
country: string | null;
|
|
@@ -1069,45 +1063,35 @@ type MetaDataValue = {
|
|
|
1069
1063
|
postalCode: string | null;
|
|
1070
1064
|
region: string | null;
|
|
1071
1065
|
streetAddress: string | null;
|
|
1072
|
-
displayValue: string;
|
|
1073
1066
|
} | {
|
|
1074
1067
|
kind: "longText";
|
|
1075
1068
|
longText: string;
|
|
1076
|
-
displayValue: string;
|
|
1077
1069
|
} | {
|
|
1078
1070
|
kind: "meta";
|
|
1079
1071
|
meta: unknown;
|
|
1080
|
-
displayValue: string;
|
|
1081
1072
|
} | {
|
|
1082
1073
|
kind: "percent";
|
|
1083
1074
|
percent: string | null;
|
|
1084
|
-
displayValue: string;
|
|
1085
1075
|
} | {
|
|
1086
1076
|
kind: "phone";
|
|
1087
1077
|
phone: string;
|
|
1088
|
-
displayValue: string;
|
|
1089
1078
|
} | {
|
|
1090
1079
|
kind: "shortText";
|
|
1091
1080
|
shortText: string;
|
|
1092
|
-
displayValue: string;
|
|
1093
1081
|
} | {
|
|
1094
1082
|
kind: "time";
|
|
1095
1083
|
time: string;
|
|
1096
|
-
displayValue: string;
|
|
1097
1084
|
} | {
|
|
1098
1085
|
kind: "url";
|
|
1099
1086
|
url: string | null;
|
|
1100
|
-
displayValue: string;
|
|
1101
1087
|
} | {
|
|
1102
1088
|
kind: "volume";
|
|
1103
1089
|
amount: string;
|
|
1104
1090
|
unit: MetaDataVolumeUnit | null;
|
|
1105
|
-
displayValue: string;
|
|
1106
1091
|
} | {
|
|
1107
1092
|
kind: "weight";
|
|
1108
1093
|
amount: string;
|
|
1109
1094
|
unit: MetaDataWeightUnit | null;
|
|
1110
|
-
displayValue: string;
|
|
1111
1095
|
};
|
|
1112
1096
|
/** A single booking custom-field response (one `fieldResponse`). */
|
|
1113
1097
|
interface MetaData {
|
|
@@ -1117,8 +1101,8 @@ interface MetaData {
|
|
|
1117
1101
|
name: string;
|
|
1118
1102
|
/**
|
|
1119
1103
|
* Field slug. When an `integrator` filter is applied, the matched
|
|
1120
|
-
* `
|
|
1121
|
-
* `
|
|
1104
|
+
* `integrators:<integrator>:` prefix is stripped off (e.g.
|
|
1105
|
+
* `integrators:bob:booking_url` → `booking_url`).
|
|
1122
1106
|
*/
|
|
1123
1107
|
slug: string;
|
|
1124
1108
|
/** Raw field type reported by the gateway (kept as a string). */
|
|
@@ -1131,6 +1115,12 @@ interface MetaData {
|
|
|
1131
1115
|
isRequired: boolean;
|
|
1132
1116
|
/** The response's reference id. */
|
|
1133
1117
|
refid: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* A human-readable, display-safe string rendering of the value. Always
|
|
1120
|
+
* present — `""` when the value is absent or of an unrecognized variant. The
|
|
1121
|
+
* `html` value's rendering is HTML-escaped so it is safe to render as text.
|
|
1122
|
+
*/
|
|
1123
|
+
displayValue: string;
|
|
1134
1124
|
/**
|
|
1135
1125
|
* The typed response value, or `null` when absent or of an unrecognized
|
|
1136
1126
|
* (future) variant.
|
|
@@ -1345,7 +1335,7 @@ interface BookingServiceOptions {
|
|
|
1345
1335
|
accessOptions?: AccessOptions;
|
|
1346
1336
|
/**
|
|
1347
1337
|
* Integrator id used to scope `getMetaData` results — only fields whose slug
|
|
1348
|
-
* starts with `
|
|
1338
|
+
* starts with `integrators:<integrator>:` are returned. Defaults to `""` (set
|
|
1349
1339
|
* by the access service to the install's issuer).
|
|
1350
1340
|
*/
|
|
1351
1341
|
integrator?: string;
|
|
@@ -1406,7 +1396,7 @@ declare class BookingService {
|
|
|
1406
1396
|
/**
|
|
1407
1397
|
* Returns a booking's custom-field metadata (its `fieldResponses`), scoped to
|
|
1408
1398
|
* this service's integrator. Only fields whose slug starts with
|
|
1409
|
-
* `
|
|
1399
|
+
* `integrators:<integrator>:` are returned, and that prefix is stripped from
|
|
1410
1400
|
* each returned `slug`. Returns `[]` when the booking is not found or has no
|
|
1411
1401
|
* matching fields.
|
|
1412
1402
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -400,7 +400,12 @@ interface ProductMeetingLocation {
|
|
|
400
400
|
}
|
|
401
401
|
/** A single bookable sub-option (resource option or add-on item option). */
|
|
402
402
|
interface ProductTicket {
|
|
403
|
-
/**
|
|
403
|
+
/**
|
|
404
|
+
* Unique identifier of the ticket / option. This is also the
|
|
405
|
+
* **`resourceOptionId`** — the id passed as a ticket's `resourceOptionId` when
|
|
406
|
+
* creating a booking (see {@link CreateBookingTicket}) and reported per slot by
|
|
407
|
+
* {@link AvailabilityService.getAvailabilityTimes}.
|
|
408
|
+
*/
|
|
404
409
|
id: string;
|
|
405
410
|
/** Human-readable name of the ticket / option. */
|
|
406
411
|
name: string;
|
|
@@ -848,6 +853,11 @@ interface BookingTimeRangeSearch extends BookingReadOptions {
|
|
|
848
853
|
type NoteMode = "append" | "overwrite";
|
|
849
854
|
/** A requested ticket (resource option) and quantity for a new booking. */
|
|
850
855
|
interface CreateBookingTicket {
|
|
856
|
+
/**
|
|
857
|
+
* The resource option to book — this is the {@link ProductTicket.id} from the
|
|
858
|
+
* activity's `tickets` (also reported per slot by
|
|
859
|
+
* {@link AvailabilityService.getAvailabilityTimes}).
|
|
860
|
+
*/
|
|
851
861
|
resourceOptionId: string;
|
|
852
862
|
quantity: number;
|
|
853
863
|
}
|
|
@@ -991,56 +1001,44 @@ type MetaDataVolumeUnit = "GALLON";
|
|
|
991
1001
|
* `number`; `Decimal` values are kept as strings to avoid float-precision loss;
|
|
992
1002
|
* `Date`/`Time` values are ISO strings.
|
|
993
1003
|
*
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
* `html` variant's `displayValue` is HTML-escaped so it is safe to render as
|
|
997
|
-
* text.
|
|
1004
|
+
* A human-readable, display-safe rendering of the value lives on the parent
|
|
1005
|
+
* {@link MetaData.displayValue}, not here.
|
|
998
1006
|
*/
|
|
999
1007
|
type MetaDataValue = {
|
|
1000
1008
|
kind: "age";
|
|
1001
1009
|
age: number;
|
|
1002
|
-
displayValue: string;
|
|
1003
1010
|
} | {
|
|
1004
1011
|
kind: "attachment";
|
|
1005
1012
|
attachmentUrl: string;
|
|
1006
1013
|
mime: string | null;
|
|
1007
1014
|
name: string | null;
|
|
1008
1015
|
size: number | null;
|
|
1009
|
-
displayValue: string;
|
|
1010
1016
|
} | {
|
|
1011
1017
|
kind: "barcode";
|
|
1012
1018
|
barcodeType: MetaDataBarcodeType | null;
|
|
1013
1019
|
barcodeValue: string;
|
|
1014
|
-
displayValue: string;
|
|
1015
1020
|
} | {
|
|
1016
1021
|
kind: "boolean";
|
|
1017
1022
|
boolean: boolean;
|
|
1018
|
-
displayValue: string;
|
|
1019
1023
|
} | {
|
|
1020
1024
|
kind: "checkbox";
|
|
1021
1025
|
isChecked: boolean;
|
|
1022
|
-
displayValue: string;
|
|
1023
1026
|
} | {
|
|
1024
1027
|
kind: "currency";
|
|
1025
1028
|
currency: string;
|
|
1026
|
-
displayValue: string;
|
|
1027
1029
|
} | {
|
|
1028
1030
|
kind: "date";
|
|
1029
1031
|
date: string;
|
|
1030
|
-
displayValue: string;
|
|
1031
1032
|
} | {
|
|
1032
1033
|
kind: "decimal";
|
|
1033
1034
|
decimal: string | null;
|
|
1034
|
-
displayValue: string;
|
|
1035
1035
|
} | {
|
|
1036
1036
|
kind: "duration";
|
|
1037
1037
|
amount: number;
|
|
1038
1038
|
unit: MetaDataDurationUnit | null;
|
|
1039
|
-
displayValue: string;
|
|
1040
1039
|
} | {
|
|
1041
1040
|
kind: "email";
|
|
1042
1041
|
email: string | null;
|
|
1043
|
-
displayValue: string;
|
|
1044
1042
|
} | {
|
|
1045
1043
|
kind: "guest";
|
|
1046
1044
|
name: string | null;
|
|
@@ -1048,19 +1046,15 @@ type MetaDataValue = {
|
|
|
1048
1046
|
dateOfBirth: string | null;
|
|
1049
1047
|
notes: string | null;
|
|
1050
1048
|
waiverSigned: boolean | null;
|
|
1051
|
-
displayValue: string;
|
|
1052
1049
|
} | {
|
|
1053
1050
|
kind: "html";
|
|
1054
1051
|
html: string;
|
|
1055
|
-
displayValue: string;
|
|
1056
1052
|
} | {
|
|
1057
1053
|
kind: "imageUrl";
|
|
1058
1054
|
imageUrl: string;
|
|
1059
|
-
displayValue: string;
|
|
1060
1055
|
} | {
|
|
1061
1056
|
kind: "integer";
|
|
1062
1057
|
integer: number;
|
|
1063
|
-
displayValue: string;
|
|
1064
1058
|
} | {
|
|
1065
1059
|
kind: "location";
|
|
1066
1060
|
country: string | null;
|
|
@@ -1069,45 +1063,35 @@ type MetaDataValue = {
|
|
|
1069
1063
|
postalCode: string | null;
|
|
1070
1064
|
region: string | null;
|
|
1071
1065
|
streetAddress: string | null;
|
|
1072
|
-
displayValue: string;
|
|
1073
1066
|
} | {
|
|
1074
1067
|
kind: "longText";
|
|
1075
1068
|
longText: string;
|
|
1076
|
-
displayValue: string;
|
|
1077
1069
|
} | {
|
|
1078
1070
|
kind: "meta";
|
|
1079
1071
|
meta: unknown;
|
|
1080
|
-
displayValue: string;
|
|
1081
1072
|
} | {
|
|
1082
1073
|
kind: "percent";
|
|
1083
1074
|
percent: string | null;
|
|
1084
|
-
displayValue: string;
|
|
1085
1075
|
} | {
|
|
1086
1076
|
kind: "phone";
|
|
1087
1077
|
phone: string;
|
|
1088
|
-
displayValue: string;
|
|
1089
1078
|
} | {
|
|
1090
1079
|
kind: "shortText";
|
|
1091
1080
|
shortText: string;
|
|
1092
|
-
displayValue: string;
|
|
1093
1081
|
} | {
|
|
1094
1082
|
kind: "time";
|
|
1095
1083
|
time: string;
|
|
1096
|
-
displayValue: string;
|
|
1097
1084
|
} | {
|
|
1098
1085
|
kind: "url";
|
|
1099
1086
|
url: string | null;
|
|
1100
|
-
displayValue: string;
|
|
1101
1087
|
} | {
|
|
1102
1088
|
kind: "volume";
|
|
1103
1089
|
amount: string;
|
|
1104
1090
|
unit: MetaDataVolumeUnit | null;
|
|
1105
|
-
displayValue: string;
|
|
1106
1091
|
} | {
|
|
1107
1092
|
kind: "weight";
|
|
1108
1093
|
amount: string;
|
|
1109
1094
|
unit: MetaDataWeightUnit | null;
|
|
1110
|
-
displayValue: string;
|
|
1111
1095
|
};
|
|
1112
1096
|
/** A single booking custom-field response (one `fieldResponse`). */
|
|
1113
1097
|
interface MetaData {
|
|
@@ -1117,8 +1101,8 @@ interface MetaData {
|
|
|
1117
1101
|
name: string;
|
|
1118
1102
|
/**
|
|
1119
1103
|
* Field slug. When an `integrator` filter is applied, the matched
|
|
1120
|
-
* `
|
|
1121
|
-
* `
|
|
1104
|
+
* `integrators:<integrator>:` prefix is stripped off (e.g.
|
|
1105
|
+
* `integrators:bob:booking_url` → `booking_url`).
|
|
1122
1106
|
*/
|
|
1123
1107
|
slug: string;
|
|
1124
1108
|
/** Raw field type reported by the gateway (kept as a string). */
|
|
@@ -1131,6 +1115,12 @@ interface MetaData {
|
|
|
1131
1115
|
isRequired: boolean;
|
|
1132
1116
|
/** The response's reference id. */
|
|
1133
1117
|
refid: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* A human-readable, display-safe string rendering of the value. Always
|
|
1120
|
+
* present — `""` when the value is absent or of an unrecognized variant. The
|
|
1121
|
+
* `html` value's rendering is HTML-escaped so it is safe to render as text.
|
|
1122
|
+
*/
|
|
1123
|
+
displayValue: string;
|
|
1134
1124
|
/**
|
|
1135
1125
|
* The typed response value, or `null` when absent or of an unrecognized
|
|
1136
1126
|
* (future) variant.
|
|
@@ -1345,7 +1335,7 @@ interface BookingServiceOptions {
|
|
|
1345
1335
|
accessOptions?: AccessOptions;
|
|
1346
1336
|
/**
|
|
1347
1337
|
* Integrator id used to scope `getMetaData` results — only fields whose slug
|
|
1348
|
-
* starts with `
|
|
1338
|
+
* starts with `integrators:<integrator>:` are returned. Defaults to `""` (set
|
|
1349
1339
|
* by the access service to the install's issuer).
|
|
1350
1340
|
*/
|
|
1351
1341
|
integrator?: string;
|
|
@@ -1406,7 +1396,7 @@ declare class BookingService {
|
|
|
1406
1396
|
/**
|
|
1407
1397
|
* Returns a booking's custom-field metadata (its `fieldResponses`), scoped to
|
|
1408
1398
|
* this service's integrator. Only fields whose slug starts with
|
|
1409
|
-
* `
|
|
1399
|
+
* `integrators:<integrator>:` are returned, and that prefix is stripped from
|
|
1410
1400
|
* each returned `slug`. Returns `[]` when the booking is not found or has no
|
|
1411
1401
|
* matching fields.
|
|
1412
1402
|
*
|
package/dist/index.js
CHANGED
|
@@ -939,6 +939,7 @@ function fromBookingMetaDataNode(node) {
|
|
|
939
939
|
function fromFieldResponseNode(response) {
|
|
940
940
|
const field = response.fieldLocation?.field;
|
|
941
941
|
const prompt = response.fieldLocation?.prompt;
|
|
942
|
+
const { value, displayValue } = fromValueNode(response.value);
|
|
942
943
|
return {
|
|
943
944
|
id: field?.id || "",
|
|
944
945
|
name: field?.name || "",
|
|
@@ -948,89 +949,96 @@ function fromFieldResponseNode(response) {
|
|
|
948
949
|
promptHint: prompt?.hint ?? null,
|
|
949
950
|
isRequired: Boolean(prompt?.isRequired),
|
|
950
951
|
refid: response.refid || "",
|
|
951
|
-
|
|
952
|
+
displayValue,
|
|
953
|
+
value
|
|
952
954
|
};
|
|
953
955
|
}
|
|
954
956
|
function fromValueNode(value) {
|
|
955
|
-
if (!value || !value.__typename) return null;
|
|
957
|
+
if (!value || !value.__typename) return { value: null, displayValue: "" };
|
|
956
958
|
switch (value.__typename) {
|
|
957
959
|
case "AgeFieldResponseValue": {
|
|
958
960
|
const age = value.age ?? 0;
|
|
959
|
-
return { kind: "age", age, displayValue: String(age) };
|
|
961
|
+
return { value: { kind: "age", age }, displayValue: String(age) };
|
|
960
962
|
}
|
|
961
963
|
case "AttachmentFieldResponseValue": {
|
|
962
964
|
const attachmentUrl = value.attachmentUrl ?? "";
|
|
963
965
|
const name = value.name ?? null;
|
|
964
966
|
return {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
967
|
+
value: {
|
|
968
|
+
kind: "attachment",
|
|
969
|
+
attachmentUrl,
|
|
970
|
+
mime: value.mime ?? null,
|
|
971
|
+
name,
|
|
972
|
+
size: value.size ?? null
|
|
973
|
+
},
|
|
970
974
|
displayValue: name || attachmentUrl
|
|
971
975
|
};
|
|
972
976
|
}
|
|
973
977
|
case "BarcodeFieldResponseValue": {
|
|
974
978
|
const barcodeValue = value.barcodeValue ?? "";
|
|
975
979
|
return {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
980
|
+
value: {
|
|
981
|
+
kind: "barcode",
|
|
982
|
+
barcodeType: value.barcodeType ?? null,
|
|
983
|
+
barcodeValue
|
|
984
|
+
},
|
|
979
985
|
displayValue: barcodeValue
|
|
980
986
|
};
|
|
981
987
|
}
|
|
982
988
|
case "BooleanFieldResponseValue": {
|
|
983
989
|
const bool = Boolean(value.boolean);
|
|
984
|
-
return { kind: "boolean", boolean: bool, displayValue: yesNo(bool) };
|
|
990
|
+
return { value: { kind: "boolean", boolean: bool }, displayValue: yesNo(bool) };
|
|
985
991
|
}
|
|
986
992
|
case "CheckboxFieldResponseValue": {
|
|
987
993
|
const isChecked = Boolean(value.isChecked);
|
|
988
|
-
return { kind: "checkbox", isChecked, displayValue: yesNo(isChecked) };
|
|
994
|
+
return { value: { kind: "checkbox", isChecked }, displayValue: yesNo(isChecked) };
|
|
989
995
|
}
|
|
990
996
|
case "CurrencyFieldResponseValue": {
|
|
991
997
|
const currency = value.currency ?? "";
|
|
992
|
-
return { kind: "currency", currency, displayValue: currency };
|
|
998
|
+
return { value: { kind: "currency", currency }, displayValue: currency };
|
|
993
999
|
}
|
|
994
1000
|
case "DateFieldResponseValue": {
|
|
995
1001
|
const date = value.date ?? "";
|
|
996
|
-
return { kind: "date", date, displayValue: date };
|
|
1002
|
+
return { value: { kind: "date", date }, displayValue: date };
|
|
997
1003
|
}
|
|
998
1004
|
case "DecimalFieldResponseValue": {
|
|
999
1005
|
const decimal = value.decimal ?? null;
|
|
1000
|
-
return { kind: "decimal", decimal, displayValue: decimal ?? "" };
|
|
1006
|
+
return { value: { kind: "decimal", decimal }, displayValue: decimal ?? "" };
|
|
1001
1007
|
}
|
|
1002
1008
|
case "DurationFieldResponseValue": {
|
|
1003
1009
|
const amount = value.duration?.amount ?? 0;
|
|
1004
1010
|
const unit = value.duration?.unit ?? null;
|
|
1005
|
-
return { kind: "duration", amount, unit, displayValue: amountUnit(amount, unit) };
|
|
1011
|
+
return { value: { kind: "duration", amount, unit }, displayValue: amountUnit(amount, unit) };
|
|
1006
1012
|
}
|
|
1007
1013
|
case "EmailFieldResponseValue": {
|
|
1008
1014
|
const email = value.email ?? null;
|
|
1009
|
-
return { kind: "email", email, displayValue: email ?? "" };
|
|
1015
|
+
return { value: { kind: "email", email }, displayValue: email ?? "" };
|
|
1010
1016
|
}
|
|
1011
1017
|
case "GuestFieldResponseValue": {
|
|
1012
1018
|
const name = value.name ?? null;
|
|
1013
1019
|
return {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
+
value: {
|
|
1021
|
+
kind: "guest",
|
|
1022
|
+
name,
|
|
1023
|
+
email: value.email ?? null,
|
|
1024
|
+
dateOfBirth: value.dateOfBirth ?? null,
|
|
1025
|
+
notes: value.notes ?? null,
|
|
1026
|
+
waiverSigned: value.waiverSigned ?? null
|
|
1027
|
+
},
|
|
1020
1028
|
displayValue: name ?? ""
|
|
1021
1029
|
};
|
|
1022
1030
|
}
|
|
1023
1031
|
case "HtmlFieldResponseValue": {
|
|
1024
1032
|
const html = value.html ?? "";
|
|
1025
|
-
return { kind: "html", html, displayValue: escapeHtml(html) };
|
|
1033
|
+
return { value: { kind: "html", html }, displayValue: escapeHtml(html) };
|
|
1026
1034
|
}
|
|
1027
1035
|
case "ImageUrlFieldResponseValue": {
|
|
1028
1036
|
const imageUrl = value.imageUrl ?? "";
|
|
1029
|
-
return { kind: "imageUrl", imageUrl, displayValue: imageUrl };
|
|
1037
|
+
return { value: { kind: "imageUrl", imageUrl }, displayValue: imageUrl };
|
|
1030
1038
|
}
|
|
1031
1039
|
case "IntegerFieldResponseValue": {
|
|
1032
1040
|
const integer = value.integer ?? 0;
|
|
1033
|
-
return { kind: "integer", integer, displayValue: String(integer) };
|
|
1041
|
+
return { value: { kind: "integer", integer }, displayValue: String(integer) };
|
|
1034
1042
|
}
|
|
1035
1043
|
case "LocationFieldResponseValue": {
|
|
1036
1044
|
const streetAddress = value.streetAddress ?? null;
|
|
@@ -1039,56 +1047,58 @@ function fromValueNode(value) {
|
|
|
1039
1047
|
const postalCode = value.postalCode ?? null;
|
|
1040
1048
|
const country = value.country ?? null;
|
|
1041
1049
|
return {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1050
|
+
value: {
|
|
1051
|
+
kind: "location",
|
|
1052
|
+
country,
|
|
1053
|
+
county: value.county ?? null,
|
|
1054
|
+
locality,
|
|
1055
|
+
postalCode,
|
|
1056
|
+
region,
|
|
1057
|
+
streetAddress
|
|
1058
|
+
},
|
|
1049
1059
|
displayValue: [streetAddress, locality, region, postalCode, country].filter((part) => part).join(", ")
|
|
1050
1060
|
};
|
|
1051
1061
|
}
|
|
1052
1062
|
case "LongTextFieldResponseValue": {
|
|
1053
1063
|
const longText = value.longText ?? "";
|
|
1054
|
-
return { kind: "longText", longText, displayValue: longText };
|
|
1064
|
+
return { value: { kind: "longText", longText }, displayValue: longText };
|
|
1055
1065
|
}
|
|
1056
1066
|
case "MetaFieldResponseValue": {
|
|
1057
1067
|
const meta = value.meta ?? null;
|
|
1058
|
-
return { kind: "meta", meta, displayValue: meta == null ? "" : JSON.stringify(meta) };
|
|
1068
|
+
return { value: { kind: "meta", meta }, displayValue: meta == null ? "" : JSON.stringify(meta) };
|
|
1059
1069
|
}
|
|
1060
1070
|
case "PercentFieldResponseValue": {
|
|
1061
1071
|
const percent = value.percent ?? null;
|
|
1062
|
-
return { kind: "percent", percent, displayValue: percent == null ? "" : `${percent}%` };
|
|
1072
|
+
return { value: { kind: "percent", percent }, displayValue: percent == null ? "" : `${percent}%` };
|
|
1063
1073
|
}
|
|
1064
1074
|
case "PhoneFieldResponseValue": {
|
|
1065
1075
|
const phone = value.phone ?? "";
|
|
1066
|
-
return { kind: "phone", phone, displayValue: phone };
|
|
1076
|
+
return { value: { kind: "phone", phone }, displayValue: phone };
|
|
1067
1077
|
}
|
|
1068
1078
|
case "ShortTextFieldResponseValue": {
|
|
1069
1079
|
const shortText = value.shortText ?? "";
|
|
1070
|
-
return { kind: "shortText", shortText, displayValue: shortText };
|
|
1080
|
+
return { value: { kind: "shortText", shortText }, displayValue: shortText };
|
|
1071
1081
|
}
|
|
1072
1082
|
case "TimeFieldResponseValue": {
|
|
1073
1083
|
const time = value.time ?? "";
|
|
1074
|
-
return { kind: "time", time, displayValue: time };
|
|
1084
|
+
return { value: { kind: "time", time }, displayValue: time };
|
|
1075
1085
|
}
|
|
1076
1086
|
case "UrlFieldResponseValue": {
|
|
1077
1087
|
const url = value.url ?? null;
|
|
1078
|
-
return { kind: "url", url, displayValue: url ?? "" };
|
|
1088
|
+
return { value: { kind: "url", url }, displayValue: url ?? "" };
|
|
1079
1089
|
}
|
|
1080
1090
|
case "VolumeFieldResponseValue": {
|
|
1081
1091
|
const amount = value.volume?.amount ?? "0";
|
|
1082
1092
|
const unit = value.volume?.unit ?? null;
|
|
1083
|
-
return { kind: "volume", amount, unit, displayValue: amountUnit(amount, unit) };
|
|
1093
|
+
return { value: { kind: "volume", amount, unit }, displayValue: amountUnit(amount, unit) };
|
|
1084
1094
|
}
|
|
1085
1095
|
case "WeightFieldResponseValue": {
|
|
1086
1096
|
const amount = value.weight?.amount ?? "0";
|
|
1087
1097
|
const unit = value.weight?.unit ?? null;
|
|
1088
|
-
return { kind: "weight", amount, unit, displayValue: amountUnit(amount, unit) };
|
|
1098
|
+
return { value: { kind: "weight", amount, unit }, displayValue: amountUnit(amount, unit) };
|
|
1089
1099
|
}
|
|
1090
1100
|
default:
|
|
1091
|
-
return null;
|
|
1101
|
+
return { value: null, displayValue: "" };
|
|
1092
1102
|
}
|
|
1093
1103
|
}
|
|
1094
1104
|
function yesNo(value) {
|
|
@@ -1108,7 +1118,7 @@ function toSetMetaDataResult(node, bookingId) {
|
|
|
1108
1118
|
};
|
|
1109
1119
|
}
|
|
1110
1120
|
function filterMetaDataByIntegrator(metaData, integrator) {
|
|
1111
|
-
const prefix = `
|
|
1121
|
+
const prefix = `integrators:${integrator}:`;
|
|
1112
1122
|
return metaData.filter((entry) => entry.slug.startsWith(prefix)).map((entry) => ({ ...entry, slug: entry.slug.slice(prefix.length) }));
|
|
1113
1123
|
}
|
|
1114
1124
|
|
|
@@ -1604,7 +1614,7 @@ var BookingService = class {
|
|
|
1604
1614
|
/**
|
|
1605
1615
|
* Returns a booking's custom-field metadata (its `fieldResponses`), scoped to
|
|
1606
1616
|
* this service's integrator. Only fields whose slug starts with
|
|
1607
|
-
* `
|
|
1617
|
+
* `integrators:<integrator>:` are returned, and that prefix is stripped from
|
|
1608
1618
|
* each returned `slug`. Returns `[]` when the booking is not found or has no
|
|
1609
1619
|
* matching fields.
|
|
1610
1620
|
*
|
|
@@ -2642,7 +2652,7 @@ async function requestWithRetry(http, url, init, label, onResponse) {
|
|
|
2642
2652
|
// src/internal/sdk-headers.ts
|
|
2643
2653
|
var SDK_HEADER_NAME = "x-peek-sdk";
|
|
2644
2654
|
var SDK_PLATFORM = "js";
|
|
2645
|
-
var SDK_VERSION = "0.9.
|
|
2655
|
+
var SDK_VERSION = "0.9.4";
|
|
2646
2656
|
var SDK_HEADER_VALUE = `${SDK_PLATFORM}-${SDK_VERSION}`;
|
|
2647
2657
|
|
|
2648
2658
|
// src/internal/peek/graphql-client.ts
|