@formio/js 5.1.0-dev.6026.929ea40 → 5.1.0-dev.6030.abc8cfc

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.
@@ -455,7 +455,7 @@ declare class Webform extends NestedDataComponent {
455
455
  */
456
456
  submit(before?: boolean, options?: any): Promise<any>;
457
457
  submitUrl(URL: any, headers: any): void;
458
- triggerCaptcha(): void;
458
+ triggerCaptcha(components?: null): void;
459
459
  _nosubmit: any;
460
460
  get conditions(): any;
461
461
  get variables(): any;
@@ -1534,17 +1534,20 @@ class Webform extends NestedDataComponent_1.default {
1534
1534
  return console.warn(message);
1535
1535
  }
1536
1536
  }
1537
- triggerCaptcha() {
1537
+ triggerCaptcha(components = null) {
1538
1538
  if (!this || !this.components || this.options.preview) {
1539
1539
  return;
1540
1540
  }
1541
1541
  const captchaComponent = [];
1542
- (0, formUtils_1.eachComponent)(this.components, (component) => {
1542
+ (0, formUtils_1.eachComponent)(components || this.components, (component) => {
1543
1543
  if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
1544
1544
  captchaComponent.push(component);
1545
1545
  }
1546
1546
  }, true);
1547
1547
  if (captchaComponent.length > 0) {
1548
+ if (captchaComponent[0].component.provider === 'google' && components) {
1549
+ return;
1550
+ }
1548
1551
  if (this.parent) {
1549
1552
  this.parent.subFormReady.then(() => {
1550
1553
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
@@ -1553,7 +1556,6 @@ class Webform extends NestedDataComponent_1.default {
1553
1556
  else {
1554
1557
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
1555
1558
  }
1556
- ;
1557
1559
  }
1558
1560
  }
1559
1561
  set nosubmit(value) {
package/lib/cjs/Wizard.js CHANGED
@@ -602,6 +602,7 @@ class Wizard extends Webform_1.default {
602
602
  }
603
603
  this.redraw().then(() => {
604
604
  this.checkData(this.submission.data);
605
+ this.triggerCaptcha(this.currentPanel.components);
605
606
  const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
606
607
  if (this.alert) {
607
608
  this.showErrors(errors, true, true);
@@ -46,6 +46,5 @@ export default class WizardBuilder extends WebformBuilder {
46
46
  components: any[];
47
47
  };
48
48
  pasteComponent(component: any): void;
49
- copyComponent(component: any): void;
50
49
  }
51
50
  import WebformBuilder from './WebformBuilder';
@@ -261,27 +261,12 @@ class WizardBuilder extends WebformBuilder_1.default {
261
261
  if (component instanceof WizardBuilder) {
262
262
  return;
263
263
  }
264
- if (!window.sessionStorage) {
265
- return console.warn(this.t('sessionStorageSupportError'));
266
- }
267
- const isWizardPageCopied = window.sessionStorage.getItem('formio.isWizardPageCopied') === 'true' ? true : false;
268
- if (isWizardPageCopied) {
269
- const data = window.sessionStorage.getItem('formio.clipboard');
270
- if (data) {
271
- const schema = JSON.parse(data);
272
- this.addPage(schema);
273
- }
264
+ if (this._form.components.find(comp => lodash_1.default.isEqual(component.component, comp))) {
265
+ this.addPage(component);
274
266
  }
275
267
  else {
276
268
  return super.pasteComponent(component);
277
269
  }
278
270
  }
279
- copyComponent(component) {
280
- super.copyComponent(component);
281
- if (window.sessionStorage) {
282
- const isWizardPageCopied = this._form.components.indexOf(comp => lodash_1.default.isEqual(component.component, comp)) !== -1;
283
- window.sessionStorage.setItem('formio.isWizardPageCopied', isWizardPageCopied.toString());
284
- }
285
- }
286
271
  }
287
272
  exports.default = WizardBuilder;
@@ -455,7 +455,7 @@ declare class Webform extends NestedDataComponent {
455
455
  */
456
456
  submit(before?: boolean, options?: any): Promise<any>;
457
457
  submitUrl(URL: any, headers: any): void;
458
- triggerCaptcha(): void;
458
+ triggerCaptcha(components?: null): void;
459
459
  _nosubmit: any;
460
460
  get conditions(): any;
461
461
  get variables(): any;
@@ -1534,17 +1534,20 @@ export default class Webform extends NestedDataComponent {
1534
1534
  return console.warn(message);
1535
1535
  }
1536
1536
  }
1537
- triggerCaptcha() {
1537
+ triggerCaptcha(components = null) {
1538
1538
  if (!this || !this.components || this.options.preview) {
1539
1539
  return;
1540
1540
  }
1541
1541
  const captchaComponent = [];
1542
- eachComponent(this.components, (component) => {
1542
+ eachComponent(components || this.components, (component) => {
1543
1543
  if (/^(re)?captcha$/.test(component.type) && component.component.eventType === 'formLoad') {
1544
1544
  captchaComponent.push(component);
1545
1545
  }
1546
1546
  }, true);
1547
1547
  if (captchaComponent.length > 0) {
1548
+ if (captchaComponent[0].component.provider === 'google' && components) {
1549
+ return;
1550
+ }
1548
1551
  if (this.parent) {
1549
1552
  this.parent.subFormReady.then(() => {
1550
1553
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
@@ -1553,7 +1556,6 @@ export default class Webform extends NestedDataComponent {
1553
1556
  else {
1554
1557
  captchaComponent[0].verify(`${this.form.name ? this.form.name : 'form'}Load`);
1555
1558
  }
1556
- ;
1557
1559
  }
1558
1560
  }
1559
1561
  set nosubmit(value) {
package/lib/mjs/Wizard.js CHANGED
@@ -594,6 +594,7 @@ export default class Wizard extends Webform {
594
594
  }
595
595
  this.redraw().then(() => {
596
596
  this.checkData(this.submission.data);
597
+ this.triggerCaptcha(this.currentPanel.components);
597
598
  const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
598
599
  if (this.alert) {
599
600
  this.showErrors(errors, true, true);
@@ -46,6 +46,5 @@ export default class WizardBuilder extends WebformBuilder {
46
46
  components: any[];
47
47
  };
48
48
  pasteComponent(component: any): void;
49
- copyComponent(component: any): void;
50
49
  }
51
50
  import WebformBuilder from './WebformBuilder';
@@ -255,26 +255,11 @@ export default class WizardBuilder extends WebformBuilder {
255
255
  if (component instanceof WizardBuilder) {
256
256
  return;
257
257
  }
258
- if (!window.sessionStorage) {
259
- return console.warn(this.t('sessionStorageSupportError'));
260
- }
261
- const isWizardPageCopied = window.sessionStorage.getItem('formio.isWizardPageCopied') === 'true' ? true : false;
262
- if (isWizardPageCopied) {
263
- const data = window.sessionStorage.getItem('formio.clipboard');
264
- if (data) {
265
- const schema = JSON.parse(data);
266
- this.addPage(schema);
267
- }
258
+ if (this._form.components.find(comp => _.isEqual(component.component, comp))) {
259
+ this.addPage(component);
268
260
  }
269
261
  else {
270
262
  return super.pasteComponent(component);
271
263
  }
272
264
  }
273
- copyComponent(component) {
274
- super.copyComponent(component);
275
- if (window.sessionStorage) {
276
- const isWizardPageCopied = this._form.components.indexOf(comp => _.isEqual(component.component, comp)) !== -1;
277
- window.sessionStorage.setItem('formio.isWizardPageCopied', isWizardPageCopied.toString());
278
- }
279
- }
280
265
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.6026.929ea40",
3
+ "version": "5.1.0-dev.6030.abc8cfc",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {