@aranova/tracking-react 1.3.0 → 1.4.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/client.mjs CHANGED
@@ -928,6 +928,10 @@ function fireConversionWithConsent(input, options) {
928
928
  }
929
929
 
930
930
  // ../tracking-core/src/resources/conversion-config.ts
931
+ var BOOKING_MODES = ["live", "test", "simulated"];
932
+ function isBookingMode(value) {
933
+ return BOOKING_MODES.includes(value);
934
+ }
931
935
  function isStringMap(value) {
932
936
  return typeof value === "object" && value !== null && Object.values(value).every((v) => typeof v === "string");
933
937
  }
@@ -999,7 +1003,8 @@ function parseIntegrations(value) {
999
1003
  config_version: typeof b.config_version === "number" ? b.config_version : null,
1000
1004
  accepts_bookings: b.accepts_bookings === true,
1001
1005
  rules: parseBookingRules(b.rules),
1002
- options: Array.isArray(b.options) ? b.options.flatMap(parseBookingOption) : []
1006
+ options: Array.isArray(b.options) ? b.options.flatMap(parseBookingOption) : [],
1007
+ ...isBookingMode(b.mode) ? { mode: b.mode } : {}
1003
1008
  }
1004
1009
  }
1005
1010
  };
@@ -1683,7 +1688,8 @@ function getBookingIntegration(integrations) {
1683
1688
  timezone: booking.timezone,
1684
1689
  configVersion: booking.config_version,
1685
1690
  rules,
1686
- options: booking.options.map((option) => ({ key: option.key, label: option.label }))
1691
+ options: booking.options.map((option) => ({ key: option.key, label: option.label })),
1692
+ mode: booking.mode ?? "live"
1687
1693
  };
1688
1694
  }
1689
1695
  function camelRules(rules) {
@@ -3916,7 +3922,7 @@ function GoogleAdsTracking(props) {
3916
3922
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
3917
3923
 
3918
3924
  // package.json
3919
- var version = "1.3.0";
3925
+ var version = "1.4.0";
3920
3926
 
3921
3927
  // ../tracking-core/src/phone-react.tsx
3922
3928
  import {
@@ -4240,13 +4246,13 @@ function useBookingSubmit(bookings, options = {}) {
4240
4246
  const [submitting, setSubmitting] = useState4(false);
4241
4247
  const attemptKey = useRef(null);
4242
4248
  const inFlight = useRef(null);
4243
- const { formSubmit } = options;
4249
+ const { formSubmit, simulate } = options;
4244
4250
  const submit = useCallback3(
4245
4251
  (input) => {
4246
4252
  if (inFlight.current) return inFlight.current;
4247
4253
  attemptKey.current ?? (attemptKey.current = newBookingAttemptKey());
4248
4254
  setSubmitting(true);
4249
- const run = bookings.submit(input, { attemptKey: attemptKey.current, formSubmit }).then((result) => {
4255
+ const run = bookings.submit(input, { attemptKey: attemptKey.current, formSubmit, simulate }).then((result) => {
4250
4256
  const unrecorded = result.status === "invalid" || result.status === "stale" || result.status === "failed" && result.id === null;
4251
4257
  if (!unrecorded) attemptKey.current = null;
4252
4258
  setOutcome(result);
@@ -4258,7 +4264,7 @@ function useBookingSubmit(bookings, options = {}) {
4258
4264
  inFlight.current = run;
4259
4265
  return run;
4260
4266
  },
4261
- [bookings, formSubmit]
4267
+ [bookings, formSubmit, simulate]
4262
4268
  );
4263
4269
  const reset = useCallback3(() => {
4264
4270
  attemptKey.current = null;