@trycourier/react-designer 0.0.0-canary-20251030183313 → 0.0.0-canary-20251105135516
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/cjs/index.js +40 -40
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/styles.css +0 -8
- package/dist/components/TemplateEditor/store.d.ts +3 -0
- package/dist/components/extensions/Variable/VariableIcon.d.ts +5 -1
- package/dist/components/extensions/Variable/VariableTypeHandler.d.ts +5 -0
- package/dist/components/extensions/Variable/index.d.ts +1 -0
- package/dist/components/extensions/index.d.ts +1 -1
- package/dist/components/hooks/index.d.ts +1 -0
- package/dist/components/hooks/useVariables.d.ts +36 -0
- package/dist/components/utils/extractVariablesFromContent.d.ts +13 -0
- package/dist/esm/index.js +39 -39
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/styles.css +0 -8
- package/dist/index.d.ts +1 -0
- package/dist/styles.css +0 -8
- package/package.json +1 -1
package/dist/cjs/styles.css
CHANGED
|
@@ -1640,10 +1640,6 @@ body {
|
|
|
1640
1640
|
--tw-border-opacity: 1;
|
|
1641
1641
|
border-color: rgb(59 130 246 / var(--tw-border-opacity, 1));
|
|
1642
1642
|
}
|
|
1643
|
-
.courier-border-\[\#BFDBFE\] {
|
|
1644
|
-
--tw-border-opacity: 1;
|
|
1645
|
-
border-color: rgb(191 219 254 / var(--tw-border-opacity, 1));
|
|
1646
|
-
}
|
|
1647
1643
|
.courier-border-accent-foreground {
|
|
1648
1644
|
border-color: var(--accent-foreground);
|
|
1649
1645
|
}
|
|
@@ -1743,10 +1739,6 @@ body {
|
|
|
1743
1739
|
--tw-bg-opacity: 1;
|
|
1744
1740
|
background-color: rgb(229 229 229 / var(--tw-bg-opacity, 1));
|
|
1745
1741
|
}
|
|
1746
|
-
.courier-bg-\[\#EFF6FF\] {
|
|
1747
|
-
--tw-bg-opacity: 1;
|
|
1748
|
-
background-color: rgb(239 246 255 / var(--tw-bg-opacity, 1));
|
|
1749
|
-
}
|
|
1750
1742
|
.courier-bg-\[\#F5F5F5\] {
|
|
1751
1743
|
--tw-bg-opacity: 1;
|
|
1752
1744
|
background-color: rgb(245 245 245 / var(--tw-bg-opacity, 1));
|
|
@@ -26,3 +26,6 @@ export declare const isTemplateTransitioningAtom: import("jotai").PrimitiveAtom<
|
|
|
26
26
|
export declare const isSidebarExpandedAtom: import("jotai").PrimitiveAtom<boolean> & {
|
|
27
27
|
init: boolean;
|
|
28
28
|
};
|
|
29
|
+
export declare const variableValuesAtom: import("jotai").PrimitiveAtom<Record<string, string>> & {
|
|
30
|
+
init: Record<string, string>;
|
|
31
|
+
};
|
|
@@ -24,4 +24,4 @@ export { Paragraph } from "./Paragraph";
|
|
|
24
24
|
export { Selection } from "./Selection";
|
|
25
25
|
export { SlashMenu } from "./SlashMenu";
|
|
26
26
|
export { UniqueId } from "./UniqueId";
|
|
27
|
-
export { Variable, VariableNode, VariablePaste } from "./Variable";
|
|
27
|
+
export { Variable, VariableNode, VariablePaste, VariableTypeHandler } from "./Variable";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ChannelType } from "@/store";
|
|
2
|
+
export interface UseVariablesResult {
|
|
3
|
+
/**
|
|
4
|
+
* All available variables from the editor configuration
|
|
5
|
+
*/
|
|
6
|
+
availableVariables: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Variables that are actually used in the channel's content
|
|
9
|
+
*/
|
|
10
|
+
usedVariables: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Current variable values (for preview/testing)
|
|
13
|
+
*/
|
|
14
|
+
variableValues: Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Update a variable's value
|
|
17
|
+
*/
|
|
18
|
+
addVariableValue: (key: string, value: string) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Hook to access and manage variables for a specific channel
|
|
22
|
+
*
|
|
23
|
+
* @param channelType - The channel to get variables for (e.g., 'email', 'sms', 'slack')
|
|
24
|
+
* @returns Object containing available variables, used variables, current values, and update function
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* const { availableVariables, usedVariables, variableValues, addVariableValue } = useVariables('email');
|
|
29
|
+
*
|
|
30
|
+
* // availableVariables = ['user.name', 'user.email', 'orderTotal']
|
|
31
|
+
* // usedVariables = ['user.name', 'orderTotal']
|
|
32
|
+
*
|
|
33
|
+
* addVariableValue('user.name', 'John Doe');
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const useVariables: (channelType?: ChannelType) => UseVariablesResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ElementalNode } from "../../types/elemental.types";
|
|
2
|
+
/**
|
|
3
|
+
* Extracts all variable names used in the content in the format {{variableName}}
|
|
4
|
+
* Supports nested dot notation like {{user.profile.name}}
|
|
5
|
+
*
|
|
6
|
+
* Extracts variables from:
|
|
7
|
+
* - Text content (content properties)
|
|
8
|
+
* - Element attributes (href, src, alt_text, etc.)
|
|
9
|
+
* - Channel raw properties (subject, title, text)
|
|
10
|
+
* - Conditional logic (if, loop properties)
|
|
11
|
+
* - Localized content and attributes
|
|
12
|
+
*/
|
|
13
|
+
export declare const extractVariablesFromContent: (elements?: ElementalNode[]) => string[];
|