fixthestatusquo / proca

Widget to transform your website into a cutting-edge campaign in 10 min. multi-lingual, privacy first.
https://proca.app
GNU Affero General Public License v3.0
36 stars 12 forks source link

How to customise: the context for context #100

Closed tttp closed 4 years ago

tttp commented 4 years ago

We need to find a balance between having a big unmaintainable mess with a gazillion options and something that is too rigid.

On the backend, we have mostly sorted it out (famous last words) with a tool that can process two "abstract" payload from the campaign website: "add action+personal data+consent" (eg a petition signature) and "add action" (eg a share on the previous signature). The core process in then encrypting the data and pushing it it to various other micro-services that will take care of other actions (send an email, add it to the CRM, generate a PDF...)

What we need now to tackle is how to customise the front-end (widget).

We have 3 main options:

  1. add css/js to customise from the campaign page (the site that embed the widget)
  2. set options to the widget generator to include/exclude some features
  3. fork and have your own widget with exactly what you want

from the campaign page

The widget is embedding html+js directly on the page (no iframe), so you are free to modify the layout or add extra features (eg add a lookup on the zipcode to pre-fill the city field)

the widget has a few hooks and you can provide your own function at the end of each step (eg "call my function displayFirework() after the user signs). or you can provide your own custom steps (eg "call my donate tool after the share step").

parameters to our widget generator

Right now, the customisation options are put into a config/your-org.yaml file, and used in the build step $widget=your-org yarn build that creates the widget you embed.

What you can customise beside the "static texts" (eg the language, name of your organisation...) is what steps you want in the journey (eg "petition,share" or "floating action button, dialog with petition" without share

At the technical level, it defines what components to include in the widget (each step is a react component)

It allows to have as many "special" steps as needed (eg "ECI signature", "CH initiative"...) and they won't be included in the code of the widget unless it's one of the step

Where I'm not sure is how to enable/disable features within a single step. For instance:

one option might be to have a line in the yaml

But it means that if we introduce a new feature, the widgets won't benefit "out of the box" without having to modify the config.

Might be better to have a multitude of {step}_{feature} = true | false and if we do not have that line, it's the default?

in the code, we'll have a multitude of if (widget.step.feature) {do the feature}

That might be a bit of a hell to manage too

Don't know @marcinkoziej ?

fork

you can customise the hell out of your widget the way you want, but we strongly suggest you to check with us first because

X+

tttp commented 4 years ago

Just to clarify: this is about how to structure the code and widget generator.

We will need to find a human friendly way of letting folks customize the widget through a UI or great documentation (storybook or something)

tttp commented 4 years ago

After further brainstorms and discussions: One context that defines the journey and allows to override the configuration of specific steps (eg the share message on twitter)

A big yaml file for now, probably a json coming from a UX that allows to configure later. To be continued...

tttp commented 4 years ago

Getting there: one big context and ability to change a value through proca.set("key,"value")

Sharp tool, you can customise a lot, and fubar things quite nicely too