@aranova/tracking-react 1.17.0 → 1.18.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/README.md +16 -0
- package/dist/{bookings-2ZKfenQ7.d.ts → bookings-CCGpXhYE.d.ts} +39 -5
- package/dist/{bookings-DOh1WMhH.d.mts → bookings-CVvpj_8K.d.mts} +39 -5
- package/dist/client.d.mts +4 -4
- package/dist/client.d.ts +4 -4
- package/dist/client.js +260 -186
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +260 -186
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +46 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -33
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-BO6Arbw-.d.mts → ingest-typed-C3XAjHlH.d.ts} +92 -2
- package/dist/{ingest-typed-D7I4aQ7p.d.ts → ingest-typed-CoCjTqJs.d.mts} +92 -2
- package/dist/{phone-utils-CYr6AmEP.d.mts → phone-utils-BlWj8oxq.d.mts} +1 -0
- package/dist/{phone-utils-CYr6AmEP.d.ts → phone-utils-BlWj8oxq.d.ts} +1 -0
- package/dist/phone.d.mts +1 -1
- package/dist/phone.d.ts +1 -1
- package/dist/{sales-I2jXSS-l.d.ts → sales-B1ONR-Yi.d.mts} +1 -1
- package/dist/{sales-B1u_IHLZ.d.mts → sales-Dlc_umAV.d.ts} +1 -1
- package/dist/sales.d.mts +3 -3
- package/dist/sales.d.ts +3 -3
- package/dist/sales.js +39 -33
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +39 -33
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1680,6 +1680,13 @@ var EVENT_SEMANTICS = {
|
|
|
1680
1680
|
outcomeRole: "engagement",
|
|
1681
1681
|
clientVisibility: "detailed"
|
|
1682
1682
|
},
|
|
1683
|
+
// Adds to the submit it names; counting it as a lead would double every lead.
|
|
1684
|
+
form_details: {
|
|
1685
|
+
label: "Form details added",
|
|
1686
|
+
category: "lead",
|
|
1687
|
+
outcomeRole: "engagement",
|
|
1688
|
+
clientVisibility: "detailed"
|
|
1689
|
+
},
|
|
1683
1690
|
form_submit: {
|
|
1684
1691
|
label: "Form submitted",
|
|
1685
1692
|
category: "lead",
|
|
@@ -1738,7 +1745,6 @@ var jsonValueSchema = z2.lazy(
|
|
|
1738
1745
|
])
|
|
1739
1746
|
).register(z2.globalRegistry, { id: "JsonSerializableValue" });
|
|
1740
1747
|
var contractNameSchema = z2.string().check(z2.regex(/^[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?$/));
|
|
1741
|
-
var contractName = contractNameSchema;
|
|
1742
1748
|
var violationRole = z2.string().check(
|
|
1743
1749
|
z2.maxLength(200),
|
|
1744
1750
|
z2.regex(
|
|
@@ -1750,38 +1756,41 @@ var contractViolationSchema = z2.strictObject({
|
|
|
1750
1756
|
role: z2.nullable(violationRole),
|
|
1751
1757
|
rule: z2.string().check(z2.regex(/^[a-z][a-z_]{0,47}$/))
|
|
1752
1758
|
});
|
|
1759
|
+
var formFieldSchema = z2.strictObject({
|
|
1760
|
+
name: z2.string(),
|
|
1761
|
+
type: z2.string(),
|
|
1762
|
+
label: z2.nullable(z2.string()),
|
|
1763
|
+
value: jsonValueSchema,
|
|
1764
|
+
role: z2.optional(z2.nullable(contractNameSchema))
|
|
1765
|
+
});
|
|
1766
|
+
var formExtraSchema = z2.optional(
|
|
1767
|
+
z2.nullable(
|
|
1768
|
+
z2.array(
|
|
1769
|
+
z2.strictObject({
|
|
1770
|
+
key: z2.string().check(z2.maxLength(64)),
|
|
1771
|
+
label: z2.string().check(z2.maxLength(200)),
|
|
1772
|
+
value: jsonValueSchema
|
|
1773
|
+
})
|
|
1774
|
+
).check(z2.maxLength(20))
|
|
1775
|
+
)
|
|
1776
|
+
);
|
|
1777
|
+
var contractVersionSchema = z2.optional(z2.nullable(z2.int().check(z2.gte(1))));
|
|
1778
|
+
var contractHashSchema = z2.optional(z2.nullable(z2.string().check(z2.maxLength(64))));
|
|
1779
|
+
var formContractViolationsSchema = z2.optional(
|
|
1780
|
+
z2.nullable(z2.array(contractViolationSchema).check(z2.maxLength(MAX_CONTRACT_VIOLATIONS)))
|
|
1781
|
+
);
|
|
1753
1782
|
var formSubmitMetadataSchema = z2.strictObject({
|
|
1754
1783
|
form: z2.strictObject({
|
|
1755
1784
|
id: z2.string(),
|
|
1756
1785
|
action: z2.nullable(z2.string()),
|
|
1757
|
-
fields: z2.optional(
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
})
|
|
1766
|
-
)
|
|
1767
|
-
),
|
|
1768
|
-
kind: z2.optional(z2.nullable(contractName)),
|
|
1769
|
-
contract_version: z2.optional(z2.nullable(z2.int().check(z2.gte(1)))),
|
|
1770
|
-
contract_hash: z2.optional(z2.nullable(z2.string().check(z2.maxLength(64)))),
|
|
1771
|
-
extra: z2.optional(
|
|
1772
|
-
z2.nullable(
|
|
1773
|
-
z2.array(
|
|
1774
|
-
z2.strictObject({
|
|
1775
|
-
key: z2.string().check(z2.maxLength(64)),
|
|
1776
|
-
label: z2.string().check(z2.maxLength(200)),
|
|
1777
|
-
value: jsonValueSchema
|
|
1778
|
-
})
|
|
1779
|
-
).check(z2.maxLength(20))
|
|
1780
|
-
)
|
|
1781
|
-
),
|
|
1782
|
-
contract_violations: z2.optional(
|
|
1783
|
-
z2.nullable(z2.array(contractViolationSchema).check(z2.maxLength(MAX_CONTRACT_VIOLATIONS)))
|
|
1784
|
-
)
|
|
1786
|
+
fields: z2.optional(z2.array(formFieldSchema)),
|
|
1787
|
+
kind: z2.optional(z2.nullable(contractNameSchema)),
|
|
1788
|
+
contract_version: contractVersionSchema,
|
|
1789
|
+
contract_hash: contractHashSchema,
|
|
1790
|
+
extra: formExtraSchema,
|
|
1791
|
+
contract_violations: formContractViolationsSchema,
|
|
1792
|
+
// Minted per submit; a later `form_details` names it to add answers to this lead.
|
|
1793
|
+
submission_id: z2.optional(z2.nullable(z2.uuidv4()))
|
|
1785
1794
|
}),
|
|
1786
1795
|
page: z2.strictObject({
|
|
1787
1796
|
path: z2.string()
|
|
@@ -1913,10 +1922,10 @@ var KNOWN_ROLES = new Set(LEAD_FORM_ROLES);
|
|
|
1913
1922
|
var ROLE_ORDER = new Map(LEAD_FORM_ROLES.map((role, index) => [role, index]));
|
|
1914
1923
|
var ADD_ON = /^add_on:[a-z0-9_-]{1,48}$/;
|
|
1915
1924
|
var CONTRACT_NAME = /^[a-z][a-z0-9_]{0,47}(:[a-z0-9_-]{1,48})?$/;
|
|
1916
|
-
function judgeLeadForm(kind, formId, fields, contracts, settings) {
|
|
1925
|
+
function judgeLeadForm(kind, formId, fields, contracts, settings, { partial = false } = {}) {
|
|
1917
1926
|
const generated = contracts?.contracts[kind];
|
|
1918
1927
|
const live = liveContract(settings.trackingConfig, kind);
|
|
1919
|
-
const violations = check(live === void 0 ? generated : fromLive(live), fields);
|
|
1928
|
+
const violations = check(live === void 0 ? generated : fromLive(live), fields, partial);
|
|
1920
1929
|
const liveHash = live === void 0 ? void 0 : live?.contract_hash ?? null;
|
|
1921
1930
|
if (contracts && (liveHash !== void 0 && (generated?.hash ?? null) !== liveHash || contracts.registryVersion !== LEAD_FORM_REGISTRY_VERSION)) {
|
|
1922
1931
|
violations.push({ role: null, rule: "contract_behind" });
|
|
@@ -1948,7 +1957,7 @@ function fromLive(live) {
|
|
|
1948
1957
|
options: Object.fromEntries(live.options.map((o) => [o.role, o.options.map((x) => x.key)]))
|
|
1949
1958
|
};
|
|
1950
1959
|
}
|
|
1951
|
-
function check(contract, fields) {
|
|
1960
|
+
function check(contract, fields, partial) {
|
|
1952
1961
|
const answered = new Map(fields);
|
|
1953
1962
|
const violations = [];
|
|
1954
1963
|
for (const [role, value] of fields) {
|
|
@@ -1966,6 +1975,7 @@ function check(contract, fields) {
|
|
|
1966
1975
|
violations.push({ role, rule: "unknown_option" });
|
|
1967
1976
|
}
|
|
1968
1977
|
}
|
|
1978
|
+
if (partial) return violations;
|
|
1969
1979
|
for (const { role, requiredWhen } of contract?.requires ?? []) {
|
|
1970
1980
|
const owing = requiredWhen === null || optionKeys(answered.get(requiredWhen.role)).some((key) => requiredWhen.anyOf.includes(key));
|
|
1971
1981
|
if (owing && !answered.has(role)) violations.push({ role, rule: "missing_required" });
|
|
@@ -2634,12 +2644,15 @@ var zSmsWithheldReason = z4.enum([
|
|
|
2634
2644
|
"test_or_bot_session",
|
|
2635
2645
|
"invalid_phone",
|
|
2636
2646
|
"recently_texted",
|
|
2647
|
+
"owner_not_alerted",
|
|
2648
|
+
"no_new_details",
|
|
2637
2649
|
"do_not_contact",
|
|
2638
2650
|
"do_not_text_tag",
|
|
2639
2651
|
"missing_value",
|
|
2640
2652
|
"us_texting_pending",
|
|
2641
2653
|
"us_texting_rejected",
|
|
2642
|
-
"texts_paused"
|
|
2654
|
+
"texts_paused",
|
|
2655
|
+
"outside_nanp"
|
|
2643
2656
|
]);
|
|
2644
2657
|
var zSaleSmsStatusSchema = z4.object({
|
|
2645
2658
|
can_send_now: z4._default(z4.boolean(), false),
|