@wealthx/shadcn 1.5.4 → 1.5.5
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/.turbo/turbo-build.log +103 -103
- package/CHANGELOG.md +6 -0
- package/dist/{chunk-G2EWIP2N.mjs → chunk-CKPEFZNH.mjs} +96 -158
- package/dist/components/ui/contact-alert-dialog/index.js +95 -157
- package/dist/components/ui/contact-alert-dialog/index.mjs +1 -1
- package/dist/index.js +95 -157
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/ui/contact-alert-dialog/builder-ui.tsx +25 -19
- package/src/components/ui/contact-alert-dialog/config.ts +47 -112
- package/src/components/ui/contact-alert-dialog/contact-alert-dialog.tsx +10 -2
- package/src/components/ui/contact-alert-dialog/types.ts +8 -4
- package/src/components/ui/contact-alert-dialog/utils.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -13923,46 +13923,38 @@ var AlertSharingType = /* @__PURE__ */ ((AlertSharingType2) => {
|
|
|
13923
13923
|
|
|
13924
13924
|
// src/components/ui/contact-alert-dialog/config.ts
|
|
13925
13925
|
var import_ui = require("@react-awesome-query-builder/ui");
|
|
13926
|
+
var NUMERIC_OPERATORS_DEFAULT = [
|
|
13927
|
+
"equal",
|
|
13928
|
+
"less",
|
|
13929
|
+
"less_or_equal",
|
|
13930
|
+
"greater",
|
|
13931
|
+
"greater_or_equal"
|
|
13932
|
+
];
|
|
13926
13933
|
var ALERT_QUERY_FIELDS = [
|
|
13927
13934
|
{
|
|
13928
13935
|
key: "userMetric.max_loan_amount",
|
|
13929
13936
|
label: "Borrowing Capacity",
|
|
13930
13937
|
type: "number",
|
|
13931
13938
|
unit: "dollar",
|
|
13932
|
-
operators:
|
|
13933
|
-
|
|
13934
|
-
"less",
|
|
13935
|
-
"less_or_equal",
|
|
13936
|
-
"greater",
|
|
13937
|
-
"greater_or_equal",
|
|
13938
|
-
"between"
|
|
13939
|
-
]
|
|
13939
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
13940
|
+
min: 0
|
|
13940
13941
|
},
|
|
13941
13942
|
{
|
|
13942
13943
|
key: "userMetric.debt_outstanding",
|
|
13943
13944
|
label: "Outstanding Debt",
|
|
13944
13945
|
type: "number",
|
|
13945
13946
|
unit: "dollar",
|
|
13946
|
-
operators:
|
|
13947
|
-
|
|
13948
|
-
"less",
|
|
13949
|
-
"less_or_equal",
|
|
13950
|
-
"greater",
|
|
13951
|
-
"greater_or_equal"
|
|
13952
|
-
]
|
|
13947
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
13948
|
+
min: 0
|
|
13953
13949
|
},
|
|
13954
13950
|
{
|
|
13955
13951
|
key: "userMetric.lvr",
|
|
13956
13952
|
label: "Current LVR",
|
|
13957
13953
|
type: "number",
|
|
13958
13954
|
unit: "percent",
|
|
13959
|
-
operators:
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
"less_or_equal",
|
|
13963
|
-
"greater",
|
|
13964
|
-
"greater_or_equal"
|
|
13965
|
-
]
|
|
13955
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
13956
|
+
min: 0,
|
|
13957
|
+
max: 100
|
|
13966
13958
|
},
|
|
13967
13959
|
{
|
|
13968
13960
|
key: "userMetric.has_met_buying_goal",
|
|
@@ -13974,116 +13966,76 @@ var ALERT_QUERY_FIELDS = [
|
|
|
13974
13966
|
label: "Excess Monthly Surplus",
|
|
13975
13967
|
type: "number",
|
|
13976
13968
|
unit: "dollar",
|
|
13977
|
-
operators:
|
|
13978
|
-
|
|
13979
|
-
"less",
|
|
13980
|
-
"less_or_equal",
|
|
13981
|
-
"greater",
|
|
13982
|
-
"greater_or_equal"
|
|
13983
|
-
]
|
|
13969
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
13970
|
+
min: 0
|
|
13984
13971
|
},
|
|
13985
13972
|
{
|
|
13986
13973
|
key: "userMetric.equity",
|
|
13987
13974
|
label: "Equity Amount",
|
|
13988
13975
|
type: "number",
|
|
13989
13976
|
unit: "dollar",
|
|
13990
|
-
operators:
|
|
13991
|
-
|
|
13992
|
-
"less",
|
|
13993
|
-
"less_or_equal",
|
|
13994
|
-
"greater",
|
|
13995
|
-
"greater_or_equal"
|
|
13996
|
-
]
|
|
13977
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
13978
|
+
min: 0
|
|
13997
13979
|
},
|
|
13998
13980
|
{
|
|
13999
13981
|
key: "userMetric.max_debt_interest_rate",
|
|
14000
13982
|
label: "Max Debt Interest Rate",
|
|
14001
13983
|
type: "number",
|
|
14002
13984
|
unit: "percent",
|
|
14003
|
-
operators:
|
|
14004
|
-
|
|
14005
|
-
|
|
14006
|
-
"less_or_equal",
|
|
14007
|
-
"greater",
|
|
14008
|
-
"greater_or_equal"
|
|
14009
|
-
]
|
|
13985
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
13986
|
+
min: 0,
|
|
13987
|
+
max: 100
|
|
14010
13988
|
},
|
|
14011
13989
|
{
|
|
14012
13990
|
key: "userMetric.min_debt_interest_rate",
|
|
14013
13991
|
label: "Min Debt Interest Rate",
|
|
14014
13992
|
type: "number",
|
|
14015
13993
|
unit: "percent",
|
|
14016
|
-
operators:
|
|
14017
|
-
|
|
14018
|
-
|
|
14019
|
-
"less_or_equal",
|
|
14020
|
-
"greater",
|
|
14021
|
-
"greater_or_equal"
|
|
14022
|
-
]
|
|
13994
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
13995
|
+
min: 0,
|
|
13996
|
+
max: 100
|
|
14023
13997
|
}
|
|
14024
13998
|
];
|
|
14025
|
-
var ALL_NUMERIC_OPERATORS =
|
|
14026
|
-
"equal",
|
|
14027
|
-
"not_equal",
|
|
14028
|
-
"less",
|
|
14029
|
-
"less_or_equal",
|
|
14030
|
-
"greater",
|
|
14031
|
-
"greater_or_equal",
|
|
14032
|
-
"between"
|
|
14033
|
-
];
|
|
13999
|
+
var ALL_NUMERIC_OPERATORS = NUMERIC_OPERATORS_DEFAULT;
|
|
14034
14000
|
var BOOLEAN_OPERATORS = ["equal"];
|
|
14035
14001
|
var OPERATOR_LABELS = {
|
|
14036
14002
|
equal: "=",
|
|
14037
|
-
not_equal: "\u2260",
|
|
14038
14003
|
less: "<",
|
|
14039
14004
|
less_or_equal: "\u2264",
|
|
14040
14005
|
greater: ">",
|
|
14041
|
-
greater_or_equal: "\u2265"
|
|
14042
|
-
between: "between"
|
|
14006
|
+
greater_or_equal: "\u2265"
|
|
14043
14007
|
};
|
|
14044
14008
|
var SEVERITY_LABELS = {
|
|
14045
|
-
|
|
14009
|
+
HEALTHY: "Healthy",
|
|
14046
14010
|
WATCH: "Watch",
|
|
14047
14011
|
NEED_ACTION: "Need Action"
|
|
14048
14012
|
};
|
|
14049
14013
|
var QB_CONFIG = __spreadProps(__spreadValues({}, import_ui.BasicConfig), {
|
|
14014
|
+
settings: __spreadProps(__spreadValues({}, import_ui.BasicConfig.settings), {
|
|
14015
|
+
maxNesting: 3,
|
|
14016
|
+
maxNumberOfRules: 5
|
|
14017
|
+
}),
|
|
14050
14018
|
fields: {
|
|
14051
14019
|
"userMetric.max_loan_amount": {
|
|
14052
14020
|
label: "Borrowing Capacity",
|
|
14053
14021
|
type: "number",
|
|
14054
|
-
operators:
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
"less_or_equal",
|
|
14058
|
-
"greater",
|
|
14059
|
-
"greater_or_equal",
|
|
14060
|
-
"between"
|
|
14061
|
-
],
|
|
14062
|
-
valueSources: ["value"]
|
|
14022
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
14023
|
+
valueSources: ["value"],
|
|
14024
|
+
fieldSettings: { min: 0 }
|
|
14063
14025
|
},
|
|
14064
14026
|
"userMetric.debt_outstanding": {
|
|
14065
14027
|
label: "Outstanding Debt",
|
|
14066
14028
|
type: "number",
|
|
14067
|
-
operators:
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
"less_or_equal",
|
|
14071
|
-
"greater",
|
|
14072
|
-
"greater_or_equal"
|
|
14073
|
-
],
|
|
14074
|
-
valueSources: ["value"]
|
|
14029
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
14030
|
+
valueSources: ["value"],
|
|
14031
|
+
fieldSettings: { min: 0 }
|
|
14075
14032
|
},
|
|
14076
14033
|
"userMetric.lvr": {
|
|
14077
14034
|
label: "Current LVR",
|
|
14078
14035
|
type: "number",
|
|
14079
|
-
operators:
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
"less_or_equal",
|
|
14083
|
-
"greater",
|
|
14084
|
-
"greater_or_equal"
|
|
14085
|
-
],
|
|
14086
|
-
valueSources: ["value"]
|
|
14036
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
14037
|
+
valueSources: ["value"],
|
|
14038
|
+
fieldSettings: { min: 0, max: 100 }
|
|
14087
14039
|
},
|
|
14088
14040
|
"userMetric.has_met_buying_goal": {
|
|
14089
14041
|
label: "Has Met Buying Goal",
|
|
@@ -14094,50 +14046,30 @@ var QB_CONFIG = __spreadProps(__spreadValues({}, import_ui.BasicConfig), {
|
|
|
14094
14046
|
"userMetric.excess_monthly_surplus": {
|
|
14095
14047
|
label: "Excess Monthly Surplus",
|
|
14096
14048
|
type: "number",
|
|
14097
|
-
operators:
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
"less_or_equal",
|
|
14101
|
-
"greater",
|
|
14102
|
-
"greater_or_equal"
|
|
14103
|
-
],
|
|
14104
|
-
valueSources: ["value"]
|
|
14049
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
14050
|
+
valueSources: ["value"],
|
|
14051
|
+
fieldSettings: { min: 0 }
|
|
14105
14052
|
},
|
|
14106
14053
|
"userMetric.equity": {
|
|
14107
14054
|
label: "Equity Amount",
|
|
14108
14055
|
type: "number",
|
|
14109
|
-
operators:
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
"less_or_equal",
|
|
14113
|
-
"greater",
|
|
14114
|
-
"greater_or_equal"
|
|
14115
|
-
],
|
|
14116
|
-
valueSources: ["value"]
|
|
14056
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
14057
|
+
valueSources: ["value"],
|
|
14058
|
+
fieldSettings: { min: 0 }
|
|
14117
14059
|
},
|
|
14118
14060
|
"userMetric.max_debt_interest_rate": {
|
|
14119
14061
|
label: "Max Debt Interest Rate",
|
|
14120
14062
|
type: "number",
|
|
14121
|
-
operators:
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
"less_or_equal",
|
|
14125
|
-
"greater",
|
|
14126
|
-
"greater_or_equal"
|
|
14127
|
-
],
|
|
14128
|
-
valueSources: ["value"]
|
|
14063
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
14064
|
+
valueSources: ["value"],
|
|
14065
|
+
fieldSettings: { min: 0, max: 100 }
|
|
14129
14066
|
},
|
|
14130
14067
|
"userMetric.min_debt_interest_rate": {
|
|
14131
14068
|
label: "Min Debt Interest Rate",
|
|
14132
14069
|
type: "number",
|
|
14133
|
-
operators:
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
"less_or_equal",
|
|
14137
|
-
"greater",
|
|
14138
|
-
"greater_or_equal"
|
|
14139
|
-
],
|
|
14140
|
-
valueSources: ["value"]
|
|
14070
|
+
operators: NUMERIC_OPERATORS_DEFAULT,
|
|
14071
|
+
valueSources: ["value"],
|
|
14072
|
+
fieldSettings: { min: 0, max: 100 }
|
|
14141
14073
|
}
|
|
14142
14074
|
}
|
|
14143
14075
|
});
|
|
@@ -14188,14 +14120,13 @@ function parseCommas(display) {
|
|
|
14188
14120
|
return display.replace(/[^\d.]/g, "").replace(/(\..*)\./g, "$1");
|
|
14189
14121
|
}
|
|
14190
14122
|
function ruleSummary(ruleProps, fields) {
|
|
14191
|
-
var _a, _b, _c, _d, _e
|
|
14123
|
+
var _a, _b, _c, _d, _e;
|
|
14192
14124
|
const field = (_a = ruleProps == null ? void 0 : ruleProps.field) != null ? _a : "";
|
|
14193
14125
|
const operator = (_b = ruleProps == null ? void 0 : ruleProps.operator) != null ? _b : "equal";
|
|
14194
14126
|
const value0 = (_c = ruleProps == null ? void 0 : ruleProps.value) == null ? void 0 : _c[0];
|
|
14195
|
-
const value1 = (_d = ruleProps == null ? void 0 : ruleProps.value) == null ? void 0 : _d[1];
|
|
14196
14127
|
const fieldDef = fields.find((f) => f.key === field);
|
|
14197
|
-
const fieldLabel = (
|
|
14198
|
-
const opLabel = (
|
|
14128
|
+
const fieldLabel = (_d = fieldDef == null ? void 0 : fieldDef.label) != null ? _d : field;
|
|
14129
|
+
const opLabel = (_e = OPERATOR_LABELS[operator]) != null ? _e : operator;
|
|
14199
14130
|
const formatVal = (v) => {
|
|
14200
14131
|
if (v === null || v === void 0) return "\u2026";
|
|
14201
14132
|
if ((fieldDef == null ? void 0 : fieldDef.type) === "boolean") return v ? "Yes" : "No";
|
|
@@ -14206,9 +14137,6 @@ function ruleSummary(ruleProps, fields) {
|
|
|
14206
14137
|
if ((fieldDef == null ? void 0 : fieldDef.unit) === "percent") return `${n}%`;
|
|
14207
14138
|
return String(v);
|
|
14208
14139
|
};
|
|
14209
|
-
if (operator === "between") {
|
|
14210
|
-
return `${fieldLabel} between ${formatVal(value0)} and ${formatVal(value1)}`;
|
|
14211
|
-
}
|
|
14212
14140
|
return `${fieldLabel} ${opLabel} ${formatVal(value0)}`;
|
|
14213
14141
|
}
|
|
14214
14142
|
function checkGroupValid(children) {
|
|
@@ -14427,8 +14355,22 @@ function ValueInput({
|
|
|
14427
14355
|
value,
|
|
14428
14356
|
onChange,
|
|
14429
14357
|
unit,
|
|
14358
|
+
min,
|
|
14359
|
+
max,
|
|
14430
14360
|
placeholder = "0"
|
|
14431
14361
|
}) {
|
|
14362
|
+
function handleChange(raw) {
|
|
14363
|
+
const parsed = parseCommas(raw);
|
|
14364
|
+
if (parsed === "") {
|
|
14365
|
+
onChange("");
|
|
14366
|
+
return;
|
|
14367
|
+
}
|
|
14368
|
+
const n = parseFloat(parsed);
|
|
14369
|
+
if (Number.isNaN(n)) return;
|
|
14370
|
+
if (min !== void 0 && n < min) return;
|
|
14371
|
+
if (max !== void 0 && n > max) return;
|
|
14372
|
+
onChange(parsed);
|
|
14373
|
+
}
|
|
14432
14374
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(InputGroup, { className: "w-36", children: [
|
|
14433
14375
|
unit === "dollar" && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(InputGroupAddon, { align: "inline-start", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(InputGroupText, { children: "$" }) }),
|
|
14434
14376
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
@@ -14437,7 +14379,7 @@ function ValueInput({
|
|
|
14437
14379
|
type: "text",
|
|
14438
14380
|
inputMode: "numeric",
|
|
14439
14381
|
value: formatWithCommas(value),
|
|
14440
|
-
onChange: (e) =>
|
|
14382
|
+
onChange: (e) => handleChange(e.target.value),
|
|
14441
14383
|
placeholder
|
|
14442
14384
|
}
|
|
14443
14385
|
),
|
|
@@ -14452,14 +14394,13 @@ function RuleEditorFields({
|
|
|
14452
14394
|
longestFieldLabel,
|
|
14453
14395
|
longestOperatorLabel
|
|
14454
14396
|
}) {
|
|
14455
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
14397
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14456
14398
|
const field = (_c = (_b = ruleProps == null ? void 0 : ruleProps.field) != null ? _b : (_a = fields[0]) == null ? void 0 : _a.key) != null ? _c : "";
|
|
14457
14399
|
const operator = (_d = ruleProps == null ? void 0 : ruleProps.operator) != null ? _d : "greater_or_equal";
|
|
14458
14400
|
const value0 = (_e = ruleProps == null ? void 0 : ruleProps.value) == null ? void 0 : _e[0];
|
|
14459
|
-
const
|
|
14460
|
-
const fieldDef = (_g = fields.find((f) => f.key === field)) != null ? _g : fields[0];
|
|
14401
|
+
const fieldDef = (_f = fields.find((f) => f.key === field)) != null ? _f : fields[0];
|
|
14461
14402
|
const isBooleanField = (fieldDef == null ? void 0 : fieldDef.type) === "boolean";
|
|
14462
|
-
const availableOperators = isBooleanField ? BOOLEAN_OPERATORS : (
|
|
14403
|
+
const availableOperators = isBooleanField ? BOOLEAN_OPERATORS : (_g = fieldDef == null ? void 0 : fieldDef.operators) != null ? _g : ALL_NUMERIC_OPERATORS;
|
|
14463
14404
|
function handleFieldChange(key) {
|
|
14464
14405
|
actions.setField(path, key);
|
|
14465
14406
|
}
|
|
@@ -14488,7 +14429,7 @@ function RuleEditorFields({
|
|
|
14488
14429
|
value: field,
|
|
14489
14430
|
onValueChange: (v) => handleFieldChange(v),
|
|
14490
14431
|
children: [
|
|
14491
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectTrigger, { size: "sm", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectValue, { children: (
|
|
14432
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectTrigger, { size: "sm", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectValue, { children: (_i = (_h = fields.find((f) => f.key === field)) == null ? void 0 : _h.label) != null ? _i : field }) }),
|
|
14492
14433
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectContent, { children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectItem, { value: f.key, children: f.label }, f.key)) })
|
|
14493
14434
|
]
|
|
14494
14435
|
}
|
|
@@ -14499,7 +14440,7 @@ function RuleEditorFields({
|
|
|
14499
14440
|
value: operator,
|
|
14500
14441
|
onValueChange: (v) => handleOperatorChange(v),
|
|
14501
14442
|
children: [
|
|
14502
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectTrigger, { size: "sm", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectValue, { children: (
|
|
14443
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectTrigger, { size: "sm", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectValue, { children: (_j = OPERATOR_LABELS[operator]) != null ? _j : operator }) }),
|
|
14503
14444
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectContent, { children: availableOperators.map((op) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(SelectItem, { value: op, children: OPERATOR_LABELS[op] }, op)) })
|
|
14504
14445
|
]
|
|
14505
14446
|
}
|
|
@@ -14517,27 +14458,16 @@ function RuleEditorFields({
|
|
|
14517
14458
|
] })
|
|
14518
14459
|
]
|
|
14519
14460
|
}
|
|
14520
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime76.
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "text-xs text-muted-foreground", children: "and" }),
|
|
14531
|
-
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14532
|
-
ValueInput,
|
|
14533
|
-
{
|
|
14534
|
-
value: valStr(value1),
|
|
14535
|
-
onChange: (v) => handleValueChange(1, v),
|
|
14536
|
-
unit: fieldDef == null ? void 0 : fieldDef.unit
|
|
14537
|
-
}
|
|
14538
|
-
)
|
|
14539
|
-
] })
|
|
14540
|
-
] })
|
|
14461
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
14462
|
+
ValueInput,
|
|
14463
|
+
{
|
|
14464
|
+
value: valStr(value0),
|
|
14465
|
+
onChange: (v) => handleValueChange(0, v),
|
|
14466
|
+
unit: fieldDef == null ? void 0 : fieldDef.unit,
|
|
14467
|
+
min: fieldDef == null ? void 0 : fieldDef.min,
|
|
14468
|
+
max: fieldDef == null ? void 0 : fieldDef.max
|
|
14469
|
+
}
|
|
14470
|
+
)
|
|
14541
14471
|
] });
|
|
14542
14472
|
}
|
|
14543
14473
|
function RuleAccordionItem({
|
|
@@ -14879,6 +14809,7 @@ function ContactAlertDialog({
|
|
|
14879
14809
|
isCompanyAdmin = false,
|
|
14880
14810
|
initialShareAcrossCompany = false,
|
|
14881
14811
|
onSave,
|
|
14812
|
+
onError,
|
|
14882
14813
|
isLoading = false,
|
|
14883
14814
|
className
|
|
14884
14815
|
}) {
|
|
@@ -14902,10 +14833,17 @@ function ContactAlertDialog({
|
|
|
14902
14833
|
const canSave = name.trim().length > 0 && hasValidRule && !isLoading;
|
|
14903
14834
|
function handleSave() {
|
|
14904
14835
|
if (!canSave) return;
|
|
14836
|
+
let filterSegment;
|
|
14837
|
+
try {
|
|
14838
|
+
filterSegment = import_ui4.Utils.sanitizeTree(tree, QB_CONFIG).fixedTree;
|
|
14839
|
+
} catch (e) {
|
|
14840
|
+
onError == null ? void 0 : onError(e instanceof Error ? e : new Error(String(e)));
|
|
14841
|
+
return;
|
|
14842
|
+
}
|
|
14905
14843
|
onSave({
|
|
14906
14844
|
name: name.trim(),
|
|
14907
14845
|
severity,
|
|
14908
|
-
filterSegment
|
|
14846
|
+
filterSegment,
|
|
14909
14847
|
sharingType: shareAcrossCompany ? "COMPANY" /* COMPANY */ : "PRIVATE" /* PRIVATE */
|
|
14910
14848
|
});
|
|
14911
14849
|
}
|
|
@@ -14921,7 +14859,7 @@ function ContactAlertDialog({
|
|
|
14921
14859
|
size: "sm",
|
|
14922
14860
|
value: severity,
|
|
14923
14861
|
onValueChange: (v) => v && setSeverity(v),
|
|
14924
|
-
children: ["NEED_ACTION", "WATCH", "
|
|
14862
|
+
children: ["NEED_ACTION", "WATCH", "HEALTHY"].map((s) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToggleGroupItem, { value: s, children: SEVERITY_LABELS[s] }, s))
|
|
14925
14863
|
}
|
|
14926
14864
|
)
|
|
14927
14865
|
] }),
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -70,13 +70,30 @@ function ValueInput({
|
|
|
70
70
|
value,
|
|
71
71
|
onChange,
|
|
72
72
|
unit,
|
|
73
|
+
min,
|
|
74
|
+
max,
|
|
73
75
|
placeholder = "0",
|
|
74
76
|
}: {
|
|
75
77
|
value: string;
|
|
76
78
|
onChange: (v: string) => void;
|
|
77
79
|
unit?: "dollar" | "percent";
|
|
80
|
+
min?: number;
|
|
81
|
+
max?: number;
|
|
78
82
|
placeholder?: string;
|
|
79
83
|
}) {
|
|
84
|
+
function handleChange(raw: string) {
|
|
85
|
+
const parsed = parseCommas(raw);
|
|
86
|
+
if (parsed === "") {
|
|
87
|
+
onChange("");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const n = parseFloat(parsed);
|
|
91
|
+
if (Number.isNaN(n)) return;
|
|
92
|
+
if (min !== undefined && n < min) return;
|
|
93
|
+
if (max !== undefined && n > max) return;
|
|
94
|
+
onChange(parsed);
|
|
95
|
+
}
|
|
96
|
+
|
|
80
97
|
return (
|
|
81
98
|
<InputGroup className="w-36">
|
|
82
99
|
{unit === "dollar" && (
|
|
@@ -88,7 +105,7 @@ function ValueInput({
|
|
|
88
105
|
type="text"
|
|
89
106
|
inputMode="numeric"
|
|
90
107
|
value={formatWithCommas(value)}
|
|
91
|
-
onChange={(e) =>
|
|
108
|
+
onChange={(e) => handleChange(e.target.value)}
|
|
92
109
|
placeholder={placeholder}
|
|
93
110
|
/>
|
|
94
111
|
{unit === "percent" && (
|
|
@@ -123,7 +140,6 @@ function RuleEditorFields({
|
|
|
123
140
|
const field: string = ruleProps?.field ?? fields[0]?.key ?? "";
|
|
124
141
|
const operator: string = ruleProps?.operator ?? "greater_or_equal";
|
|
125
142
|
const value0 = ruleProps?.value?.[0];
|
|
126
|
-
const value1 = ruleProps?.value?.[1];
|
|
127
143
|
|
|
128
144
|
const fieldDef = fields.find((f) => f.key === field) ?? fields[0];
|
|
129
145
|
const isBooleanField = fieldDef?.type === "boolean";
|
|
@@ -217,23 +233,13 @@ function RuleEditorFields({
|
|
|
217
233
|
</SelectContent>
|
|
218
234
|
</Select>
|
|
219
235
|
) : (
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<>
|
|
228
|
-
<span className="text-xs text-muted-foreground">and</span>
|
|
229
|
-
<ValueInput
|
|
230
|
-
value={valStr(value1)}
|
|
231
|
-
onChange={(v) => handleValueChange(1, v)}
|
|
232
|
-
unit={fieldDef?.unit}
|
|
233
|
-
/>
|
|
234
|
-
</>
|
|
235
|
-
)}
|
|
236
|
-
</>
|
|
236
|
+
<ValueInput
|
|
237
|
+
value={valStr(value0)}
|
|
238
|
+
onChange={(v) => handleValueChange(0, v)}
|
|
239
|
+
unit={fieldDef?.unit}
|
|
240
|
+
min={fieldDef?.min}
|
|
241
|
+
max={fieldDef?.max}
|
|
242
|
+
/>
|
|
237
243
|
)}
|
|
238
244
|
</div>
|
|
239
245
|
);
|