@embedreach/components 0.2.0 → 0.2.1
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/chunks/index.js +2075 -2123
- package/dist/index.umd.js +22 -22
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -77367,1045 +77367,142 @@ const AutomationsEditorHeader = ({ showBackButton, onDuplicationCreated, onBefor
|
|
|
77367
77367
|
)
|
|
77368
77368
|
] });
|
|
77369
77369
|
};
|
|
77370
|
-
|
|
77371
|
-
|
|
77372
|
-
|
|
77373
|
-
|
|
77374
|
-
|
|
77375
|
-
|
|
77376
|
-
|
|
77377
|
-
|
|
77378
|
-
|
|
77379
|
-
|
|
77380
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
77381
|
-
const BaseContext2 = React.createContext(defaultContext);
|
|
77382
|
-
const index2 = defaultContexts.length;
|
|
77383
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
77384
|
-
const Provider2 = (props2) => {
|
|
77385
|
-
const { scope, children: children2, ...context2 } = props2;
|
|
77386
|
-
const Context2 = scope?.[scopeName]?.[index2] || BaseContext2;
|
|
77387
|
-
const value = React.useMemo(() => context2, Object.values(context2));
|
|
77388
|
-
return /* @__PURE__ */ jsx(Context2.Provider, { value, children: children2 });
|
|
77389
|
-
};
|
|
77390
|
-
Provider2.displayName = rootComponentName + "Provider";
|
|
77391
|
-
function useContext2(consumerName, scope) {
|
|
77392
|
-
const Context2 = scope?.[scopeName]?.[index2] || BaseContext2;
|
|
77393
|
-
const context2 = React.useContext(Context2);
|
|
77394
|
-
if (context2) return context2;
|
|
77395
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
77396
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
77397
|
-
}
|
|
77398
|
-
return [Provider2, useContext2];
|
|
77399
|
-
}
|
|
77400
|
-
const createScope = () => {
|
|
77401
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
77402
|
-
return React.createContext(defaultContext);
|
|
77403
|
-
});
|
|
77404
|
-
return function useScope(scope) {
|
|
77405
|
-
const contexts = scope?.[scopeName] || scopeContexts;
|
|
77406
|
-
return React.useMemo(
|
|
77407
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
77408
|
-
[scope, contexts]
|
|
77409
|
-
);
|
|
77410
|
-
};
|
|
77411
|
-
};
|
|
77412
|
-
createScope.scopeName = scopeName;
|
|
77413
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
77414
|
-
}
|
|
77415
|
-
function composeContextScopes(...scopes) {
|
|
77416
|
-
const baseScope = scopes[0];
|
|
77417
|
-
if (scopes.length === 1) return baseScope;
|
|
77418
|
-
const createScope = () => {
|
|
77419
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
77420
|
-
useScope: createScope2(),
|
|
77421
|
-
scopeName: createScope2.scopeName
|
|
77422
|
-
}));
|
|
77423
|
-
return function useComposedScopes(overrideScopes) {
|
|
77424
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
77425
|
-
const scopeProps = useScope(overrideScopes);
|
|
77426
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
77427
|
-
return { ...nextScopes2, ...currentScope };
|
|
77428
|
-
}, {});
|
|
77429
|
-
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
77430
|
-
};
|
|
77431
|
-
};
|
|
77432
|
-
createScope.scopeName = baseScope.scopeName;
|
|
77433
|
-
return createScope;
|
|
77434
|
-
}
|
|
77435
|
-
function setRef(ref, value) {
|
|
77436
|
-
if (typeof ref === "function") {
|
|
77437
|
-
return ref(value);
|
|
77438
|
-
} else if (ref !== null && ref !== void 0) {
|
|
77439
|
-
ref.current = value;
|
|
77440
|
-
}
|
|
77441
|
-
}
|
|
77442
|
-
function composeRefs(...refs) {
|
|
77443
|
-
return (node) => {
|
|
77444
|
-
let hasCleanup = false;
|
|
77445
|
-
const cleanups = refs.map((ref) => {
|
|
77446
|
-
const cleanup = setRef(ref, node);
|
|
77447
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
77448
|
-
hasCleanup = true;
|
|
77449
|
-
}
|
|
77450
|
-
return cleanup;
|
|
77451
|
-
});
|
|
77452
|
-
if (hasCleanup) {
|
|
77453
|
-
return () => {
|
|
77454
|
-
for (let i3 = 0; i3 < cleanups.length; i3++) {
|
|
77455
|
-
const cleanup = cleanups[i3];
|
|
77456
|
-
if (typeof cleanup == "function") {
|
|
77457
|
-
cleanup();
|
|
77458
|
-
} else {
|
|
77459
|
-
setRef(refs[i3], null);
|
|
77460
|
-
}
|
|
77461
|
-
}
|
|
77462
|
-
};
|
|
77463
|
-
}
|
|
77464
|
-
};
|
|
77465
|
-
}
|
|
77466
|
-
function useComposedRefs(...refs) {
|
|
77467
|
-
return React.useCallback(composeRefs(...refs), refs);
|
|
77468
|
-
}
|
|
77469
|
-
// @__NO_SIDE_EFFECTS__
|
|
77470
|
-
function createSlot(ownerName) {
|
|
77471
|
-
const SlotClone2 = /* @__PURE__ */ createSlotClone(ownerName);
|
|
77472
|
-
const Slot2 = React.forwardRef((props2, forwardedRef) => {
|
|
77473
|
-
const { children: children2, ...slotProps } = props2;
|
|
77474
|
-
const childrenArray = React.Children.toArray(children2);
|
|
77475
|
-
const slottable = childrenArray.find(isSlottable);
|
|
77476
|
-
if (slottable) {
|
|
77477
|
-
const newElement = slottable.props.children;
|
|
77478
|
-
const newChildren = childrenArray.map((child) => {
|
|
77479
|
-
if (child === slottable) {
|
|
77480
|
-
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
77481
|
-
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
77482
|
-
} else {
|
|
77483
|
-
return child;
|
|
77484
|
-
}
|
|
77485
|
-
});
|
|
77486
|
-
return /* @__PURE__ */ jsx(SlotClone2, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
77487
|
-
}
|
|
77488
|
-
return /* @__PURE__ */ jsx(SlotClone2, { ...slotProps, ref: forwardedRef, children: children2 });
|
|
77489
|
-
});
|
|
77490
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
77491
|
-
return Slot2;
|
|
77492
|
-
}
|
|
77493
|
-
// @__NO_SIDE_EFFECTS__
|
|
77494
|
-
function createSlotClone(ownerName) {
|
|
77495
|
-
const SlotClone2 = React.forwardRef((props2, forwardedRef) => {
|
|
77496
|
-
const { children: children2, ...slotProps } = props2;
|
|
77497
|
-
if (React.isValidElement(children2)) {
|
|
77498
|
-
const childrenRef = getElementRef$1(children2);
|
|
77499
|
-
const props22 = mergeProps(slotProps, children2.props);
|
|
77500
|
-
if (children2.type !== React.Fragment) {
|
|
77501
|
-
props22.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
77370
|
+
const AutomationsEditorStatsTab = () => {
|
|
77371
|
+
const automation2 = useAutomation();
|
|
77372
|
+
const { isLoading: isStatisticsLoading } = useGetBusinessAutomationStatistics(
|
|
77373
|
+
automation2?.id
|
|
77374
|
+
);
|
|
77375
|
+
if (!automation2 || isStatisticsLoading) {
|
|
77376
|
+
return /* @__PURE__ */ jsx(
|
|
77377
|
+
BasicLoader,
|
|
77378
|
+
{
|
|
77379
|
+
text: [`Fetching ${t$1("engage:insight", { count: 2 })}`, "Finishing up"]
|
|
77502
77380
|
}
|
|
77503
|
-
|
|
77381
|
+
);
|
|
77382
|
+
}
|
|
77383
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(
|
|
77384
|
+
AutomationStatistics,
|
|
77385
|
+
{
|
|
77386
|
+
automationId: automation2.id,
|
|
77387
|
+
automation: automation2,
|
|
77388
|
+
includeSales: true
|
|
77504
77389
|
}
|
|
77505
|
-
|
|
77506
|
-
|
|
77507
|
-
|
|
77508
|
-
|
|
77509
|
-
|
|
77510
|
-
|
|
77511
|
-
|
|
77512
|
-
|
|
77513
|
-
}
|
|
77514
|
-
|
|
77515
|
-
|
|
77516
|
-
|
|
77517
|
-
|
|
77518
|
-
|
|
77519
|
-
|
|
77520
|
-
|
|
77521
|
-
|
|
77522
|
-
|
|
77523
|
-
|
|
77524
|
-
slotPropValue(...args);
|
|
77525
|
-
};
|
|
77526
|
-
} else if (slotPropValue) {
|
|
77527
|
-
overrideProps[propName] = slotPropValue;
|
|
77390
|
+
) });
|
|
77391
|
+
};
|
|
77392
|
+
const AutomationsEditorRecipientsTab = () => {
|
|
77393
|
+
const automation2 = useAutomation();
|
|
77394
|
+
const {
|
|
77395
|
+
recipients,
|
|
77396
|
+
isLoading: isLoadingRecipients,
|
|
77397
|
+
fetchError
|
|
77398
|
+
} = useGetBusinessAutomationRecipients(automation2?.id ?? "");
|
|
77399
|
+
const columns = [
|
|
77400
|
+
{
|
|
77401
|
+
accessorFn: (row) => `${row.firstName || ""} ${row.lastName || ""}`.trim(),
|
|
77402
|
+
id: "name",
|
|
77403
|
+
header: "Name",
|
|
77404
|
+
cell: ({ row }) => {
|
|
77405
|
+
const firstName = row.original.firstName || "";
|
|
77406
|
+
const lastName = row.original.lastName || "";
|
|
77407
|
+
const fullName = `${firstName} ${lastName}`.trim();
|
|
77408
|
+
return fullName ? fullName : /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" });
|
|
77528
77409
|
}
|
|
77529
|
-
}
|
|
77530
|
-
|
|
77531
|
-
|
|
77532
|
-
|
|
77410
|
+
},
|
|
77411
|
+
{
|
|
77412
|
+
accessorKey: "email",
|
|
77413
|
+
header: "Email",
|
|
77414
|
+
cell: ({ row }) => row.original.email || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" })
|
|
77415
|
+
},
|
|
77416
|
+
{
|
|
77417
|
+
accessorKey: "phone",
|
|
77418
|
+
header: "Phone",
|
|
77419
|
+
cell: ({ row }) => row.original.phone || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" })
|
|
77533
77420
|
}
|
|
77421
|
+
];
|
|
77422
|
+
if (!automation2 || isLoadingRecipients || !recipients) {
|
|
77423
|
+
return /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Recipients", "Finishing up"] });
|
|
77534
77424
|
}
|
|
77535
|
-
|
|
77536
|
-
|
|
77537
|
-
|
|
77538
|
-
|
|
77539
|
-
|
|
77540
|
-
if (mayWarn) {
|
|
77541
|
-
return element.ref;
|
|
77425
|
+
if (fetchError) {
|
|
77426
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
77427
|
+
"Error: ",
|
|
77428
|
+
fetchError.message
|
|
77429
|
+
] });
|
|
77542
77430
|
}
|
|
77543
|
-
|
|
77544
|
-
|
|
77545
|
-
|
|
77546
|
-
|
|
77431
|
+
if (!recipients || recipients.recipients.length === 0) {
|
|
77432
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center p-8 text-center", children: [
|
|
77433
|
+
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx(IconDefinitions.UserIcon, { className: "h-12 w-12 text-gray-400" }) }),
|
|
77434
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-semibold text-gray-700", children: "No Recipients Found" }),
|
|
77435
|
+
/* @__PURE__ */ jsxs("p", { className: "text-gray-500", children: [
|
|
77436
|
+
"This ",
|
|
77437
|
+
t$1("engage:automation"),
|
|
77438
|
+
" currently has no assigned recipients. Please update the include or exclude",
|
|
77439
|
+
" ",
|
|
77440
|
+
t$1("engage:segment", { count: 2 }),
|
|
77441
|
+
" to add recipients."
|
|
77442
|
+
] })
|
|
77443
|
+
] });
|
|
77547
77444
|
}
|
|
77548
|
-
return
|
|
77549
|
-
|
|
77550
|
-
|
|
77551
|
-
|
|
77552
|
-
|
|
77553
|
-
|
|
77554
|
-
|
|
77555
|
-
|
|
77556
|
-
);
|
|
77557
|
-
const CollectionProvider = (props2) => {
|
|
77558
|
-
const { scope, children: children2 } = props2;
|
|
77559
|
-
const ref = React__default.useRef(null);
|
|
77560
|
-
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
77561
|
-
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children: children2 });
|
|
77562
|
-
};
|
|
77563
|
-
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
77564
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
77565
|
-
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
77566
|
-
const CollectionSlot = React__default.forwardRef(
|
|
77567
|
-
(props2, forwardedRef) => {
|
|
77568
|
-
const { scope, children: children2 } = props2;
|
|
77569
|
-
const context2 = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
77570
|
-
const composedRefs = useComposedRefs(forwardedRef, context2.collectionRef);
|
|
77571
|
-
return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children: children2 });
|
|
77572
|
-
}
|
|
77573
|
-
);
|
|
77574
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
77575
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
77576
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
77577
|
-
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
|
|
77578
|
-
const CollectionItemSlot = React__default.forwardRef(
|
|
77579
|
-
(props2, forwardedRef) => {
|
|
77580
|
-
const { scope, children: children2, ...itemData } = props2;
|
|
77581
|
-
const ref = React__default.useRef(null);
|
|
77582
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
77583
|
-
const context2 = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
77584
|
-
React__default.useEffect(() => {
|
|
77585
|
-
context2.itemMap.set(ref, { ref, ...itemData });
|
|
77586
|
-
return () => void context2.itemMap.delete(ref);
|
|
77587
|
-
});
|
|
77588
|
-
return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children: children2 });
|
|
77445
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(
|
|
77446
|
+
TanstackTable,
|
|
77447
|
+
{
|
|
77448
|
+
data: recipients.recipients,
|
|
77449
|
+
columns,
|
|
77450
|
+
paginationMode: "standard",
|
|
77451
|
+
initialPageSize: 10,
|
|
77452
|
+
isLoading: isLoadingRecipients
|
|
77589
77453
|
}
|
|
77590
|
-
);
|
|
77591
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
77592
|
-
function useCollection2(scope) {
|
|
77593
|
-
const context2 = useCollectionContext(name + "CollectionConsumer", scope);
|
|
77594
|
-
const getItems = React__default.useCallback(() => {
|
|
77595
|
-
const collectionNode = context2.collectionRef.current;
|
|
77596
|
-
if (!collectionNode) return [];
|
|
77597
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
77598
|
-
const items = Array.from(context2.itemMap.values());
|
|
77599
|
-
const orderedItems = items.sort(
|
|
77600
|
-
(a4, b3) => orderedNodes.indexOf(a4.ref.current) - orderedNodes.indexOf(b3.ref.current)
|
|
77601
|
-
);
|
|
77602
|
-
return orderedItems;
|
|
77603
|
-
}, [context2.collectionRef, context2.itemMap]);
|
|
77604
|
-
return getItems;
|
|
77605
|
-
}
|
|
77606
|
-
return [
|
|
77607
|
-
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
77608
|
-
useCollection2,
|
|
77609
|
-
createCollectionScope2
|
|
77610
|
-
];
|
|
77611
|
-
}
|
|
77612
|
-
var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
|
|
77454
|
+
) });
|
|
77613
77455
|
};
|
|
77614
|
-
|
|
77615
|
-
|
|
77616
|
-
|
|
77617
|
-
|
|
77618
|
-
|
|
77619
|
-
|
|
77620
|
-
|
|
77621
|
-
|
|
77622
|
-
|
|
77623
|
-
|
|
77624
|
-
"
|
|
77625
|
-
"
|
|
77626
|
-
"
|
|
77627
|
-
"
|
|
77628
|
-
"
|
|
77629
|
-
|
|
77630
|
-
|
|
77631
|
-
|
|
77632
|
-
|
|
77633
|
-
|
|
77634
|
-
|
|
77635
|
-
|
|
77636
|
-
|
|
77637
|
-
|
|
77638
|
-
|
|
77639
|
-
|
|
77640
|
-
"ul"
|
|
77641
|
-
];
|
|
77642
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
77643
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
77644
|
-
const Node2 = React.forwardRef((props2, forwardedRef) => {
|
|
77645
|
-
const { asChild, ...primitiveProps } = props2;
|
|
77646
|
-
const Comp = asChild ? Slot2 : node;
|
|
77647
|
-
if (typeof window !== "undefined") {
|
|
77648
|
-
window[Symbol.for("radix-ui")] = true;
|
|
77649
|
-
}
|
|
77650
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
77651
|
-
});
|
|
77652
|
-
Node2.displayName = `Primitive.${node}`;
|
|
77653
|
-
return { ...primitive, [node]: Node2 };
|
|
77654
|
-
}, {});
|
|
77655
|
-
function useCallbackRef(callback) {
|
|
77656
|
-
const callbackRef = React.useRef(callback);
|
|
77657
|
-
React.useEffect(() => {
|
|
77658
|
-
callbackRef.current = callback;
|
|
77659
|
-
});
|
|
77660
|
-
return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
77661
|
-
}
|
|
77662
|
-
var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
77663
|
-
function useControllableState({
|
|
77664
|
-
prop,
|
|
77665
|
-
defaultProp,
|
|
77666
|
-
onChange = () => {
|
|
77667
|
-
},
|
|
77668
|
-
caller
|
|
77669
|
-
}) {
|
|
77670
|
-
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
77671
|
-
defaultProp,
|
|
77672
|
-
onChange
|
|
77673
|
-
});
|
|
77674
|
-
const isControlled = prop !== void 0;
|
|
77675
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
77676
|
-
{
|
|
77677
|
-
const isControlledRef = React.useRef(prop !== void 0);
|
|
77678
|
-
React.useEffect(() => {
|
|
77679
|
-
const wasControlled = isControlledRef.current;
|
|
77680
|
-
if (wasControlled !== isControlled) {
|
|
77681
|
-
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
77682
|
-
const to = isControlled ? "controlled" : "uncontrolled";
|
|
77683
|
-
console.warn(
|
|
77684
|
-
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
77685
|
-
);
|
|
77686
|
-
}
|
|
77687
|
-
isControlledRef.current = isControlled;
|
|
77688
|
-
}, [isControlled, caller]);
|
|
77456
|
+
const PanelGroupContext = createContext$1(null);
|
|
77457
|
+
PanelGroupContext.displayName = "PanelGroupContext";
|
|
77458
|
+
const DATA_ATTRIBUTES = {
|
|
77459
|
+
group: "data-panel-group",
|
|
77460
|
+
groupDirection: "data-panel-group-direction",
|
|
77461
|
+
groupId: "data-panel-group-id",
|
|
77462
|
+
panel: "data-panel",
|
|
77463
|
+
panelCollapsible: "data-panel-collapsible",
|
|
77464
|
+
panelId: "data-panel-id",
|
|
77465
|
+
panelSize: "data-panel-size",
|
|
77466
|
+
resizeHandle: "data-resize-handle",
|
|
77467
|
+
resizeHandleActive: "data-resize-handle-active",
|
|
77468
|
+
resizeHandleEnabled: "data-panel-resize-handle-enabled",
|
|
77469
|
+
resizeHandleId: "data-panel-resize-handle-id",
|
|
77470
|
+
resizeHandleState: "data-resize-handle-state"
|
|
77471
|
+
};
|
|
77472
|
+
const PRECISION = 10;
|
|
77473
|
+
const useIsomorphicLayoutEffect = useLayoutEffect;
|
|
77474
|
+
const useId$1 = React["useId".toString()];
|
|
77475
|
+
const wrappedUseId = typeof useId$1 === "function" ? useId$1 : () => null;
|
|
77476
|
+
let counter = 0;
|
|
77477
|
+
function useUniqueId(idFromParams = null) {
|
|
77478
|
+
const idFromUseId = wrappedUseId();
|
|
77479
|
+
const idRef = useRef(idFromParams || idFromUseId || null);
|
|
77480
|
+
if (idRef.current === null) {
|
|
77481
|
+
idRef.current = "" + counter++;
|
|
77689
77482
|
}
|
|
77690
|
-
|
|
77691
|
-
(nextValue) => {
|
|
77692
|
-
if (isControlled) {
|
|
77693
|
-
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
77694
|
-
if (value2 !== prop) {
|
|
77695
|
-
onChangeRef.current?.(value2);
|
|
77696
|
-
}
|
|
77697
|
-
} else {
|
|
77698
|
-
setUncontrolledProp(nextValue);
|
|
77699
|
-
}
|
|
77700
|
-
},
|
|
77701
|
-
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
77702
|
-
);
|
|
77703
|
-
return [value, setValue];
|
|
77483
|
+
return idFromParams !== null && idFromParams !== void 0 ? idFromParams : idRef.current;
|
|
77704
77484
|
}
|
|
77705
|
-
function
|
|
77706
|
-
|
|
77707
|
-
|
|
77485
|
+
function PanelWithForwardedRef({
|
|
77486
|
+
children: children2,
|
|
77487
|
+
className: classNameFromProps = "",
|
|
77488
|
+
collapsedSize,
|
|
77489
|
+
collapsible,
|
|
77490
|
+
defaultSize,
|
|
77491
|
+
forwardedRef,
|
|
77492
|
+
id: idFromProps,
|
|
77493
|
+
maxSize,
|
|
77494
|
+
minSize,
|
|
77495
|
+
onCollapse,
|
|
77496
|
+
onExpand,
|
|
77497
|
+
onResize,
|
|
77498
|
+
order: order2,
|
|
77499
|
+
style: styleFromProps,
|
|
77500
|
+
tagName: Type = "div",
|
|
77501
|
+
...rest
|
|
77708
77502
|
}) {
|
|
77709
|
-
const
|
|
77710
|
-
|
|
77711
|
-
|
|
77712
|
-
useInsertionEffect(() => {
|
|
77713
|
-
onChangeRef.current = onChange;
|
|
77714
|
-
}, [onChange]);
|
|
77715
|
-
React.useEffect(() => {
|
|
77716
|
-
if (prevValueRef.current !== value) {
|
|
77717
|
-
onChangeRef.current?.(value);
|
|
77718
|
-
prevValueRef.current = value;
|
|
77719
|
-
}
|
|
77720
|
-
}, [value, prevValueRef]);
|
|
77721
|
-
return [value, setValue, onChangeRef];
|
|
77722
|
-
}
|
|
77723
|
-
function isFunction(value) {
|
|
77724
|
-
return typeof value === "function";
|
|
77725
|
-
}
|
|
77726
|
-
var DirectionContext = React.createContext(void 0);
|
|
77727
|
-
function useDirection(localDir) {
|
|
77728
|
-
const globalDir = React.useContext(DirectionContext);
|
|
77729
|
-
return localDir || globalDir || "ltr";
|
|
77730
|
-
}
|
|
77731
|
-
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
77732
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
77733
|
-
var GROUP_NAME = "RovingFocusGroup";
|
|
77734
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
77735
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
77736
|
-
GROUP_NAME,
|
|
77737
|
-
[createCollectionScope]
|
|
77738
|
-
);
|
|
77739
|
-
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
77740
|
-
var RovingFocusGroup = React.forwardRef(
|
|
77741
|
-
(props2, forwardedRef) => {
|
|
77742
|
-
return /* @__PURE__ */ jsx(Collection.Provider, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props2, ref: forwardedRef }) }) });
|
|
77743
|
-
}
|
|
77744
|
-
);
|
|
77745
|
-
RovingFocusGroup.displayName = GROUP_NAME;
|
|
77746
|
-
var RovingFocusGroupImpl = React.forwardRef((props2, forwardedRef) => {
|
|
77747
|
-
const {
|
|
77748
|
-
__scopeRovingFocusGroup,
|
|
77749
|
-
orientation,
|
|
77750
|
-
loop = false,
|
|
77751
|
-
dir,
|
|
77752
|
-
currentTabStopId: currentTabStopIdProp,
|
|
77753
|
-
defaultCurrentTabStopId,
|
|
77754
|
-
onCurrentTabStopIdChange,
|
|
77755
|
-
onEntryFocus,
|
|
77756
|
-
preventScrollOnEntryFocus = false,
|
|
77757
|
-
...groupProps
|
|
77758
|
-
} = props2;
|
|
77759
|
-
const ref = React.useRef(null);
|
|
77760
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
77761
|
-
const direction = useDirection(dir);
|
|
77762
|
-
const [currentTabStopId, setCurrentTabStopId] = useControllableState({
|
|
77763
|
-
prop: currentTabStopIdProp,
|
|
77764
|
-
defaultProp: defaultCurrentTabStopId ?? null,
|
|
77765
|
-
onChange: onCurrentTabStopIdChange,
|
|
77766
|
-
caller: GROUP_NAME
|
|
77767
|
-
});
|
|
77768
|
-
const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
|
|
77769
|
-
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
77770
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
77771
|
-
const isClickFocusRef = React.useRef(false);
|
|
77772
|
-
const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
|
|
77773
|
-
React.useEffect(() => {
|
|
77774
|
-
const node = ref.current;
|
|
77775
|
-
if (node) {
|
|
77776
|
-
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
77777
|
-
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
77778
|
-
}
|
|
77779
|
-
}, [handleEntryFocus]);
|
|
77780
|
-
return /* @__PURE__ */ jsx(
|
|
77781
|
-
RovingFocusProvider,
|
|
77782
|
-
{
|
|
77783
|
-
scope: __scopeRovingFocusGroup,
|
|
77784
|
-
orientation,
|
|
77785
|
-
dir: direction,
|
|
77786
|
-
loop,
|
|
77787
|
-
currentTabStopId,
|
|
77788
|
-
onItemFocus: React.useCallback(
|
|
77789
|
-
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
77790
|
-
[setCurrentTabStopId]
|
|
77791
|
-
),
|
|
77792
|
-
onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
|
|
77793
|
-
onFocusableItemAdd: React.useCallback(
|
|
77794
|
-
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
77795
|
-
[]
|
|
77796
|
-
),
|
|
77797
|
-
onFocusableItemRemove: React.useCallback(
|
|
77798
|
-
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
77799
|
-
[]
|
|
77800
|
-
),
|
|
77801
|
-
children: /* @__PURE__ */ jsx(
|
|
77802
|
-
Primitive.div,
|
|
77803
|
-
{
|
|
77804
|
-
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
77805
|
-
"data-orientation": orientation,
|
|
77806
|
-
...groupProps,
|
|
77807
|
-
ref: composedRefs,
|
|
77808
|
-
style: { outline: "none", ...props2.style },
|
|
77809
|
-
onMouseDown: composeEventHandlers(props2.onMouseDown, () => {
|
|
77810
|
-
isClickFocusRef.current = true;
|
|
77811
|
-
}),
|
|
77812
|
-
onFocus: composeEventHandlers(props2.onFocus, (event) => {
|
|
77813
|
-
const isKeyboardFocus = !isClickFocusRef.current;
|
|
77814
|
-
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
77815
|
-
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
77816
|
-
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
77817
|
-
if (!entryFocusEvent.defaultPrevented) {
|
|
77818
|
-
const items = getItems().filter((item) => item.focusable);
|
|
77819
|
-
const activeItem = items.find((item) => item.active);
|
|
77820
|
-
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
77821
|
-
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
77822
|
-
Boolean
|
|
77823
|
-
);
|
|
77824
|
-
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
77825
|
-
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
77826
|
-
}
|
|
77827
|
-
}
|
|
77828
|
-
isClickFocusRef.current = false;
|
|
77829
|
-
}),
|
|
77830
|
-
onBlur: composeEventHandlers(props2.onBlur, () => setIsTabbingBackOut(false))
|
|
77831
|
-
}
|
|
77832
|
-
)
|
|
77833
|
-
}
|
|
77834
|
-
);
|
|
77835
|
-
});
|
|
77836
|
-
var ITEM_NAME = "RovingFocusGroupItem";
|
|
77837
|
-
var RovingFocusGroupItem = React.forwardRef(
|
|
77838
|
-
(props2, forwardedRef) => {
|
|
77839
|
-
const {
|
|
77840
|
-
__scopeRovingFocusGroup,
|
|
77841
|
-
focusable = true,
|
|
77842
|
-
active = false,
|
|
77843
|
-
tabStopId,
|
|
77844
|
-
children: children2,
|
|
77845
|
-
...itemProps
|
|
77846
|
-
} = props2;
|
|
77847
|
-
const autoId = useId$1();
|
|
77848
|
-
const id2 = tabStopId || autoId;
|
|
77849
|
-
const context2 = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
77850
|
-
const isCurrentTabStop = context2.currentTabStopId === id2;
|
|
77851
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
77852
|
-
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context2;
|
|
77853
|
-
React.useEffect(() => {
|
|
77854
|
-
if (focusable) {
|
|
77855
|
-
onFocusableItemAdd();
|
|
77856
|
-
return () => onFocusableItemRemove();
|
|
77857
|
-
}
|
|
77858
|
-
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
77859
|
-
return /* @__PURE__ */ jsx(
|
|
77860
|
-
Collection.ItemSlot,
|
|
77861
|
-
{
|
|
77862
|
-
scope: __scopeRovingFocusGroup,
|
|
77863
|
-
id: id2,
|
|
77864
|
-
focusable,
|
|
77865
|
-
active,
|
|
77866
|
-
children: /* @__PURE__ */ jsx(
|
|
77867
|
-
Primitive.span,
|
|
77868
|
-
{
|
|
77869
|
-
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
77870
|
-
"data-orientation": context2.orientation,
|
|
77871
|
-
...itemProps,
|
|
77872
|
-
ref: forwardedRef,
|
|
77873
|
-
onMouseDown: composeEventHandlers(props2.onMouseDown, (event) => {
|
|
77874
|
-
if (!focusable) event.preventDefault();
|
|
77875
|
-
else context2.onItemFocus(id2);
|
|
77876
|
-
}),
|
|
77877
|
-
onFocus: composeEventHandlers(props2.onFocus, () => context2.onItemFocus(id2)),
|
|
77878
|
-
onKeyDown: composeEventHandlers(props2.onKeyDown, (event) => {
|
|
77879
|
-
if (event.key === "Tab" && event.shiftKey) {
|
|
77880
|
-
context2.onItemShiftTab();
|
|
77881
|
-
return;
|
|
77882
|
-
}
|
|
77883
|
-
if (event.target !== event.currentTarget) return;
|
|
77884
|
-
const focusIntent = getFocusIntent(event, context2.orientation, context2.dir);
|
|
77885
|
-
if (focusIntent !== void 0) {
|
|
77886
|
-
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
77887
|
-
event.preventDefault();
|
|
77888
|
-
const items = getItems().filter((item) => item.focusable);
|
|
77889
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
77890
|
-
if (focusIntent === "last") candidateNodes.reverse();
|
|
77891
|
-
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
77892
|
-
if (focusIntent === "prev") candidateNodes.reverse();
|
|
77893
|
-
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
77894
|
-
candidateNodes = context2.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
77895
|
-
}
|
|
77896
|
-
setTimeout(() => focusFirst(candidateNodes));
|
|
77897
|
-
}
|
|
77898
|
-
}),
|
|
77899
|
-
children: typeof children2 === "function" ? children2({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children2
|
|
77900
|
-
}
|
|
77901
|
-
)
|
|
77902
|
-
}
|
|
77903
|
-
);
|
|
77904
|
-
}
|
|
77905
|
-
);
|
|
77906
|
-
RovingFocusGroupItem.displayName = ITEM_NAME;
|
|
77907
|
-
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
77908
|
-
ArrowLeft: "prev",
|
|
77909
|
-
ArrowUp: "prev",
|
|
77910
|
-
ArrowRight: "next",
|
|
77911
|
-
ArrowDown: "next",
|
|
77912
|
-
PageUp: "first",
|
|
77913
|
-
Home: "first",
|
|
77914
|
-
PageDown: "last",
|
|
77915
|
-
End: "last"
|
|
77916
|
-
};
|
|
77917
|
-
function getDirectionAwareKey(key, dir) {
|
|
77918
|
-
if (dir !== "rtl") return key;
|
|
77919
|
-
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
77920
|
-
}
|
|
77921
|
-
function getFocusIntent(event, orientation, dir) {
|
|
77922
|
-
const key = getDirectionAwareKey(event.key, dir);
|
|
77923
|
-
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
77924
|
-
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
77925
|
-
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
77926
|
-
}
|
|
77927
|
-
function focusFirst(candidates, preventScroll = false) {
|
|
77928
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
77929
|
-
for (const candidate of candidates) {
|
|
77930
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
77931
|
-
candidate.focus({ preventScroll });
|
|
77932
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
77933
|
-
}
|
|
77934
|
-
}
|
|
77935
|
-
function wrapArray(array, startIndex2) {
|
|
77936
|
-
return array.map((_2, index2) => array[(startIndex2 + index2) % array.length]);
|
|
77937
|
-
}
|
|
77938
|
-
var Root$1 = RovingFocusGroup;
|
|
77939
|
-
var Item = RovingFocusGroupItem;
|
|
77940
|
-
function useStateMachine(initialState2, machine) {
|
|
77941
|
-
return React.useReducer((state, event) => {
|
|
77942
|
-
const nextState = machine[state][event];
|
|
77943
|
-
return nextState ?? state;
|
|
77944
|
-
}, initialState2);
|
|
77945
|
-
}
|
|
77946
|
-
var Presence = (props2) => {
|
|
77947
|
-
const { present, children: children2 } = props2;
|
|
77948
|
-
const presence = usePresence(present);
|
|
77949
|
-
const child = typeof children2 === "function" ? children2({ present: presence.isPresent }) : React.Children.only(children2);
|
|
77950
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
77951
|
-
const forceMount = typeof children2 === "function";
|
|
77952
|
-
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
77953
|
-
};
|
|
77954
|
-
Presence.displayName = "Presence";
|
|
77955
|
-
function usePresence(present) {
|
|
77956
|
-
const [node, setNode] = React.useState();
|
|
77957
|
-
const stylesRef = React.useRef(null);
|
|
77958
|
-
const prevPresentRef = React.useRef(present);
|
|
77959
|
-
const prevAnimationNameRef = React.useRef("none");
|
|
77960
|
-
const initialState2 = present ? "mounted" : "unmounted";
|
|
77961
|
-
const [state, send] = useStateMachine(initialState2, {
|
|
77962
|
-
mounted: {
|
|
77963
|
-
UNMOUNT: "unmounted",
|
|
77964
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
77965
|
-
},
|
|
77966
|
-
unmountSuspended: {
|
|
77967
|
-
MOUNT: "mounted",
|
|
77968
|
-
ANIMATION_END: "unmounted"
|
|
77969
|
-
},
|
|
77970
|
-
unmounted: {
|
|
77971
|
-
MOUNT: "mounted"
|
|
77972
|
-
}
|
|
77973
|
-
});
|
|
77974
|
-
React.useEffect(() => {
|
|
77975
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
77976
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
77977
|
-
}, [state]);
|
|
77978
|
-
useLayoutEffect2(() => {
|
|
77979
|
-
const styles2 = stylesRef.current;
|
|
77980
|
-
const wasPresent = prevPresentRef.current;
|
|
77981
|
-
const hasPresentChanged = wasPresent !== present;
|
|
77982
|
-
if (hasPresentChanged) {
|
|
77983
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
77984
|
-
const currentAnimationName = getAnimationName(styles2);
|
|
77985
|
-
if (present) {
|
|
77986
|
-
send("MOUNT");
|
|
77987
|
-
} else if (currentAnimationName === "none" || styles2?.display === "none") {
|
|
77988
|
-
send("UNMOUNT");
|
|
77989
|
-
} else {
|
|
77990
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
77991
|
-
if (wasPresent && isAnimating) {
|
|
77992
|
-
send("ANIMATION_OUT");
|
|
77993
|
-
} else {
|
|
77994
|
-
send("UNMOUNT");
|
|
77995
|
-
}
|
|
77996
|
-
}
|
|
77997
|
-
prevPresentRef.current = present;
|
|
77998
|
-
}
|
|
77999
|
-
}, [present, send]);
|
|
78000
|
-
useLayoutEffect2(() => {
|
|
78001
|
-
if (node) {
|
|
78002
|
-
let timeoutId;
|
|
78003
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
78004
|
-
const handleAnimationEnd = (event) => {
|
|
78005
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
78006
|
-
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
78007
|
-
if (event.target === node && isCurrentAnimation) {
|
|
78008
|
-
send("ANIMATION_END");
|
|
78009
|
-
if (!prevPresentRef.current) {
|
|
78010
|
-
const currentFillMode = node.style.animationFillMode;
|
|
78011
|
-
node.style.animationFillMode = "forwards";
|
|
78012
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
78013
|
-
if (node.style.animationFillMode === "forwards") {
|
|
78014
|
-
node.style.animationFillMode = currentFillMode;
|
|
78015
|
-
}
|
|
78016
|
-
});
|
|
78017
|
-
}
|
|
78018
|
-
}
|
|
78019
|
-
};
|
|
78020
|
-
const handleAnimationStart = (event) => {
|
|
78021
|
-
if (event.target === node) {
|
|
78022
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
78023
|
-
}
|
|
78024
|
-
};
|
|
78025
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
78026
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
78027
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
78028
|
-
return () => {
|
|
78029
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
78030
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
78031
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
78032
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
78033
|
-
};
|
|
78034
|
-
} else {
|
|
78035
|
-
send("ANIMATION_END");
|
|
78036
|
-
}
|
|
78037
|
-
}, [node, send]);
|
|
78038
|
-
return {
|
|
78039
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
78040
|
-
ref: React.useCallback((node2) => {
|
|
78041
|
-
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
78042
|
-
setNode(node2);
|
|
78043
|
-
}, [])
|
|
78044
|
-
};
|
|
78045
|
-
}
|
|
78046
|
-
function getAnimationName(styles2) {
|
|
78047
|
-
return styles2?.animationName || "none";
|
|
78048
|
-
}
|
|
78049
|
-
function getElementRef(element) {
|
|
78050
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
78051
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
78052
|
-
if (mayWarn) {
|
|
78053
|
-
return element.ref;
|
|
78054
|
-
}
|
|
78055
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
78056
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
78057
|
-
if (mayWarn) {
|
|
78058
|
-
return element.props.ref;
|
|
78059
|
-
}
|
|
78060
|
-
return element.props.ref || element.ref;
|
|
78061
|
-
}
|
|
78062
|
-
var TABS_NAME = "Tabs";
|
|
78063
|
-
var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
|
|
78064
|
-
createRovingFocusGroupScope
|
|
78065
|
-
]);
|
|
78066
|
-
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
78067
|
-
var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
|
|
78068
|
-
var Tabs$1 = React.forwardRef(
|
|
78069
|
-
(props2, forwardedRef) => {
|
|
78070
|
-
const {
|
|
78071
|
-
__scopeTabs,
|
|
78072
|
-
value: valueProp,
|
|
78073
|
-
onValueChange,
|
|
78074
|
-
defaultValue,
|
|
78075
|
-
orientation = "horizontal",
|
|
78076
|
-
dir,
|
|
78077
|
-
activationMode = "automatic",
|
|
78078
|
-
...tabsProps
|
|
78079
|
-
} = props2;
|
|
78080
|
-
const direction = useDirection(dir);
|
|
78081
|
-
const [value, setValue] = useControllableState({
|
|
78082
|
-
prop: valueProp,
|
|
78083
|
-
onChange: onValueChange,
|
|
78084
|
-
defaultProp: defaultValue ?? "",
|
|
78085
|
-
caller: TABS_NAME
|
|
78086
|
-
});
|
|
78087
|
-
return /* @__PURE__ */ jsx(
|
|
78088
|
-
TabsProvider,
|
|
78089
|
-
{
|
|
78090
|
-
scope: __scopeTabs,
|
|
78091
|
-
baseId: useId$1(),
|
|
78092
|
-
value,
|
|
78093
|
-
onValueChange: setValue,
|
|
78094
|
-
orientation,
|
|
78095
|
-
dir: direction,
|
|
78096
|
-
activationMode,
|
|
78097
|
-
children: /* @__PURE__ */ jsx(
|
|
78098
|
-
Primitive.div,
|
|
78099
|
-
{
|
|
78100
|
-
dir: direction,
|
|
78101
|
-
"data-orientation": orientation,
|
|
78102
|
-
...tabsProps,
|
|
78103
|
-
ref: forwardedRef
|
|
78104
|
-
}
|
|
78105
|
-
)
|
|
78106
|
-
}
|
|
78107
|
-
);
|
|
78108
|
-
}
|
|
78109
|
-
);
|
|
78110
|
-
Tabs$1.displayName = TABS_NAME;
|
|
78111
|
-
var TAB_LIST_NAME = "TabsList";
|
|
78112
|
-
var TabsList$1 = React.forwardRef(
|
|
78113
|
-
(props2, forwardedRef) => {
|
|
78114
|
-
const { __scopeTabs, loop = true, ...listProps } = props2;
|
|
78115
|
-
const context2 = useTabsContext(TAB_LIST_NAME, __scopeTabs);
|
|
78116
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
78117
|
-
return /* @__PURE__ */ jsx(
|
|
78118
|
-
Root$1,
|
|
78119
|
-
{
|
|
78120
|
-
asChild: true,
|
|
78121
|
-
...rovingFocusGroupScope,
|
|
78122
|
-
orientation: context2.orientation,
|
|
78123
|
-
dir: context2.dir,
|
|
78124
|
-
loop,
|
|
78125
|
-
children: /* @__PURE__ */ jsx(
|
|
78126
|
-
Primitive.div,
|
|
78127
|
-
{
|
|
78128
|
-
role: "tablist",
|
|
78129
|
-
"aria-orientation": context2.orientation,
|
|
78130
|
-
...listProps,
|
|
78131
|
-
ref: forwardedRef
|
|
78132
|
-
}
|
|
78133
|
-
)
|
|
78134
|
-
}
|
|
78135
|
-
);
|
|
78136
|
-
}
|
|
78137
|
-
);
|
|
78138
|
-
TabsList$1.displayName = TAB_LIST_NAME;
|
|
78139
|
-
var TRIGGER_NAME = "TabsTrigger";
|
|
78140
|
-
var TabsTrigger$1 = React.forwardRef(
|
|
78141
|
-
(props2, forwardedRef) => {
|
|
78142
|
-
const { __scopeTabs, value, disabled = false, ...triggerProps } = props2;
|
|
78143
|
-
const context2 = useTabsContext(TRIGGER_NAME, __scopeTabs);
|
|
78144
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
78145
|
-
const triggerId = makeTriggerId(context2.baseId, value);
|
|
78146
|
-
const contentId = makeContentId(context2.baseId, value);
|
|
78147
|
-
const isSelected = value === context2.value;
|
|
78148
|
-
return /* @__PURE__ */ jsx(
|
|
78149
|
-
Item,
|
|
78150
|
-
{
|
|
78151
|
-
asChild: true,
|
|
78152
|
-
...rovingFocusGroupScope,
|
|
78153
|
-
focusable: !disabled,
|
|
78154
|
-
active: isSelected,
|
|
78155
|
-
children: /* @__PURE__ */ jsx(
|
|
78156
|
-
Primitive.button,
|
|
78157
|
-
{
|
|
78158
|
-
type: "button",
|
|
78159
|
-
role: "tab",
|
|
78160
|
-
"aria-selected": isSelected,
|
|
78161
|
-
"aria-controls": contentId,
|
|
78162
|
-
"data-state": isSelected ? "active" : "inactive",
|
|
78163
|
-
"data-disabled": disabled ? "" : void 0,
|
|
78164
|
-
disabled,
|
|
78165
|
-
id: triggerId,
|
|
78166
|
-
...triggerProps,
|
|
78167
|
-
ref: forwardedRef,
|
|
78168
|
-
onMouseDown: composeEventHandlers(props2.onMouseDown, (event) => {
|
|
78169
|
-
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
78170
|
-
context2.onValueChange(value);
|
|
78171
|
-
} else {
|
|
78172
|
-
event.preventDefault();
|
|
78173
|
-
}
|
|
78174
|
-
}),
|
|
78175
|
-
onKeyDown: composeEventHandlers(props2.onKeyDown, (event) => {
|
|
78176
|
-
if ([" ", "Enter"].includes(event.key)) context2.onValueChange(value);
|
|
78177
|
-
}),
|
|
78178
|
-
onFocus: composeEventHandlers(props2.onFocus, () => {
|
|
78179
|
-
const isAutomaticActivation = context2.activationMode !== "manual";
|
|
78180
|
-
if (!isSelected && !disabled && isAutomaticActivation) {
|
|
78181
|
-
context2.onValueChange(value);
|
|
78182
|
-
}
|
|
78183
|
-
})
|
|
78184
|
-
}
|
|
78185
|
-
)
|
|
78186
|
-
}
|
|
78187
|
-
);
|
|
78188
|
-
}
|
|
78189
|
-
);
|
|
78190
|
-
TabsTrigger$1.displayName = TRIGGER_NAME;
|
|
78191
|
-
var CONTENT_NAME = "TabsContent";
|
|
78192
|
-
var TabsContent$1 = React.forwardRef(
|
|
78193
|
-
(props2, forwardedRef) => {
|
|
78194
|
-
const { __scopeTabs, value, forceMount, children: children2, ...contentProps } = props2;
|
|
78195
|
-
const context2 = useTabsContext(CONTENT_NAME, __scopeTabs);
|
|
78196
|
-
const triggerId = makeTriggerId(context2.baseId, value);
|
|
78197
|
-
const contentId = makeContentId(context2.baseId, value);
|
|
78198
|
-
const isSelected = value === context2.value;
|
|
78199
|
-
const isMountAnimationPreventedRef = React.useRef(isSelected);
|
|
78200
|
-
React.useEffect(() => {
|
|
78201
|
-
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
78202
|
-
return () => cancelAnimationFrame(rAF);
|
|
78203
|
-
}, []);
|
|
78204
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(
|
|
78205
|
-
Primitive.div,
|
|
78206
|
-
{
|
|
78207
|
-
"data-state": isSelected ? "active" : "inactive",
|
|
78208
|
-
"data-orientation": context2.orientation,
|
|
78209
|
-
role: "tabpanel",
|
|
78210
|
-
"aria-labelledby": triggerId,
|
|
78211
|
-
hidden: !present,
|
|
78212
|
-
id: contentId,
|
|
78213
|
-
tabIndex: 0,
|
|
78214
|
-
...contentProps,
|
|
78215
|
-
ref: forwardedRef,
|
|
78216
|
-
style: {
|
|
78217
|
-
...props2.style,
|
|
78218
|
-
animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
|
|
78219
|
-
},
|
|
78220
|
-
children: present && children2
|
|
78221
|
-
}
|
|
78222
|
-
) });
|
|
78223
|
-
}
|
|
78224
|
-
);
|
|
78225
|
-
TabsContent$1.displayName = CONTENT_NAME;
|
|
78226
|
-
function makeTriggerId(baseId, value) {
|
|
78227
|
-
return `${baseId}-trigger-${value}`;
|
|
78228
|
-
}
|
|
78229
|
-
function makeContentId(baseId, value) {
|
|
78230
|
-
return `${baseId}-content-${value}`;
|
|
78231
|
-
}
|
|
78232
|
-
var Root2 = Tabs$1;
|
|
78233
|
-
var List = TabsList$1;
|
|
78234
|
-
var Trigger = TabsTrigger$1;
|
|
78235
|
-
var Content = TabsContent$1;
|
|
78236
|
-
const Tabs = Root2;
|
|
78237
|
-
const TabsList = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx(
|
|
78238
|
-
List,
|
|
78239
|
-
{
|
|
78240
|
-
ref,
|
|
78241
|
-
className: cn$1(
|
|
78242
|
-
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
78243
|
-
className2
|
|
78244
|
-
),
|
|
78245
|
-
...props2
|
|
78246
|
-
}
|
|
78247
|
-
));
|
|
78248
|
-
TabsList.displayName = List.displayName;
|
|
78249
|
-
const TabsTrigger = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx(
|
|
78250
|
-
Trigger,
|
|
78251
|
-
{
|
|
78252
|
-
ref,
|
|
78253
|
-
className: cn$1(
|
|
78254
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
78255
|
-
className2
|
|
78256
|
-
),
|
|
78257
|
-
...props2
|
|
78258
|
-
}
|
|
78259
|
-
));
|
|
78260
|
-
TabsTrigger.displayName = Trigger.displayName;
|
|
78261
|
-
const TabsContent = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx(
|
|
78262
|
-
Content,
|
|
78263
|
-
{
|
|
78264
|
-
ref,
|
|
78265
|
-
className: cn$1(
|
|
78266
|
-
"ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
78267
|
-
className2
|
|
78268
|
-
),
|
|
78269
|
-
...props2
|
|
78270
|
-
}
|
|
78271
|
-
));
|
|
78272
|
-
TabsContent.displayName = Content.displayName;
|
|
78273
|
-
const AutomationsEditorStatsTab = () => {
|
|
78274
|
-
const automation2 = useAutomation();
|
|
78275
|
-
const { isLoading: isStatisticsLoading } = useGetBusinessAutomationStatistics(
|
|
78276
|
-
automation2?.id
|
|
78277
|
-
);
|
|
78278
|
-
if (!automation2 || isStatisticsLoading) {
|
|
78279
|
-
return /* @__PURE__ */ jsx(
|
|
78280
|
-
BasicLoader,
|
|
78281
|
-
{
|
|
78282
|
-
text: [`Fetching ${t$1("engage:insight", { count: 2 })}`, "Finishing up"]
|
|
78283
|
-
}
|
|
78284
|
-
);
|
|
78285
|
-
}
|
|
78286
|
-
return /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(
|
|
78287
|
-
AutomationStatistics,
|
|
78288
|
-
{
|
|
78289
|
-
automationId: automation2.id,
|
|
78290
|
-
automation: automation2,
|
|
78291
|
-
includeSales: true
|
|
78292
|
-
}
|
|
78293
|
-
) });
|
|
78294
|
-
};
|
|
78295
|
-
const AutomationsEditorRecipientsTab = () => {
|
|
78296
|
-
const automation2 = useAutomation();
|
|
78297
|
-
const {
|
|
78298
|
-
recipients,
|
|
78299
|
-
isLoading: isLoadingRecipients,
|
|
78300
|
-
fetchError
|
|
78301
|
-
} = useGetBusinessAutomationRecipients(automation2?.id ?? "");
|
|
78302
|
-
const columns = [
|
|
78303
|
-
{
|
|
78304
|
-
accessorFn: (row) => `${row.firstName || ""} ${row.lastName || ""}`.trim(),
|
|
78305
|
-
id: "name",
|
|
78306
|
-
header: "Name",
|
|
78307
|
-
cell: ({ row }) => {
|
|
78308
|
-
const firstName = row.original.firstName || "";
|
|
78309
|
-
const lastName = row.original.lastName || "";
|
|
78310
|
-
const fullName = `${firstName} ${lastName}`.trim();
|
|
78311
|
-
return fullName ? fullName : /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" });
|
|
78312
|
-
}
|
|
78313
|
-
},
|
|
78314
|
-
{
|
|
78315
|
-
accessorKey: "email",
|
|
78316
|
-
header: "Email",
|
|
78317
|
-
cell: ({ row }) => row.original.email || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" })
|
|
78318
|
-
},
|
|
78319
|
-
{
|
|
78320
|
-
accessorKey: "phone",
|
|
78321
|
-
header: "Phone",
|
|
78322
|
-
cell: ({ row }) => row.original.phone || /* @__PURE__ */ jsx("span", { className: "text-gray-400", children: "Not provided" })
|
|
78323
|
-
}
|
|
78324
|
-
];
|
|
78325
|
-
if (!automation2 || isLoadingRecipients || !recipients) {
|
|
78326
|
-
return /* @__PURE__ */ jsx(BasicLoader, { text: ["Fetching Recipients", "Finishing up"] });
|
|
78327
|
-
}
|
|
78328
|
-
if (fetchError) {
|
|
78329
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
78330
|
-
"Error: ",
|
|
78331
|
-
fetchError.message
|
|
78332
|
-
] });
|
|
78333
|
-
}
|
|
78334
|
-
if (!recipients || recipients.recipients.length === 0) {
|
|
78335
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center p-8 text-center", children: [
|
|
78336
|
-
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx(IconDefinitions.UserIcon, { className: "h-12 w-12 text-gray-400" }) }),
|
|
78337
|
-
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-lg font-semibold text-gray-700", children: "No Recipients Found" }),
|
|
78338
|
-
/* @__PURE__ */ jsxs("p", { className: "text-gray-500", children: [
|
|
78339
|
-
"This ",
|
|
78340
|
-
t$1("engage:automation"),
|
|
78341
|
-
" currently has no assigned recipients. Please update the include or exclude",
|
|
78342
|
-
" ",
|
|
78343
|
-
t$1("engage:segment", { count: 2 }),
|
|
78344
|
-
" to add recipients."
|
|
78345
|
-
] })
|
|
78346
|
-
] });
|
|
78347
|
-
}
|
|
78348
|
-
return /* @__PURE__ */ jsx("div", { className: "h-full p-4", children: /* @__PURE__ */ jsx(
|
|
78349
|
-
TanstackTable,
|
|
78350
|
-
{
|
|
78351
|
-
data: recipients.recipients,
|
|
78352
|
-
columns,
|
|
78353
|
-
paginationMode: "standard",
|
|
78354
|
-
initialPageSize: 10,
|
|
78355
|
-
isLoading: isLoadingRecipients
|
|
78356
|
-
}
|
|
78357
|
-
) });
|
|
78358
|
-
};
|
|
78359
|
-
const PanelGroupContext = createContext$1(null);
|
|
78360
|
-
PanelGroupContext.displayName = "PanelGroupContext";
|
|
78361
|
-
const DATA_ATTRIBUTES = {
|
|
78362
|
-
group: "data-panel-group",
|
|
78363
|
-
groupDirection: "data-panel-group-direction",
|
|
78364
|
-
groupId: "data-panel-group-id",
|
|
78365
|
-
panel: "data-panel",
|
|
78366
|
-
panelCollapsible: "data-panel-collapsible",
|
|
78367
|
-
panelId: "data-panel-id",
|
|
78368
|
-
panelSize: "data-panel-size",
|
|
78369
|
-
resizeHandle: "data-resize-handle",
|
|
78370
|
-
resizeHandleActive: "data-resize-handle-active",
|
|
78371
|
-
resizeHandleEnabled: "data-panel-resize-handle-enabled",
|
|
78372
|
-
resizeHandleId: "data-panel-resize-handle-id",
|
|
78373
|
-
resizeHandleState: "data-resize-handle-state"
|
|
78374
|
-
};
|
|
78375
|
-
const PRECISION = 10;
|
|
78376
|
-
const useIsomorphicLayoutEffect = useLayoutEffect;
|
|
78377
|
-
const useId = React["useId".toString()];
|
|
78378
|
-
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
78379
|
-
let counter = 0;
|
|
78380
|
-
function useUniqueId(idFromParams = null) {
|
|
78381
|
-
const idFromUseId = wrappedUseId();
|
|
78382
|
-
const idRef = useRef(idFromParams || idFromUseId || null);
|
|
78383
|
-
if (idRef.current === null) {
|
|
78384
|
-
idRef.current = "" + counter++;
|
|
78385
|
-
}
|
|
78386
|
-
return idFromParams !== null && idFromParams !== void 0 ? idFromParams : idRef.current;
|
|
78387
|
-
}
|
|
78388
|
-
function PanelWithForwardedRef({
|
|
78389
|
-
children: children2,
|
|
78390
|
-
className: classNameFromProps = "",
|
|
78391
|
-
collapsedSize,
|
|
78392
|
-
collapsible,
|
|
78393
|
-
defaultSize,
|
|
78394
|
-
forwardedRef,
|
|
78395
|
-
id: idFromProps,
|
|
78396
|
-
maxSize,
|
|
78397
|
-
minSize,
|
|
78398
|
-
onCollapse,
|
|
78399
|
-
onExpand,
|
|
78400
|
-
onResize,
|
|
78401
|
-
order: order2,
|
|
78402
|
-
style: styleFromProps,
|
|
78403
|
-
tagName: Type = "div",
|
|
78404
|
-
...rest
|
|
78405
|
-
}) {
|
|
78406
|
-
const context2 = useContext$1(PanelGroupContext);
|
|
78407
|
-
if (context2 === null) {
|
|
78408
|
-
throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
77503
|
+
const context2 = useContext$1(PanelGroupContext);
|
|
77504
|
+
if (context2 === null) {
|
|
77505
|
+
throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
78409
77506
|
}
|
|
78410
77507
|
const {
|
|
78411
77508
|
collapsePanel,
|
|
@@ -79849,12 +78946,238 @@ function PanelGroupWithForwardedRef({
|
|
|
79849
78946
|
if (onLayout2) {
|
|
79850
78947
|
onLayout2(nextLayout);
|
|
79851
78948
|
}
|
|
79852
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
78949
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
78950
|
+
}
|
|
78951
|
+
}
|
|
78952
|
+
}
|
|
78953
|
+
}, []);
|
|
78954
|
+
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
78955
|
+
const {
|
|
78956
|
+
onLayout: onLayout2
|
|
78957
|
+
} = committedValuesRef.current;
|
|
78958
|
+
const {
|
|
78959
|
+
layout: prevLayout,
|
|
78960
|
+
panelDataArray
|
|
78961
|
+
} = eagerValuesRef.current;
|
|
78962
|
+
if (panelData.constraints.collapsible) {
|
|
78963
|
+
const panelConstraintsArray = panelDataArray.map((panelData2) => panelData2.constraints);
|
|
78964
|
+
const {
|
|
78965
|
+
collapsedSize = 0,
|
|
78966
|
+
panelSize = 0,
|
|
78967
|
+
minSize: minSizeFromProps = 0,
|
|
78968
|
+
pivotIndices
|
|
78969
|
+
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
78970
|
+
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
78971
|
+
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
78972
|
+
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
78973
|
+
const baseSize = prevPanelSize != null && prevPanelSize >= minSize ? prevPanelSize : minSize;
|
|
78974
|
+
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
78975
|
+
const delta = isLastPanel ? panelSize - baseSize : baseSize - panelSize;
|
|
78976
|
+
const nextLayout = adjustLayoutByDelta({
|
|
78977
|
+
delta,
|
|
78978
|
+
initialLayout: prevLayout,
|
|
78979
|
+
panelConstraints: panelConstraintsArray,
|
|
78980
|
+
pivotIndices,
|
|
78981
|
+
prevLayout,
|
|
78982
|
+
trigger: "imperative-api"
|
|
78983
|
+
});
|
|
78984
|
+
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
78985
|
+
setLayout(nextLayout);
|
|
78986
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
78987
|
+
if (onLayout2) {
|
|
78988
|
+
onLayout2(nextLayout);
|
|
78989
|
+
}
|
|
78990
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
78991
|
+
}
|
|
78992
|
+
}
|
|
78993
|
+
}
|
|
78994
|
+
}, []);
|
|
78995
|
+
const getPanelSize = useCallback((panelData) => {
|
|
78996
|
+
const {
|
|
78997
|
+
layout: layout3,
|
|
78998
|
+
panelDataArray
|
|
78999
|
+
} = eagerValuesRef.current;
|
|
79000
|
+
const {
|
|
79001
|
+
panelSize
|
|
79002
|
+
} = panelDataHelper(panelDataArray, panelData, layout3);
|
|
79003
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
79004
|
+
return panelSize;
|
|
79005
|
+
}, []);
|
|
79006
|
+
const getPanelStyle = useCallback((panelData, defaultSize) => {
|
|
79007
|
+
const {
|
|
79008
|
+
panelDataArray
|
|
79009
|
+
} = eagerValuesRef.current;
|
|
79010
|
+
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
79011
|
+
return computePanelFlexBoxStyle({
|
|
79012
|
+
defaultSize,
|
|
79013
|
+
dragState,
|
|
79014
|
+
layout: layout2,
|
|
79015
|
+
panelData: panelDataArray,
|
|
79016
|
+
panelIndex
|
|
79017
|
+
});
|
|
79018
|
+
}, [dragState, layout2]);
|
|
79019
|
+
const isPanelCollapsed = useCallback((panelData) => {
|
|
79020
|
+
const {
|
|
79021
|
+
layout: layout3,
|
|
79022
|
+
panelDataArray
|
|
79023
|
+
} = eagerValuesRef.current;
|
|
79024
|
+
const {
|
|
79025
|
+
collapsedSize = 0,
|
|
79026
|
+
collapsible,
|
|
79027
|
+
panelSize
|
|
79028
|
+
} = panelDataHelper(panelDataArray, panelData, layout3);
|
|
79029
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
79030
|
+
return collapsible === true && fuzzyNumbersEqual$1(panelSize, collapsedSize);
|
|
79031
|
+
}, []);
|
|
79032
|
+
const isPanelExpanded = useCallback((panelData) => {
|
|
79033
|
+
const {
|
|
79034
|
+
layout: layout3,
|
|
79035
|
+
panelDataArray
|
|
79036
|
+
} = eagerValuesRef.current;
|
|
79037
|
+
const {
|
|
79038
|
+
collapsedSize = 0,
|
|
79039
|
+
collapsible,
|
|
79040
|
+
panelSize
|
|
79041
|
+
} = panelDataHelper(panelDataArray, panelData, layout3);
|
|
79042
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
79043
|
+
return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
|
|
79044
|
+
}, []);
|
|
79045
|
+
const registerPanel = useCallback((panelData) => {
|
|
79046
|
+
const {
|
|
79047
|
+
panelDataArray
|
|
79048
|
+
} = eagerValuesRef.current;
|
|
79049
|
+
panelDataArray.push(panelData);
|
|
79050
|
+
panelDataArray.sort((panelA, panelB) => {
|
|
79051
|
+
const orderA = panelA.order;
|
|
79052
|
+
const orderB = panelB.order;
|
|
79053
|
+
if (orderA == null && orderB == null) {
|
|
79054
|
+
return 0;
|
|
79055
|
+
} else if (orderA == null) {
|
|
79056
|
+
return -1;
|
|
79057
|
+
} else if (orderB == null) {
|
|
79058
|
+
return 1;
|
|
79059
|
+
} else {
|
|
79060
|
+
return orderA - orderB;
|
|
79061
|
+
}
|
|
79062
|
+
});
|
|
79063
|
+
eagerValuesRef.current.panelDataArrayChanged = true;
|
|
79064
|
+
forceUpdate();
|
|
79065
|
+
}, [forceUpdate]);
|
|
79066
|
+
useIsomorphicLayoutEffect(() => {
|
|
79067
|
+
if (eagerValuesRef.current.panelDataArrayChanged) {
|
|
79068
|
+
eagerValuesRef.current.panelDataArrayChanged = false;
|
|
79069
|
+
const {
|
|
79070
|
+
autoSaveId: autoSaveId2,
|
|
79071
|
+
onLayout: onLayout2,
|
|
79072
|
+
storage: storage2
|
|
79073
|
+
} = committedValuesRef.current;
|
|
79074
|
+
const {
|
|
79075
|
+
layout: prevLayout,
|
|
79076
|
+
panelDataArray
|
|
79077
|
+
} = eagerValuesRef.current;
|
|
79078
|
+
let unsafeLayout = null;
|
|
79079
|
+
if (autoSaveId2) {
|
|
79080
|
+
const state = loadPanelGroupState(autoSaveId2, panelDataArray, storage2);
|
|
79081
|
+
if (state) {
|
|
79082
|
+
panelSizeBeforeCollapseRef.current = new Map(Object.entries(state.expandToSizes));
|
|
79083
|
+
unsafeLayout = state.layout;
|
|
79084
|
+
}
|
|
79085
|
+
}
|
|
79086
|
+
if (unsafeLayout == null) {
|
|
79087
|
+
unsafeLayout = calculateUnsafeDefaultLayout({
|
|
79088
|
+
panelDataArray
|
|
79089
|
+
});
|
|
79090
|
+
}
|
|
79091
|
+
const nextLayout = validatePanelGroupLayout({
|
|
79092
|
+
layout: unsafeLayout,
|
|
79093
|
+
panelConstraints: panelDataArray.map((panelData) => panelData.constraints)
|
|
79094
|
+
});
|
|
79095
|
+
if (!areEqual(prevLayout, nextLayout)) {
|
|
79096
|
+
setLayout(nextLayout);
|
|
79097
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
79098
|
+
if (onLayout2) {
|
|
79099
|
+
onLayout2(nextLayout);
|
|
79100
|
+
}
|
|
79101
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
79102
|
+
}
|
|
79103
|
+
}
|
|
79104
|
+
});
|
|
79105
|
+
useIsomorphicLayoutEffect(() => {
|
|
79106
|
+
const eagerValues = eagerValuesRef.current;
|
|
79107
|
+
return () => {
|
|
79108
|
+
eagerValues.layout = [];
|
|
79109
|
+
};
|
|
79110
|
+
}, []);
|
|
79111
|
+
const registerResizeHandle2 = useCallback((dragHandleId) => {
|
|
79112
|
+
let isRTL2 = false;
|
|
79113
|
+
const panelGroupElement = panelGroupElementRef.current;
|
|
79114
|
+
if (panelGroupElement) {
|
|
79115
|
+
const style3 = window.getComputedStyle(panelGroupElement, null);
|
|
79116
|
+
if (style3.getPropertyValue("direction") === "rtl") {
|
|
79117
|
+
isRTL2 = true;
|
|
79118
|
+
}
|
|
79119
|
+
}
|
|
79120
|
+
return function resizeHandler(event) {
|
|
79121
|
+
event.preventDefault();
|
|
79122
|
+
const panelGroupElement2 = panelGroupElementRef.current;
|
|
79123
|
+
if (!panelGroupElement2) {
|
|
79124
|
+
return () => null;
|
|
79125
|
+
}
|
|
79126
|
+
const {
|
|
79127
|
+
direction: direction2,
|
|
79128
|
+
dragState: dragState2,
|
|
79129
|
+
id: groupId2,
|
|
79130
|
+
keyboardResizeBy: keyboardResizeBy2,
|
|
79131
|
+
onLayout: onLayout2
|
|
79132
|
+
} = committedValuesRef.current;
|
|
79133
|
+
const {
|
|
79134
|
+
layout: prevLayout,
|
|
79135
|
+
panelDataArray
|
|
79136
|
+
} = eagerValuesRef.current;
|
|
79137
|
+
const {
|
|
79138
|
+
initialLayout
|
|
79139
|
+
} = dragState2 !== null && dragState2 !== void 0 ? dragState2 : {};
|
|
79140
|
+
const pivotIndices = determinePivotIndices(groupId2, dragHandleId, panelGroupElement2);
|
|
79141
|
+
let delta = calculateDeltaPercentage(event, dragHandleId, direction2, dragState2, keyboardResizeBy2, panelGroupElement2);
|
|
79142
|
+
const isHorizontal = direction2 === "horizontal";
|
|
79143
|
+
if (isHorizontal && isRTL2) {
|
|
79144
|
+
delta = -delta;
|
|
79145
|
+
}
|
|
79146
|
+
const panelConstraints = panelDataArray.map((panelData) => panelData.constraints);
|
|
79147
|
+
const nextLayout = adjustLayoutByDelta({
|
|
79148
|
+
delta,
|
|
79149
|
+
initialLayout: initialLayout !== null && initialLayout !== void 0 ? initialLayout : prevLayout,
|
|
79150
|
+
panelConstraints,
|
|
79151
|
+
pivotIndices,
|
|
79152
|
+
prevLayout,
|
|
79153
|
+
trigger: isKeyDown(event) ? "keyboard" : "mouse-or-touch"
|
|
79154
|
+
});
|
|
79155
|
+
const layoutChanged = !compareLayouts(prevLayout, nextLayout);
|
|
79156
|
+
if (isPointerEvent(event) || isMouseEvent(event)) {
|
|
79157
|
+
if (prevDeltaRef.current != delta) {
|
|
79158
|
+
prevDeltaRef.current = delta;
|
|
79159
|
+
if (!layoutChanged && delta !== 0) {
|
|
79160
|
+
if (isHorizontal) {
|
|
79161
|
+
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_HORIZONTAL_MIN : EXCEEDED_HORIZONTAL_MAX);
|
|
79162
|
+
} else {
|
|
79163
|
+
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_VERTICAL_MIN : EXCEEDED_VERTICAL_MAX);
|
|
79164
|
+
}
|
|
79165
|
+
} else {
|
|
79166
|
+
reportConstraintsViolation(dragHandleId, 0);
|
|
79167
|
+
}
|
|
79853
79168
|
}
|
|
79854
79169
|
}
|
|
79855
|
-
|
|
79170
|
+
if (layoutChanged) {
|
|
79171
|
+
setLayout(nextLayout);
|
|
79172
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
79173
|
+
if (onLayout2) {
|
|
79174
|
+
onLayout2(nextLayout);
|
|
79175
|
+
}
|
|
79176
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
79177
|
+
}
|
|
79178
|
+
};
|
|
79856
79179
|
}, []);
|
|
79857
|
-
const
|
|
79180
|
+
const resizePanel2 = useCallback((panelData, unsafePanelSize) => {
|
|
79858
79181
|
const {
|
|
79859
79182
|
onLayout: onLayout2
|
|
79860
79183
|
} = committedValuesRef.current;
|
|
@@ -79862,1116 +79185,1793 @@ function PanelGroupWithForwardedRef({
|
|
|
79862
79185
|
layout: prevLayout,
|
|
79863
79186
|
panelDataArray
|
|
79864
79187
|
} = eagerValuesRef.current;
|
|
79865
|
-
|
|
79866
|
-
|
|
79867
|
-
|
|
79868
|
-
|
|
79869
|
-
|
|
79870
|
-
|
|
79871
|
-
|
|
79872
|
-
|
|
79873
|
-
|
|
79874
|
-
|
|
79875
|
-
|
|
79876
|
-
|
|
79877
|
-
|
|
79878
|
-
|
|
79879
|
-
|
|
79880
|
-
|
|
79881
|
-
|
|
79882
|
-
|
|
79883
|
-
|
|
79884
|
-
|
|
79885
|
-
|
|
79886
|
-
});
|
|
79887
|
-
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
79888
|
-
setLayout(nextLayout);
|
|
79889
|
-
eagerValuesRef.current.layout = nextLayout;
|
|
79890
|
-
if (onLayout2) {
|
|
79891
|
-
onLayout2(nextLayout);
|
|
79892
|
-
}
|
|
79893
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
79894
|
-
}
|
|
79188
|
+
const panelConstraintsArray = panelDataArray.map((panelData2) => panelData2.constraints);
|
|
79189
|
+
const {
|
|
79190
|
+
panelSize,
|
|
79191
|
+
pivotIndices
|
|
79192
|
+
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
79193
|
+
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
79194
|
+
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
79195
|
+
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
79196
|
+
const nextLayout = adjustLayoutByDelta({
|
|
79197
|
+
delta,
|
|
79198
|
+
initialLayout: prevLayout,
|
|
79199
|
+
panelConstraints: panelConstraintsArray,
|
|
79200
|
+
pivotIndices,
|
|
79201
|
+
prevLayout,
|
|
79202
|
+
trigger: "imperative-api"
|
|
79203
|
+
});
|
|
79204
|
+
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
79205
|
+
setLayout(nextLayout);
|
|
79206
|
+
eagerValuesRef.current.layout = nextLayout;
|
|
79207
|
+
if (onLayout2) {
|
|
79208
|
+
onLayout2(nextLayout);
|
|
79895
79209
|
}
|
|
79210
|
+
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
79896
79211
|
}
|
|
79897
79212
|
}, []);
|
|
79898
|
-
const
|
|
79213
|
+
const reevaluatePanelConstraints = useCallback((panelData, prevConstraints) => {
|
|
79899
79214
|
const {
|
|
79900
79215
|
layout: layout3,
|
|
79901
79216
|
panelDataArray
|
|
79902
79217
|
} = eagerValuesRef.current;
|
|
79903
79218
|
const {
|
|
79904
|
-
|
|
79905
|
-
|
|
79906
|
-
|
|
79907
|
-
return panelSize;
|
|
79908
|
-
}, []);
|
|
79909
|
-
const getPanelStyle = useCallback((panelData, defaultSize) => {
|
|
79910
|
-
const {
|
|
79911
|
-
panelDataArray
|
|
79912
|
-
} = eagerValuesRef.current;
|
|
79913
|
-
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
79914
|
-
return computePanelFlexBoxStyle({
|
|
79915
|
-
defaultSize,
|
|
79916
|
-
dragState,
|
|
79917
|
-
layout: layout2,
|
|
79918
|
-
panelData: panelDataArray,
|
|
79919
|
-
panelIndex
|
|
79920
|
-
});
|
|
79921
|
-
}, [dragState, layout2]);
|
|
79922
|
-
const isPanelCollapsed = useCallback((panelData) => {
|
|
79219
|
+
collapsedSize: prevCollapsedSize = 0,
|
|
79220
|
+
collapsible: prevCollapsible
|
|
79221
|
+
} = prevConstraints;
|
|
79923
79222
|
const {
|
|
79924
|
-
|
|
79925
|
-
|
|
79926
|
-
|
|
79223
|
+
collapsedSize: nextCollapsedSize = 0,
|
|
79224
|
+
collapsible: nextCollapsible,
|
|
79225
|
+
maxSize: nextMaxSize = 100,
|
|
79226
|
+
minSize: nextMinSize = 0
|
|
79227
|
+
} = panelData.constraints;
|
|
79927
79228
|
const {
|
|
79928
|
-
|
|
79929
|
-
collapsible,
|
|
79930
|
-
panelSize
|
|
79229
|
+
panelSize: prevPanelSize
|
|
79931
79230
|
} = panelDataHelper(panelDataArray, panelData, layout3);
|
|
79932
|
-
|
|
79933
|
-
|
|
79934
|
-
|
|
79935
|
-
|
|
79231
|
+
if (prevPanelSize == null) {
|
|
79232
|
+
return;
|
|
79233
|
+
}
|
|
79234
|
+
if (prevCollapsible && nextCollapsible && fuzzyNumbersEqual$1(prevPanelSize, prevCollapsedSize)) {
|
|
79235
|
+
if (!fuzzyNumbersEqual$1(prevCollapsedSize, nextCollapsedSize)) {
|
|
79236
|
+
resizePanel2(panelData, nextCollapsedSize);
|
|
79237
|
+
}
|
|
79238
|
+
} else if (prevPanelSize < nextMinSize) {
|
|
79239
|
+
resizePanel2(panelData, nextMinSize);
|
|
79240
|
+
} else if (prevPanelSize > nextMaxSize) {
|
|
79241
|
+
resizePanel2(panelData, nextMaxSize);
|
|
79242
|
+
}
|
|
79243
|
+
}, [resizePanel2]);
|
|
79244
|
+
const startDragging = useCallback((dragHandleId, event) => {
|
|
79936
79245
|
const {
|
|
79937
|
-
|
|
79938
|
-
|
|
79939
|
-
} = eagerValuesRef.current;
|
|
79246
|
+
direction: direction2
|
|
79247
|
+
} = committedValuesRef.current;
|
|
79940
79248
|
const {
|
|
79941
|
-
|
|
79942
|
-
|
|
79943
|
-
|
|
79944
|
-
|
|
79945
|
-
|
|
79946
|
-
|
|
79249
|
+
layout: layout3
|
|
79250
|
+
} = eagerValuesRef.current;
|
|
79251
|
+
if (!panelGroupElementRef.current) {
|
|
79252
|
+
return;
|
|
79253
|
+
}
|
|
79254
|
+
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
79255
|
+
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
79256
|
+
const initialCursorPosition = getResizeEventCursorPosition(direction2, event);
|
|
79257
|
+
setDragState({
|
|
79258
|
+
dragHandleId,
|
|
79259
|
+
dragHandleRect: handleElement.getBoundingClientRect(),
|
|
79260
|
+
initialCursorPosition,
|
|
79261
|
+
initialLayout: layout3
|
|
79262
|
+
});
|
|
79947
79263
|
}, []);
|
|
79948
|
-
const
|
|
79264
|
+
const stopDragging = useCallback(() => {
|
|
79265
|
+
setDragState(null);
|
|
79266
|
+
}, []);
|
|
79267
|
+
const unregisterPanel = useCallback((panelData) => {
|
|
79949
79268
|
const {
|
|
79950
79269
|
panelDataArray
|
|
79951
79270
|
} = eagerValuesRef.current;
|
|
79952
|
-
panelDataArray
|
|
79953
|
-
|
|
79954
|
-
|
|
79955
|
-
|
|
79956
|
-
|
|
79957
|
-
|
|
79958
|
-
|
|
79959
|
-
|
|
79960
|
-
|
|
79961
|
-
|
|
79962
|
-
|
|
79963
|
-
|
|
79271
|
+
const index2 = findPanelDataIndex(panelDataArray, panelData);
|
|
79272
|
+
if (index2 >= 0) {
|
|
79273
|
+
panelDataArray.splice(index2, 1);
|
|
79274
|
+
delete panelIdToLastNotifiedSizeMapRef.current[panelData.id];
|
|
79275
|
+
eagerValuesRef.current.panelDataArrayChanged = true;
|
|
79276
|
+
forceUpdate();
|
|
79277
|
+
}
|
|
79278
|
+
}, [forceUpdate]);
|
|
79279
|
+
const context2 = useMemo(() => ({
|
|
79280
|
+
collapsePanel,
|
|
79281
|
+
direction,
|
|
79282
|
+
dragState,
|
|
79283
|
+
expandPanel,
|
|
79284
|
+
getPanelSize,
|
|
79285
|
+
getPanelStyle,
|
|
79286
|
+
groupId,
|
|
79287
|
+
isPanelCollapsed,
|
|
79288
|
+
isPanelExpanded,
|
|
79289
|
+
reevaluatePanelConstraints,
|
|
79290
|
+
registerPanel,
|
|
79291
|
+
registerResizeHandle: registerResizeHandle2,
|
|
79292
|
+
resizePanel: resizePanel2,
|
|
79293
|
+
startDragging,
|
|
79294
|
+
stopDragging,
|
|
79295
|
+
unregisterPanel,
|
|
79296
|
+
panelGroupElement: panelGroupElementRef.current
|
|
79297
|
+
}), [collapsePanel, dragState, direction, expandPanel, getPanelSize, getPanelStyle, groupId, isPanelCollapsed, isPanelExpanded, reevaluatePanelConstraints, registerPanel, registerResizeHandle2, resizePanel2, startDragging, stopDragging, unregisterPanel]);
|
|
79298
|
+
const style2 = {
|
|
79299
|
+
display: "flex",
|
|
79300
|
+
flexDirection: direction === "horizontal" ? "row" : "column",
|
|
79301
|
+
height: "100%",
|
|
79302
|
+
overflow: "hidden",
|
|
79303
|
+
width: "100%"
|
|
79304
|
+
};
|
|
79305
|
+
return createElement$1(PanelGroupContext.Provider, {
|
|
79306
|
+
value: context2
|
|
79307
|
+
}, createElement$1(Type, {
|
|
79308
|
+
...rest,
|
|
79309
|
+
children: children2,
|
|
79310
|
+
className: classNameFromProps,
|
|
79311
|
+
id: idFromProps,
|
|
79312
|
+
ref: panelGroupElementRef,
|
|
79313
|
+
style: {
|
|
79314
|
+
...style2,
|
|
79315
|
+
...styleFromProps
|
|
79316
|
+
},
|
|
79317
|
+
// CSS selectors
|
|
79318
|
+
[DATA_ATTRIBUTES.group]: "",
|
|
79319
|
+
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
79320
|
+
[DATA_ATTRIBUTES.groupId]: groupId
|
|
79321
|
+
}));
|
|
79322
|
+
}
|
|
79323
|
+
const PanelGroup = forwardRef((props2, ref) => createElement$1(PanelGroupWithForwardedRef, {
|
|
79324
|
+
...props2,
|
|
79325
|
+
forwardedRef: ref
|
|
79326
|
+
}));
|
|
79327
|
+
PanelGroupWithForwardedRef.displayName = "PanelGroup";
|
|
79328
|
+
PanelGroup.displayName = "forwardRef(PanelGroup)";
|
|
79329
|
+
function findPanelDataIndex(panelDataArray, panelData) {
|
|
79330
|
+
return panelDataArray.findIndex((prevPanelData) => prevPanelData === panelData || prevPanelData.id === panelData.id);
|
|
79331
|
+
}
|
|
79332
|
+
function panelDataHelper(panelDataArray, panelData, layout2) {
|
|
79333
|
+
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
79334
|
+
const isLastPanel = panelIndex === panelDataArray.length - 1;
|
|
79335
|
+
const pivotIndices = isLastPanel ? [panelIndex - 1, panelIndex] : [panelIndex, panelIndex + 1];
|
|
79336
|
+
const panelSize = layout2[panelIndex];
|
|
79337
|
+
return {
|
|
79338
|
+
...panelData.constraints,
|
|
79339
|
+
panelSize,
|
|
79340
|
+
pivotIndices
|
|
79341
|
+
};
|
|
79342
|
+
}
|
|
79343
|
+
function useWindowSplitterResizeHandlerBehavior({
|
|
79344
|
+
disabled,
|
|
79345
|
+
handleId,
|
|
79346
|
+
resizeHandler,
|
|
79347
|
+
panelGroupElement
|
|
79348
|
+
}) {
|
|
79349
|
+
useEffect(() => {
|
|
79350
|
+
if (disabled || resizeHandler == null || panelGroupElement == null) {
|
|
79351
|
+
return;
|
|
79352
|
+
}
|
|
79353
|
+
const handleElement = getResizeHandleElement(handleId, panelGroupElement);
|
|
79354
|
+
if (handleElement == null) {
|
|
79355
|
+
return;
|
|
79356
|
+
}
|
|
79357
|
+
const onKeyDown = (event) => {
|
|
79358
|
+
if (event.defaultPrevented) {
|
|
79359
|
+
return;
|
|
79964
79360
|
}
|
|
79965
|
-
|
|
79966
|
-
|
|
79967
|
-
|
|
79968
|
-
|
|
79969
|
-
|
|
79970
|
-
|
|
79971
|
-
|
|
79972
|
-
|
|
79973
|
-
|
|
79974
|
-
|
|
79975
|
-
storage: storage2
|
|
79976
|
-
} = committedValuesRef.current;
|
|
79977
|
-
const {
|
|
79978
|
-
layout: prevLayout,
|
|
79979
|
-
panelDataArray
|
|
79980
|
-
} = eagerValuesRef.current;
|
|
79981
|
-
let unsafeLayout = null;
|
|
79982
|
-
if (autoSaveId2) {
|
|
79983
|
-
const state = loadPanelGroupState(autoSaveId2, panelDataArray, storage2);
|
|
79984
|
-
if (state) {
|
|
79985
|
-
panelSizeBeforeCollapseRef.current = new Map(Object.entries(state.expandToSizes));
|
|
79986
|
-
unsafeLayout = state.layout;
|
|
79361
|
+
switch (event.key) {
|
|
79362
|
+
case "ArrowDown":
|
|
79363
|
+
case "ArrowLeft":
|
|
79364
|
+
case "ArrowRight":
|
|
79365
|
+
case "ArrowUp":
|
|
79366
|
+
case "End":
|
|
79367
|
+
case "Home": {
|
|
79368
|
+
event.preventDefault();
|
|
79369
|
+
resizeHandler(event);
|
|
79370
|
+
break;
|
|
79987
79371
|
}
|
|
79988
|
-
|
|
79989
|
-
|
|
79990
|
-
|
|
79991
|
-
|
|
79992
|
-
|
|
79993
|
-
|
|
79994
|
-
|
|
79995
|
-
|
|
79996
|
-
|
|
79997
|
-
|
|
79998
|
-
|
|
79999
|
-
setLayout(nextLayout);
|
|
80000
|
-
eagerValuesRef.current.layout = nextLayout;
|
|
80001
|
-
if (onLayout2) {
|
|
80002
|
-
onLayout2(nextLayout);
|
|
79372
|
+
case "F6": {
|
|
79373
|
+
event.preventDefault();
|
|
79374
|
+
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
|
|
79375
|
+
assert(groupId, `No group element found for id "${groupId}"`);
|
|
79376
|
+
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
79377
|
+
const index2 = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
79378
|
+
assert(index2 !== null, `No resize element found for id "${handleId}"`);
|
|
79379
|
+
const nextIndex = event.shiftKey ? index2 > 0 ? index2 - 1 : handles.length - 1 : index2 + 1 < handles.length ? index2 + 1 : 0;
|
|
79380
|
+
const nextHandle = handles[nextIndex];
|
|
79381
|
+
nextHandle.focus();
|
|
79382
|
+
break;
|
|
80003
79383
|
}
|
|
80004
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
80005
79384
|
}
|
|
80006
|
-
}
|
|
80007
|
-
|
|
80008
|
-
useIsomorphicLayoutEffect(() => {
|
|
80009
|
-
const eagerValues = eagerValuesRef.current;
|
|
79385
|
+
};
|
|
79386
|
+
handleElement.addEventListener("keydown", onKeyDown);
|
|
80010
79387
|
return () => {
|
|
80011
|
-
|
|
79388
|
+
handleElement.removeEventListener("keydown", onKeyDown);
|
|
80012
79389
|
};
|
|
80013
|
-
}, []);
|
|
80014
|
-
|
|
80015
|
-
|
|
80016
|
-
|
|
80017
|
-
|
|
80018
|
-
|
|
80019
|
-
|
|
80020
|
-
|
|
80021
|
-
|
|
79390
|
+
}, [panelGroupElement, disabled, handleId, resizeHandler]);
|
|
79391
|
+
}
|
|
79392
|
+
function PanelResizeHandle({
|
|
79393
|
+
children: children2 = null,
|
|
79394
|
+
className: classNameFromProps = "",
|
|
79395
|
+
disabled = false,
|
|
79396
|
+
hitAreaMargins,
|
|
79397
|
+
id: idFromProps,
|
|
79398
|
+
onBlur,
|
|
79399
|
+
onClick,
|
|
79400
|
+
onDragging,
|
|
79401
|
+
onFocus,
|
|
79402
|
+
onPointerDown,
|
|
79403
|
+
onPointerUp,
|
|
79404
|
+
style: styleFromProps = {},
|
|
79405
|
+
tabIndex = 0,
|
|
79406
|
+
tagName: Type = "div",
|
|
79407
|
+
...rest
|
|
79408
|
+
}) {
|
|
79409
|
+
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
79410
|
+
const elementRef = useRef(null);
|
|
79411
|
+
const callbacksRef = useRef({
|
|
79412
|
+
onClick,
|
|
79413
|
+
onDragging,
|
|
79414
|
+
onPointerDown,
|
|
79415
|
+
onPointerUp
|
|
79416
|
+
});
|
|
79417
|
+
useEffect(() => {
|
|
79418
|
+
callbacksRef.current.onClick = onClick;
|
|
79419
|
+
callbacksRef.current.onDragging = onDragging;
|
|
79420
|
+
callbacksRef.current.onPointerDown = onPointerDown;
|
|
79421
|
+
callbacksRef.current.onPointerUp = onPointerUp;
|
|
79422
|
+
});
|
|
79423
|
+
const panelGroupContext = useContext$1(PanelGroupContext);
|
|
79424
|
+
if (panelGroupContext === null) {
|
|
79425
|
+
throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
|
|
79426
|
+
}
|
|
79427
|
+
const {
|
|
79428
|
+
direction,
|
|
79429
|
+
groupId,
|
|
79430
|
+
registerResizeHandle: registerResizeHandleWithParentGroup,
|
|
79431
|
+
startDragging,
|
|
79432
|
+
stopDragging,
|
|
79433
|
+
panelGroupElement
|
|
79434
|
+
} = panelGroupContext;
|
|
79435
|
+
const resizeHandleId = useUniqueId(idFromProps);
|
|
79436
|
+
const [state, setState] = useState("inactive");
|
|
79437
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
79438
|
+
const [resizeHandler, setResizeHandler] = useState(null);
|
|
79439
|
+
const committedValuesRef = useRef({
|
|
79440
|
+
state
|
|
79441
|
+
});
|
|
79442
|
+
useIsomorphicLayoutEffect(() => {
|
|
79443
|
+
committedValuesRef.current.state = state;
|
|
79444
|
+
});
|
|
79445
|
+
useEffect(() => {
|
|
79446
|
+
if (disabled) {
|
|
79447
|
+
setResizeHandler(null);
|
|
79448
|
+
} else {
|
|
79449
|
+
const resizeHandler2 = registerResizeHandleWithParentGroup(resizeHandleId);
|
|
79450
|
+
setResizeHandler(() => resizeHandler2);
|
|
80022
79451
|
}
|
|
80023
|
-
|
|
80024
|
-
|
|
80025
|
-
|
|
80026
|
-
|
|
80027
|
-
|
|
80028
|
-
|
|
80029
|
-
|
|
80030
|
-
|
|
80031
|
-
|
|
80032
|
-
|
|
80033
|
-
|
|
80034
|
-
|
|
80035
|
-
|
|
80036
|
-
|
|
80037
|
-
layout: prevLayout,
|
|
80038
|
-
panelDataArray
|
|
80039
|
-
} = eagerValuesRef.current;
|
|
80040
|
-
const {
|
|
80041
|
-
initialLayout
|
|
80042
|
-
} = dragState2 !== null && dragState2 !== void 0 ? dragState2 : {};
|
|
80043
|
-
const pivotIndices = determinePivotIndices(groupId2, dragHandleId, panelGroupElement2);
|
|
80044
|
-
let delta = calculateDeltaPercentage(event, dragHandleId, direction2, dragState2, keyboardResizeBy2, panelGroupElement2);
|
|
80045
|
-
const isHorizontal = direction2 === "horizontal";
|
|
80046
|
-
if (isHorizontal && isRTL2) {
|
|
80047
|
-
delta = -delta;
|
|
79452
|
+
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
79453
|
+
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
79454
|
+
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
79455
|
+
useEffect(() => {
|
|
79456
|
+
if (disabled || resizeHandler == null) {
|
|
79457
|
+
return;
|
|
79458
|
+
}
|
|
79459
|
+
const element = elementRef.current;
|
|
79460
|
+
assert(element, "Element ref not attached");
|
|
79461
|
+
let didMove = false;
|
|
79462
|
+
const setResizeHandlerState = (action, isActive, event) => {
|
|
79463
|
+
if (!isActive) {
|
|
79464
|
+
setState("inactive");
|
|
79465
|
+
return;
|
|
80048
79466
|
}
|
|
80049
|
-
|
|
80050
|
-
|
|
80051
|
-
|
|
80052
|
-
|
|
80053
|
-
|
|
80054
|
-
|
|
80055
|
-
|
|
80056
|
-
|
|
80057
|
-
|
|
80058
|
-
|
|
80059
|
-
|
|
80060
|
-
|
|
80061
|
-
|
|
80062
|
-
|
|
80063
|
-
|
|
80064
|
-
|
|
80065
|
-
|
|
80066
|
-
|
|
80067
|
-
|
|
80068
|
-
|
|
80069
|
-
|
|
79467
|
+
switch (action) {
|
|
79468
|
+
case "down": {
|
|
79469
|
+
setState("drag");
|
|
79470
|
+
didMove = false;
|
|
79471
|
+
assert(event, 'Expected event to be defined for "down" action');
|
|
79472
|
+
startDragging(resizeHandleId, event);
|
|
79473
|
+
const {
|
|
79474
|
+
onDragging: onDragging2,
|
|
79475
|
+
onPointerDown: onPointerDown2
|
|
79476
|
+
} = callbacksRef.current;
|
|
79477
|
+
onDragging2 === null || onDragging2 === void 0 ? void 0 : onDragging2(true);
|
|
79478
|
+
onPointerDown2 === null || onPointerDown2 === void 0 ? void 0 : onPointerDown2();
|
|
79479
|
+
break;
|
|
79480
|
+
}
|
|
79481
|
+
case "move": {
|
|
79482
|
+
const {
|
|
79483
|
+
state: state2
|
|
79484
|
+
} = committedValuesRef.current;
|
|
79485
|
+
didMove = true;
|
|
79486
|
+
if (state2 !== "drag") {
|
|
79487
|
+
setState("hover");
|
|
79488
|
+
}
|
|
79489
|
+
assert(event, 'Expected event to be defined for "move" action');
|
|
79490
|
+
resizeHandler(event);
|
|
79491
|
+
break;
|
|
79492
|
+
}
|
|
79493
|
+
case "up": {
|
|
79494
|
+
setState("hover");
|
|
79495
|
+
stopDragging();
|
|
79496
|
+
const {
|
|
79497
|
+
onClick: onClick2,
|
|
79498
|
+
onDragging: onDragging2,
|
|
79499
|
+
onPointerUp: onPointerUp2
|
|
79500
|
+
} = callbacksRef.current;
|
|
79501
|
+
onDragging2 === null || onDragging2 === void 0 ? void 0 : onDragging2(false);
|
|
79502
|
+
onPointerUp2 === null || onPointerUp2 === void 0 ? void 0 : onPointerUp2();
|
|
79503
|
+
if (!didMove) {
|
|
79504
|
+
onClick2 === null || onClick2 === void 0 ? void 0 : onClick2();
|
|
80070
79505
|
}
|
|
79506
|
+
break;
|
|
80071
79507
|
}
|
|
80072
79508
|
}
|
|
80073
|
-
if (layoutChanged) {
|
|
80074
|
-
setLayout(nextLayout);
|
|
80075
|
-
eagerValuesRef.current.layout = nextLayout;
|
|
80076
|
-
if (onLayout2) {
|
|
80077
|
-
onLayout2(nextLayout);
|
|
80078
|
-
}
|
|
80079
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
80080
|
-
}
|
|
80081
79509
|
};
|
|
80082
|
-
|
|
80083
|
-
|
|
80084
|
-
|
|
80085
|
-
|
|
80086
|
-
|
|
80087
|
-
|
|
80088
|
-
|
|
80089
|
-
|
|
80090
|
-
|
|
80091
|
-
|
|
80092
|
-
|
|
80093
|
-
|
|
80094
|
-
|
|
80095
|
-
|
|
80096
|
-
|
|
80097
|
-
|
|
80098
|
-
|
|
80099
|
-
|
|
80100
|
-
|
|
80101
|
-
|
|
80102
|
-
|
|
80103
|
-
|
|
80104
|
-
|
|
80105
|
-
|
|
80106
|
-
|
|
80107
|
-
|
|
80108
|
-
|
|
80109
|
-
|
|
80110
|
-
|
|
80111
|
-
|
|
80112
|
-
|
|
80113
|
-
|
|
79510
|
+
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
79511
|
+
coarse: coarseHitAreaMargins,
|
|
79512
|
+
fine: fineHitAreaMargins
|
|
79513
|
+
}, setResizeHandlerState);
|
|
79514
|
+
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
79515
|
+
useWindowSplitterResizeHandlerBehavior({
|
|
79516
|
+
disabled,
|
|
79517
|
+
handleId: resizeHandleId,
|
|
79518
|
+
resizeHandler,
|
|
79519
|
+
panelGroupElement
|
|
79520
|
+
});
|
|
79521
|
+
const style2 = {
|
|
79522
|
+
touchAction: "none",
|
|
79523
|
+
userSelect: "none"
|
|
79524
|
+
};
|
|
79525
|
+
return createElement$1(Type, {
|
|
79526
|
+
...rest,
|
|
79527
|
+
children: children2,
|
|
79528
|
+
className: classNameFromProps,
|
|
79529
|
+
id: idFromProps,
|
|
79530
|
+
onBlur: () => {
|
|
79531
|
+
setIsFocused(false);
|
|
79532
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
79533
|
+
},
|
|
79534
|
+
onFocus: () => {
|
|
79535
|
+
setIsFocused(true);
|
|
79536
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
79537
|
+
},
|
|
79538
|
+
ref: elementRef,
|
|
79539
|
+
role: "separator",
|
|
79540
|
+
style: {
|
|
79541
|
+
...style2,
|
|
79542
|
+
...styleFromProps
|
|
79543
|
+
},
|
|
79544
|
+
tabIndex,
|
|
79545
|
+
// CSS selectors
|
|
79546
|
+
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
79547
|
+
[DATA_ATTRIBUTES.groupId]: groupId,
|
|
79548
|
+
[DATA_ATTRIBUTES.resizeHandle]: "",
|
|
79549
|
+
[DATA_ATTRIBUTES.resizeHandleActive]: state === "drag" ? "pointer" : isFocused ? "keyboard" : void 0,
|
|
79550
|
+
[DATA_ATTRIBUTES.resizeHandleEnabled]: !disabled,
|
|
79551
|
+
[DATA_ATTRIBUTES.resizeHandleId]: resizeHandleId,
|
|
79552
|
+
[DATA_ATTRIBUTES.resizeHandleState]: state
|
|
79553
|
+
});
|
|
79554
|
+
}
|
|
79555
|
+
PanelResizeHandle.displayName = "PanelResizeHandle";
|
|
79556
|
+
const ResizablePanelGroup = ({
|
|
79557
|
+
className: className2,
|
|
79558
|
+
...props2
|
|
79559
|
+
}) => /* @__PURE__ */ jsx(
|
|
79560
|
+
PanelGroup,
|
|
79561
|
+
{
|
|
79562
|
+
className: cn(
|
|
79563
|
+
"flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
|
|
79564
|
+
className2
|
|
79565
|
+
),
|
|
79566
|
+
...props2
|
|
79567
|
+
}
|
|
79568
|
+
);
|
|
79569
|
+
const ResizablePanel = Panel;
|
|
79570
|
+
const ResizableHandle = ({
|
|
79571
|
+
withHandle,
|
|
79572
|
+
className: className2,
|
|
79573
|
+
...props2
|
|
79574
|
+
}) => /* @__PURE__ */ jsx(
|
|
79575
|
+
PanelResizeHandle,
|
|
79576
|
+
{
|
|
79577
|
+
className: cn(
|
|
79578
|
+
"relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",
|
|
79579
|
+
className2
|
|
79580
|
+
),
|
|
79581
|
+
...props2,
|
|
79582
|
+
children: withHandle && /* @__PURE__ */ jsx("div", { className: "z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border", children: /* @__PURE__ */ jsx(GripVertical, { className: "h-2.5 w-2.5" }) })
|
|
79583
|
+
}
|
|
79584
|
+
);
|
|
79585
|
+
const sortAutomationSteps = (args) => {
|
|
79586
|
+
const { steps, rootActionId } = args;
|
|
79587
|
+
if (!steps || !rootActionId) return steps ?? [];
|
|
79588
|
+
const stepMap = new Map(
|
|
79589
|
+
steps.map((step) => [step.actionMetadata.currentActionId, step])
|
|
79590
|
+
);
|
|
79591
|
+
const startStep = stepMap.get(rootActionId);
|
|
79592
|
+
if (!startStep) return steps;
|
|
79593
|
+
const sortedSteps = [];
|
|
79594
|
+
let currentStep = startStep;
|
|
79595
|
+
while (currentStep) {
|
|
79596
|
+
sortedSteps.push(currentStep);
|
|
79597
|
+
const nextId = currentStep.actionMetadata.nextActionId;
|
|
79598
|
+
if (!nextId) break;
|
|
79599
|
+
currentStep = stepMap.get(nextId);
|
|
79600
|
+
}
|
|
79601
|
+
return sortedSteps;
|
|
79602
|
+
};
|
|
79603
|
+
var BuiltInActionIds = /* @__PURE__ */ ((BuiltInActionIds2) => {
|
|
79604
|
+
BuiltInActionIds2["EditAudience"] = "edit-audience";
|
|
79605
|
+
BuiltInActionIds2["EditTime"] = "edit-time";
|
|
79606
|
+
return BuiltInActionIds2;
|
|
79607
|
+
})(BuiltInActionIds || {});
|
|
79608
|
+
const AutomationFlowLabel = ({ copyText }) => {
|
|
79609
|
+
return /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: copyText });
|
|
79610
|
+
};
|
|
79611
|
+
const DEFAULT_BG = "rgba(245, 246, 247, 1)";
|
|
79612
|
+
const STEP_METADATA = {
|
|
79613
|
+
[ActionType.SEND_COMMUNICATION]: {
|
|
79614
|
+
color: {
|
|
79615
|
+
bg: "rgba(205, 241, 225, 1)",
|
|
79616
|
+
text: "rgba(30, 108, 74, 1)",
|
|
79617
|
+
bgUnselected: DEFAULT_BG
|
|
79618
|
+
},
|
|
79619
|
+
clickable: true
|
|
79620
|
+
},
|
|
79621
|
+
[ActionType.WAIT_UNTIL_NEXT_FIXED_TIME]: {
|
|
79622
|
+
color: {
|
|
79623
|
+
bg: DEFAULT_BG
|
|
79624
|
+
},
|
|
79625
|
+
clickable: false
|
|
79626
|
+
}
|
|
79627
|
+
};
|
|
79628
|
+
const STEP_TYPES = {
|
|
79629
|
+
[ActionType.SEND_COMMUNICATION]: "Send Email & SMS",
|
|
79630
|
+
[ActionType.WAIT_UNTIL_NEXT_FIXED_TIME]: "Wait"
|
|
79631
|
+
};
|
|
79632
|
+
const BasicsButton = ({
|
|
79633
|
+
children: children2,
|
|
79634
|
+
onClick,
|
|
79635
|
+
iconBgColor,
|
|
79636
|
+
iconStrokeColor,
|
|
79637
|
+
Icon: Icon2,
|
|
79638
|
+
disabled = false,
|
|
79639
|
+
selected = false
|
|
79640
|
+
}) => {
|
|
79641
|
+
const IconComponent = Icon2;
|
|
79642
|
+
return /* @__PURE__ */ jsx(
|
|
79643
|
+
motion.div,
|
|
79644
|
+
{
|
|
79645
|
+
layout: true,
|
|
79646
|
+
initial: { opacity: 0, y: 20 },
|
|
79647
|
+
animate: { opacity: 1, y: 0 },
|
|
79648
|
+
exit: { opacity: 0, y: -20 },
|
|
79649
|
+
transition: { duration: 0.2, ease: "easeInOut" },
|
|
79650
|
+
style: {
|
|
79651
|
+
backgroundColor: selected ? iconBgColor : DEFAULT_BG
|
|
79652
|
+
},
|
|
79653
|
+
className: cn$1(
|
|
79654
|
+
"flex gap-2 items-center rounded-md transition-colors group",
|
|
79655
|
+
"border-2 border-transparent overflow-hidden",
|
|
79656
|
+
!disabled && "hover:border-primary cursor-pointer",
|
|
79657
|
+
selected && "border-primary"
|
|
79658
|
+
),
|
|
79659
|
+
children: /* @__PURE__ */ jsxs(
|
|
79660
|
+
Button$1,
|
|
79661
|
+
{
|
|
79662
|
+
variant: "ghost",
|
|
79663
|
+
className: "text-left w-full h-full flex items-center gap-2 min-h-none whitespace-normal rounded-none px-2 group/trigger-audience",
|
|
79664
|
+
onClick,
|
|
79665
|
+
children: [
|
|
79666
|
+
/* @__PURE__ */ jsx(
|
|
79667
|
+
"div",
|
|
79668
|
+
{
|
|
79669
|
+
className: cn$1(
|
|
79670
|
+
"bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",
|
|
79671
|
+
!disabled && "group-hover/trigger-audience:bg-background",
|
|
79672
|
+
iconBgColor
|
|
79673
|
+
),
|
|
79674
|
+
children: /* @__PURE__ */ jsx(
|
|
79675
|
+
IconComponent,
|
|
79676
|
+
{
|
|
79677
|
+
className: cn$1(
|
|
79678
|
+
"w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",
|
|
79679
|
+
iconStrokeColor
|
|
79680
|
+
)
|
|
79681
|
+
}
|
|
79682
|
+
)
|
|
79683
|
+
}
|
|
79684
|
+
),
|
|
79685
|
+
children2
|
|
79686
|
+
]
|
|
79687
|
+
}
|
|
79688
|
+
)
|
|
80114
79689
|
}
|
|
80115
|
-
|
|
80116
|
-
|
|
80117
|
-
|
|
80118
|
-
|
|
80119
|
-
|
|
80120
|
-
|
|
80121
|
-
|
|
80122
|
-
|
|
80123
|
-
|
|
80124
|
-
|
|
80125
|
-
|
|
80126
|
-
|
|
80127
|
-
|
|
80128
|
-
|
|
80129
|
-
|
|
80130
|
-
|
|
80131
|
-
|
|
80132
|
-
|
|
80133
|
-
|
|
80134
|
-
|
|
79690
|
+
);
|
|
79691
|
+
};
|
|
79692
|
+
const SegmentPill = ({ segmentName }) => {
|
|
79693
|
+
return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center bg-white border border-gray-200 rounded-md px-2 py-0.5 text-sm font-medium shadow-sm", children: segmentName });
|
|
79694
|
+
};
|
|
79695
|
+
const AutomationAudienceSelector = () => {
|
|
79696
|
+
const automation2 = useAutomation();
|
|
79697
|
+
const {
|
|
79698
|
+
setActionId: setActionId2,
|
|
79699
|
+
state: { selectedActionId }
|
|
79700
|
+
} = useContext$1(Context);
|
|
79701
|
+
const [includeSegmentIds, setIncludeSegmentIds] = useState(
|
|
79702
|
+
automation2?.includeSegmentIds || null
|
|
79703
|
+
);
|
|
79704
|
+
const [excludeSegmentIds, setExcludeSegmentIds] = useState(
|
|
79705
|
+
automation2?.excludeSegmentIds || null
|
|
79706
|
+
);
|
|
79707
|
+
const { segments } = useListSegments();
|
|
79708
|
+
const getAllUsersSegment = useCallback(() => {
|
|
79709
|
+
return segments?.find(
|
|
79710
|
+
(segment2) => segment2.type === BusinessSegmentTypeEnum.ALL_USERS
|
|
79711
|
+
);
|
|
79712
|
+
}, [segments]);
|
|
79713
|
+
useEffect(() => {
|
|
79714
|
+
if (!automation2 || !segments) {
|
|
80135
79715
|
return;
|
|
80136
79716
|
}
|
|
80137
|
-
if (
|
|
80138
|
-
|
|
80139
|
-
|
|
79717
|
+
if (includeSegmentIds === null && excludeSegmentIds === null) {
|
|
79718
|
+
setIncludeSegmentIds(automation2?.includeSegmentIds || null);
|
|
79719
|
+
setExcludeSegmentIds(automation2?.excludeSegmentIds || null);
|
|
79720
|
+
if (automation2.includeSegmentIds.length === 0 && automation2.excludeSegmentIds.length === 0) {
|
|
79721
|
+
setIncludeSegmentIds([getAllUsersSegment()?.id || ""]);
|
|
79722
|
+
setExcludeSegmentIds([]);
|
|
79723
|
+
}
|
|
79724
|
+
} else {
|
|
79725
|
+
if (JSON.stringify(automation2.includeSegmentIds) !== JSON.stringify(includeSegmentIds)) {
|
|
79726
|
+
setIncludeSegmentIds(automation2.includeSegmentIds);
|
|
79727
|
+
}
|
|
79728
|
+
if (JSON.stringify(automation2.excludeSegmentIds) !== JSON.stringify(excludeSegmentIds)) {
|
|
79729
|
+
setExcludeSegmentIds(automation2.excludeSegmentIds);
|
|
80140
79730
|
}
|
|
80141
|
-
} else if (prevPanelSize < nextMinSize) {
|
|
80142
|
-
resizePanel2(panelData, nextMinSize);
|
|
80143
|
-
} else if (prevPanelSize > nextMaxSize) {
|
|
80144
|
-
resizePanel2(panelData, nextMaxSize);
|
|
80145
|
-
}
|
|
80146
|
-
}, [resizePanel2]);
|
|
80147
|
-
const startDragging = useCallback((dragHandleId, event) => {
|
|
80148
|
-
const {
|
|
80149
|
-
direction: direction2
|
|
80150
|
-
} = committedValuesRef.current;
|
|
80151
|
-
const {
|
|
80152
|
-
layout: layout3
|
|
80153
|
-
} = eagerValuesRef.current;
|
|
80154
|
-
if (!panelGroupElementRef.current) {
|
|
80155
|
-
return;
|
|
80156
79731
|
}
|
|
80157
|
-
|
|
80158
|
-
|
|
80159
|
-
|
|
80160
|
-
|
|
80161
|
-
|
|
80162
|
-
|
|
80163
|
-
|
|
80164
|
-
|
|
80165
|
-
|
|
80166
|
-
}
|
|
80167
|
-
|
|
80168
|
-
|
|
80169
|
-
|
|
80170
|
-
|
|
80171
|
-
|
|
80172
|
-
|
|
80173
|
-
|
|
80174
|
-
|
|
80175
|
-
|
|
80176
|
-
|
|
80177
|
-
|
|
80178
|
-
|
|
80179
|
-
|
|
79732
|
+
}, [
|
|
79733
|
+
automation2,
|
|
79734
|
+
excludeSegmentIds,
|
|
79735
|
+
includeSegmentIds,
|
|
79736
|
+
segments,
|
|
79737
|
+
getAllUsersSegment
|
|
79738
|
+
]);
|
|
79739
|
+
if (!automation2 || !includeSegmentIds || !excludeSegmentIds) {
|
|
79740
|
+
return null;
|
|
79741
|
+
}
|
|
79742
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
79743
|
+
BasicsButton,
|
|
79744
|
+
{
|
|
79745
|
+
selected: selectedActionId === BuiltInActionIds.EditAudience,
|
|
79746
|
+
iconBgColor: "bg-purple-50",
|
|
79747
|
+
iconStrokeColor: "stroke-purple-500",
|
|
79748
|
+
onClick: () => {
|
|
79749
|
+
setActionId2(BuiltInActionIds.EditAudience);
|
|
79750
|
+
},
|
|
79751
|
+
Icon: IconDefinitions.AudienceIcon,
|
|
79752
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1", children: [
|
|
79753
|
+
/* @__PURE__ */ jsx(MinorText, { children: "Audience" }),
|
|
79754
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
79755
|
+
/* @__PURE__ */ jsx(
|
|
79756
|
+
AutomationFlowLabel,
|
|
79757
|
+
{
|
|
79758
|
+
copyText: `Send to all ${t$1("engage:user", {
|
|
79759
|
+
count: 2
|
|
79760
|
+
})} in ${includeSegmentIds.length === 1 ? "this" : "these"} ${t$1(
|
|
79761
|
+
"engage:segment",
|
|
79762
|
+
{
|
|
79763
|
+
count: includeSegmentIds.length
|
|
79764
|
+
}
|
|
79765
|
+
).toLowerCase()}`
|
|
79766
|
+
}
|
|
79767
|
+
),
|
|
79768
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-1 flex-wrap", children: includeSegmentIds.map((id2) => {
|
|
79769
|
+
const segment2 = segments?.find((segment22) => segment22.id === id2);
|
|
79770
|
+
if (!segment2) return null;
|
|
79771
|
+
return /* @__PURE__ */ jsx(SegmentPill, { segmentName: segment2.name }, id2);
|
|
79772
|
+
}) })
|
|
79773
|
+
] })
|
|
79774
|
+
] })
|
|
79775
|
+
}
|
|
79776
|
+
) });
|
|
79777
|
+
};
|
|
79778
|
+
const AutomationEditorTrigger = () => {
|
|
79779
|
+
const automation2 = useAutomation();
|
|
79780
|
+
const {
|
|
79781
|
+
setActionId: setActionId2,
|
|
79782
|
+
state: { selectedActionId }
|
|
79783
|
+
} = useContext$1(Context);
|
|
79784
|
+
const { segments } = useListSegments();
|
|
79785
|
+
const START_THIS_AUTOMATION_COPY_TEXT = `Start this ${t$1("engage:automation").toLowerCase()}`;
|
|
79786
|
+
if (!automation2 || !segments) {
|
|
79787
|
+
return null;
|
|
79788
|
+
}
|
|
79789
|
+
const renderTriggerData = () => {
|
|
79790
|
+
switch (automation2.triggerType) {
|
|
79791
|
+
case AutomationTriggerType.TRIGGER_BASED: {
|
|
79792
|
+
if (automation2.triggerMetadata.triggerType !== AutomationTriggerType.TRIGGER_BASED || automation2.triggerMetadata.eventName !== "USER_JOINED_SEGMENT" || !automation2.triggerMetadata.eventFilter.segment_id) {
|
|
79793
|
+
return null;
|
|
79794
|
+
}
|
|
79795
|
+
const segmentId = automation2.triggerMetadata.eventFilter.segment_id;
|
|
79796
|
+
const segmentName = segments.find(
|
|
79797
|
+
(segment2) => segment2.id === segmentId
|
|
79798
|
+
)?.name;
|
|
79799
|
+
if (!segmentName) {
|
|
79800
|
+
return null;
|
|
79801
|
+
}
|
|
79802
|
+
return /* @__PURE__ */ jsx(
|
|
79803
|
+
BasicsButton,
|
|
79804
|
+
{
|
|
79805
|
+
iconBgColor: "bg-amber-100",
|
|
79806
|
+
disabled: true,
|
|
79807
|
+
iconStrokeColor: "stroke-amber-500",
|
|
79808
|
+
onClick: () => {
|
|
79809
|
+
},
|
|
79810
|
+
Icon: IconDefinitions.TriggerIcon,
|
|
79811
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1", children: [
|
|
79812
|
+
/* @__PURE__ */ jsx(MinorText, { children: START_THIS_AUTOMATION_COPY_TEXT }),
|
|
79813
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
79814
|
+
/* @__PURE__ */ jsx(
|
|
79815
|
+
AutomationFlowLabel,
|
|
79816
|
+
{
|
|
79817
|
+
copyText: `When ${t$1("engage:user").toLowerCase()} joins the`
|
|
79818
|
+
}
|
|
79819
|
+
),
|
|
79820
|
+
/* @__PURE__ */ jsx(SegmentPill, { segmentName })
|
|
79821
|
+
] })
|
|
79822
|
+
] })
|
|
79823
|
+
}
|
|
79824
|
+
);
|
|
79825
|
+
}
|
|
79826
|
+
case AutomationTriggerType.ONE_TIME: {
|
|
79827
|
+
const needsDate = !automation2.triggerMetadata || !("scheduledAt" in automation2.triggerMetadata);
|
|
79828
|
+
return /* @__PURE__ */ jsxs(
|
|
79829
|
+
BasicsButton,
|
|
79830
|
+
{
|
|
79831
|
+
iconBgColor: "bg-amber-100",
|
|
79832
|
+
iconStrokeColor: "stroke-amber-500",
|
|
79833
|
+
onClick: () => {
|
|
79834
|
+
setActionId2(BuiltInActionIds.EditTime);
|
|
79835
|
+
},
|
|
79836
|
+
selected: selectedActionId === BuiltInActionIds.EditTime,
|
|
79837
|
+
Icon: IconDefinitions.TriggerIcon,
|
|
79838
|
+
children: [
|
|
79839
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1", children: [
|
|
79840
|
+
/* @__PURE__ */ jsx(MinorText, { children: START_THIS_AUTOMATION_COPY_TEXT }),
|
|
79841
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
79842
|
+
needsDate ? /* @__PURE__ */ jsx(
|
|
79843
|
+
AutomationFlowLabel,
|
|
79844
|
+
{
|
|
79845
|
+
copyText: `Click to set the date and time for this ${t$1("engage:one_time")}`
|
|
79846
|
+
}
|
|
79847
|
+
) : /* @__PURE__ */ jsx(AutomationFlowLabel, { copyText: "Bulk send at" }),
|
|
79848
|
+
needsDate === false && "scheduledAt" in automation2.triggerMetadata && automation2.triggerMetadata.scheduledAt && /* @__PURE__ */ jsx("div", { className: "text-xs font-medium", children: /* @__PURE__ */ jsx(
|
|
79849
|
+
SegmentPill,
|
|
79850
|
+
{
|
|
79851
|
+
segmentName: format$1(
|
|
79852
|
+
new Date(automation2.triggerMetadata.scheduledAt),
|
|
79853
|
+
"h:mma MM/dd/yy"
|
|
79854
|
+
)
|
|
79855
|
+
}
|
|
79856
|
+
) })
|
|
79857
|
+
] })
|
|
79858
|
+
] }),
|
|
79859
|
+
/* @__PURE__ */ jsx("div", { className: "", children: needsDate && /* @__PURE__ */ jsx(AlertIcon, { className: "group-hover/trigger-send-date:bg-red-500 group-hover/trigger-send-date:text-white transition-colors" }) })
|
|
79860
|
+
]
|
|
79861
|
+
}
|
|
79862
|
+
);
|
|
79863
|
+
}
|
|
79864
|
+
default:
|
|
79865
|
+
throw UnreachableCaseStatement(
|
|
79866
|
+
automation2.triggerType,
|
|
79867
|
+
AutomationTriggerType
|
|
79868
|
+
);
|
|
80180
79869
|
}
|
|
80181
|
-
}, [forceUpdate]);
|
|
80182
|
-
const context2 = useMemo(() => ({
|
|
80183
|
-
collapsePanel,
|
|
80184
|
-
direction,
|
|
80185
|
-
dragState,
|
|
80186
|
-
expandPanel,
|
|
80187
|
-
getPanelSize,
|
|
80188
|
-
getPanelStyle,
|
|
80189
|
-
groupId,
|
|
80190
|
-
isPanelCollapsed,
|
|
80191
|
-
isPanelExpanded,
|
|
80192
|
-
reevaluatePanelConstraints,
|
|
80193
|
-
registerPanel,
|
|
80194
|
-
registerResizeHandle: registerResizeHandle2,
|
|
80195
|
-
resizePanel: resizePanel2,
|
|
80196
|
-
startDragging,
|
|
80197
|
-
stopDragging,
|
|
80198
|
-
unregisterPanel,
|
|
80199
|
-
panelGroupElement: panelGroupElementRef.current
|
|
80200
|
-
}), [collapsePanel, dragState, direction, expandPanel, getPanelSize, getPanelStyle, groupId, isPanelCollapsed, isPanelExpanded, reevaluatePanelConstraints, registerPanel, registerResizeHandle2, resizePanel2, startDragging, stopDragging, unregisterPanel]);
|
|
80201
|
-
const style2 = {
|
|
80202
|
-
display: "flex",
|
|
80203
|
-
flexDirection: direction === "horizontal" ? "row" : "column",
|
|
80204
|
-
height: "100%",
|
|
80205
|
-
overflow: "hidden",
|
|
80206
|
-
width: "100%"
|
|
80207
|
-
};
|
|
80208
|
-
return createElement$1(PanelGroupContext.Provider, {
|
|
80209
|
-
value: context2
|
|
80210
|
-
}, createElement$1(Type, {
|
|
80211
|
-
...rest,
|
|
80212
|
-
children: children2,
|
|
80213
|
-
className: classNameFromProps,
|
|
80214
|
-
id: idFromProps,
|
|
80215
|
-
ref: panelGroupElementRef,
|
|
80216
|
-
style: {
|
|
80217
|
-
...style2,
|
|
80218
|
-
...styleFromProps
|
|
80219
|
-
},
|
|
80220
|
-
// CSS selectors
|
|
80221
|
-
[DATA_ATTRIBUTES.group]: "",
|
|
80222
|
-
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
80223
|
-
[DATA_ATTRIBUTES.groupId]: groupId
|
|
80224
|
-
}));
|
|
80225
|
-
}
|
|
80226
|
-
const PanelGroup = forwardRef((props2, ref) => createElement$1(PanelGroupWithForwardedRef, {
|
|
80227
|
-
...props2,
|
|
80228
|
-
forwardedRef: ref
|
|
80229
|
-
}));
|
|
80230
|
-
PanelGroupWithForwardedRef.displayName = "PanelGroup";
|
|
80231
|
-
PanelGroup.displayName = "forwardRef(PanelGroup)";
|
|
80232
|
-
function findPanelDataIndex(panelDataArray, panelData) {
|
|
80233
|
-
return panelDataArray.findIndex((prevPanelData) => prevPanelData === panelData || prevPanelData.id === panelData.id);
|
|
80234
|
-
}
|
|
80235
|
-
function panelDataHelper(panelDataArray, panelData, layout2) {
|
|
80236
|
-
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
80237
|
-
const isLastPanel = panelIndex === panelDataArray.length - 1;
|
|
80238
|
-
const pivotIndices = isLastPanel ? [panelIndex - 1, panelIndex] : [panelIndex, panelIndex + 1];
|
|
80239
|
-
const panelSize = layout2[panelIndex];
|
|
80240
|
-
return {
|
|
80241
|
-
...panelData.constraints,
|
|
80242
|
-
panelSize,
|
|
80243
|
-
pivotIndices
|
|
80244
79870
|
};
|
|
80245
|
-
}
|
|
80246
|
-
|
|
80247
|
-
|
|
80248
|
-
|
|
80249
|
-
|
|
80250
|
-
|
|
80251
|
-
|
|
79871
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderTriggerData() });
|
|
79872
|
+
};
|
|
79873
|
+
const actionTypeToHumanReadable = (actionType) => {
|
|
79874
|
+
switch (actionType) {
|
|
79875
|
+
case ActionType.SEND_COMMUNICATION:
|
|
79876
|
+
return "Send Communication";
|
|
79877
|
+
case ActionType.WAIT_UNTIL_NEXT_FIXED_TIME:
|
|
79878
|
+
return "Wait";
|
|
79879
|
+
default:
|
|
79880
|
+
throw UnreachableCaseStatement$1(actionType, ActionType);
|
|
79881
|
+
}
|
|
79882
|
+
};
|
|
79883
|
+
const AutomationFlowUtils = {
|
|
79884
|
+
actionTypeToHumanReadable
|
|
79885
|
+
};
|
|
79886
|
+
const getStepIcon = (type) => {
|
|
79887
|
+
switch (type) {
|
|
79888
|
+
case ActionType.SEND_COMMUNICATION:
|
|
79889
|
+
return /* @__PURE__ */ jsx(IconDefinitions.CommunicationIcon, { className: "w-4 h-4" });
|
|
79890
|
+
case ActionType.WAIT_UNTIL_NEXT_FIXED_TIME:
|
|
79891
|
+
return /* @__PURE__ */ jsx(IconDefinitions.WaitUntilNextFixedTimeIcon, { className: "w-4 h-4" });
|
|
79892
|
+
default:
|
|
79893
|
+
throw UnreachableCaseStatement(type, ActionType);
|
|
79894
|
+
}
|
|
79895
|
+
};
|
|
79896
|
+
const getWaitStepDetail = (actionMetadata) => {
|
|
79897
|
+
if (!actionMetadata || actionMetadata.actionType !== ActionType.WAIT_UNTIL_NEXT_FIXED_TIME || !("hour" in actionMetadata) || !("minute" in actionMetadata) || !("timezone" in actionMetadata))
|
|
79898
|
+
return null;
|
|
79899
|
+
const { hour, minute, timezone } = actionMetadata;
|
|
79900
|
+
const formattedTime = `${hour?.toString().padStart(2, "0")}:${minute?.toString().padStart(2, "0")}`;
|
|
79901
|
+
return `Wait until next ${formattedTime} ${timezone}`;
|
|
79902
|
+
};
|
|
79903
|
+
const AutomationsEditorStep = ({
|
|
79904
|
+
actionData
|
|
79905
|
+
}) => {
|
|
79906
|
+
const {
|
|
79907
|
+
state: { selectedActionId },
|
|
79908
|
+
setActionId: setActionId2
|
|
79909
|
+
} = useContext$1(Context);
|
|
79910
|
+
const isSelected = useMemo(
|
|
79911
|
+
() => selectedActionId === actionData.actionMetadata.currentActionId,
|
|
79912
|
+
[selectedActionId, actionData.actionMetadata.currentActionId]
|
|
79913
|
+
);
|
|
79914
|
+
const metadata = STEP_METADATA[actionData.actionType];
|
|
79915
|
+
const colors = metadata.color;
|
|
79916
|
+
const clickable = metadata.clickable;
|
|
79917
|
+
return /* @__PURE__ */ jsx(
|
|
79918
|
+
motion.div,
|
|
79919
|
+
{
|
|
79920
|
+
layout: true,
|
|
79921
|
+
initial: { opacity: 0, y: 20 },
|
|
79922
|
+
animate: { opacity: 1, y: 0 },
|
|
79923
|
+
exit: { opacity: 0, y: -20 },
|
|
79924
|
+
transition: { duration: 0.2, ease: "easeInOut" },
|
|
79925
|
+
className: cn$1(
|
|
79926
|
+
"p-2 pr-3 flex gap-2 items-center rounded-md transition-colors cursor-pointer group",
|
|
79927
|
+
" border-2 border-transparent",
|
|
79928
|
+
isSelected && "border-primary",
|
|
79929
|
+
actionData.actionType !== ActionType.WAIT_UNTIL_NEXT_FIXED_TIME && "hover:border-primary"
|
|
79930
|
+
),
|
|
79931
|
+
style: {
|
|
79932
|
+
backgroundColor: isSelected ? colors.bg : colors.bgUnselected ?? DEFAULT_BG
|
|
79933
|
+
},
|
|
79934
|
+
onClick: () => {
|
|
79935
|
+
if (clickable) {
|
|
79936
|
+
setActionId2(actionData.actionMetadata.currentActionId);
|
|
79937
|
+
}
|
|
79938
|
+
},
|
|
79939
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
79940
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 bg-white", children: getStepIcon(actionData.actionType) }),
|
|
79941
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
79942
|
+
/* @__PURE__ */ jsx(
|
|
79943
|
+
"div",
|
|
79944
|
+
{
|
|
79945
|
+
style: {
|
|
79946
|
+
color: isSelected ? colors.text : colors.textUnselected
|
|
79947
|
+
},
|
|
79948
|
+
children: /* @__PURE__ */ jsx(MinorText, { children: STEP_TYPES[actionData.actionType] })
|
|
79949
|
+
}
|
|
79950
|
+
),
|
|
79951
|
+
actionData.actionType === ActionType.WAIT_UNTIL_NEXT_FIXED_TIME ? /* @__PURE__ */ jsx("div", { className: "text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate", children: getWaitStepDetail(actionData.actionMetadata) }) : /* @__PURE__ */ jsx("div", { className: "text-xs font-medium", children: AutomationFlowUtils.actionTypeToHumanReadable(
|
|
79952
|
+
actionData.actionType
|
|
79953
|
+
) })
|
|
79954
|
+
] })
|
|
79955
|
+
] })
|
|
79956
|
+
}
|
|
79957
|
+
);
|
|
79958
|
+
};
|
|
79959
|
+
const AutomationFlowMain = () => {
|
|
79960
|
+
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
|
|
79961
|
+
const automation2 = useAutomation();
|
|
79962
|
+
const {
|
|
79963
|
+
setActionId: setActionId2,
|
|
79964
|
+
state: { selectedActionId }
|
|
79965
|
+
} = useContext$1(Context);
|
|
80252
79966
|
useEffect(() => {
|
|
80253
|
-
if (
|
|
79967
|
+
if (!automation2) {
|
|
80254
79968
|
return;
|
|
80255
79969
|
}
|
|
80256
|
-
|
|
80257
|
-
if (handleElement == null) {
|
|
79970
|
+
if (selectedActionId) {
|
|
80258
79971
|
return;
|
|
80259
79972
|
}
|
|
80260
|
-
const
|
|
80261
|
-
|
|
80262
|
-
|
|
79973
|
+
const firstSendCommunicationAction = automation2.actionData?.find(
|
|
79974
|
+
(action) => action.actionType === "send_communication"
|
|
79975
|
+
);
|
|
79976
|
+
if (firstSendCommunicationAction) {
|
|
79977
|
+
setActionId2(firstSendCommunicationAction.actionMetadata.currentActionId);
|
|
79978
|
+
}
|
|
79979
|
+
}, [automation2, setActionId2, selectedActionId]);
|
|
79980
|
+
if (!automation2) {
|
|
79981
|
+
return null;
|
|
79982
|
+
}
|
|
79983
|
+
const automationSteps = sortAutomationSteps({
|
|
79984
|
+
steps: automation2.actionData?.filter((step) => {
|
|
79985
|
+
if (isDetailsVisible) {
|
|
79986
|
+
return true;
|
|
80263
79987
|
}
|
|
80264
|
-
|
|
80265
|
-
|
|
80266
|
-
|
|
80267
|
-
|
|
80268
|
-
|
|
80269
|
-
|
|
80270
|
-
|
|
80271
|
-
|
|
80272
|
-
|
|
80273
|
-
|
|
80274
|
-
|
|
80275
|
-
|
|
80276
|
-
|
|
80277
|
-
|
|
80278
|
-
|
|
80279
|
-
|
|
80280
|
-
|
|
80281
|
-
|
|
80282
|
-
|
|
80283
|
-
|
|
80284
|
-
|
|
80285
|
-
|
|
80286
|
-
}
|
|
79988
|
+
return step.actionType === "send_communication";
|
|
79989
|
+
}),
|
|
79990
|
+
rootActionId: automation2.triggerMetadata?.triggerType === AutomationTriggerType.TRIGGER_BASED ? automation2.triggerMetadata.rootActionId : void 0
|
|
79991
|
+
});
|
|
79992
|
+
let renderTriggerAndAudienceStep = () => /* @__PURE__ */ jsx(Fragment, {});
|
|
79993
|
+
if (isDetailsVisible || automation2.triggerType === AutomationTriggerType.ONE_TIME) {
|
|
79994
|
+
renderTriggerAndAudienceStep = () => {
|
|
79995
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79996
|
+
/* @__PURE__ */ jsx(AutomationEditorTrigger, {}),
|
|
79997
|
+
automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(AutomationAudienceSelector, {})
|
|
79998
|
+
] });
|
|
79999
|
+
};
|
|
80000
|
+
}
|
|
80001
|
+
const renderAutomationDescription = () => {
|
|
80002
|
+
if (!automation2.description) return null;
|
|
80003
|
+
return /* @__PURE__ */ jsx(
|
|
80004
|
+
"div",
|
|
80005
|
+
{
|
|
80006
|
+
className: "w-full mx-auto rounded-xl bg-neutral-50 dark:bg-neutral-900 shadow-sm px-4 py-3 my-2 border border-neutral-200 dark:border-neutral-800 text-neutral-800 dark:text-neutral-100 text-[15px] font-medium leading-snug tracking-tight justify-start",
|
|
80007
|
+
style: {
|
|
80008
|
+
/* Container queries for mobile optimization */
|
|
80009
|
+
containerType: "inline-size"
|
|
80010
|
+
},
|
|
80011
|
+
children: automation2.description
|
|
80012
|
+
}
|
|
80013
|
+
);
|
|
80014
|
+
};
|
|
80015
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-2 w-full overflow-visible", children: [
|
|
80016
|
+
renderAutomationDescription(),
|
|
80017
|
+
automation2.triggerType === AutomationTriggerType.TRIGGER_BASED && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center justify-between", children: [
|
|
80018
|
+
/* @__PURE__ */ jsx("div", { className: "text-[13px] text-muted-foreground", children: "Messages sent in listed order" }),
|
|
80019
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
80020
|
+
/* @__PURE__ */ jsx("div", { className: "text-[13px] font-medium", children: "Show all details" }),
|
|
80021
|
+
/* @__PURE__ */ jsx(
|
|
80022
|
+
Switch,
|
|
80023
|
+
{
|
|
80024
|
+
defaultChecked: isDetailsVisible,
|
|
80025
|
+
onCheckedChange: () => {
|
|
80026
|
+
setIsDetailsVisible(!isDetailsVisible);
|
|
80027
|
+
}
|
|
80028
|
+
}
|
|
80029
|
+
)
|
|
80030
|
+
] })
|
|
80031
|
+
] }),
|
|
80032
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 flex flex-col gap-3", children: /* @__PURE__ */ jsxs(AnimatePresence, { mode: "popLayout", children: [
|
|
80033
|
+
renderTriggerAndAudienceStep(),
|
|
80034
|
+
automationSteps.map((actionData, index2) => /* @__PURE__ */ jsx(
|
|
80035
|
+
motion.div,
|
|
80036
|
+
{
|
|
80037
|
+
initial: { opacity: 0, y: 20 },
|
|
80038
|
+
animate: { opacity: 1, y: 0 },
|
|
80039
|
+
exit: { opacity: 0, y: -20 },
|
|
80040
|
+
transition: {
|
|
80041
|
+
duration: 0.2,
|
|
80042
|
+
delay: index2 * 0.05,
|
|
80043
|
+
ease: "easeInOut"
|
|
80044
|
+
},
|
|
80045
|
+
children: /* @__PURE__ */ jsx(AutomationsEditorStep, { actionData })
|
|
80046
|
+
},
|
|
80047
|
+
actionData.actionMetadata?.currentActionId ?? index2
|
|
80048
|
+
))
|
|
80049
|
+
] }) })
|
|
80050
|
+
] });
|
|
80051
|
+
};
|
|
80052
|
+
const AutomationsEditorSidebar = () => {
|
|
80053
|
+
const automation2 = useAutomation();
|
|
80054
|
+
const { segments } = useListSegments();
|
|
80055
|
+
if (!automation2 || !segments) {
|
|
80056
|
+
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
80057
|
+
BasicLoader,
|
|
80058
|
+
{
|
|
80059
|
+
text: [
|
|
80060
|
+
`Getting details on your ${t$1("engage:automation", { count: 1 }).toLowerCase()}`,
|
|
80061
|
+
"Finishing up"
|
|
80062
|
+
]
|
|
80287
80063
|
}
|
|
80064
|
+
) });
|
|
80065
|
+
}
|
|
80066
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full pt-4 relative", children: /* @__PURE__ */ jsx("div", { className: "absolute inset-0 overflow-y-auto flex flex-col gap-3", children: /* @__PURE__ */ jsx(AutomationFlowMain, {}) }) });
|
|
80067
|
+
};
|
|
80068
|
+
const emailActiveIcon = "data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e";
|
|
80069
|
+
const emailInactiveIcon = "data:image/svg+xml,%3csvg%20width='17'%20height='16'%20viewBox='0%200%2017%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M6.66683%201.5C4.79999%201.5%203.86657%201.5%203.15353%201.86331C2.52632%202.18289%202.01639%202.69282%201.69681%203.32003C1.3335%204.03307%201.3335%204.96649%201.3335%206.83333V9.16667C1.3335%2011.0335%201.3335%2011.9669%201.69681%2012.68C2.01639%2013.3072%202.52632%2013.8171%203.15353%2014.1367C3.86657%2014.5%204.79999%2014.5%206.66683%2014.5H10.3335C12.2003%2014.5%2013.1338%2014.5%2013.8468%2014.1367C14.474%2013.8171%2014.9839%2013.3072%2015.3035%2012.68C15.6668%2011.9669%2015.6668%2011.0335%2015.6668%209.16667V6.83333C15.6668%204.96649%2015.6668%204.03307%2015.3035%203.32003C14.9839%202.69282%2014.474%202.18289%2013.8468%201.86331C13.1338%201.5%2012.2003%201.5%2010.3335%201.5H6.66683Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M12.3125%204.86981C12.5278%204.7825%2012.7821%204.85543%2012.916%205.05633C13.05%205.25736%2013.0191%205.52008%2012.8554%205.68524L12.7773%205.74969L12.1103%206.19403C11.0645%206.89127%2010.4559%207.30338%209.79783%207.50164C9.05705%207.72477%208.27301%207.75304%207.52146%207.58563L7.20212%207.50164C6.7086%207.35295%206.24273%207.08397%205.59958%206.66473L4.88962%206.19403L4.22263%205.74969L4.14451%205.68524C3.98082%205.52008%203.95%205.25736%204.08396%205.05633C4.21789%204.85543%204.47213%204.7825%204.68747%204.86981L4.77732%204.91766L5.44431%205.36199L6.16013%205.83563C6.77757%206.23725%207.12913%206.43582%207.49021%206.54461L7.73923%206.60906C8.32376%206.73923%208.93361%206.71818%209.50974%206.54461C9.99112%206.39957%2010.4556%206.09534%2011.5556%205.36199L12.2226%204.91766L12.3125%204.86981Z'%20fill='%237A8599'%20/%3e%3c/svg%3e";
|
|
80070
|
+
const smsActiveIcon = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%230B66E4'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%230B66E4'%20/%3e%3c/svg%3e";
|
|
80071
|
+
const smsInactiveIcon = "data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.32'%20d='M7.09967%200.833328C5.6062%200.833328%204.85946%200.833328%204.28903%201.12398C3.78727%201.37964%203.37932%201.78759%203.12366%202.28935C2.83301%202.85978%202.83301%203.60652%202.83301%205.09999V10.9C2.83301%2012.3935%202.83301%2013.1402%203.12366%2013.7106C3.37932%2014.2124%203.78727%2014.6204%204.28903%2014.876C4.85946%2015.1667%205.6062%2015.1667%207.09967%2015.1667H8.89967C10.3931%2015.1667%2011.1399%2015.1667%2011.7103%2014.876C12.2121%2014.6204%2012.62%2014.2124%2012.8757%2013.7106C13.1663%2013.1402%2013.1663%2012.3935%2013.1663%2010.9V5.1C13.1663%203.60652%2013.1663%202.85978%2012.8757%202.28935C12.62%201.78759%2012.2121%201.37964%2011.7103%201.12398C11.1399%200.833328%2010.3931%200.833328%208.89968%200.833328H7.09967Z'%20fill='%237A8599'%20/%3e%3cpath%20d='M9.43457%2012.1764C9.66223%2012.2232%209.83398%2012.4252%209.83398%2012.6667C9.83398%2012.9082%209.66223%2013.1101%209.43457%2013.1569L9.33398%2013.1667H6.66699C6.39085%2013.1667%206.16699%2012.9428%206.16699%2012.6667C6.16699%2012.3905%206.39085%2012.1667%206.66699%2012.1667H9.33398L9.43457%2012.1764ZM8.08594%203.17058C8.50572%203.21356%208.83382%203.56859%208.83398%203.99968C8.83398%204.45981%208.46009%204.83349%208%204.83366C7.56881%204.8335%207.21375%204.50553%207.1709%204.08562L7.16699%203.99968L7.1709%203.91472C7.2136%203.49464%207.5687%203.16684%208%203.16667L8.08594%203.17058Z'%20fill='%237A8599'%20/%3e%3c/svg%3e";
|
|
80072
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
80073
|
+
return function handleEvent(event) {
|
|
80074
|
+
originalEventHandler?.(event);
|
|
80075
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
80076
|
+
return ourEventHandler?.(event);
|
|
80077
|
+
}
|
|
80078
|
+
};
|
|
80079
|
+
}
|
|
80080
|
+
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
80081
|
+
let defaultContexts = [];
|
|
80082
|
+
function createContext3(rootComponentName, defaultContext) {
|
|
80083
|
+
const BaseContext2 = React.createContext(defaultContext);
|
|
80084
|
+
const index2 = defaultContexts.length;
|
|
80085
|
+
defaultContexts = [...defaultContexts, defaultContext];
|
|
80086
|
+
const Provider2 = (props2) => {
|
|
80087
|
+
const { scope, children: children2, ...context2 } = props2;
|
|
80088
|
+
const Context2 = scope?.[scopeName]?.[index2] || BaseContext2;
|
|
80089
|
+
const value = React.useMemo(() => context2, Object.values(context2));
|
|
80090
|
+
return /* @__PURE__ */ jsx(Context2.Provider, { value, children: children2 });
|
|
80288
80091
|
};
|
|
80289
|
-
|
|
80290
|
-
|
|
80291
|
-
|
|
80092
|
+
Provider2.displayName = rootComponentName + "Provider";
|
|
80093
|
+
function useContext2(consumerName, scope) {
|
|
80094
|
+
const Context2 = scope?.[scopeName]?.[index2] || BaseContext2;
|
|
80095
|
+
const context2 = React.useContext(Context2);
|
|
80096
|
+
if (context2) return context2;
|
|
80097
|
+
if (defaultContext !== void 0) return defaultContext;
|
|
80098
|
+
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
80099
|
+
}
|
|
80100
|
+
return [Provider2, useContext2];
|
|
80101
|
+
}
|
|
80102
|
+
const createScope = () => {
|
|
80103
|
+
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
80104
|
+
return React.createContext(defaultContext);
|
|
80105
|
+
});
|
|
80106
|
+
return function useScope(scope) {
|
|
80107
|
+
const contexts = scope?.[scopeName] || scopeContexts;
|
|
80108
|
+
return React.useMemo(
|
|
80109
|
+
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
80110
|
+
[scope, contexts]
|
|
80111
|
+
);
|
|
80292
80112
|
};
|
|
80293
|
-
}
|
|
80113
|
+
};
|
|
80114
|
+
createScope.scopeName = scopeName;
|
|
80115
|
+
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
80294
80116
|
}
|
|
80295
|
-
function
|
|
80296
|
-
|
|
80297
|
-
|
|
80298
|
-
|
|
80299
|
-
|
|
80300
|
-
|
|
80301
|
-
|
|
80302
|
-
|
|
80303
|
-
|
|
80304
|
-
|
|
80305
|
-
|
|
80306
|
-
|
|
80307
|
-
|
|
80308
|
-
|
|
80309
|
-
|
|
80310
|
-
|
|
80311
|
-
}
|
|
80312
|
-
|
|
80313
|
-
|
|
80314
|
-
|
|
80315
|
-
|
|
80316
|
-
|
|
80317
|
-
|
|
80318
|
-
|
|
80319
|
-
|
|
80320
|
-
useEffect(() => {
|
|
80321
|
-
callbacksRef.current.onClick = onClick;
|
|
80322
|
-
callbacksRef.current.onDragging = onDragging;
|
|
80323
|
-
callbacksRef.current.onPointerDown = onPointerDown;
|
|
80324
|
-
callbacksRef.current.onPointerUp = onPointerUp;
|
|
80325
|
-
});
|
|
80326
|
-
const panelGroupContext = useContext$1(PanelGroupContext);
|
|
80327
|
-
if (panelGroupContext === null) {
|
|
80328
|
-
throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
|
|
80117
|
+
function composeContextScopes(...scopes) {
|
|
80118
|
+
const baseScope = scopes[0];
|
|
80119
|
+
if (scopes.length === 1) return baseScope;
|
|
80120
|
+
const createScope = () => {
|
|
80121
|
+
const scopeHooks = scopes.map((createScope2) => ({
|
|
80122
|
+
useScope: createScope2(),
|
|
80123
|
+
scopeName: createScope2.scopeName
|
|
80124
|
+
}));
|
|
80125
|
+
return function useComposedScopes(overrideScopes) {
|
|
80126
|
+
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
80127
|
+
const scopeProps = useScope(overrideScopes);
|
|
80128
|
+
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
80129
|
+
return { ...nextScopes2, ...currentScope };
|
|
80130
|
+
}, {});
|
|
80131
|
+
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
80132
|
+
};
|
|
80133
|
+
};
|
|
80134
|
+
createScope.scopeName = baseScope.scopeName;
|
|
80135
|
+
return createScope;
|
|
80136
|
+
}
|
|
80137
|
+
function setRef(ref, value) {
|
|
80138
|
+
if (typeof ref === "function") {
|
|
80139
|
+
return ref(value);
|
|
80140
|
+
} else if (ref !== null && ref !== void 0) {
|
|
80141
|
+
ref.current = value;
|
|
80329
80142
|
}
|
|
80330
|
-
|
|
80331
|
-
|
|
80332
|
-
|
|
80333
|
-
|
|
80334
|
-
|
|
80335
|
-
|
|
80336
|
-
|
|
80337
|
-
|
|
80338
|
-
const resizeHandleId = useUniqueId(idFromProps);
|
|
80339
|
-
const [state, setState] = useState("inactive");
|
|
80340
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
80341
|
-
const [resizeHandler, setResizeHandler] = useState(null);
|
|
80342
|
-
const committedValuesRef = useRef({
|
|
80343
|
-
state
|
|
80344
|
-
});
|
|
80345
|
-
useIsomorphicLayoutEffect(() => {
|
|
80346
|
-
committedValuesRef.current.state = state;
|
|
80347
|
-
});
|
|
80348
|
-
useEffect(() => {
|
|
80349
|
-
if (disabled) {
|
|
80350
|
-
setResizeHandler(null);
|
|
80351
|
-
} else {
|
|
80352
|
-
const resizeHandler2 = registerResizeHandleWithParentGroup(resizeHandleId);
|
|
80353
|
-
setResizeHandler(() => resizeHandler2);
|
|
80354
|
-
}
|
|
80355
|
-
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
80356
|
-
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
80357
|
-
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
80358
|
-
useEffect(() => {
|
|
80359
|
-
if (disabled || resizeHandler == null) {
|
|
80360
|
-
return;
|
|
80361
|
-
}
|
|
80362
|
-
const element = elementRef.current;
|
|
80363
|
-
assert(element, "Element ref not attached");
|
|
80364
|
-
let didMove = false;
|
|
80365
|
-
const setResizeHandlerState = (action, isActive, event) => {
|
|
80366
|
-
if (!isActive) {
|
|
80367
|
-
setState("inactive");
|
|
80368
|
-
return;
|
|
80143
|
+
}
|
|
80144
|
+
function composeRefs(...refs) {
|
|
80145
|
+
return (node) => {
|
|
80146
|
+
let hasCleanup = false;
|
|
80147
|
+
const cleanups = refs.map((ref) => {
|
|
80148
|
+
const cleanup = setRef(ref, node);
|
|
80149
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
80150
|
+
hasCleanup = true;
|
|
80369
80151
|
}
|
|
80370
|
-
|
|
80371
|
-
|
|
80372
|
-
|
|
80373
|
-
|
|
80374
|
-
|
|
80375
|
-
|
|
80376
|
-
|
|
80377
|
-
|
|
80378
|
-
|
|
80379
|
-
|
|
80380
|
-
onDragging2 === null || onDragging2 === void 0 ? void 0 : onDragging2(true);
|
|
80381
|
-
onPointerDown2 === null || onPointerDown2 === void 0 ? void 0 : onPointerDown2();
|
|
80382
|
-
break;
|
|
80383
|
-
}
|
|
80384
|
-
case "move": {
|
|
80385
|
-
const {
|
|
80386
|
-
state: state2
|
|
80387
|
-
} = committedValuesRef.current;
|
|
80388
|
-
didMove = true;
|
|
80389
|
-
if (state2 !== "drag") {
|
|
80390
|
-
setState("hover");
|
|
80391
|
-
}
|
|
80392
|
-
assert(event, 'Expected event to be defined for "move" action');
|
|
80393
|
-
resizeHandler(event);
|
|
80394
|
-
break;
|
|
80395
|
-
}
|
|
80396
|
-
case "up": {
|
|
80397
|
-
setState("hover");
|
|
80398
|
-
stopDragging();
|
|
80399
|
-
const {
|
|
80400
|
-
onClick: onClick2,
|
|
80401
|
-
onDragging: onDragging2,
|
|
80402
|
-
onPointerUp: onPointerUp2
|
|
80403
|
-
} = callbacksRef.current;
|
|
80404
|
-
onDragging2 === null || onDragging2 === void 0 ? void 0 : onDragging2(false);
|
|
80405
|
-
onPointerUp2 === null || onPointerUp2 === void 0 ? void 0 : onPointerUp2();
|
|
80406
|
-
if (!didMove) {
|
|
80407
|
-
onClick2 === null || onClick2 === void 0 ? void 0 : onClick2();
|
|
80152
|
+
return cleanup;
|
|
80153
|
+
});
|
|
80154
|
+
if (hasCleanup) {
|
|
80155
|
+
return () => {
|
|
80156
|
+
for (let i3 = 0; i3 < cleanups.length; i3++) {
|
|
80157
|
+
const cleanup = cleanups[i3];
|
|
80158
|
+
if (typeof cleanup == "function") {
|
|
80159
|
+
cleanup();
|
|
80160
|
+
} else {
|
|
80161
|
+
setRef(refs[i3], null);
|
|
80408
80162
|
}
|
|
80409
|
-
break;
|
|
80410
80163
|
}
|
|
80411
|
-
}
|
|
80412
|
-
}
|
|
80413
|
-
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
80414
|
-
coarse: coarseHitAreaMargins,
|
|
80415
|
-
fine: fineHitAreaMargins
|
|
80416
|
-
}, setResizeHandlerState);
|
|
80417
|
-
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
80418
|
-
useWindowSplitterResizeHandlerBehavior({
|
|
80419
|
-
disabled,
|
|
80420
|
-
handleId: resizeHandleId,
|
|
80421
|
-
resizeHandler,
|
|
80422
|
-
panelGroupElement
|
|
80423
|
-
});
|
|
80424
|
-
const style2 = {
|
|
80425
|
-
touchAction: "none",
|
|
80426
|
-
userSelect: "none"
|
|
80164
|
+
};
|
|
80165
|
+
}
|
|
80427
80166
|
};
|
|
80428
|
-
|
|
80429
|
-
|
|
80430
|
-
|
|
80431
|
-
|
|
80432
|
-
|
|
80433
|
-
|
|
80434
|
-
|
|
80435
|
-
|
|
80436
|
-
}
|
|
80437
|
-
|
|
80438
|
-
|
|
80439
|
-
|
|
80440
|
-
|
|
80441
|
-
|
|
80442
|
-
|
|
80443
|
-
|
|
80444
|
-
|
|
80445
|
-
|
|
80446
|
-
|
|
80447
|
-
|
|
80448
|
-
|
|
80449
|
-
|
|
80450
|
-
|
|
80451
|
-
|
|
80452
|
-
[DATA_ATTRIBUTES.resizeHandleActive]: state === "drag" ? "pointer" : isFocused ? "keyboard" : void 0,
|
|
80453
|
-
[DATA_ATTRIBUTES.resizeHandleEnabled]: !disabled,
|
|
80454
|
-
[DATA_ATTRIBUTES.resizeHandleId]: resizeHandleId,
|
|
80455
|
-
[DATA_ATTRIBUTES.resizeHandleState]: state
|
|
80167
|
+
}
|
|
80168
|
+
function useComposedRefs(...refs) {
|
|
80169
|
+
return React.useCallback(composeRefs(...refs), refs);
|
|
80170
|
+
}
|
|
80171
|
+
// @__NO_SIDE_EFFECTS__
|
|
80172
|
+
function createSlot(ownerName) {
|
|
80173
|
+
const SlotClone2 = /* @__PURE__ */ createSlotClone(ownerName);
|
|
80174
|
+
const Slot2 = React.forwardRef((props2, forwardedRef) => {
|
|
80175
|
+
const { children: children2, ...slotProps } = props2;
|
|
80176
|
+
const childrenArray = React.Children.toArray(children2);
|
|
80177
|
+
const slottable = childrenArray.find(isSlottable);
|
|
80178
|
+
if (slottable) {
|
|
80179
|
+
const newElement = slottable.props.children;
|
|
80180
|
+
const newChildren = childrenArray.map((child) => {
|
|
80181
|
+
if (child === slottable) {
|
|
80182
|
+
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
80183
|
+
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
80184
|
+
} else {
|
|
80185
|
+
return child;
|
|
80186
|
+
}
|
|
80187
|
+
});
|
|
80188
|
+
return /* @__PURE__ */ jsx(SlotClone2, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
80189
|
+
}
|
|
80190
|
+
return /* @__PURE__ */ jsx(SlotClone2, { ...slotProps, ref: forwardedRef, children: children2 });
|
|
80456
80191
|
});
|
|
80192
|
+
Slot2.displayName = `${ownerName}.Slot`;
|
|
80193
|
+
return Slot2;
|
|
80457
80194
|
}
|
|
80458
|
-
|
|
80459
|
-
|
|
80460
|
-
|
|
80461
|
-
|
|
80462
|
-
|
|
80463
|
-
|
|
80464
|
-
|
|
80465
|
-
|
|
80466
|
-
|
|
80467
|
-
|
|
80468
|
-
|
|
80469
|
-
|
|
80470
|
-
|
|
80471
|
-
);
|
|
80472
|
-
|
|
80473
|
-
|
|
80474
|
-
|
|
80475
|
-
|
|
80476
|
-
|
|
80477
|
-
|
|
80478
|
-
|
|
80479
|
-
|
|
80480
|
-
|
|
80481
|
-
|
|
80482
|
-
|
|
80483
|
-
|
|
80484
|
-
|
|
80485
|
-
|
|
80195
|
+
// @__NO_SIDE_EFFECTS__
|
|
80196
|
+
function createSlotClone(ownerName) {
|
|
80197
|
+
const SlotClone2 = React.forwardRef((props2, forwardedRef) => {
|
|
80198
|
+
const { children: children2, ...slotProps } = props2;
|
|
80199
|
+
if (React.isValidElement(children2)) {
|
|
80200
|
+
const childrenRef = getElementRef$1(children2);
|
|
80201
|
+
const props22 = mergeProps(slotProps, children2.props);
|
|
80202
|
+
if (children2.type !== React.Fragment) {
|
|
80203
|
+
props22.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
80204
|
+
}
|
|
80205
|
+
return React.cloneElement(children2, props22);
|
|
80206
|
+
}
|
|
80207
|
+
return React.Children.count(children2) > 1 ? React.Children.only(null) : null;
|
|
80208
|
+
});
|
|
80209
|
+
SlotClone2.displayName = `${ownerName}.SlotClone`;
|
|
80210
|
+
return SlotClone2;
|
|
80211
|
+
}
|
|
80212
|
+
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
80213
|
+
function isSlottable(child) {
|
|
80214
|
+
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
80215
|
+
}
|
|
80216
|
+
function mergeProps(slotProps, childProps) {
|
|
80217
|
+
const overrideProps = { ...childProps };
|
|
80218
|
+
for (const propName in childProps) {
|
|
80219
|
+
const slotPropValue = slotProps[propName];
|
|
80220
|
+
const childPropValue = childProps[propName];
|
|
80221
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
80222
|
+
if (isHandler) {
|
|
80223
|
+
if (slotPropValue && childPropValue) {
|
|
80224
|
+
overrideProps[propName] = (...args) => {
|
|
80225
|
+
childPropValue(...args);
|
|
80226
|
+
slotPropValue(...args);
|
|
80227
|
+
};
|
|
80228
|
+
} else if (slotPropValue) {
|
|
80229
|
+
overrideProps[propName] = slotPropValue;
|
|
80230
|
+
}
|
|
80231
|
+
} else if (propName === "style") {
|
|
80232
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
80233
|
+
} else if (propName === "className") {
|
|
80234
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
80235
|
+
}
|
|
80486
80236
|
}
|
|
80487
|
-
|
|
80488
|
-
|
|
80489
|
-
|
|
80490
|
-
|
|
80491
|
-
|
|
80492
|
-
|
|
80493
|
-
|
|
80494
|
-
const startStep = stepMap.get(rootActionId);
|
|
80495
|
-
if (!startStep) return steps;
|
|
80496
|
-
const sortedSteps = [];
|
|
80497
|
-
let currentStep = startStep;
|
|
80498
|
-
while (currentStep) {
|
|
80499
|
-
sortedSteps.push(currentStep);
|
|
80500
|
-
const nextId = currentStep.actionMetadata.nextActionId;
|
|
80501
|
-
if (!nextId) break;
|
|
80502
|
-
currentStep = stepMap.get(nextId);
|
|
80237
|
+
return { ...slotProps, ...overrideProps };
|
|
80238
|
+
}
|
|
80239
|
+
function getElementRef$1(element) {
|
|
80240
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
80241
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
80242
|
+
if (mayWarn) {
|
|
80243
|
+
return element.ref;
|
|
80503
80244
|
}
|
|
80504
|
-
|
|
80505
|
-
|
|
80506
|
-
|
|
80507
|
-
|
|
80508
|
-
BuiltInActionIds2["EditTime"] = "edit-time";
|
|
80509
|
-
return BuiltInActionIds2;
|
|
80510
|
-
})(BuiltInActionIds || {});
|
|
80511
|
-
const AutomationFlowLabel = ({ copyText }) => {
|
|
80512
|
-
return /* @__PURE__ */ jsx("span", { className: "text-xs font-medium", children: copyText });
|
|
80513
|
-
};
|
|
80514
|
-
const DEFAULT_BG = "rgba(245, 246, 247, 1)";
|
|
80515
|
-
const STEP_METADATA = {
|
|
80516
|
-
[ActionType.SEND_COMMUNICATION]: {
|
|
80517
|
-
color: {
|
|
80518
|
-
bg: "rgba(205, 241, 225, 1)",
|
|
80519
|
-
text: "rgba(30, 108, 74, 1)",
|
|
80520
|
-
bgUnselected: DEFAULT_BG
|
|
80521
|
-
},
|
|
80522
|
-
clickable: true
|
|
80523
|
-
},
|
|
80524
|
-
[ActionType.WAIT_UNTIL_NEXT_FIXED_TIME]: {
|
|
80525
|
-
color: {
|
|
80526
|
-
bg: DEFAULT_BG
|
|
80527
|
-
},
|
|
80528
|
-
clickable: false
|
|
80245
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
80246
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
80247
|
+
if (mayWarn) {
|
|
80248
|
+
return element.props.ref;
|
|
80529
80249
|
}
|
|
80530
|
-
|
|
80531
|
-
|
|
80532
|
-
|
|
80533
|
-
|
|
80534
|
-
|
|
80535
|
-
const
|
|
80536
|
-
|
|
80537
|
-
|
|
80538
|
-
iconBgColor,
|
|
80539
|
-
iconStrokeColor,
|
|
80540
|
-
Icon: Icon2,
|
|
80541
|
-
disabled = false,
|
|
80542
|
-
selected = false
|
|
80543
|
-
}) => {
|
|
80544
|
-
const IconComponent = Icon2;
|
|
80545
|
-
return /* @__PURE__ */ jsx(
|
|
80546
|
-
motion.div,
|
|
80547
|
-
{
|
|
80548
|
-
layout: true,
|
|
80549
|
-
initial: { opacity: 0, y: 20 },
|
|
80550
|
-
animate: { opacity: 1, y: 0 },
|
|
80551
|
-
exit: { opacity: 0, y: -20 },
|
|
80552
|
-
transition: { duration: 0.2, ease: "easeInOut" },
|
|
80553
|
-
style: {
|
|
80554
|
-
backgroundColor: selected ? iconBgColor : DEFAULT_BG
|
|
80555
|
-
},
|
|
80556
|
-
className: cn$1(
|
|
80557
|
-
"flex gap-2 items-center rounded-md transition-colors group",
|
|
80558
|
-
"border-2 border-transparent overflow-hidden",
|
|
80559
|
-
!disabled && "hover:border-primary cursor-pointer",
|
|
80560
|
-
selected && "border-primary"
|
|
80561
|
-
),
|
|
80562
|
-
children: /* @__PURE__ */ jsxs(
|
|
80563
|
-
Button$1,
|
|
80564
|
-
{
|
|
80565
|
-
variant: "ghost",
|
|
80566
|
-
className: "text-left w-full h-full flex items-center gap-2 min-h-none whitespace-normal rounded-none px-2 group/trigger-audience",
|
|
80567
|
-
onClick,
|
|
80568
|
-
children: [
|
|
80569
|
-
/* @__PURE__ */ jsx(
|
|
80570
|
-
"div",
|
|
80571
|
-
{
|
|
80572
|
-
className: cn$1(
|
|
80573
|
-
"bg-purple-50 rounded-md p-2 flex items-center justify-center w-8 h-8 flex-shrink-0 transition-colors",
|
|
80574
|
-
!disabled && "group-hover/trigger-audience:bg-background",
|
|
80575
|
-
iconBgColor
|
|
80576
|
-
),
|
|
80577
|
-
children: /* @__PURE__ */ jsx(
|
|
80578
|
-
IconComponent,
|
|
80579
|
-
{
|
|
80580
|
-
className: cn$1(
|
|
80581
|
-
"w-4 h-4 stroke-purple-500 group-hover/trigger-audience:fill-purple-50 transition-colors",
|
|
80582
|
-
iconStrokeColor
|
|
80583
|
-
)
|
|
80584
|
-
}
|
|
80585
|
-
)
|
|
80586
|
-
}
|
|
80587
|
-
),
|
|
80588
|
-
children2
|
|
80589
|
-
]
|
|
80590
|
-
}
|
|
80591
|
-
)
|
|
80592
|
-
}
|
|
80250
|
+
return element.props.ref || element.ref;
|
|
80251
|
+
}
|
|
80252
|
+
function createCollection(name) {
|
|
80253
|
+
const PROVIDER_NAME2 = name + "CollectionProvider";
|
|
80254
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME2);
|
|
80255
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
80256
|
+
PROVIDER_NAME2,
|
|
80257
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
80593
80258
|
);
|
|
80594
|
-
|
|
80595
|
-
const
|
|
80596
|
-
|
|
80597
|
-
|
|
80598
|
-
|
|
80599
|
-
|
|
80600
|
-
|
|
80601
|
-
|
|
80602
|
-
|
|
80603
|
-
|
|
80604
|
-
|
|
80605
|
-
|
|
80259
|
+
const CollectionProvider = (props2) => {
|
|
80260
|
+
const { scope, children: children2 } = props2;
|
|
80261
|
+
const ref = React__default.useRef(null);
|
|
80262
|
+
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
80263
|
+
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children: children2 });
|
|
80264
|
+
};
|
|
80265
|
+
CollectionProvider.displayName = PROVIDER_NAME2;
|
|
80266
|
+
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
80267
|
+
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
80268
|
+
const CollectionSlot = React__default.forwardRef(
|
|
80269
|
+
(props2, forwardedRef) => {
|
|
80270
|
+
const { scope, children: children2 } = props2;
|
|
80271
|
+
const context2 = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
80272
|
+
const composedRefs = useComposedRefs(forwardedRef, context2.collectionRef);
|
|
80273
|
+
return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children: children2 });
|
|
80274
|
+
}
|
|
80606
80275
|
);
|
|
80607
|
-
|
|
80608
|
-
|
|
80276
|
+
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
80277
|
+
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
80278
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
80279
|
+
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
|
|
80280
|
+
const CollectionItemSlot = React__default.forwardRef(
|
|
80281
|
+
(props2, forwardedRef) => {
|
|
80282
|
+
const { scope, children: children2, ...itemData } = props2;
|
|
80283
|
+
const ref = React__default.useRef(null);
|
|
80284
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
80285
|
+
const context2 = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
80286
|
+
React__default.useEffect(() => {
|
|
80287
|
+
context2.itemMap.set(ref, { ref, ...itemData });
|
|
80288
|
+
return () => void context2.itemMap.delete(ref);
|
|
80289
|
+
});
|
|
80290
|
+
return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children: children2 });
|
|
80291
|
+
}
|
|
80609
80292
|
);
|
|
80610
|
-
|
|
80611
|
-
|
|
80612
|
-
|
|
80613
|
-
|
|
80614
|
-
|
|
80615
|
-
|
|
80616
|
-
|
|
80617
|
-
|
|
80618
|
-
|
|
80293
|
+
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
80294
|
+
function useCollection2(scope) {
|
|
80295
|
+
const context2 = useCollectionContext(name + "CollectionConsumer", scope);
|
|
80296
|
+
const getItems = React__default.useCallback(() => {
|
|
80297
|
+
const collectionNode = context2.collectionRef.current;
|
|
80298
|
+
if (!collectionNode) return [];
|
|
80299
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
80300
|
+
const items = Array.from(context2.itemMap.values());
|
|
80301
|
+
const orderedItems = items.sort(
|
|
80302
|
+
(a4, b3) => orderedNodes.indexOf(a4.ref.current) - orderedNodes.indexOf(b3.ref.current)
|
|
80303
|
+
);
|
|
80304
|
+
return orderedItems;
|
|
80305
|
+
}, [context2.collectionRef, context2.itemMap]);
|
|
80306
|
+
return getItems;
|
|
80307
|
+
}
|
|
80308
|
+
return [
|
|
80309
|
+
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
80310
|
+
useCollection2,
|
|
80311
|
+
createCollectionScope2
|
|
80312
|
+
];
|
|
80313
|
+
}
|
|
80314
|
+
var useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {
|
|
80315
|
+
};
|
|
80316
|
+
var useReactId = React[" useId ".trim().toString()] || (() => void 0);
|
|
80317
|
+
var count = 0;
|
|
80318
|
+
function useId(deterministicId) {
|
|
80319
|
+
const [id2, setId] = React.useState(useReactId());
|
|
80320
|
+
useLayoutEffect2(() => {
|
|
80321
|
+
setId((reactId) => reactId ?? String(count++));
|
|
80322
|
+
}, [deterministicId]);
|
|
80323
|
+
return deterministicId || (id2 ? `radix-${id2}` : "");
|
|
80324
|
+
}
|
|
80325
|
+
var NODES = [
|
|
80326
|
+
"a",
|
|
80327
|
+
"button",
|
|
80328
|
+
"div",
|
|
80329
|
+
"form",
|
|
80330
|
+
"h2",
|
|
80331
|
+
"h3",
|
|
80332
|
+
"img",
|
|
80333
|
+
"input",
|
|
80334
|
+
"label",
|
|
80335
|
+
"li",
|
|
80336
|
+
"nav",
|
|
80337
|
+
"ol",
|
|
80338
|
+
"p",
|
|
80339
|
+
"select",
|
|
80340
|
+
"span",
|
|
80341
|
+
"svg",
|
|
80342
|
+
"ul"
|
|
80343
|
+
];
|
|
80344
|
+
var Primitive = NODES.reduce((primitive, node) => {
|
|
80345
|
+
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
80346
|
+
const Node2 = React.forwardRef((props2, forwardedRef) => {
|
|
80347
|
+
const { asChild, ...primitiveProps } = props2;
|
|
80348
|
+
const Comp = asChild ? Slot2 : node;
|
|
80349
|
+
if (typeof window !== "undefined") {
|
|
80350
|
+
window[Symbol.for("radix-ui")] = true;
|
|
80619
80351
|
}
|
|
80620
|
-
|
|
80621
|
-
|
|
80622
|
-
|
|
80623
|
-
|
|
80624
|
-
|
|
80625
|
-
|
|
80626
|
-
|
|
80627
|
-
|
|
80628
|
-
|
|
80629
|
-
|
|
80352
|
+
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
80353
|
+
});
|
|
80354
|
+
Node2.displayName = `Primitive.${node}`;
|
|
80355
|
+
return { ...primitive, [node]: Node2 };
|
|
80356
|
+
}, {});
|
|
80357
|
+
function useCallbackRef(callback) {
|
|
80358
|
+
const callbackRef = React.useRef(callback);
|
|
80359
|
+
React.useEffect(() => {
|
|
80360
|
+
callbackRef.current = callback;
|
|
80361
|
+
});
|
|
80362
|
+
return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
80363
|
+
}
|
|
80364
|
+
var useInsertionEffect = React[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
80365
|
+
function useControllableState({
|
|
80366
|
+
prop,
|
|
80367
|
+
defaultProp,
|
|
80368
|
+
onChange = () => {
|
|
80369
|
+
},
|
|
80370
|
+
caller
|
|
80371
|
+
}) {
|
|
80372
|
+
const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
|
|
80373
|
+
defaultProp,
|
|
80374
|
+
onChange
|
|
80375
|
+
});
|
|
80376
|
+
const isControlled = prop !== void 0;
|
|
80377
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
80378
|
+
{
|
|
80379
|
+
const isControlledRef = React.useRef(prop !== void 0);
|
|
80380
|
+
React.useEffect(() => {
|
|
80381
|
+
const wasControlled = isControlledRef.current;
|
|
80382
|
+
if (wasControlled !== isControlled) {
|
|
80383
|
+
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
80384
|
+
const to = isControlled ? "controlled" : "uncontrolled";
|
|
80385
|
+
console.warn(
|
|
80386
|
+
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
80387
|
+
);
|
|
80630
80388
|
}
|
|
80631
|
-
|
|
80632
|
-
|
|
80389
|
+
isControlledRef.current = isControlled;
|
|
80390
|
+
}, [isControlled, caller]);
|
|
80391
|
+
}
|
|
80392
|
+
const setValue = React.useCallback(
|
|
80393
|
+
(nextValue) => {
|
|
80394
|
+
if (isControlled) {
|
|
80395
|
+
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
80396
|
+
if (value2 !== prop) {
|
|
80397
|
+
onChangeRef.current?.(value2);
|
|
80398
|
+
}
|
|
80399
|
+
} else {
|
|
80400
|
+
setUncontrolledProp(nextValue);
|
|
80633
80401
|
}
|
|
80402
|
+
},
|
|
80403
|
+
[isControlled, prop, setUncontrolledProp, onChangeRef]
|
|
80404
|
+
);
|
|
80405
|
+
return [value, setValue];
|
|
80406
|
+
}
|
|
80407
|
+
function useUncontrolledState({
|
|
80408
|
+
defaultProp,
|
|
80409
|
+
onChange
|
|
80410
|
+
}) {
|
|
80411
|
+
const [value, setValue] = React.useState(defaultProp);
|
|
80412
|
+
const prevValueRef = React.useRef(value);
|
|
80413
|
+
const onChangeRef = React.useRef(onChange);
|
|
80414
|
+
useInsertionEffect(() => {
|
|
80415
|
+
onChangeRef.current = onChange;
|
|
80416
|
+
}, [onChange]);
|
|
80417
|
+
React.useEffect(() => {
|
|
80418
|
+
if (prevValueRef.current !== value) {
|
|
80419
|
+
onChangeRef.current?.(value);
|
|
80420
|
+
prevValueRef.current = value;
|
|
80634
80421
|
}
|
|
80635
|
-
}, [
|
|
80636
|
-
|
|
80637
|
-
|
|
80638
|
-
|
|
80639
|
-
|
|
80640
|
-
|
|
80641
|
-
|
|
80642
|
-
|
|
80643
|
-
|
|
80422
|
+
}, [value, prevValueRef]);
|
|
80423
|
+
return [value, setValue, onChangeRef];
|
|
80424
|
+
}
|
|
80425
|
+
function isFunction(value) {
|
|
80426
|
+
return typeof value === "function";
|
|
80427
|
+
}
|
|
80428
|
+
var DirectionContext = React.createContext(void 0);
|
|
80429
|
+
function useDirection(localDir) {
|
|
80430
|
+
const globalDir = React.useContext(DirectionContext);
|
|
80431
|
+
return localDir || globalDir || "ltr";
|
|
80432
|
+
}
|
|
80433
|
+
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
80434
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
80435
|
+
var GROUP_NAME = "RovingFocusGroup";
|
|
80436
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
80437
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
80438
|
+
GROUP_NAME,
|
|
80439
|
+
[createCollectionScope]
|
|
80440
|
+
);
|
|
80441
|
+
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
80442
|
+
var RovingFocusGroup = React.forwardRef(
|
|
80443
|
+
(props2, forwardedRef) => {
|
|
80444
|
+
return /* @__PURE__ */ jsx(Collection.Provider, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props2.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props2, ref: forwardedRef }) }) });
|
|
80644
80445
|
}
|
|
80645
|
-
|
|
80646
|
-
|
|
80446
|
+
);
|
|
80447
|
+
RovingFocusGroup.displayName = GROUP_NAME;
|
|
80448
|
+
var RovingFocusGroupImpl = React.forwardRef((props2, forwardedRef) => {
|
|
80449
|
+
const {
|
|
80450
|
+
__scopeRovingFocusGroup,
|
|
80451
|
+
orientation,
|
|
80452
|
+
loop = false,
|
|
80453
|
+
dir,
|
|
80454
|
+
currentTabStopId: currentTabStopIdProp,
|
|
80455
|
+
defaultCurrentTabStopId,
|
|
80456
|
+
onCurrentTabStopIdChange,
|
|
80457
|
+
onEntryFocus,
|
|
80458
|
+
preventScrollOnEntryFocus = false,
|
|
80459
|
+
...groupProps
|
|
80460
|
+
} = props2;
|
|
80461
|
+
const ref = React.useRef(null);
|
|
80462
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
80463
|
+
const direction = useDirection(dir);
|
|
80464
|
+
const [currentTabStopId, setCurrentTabStopId] = useControllableState({
|
|
80465
|
+
prop: currentTabStopIdProp,
|
|
80466
|
+
defaultProp: defaultCurrentTabStopId ?? null,
|
|
80467
|
+
onChange: onCurrentTabStopIdChange,
|
|
80468
|
+
caller: GROUP_NAME
|
|
80469
|
+
});
|
|
80470
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
|
|
80471
|
+
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
80472
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
80473
|
+
const isClickFocusRef = React.useRef(false);
|
|
80474
|
+
const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
|
|
80475
|
+
React.useEffect(() => {
|
|
80476
|
+
const node = ref.current;
|
|
80477
|
+
if (node) {
|
|
80478
|
+
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
80479
|
+
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
80480
|
+
}
|
|
80481
|
+
}, [handleEntryFocus]);
|
|
80482
|
+
return /* @__PURE__ */ jsx(
|
|
80483
|
+
RovingFocusProvider,
|
|
80647
80484
|
{
|
|
80648
|
-
|
|
80649
|
-
|
|
80650
|
-
|
|
80651
|
-
|
|
80652
|
-
|
|
80653
|
-
|
|
80654
|
-
|
|
80655
|
-
|
|
80656
|
-
|
|
80657
|
-
|
|
80658
|
-
|
|
80659
|
-
|
|
80660
|
-
|
|
80661
|
-
|
|
80662
|
-
|
|
80663
|
-
|
|
80664
|
-
|
|
80665
|
-
|
|
80666
|
-
|
|
80667
|
-
|
|
80668
|
-
|
|
80485
|
+
scope: __scopeRovingFocusGroup,
|
|
80486
|
+
orientation,
|
|
80487
|
+
dir: direction,
|
|
80488
|
+
loop,
|
|
80489
|
+
currentTabStopId,
|
|
80490
|
+
onItemFocus: React.useCallback(
|
|
80491
|
+
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
80492
|
+
[setCurrentTabStopId]
|
|
80493
|
+
),
|
|
80494
|
+
onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
|
|
80495
|
+
onFocusableItemAdd: React.useCallback(
|
|
80496
|
+
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
80497
|
+
[]
|
|
80498
|
+
),
|
|
80499
|
+
onFocusableItemRemove: React.useCallback(
|
|
80500
|
+
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
80501
|
+
[]
|
|
80502
|
+
),
|
|
80503
|
+
children: /* @__PURE__ */ jsx(
|
|
80504
|
+
Primitive.div,
|
|
80505
|
+
{
|
|
80506
|
+
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
80507
|
+
"data-orientation": orientation,
|
|
80508
|
+
...groupProps,
|
|
80509
|
+
ref: composedRefs,
|
|
80510
|
+
style: { outline: "none", ...props2.style },
|
|
80511
|
+
onMouseDown: composeEventHandlers(props2.onMouseDown, () => {
|
|
80512
|
+
isClickFocusRef.current = true;
|
|
80513
|
+
}),
|
|
80514
|
+
onFocus: composeEventHandlers(props2.onFocus, (event) => {
|
|
80515
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
80516
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
80517
|
+
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
80518
|
+
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
80519
|
+
if (!entryFocusEvent.defaultPrevented) {
|
|
80520
|
+
const items = getItems().filter((item) => item.focusable);
|
|
80521
|
+
const activeItem = items.find((item) => item.active);
|
|
80522
|
+
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
80523
|
+
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
80524
|
+
Boolean
|
|
80525
|
+
);
|
|
80526
|
+
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
80527
|
+
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
80528
|
+
}
|
|
80669
80529
|
}
|
|
80670
|
-
|
|
80671
|
-
|
|
80672
|
-
|
|
80673
|
-
if (!segment2) return null;
|
|
80674
|
-
return /* @__PURE__ */ jsx(SegmentPill, { segmentName: segment2.name }, id2);
|
|
80675
|
-
}) })
|
|
80676
|
-
] })
|
|
80677
|
-
] })
|
|
80678
|
-
}
|
|
80679
|
-
) });
|
|
80680
|
-
};
|
|
80681
|
-
const AutomationEditorTrigger = () => {
|
|
80682
|
-
const automation2 = useAutomation();
|
|
80683
|
-
const {
|
|
80684
|
-
setActionId: setActionId2,
|
|
80685
|
-
state: { selectedActionId }
|
|
80686
|
-
} = useContext$1(Context);
|
|
80687
|
-
const { segments } = useListSegments();
|
|
80688
|
-
const START_THIS_AUTOMATION_COPY_TEXT = `Start this ${t$1("engage:automation").toLowerCase()}`;
|
|
80689
|
-
if (!automation2 || !segments) {
|
|
80690
|
-
return null;
|
|
80691
|
-
}
|
|
80692
|
-
const renderTriggerData = () => {
|
|
80693
|
-
switch (automation2.triggerType) {
|
|
80694
|
-
case AutomationTriggerType.TRIGGER_BASED: {
|
|
80695
|
-
if (automation2.triggerMetadata.triggerType !== AutomationTriggerType.TRIGGER_BASED || automation2.triggerMetadata.eventName !== "USER_JOINED_SEGMENT" || !automation2.triggerMetadata.eventFilter.segment_id) {
|
|
80696
|
-
return null;
|
|
80697
|
-
}
|
|
80698
|
-
const segmentId = automation2.triggerMetadata.eventFilter.segment_id;
|
|
80699
|
-
const segmentName = segments.find(
|
|
80700
|
-
(segment2) => segment2.id === segmentId
|
|
80701
|
-
)?.name;
|
|
80702
|
-
if (!segmentName) {
|
|
80703
|
-
return null;
|
|
80530
|
+
isClickFocusRef.current = false;
|
|
80531
|
+
}),
|
|
80532
|
+
onBlur: composeEventHandlers(props2.onBlur, () => setIsTabbingBackOut(false))
|
|
80704
80533
|
}
|
|
80705
|
-
|
|
80706
|
-
|
|
80707
|
-
|
|
80708
|
-
|
|
80709
|
-
|
|
80710
|
-
|
|
80711
|
-
|
|
80712
|
-
|
|
80713
|
-
|
|
80714
|
-
|
|
80715
|
-
|
|
80716
|
-
|
|
80717
|
-
|
|
80718
|
-
|
|
80719
|
-
|
|
80720
|
-
|
|
80721
|
-
|
|
80722
|
-
|
|
80723
|
-
|
|
80724
|
-
|
|
80725
|
-
|
|
80726
|
-
|
|
80727
|
-
|
|
80534
|
+
)
|
|
80535
|
+
}
|
|
80536
|
+
);
|
|
80537
|
+
});
|
|
80538
|
+
var ITEM_NAME = "RovingFocusGroupItem";
|
|
80539
|
+
var RovingFocusGroupItem = React.forwardRef(
|
|
80540
|
+
(props2, forwardedRef) => {
|
|
80541
|
+
const {
|
|
80542
|
+
__scopeRovingFocusGroup,
|
|
80543
|
+
focusable = true,
|
|
80544
|
+
active = false,
|
|
80545
|
+
tabStopId,
|
|
80546
|
+
children: children2,
|
|
80547
|
+
...itemProps
|
|
80548
|
+
} = props2;
|
|
80549
|
+
const autoId = useId();
|
|
80550
|
+
const id2 = tabStopId || autoId;
|
|
80551
|
+
const context2 = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup);
|
|
80552
|
+
const isCurrentTabStop = context2.currentTabStopId === id2;
|
|
80553
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
80554
|
+
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context2;
|
|
80555
|
+
React.useEffect(() => {
|
|
80556
|
+
if (focusable) {
|
|
80557
|
+
onFocusableItemAdd();
|
|
80558
|
+
return () => onFocusableItemRemove();
|
|
80728
80559
|
}
|
|
80729
|
-
|
|
80730
|
-
|
|
80731
|
-
|
|
80732
|
-
|
|
80560
|
+
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
80561
|
+
return /* @__PURE__ */ jsx(
|
|
80562
|
+
Collection.ItemSlot,
|
|
80563
|
+
{
|
|
80564
|
+
scope: __scopeRovingFocusGroup,
|
|
80565
|
+
id: id2,
|
|
80566
|
+
focusable,
|
|
80567
|
+
active,
|
|
80568
|
+
children: /* @__PURE__ */ jsx(
|
|
80569
|
+
Primitive.span,
|
|
80733
80570
|
{
|
|
80734
|
-
|
|
80735
|
-
|
|
80736
|
-
|
|
80737
|
-
|
|
80738
|
-
|
|
80739
|
-
|
|
80740
|
-
|
|
80741
|
-
|
|
80742
|
-
|
|
80743
|
-
|
|
80744
|
-
|
|
80745
|
-
|
|
80746
|
-
|
|
80747
|
-
|
|
80748
|
-
|
|
80749
|
-
|
|
80750
|
-
|
|
80751
|
-
|
|
80752
|
-
|
|
80753
|
-
|
|
80754
|
-
|
|
80755
|
-
|
|
80756
|
-
|
|
80757
|
-
|
|
80758
|
-
|
|
80759
|
-
)
|
|
80760
|
-
|
|
80761
|
-
|
|
80762
|
-
|
|
80763
|
-
|
|
80571
|
+
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
80572
|
+
"data-orientation": context2.orientation,
|
|
80573
|
+
...itemProps,
|
|
80574
|
+
ref: forwardedRef,
|
|
80575
|
+
onMouseDown: composeEventHandlers(props2.onMouseDown, (event) => {
|
|
80576
|
+
if (!focusable) event.preventDefault();
|
|
80577
|
+
else context2.onItemFocus(id2);
|
|
80578
|
+
}),
|
|
80579
|
+
onFocus: composeEventHandlers(props2.onFocus, () => context2.onItemFocus(id2)),
|
|
80580
|
+
onKeyDown: composeEventHandlers(props2.onKeyDown, (event) => {
|
|
80581
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
80582
|
+
context2.onItemShiftTab();
|
|
80583
|
+
return;
|
|
80584
|
+
}
|
|
80585
|
+
if (event.target !== event.currentTarget) return;
|
|
80586
|
+
const focusIntent = getFocusIntent(event, context2.orientation, context2.dir);
|
|
80587
|
+
if (focusIntent !== void 0) {
|
|
80588
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
80589
|
+
event.preventDefault();
|
|
80590
|
+
const items = getItems().filter((item) => item.focusable);
|
|
80591
|
+
let candidateNodes = items.map((item) => item.ref.current);
|
|
80592
|
+
if (focusIntent === "last") candidateNodes.reverse();
|
|
80593
|
+
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
80594
|
+
if (focusIntent === "prev") candidateNodes.reverse();
|
|
80595
|
+
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
80596
|
+
candidateNodes = context2.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
80597
|
+
}
|
|
80598
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
80599
|
+
}
|
|
80600
|
+
}),
|
|
80601
|
+
children: typeof children2 === "function" ? children2({ isCurrentTabStop, hasTabStop: currentTabStopId != null }) : children2
|
|
80764
80602
|
}
|
|
80765
|
-
)
|
|
80603
|
+
)
|
|
80604
|
+
}
|
|
80605
|
+
);
|
|
80606
|
+
}
|
|
80607
|
+
);
|
|
80608
|
+
RovingFocusGroupItem.displayName = ITEM_NAME;
|
|
80609
|
+
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
80610
|
+
ArrowLeft: "prev",
|
|
80611
|
+
ArrowUp: "prev",
|
|
80612
|
+
ArrowRight: "next",
|
|
80613
|
+
ArrowDown: "next",
|
|
80614
|
+
PageUp: "first",
|
|
80615
|
+
Home: "first",
|
|
80616
|
+
PageDown: "last",
|
|
80617
|
+
End: "last"
|
|
80618
|
+
};
|
|
80619
|
+
function getDirectionAwareKey(key, dir) {
|
|
80620
|
+
if (dir !== "rtl") return key;
|
|
80621
|
+
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
80622
|
+
}
|
|
80623
|
+
function getFocusIntent(event, orientation, dir) {
|
|
80624
|
+
const key = getDirectionAwareKey(event.key, dir);
|
|
80625
|
+
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
80626
|
+
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
80627
|
+
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
80628
|
+
}
|
|
80629
|
+
function focusFirst(candidates, preventScroll = false) {
|
|
80630
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
80631
|
+
for (const candidate of candidates) {
|
|
80632
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
80633
|
+
candidate.focus({ preventScroll });
|
|
80634
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
80635
|
+
}
|
|
80636
|
+
}
|
|
80637
|
+
function wrapArray(array, startIndex2) {
|
|
80638
|
+
return array.map((_2, index2) => array[(startIndex2 + index2) % array.length]);
|
|
80639
|
+
}
|
|
80640
|
+
var Root$1 = RovingFocusGroup;
|
|
80641
|
+
var Item = RovingFocusGroupItem;
|
|
80642
|
+
function useStateMachine(initialState2, machine) {
|
|
80643
|
+
return React.useReducer((state, event) => {
|
|
80644
|
+
const nextState = machine[state][event];
|
|
80645
|
+
return nextState ?? state;
|
|
80646
|
+
}, initialState2);
|
|
80647
|
+
}
|
|
80648
|
+
var Presence = (props2) => {
|
|
80649
|
+
const { present, children: children2 } = props2;
|
|
80650
|
+
const presence = usePresence(present);
|
|
80651
|
+
const child = typeof children2 === "function" ? children2({ present: presence.isPresent }) : React.Children.only(children2);
|
|
80652
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
80653
|
+
const forceMount = typeof children2 === "function";
|
|
80654
|
+
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
80655
|
+
};
|
|
80656
|
+
Presence.displayName = "Presence";
|
|
80657
|
+
function usePresence(present) {
|
|
80658
|
+
const [node, setNode] = React.useState();
|
|
80659
|
+
const stylesRef = React.useRef(null);
|
|
80660
|
+
const prevPresentRef = React.useRef(present);
|
|
80661
|
+
const prevAnimationNameRef = React.useRef("none");
|
|
80662
|
+
const initialState2 = present ? "mounted" : "unmounted";
|
|
80663
|
+
const [state, send] = useStateMachine(initialState2, {
|
|
80664
|
+
mounted: {
|
|
80665
|
+
UNMOUNT: "unmounted",
|
|
80666
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
80667
|
+
},
|
|
80668
|
+
unmountSuspended: {
|
|
80669
|
+
MOUNT: "mounted",
|
|
80670
|
+
ANIMATION_END: "unmounted"
|
|
80671
|
+
},
|
|
80672
|
+
unmounted: {
|
|
80673
|
+
MOUNT: "mounted"
|
|
80674
|
+
}
|
|
80675
|
+
});
|
|
80676
|
+
React.useEffect(() => {
|
|
80677
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
80678
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
80679
|
+
}, [state]);
|
|
80680
|
+
useLayoutEffect2(() => {
|
|
80681
|
+
const styles2 = stylesRef.current;
|
|
80682
|
+
const wasPresent = prevPresentRef.current;
|
|
80683
|
+
const hasPresentChanged = wasPresent !== present;
|
|
80684
|
+
if (hasPresentChanged) {
|
|
80685
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
80686
|
+
const currentAnimationName = getAnimationName(styles2);
|
|
80687
|
+
if (present) {
|
|
80688
|
+
send("MOUNT");
|
|
80689
|
+
} else if (currentAnimationName === "none" || styles2?.display === "none") {
|
|
80690
|
+
send("UNMOUNT");
|
|
80691
|
+
} else {
|
|
80692
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
80693
|
+
if (wasPresent && isAnimating) {
|
|
80694
|
+
send("ANIMATION_OUT");
|
|
80695
|
+
} else {
|
|
80696
|
+
send("UNMOUNT");
|
|
80697
|
+
}
|
|
80766
80698
|
}
|
|
80767
|
-
|
|
80768
|
-
|
|
80769
|
-
|
|
80770
|
-
|
|
80771
|
-
|
|
80699
|
+
prevPresentRef.current = present;
|
|
80700
|
+
}
|
|
80701
|
+
}, [present, send]);
|
|
80702
|
+
useLayoutEffect2(() => {
|
|
80703
|
+
if (node) {
|
|
80704
|
+
let timeoutId;
|
|
80705
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
80706
|
+
const handleAnimationEnd = (event) => {
|
|
80707
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
80708
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
80709
|
+
if (event.target === node && isCurrentAnimation) {
|
|
80710
|
+
send("ANIMATION_END");
|
|
80711
|
+
if (!prevPresentRef.current) {
|
|
80712
|
+
const currentFillMode = node.style.animationFillMode;
|
|
80713
|
+
node.style.animationFillMode = "forwards";
|
|
80714
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
80715
|
+
if (node.style.animationFillMode === "forwards") {
|
|
80716
|
+
node.style.animationFillMode = currentFillMode;
|
|
80717
|
+
}
|
|
80718
|
+
});
|
|
80719
|
+
}
|
|
80720
|
+
}
|
|
80721
|
+
};
|
|
80722
|
+
const handleAnimationStart = (event) => {
|
|
80723
|
+
if (event.target === node) {
|
|
80724
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
80725
|
+
}
|
|
80726
|
+
};
|
|
80727
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
80728
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
80729
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
80730
|
+
return () => {
|
|
80731
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
80732
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
80733
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
80734
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
80735
|
+
};
|
|
80736
|
+
} else {
|
|
80737
|
+
send("ANIMATION_END");
|
|
80772
80738
|
}
|
|
80739
|
+
}, [node, send]);
|
|
80740
|
+
return {
|
|
80741
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
80742
|
+
ref: React.useCallback((node2) => {
|
|
80743
|
+
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
80744
|
+
setNode(node2);
|
|
80745
|
+
}, [])
|
|
80773
80746
|
};
|
|
80774
|
-
|
|
80775
|
-
|
|
80776
|
-
|
|
80777
|
-
|
|
80778
|
-
|
|
80779
|
-
|
|
80780
|
-
|
|
80781
|
-
|
|
80782
|
-
|
|
80783
|
-
throw UnreachableCaseStatement$1(actionType, ActionType);
|
|
80747
|
+
}
|
|
80748
|
+
function getAnimationName(styles2) {
|
|
80749
|
+
return styles2?.animationName || "none";
|
|
80750
|
+
}
|
|
80751
|
+
function getElementRef(element) {
|
|
80752
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
80753
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
80754
|
+
if (mayWarn) {
|
|
80755
|
+
return element.ref;
|
|
80784
80756
|
}
|
|
80785
|
-
|
|
80786
|
-
|
|
80787
|
-
|
|
80788
|
-
|
|
80789
|
-
const getStepIcon = (type) => {
|
|
80790
|
-
switch (type) {
|
|
80791
|
-
case ActionType.SEND_COMMUNICATION:
|
|
80792
|
-
return /* @__PURE__ */ jsx(IconDefinitions.CommunicationIcon, { className: "w-4 h-4" });
|
|
80793
|
-
case ActionType.WAIT_UNTIL_NEXT_FIXED_TIME:
|
|
80794
|
-
return /* @__PURE__ */ jsx(IconDefinitions.WaitUntilNextFixedTimeIcon, { className: "w-4 h-4" });
|
|
80795
|
-
default:
|
|
80796
|
-
throw UnreachableCaseStatement(type, ActionType);
|
|
80757
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
80758
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
80759
|
+
if (mayWarn) {
|
|
80760
|
+
return element.props.ref;
|
|
80797
80761
|
}
|
|
80798
|
-
|
|
80799
|
-
|
|
80800
|
-
|
|
80801
|
-
|
|
80802
|
-
|
|
80803
|
-
|
|
80804
|
-
|
|
80805
|
-
|
|
80806
|
-
|
|
80807
|
-
|
|
80808
|
-
|
|
80809
|
-
|
|
80810
|
-
|
|
80811
|
-
|
|
80812
|
-
|
|
80813
|
-
|
|
80814
|
-
|
|
80815
|
-
|
|
80816
|
-
|
|
80817
|
-
|
|
80818
|
-
|
|
80819
|
-
|
|
80820
|
-
|
|
80821
|
-
|
|
80822
|
-
|
|
80823
|
-
|
|
80824
|
-
|
|
80825
|
-
|
|
80826
|
-
|
|
80827
|
-
|
|
80828
|
-
|
|
80829
|
-
|
|
80830
|
-
|
|
80831
|
-
|
|
80832
|
-
|
|
80833
|
-
|
|
80834
|
-
|
|
80835
|
-
|
|
80836
|
-
|
|
80837
|
-
|
|
80838
|
-
|
|
80839
|
-
|
|
80840
|
-
|
|
80841
|
-
|
|
80842
|
-
|
|
80843
|
-
|
|
80844
|
-
|
|
80845
|
-
/* @__PURE__ */ jsx(
|
|
80846
|
-
"div",
|
|
80847
|
-
{
|
|
80848
|
-
style: {
|
|
80849
|
-
color: isSelected ? colors.text : colors.textUnselected
|
|
80850
|
-
},
|
|
80851
|
-
children: /* @__PURE__ */ jsx(MinorText, { children: STEP_TYPES[actionData.actionType] })
|
|
80852
|
-
}
|
|
80853
|
-
),
|
|
80854
|
-
actionData.actionType === ActionType.WAIT_UNTIL_NEXT_FIXED_TIME ? /* @__PURE__ */ jsx("div", { className: "text-[11px] text-muted-foreground font-normal rounded bg-muted/40 w-fit max-w-full truncate", children: getWaitStepDetail(actionData.actionMetadata) }) : /* @__PURE__ */ jsx("div", { className: "text-xs font-medium", children: AutomationFlowUtils.actionTypeToHumanReadable(
|
|
80855
|
-
actionData.actionType
|
|
80856
|
-
) })
|
|
80857
|
-
] })
|
|
80858
|
-
] })
|
|
80859
|
-
}
|
|
80860
|
-
);
|
|
80861
|
-
};
|
|
80862
|
-
const AutomationFlowMain = () => {
|
|
80863
|
-
const [isDetailsVisible, setIsDetailsVisible] = useState(false);
|
|
80864
|
-
const automation2 = useAutomation();
|
|
80865
|
-
const {
|
|
80866
|
-
setActionId: setActionId2,
|
|
80867
|
-
state: { selectedActionId }
|
|
80868
|
-
} = useContext$1(Context);
|
|
80869
|
-
useEffect(() => {
|
|
80870
|
-
if (!automation2) {
|
|
80871
|
-
return;
|
|
80872
|
-
}
|
|
80873
|
-
if (selectedActionId) {
|
|
80874
|
-
return;
|
|
80875
|
-
}
|
|
80876
|
-
const firstSendCommunicationAction = automation2.actionData?.find(
|
|
80877
|
-
(action) => action.actionType === "send_communication"
|
|
80762
|
+
return element.props.ref || element.ref;
|
|
80763
|
+
}
|
|
80764
|
+
var TABS_NAME = "Tabs";
|
|
80765
|
+
var [createTabsContext, createTabsScope] = createContextScope(TABS_NAME, [
|
|
80766
|
+
createRovingFocusGroupScope
|
|
80767
|
+
]);
|
|
80768
|
+
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
80769
|
+
var [TabsProvider, useTabsContext] = createTabsContext(TABS_NAME);
|
|
80770
|
+
var Tabs$1 = React.forwardRef(
|
|
80771
|
+
(props2, forwardedRef) => {
|
|
80772
|
+
const {
|
|
80773
|
+
__scopeTabs,
|
|
80774
|
+
value: valueProp,
|
|
80775
|
+
onValueChange,
|
|
80776
|
+
defaultValue,
|
|
80777
|
+
orientation = "horizontal",
|
|
80778
|
+
dir,
|
|
80779
|
+
activationMode = "automatic",
|
|
80780
|
+
...tabsProps
|
|
80781
|
+
} = props2;
|
|
80782
|
+
const direction = useDirection(dir);
|
|
80783
|
+
const [value, setValue] = useControllableState({
|
|
80784
|
+
prop: valueProp,
|
|
80785
|
+
onChange: onValueChange,
|
|
80786
|
+
defaultProp: defaultValue ?? "",
|
|
80787
|
+
caller: TABS_NAME
|
|
80788
|
+
});
|
|
80789
|
+
return /* @__PURE__ */ jsx(
|
|
80790
|
+
TabsProvider,
|
|
80791
|
+
{
|
|
80792
|
+
scope: __scopeTabs,
|
|
80793
|
+
baseId: useId(),
|
|
80794
|
+
value,
|
|
80795
|
+
onValueChange: setValue,
|
|
80796
|
+
orientation,
|
|
80797
|
+
dir: direction,
|
|
80798
|
+
activationMode,
|
|
80799
|
+
children: /* @__PURE__ */ jsx(
|
|
80800
|
+
Primitive.div,
|
|
80801
|
+
{
|
|
80802
|
+
dir: direction,
|
|
80803
|
+
"data-orientation": orientation,
|
|
80804
|
+
...tabsProps,
|
|
80805
|
+
ref: forwardedRef
|
|
80806
|
+
}
|
|
80807
|
+
)
|
|
80808
|
+
}
|
|
80878
80809
|
);
|
|
80879
|
-
if (firstSendCommunicationAction) {
|
|
80880
|
-
setActionId2(firstSendCommunicationAction.actionMetadata.currentActionId);
|
|
80881
|
-
}
|
|
80882
|
-
}, [automation2, setActionId2, selectedActionId]);
|
|
80883
|
-
if (!automation2) {
|
|
80884
|
-
return null;
|
|
80885
80810
|
}
|
|
80886
|
-
|
|
80887
|
-
|
|
80888
|
-
|
|
80889
|
-
|
|
80811
|
+
);
|
|
80812
|
+
Tabs$1.displayName = TABS_NAME;
|
|
80813
|
+
var TAB_LIST_NAME = "TabsList";
|
|
80814
|
+
var TabsList$1 = React.forwardRef(
|
|
80815
|
+
(props2, forwardedRef) => {
|
|
80816
|
+
const { __scopeTabs, loop = true, ...listProps } = props2;
|
|
80817
|
+
const context2 = useTabsContext(TAB_LIST_NAME, __scopeTabs);
|
|
80818
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
80819
|
+
return /* @__PURE__ */ jsx(
|
|
80820
|
+
Root$1,
|
|
80821
|
+
{
|
|
80822
|
+
asChild: true,
|
|
80823
|
+
...rovingFocusGroupScope,
|
|
80824
|
+
orientation: context2.orientation,
|
|
80825
|
+
dir: context2.dir,
|
|
80826
|
+
loop,
|
|
80827
|
+
children: /* @__PURE__ */ jsx(
|
|
80828
|
+
Primitive.div,
|
|
80829
|
+
{
|
|
80830
|
+
role: "tablist",
|
|
80831
|
+
"aria-orientation": context2.orientation,
|
|
80832
|
+
...listProps,
|
|
80833
|
+
ref: forwardedRef
|
|
80834
|
+
}
|
|
80835
|
+
)
|
|
80890
80836
|
}
|
|
80891
|
-
|
|
80892
|
-
}),
|
|
80893
|
-
rootActionId: automation2.triggerMetadata?.triggerType === AutomationTriggerType.TRIGGER_BASED ? automation2.triggerMetadata.rootActionId : void 0
|
|
80894
|
-
});
|
|
80895
|
-
let renderTriggerAndAudienceStep = () => /* @__PURE__ */ jsx(Fragment, {});
|
|
80896
|
-
if (isDetailsVisible || automation2.triggerType === AutomationTriggerType.ONE_TIME) {
|
|
80897
|
-
renderTriggerAndAudienceStep = () => {
|
|
80898
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80899
|
-
/* @__PURE__ */ jsx(AutomationEditorTrigger, {}),
|
|
80900
|
-
automation2.triggerType === AutomationTriggerType.ONE_TIME && /* @__PURE__ */ jsx(AutomationAudienceSelector, {})
|
|
80901
|
-
] });
|
|
80902
|
-
};
|
|
80837
|
+
);
|
|
80903
80838
|
}
|
|
80904
|
-
|
|
80905
|
-
|
|
80839
|
+
);
|
|
80840
|
+
TabsList$1.displayName = TAB_LIST_NAME;
|
|
80841
|
+
var TRIGGER_NAME = "TabsTrigger";
|
|
80842
|
+
var TabsTrigger$1 = React.forwardRef(
|
|
80843
|
+
(props2, forwardedRef) => {
|
|
80844
|
+
const { __scopeTabs, value, disabled = false, ...triggerProps } = props2;
|
|
80845
|
+
const context2 = useTabsContext(TRIGGER_NAME, __scopeTabs);
|
|
80846
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeTabs);
|
|
80847
|
+
const triggerId = makeTriggerId(context2.baseId, value);
|
|
80848
|
+
const contentId = makeContentId(context2.baseId, value);
|
|
80849
|
+
const isSelected = value === context2.value;
|
|
80906
80850
|
return /* @__PURE__ */ jsx(
|
|
80907
|
-
|
|
80851
|
+
Item,
|
|
80908
80852
|
{
|
|
80909
|
-
|
|
80910
|
-
|
|
80911
|
-
|
|
80912
|
-
|
|
80913
|
-
|
|
80914
|
-
|
|
80915
|
-
}
|
|
80916
|
-
);
|
|
80917
|
-
};
|
|
80918
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col gap-2 w-full overflow-visible", children: [
|
|
80919
|
-
renderAutomationDescription(),
|
|
80920
|
-
automation2.triggerType === AutomationTriggerType.TRIGGER_BASED && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center justify-between", children: [
|
|
80921
|
-
/* @__PURE__ */ jsx("div", { className: "text-[13px] text-muted-foreground", children: "Messages sent in listed order" }),
|
|
80922
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
80923
|
-
/* @__PURE__ */ jsx("div", { className: "text-[13px] font-medium", children: "Show all details" }),
|
|
80924
|
-
/* @__PURE__ */ jsx(
|
|
80925
|
-
Switch,
|
|
80853
|
+
asChild: true,
|
|
80854
|
+
...rovingFocusGroupScope,
|
|
80855
|
+
focusable: !disabled,
|
|
80856
|
+
active: isSelected,
|
|
80857
|
+
children: /* @__PURE__ */ jsx(
|
|
80858
|
+
Primitive.button,
|
|
80926
80859
|
{
|
|
80927
|
-
|
|
80928
|
-
|
|
80929
|
-
|
|
80930
|
-
|
|
80860
|
+
type: "button",
|
|
80861
|
+
role: "tab",
|
|
80862
|
+
"aria-selected": isSelected,
|
|
80863
|
+
"aria-controls": contentId,
|
|
80864
|
+
"data-state": isSelected ? "active" : "inactive",
|
|
80865
|
+
"data-disabled": disabled ? "" : void 0,
|
|
80866
|
+
disabled,
|
|
80867
|
+
id: triggerId,
|
|
80868
|
+
...triggerProps,
|
|
80869
|
+
ref: forwardedRef,
|
|
80870
|
+
onMouseDown: composeEventHandlers(props2.onMouseDown, (event) => {
|
|
80871
|
+
if (!disabled && event.button === 0 && event.ctrlKey === false) {
|
|
80872
|
+
context2.onValueChange(value);
|
|
80873
|
+
} else {
|
|
80874
|
+
event.preventDefault();
|
|
80875
|
+
}
|
|
80876
|
+
}),
|
|
80877
|
+
onKeyDown: composeEventHandlers(props2.onKeyDown, (event) => {
|
|
80878
|
+
if ([" ", "Enter"].includes(event.key)) context2.onValueChange(value);
|
|
80879
|
+
}),
|
|
80880
|
+
onFocus: composeEventHandlers(props2.onFocus, () => {
|
|
80881
|
+
const isAutomaticActivation = context2.activationMode !== "manual";
|
|
80882
|
+
if (!isSelected && !disabled && isAutomaticActivation) {
|
|
80883
|
+
context2.onValueChange(value);
|
|
80884
|
+
}
|
|
80885
|
+
})
|
|
80931
80886
|
}
|
|
80932
80887
|
)
|
|
80933
|
-
|
|
80934
|
-
|
|
80935
|
-
|
|
80936
|
-
|
|
80937
|
-
|
|
80938
|
-
|
|
80939
|
-
|
|
80940
|
-
|
|
80941
|
-
|
|
80942
|
-
|
|
80943
|
-
|
|
80944
|
-
|
|
80945
|
-
|
|
80946
|
-
|
|
80947
|
-
|
|
80948
|
-
|
|
80949
|
-
|
|
80950
|
-
|
|
80951
|
-
|
|
80952
|
-
|
|
80953
|
-
] });
|
|
80954
|
-
};
|
|
80955
|
-
const AutomationsEditorSidebar = () => {
|
|
80956
|
-
const automation2 = useAutomation();
|
|
80957
|
-
const { segments } = useListSegments();
|
|
80958
|
-
if (!automation2 || !segments) {
|
|
80959
|
-
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx(
|
|
80960
|
-
BasicLoader,
|
|
80888
|
+
}
|
|
80889
|
+
);
|
|
80890
|
+
}
|
|
80891
|
+
);
|
|
80892
|
+
TabsTrigger$1.displayName = TRIGGER_NAME;
|
|
80893
|
+
var CONTENT_NAME = "TabsContent";
|
|
80894
|
+
var TabsContent$1 = React.forwardRef(
|
|
80895
|
+
(props2, forwardedRef) => {
|
|
80896
|
+
const { __scopeTabs, value, forceMount, children: children2, ...contentProps } = props2;
|
|
80897
|
+
const context2 = useTabsContext(CONTENT_NAME, __scopeTabs);
|
|
80898
|
+
const triggerId = makeTriggerId(context2.baseId, value);
|
|
80899
|
+
const contentId = makeContentId(context2.baseId, value);
|
|
80900
|
+
const isSelected = value === context2.value;
|
|
80901
|
+
const isMountAnimationPreventedRef = React.useRef(isSelected);
|
|
80902
|
+
React.useEffect(() => {
|
|
80903
|
+
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
80904
|
+
return () => cancelAnimationFrame(rAF);
|
|
80905
|
+
}, []);
|
|
80906
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || isSelected, children: ({ present }) => /* @__PURE__ */ jsx(
|
|
80907
|
+
Primitive.div,
|
|
80961
80908
|
{
|
|
80962
|
-
|
|
80963
|
-
|
|
80964
|
-
|
|
80965
|
-
|
|
80909
|
+
"data-state": isSelected ? "active" : "inactive",
|
|
80910
|
+
"data-orientation": context2.orientation,
|
|
80911
|
+
role: "tabpanel",
|
|
80912
|
+
"aria-labelledby": triggerId,
|
|
80913
|
+
hidden: !present,
|
|
80914
|
+
id: contentId,
|
|
80915
|
+
tabIndex: 0,
|
|
80916
|
+
...contentProps,
|
|
80917
|
+
ref: forwardedRef,
|
|
80918
|
+
style: {
|
|
80919
|
+
...props2.style,
|
|
80920
|
+
animationDuration: isMountAnimationPreventedRef.current ? "0s" : void 0
|
|
80921
|
+
},
|
|
80922
|
+
children: present && children2
|
|
80966
80923
|
}
|
|
80967
80924
|
) });
|
|
80968
80925
|
}
|
|
80969
|
-
|
|
80970
|
-
|
|
80971
|
-
|
|
80972
|
-
|
|
80973
|
-
|
|
80974
|
-
|
|
80926
|
+
);
|
|
80927
|
+
TabsContent$1.displayName = CONTENT_NAME;
|
|
80928
|
+
function makeTriggerId(baseId, value) {
|
|
80929
|
+
return `${baseId}-trigger-${value}`;
|
|
80930
|
+
}
|
|
80931
|
+
function makeContentId(baseId, value) {
|
|
80932
|
+
return `${baseId}-content-${value}`;
|
|
80933
|
+
}
|
|
80934
|
+
var Root2 = Tabs$1;
|
|
80935
|
+
var List = TabsList$1;
|
|
80936
|
+
var Trigger = TabsTrigger$1;
|
|
80937
|
+
var Content = TabsContent$1;
|
|
80938
|
+
const Tabs = Root2;
|
|
80939
|
+
const TabsList = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx(
|
|
80940
|
+
List,
|
|
80941
|
+
{
|
|
80942
|
+
ref,
|
|
80943
|
+
className: cn$1(
|
|
80944
|
+
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
80945
|
+
className2
|
|
80946
|
+
),
|
|
80947
|
+
...props2
|
|
80948
|
+
}
|
|
80949
|
+
));
|
|
80950
|
+
TabsList.displayName = List.displayName;
|
|
80951
|
+
const TabsTrigger = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx(
|
|
80952
|
+
Trigger,
|
|
80953
|
+
{
|
|
80954
|
+
ref,
|
|
80955
|
+
className: cn$1(
|
|
80956
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
80957
|
+
className2
|
|
80958
|
+
),
|
|
80959
|
+
...props2
|
|
80960
|
+
}
|
|
80961
|
+
));
|
|
80962
|
+
TabsTrigger.displayName = Trigger.displayName;
|
|
80963
|
+
const TabsContent = React.forwardRef(({ className: className2, ...props2 }, ref) => /* @__PURE__ */ jsx(
|
|
80964
|
+
Content,
|
|
80965
|
+
{
|
|
80966
|
+
ref,
|
|
80967
|
+
className: cn$1(
|
|
80968
|
+
"ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
80969
|
+
className2
|
|
80970
|
+
),
|
|
80971
|
+
...props2
|
|
80972
|
+
}
|
|
80973
|
+
));
|
|
80974
|
+
TabsContent.displayName = Content.displayName;
|
|
80975
80975
|
const StatCard = ({
|
|
80976
80976
|
value,
|
|
80977
80977
|
label,
|
|
@@ -83924,80 +83924,32 @@ const AutomationsEditorWorkflowTab = () => {
|
|
|
83924
83924
|
};
|
|
83925
83925
|
const AutomationsEditorTabs = () => {
|
|
83926
83926
|
const [activeTab, setActiveTab] = React__default.useState("workflow");
|
|
83927
|
-
const
|
|
83928
|
-
|
|
83929
|
-
|
|
83930
|
-
|
|
83931
|
-
|
|
83932
|
-
|
|
83933
|
-
|
|
83934
|
-
|
|
83935
|
-
|
|
83936
|
-
|
|
83937
|
-
|
|
83938
|
-
|
|
83939
|
-
|
|
83927
|
+
const tabs = [
|
|
83928
|
+
{
|
|
83929
|
+
id: "workflow",
|
|
83930
|
+
label: "Workflow",
|
|
83931
|
+
content: /* @__PURE__ */ jsx(AutomationsEditorWorkflowTab, {})
|
|
83932
|
+
},
|
|
83933
|
+
{
|
|
83934
|
+
id: "recipients",
|
|
83935
|
+
label: "Recipients",
|
|
83936
|
+
content: /* @__PURE__ */ jsx(AutomationsEditorRecipientsTab, {})
|
|
83937
|
+
},
|
|
83938
|
+
{
|
|
83939
|
+
id: "insights",
|
|
83940
|
+
label: t$1("engage:insight", { count: 2 }),
|
|
83941
|
+
content: /* @__PURE__ */ jsx(AutomationsEditorStatsTab, {})
|
|
83940
83942
|
}
|
|
83941
|
-
|
|
83942
|
-
return /* @__PURE__ */
|
|
83943
|
-
|
|
83943
|
+
];
|
|
83944
|
+
return /* @__PURE__ */ jsx("div", { className: "h-full w-full", children: /* @__PURE__ */ jsx(
|
|
83945
|
+
AnimatedTabs,
|
|
83944
83946
|
{
|
|
83945
|
-
|
|
83946
|
-
|
|
83947
|
-
|
|
83948
|
-
|
|
83949
|
-
activationMode: "manual",
|
|
83950
|
-
children: [
|
|
83951
|
-
/* @__PURE__ */ jsxs("div", { className: "relative mt-1 mb-2", children: [
|
|
83952
|
-
/* @__PURE__ */ jsxs(TabsList, { className: "w-full justify-start rounded-none bg-transparent gap-2 flex min-w-0 h-auto py-1", children: [
|
|
83953
|
-
/* @__PURE__ */ jsx(
|
|
83954
|
-
TabsTrigger,
|
|
83955
|
-
{
|
|
83956
|
-
value: "workflow",
|
|
83957
|
-
tabIndex: 0,
|
|
83958
|
-
ref: (el) => tabsRef.current[0] = el,
|
|
83959
|
-
className: "data-[state=inactive]:text-muted-foreground data-[state=active]:shadow-none text-base font-normal px-3 hover:bg-muted data-[state=active]:cursor-default",
|
|
83960
|
-
children: "Workflow"
|
|
83961
|
-
}
|
|
83962
|
-
),
|
|
83963
|
-
/* @__PURE__ */ jsx(
|
|
83964
|
-
TabsTrigger,
|
|
83965
|
-
{
|
|
83966
|
-
value: "recipients",
|
|
83967
|
-
tabIndex: 0,
|
|
83968
|
-
ref: (el) => tabsRef.current[1] = el,
|
|
83969
|
-
className: "data-[state=inactive]:text-muted-foreground data-[state=active]:shadow-none text-base font-normal px-3 hover:bg-muted data-[state=active]:cursor-default",
|
|
83970
|
-
children: "Recipients"
|
|
83971
|
-
}
|
|
83972
|
-
),
|
|
83973
|
-
/* @__PURE__ */ jsx(
|
|
83974
|
-
TabsTrigger,
|
|
83975
|
-
{
|
|
83976
|
-
value: "insights",
|
|
83977
|
-
tabIndex: 0,
|
|
83978
|
-
ref: (el) => tabsRef.current[2] = el,
|
|
83979
|
-
className: "data-[state=inactive]:text-muted-foreground data-[state=active]:shadow-none text-base font-normal px-3 hover:bg-muted data-[state=active]:cursor-default",
|
|
83980
|
-
children: t$1("engage:insight", { count: 2 })
|
|
83981
|
-
}
|
|
83982
|
-
)
|
|
83983
|
-
] }),
|
|
83984
|
-
/* @__PURE__ */ jsx(
|
|
83985
|
-
"div",
|
|
83986
|
-
{
|
|
83987
|
-
className: "absolute bottom-0 h-[2px] rounded-full transition-all duration-300 ease-out\n bg-gradient-to-r from-primary to-primary/90\n shadow-[0_0_8px_rgba(var(--primary-rgb),0.3)]",
|
|
83988
|
-
style: {
|
|
83989
|
-
width: `${lineStyles.width}px`,
|
|
83990
|
-
left: `${lineStyles.left}px`
|
|
83991
|
-
}
|
|
83992
|
-
}
|
|
83993
|
-
)
|
|
83994
|
-
] }),
|
|
83995
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "workflow", className: "flex-1 px-1", children: /* @__PURE__ */ jsx(AutomationsEditorWorkflowTab, {}) }),
|
|
83996
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "recipients", className: "flex-1 px-1", children: /* @__PURE__ */ jsx(AutomationsEditorRecipientsTab, {}) }),
|
|
83997
|
-
/* @__PURE__ */ jsx(TabsContent, { value: "insights", className: "flex-1 px-1", children: /* @__PURE__ */ jsx(AutomationsEditorStatsTab, {}) })
|
|
83998
|
-
]
|
|
83947
|
+
tabs,
|
|
83948
|
+
activeTab,
|
|
83949
|
+
onTabChange: setActiveTab,
|
|
83950
|
+
tabsLocation: "left"
|
|
83999
83951
|
}
|
|
84000
|
-
);
|
|
83952
|
+
) });
|
|
84001
83953
|
};
|
|
84002
83954
|
const ViewAutomationMain = ({
|
|
84003
83955
|
showBackButton = false,
|