@aranova/tracking-react 1.11.0 → 1.12.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
@@ -1082,9 +1082,58 @@ function parseConversionConfig(raw) {
1082
1082
  };
1083
1083
  }
1084
1084
  function parseLeadForms(value) {
1085
- if (!value || typeof value !== "object") return null;
1086
- const version2 = value.registry_version;
1087
- return typeof version2 === "number" ? { registry_version: version2 } : null;
1085
+ if (!isRecord(value) || typeof value.registry_version !== "number") return null;
1086
+ return {
1087
+ registry_version: value.registry_version,
1088
+ contracts: records(value.contracts).flatMap(
1089
+ (c) => typeof c.form_kind === "string" && typeof c.contract_hash === "string" ? [
1090
+ {
1091
+ form_kind: c.form_kind,
1092
+ requires: records(c.requires).flatMap(
1093
+ (r) => typeof r.role === "string" ? [
1094
+ {
1095
+ role: r.role,
1096
+ required_when: parseCondition(r.required_when),
1097
+ waived: r.waived === true
1098
+ }
1099
+ ] : []
1100
+ ),
1101
+ requires_any: records(c.requires_any).map((g) => ({
1102
+ roles: strings(g.roles),
1103
+ waived: g.waived === true
1104
+ })),
1105
+ options: records(c.options).flatMap(
1106
+ (o) => typeof o.role === "string" ? [{ role: o.role, options: records(o.options).flatMap(parseContractOption) }] : []
1107
+ ),
1108
+ contract_hash: c.contract_hash
1109
+ }
1110
+ ] : []
1111
+ )
1112
+ };
1113
+ }
1114
+ function parseCondition(value) {
1115
+ if (!isRecord(value) || typeof value.role !== "string") return null;
1116
+ return { role: value.role, any_of: strings(value.any_of) };
1117
+ }
1118
+ function parseContractOption(value) {
1119
+ if (typeof value.key !== "string" || typeof value.label !== "string") return [];
1120
+ return [
1121
+ {
1122
+ key: value.key,
1123
+ label: value.label,
1124
+ is_non_answer: value.is_non_answer === true,
1125
+ deprecated: value.deprecated === true
1126
+ }
1127
+ ];
1128
+ }
1129
+ function isRecord(value) {
1130
+ return !!value && typeof value === "object" && !Array.isArray(value);
1131
+ }
1132
+ function records(value) {
1133
+ return Array.isArray(value) ? value.filter(isRecord) : [];
1134
+ }
1135
+ function strings(value) {
1136
+ return Array.isArray(value) ? value.filter((v) => typeof v === "string") : [];
1088
1137
  }
1089
1138
  var CACHE_PREFIX = "_aranova_cfg_";
1090
1139
  function cacheKey(url) {
@@ -3980,7 +4029,7 @@ function GoogleAdsTracking(props) {
3980
4029
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
3981
4030
 
3982
4031
  // package.json
3983
- var version = "1.11.0";
4032
+ var version = "1.12.0";
3984
4033
 
3985
4034
  // ../tracking-core/src/phone-react.tsx
3986
4035
  import {