@v-office/website-sdk 1.0.0

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.
Files changed (39) hide show
  1. package/README.md +263 -0
  2. package/dist/cli.d.mts +1 -0
  3. package/dist/cli.mjs +337 -0
  4. package/dist/client-BbAfk-qa.mjs +33672 -0
  5. package/dist/custom-attribute-ChCbJKf_.mjs +54 -0
  6. package/dist/errors-2cuUGSvi.mjs +5 -0
  7. package/dist/index.d.mts +16130 -0
  8. package/dist/index.mjs +3 -0
  9. package/dist/operations-BanW36PK.mjs +12616 -0
  10. package/dist/operations-CHxEQ3jG.mjs +904 -0
  11. package/dist/parser-D6UAf8Ld.mjs +65 -0
  12. package/dist/quote-C3HZsFua.mjs +313 -0
  13. package/dist/quote-Vl6Nutaa.mjs +513 -0
  14. package/dist/rentals-BFmmp26v.mjs +323 -0
  15. package/dist/rentals-cQAg5TTW.mjs +403 -0
  16. package/dist/search-JqA3v_Fx.mjs +342 -0
  17. package/dist/search-filter-metadata-DZP0-Udc.mjs +4294 -0
  18. package/dist/to-rental-highlights-BcRa9Odv.mjs +402 -0
  19. package/dist/translations/shared/de-DE/availability.json +15 -0
  20. package/dist/translations/shared/de-DE/booking.json +15 -0
  21. package/dist/translations/shared/de-DE/insurance.json +18 -0
  22. package/dist/translations/shared/de-DE/quote.json +8 -0
  23. package/dist/translations/shared/de-DE/reviews.json +11 -0
  24. package/dist/translations/shared/en-US/availability.json +15 -0
  25. package/dist/translations/shared/en-US/booking.json +15 -0
  26. package/dist/translations/shared/en-US/insurance.json +18 -0
  27. package/dist/translations/shared/en-US/quote.json +8 -0
  28. package/dist/translations/shared/en-US/reviews.json +11 -0
  29. package/dist/translations/v10/de-DE/core.json +7027 -0
  30. package/dist/translations/v10/en-US/core.json +7027 -0
  31. package/dist/translations/v9/de-DE/core.json +4 -0
  32. package/dist/translations/v9/de-DE/filter.json +25 -0
  33. package/dist/translations/v9/de-DE/rental-attribute-categories.json +19 -0
  34. package/dist/translations/v9/de-DE/rental-attributes.json +451 -0
  35. package/dist/translations/v9/en-US/core.json +4 -0
  36. package/dist/translations/v9/en-US/filter.json +25 -0
  37. package/dist/translations/v9/en-US/rental-attribute-categories.json +19 -0
  38. package/dist/translations/v9/en-US/rental-attributes.json +451 -0
  39. package/package.json +90 -0
@@ -0,0 +1,54 @@
1
+ import { c as localeToLanguage } from "./parser-D6UAf8Ld.mjs";
2
+ //#region src/adapters/shared/parser/attribute-value.ts
3
+ const isDistanceAttributeKey = (key) => key.endsWith("distance");
4
+ const formatLabeledDistance = ({ label, value }) => `${label}: ${value}m`;
5
+ const isEnabledBooleanValue = (value) => value === true || value === 1 || value === "true" || value === "1";
6
+ const isDisabledBooleanValue = (value) => value === false || value === 0 || value === "false" || value === "0" || value == null;
7
+ const isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
8
+ const isRecord = (value) => typeof value === "object" && value !== null;
9
+ const toLocalizedAttributeString = ({ locale, value }) => {
10
+ if (isNonEmptyString(value)) return value;
11
+ if (!isRecord(value)) return void 0;
12
+ const preferredKeys = [
13
+ locale,
14
+ localeToLanguage(locale),
15
+ "en"
16
+ ];
17
+ for (const key of preferredKeys) {
18
+ const localizedValue = value[key];
19
+ if (isNonEmptyString(localizedValue)) return localizedValue;
20
+ }
21
+ return Object.values(value).find(isNonEmptyString);
22
+ };
23
+ const renderLabeledAttributeValue = ({ key, label, locale, value }) => {
24
+ if (isDisabledBooleanValue(value)) return void 0;
25
+ if (isEnabledBooleanValue(value)) return label;
26
+ if (typeof value === "number") {
27
+ if (isDistanceAttributeKey(key)) return formatLabeledDistance({
28
+ label,
29
+ value
30
+ });
31
+ if (key === "squareMeters") return `${value} m²`;
32
+ return value === 1 ? label : `${value} ${label}`;
33
+ }
34
+ const localizedValue = toLocalizedAttributeString({
35
+ locale,
36
+ value
37
+ });
38
+ if (localizedValue != null) return `${label}: ${localizedValue}`;
39
+ };
40
+ //#endregion
41
+ //#region src/adapters/shared/parser/custom-attribute.ts
42
+ const renderCustomAttributeHighlight = ({ definitions, key, locale, value }) => {
43
+ const definition = definitions.find((entry) => entry.key === key);
44
+ if (definition == null) return void 0;
45
+ const translatedValue = definition.type === "option" && typeof value === "string" ? definition.options.find((option) => option.value === value)?.label[locale] ?? value : value;
46
+ return renderLabeledAttributeValue({
47
+ key,
48
+ label: definition.label[locale],
49
+ locale,
50
+ value: translatedValue
51
+ });
52
+ };
53
+ //#endregion
54
+ export { renderLabeledAttributeValue as i, formatLabeledDistance as n, isDistanceAttributeKey as r, renderCustomAttributeHighlight as t };
@@ -0,0 +1,5 @@
1
+ import { Data } from "effect";
2
+ //#region src/errors/index.ts
3
+ var CMSError = class extends Data.TaggedError("CMSError") {};
4
+ //#endregion
5
+ export { CMSError as t };