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

Campaign config override bugs #544

Closed marcinkoziej closed 3 years ago

marcinkoziej commented 3 years ago

https://github.com/fixthestatusquo/proca/blob/30b2ba9adae10713f9ec1cfea13dbf5f094ae55e/webpack/config.js#L18

function configFolder() {
  return process.env.REACT_APP_CONFIG_FOLDER
    ? "../" + process.env.REACT_APP_CONFIG_FOLDER + "/"
  //   ^^^ is this .. wanted? if I defined REACT_APP_CONFIG_FOLDER to absolute path (/var/db/proca-configs) the result is not what I'd expect!
    : "../config/";
}

If this is wanted can we just:

return `../${process.env.REACT_APP_CONFIG_FOLDER || "config"}/`; 

?

marcinkoziej commented 3 years ago

https://github.com/fixthestatusquo/proca/blob/30b2ba9adae10713f9ec1cfea13dbf5f094ae55e/webpack/config.js#L42

The colon in campaign: seems to be a typo. On the other hand i see this in config and code too.. I don't understand this - when using locales in yaml format, the : is not the part of the key!

marcinkoziej commented 3 years ago

https://github.com/fixthestatusquo/proca/blob/30b2ba9adae10713f9ec1cfea13dbf5f094ae55e/webpack/config.js#L47

Shouldn't the merge be reversed? so page's components, layout config override the campaign ones?

marcinkoziej commented 3 years ago

https://github.com/fixthestatusquo/proca/blob/30b2ba9adae10713f9ec1cfea13dbf5f094ae55e/webpack/config.js#L43

Can we make the keys match? demand vs description

marcinkoziej commented 3 years ago

I moved the config from a widget to campaign for collect-ubi-test; then joined as partner (ap 472) and the result does not produce a proper widget. Log here, I have dumped the resulting config - as you see, journey is wrong (it use the default config of empty partner page), and there is maybe some locale problem (the en: { de: { ... print out, I have no idea where it is printed because you did not add a label to console.log (if you do console.log(variable) it's super hard to locate. If you do console.log('locale after merge:', locale) it is easier).

building https://widget.proca.app/d/collect-ubi-test/plain/index.html
to publish:
 rsync -avz d/collect-ubi-test kundera:/var/www/act.tttp/d/
Creating an optimized production build...
en {
  de: {
    donation: {
      intro: 'Dank Deiner Spende machen wir mit {{campaign}}, die demokratische Mitsprache einfacher'
    }
  }
}
{
  "actionpage": 472,
  "organisation": "plain",
  "lang": "en",
  "filename": "collect-ubi-test/plain",
  "lead": {
    "name": "campax",
    "title": "Campax Collect Platform"
  },
  "campaign": {
    "title": "Universal Basic Income",
    "name": "collect-ubi-test"
  },
  "journey": [
    "Petition",
    "Share"
  ],
  "layout": {
    "HtmlTemplate": "CH-initiative.html",
    "primaryColor": "#a53264"
  },
  "component": {
    "consent": {
      "privacyPolicy": "https://campax.org/privacy-policy/"
    },
    "donation": {
      "currency": {
        "code": "CHF",
        "symbol": ".-"
      },
      "external": {
        "url": "https://campax.payrexx.com/de/pay?cid=d6a7c49a&invoice_number=Campax&invoice_amount="
      },
      "monthly": false,
      "oneoff": {
        "average": 35,
        "default": [
          7,
          15,
          25,
          50,
          100,
          200
        ],
        "url": ""
      }
    },
    "initiative": {
      "prefixActionPage": "collect.campax.org/"
    },
    "share": {
      "email": false,
      "next": true,
      "reddit": false
    }
  },
  "portal": [],
  "locales": {
    "campaign:": {
      "description": "Universal Basic income, the text"
    }
  }
}
30b2ba9adae10713f9ec1cfea13dbf5f094ae55e
Compiled successfully.

File sizes after gzip:

  202.91 KB  build/index.js

The project was built assuming it is hosted at /d/collect-ubi-test/plain/.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  bit.ly/CRA-deploy

Done in 11.51s.
tttp commented 3 years ago

https://github.com/fixthestatusquo/proca/blob/30b2ba9adae10713f9ec1cfea13dbf5f094ae55e/webpack/config.js#L42

The colon in campaign: seems to be a typo. On the other hand i see this in config and code too.. I don't understand this - when using locales in yaml format, the : is not the part of the key!

the ":" at the end isn't a typo, that's to define the name space

we have two name spaces "common:" and "campaign:"

tttp commented 3 years ago

it seems that the yarn pull defaults to Petition + Share if empty.

So it means that campaign NEEDS to default the journey to Petition + Share so I can remove it. Is this the case @marcinkoziej ?

as for the de.intro.donation, where does it come from? how was it defined on the campaign?

tttp commented 3 years ago

Cleaned up and removed the console.log.

the format is ok and as expected

marcinkoziej commented 3 years ago

Right now the column is set by default to Petition, Share - on server - but we want to remove this column and new action page will just have clear empty config.

Right now there needs to be some smart logic to pick the right journey,,.