{"id":20244329,"url":"https://github.com/protonmail/pt-formgenerator","last_synced_at":"2025-04-10T20:43:47.869Z","repository":{"id":34556378,"uuid":"175828596","full_name":"ProtonMail/pt-formgenerator","owner":"ProtonMail","description":"Html form generator library","archived":false,"fork":false,"pushed_at":"2023-07-07T11:39:26.000Z","size":2311,"stargazers_count":8,"open_issues_count":13,"forks_count":5,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-24T18:13:11.511Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProtonMail.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-15T13:47:39.000Z","updated_at":"2023-11-20T21:31:41.000Z","dependencies_parsed_at":"2023-01-15T07:45:33.971Z","dependency_job_id":null,"html_url":"https://github.com/ProtonMail/pt-formgenerator","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtonMail%2Fpt-formgenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtonMail%2Fpt-formgenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtonMail%2Fpt-formgenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProtonMail%2Fpt-formgenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProtonMail","download_url":"https://codeload.github.com/ProtonMail/pt-formgenerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248294110,"owners_count":21079784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T09:14:30.889Z","updated_at":"2025-04-10T20:43:47.851Z","avatar_url":"https://github.com/ProtonMail.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tested with:\n- Node.js `v11.6.0`\n- npm `6.7.0`\n\nBefore you start: `$ npm i`.\n\n## Dev\n\n- `$ npm start`\n\nThat's it. Now you can test:\n- URL: `http://localhost:1234/?name=bottom`\n- URL: `http://localhost:1234/?name=top`\n\n### Conventions\n\nWhen there is an error on an input it must have a className/error with `error` inside. Why ?\nBecause we need `input:not([class*=\"error\"])` to check the validity.\n\n### About dev env\n\n- URL: `http://localhost:1234/?name=bottom`\n\n\u003e cf the key **name** inside data.\n\n```javascript\nwindow.postMessage({\n    type: 'create.form',\n    data: {\n        name: 'bottom',\n        targetOrigin: '*',\n        config: [\n            {\n                component: 'email',\n                label: 'Add a recovery email',\n                placeholder: 'Recovery Email',\n                type: 'email',\n                name: 'notificationEmail'\n            },\n            {\n                component: 'signupSubmit',\n                messages: {\n                    agreeLabel: 'By clicking Create Account, you agree to abide by',\n                    agreeLink: \"ProtonMail's Terms and Conditions\",\n                    alreadyUser: 'Already have an account?'\n                },\n                button: {\n                    label: 'Create Account'\n                }\n            }\n        ]\n    }\n});\n```\n\n- URL: `http://localhost:1234/?name=top`\n\n\u003e cf the key **name** inside data.\n\n```javascript\nwindow.postMessage({\n    type: 'create.form',\n    data: {\n        name: 'top',\n        targetOrigin: '*',\n        config: [\n            {\n                component: 'username',\n                label: 'Choose a username',\n                placeholder: 'Jean Valjean',\n                maxlength: 10,\n                minlength: 3,\n                required: true,\n                name: 'username',\n                domains: {\n                    component: 'domains',\n                    label: 'Select a domain',\n                    name: 'domain',\n                    options: [\n                        {\n                            selected: true,\n                            value: 'protonmail.com'\n                        },\n                        {\n                            value: 'protonmail.ch'\n                        }\n                    ]\n                }\n            }\n        ]\n    }\n});\n```\n\n\u003e For this component you can see a custom config for the API, with a route and custom headers.\n\n:warning: **You must set a key `targetOrigin` inside the config, as we use [postMessage() API](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage). It's important for the security.**\n`\n\n## Build\n\n- `$ npm run build`\n\nIt will create 3 files:\n- `dist/main.ie11.js`: _App bundle for IE11_\n- `dist/main.ie11.js.map`: __Sourcemap__\n- `dist/main.js`: _App bundle_\n- `dist/main.js.map`: _Sourcemap_\n- `dist/main.css`: _Stylesheet_\n\n### Dev build\n\n- `$ npm run dev`\n\n\u003e :warning: _It won't build the version for IE_\n\n### New version\n\n- `$ npm run version \u003cpatch|minor|major\u003e` \nand :popcorn: it will do everything else.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotonmail%2Fpt-formgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprotonmail%2Fpt-formgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprotonmail%2Fpt-formgenerator/lists"}