Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ [FEATURE]: Add default input values and outer state management options #81

Closed
2 tasks
thinkjrs opened this issue Aug 12, 2022 · 2 comments · Fixed by #97
Closed
2 tasks

✨ [FEATURE]: Add default input values and outer state management options #81

thinkjrs opened this issue Aug 12, 2022 · 2 comments · Fixed by #97
Assignees
Labels
enhancement New feature or request

Comments

@thinkjrs
Copy link
Member

thinkjrs commented Aug 12, 2022

Is your feature request related to a problem? Please describe.
It would be nice to be able to customize default input values in the options config object.

Describe the solution you'd like
Add inputValues and other keys to options object, e.g.

<PromoButton
  options={{
    inputValues: {
      adTitle: "My default title",
      budget: 55,
      target: "https://b00st.com",
      adCopy: "Save time and make defaults!",
      adCallToAction: "Do it now!",
      buttonText: "Sign up",
    }
  }}
/>

In contrast to #80 , these options should actually be proper "defaults" and eventually filter through to the backend submission, without any user input (other than submitting the form).

Use cases

  1. Pre-fill promo-button developer app button with optimized defaults
  2. Pre-fill a past campaign to be re-run
  3. Generally handle and/or expose PromoButton state data from a parent component, such as a developer's app dashboard.

Requirements

  • add inputValues to options config
  • add setPromoData to options config

If either of the above is present, use it to manage state alongside our current implementation.

For example, using setPromoData should update inside of the submitCampaign function within the PromoButton component body implementation.

Specifically:

const data = {
  target_link: event.target.target.value,
  budget: event.target.budget.value,
  email: email,
  creative_uri: fileImage,
  asset_title: event.target.adTitle.value || event.target.name.value,
};

Should include

const data = {
  target_link: event.target.target.value,
  budget: event.target.budget.value,
  email: email,
  creative_uri: fileImage,
  asset_title: event.target.adTitle.value || event.target.name.value,
};
if (typeof setPromoDataset !== 'undefined') {
    setPromoData({data});
}
@thinkjrs thinkjrs added the enhancement New feature or request label Aug 12, 2022
@thinkjrs thinkjrs self-assigned this Aug 12, 2022
@thinkjrs thinkjrs changed the title ✨ [Feature]: Add default input text options ✨ [FEATURE]: Add default input text options Aug 12, 2022
@thinkjrs
Copy link
Member Author

I just had an additional use for this come up: state management via an HOC flow-through.

@thinkjrs thinkjrs changed the title ✨ [FEATURE]: Add default input text options ✨ [FEATURE]: Add default input value options Oct 24, 2022
@thinkjrs thinkjrs changed the title ✨ [FEATURE]: Add default input value options ✨ [FEATURE]: Add default input values and outer state management options Oct 24, 2022
@thinkjrs
Copy link
Member Author

I'm working on this now and will tag the PR as soon as it's pushed 💥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant