@peektravel/app-utilities 0.5.1 → 0.5.2

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 CHANGED
@@ -2788,6 +2788,14 @@ function normalizeDate(date) {
2788
2788
  return date.split("T")[0] ?? date;
2789
2789
  }
2790
2790
 
2791
+ // src/internal/peek/money.ts
2792
+ function toPricingMoney(raw) {
2793
+ if (!raw) return null;
2794
+ const money = { amount: raw.amount, currency: raw.currency };
2795
+ if (raw.formatted != null) money.displayPrice = raw.formatted;
2796
+ return money;
2797
+ }
2798
+
2791
2799
  // src/internal/peek/products/product-converter.ts
2792
2800
  var ADD_ON_COLOR = "#FFFFFF";
2793
2801
  function fromActivities(activities) {
@@ -2803,7 +2811,9 @@ function fromActivity(activity) {
2803
2811
  currency: activity.currency || "",
2804
2812
  tickets: (activity.resourceOptions ?? []).map((option) => ({
2805
2813
  id: option.id,
2806
- name: option.name
2814
+ name: option.name,
2815
+ minPrice: toPricingMoney(option.priceRange?.min),
2816
+ maxPrice: toPricingMoney(option.priceRange?.max)
2807
2817
  }))
2808
2818
  };
2809
2819
  }
@@ -2824,7 +2834,12 @@ function fromItemOptionNodes(nodes) {
2824
2834
  };
2825
2835
  grouped.set(itemId, product);
2826
2836
  }
2827
- product.tickets.push({ id: node.id, name: node.name });
2837
+ product.tickets.push({
2838
+ id: node.id,
2839
+ name: node.name,
2840
+ minPrice: null,
2841
+ maxPrice: null
2842
+ });
2828
2843
  }
2829
2844
  return Array.from(grouped.values());
2830
2845
  }
@@ -2843,6 +2858,18 @@ var PRODUCTS_QUERY = `
2843
2858
  resourceOptions {
2844
2859
  id
2845
2860
  name
2861
+ priceRange {
2862
+ min {
2863
+ currency
2864
+ amount
2865
+ formatted
2866
+ }
2867
+ max {
2868
+ currency
2869
+ amount
2870
+ formatted
2871
+ }
2872
+ }
2846
2873
  }
2847
2874
  }
2848
2875
  }
@@ -3146,6 +3173,7 @@ var UPSERT_PRICING_OVERRIDES_MUTATION = `
3146
3173
  price {
3147
3174
  amount
3148
3175
  currency
3176
+ formatted
3149
3177
  }
3150
3178
  }
3151
3179
  ... on PricingOverridesActivityContextResourceOptionPercentageAdjustmentOverride {
@@ -3194,7 +3222,11 @@ function buildUpsertInput(input) {
3194
3222
  overrides: activity.overrides.map((override) => ({
3195
3223
  order: override.order,
3196
3224
  resourceOptions: override.resourceOptions.map(
3197
- (option) => option.mode === "fixed" ? { id: option.id, price: option.price } : { id: option.id, percentageAdjustment: option.percentageAdjustment }
3225
+ (option) => option.mode === "fixed" ? {
3226
+ id: option.id,
3227
+ // Send only the wire fields — `displayPrice` is read-only.
3228
+ price: { amount: option.price.amount, currency: option.price.currency }
3229
+ } : { id: option.id, percentageAdjustment: option.percentageAdjustment }
3198
3230
  ),
3199
3231
  filters: override.filters
3200
3232
  }))
@@ -3241,7 +3273,7 @@ function fromResourceOption(option) {
3241
3273
  };
3242
3274
  }
3243
3275
  function fromResolvedOverride(override) {
3244
- return "price" in override ? { mode: "fixed", price: override.price } : { mode: "percentage", percentageAdjustment: override.percentageAdjustment };
3276
+ return "price" in override ? { mode: "fixed", price: toPricingMoney(override.price) } : { mode: "percentage", percentageAdjustment: override.percentageAdjustment };
3245
3277
  }
3246
3278
  function fromFilter(filter) {
3247
3279
  if (filter.__typename === SPOTS_TAKEN_FILTER_TYPENAME) {