@bigbinary/neeto-form-frontend 3.1.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -107,6 +107,41 @@ The engine adds setup for form on backend and allows us to attach forms to any m
107
107
  3. `additional_create_submission_actions`: You can use this method to specify any additional logic that needs to be executed after creating submissions.
108
108
  4. `additional_create_response_actions`: If you want to perform some additional actions on each of the responses, you can specify them using this method. This method receives `question` and `response_param` passed from the front-end as arguments.
109
109
 
110
+ ### Set up Google reCAPTCHA
111
+
112
+ 1. Sign up for an API key pair from the
113
+ [official website](http://www.google.com/recaptcha/admin).
114
+ 2. Configure the following `environment variables` and `secrets` with suitable
115
+ values
116
+
117
+ - Under `.env` file:
118
+
119
+ ```yaml
120
+ FORM_NANO_RECAPTCHA_V2_SITE_KEY=# Value from Google cloud console
121
+ FORM_NANO_RECAPTCHA_V2_SECRET_KEY=# Value from Google cloud console
122
+ ```
123
+
124
+ - Under `secrets.yml` file:
125
+
126
+ ```yaml
127
+ form_nano:
128
+ recaptcha_v2:
129
+ site_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SITE_KEY"] %>
130
+ secret_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SECRET_KEY"] %>
131
+ ```
132
+ 3. Include the site key in `global_props`
133
+ ```ruby
134
+ module ApplicationHelper
135
+ def get_client_props
136
+ # other variables
137
+ custom_props = {
138
+ # other props
139
+ form_nano_recaptcha_v2_site_key: Rails.application.secrets.form_nano.dig(:recaptcha_v2, :site_key)
140
+ }
141
+ end
142
+ end
143
+ ```
144
+
110
145
  ## Frontend package
111
146
  The frontend package allows us to create forms across neeto products.
112
147
 
@@ -122,7 +157,7 @@ the proper functioning of the package. Install all the peer dependencies using
122
157
  the below command:
123
158
 
124
159
  ```zsh
125
- yarn add @bigbinary/neetoui @bigbinary/neeto-icons ramda@^0.28.0 classnames@^2.3.1 formik@2.2.9 @bigbinary/neeto-commons-frontend
160
+ yarn add @bigbinary/neetoui @bigbinary/neeto-icons ramda@^0.28.0 classnames@^2.3.1 formik@2.2.9 @bigbinary/neeto-commons-frontend react-google-recaptcha
126
161
  ```
127
162
 
128
163
  3. Import stylesheet from the following location:
@@ -12,7 +12,9 @@
12
12
  "invalidField": "يرجى إدخال {{label}} صالح",
13
13
  "invalidType": "{{label}} يجب أن يكون {{type}} صالحًا",
14
14
  "requiredField": "يرجى إدخال {{label}}",
15
- "selectMin": "يرجى اختيار {{entity}}"
15
+ "selectMin": "يرجى اختيار {{min}} {{entity}}",
16
+ "incompleteCaptcha": "يرجى إكمال كلمة التحقق",
17
+ "captchaVerificationFailed": "فشل التحقق من كلمة التحقق. حاول مرة اخرى."
16
18
  },
17
19
  "fileUpload": {
18
20
  "validations": {
@@ -12,7 +12,9 @@
12
12
  "invalidField": "Bitte geben Sie ein gültiges {{label}} ein",
13
13
  "invalidType": "{{label}} sollte ein gültiger {{type}} sein",
14
14
  "requiredField": "Bitte geben Sie {{label}} ein",
15
- "selectMin": "Bitte wählen Sie {{entity}} aus"
15
+ "selectMin": "Bitte wählen Sie {{min}} {{entity}} aus",
16
+ "incompleteCaptcha": "Bitte füllen Sie das Captcha aus",
17
+ "captchaVerificationFailed": "Die Captcha-Überprüfung ist fehlgeschlagen. Bitte versuche es erneut."
16
18
  },
17
19
  "fileUpload": {
18
20
  "validations": {
@@ -50,7 +50,10 @@
50
50
  "advancedProperties": "Advanced properties",
51
51
  "clonedElementLabel": "Copy of {{label, anyCase}}",
52
52
  "option": "Option",
53
- "rating": "Rating"
53
+ "rating": "Rating",
54
+ "captchaType": "Captcha type",
55
+ "reCaptchaV2": "reCaptcha v2",
56
+ "mathCaptcha": "Match captcha"
54
57
  },
55
58
  "fields": {
56
59
  "mcf": "Multiple choice",
@@ -71,7 +74,8 @@
71
74
  "cf": "Condition",
72
75
  "iif": "Integer",
73
76
  "dif": "Decimal",
74
- "fileUpload": "File upload"
77
+ "fileUpload": "File upload",
78
+ "captcha": "Captcha"
75
79
  },
76
80
  "toasts": {
77
81
  "formSubmitted": "Form has been submitted successfully!"
@@ -132,7 +136,9 @@
132
136
  "requiredField": "Please enter {{label}}",
133
137
  "selectMin": "Please select {{min}} {{entity}}",
134
138
  "invalidType": "{{label}} should be a valid {{type}}",
135
- "fieldCantBeEmpty": "{{field, anyCase}} can't be empty"
139
+ "fieldCantBeEmpty": "{{field, anyCase}} can't be empty",
140
+ "incompleteCaptcha": "Please complete captcha",
141
+ "captchaVerificationFailed": "Captcha verification failed. Please try again."
136
142
  },
137
143
  "fileTypes": {
138
144
  "documents": "Documents",
@@ -12,7 +12,9 @@
12
12
  "invalidField": "Introduzca una {{label}} válida",
13
13
  "invalidType": "{{label}} debe ser un {{type}} válido",
14
14
  "requiredField": "Por favor ingrese {{label}}",
15
- "selectMin": "Por favor seleccione {{entity}}"
15
+ "selectMin": "Por favor seleccione {{min}} {{entity}}",
16
+ "incompleteCaptcha": "Por favor completa el captcha",
17
+ "captchaVerificationFailed": "La verificación del captcha falló. Inténtalo de nuevo."
16
18
  },
17
19
  "fileUpload": {
18
20
  "validations": {
@@ -12,7 +12,9 @@
12
12
  "invalidField": "Veuillez saisir un {{label}} valide",
13
13
  "invalidType": "{{label}} doit être un {{type}} valide",
14
14
  "requiredField": "Veuillez saisir {{label}}",
15
- "selectMin": "Veuillez sélectionner {{entity}}"
15
+ "selectMin": "Veuillez sélectionner {{min}} {{entity}}",
16
+ "incompleteCaptcha": "Veuillez compléter le captcha",
17
+ "captchaVerificationFailed": "La vérification du Captcha a échoué. Veuillez réessayer."
16
18
  },
17
19
  "fileUpload": {
18
20
  "validations": {
@@ -12,7 +12,9 @@
12
12
  "invalidField": "Voer een geldige {{label}} in",
13
13
  "invalidType": "{{label}} moet een geldige {{type}} zijn",
14
14
  "requiredField": "Voer {{label}} in",
15
- "selectMin": "Selecteer {{entity}}"
15
+ "selectMin": "Selecteer {{min}} {{entity}}",
16
+ "incompleteCaptcha": "Vul de captcha in",
17
+ "captchaVerificationFailed": "Captcha-verificatie mislukt. Probeer het opnieuw."
16
18
  },
17
19
  "fileUpload": {
18
20
  "validations": {
@@ -12,7 +12,9 @@
12
12
  "invalidField": "Proszę wprowadzić poprawną etykietę {{label}}",
13
13
  "invalidType": "{{label}} powinien być prawidłowym {{type}}",
14
14
  "requiredField": "Proszę wpisać {{label}}",
15
- "selectMin": "Proszę wybrać {{entity}}"
15
+ "selectMin": "Proszę wybrać {{min}} {{entity}}",
16
+ "incompleteCaptcha": "Proszę uzupełnić captcha",
17
+ "captchaVerificationFailed": "Weryfikacja Captcha nie powiodła się. Proszę spróbuj ponownie."
16
18
  },
17
19
  "fileUpload": {
18
20
  "validations": {
@@ -12,7 +12,9 @@
12
12
  "invalidField": "Insira um {{label}} válido",
13
13
  "invalidType": "{{label}} deve ser um {{type}} válido",
14
14
  "requiredField": "Insira {{label}}",
15
- "selectMin": "Selecione {{entity}}"
15
+ "selectMin": "Selecione {{min}} {{entity}}",
16
+ "incompleteCaptcha": "Por favor complete o captcha",
17
+ "captchaVerificationFailed": "A verificação do Captcha falhou. Por favor, tente novamente."
16
18
  },
17
19
  "fileUpload": {
18
20
  "validations": {