@dataemergencia/emergency 0.4.0 → 0.5.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.
package/dist/index.js CHANGED
@@ -734,6 +734,7 @@ function createEmergencyStore(config) {
734
734
  lastError: null,
735
735
  geolocation: null,
736
736
  geolocationError: null,
737
+ contactPhone: null,
737
738
  realtimeStatus: "idle",
738
739
  abortResult: null,
739
740
  simulationResult: null,
@@ -1176,7 +1177,8 @@ function createEmergencyController(deps) {
1176
1177
  patch({
1177
1178
  panelOpen: false,
1178
1179
  abortConfirmation: false,
1179
- simulationConfirmation: false
1180
+ simulationConfirmation: false,
1181
+ contactPhone: null
1180
1182
  });
1181
1183
  events.emit("panel:closed", { reason });
1182
1184
  }
@@ -1225,6 +1227,7 @@ function createEmergencyController(deps) {
1225
1227
  lastError: null,
1226
1228
  geolocation: null,
1227
1229
  geolocationError: null,
1230
+ contactPhone: null,
1228
1231
  realtimeStatus: "idle",
1229
1232
  abortResult: null,
1230
1233
  simulationResult: null,
@@ -1266,7 +1269,8 @@ function createEmergencyController(deps) {
1266
1269
  geolocationError: null,
1267
1270
  ...state.geolocationError !== null || state.abortResult?.ok === false || state.simulationResult?.ok === false || state.phase.kind === "ready" && state.lastError !== null ? { lastError: null } : {}
1268
1271
  });
1269
- }
1272
+ },
1273
+ setContactPhone: (phone) => patch({ contactPhone: phone })
1270
1274
  },
1271
1275
  store,
1272
1276
  events
@@ -1497,6 +1501,11 @@ const paths = {
1497
1501
  /* @__PURE__ */ jsx("path", { d: "M12 7h.01" })
1498
1502
  ] }),
1499
1503
  "arrow-left": /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M19 12H5" }), /* @__PURE__ */ jsx("path", { d: "m12 19-7-7 7-7" })] }),
1504
+ "map-pin": /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", { d: "M12 22s7-6.2 7-12a7 7 0 1 0-14 0c0 5.8 7 12 7 12z" }), /* @__PURE__ */ jsx("circle", {
1505
+ cx: "12",
1506
+ cy: "10",
1507
+ r: "2.5"
1508
+ })] }),
1500
1509
  "credit-card-plus": /* @__PURE__ */ jsxs(Fragment, { children: [
1501
1510
  /* @__PURE__ */ jsx("path", { d: "M12 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5" }),
1502
1511
  /* @__PURE__ */ jsx("path", { d: "M18 12h.01" }),
@@ -1574,6 +1583,7 @@ var panel_module_default = {
1574
1583
  "emergency-panel": "de-emergency-emergency-panel-nA5Hwa",
1575
1584
  "emergency-panel__availability-region": "de-emergency-emergency-panel__availability-region-nA5Hwa",
1576
1585
  "emergency-panel__body": "de-emergency-emergency-panel__body-nA5Hwa",
1586
+ "emergency-panel__body--pre-emergency": "de-emergency-emergency-panel__body--pre-emergency-nA5Hwa",
1577
1587
  "emergency-panel__body--pricing": "de-emergency-emergency-panel__body--pricing-nA5Hwa",
1578
1588
  "emergency-panel__body-split": "de-emergency-emergency-panel__body-split-nA5Hwa",
1579
1589
  "emergency-panel__body-split--with-availability": "de-emergency-emergency-panel__body-split--with-availability-nA5Hwa",
@@ -1584,18 +1594,35 @@ var panel_module_default = {
1584
1594
  "emergency-panel__button--simulation": "de-emergency-emergency-panel__button--simulation-nA5Hwa",
1585
1595
  "emergency-panel__close-button": "de-emergency-emergency-panel__close-button-nA5Hwa",
1586
1596
  "emergency-panel__close-icon": "de-emergency-emergency-panel__close-icon-nA5Hwa",
1597
+ "emergency-panel__divider": "de-emergency-emergency-panel__divider-nA5Hwa",
1587
1598
  "emergency-panel__footer": "de-emergency-emergency-panel__footer-nA5Hwa",
1599
+ "emergency-panel__footer--single": "de-emergency-emergency-panel__footer--single-nA5Hwa",
1588
1600
  "emergency-panel__header": "de-emergency-emergency-panel__header-nA5Hwa",
1601
+ "emergency-panel__header--close-only": "de-emergency-emergency-panel__header--close-only-nA5Hwa",
1589
1602
  "emergency-panel__prompt-region": "de-emergency-emergency-panel__prompt-region-nA5Hwa",
1603
+ "emergency-panel__sr-only": "de-emergency-emergency-panel__sr-only-nA5Hwa",
1590
1604
  "emergency-panel__title": "de-emergency-emergency-panel__title-nA5Hwa",
1591
1605
  "emergency-panel--hidden": "de-emergency-emergency-panel--hidden-nA5Hwa",
1606
+ "emergency-pre-emergency": "de-emergency-emergency-pre-emergency-nA5Hwa",
1607
+ "emergency-pre-emergency__error": "de-emergency-emergency-pre-emergency__error-nA5Hwa",
1608
+ "emergency-pre-emergency__form": "de-emergency-emergency-pre-emergency__form-nA5Hwa",
1609
+ "emergency-pre-emergency__input": "de-emergency-emergency-pre-emergency__input-nA5Hwa",
1610
+ "emergency-pre-emergency__input--area-code": "de-emergency-emergency-pre-emergency__input--area-code-nA5Hwa",
1611
+ "emergency-pre-emergency__input--invalid": "de-emergency-emergency-pre-emergency__input--invalid-nA5Hwa",
1612
+ "emergency-pre-emergency__input--number": "de-emergency-emergency-pre-emergency__input--number-nA5Hwa",
1613
+ "emergency-pre-emergency__input--valid": "de-emergency-emergency-pre-emergency__input--valid-nA5Hwa",
1614
+ "emergency-pre-emergency__label": "de-emergency-emergency-pre-emergency__label-nA5Hwa",
1615
+ "emergency-pre-emergency__notice": "de-emergency-emergency-pre-emergency__notice-nA5Hwa",
1616
+ "emergency-pre-emergency__notice-icon": "de-emergency-emergency-pre-emergency__notice-icon-nA5Hwa",
1617
+ "emergency-pre-emergency__notice-text": "de-emergency-emergency-pre-emergency__notice-text-nA5Hwa",
1618
+ "emergency-pre-emergency__phone-row": "de-emergency-emergency-pre-emergency__phone-row-nA5Hwa",
1592
1619
  "emergency-pricing": "de-emergency-emergency-pricing-nA5Hwa",
1593
1620
  "emergency-pricing__badge": "de-emergency-emergency-pricing__badge-nA5Hwa",
1594
- "emergency-pricing__footnote": "de-emergency-emergency-pricing__footnote-nA5Hwa",
1595
1621
  "emergency-pricing__heading": "de-emergency-emergency-pricing__heading-nA5Hwa",
1596
1622
  "emergency-pricing__package": "de-emergency-emergency-pricing__package-nA5Hwa",
1597
1623
  "emergency-pricing__package--highlighted": "de-emergency-emergency-pricing__package--highlighted-nA5Hwa",
1598
1624
  "emergency-pricing__package-caption": "de-emergency-emergency-pricing__package-caption-nA5Hwa",
1625
+ "emergency-pricing__package-footnote": "de-emergency-emergency-pricing__package-footnote-nA5Hwa",
1599
1626
  "emergency-pricing__package-header": "de-emergency-emergency-pricing__package-header-nA5Hwa",
1600
1627
  "emergency-pricing__package-label": "de-emergency-emergency-pricing__package-label-nA5Hwa",
1601
1628
  "emergency-pricing__package-name": "de-emergency-emergency-pricing__package-name-nA5Hwa",
@@ -1850,11 +1877,12 @@ function useScreenNavigation() {
1850
1877
  }
1851
1878
 
1852
1879
  // src/react/components/EmergencyHeader/index.tsx
1853
- function EmergencyHeader({ titleId, onClose, title = copy.panelLabel, onBack }) {
1880
+ function EmergencyHeader({ titleId, onClose, title = copy.panelLabel, onBack, variant = "default" }) {
1881
+ const closeOnly = variant === "close-only";
1854
1882
  return /* @__PURE__ */ jsxs("header", {
1855
- className: cls("emergency-panel__header"),
1883
+ className: cls("emergency-panel__header", closeOnly && "emergency-panel__header--close-only"),
1856
1884
  children: [
1857
- onBack ? /* @__PURE__ */ jsx("button", {
1885
+ onBack && !closeOnly ? /* @__PURE__ */ jsx("button", {
1858
1886
  type: "button",
1859
1887
  className: cls("emergency-panel__close-button"),
1860
1888
  "aria-label": copy.back,
@@ -1865,7 +1893,7 @@ function EmergencyHeader({ titleId, onClose, title = copy.panelLabel, onBack })
1865
1893
  })
1866
1894
  }) : null,
1867
1895
  /* @__PURE__ */ jsx("h2", {
1868
- className: cls("emergency-panel__title"),
1896
+ className: cls("emergency-panel__title", closeOnly && "emergency-panel__sr-only"),
1869
1897
  id: titleId,
1870
1898
  tabIndex: -1,
1871
1899
  children: title
@@ -1947,6 +1975,182 @@ function DetailsScreen({ titleId, onClose }) {
1947
1975
  });
1948
1976
  }
1949
1977
 
1978
+ // src/core/phone.ts
1979
+ const VENEZUELA_DIALLING_CODE = "+58";
1980
+ const VENEZUELAN_MOBILE_PATTERN = /^4\d{9}$/;
1981
+ function normalizeVenezuelanPhone(input) {
1982
+ return input.replace(/\D/g, "").replace(/^0+/, "");
1983
+ }
1984
+ function formatVenezuelanPhone(input) {
1985
+ const digits = normalizeVenezuelanPhone(input).slice(0, 10);
1986
+ if (digits.length <= 3) return digits;
1987
+ return `${digits.slice(0, 3)} ${digits.slice(3)}`;
1988
+ }
1989
+ function isValidVenezuelanPhone(input) {
1990
+ return VENEZUELAN_MOBILE_PATTERN.test(normalizeVenezuelanPhone(input));
1991
+ }
1992
+ function toVenezuelanE164(input) {
1993
+ const digits = normalizeVenezuelanPhone(input);
1994
+ if (!VENEZUELAN_MOBILE_PATTERN.test(digits)) return null;
1995
+ return `${"+58"}${digits}`;
1996
+ }
1997
+
1998
+ // src/react/components/EmergencyFooter/index.tsx
1999
+ function EmergencyFooter(props) {
2000
+ const { active, busy, aborting, feedbackVisible, showSimulation = true, emergencyDisabled = false, onActivate, onRequestAbort, onRequestSimulation } = props;
2001
+ if (active) return /* @__PURE__ */ jsx("footer", {
2002
+ className: cls("emergency-panel__footer"),
2003
+ children: /* @__PURE__ */ jsxs("button", {
2004
+ type: "button",
2005
+ className: cls("emergency-status__abort-btn"),
2006
+ "aria-label": copy.abort,
2007
+ disabled: aborting || feedbackVisible,
2008
+ onClick: onRequestAbort,
2009
+ children: [copy.abort, /* @__PURE__ */ jsx(Icon, { name: "alert-triangle" })]
2010
+ })
2011
+ });
2012
+ return /* @__PURE__ */ jsxs("footer", {
2013
+ className: cls("emergency-panel__footer", !showSimulation && "emergency-panel__footer--single"),
2014
+ children: [/* @__PURE__ */ jsxs("button", {
2015
+ type: "button",
2016
+ className: cls("emergency-panel__button", "emergency-panel__button--emergency"),
2017
+ "aria-label": copy.emergencyAria,
2018
+ disabled: busy || feedbackVisible || emergencyDisabled,
2019
+ onClick: onActivate,
2020
+ children: [copy.emergency, /* @__PURE__ */ jsx(Icon, { name: "emergency" })]
2021
+ }), showSimulation ? /* @__PURE__ */ jsxs("button", {
2022
+ type: "button",
2023
+ className: cls("emergency-panel__button", "emergency-panel__button--simulation"),
2024
+ "aria-label": copy.testAria,
2025
+ disabled: busy || feedbackVisible,
2026
+ onClick: onRequestSimulation,
2027
+ children: [copy.test, /* @__PURE__ */ jsx(Icon, { name: "list-check" })]
2028
+ }) : null]
2029
+ });
2030
+ }
2031
+
2032
+ // src/react/screens/pre-emergency/copy.ts
2033
+ const preEmergencyCopy = {
2034
+ title: "Pre-emergencia",
2035
+ permissionNotice: "Debes autorizar todos los permisos de ubicación",
2036
+ phoneLabel: "Indique su número de teléfono",
2037
+ phonePlaceholder: "Ej. 0412 000 0000",
2038
+ areaCodeLabel: "Código de país",
2039
+ areaCode: "+58",
2040
+ invalidPhone: "Ingresa un número móvil venezolano válido. Ej. 412 1301234"
2041
+ };
2042
+
2043
+ // src/react/screens/pre-emergency/index.tsx
2044
+ function PreEmergencyScreen(props) {
2045
+ const { back } = useScreenNavigation();
2046
+ const phoneId = useId();
2047
+ const errorId = `${phoneId}-error`;
2048
+ const permissionId = `${phoneId}-permission`;
2049
+ const [digits, setDigits] = useState("");
2050
+ const [touched, setTouched] = useState(false);
2051
+ const valid = isValidVenezuelanPhone(digits);
2052
+ const invalid = touched && digits.length > 0 && !valid;
2053
+ const handleChange = (event) => {
2054
+ const next = normalizeVenezuelanPhone(event.target.value).slice(0, 10);
2055
+ setDigits(next);
2056
+ };
2057
+ const handleSubmit = () => {
2058
+ setTouched(true);
2059
+ if (!valid) return;
2060
+ const phone = toVenezuelanE164(digits);
2061
+ if (phone === null) return;
2062
+ props.onSetContactPhone(phone);
2063
+ props.onActivate();
2064
+ };
2065
+ return /* @__PURE__ */ jsx(EmergencyScreenLayout, {
2066
+ screen: "pre-emergency",
2067
+ titleId: props.titleId,
2068
+ bodyClassName: "emergency-panel__body--pre-emergency",
2069
+ header: /* @__PURE__ */ jsx(EmergencyHeader, {
2070
+ titleId: props.titleId,
2071
+ title: preEmergencyCopy.title,
2072
+ onClose: () => props.onClose("close"),
2073
+ onBack: back
2074
+ }),
2075
+ footer: /* @__PURE__ */ jsx(EmergencyFooter, {
2076
+ active: props.active,
2077
+ busy: props.busy,
2078
+ aborting: props.aborting,
2079
+ feedbackVisible: props.feedbackVisible,
2080
+ emergencyDisabled: !valid,
2081
+ showSimulation: false,
2082
+ onActivate: handleSubmit,
2083
+ onRequestAbort: props.onRequestAbort,
2084
+ onRequestSimulation: props.onRequestSimulation
2085
+ }),
2086
+ children: /* @__PURE__ */ jsxs("div", {
2087
+ className: cls("emergency-pre-emergency"),
2088
+ children: [/* @__PURE__ */ jsxs("section", {
2089
+ role: "note",
2090
+ "aria-labelledby": permissionId,
2091
+ className: cls("emergency-pre-emergency__notice"),
2092
+ children: [/* @__PURE__ */ jsx(Icon, {
2093
+ name: "map-pin",
2094
+ className: cls("emergency-pre-emergency__notice-icon")
2095
+ }), /* @__PURE__ */ jsx("p", {
2096
+ id: permissionId,
2097
+ className: cls("emergency-pre-emergency__notice-text"),
2098
+ children: preEmergencyCopy.permissionNotice
2099
+ })]
2100
+ }), /* @__PURE__ */ jsxs("form", {
2101
+ className: cls("emergency-pre-emergency__form"),
2102
+ noValidate: true,
2103
+ onSubmit: (event) => {
2104
+ event.preventDefault();
2105
+ handleSubmit();
2106
+ },
2107
+ onKeyDown: (event) => {
2108
+ if (event.key === "Enter") {
2109
+ event.preventDefault();
2110
+ handleSubmit();
2111
+ }
2112
+ },
2113
+ children: [
2114
+ /* @__PURE__ */ jsx("label", {
2115
+ htmlFor: phoneId,
2116
+ className: cls("emergency-pre-emergency__label"),
2117
+ children: preEmergencyCopy.phoneLabel
2118
+ }),
2119
+ /* @__PURE__ */ jsxs("div", {
2120
+ className: cls("emergency-pre-emergency__phone-row"),
2121
+ children: [/* @__PURE__ */ jsx("input", {
2122
+ type: "tel",
2123
+ "aria-label": preEmergencyCopy.areaCodeLabel,
2124
+ className: cls("emergency-pre-emergency__input", "emergency-pre-emergency__input--area-code", valid && "emergency-pre-emergency__input--valid"),
2125
+ value: preEmergencyCopy.areaCode,
2126
+ disabled: true,
2127
+ readOnly: true
2128
+ }), /* @__PURE__ */ jsx("input", {
2129
+ id: phoneId,
2130
+ type: "tel",
2131
+ inputMode: "tel",
2132
+ autoComplete: "tel-national",
2133
+ placeholder: preEmergencyCopy.phonePlaceholder,
2134
+ className: cls("emergency-pre-emergency__input", "emergency-pre-emergency__input--number", valid && "emergency-pre-emergency__input--valid", invalid && "emergency-pre-emergency__input--invalid"),
2135
+ value: formatVenezuelanPhone(digits),
2136
+ "aria-invalid": invalid,
2137
+ "aria-describedby": invalid ? errorId : void 0,
2138
+ onChange: handleChange,
2139
+ onBlur: () => setTouched(true)
2140
+ })]
2141
+ }),
2142
+ invalid ? /* @__PURE__ */ jsx("p", {
2143
+ id: errorId,
2144
+ role: "alert",
2145
+ className: cls("emergency-pre-emergency__error"),
2146
+ children: preEmergencyCopy.invalidPhone
2147
+ }) : null
2148
+ ]
2149
+ })]
2150
+ })
2151
+ });
2152
+ }
2153
+
1950
2154
  // src/react/components/icons/paramedical-mark.tsx
1951
2155
  /**
1952
2156
  * Neutral inline illustration used by the idle panel.
@@ -2418,13 +2622,16 @@ function EmergencyBody(props) {
2418
2622
  const idle = !active && !loading && !showingFeedback && error === null;
2419
2623
  return /* @__PURE__ */ jsxs("div", {
2420
2624
  className: cls("emergency-panel__body-split", idle && "emergency-panel__body-split--with-availability"),
2421
- children: [idle ? /* @__PURE__ */ jsx("div", {
2625
+ children: [idle ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
2422
2626
  className: cls("emergency-panel__availability-region"),
2423
2627
  children: /* @__PURE__ */ jsx(Availability, {
2424
2628
  onRecharge,
2425
2629
  onDetails
2426
2630
  })
2427
- }) : null, /* @__PURE__ */ jsxs("div", {
2631
+ }), /* @__PURE__ */ jsx("hr", {
2632
+ className: cls("emergency-panel__divider"),
2633
+ "aria-hidden": "true"
2634
+ })] }) : null, /* @__PURE__ */ jsxs("div", {
2428
2635
  className: cls("emergency-panel__prompt-region"),
2429
2636
  children: [
2430
2637
  !loading && !showingFeedback ? /* @__PURE__ */ jsx("div", {
@@ -2465,48 +2672,17 @@ function EmergencyBody(props) {
2465
2672
  });
2466
2673
  }
2467
2674
 
2468
- // src/react/components/EmergencyFooter/index.tsx
2469
- function EmergencyFooter(props) {
2470
- const { active, busy, aborting, feedbackVisible, onActivate, onRequestAbort, onRequestSimulation } = props;
2471
- if (active) return /* @__PURE__ */ jsx("footer", {
2472
- className: cls("emergency-panel__footer"),
2473
- children: /* @__PURE__ */ jsxs("button", {
2474
- type: "button",
2475
- className: cls("emergency-status__abort-btn"),
2476
- "aria-label": copy.abort,
2477
- disabled: aborting || feedbackVisible,
2478
- onClick: onRequestAbort,
2479
- children: [copy.abort, /* @__PURE__ */ jsx(Icon, { name: "alert-triangle" })]
2480
- })
2481
- });
2482
- return /* @__PURE__ */ jsxs("footer", {
2483
- className: cls("emergency-panel__footer"),
2484
- children: [/* @__PURE__ */ jsxs("button", {
2485
- type: "button",
2486
- className: cls("emergency-panel__button", "emergency-panel__button--emergency"),
2487
- "aria-label": copy.emergencyAria,
2488
- disabled: busy || feedbackVisible,
2489
- onClick: onActivate,
2490
- children: [copy.emergency, /* @__PURE__ */ jsx(Icon, { name: "emergency" })]
2491
- }), /* @__PURE__ */ jsxs("button", {
2492
- type: "button",
2493
- className: cls("emergency-panel__button", "emergency-panel__button--simulation"),
2494
- "aria-label": copy.testAria,
2495
- disabled: busy || feedbackVisible,
2496
- onClick: onRequestSimulation,
2497
- children: [copy.test, /* @__PURE__ */ jsx(Icon, { name: "list-check" })]
2498
- })]
2499
- });
2500
- }
2501
-
2502
2675
  // src/react/screens/primary/index.tsx
2503
2676
  function PrimaryScreen(props) {
2504
2677
  const { navigate } = useScreenNavigation();
2678
+ const idle = !props.active && !props.loading && !props.feedbackVisible && props.error === null;
2679
+ const needsContactPhone = props.contactPhone === null;
2505
2680
  return /* @__PURE__ */ jsx(EmergencyScreenLayout, {
2506
2681
  screen: "primary",
2507
2682
  titleId: props.titleId,
2508
2683
  header: /* @__PURE__ */ jsx(EmergencyHeader, {
2509
2684
  titleId: props.titleId,
2685
+ variant: idle ? "close-only" : "default",
2510
2686
  onClose: () => props.onClose("close")
2511
2687
  }),
2512
2688
  footer: /* @__PURE__ */ jsx(EmergencyFooter, {
@@ -2514,7 +2690,7 @@ function PrimaryScreen(props) {
2514
2690
  busy: props.busy,
2515
2691
  aborting: props.aborting,
2516
2692
  feedbackVisible: props.feedbackVisible,
2517
- onActivate: props.onActivate,
2693
+ onActivate: needsContactPhone ? () => navigate("pre-emergency") : props.onActivate,
2518
2694
  onRequestAbort: props.onRequestAbort,
2519
2695
  onRequestSimulation: props.onRequestSimulation
2520
2696
  }),
@@ -2548,7 +2724,7 @@ const pricingCopy = {
2548
2724
  chosen: "Seleccionado",
2549
2725
  whatsapp: "de WhatsApp",
2550
2726
  rounds: "rondas de alerta",
2551
- perMessage: "por mensaje + IVA",
2727
+ perMessage: "IVA Incluido",
2552
2728
  footnote: "Rondas calculadas con 3 contactos de emergencia. Válidas para pruebas y emergencias."
2553
2729
  };
2554
2730
 
@@ -2562,17 +2738,16 @@ const PRICING_PACKAGES = [{
2562
2738
  label: "PAQUETE 1",
2563
2739
  messages: 100,
2564
2740
  priceLabel: "$7",
2565
- priceCaption: "IVA incluido",
2566
- perMessageLabel: "$0.06",
2741
+ priceCaption: "IVA incluído",
2742
+ perMessageLabel: "$0.07",
2567
2743
  highlighted: false
2568
2744
  }, {
2569
2745
  id: "package-2",
2570
2746
  label: "PAQUETE 2",
2571
2747
  messages: 200,
2572
2748
  priceLabel: "12$",
2573
- priceNote: "($10 + IVA)",
2574
- priceCaption: "IVA incluido",
2575
- perMessageLabel: "$0.05",
2749
+ priceCaption: "IVA incluído",
2750
+ perMessageLabel: "$0.06",
2576
2751
  highlighted: true,
2577
2752
  badge: "MEJOR VALOR"
2578
2753
  }];
@@ -2649,6 +2824,10 @@ function PackageCard({ pkg, selected, onSelect }) {
2649
2824
  })
2650
2825
  ]
2651
2826
  }),
2827
+ /* @__PURE__ */ jsx("p", {
2828
+ className: cls("emergency-pricing__package-footnote"),
2829
+ children: pricingCopy.footnote
2830
+ }),
2652
2831
  /* @__PURE__ */ jsx("button", {
2653
2832
  type: "button",
2654
2833
  className: cls("emergency-pricing__select"),
@@ -2677,30 +2856,23 @@ function PricingScreen(props) {
2677
2856
  footer: null,
2678
2857
  children: /* @__PURE__ */ jsxs("div", {
2679
2858
  className: cls("emergency-pricing"),
2680
- children: [
2681
- /* @__PURE__ */ jsx("div", {
2682
- className: cls("emergency-pricing__heading"),
2683
- children: /* @__PURE__ */ jsxs("div", {
2684
- className: cls("emergency-pricing__titles"),
2685
- children: [/* @__PURE__ */ jsx("h3", {
2686
- className: cls("emergency-pricing__title"),
2687
- children: pricingCopy.heading
2688
- }), /* @__PURE__ */ jsx("p", {
2689
- className: cls("emergency-pricing__subtitle"),
2690
- children: pricingCopy.subtitle
2691
- })]
2692
- })
2693
- }),
2694
- PRICING_PACKAGES.map((pkg) => /* @__PURE__ */ jsx(PackageCard, {
2695
- pkg,
2696
- selected: selected === pkg.id,
2697
- onSelect: setSelected
2698
- }, pkg.id)),
2699
- /* @__PURE__ */ jsx("p", {
2700
- className: cls("emergency-pricing__footnote"),
2701
- children: pricingCopy.footnote
2859
+ children: [/* @__PURE__ */ jsx("div", {
2860
+ className: cls("emergency-pricing__heading"),
2861
+ children: /* @__PURE__ */ jsxs("div", {
2862
+ className: cls("emergency-pricing__titles"),
2863
+ children: [/* @__PURE__ */ jsx("h3", {
2864
+ className: cls("emergency-pricing__title"),
2865
+ children: pricingCopy.heading
2866
+ }), /* @__PURE__ */ jsx("p", {
2867
+ className: cls("emergency-pricing__subtitle"),
2868
+ children: pricingCopy.subtitle
2869
+ })]
2702
2870
  })
2703
- ]
2871
+ }), PRICING_PACKAGES.map((pkg) => /* @__PURE__ */ jsx(PackageCard, {
2872
+ pkg,
2873
+ selected: selected === pkg.id,
2874
+ onSelect: setSelected
2875
+ }, pkg.id))]
2704
2876
  })
2705
2877
  });
2706
2878
  }
@@ -2709,6 +2881,7 @@ function PricingScreen(props) {
2709
2881
  /** Every screen the panel can render. Add one entry to add a screen. */
2710
2882
  const screenRegistry = {
2711
2883
  primary: PrimaryScreen,
2884
+ "pre-emergency": PreEmergencyScreen,
2712
2885
  pricing: PricingScreen,
2713
2886
  details: DetailsScreen
2714
2887
  };
@@ -2739,7 +2912,7 @@ function ActiveScreen({ screenProps, open, forcePrimary }) {
2739
2912
  return /* @__PURE__ */ jsx(Screen, { ...screenProps });
2740
2913
  }
2741
2914
  function EmergencyPanel(props) {
2742
- const { open, theme, active, busy, aborting, loading, locale, responders, refreshing, geolocationError, activationError, error, abortResult, simulationResult, abortConfirmation, simulationConfirmation, onClose, onActivate, onRefresh, onRetry, onDismissFeedback, onRequestAbort, onRequestSimulation, onCancelAbort, onCancelSimulation, onConfirmAbort, onConfirmSimulation } = props;
2915
+ const { open, theme, active, busy, aborting, loading, locale, responders, refreshing, geolocationError, contactPhone, activationError, error, abortResult, simulationResult, abortConfirmation, simulationConfirmation, onClose, onActivate, onRefresh, onRetry, onDismissFeedback, onRequestAbort, onRequestSimulation, onCancelAbort, onCancelSimulation, onConfirmAbort, onConfirmSimulation, onSetContactPhone } = props;
2743
2916
  const titleId = useId();
2744
2917
  const dialogRef = useRef(null);
2745
2918
  const feedbackVisible = geolocationError !== null || Boolean(activationError) || abortResult !== null || simulationResult !== null;
@@ -2764,13 +2937,15 @@ function EmergencyPanel(props) {
2764
2937
  abortResult,
2765
2938
  simulationResult,
2766
2939
  feedbackVisible,
2940
+ contactPhone,
2767
2941
  onClose,
2768
2942
  onActivate,
2769
2943
  onRefresh,
2770
2944
  onRetry,
2771
2945
  onDismissFeedback,
2772
2946
  onRequestAbort,
2773
- onRequestSimulation
2947
+ onRequestSimulation,
2948
+ onSetContactPhone
2774
2949
  };
2775
2950
  return /* @__PURE__ */ jsxs("div", {
2776
2951
  ref: dialogRef,
@@ -2877,6 +3052,7 @@ function EmergencyRoot() {
2877
3052
  const responders = useEmergencyStore((state) => state.responders);
2878
3053
  const resumeAvailable = useEmergencyStore((state) => state.resumeAvailable);
2879
3054
  const geolocationError = useEmergencyStore((state) => state.geolocationError);
3055
+ const contactPhone = useEmergencyStore((state) => state.contactPhone);
2880
3056
  const lastError = useEmergencyStore((state) => state.lastError);
2881
3057
  const abortResult = useEmergencyStore((state) => state.abortResult);
2882
3058
  const simulationResult = useEmergencyStore((state) => state.simulationResult);
@@ -2902,6 +3078,7 @@ function EmergencyRoot() {
2902
3078
  responders,
2903
3079
  refreshing: phase.kind === "refreshing",
2904
3080
  geolocationError,
3081
+ contactPhone,
2905
3082
  activationError,
2906
3083
  error: showError ? error : null,
2907
3084
  abortResult,
@@ -2928,7 +3105,8 @@ function EmergencyRoot() {
2928
3105
  },
2929
3106
  onConfirmSimulation: () => {
2930
3107
  client.simulate();
2931
- }
3108
+ },
3109
+ onSetContactPhone: (phone) => client.setContactPhone(phone)
2932
3110
  })] });
2933
3111
  }
2934
3112
 
@@ -2960,6 +3138,7 @@ function createFailedClient(error) {
2960
3138
  lastError: error,
2961
3139
  geolocation: null,
2962
3140
  geolocationError: null,
3141
+ contactPhone: null,
2963
3142
  realtimeStatus: "idle",
2964
3143
  abortResult: null,
2965
3144
  simulationResult: null,
@@ -2988,7 +3167,8 @@ function createFailedClient(error) {
2988
3167
  cancelAbortConfirmation: noop,
2989
3168
  requestSimulationConfirmation: noop,
2990
3169
  cancelSimulationConfirmation: noop,
2991
- dismissFeedback: noop
3170
+ dismissFeedback: noop,
3171
+ setContactPhone: noop
2992
3172
  };
2993
3173
  }
2994
3174
  function attachTrigger(trigger, client) {
@@ -3077,6 +3257,7 @@ function mount(options) {
3077
3257
  requestSimulationConfirmation: () => client.requestSimulationConfirmation(),
3078
3258
  cancelSimulationConfirmation: () => client.cancelSimulationConfirmation(),
3079
3259
  dismissFeedback: () => client.dismissFeedback(),
3260
+ setContactPhone: (phone) => client.setContactPhone(phone),
3080
3261
  destroy
3081
3262
  };
3082
3263
  }