arikchakma / maily.to

Craft beautiful emails effortlessly with Maily, the powerful email editor that ensures impeccable communication across all major clients.
https://maily.to
MIT License
1.61k stars 81 forks source link

Extend variables api configuration #35

Closed BigDog1400 closed 9 months ago

BigDog1400 commented 9 months ago

Showing a warning for every variable added (that doesn't have a fallback), may cause some confusion for some users. I will like to propose change the api for the variables prop to this

type ExtensionsProps = {
  variables?: Array<{
    name: string;
    defaultValue?: string;
    required?: boolean // default to true
  }>
};

In this proposal, each variable in the array can have an associated 'name', an optional 'defaultValue', and a 'required' flag that defaults to true. This approach could make the handling of variables more flexible and intuitive for users.

arikchakma commented 9 months ago

I agree. Let's not add the defaultValue in the props. Only name and required is fine I think. Because we have to manually add the fallback value.