@marvalt/wadapter 2.3.4 → 2.3.6
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/dist/gravity-forms/gravity-forms-client.d.ts +1 -1
- package/dist/gravity-forms/gravity-forms-client.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +138 -68
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +138 -67
- package/dist/index.js.map +1 -1
- package/dist/react/components/GravityForm.d.ts.map +1 -1
- package/dist/react/components/TurnstileWidget.d.ts +50 -0
- package/dist/react/components/TurnstileWidget.d.ts.map +1 -0
- package/dist/server/gravity-forms-proxy.d.ts +22 -0
- package/dist/server/gravity-forms-proxy.d.ts.map +1 -0
- package/dist/server/index.d.ts +23 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/turnstile.d.ts +24 -0
- package/dist/server/turnstile.d.ts.map +1 -0
- package/dist/server.cjs +212 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.esm.js +209 -0
- package/dist/server.esm.js.map +1 -0
- package/dist/types/gravity-forms.d.ts +1 -0
- package/dist/types/gravity-forms.d.ts.map +1 -1
- package/package.json +9 -2
- package/scripts/postinstall.cjs +96 -0
- package/templates/gravity-forms-submit.ts +21 -0
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { GravityFormsConfig, GravityForm, GravityFormSubmission, GravityFormSubmissionResult } from '../types/gravity-forms';
|
|
18
18
|
export declare class GravityFormsClient {
|
|
19
|
+
private proxyEndpoint;
|
|
19
20
|
private config;
|
|
20
21
|
constructor(config: GravityFormsConfig);
|
|
21
22
|
private makeRequest;
|
|
22
|
-
private getBaseUrl;
|
|
23
23
|
getForm(id: number): Promise<GravityForm>;
|
|
24
24
|
getForms(): Promise<GravityForm[]>;
|
|
25
25
|
getFormConfig(id: number): Promise<GravityForm>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gravity-forms-client.d.ts","sourceRoot":"","sources":["../../src/gravity-forms/gravity-forms-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE7H,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,EAAE,kBAAkB;
|
|
1
|
+
{"version":3,"file":"gravity-forms-client.d.ts","sourceRoot":"","sources":["../../src/gravity-forms/gravity-forms-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE7H,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,MAAM,CAAqB;gBAEvB,MAAM,EAAE,kBAAkB;YAQxB,WAAW;IAoCnB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAMzC,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAMlC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAM/C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAiBnG,SAAS,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;CAI1F"}
|
package/dist/index.d.ts
CHANGED
|
@@ -545,6 +545,7 @@ interface GravityFormSubmission {
|
|
|
545
545
|
source_page_confirmations?: any;
|
|
546
546
|
target_page_number?: number;
|
|
547
547
|
target_page_confirmations?: any;
|
|
548
|
+
headers?: Record<string, string>;
|
|
548
549
|
}
|
|
549
550
|
interface GravityFormSubmissionResult {
|
|
550
551
|
success: boolean;
|
|
@@ -588,10 +589,10 @@ interface GravityFormsConfig {
|
|
|
588
589
|
*/
|
|
589
590
|
|
|
590
591
|
declare class GravityFormsClient {
|
|
592
|
+
private proxyEndpoint;
|
|
591
593
|
private config;
|
|
592
594
|
constructor(config: GravityFormsConfig);
|
|
593
595
|
private makeRequest;
|
|
594
|
-
private getBaseUrl;
|
|
595
596
|
getForm(id: number): Promise<GravityForm$1>;
|
|
596
597
|
getForms(): Promise<GravityForm$1[]>;
|
|
597
598
|
getFormConfig(id: number): Promise<GravityForm$1>;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { useState, useEffect, useCallback, createContext, useContext } from 'react';
|
|
1
|
+
import require$$0, { useState, useEffect, useCallback, useRef, useMemo, createContext, useContext } from 'react';
|
|
2
2
|
import { writeFileSync } from 'fs';
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
|
|
@@ -265,33 +265,18 @@ function transformWordPressMediaItems(media) {
|
|
|
265
265
|
class GravityFormsClient {
|
|
266
266
|
constructor(config) {
|
|
267
267
|
this.config = config;
|
|
268
|
+
// Convention-based: Always use /api/gravity-forms-submit unless explicitly overridden
|
|
269
|
+
// This matches the Mautic pattern for consistency
|
|
270
|
+
this.proxyEndpoint = config.proxyEndpoint || '/api/gravity-forms-submit';
|
|
268
271
|
}
|
|
269
272
|
async makeRequest(endpoint, options = {}) {
|
|
270
|
-
//
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
// For proxy modes, pass the full REST path including /wp-json as query parameter
|
|
274
|
-
const baseUrl = this.getBaseUrl();
|
|
275
|
-
const fullEndpoint = `/wp-json${endpoint}`;
|
|
276
|
-
url = `${baseUrl}?endpoint=${encodeURIComponent(fullEndpoint)}`;
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
// For direct mode, construct the full API URL
|
|
280
|
-
url = `${this.config.apiUrl}${endpoint}`;
|
|
281
|
-
}
|
|
273
|
+
// Always use proxy endpoint (convention-based, like Mautic)
|
|
274
|
+
const proxyEndpoint = endpoint.startsWith('/') ? endpoint : `/${endpoint}`;
|
|
275
|
+
const url = `${this.proxyEndpoint}?endpoint=${encodeURIComponent(proxyEndpoint)}`;
|
|
282
276
|
const headers = {
|
|
283
277
|
'Content-Type': 'application/json',
|
|
284
278
|
...options.headers,
|
|
285
279
|
};
|
|
286
|
-
// Add authentication based on mode
|
|
287
|
-
if (this.config.authMode === 'cloudflare_proxy') ;
|
|
288
|
-
else {
|
|
289
|
-
// Direct mode - use basic auth
|
|
290
|
-
if (this.config.username && this.config.password) {
|
|
291
|
-
const credentials = btoa(`${this.config.username}:${this.config.password}`);
|
|
292
|
-
headers.Authorization = `Basic ${credentials}`;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
280
|
const response = await fetch(url, {
|
|
296
281
|
...options,
|
|
297
282
|
headers,
|
|
@@ -315,56 +300,37 @@ class GravityFormsClient {
|
|
|
315
300
|
throw new Error(`Failed to parse JSON response: ${error.message}`);
|
|
316
301
|
}
|
|
317
302
|
}
|
|
318
|
-
getBaseUrl() {
|
|
319
|
-
switch (this.config.authMode) {
|
|
320
|
-
case 'cloudflare_proxy':
|
|
321
|
-
return this.config.cloudflareWorkerUrl || '';
|
|
322
|
-
default:
|
|
323
|
-
return this.config.apiUrl || '';
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
303
|
async getForm(id) {
|
|
327
|
-
//
|
|
328
|
-
|
|
329
|
-
const useCustom = this.config.useCustomEndpoint;
|
|
330
|
-
const endpoint = useCustom
|
|
331
|
-
? `/forms/${id}` // apiUrl already includes /wp-json/gf-api/v1
|
|
332
|
-
: (this.config.authMode === 'cloudflare_proxy'
|
|
333
|
-
? `/gf-api/v1/forms/${id}`
|
|
334
|
-
: `/wp-json/gf/v2/forms/${id}`);
|
|
304
|
+
// Always use custom gf-api/v1 endpoint (from custom plugin)
|
|
305
|
+
const endpoint = `/forms/${id}`;
|
|
335
306
|
return this.makeRequest(endpoint);
|
|
336
307
|
}
|
|
337
308
|
async getForms() {
|
|
338
|
-
|
|
339
|
-
const endpoint =
|
|
340
|
-
? '/forms' // apiUrl already includes /wp-json/gf-api/v1
|
|
341
|
-
: (this.config.authMode === 'cloudflare_proxy'
|
|
342
|
-
? '/gf-api/v1/forms'
|
|
343
|
-
: '/wp-json/gf/v2/forms');
|
|
309
|
+
// Always use custom gf-api/v1 endpoint (from custom plugin)
|
|
310
|
+
const endpoint = '/forms';
|
|
344
311
|
return this.makeRequest(endpoint);
|
|
345
312
|
}
|
|
346
313
|
async getFormConfig(id) {
|
|
347
|
-
|
|
348
|
-
const endpoint =
|
|
349
|
-
? `/forms/${id}/config` // apiUrl already includes /wp-json/gf-api/v1
|
|
350
|
-
: (this.config.authMode === 'cloudflare_proxy'
|
|
351
|
-
? `/gf-api/v1/forms/${id}/config`
|
|
352
|
-
: `/wp-json/gf/v2/forms/${id}`); // v2 returns full form including settings
|
|
314
|
+
// Always use custom gf-api/v1 endpoint (from custom plugin)
|
|
315
|
+
const endpoint = `/forms/${id}/config`;
|
|
353
316
|
return this.makeRequest(endpoint);
|
|
354
317
|
}
|
|
355
318
|
async submitForm(formId, submission) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
319
|
+
// Always use custom gf-api/v1 submit endpoint (from custom plugin)
|
|
320
|
+
const endpoint = `/forms/${formId}/submit`;
|
|
321
|
+
// Merge custom headers (e.g., Turnstile token) with default headers
|
|
322
|
+
const headers = {
|
|
323
|
+
'Content-Type': 'application/json',
|
|
324
|
+
...(submission.headers || {}),
|
|
325
|
+
};
|
|
359
326
|
return this.makeRequest(endpoint, {
|
|
360
327
|
method: 'POST',
|
|
361
|
-
|
|
328
|
+
headers,
|
|
329
|
+
body: JSON.stringify(submission.field_values),
|
|
362
330
|
});
|
|
363
331
|
}
|
|
364
332
|
async getHealth() {
|
|
365
|
-
const endpoint =
|
|
366
|
-
? '/gf-api/v1/health'
|
|
367
|
-
: '/wp-json/gf/v2/health';
|
|
333
|
+
const endpoint = '/health';
|
|
368
334
|
return this.makeRequest(endpoint);
|
|
369
335
|
}
|
|
370
336
|
}
|
|
@@ -1932,15 +1898,115 @@ const WordPressContent = ({ content, className = '', showExcerpt = false, showDa
|
|
|
1932
1898
|
return (jsxRuntimeExports.jsxs("article", { className: `wordpress-content ${className}`, children: [jsxRuntimeExports.jsxs("header", { className: "content-header", children: [jsxRuntimeExports.jsx("h1", { className: "content-title", dangerouslySetInnerHTML: { __html: content.title.rendered } }), showDate && (jsxRuntimeExports.jsx("time", { className: "content-date", dateTime: content.date, children: new Date(content.date).toLocaleDateString() })), showAuthor && 'author' in content && (jsxRuntimeExports.jsxs("span", { className: "content-author", children: ["Author ID: ", content.author] }))] }), showExcerpt && content.excerpt && (jsxRuntimeExports.jsx("div", { className: "content-excerpt", dangerouslySetInnerHTML: { __html: content.excerpt.rendered } })), jsxRuntimeExports.jsx("div", { className: "content-body", dangerouslySetInnerHTML: { __html: content.content.rendered } })] }));
|
|
1933
1899
|
};
|
|
1934
1900
|
|
|
1901
|
+
const TurnstileWidget = ({ siteKey, action, cData, onSuccess, onError, onExpire, theme = 'auto', size = 'normal', tabIndex, }) => {
|
|
1902
|
+
const widgetRef = useRef(null);
|
|
1903
|
+
const widgetId = useRef(null);
|
|
1904
|
+
const scriptLoaded = useRef(false);
|
|
1905
|
+
useEffect(() => {
|
|
1906
|
+
if (!widgetRef.current || !siteKey)
|
|
1907
|
+
return;
|
|
1908
|
+
const loadTurnstile = () => {
|
|
1909
|
+
if (window.turnstile && widgetRef.current && !widgetId.current) {
|
|
1910
|
+
try {
|
|
1911
|
+
widgetId.current = window.turnstile.render(widgetRef.current, {
|
|
1912
|
+
sitekey: siteKey,
|
|
1913
|
+
callback: onSuccess,
|
|
1914
|
+
'error-callback': onError,
|
|
1915
|
+
'expired-callback': onExpire,
|
|
1916
|
+
theme,
|
|
1917
|
+
size,
|
|
1918
|
+
tabindex: tabIndex,
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
catch (error) {
|
|
1922
|
+
console.error('Failed to render Turnstile widget:', error);
|
|
1923
|
+
onError?.();
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
// Check if Turnstile is already loaded
|
|
1928
|
+
if (window.turnstile) {
|
|
1929
|
+
loadTurnstile();
|
|
1930
|
+
}
|
|
1931
|
+
else if (!scriptLoaded.current) {
|
|
1932
|
+
// Load Turnstile script
|
|
1933
|
+
scriptLoaded.current = true;
|
|
1934
|
+
const script = document.createElement('script');
|
|
1935
|
+
script.src = 'https://challenges.cloudflare.com/turnstile/v0/api.js';
|
|
1936
|
+
script.async = true;
|
|
1937
|
+
script.defer = true;
|
|
1938
|
+
script.onload = loadTurnstile;
|
|
1939
|
+
script.onerror = () => {
|
|
1940
|
+
console.error('Failed to load Turnstile script');
|
|
1941
|
+
onError?.();
|
|
1942
|
+
};
|
|
1943
|
+
document.head.appendChild(script);
|
|
1944
|
+
}
|
|
1945
|
+
return () => {
|
|
1946
|
+
if (widgetId.current && window.turnstile) {
|
|
1947
|
+
try {
|
|
1948
|
+
window.turnstile.remove(widgetId.current);
|
|
1949
|
+
}
|
|
1950
|
+
catch (error) {
|
|
1951
|
+
console.error('Failed to remove Turnstile widget:', error);
|
|
1952
|
+
}
|
|
1953
|
+
widgetId.current = null;
|
|
1954
|
+
}
|
|
1955
|
+
};
|
|
1956
|
+
}, [siteKey, onSuccess, onError, onExpire, theme, size, tabIndex]);
|
|
1957
|
+
return jsxRuntimeExports.jsx("div", { ref: widgetRef, className: "cf-turnstile" });
|
|
1958
|
+
};
|
|
1959
|
+
|
|
1935
1960
|
const GravityForm = ({ formId, config, className = '', onSubmit, onError, }) => {
|
|
1936
1961
|
const { form, loading, error, submitting, result, submitForm } = useGravityForms(formId, config);
|
|
1937
1962
|
const [formData, setFormData] = useState({});
|
|
1963
|
+
const [turnstileToken, setTurnstileToken] = useState(null);
|
|
1964
|
+
const [turnstileError, setTurnstileError] = useState(null);
|
|
1965
|
+
// Get Turnstile site key from environment - memoized to prevent re-renders
|
|
1966
|
+
const turnstilesiteKey = useMemo(() => {
|
|
1967
|
+
try {
|
|
1968
|
+
// @ts-ignore - import.meta is a Vite-specific global
|
|
1969
|
+
if (typeof import.meta !== 'undefined' && import.meta.env) {
|
|
1970
|
+
// @ts-ignore
|
|
1971
|
+
const key = import.meta.env.VITE_TURNSTILE_SITE_KEY;
|
|
1972
|
+
// Ensure we return a string or undefined, not an object
|
|
1973
|
+
return typeof key === 'string' ? key : undefined;
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
catch (e) {
|
|
1977
|
+
// import.meta not available
|
|
1978
|
+
}
|
|
1979
|
+
return undefined;
|
|
1980
|
+
}, []); // Empty deps - site key doesn't change during runtime
|
|
1981
|
+
// Memoize Turnstile callbacks to prevent widget re-renders
|
|
1982
|
+
const handleTurnstileSuccess = useCallback((token) => {
|
|
1983
|
+
setTurnstileToken(token);
|
|
1984
|
+
setTurnstileError(null);
|
|
1985
|
+
}, []);
|
|
1986
|
+
const handleTurnstileError = useCallback(() => {
|
|
1987
|
+
setTurnstileToken(null);
|
|
1988
|
+
setTurnstileError('Verification failed. Please try again.');
|
|
1989
|
+
}, []);
|
|
1990
|
+
const handleTurnstileExpire = useCallback(() => {
|
|
1991
|
+
setTurnstileToken(null);
|
|
1992
|
+
setTurnstileError('Verification expired. Please verify again.');
|
|
1993
|
+
}, []);
|
|
1938
1994
|
const handleSubmit = async (e) => {
|
|
1939
1995
|
e.preventDefault();
|
|
1996
|
+
// Check Turnstile token if enabled
|
|
1997
|
+
if (turnstilesiteKey && !turnstileToken) {
|
|
1998
|
+
setTurnstileError('Please complete the verification');
|
|
1999
|
+
return;
|
|
2000
|
+
}
|
|
1940
2001
|
try {
|
|
1941
2002
|
const submission = {
|
|
1942
2003
|
form_id: formId,
|
|
1943
2004
|
field_values: formData,
|
|
2005
|
+
...(turnstileToken ? {
|
|
2006
|
+
headers: {
|
|
2007
|
+
'cf-turnstile-response': turnstileToken
|
|
2008
|
+
}
|
|
2009
|
+
} : {})
|
|
1944
2010
|
};
|
|
1945
2011
|
await submitForm(submission);
|
|
1946
2012
|
if (onSubmit && result) {
|
|
@@ -1968,7 +2034,11 @@ const GravityForm = ({ formId, config, className = '', onSubmit, onError, }) =>
|
|
|
1968
2034
|
if (!form) {
|
|
1969
2035
|
return jsxRuntimeExports.jsx("div", { className: `gravity-form not-found ${className}`, children: "Form not found" });
|
|
1970
2036
|
}
|
|
1971
|
-
return (jsxRuntimeExports.jsx("div", { className: `gravity-form ${className}`, children: jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, children: [jsxRuntimeExports.jsx("h2", { children: form.title }), form.description && jsxRuntimeExports.jsx("p", { children: form.description }), form.fields.map(field => (jsxRuntimeExports.jsxs("div", { className: `field field-${field.type}`, children: [jsxRuntimeExports.jsxs("label", { htmlFor: `field_${field.id}`, children: [field.label, field.required && jsxRuntimeExports.jsx("span", { className: "required", children: "*" })] }), field.description && (jsxRuntimeExports.jsx("p", { className: "field-description", children: field.description })), field.type === 'text' && (jsxRuntimeExports.jsx("input", { type: "text", id: `field_${field.id}`, name: field.label, required: field.required, placeholder: field.placeholder, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value) })), field.type === 'email' && (jsxRuntimeExports.jsx("input", { type: "email", id: `field_${field.id}`, name: field.label, required: field.required, placeholder: field.placeholder, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value) })), field.type === 'textarea' && (jsxRuntimeExports.jsx("textarea", { id: `field_${field.id}`, name: field.label, required: field.required, placeholder: field.placeholder, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value) })), field.type === 'select' && field.choices && (jsxRuntimeExports.jsxs("select", { id: `field_${field.id}`, name: field.label, required: field.required, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value), children: [jsxRuntimeExports.jsx("option", { value: "", children: "Select an option" }), field.choices.map((choice, index) => (jsxRuntimeExports.jsx("option", { value: choice.value, children: choice.text }, index)))] }))] }, field.id))), jsxRuntimeExports.
|
|
2037
|
+
return (jsxRuntimeExports.jsx("div", { className: `gravity-form ${className}`, children: jsxRuntimeExports.jsxs("form", { onSubmit: handleSubmit, children: [jsxRuntimeExports.jsx("h2", { children: form.title }), form.description && jsxRuntimeExports.jsx("p", { children: form.description }), form.fields.map(field => (jsxRuntimeExports.jsxs("div", { className: `field field-${field.type}`, children: [jsxRuntimeExports.jsxs("label", { htmlFor: `field_${field.id}`, children: [field.label, field.required && jsxRuntimeExports.jsx("span", { className: "required", children: "*" })] }), field.description && (jsxRuntimeExports.jsx("p", { className: "field-description", children: field.description })), field.type === 'text' && (jsxRuntimeExports.jsx("input", { type: "text", id: `field_${field.id}`, name: field.label, required: field.required, placeholder: field.placeholder, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value) })), field.type === 'email' && (jsxRuntimeExports.jsx("input", { type: "email", id: `field_${field.id}`, name: field.label, required: field.required, placeholder: field.placeholder, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value) })), field.type === 'textarea' && (jsxRuntimeExports.jsx("textarea", { id: `field_${field.id}`, name: field.label, required: field.required, placeholder: field.placeholder, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value) })), field.type === 'select' && field.choices && (jsxRuntimeExports.jsxs("select", { id: `field_${field.id}`, name: field.label, required: field.required, onChange: (e) => handleFieldChange(field.id.toString(), e.target.value), children: [jsxRuntimeExports.jsx("option", { value: "", children: "Select an option" }), field.choices.map((choice, index) => (jsxRuntimeExports.jsx("option", { value: choice.value, children: choice.text }, index)))] }))] }, field.id))), turnstilesiteKey && (jsxRuntimeExports.jsxs("div", { className: "form-turnstile", children: [jsxRuntimeExports.jsx(TurnstileWidget, { siteKey: turnstilesiteKey, onSuccess: handleTurnstileSuccess, onError: handleTurnstileError, onExpire: handleTurnstileExpire, theme: "auto", size: "normal" }), turnstileError && (jsxRuntimeExports.jsx("p", { className: "field-error turnstile-error", children: turnstileError }))] })), jsxRuntimeExports.jsx("button", { type: "submit", disabled: submitting || (!!turnstilesiteKey && !turnstileToken), children: submitting
|
|
2038
|
+
? 'Submitting...'
|
|
2039
|
+
: (turnstilesiteKey && !turnstileToken)
|
|
2040
|
+
? 'Complete verification first'
|
|
2041
|
+
: 'Submit' }), result && (jsxRuntimeExports.jsx("div", { className: `result ${result.success ? 'success' : 'error'}`, children: result.message }))] }) }));
|
|
1972
2042
|
};
|
|
1973
2043
|
|
|
1974
2044
|
const WordPressContext = createContext(undefined);
|
|
@@ -2091,7 +2161,7 @@ function getFormById(id) {
|
|
|
2091
2161
|
return (gravityFormsStaticData?.forms ?? []).find(f => String(f.id) === key);
|
|
2092
2162
|
}
|
|
2093
2163
|
|
|
2094
|
-
let document;
|
|
2164
|
+
let document$1;
|
|
2095
2165
|
let offset;
|
|
2096
2166
|
let output;
|
|
2097
2167
|
let stack;
|
|
@@ -2118,7 +2188,7 @@ function Frame(block, tokenStart, tokenLength, prevOffset, leadingHtmlStart) {
|
|
|
2118
2188
|
};
|
|
2119
2189
|
}
|
|
2120
2190
|
const parse = (doc) => {
|
|
2121
|
-
document = doc;
|
|
2191
|
+
document$1 = doc;
|
|
2122
2192
|
offset = 0;
|
|
2123
2193
|
output = [];
|
|
2124
2194
|
stack = [];
|
|
@@ -2151,7 +2221,7 @@ function proceed() {
|
|
|
2151
2221
|
if (null !== leadingHtmlStart) {
|
|
2152
2222
|
output.push(
|
|
2153
2223
|
Freeform(
|
|
2154
|
-
document.substr(
|
|
2224
|
+
document$1.substr(
|
|
2155
2225
|
leadingHtmlStart,
|
|
2156
2226
|
startOffset - leadingHtmlStart
|
|
2157
2227
|
)
|
|
@@ -2192,7 +2262,7 @@ function proceed() {
|
|
|
2192
2262
|
return true;
|
|
2193
2263
|
}
|
|
2194
2264
|
const stackTop = stack.pop();
|
|
2195
|
-
const html = document.substr(
|
|
2265
|
+
const html = document$1.substr(
|
|
2196
2266
|
stackTop.prevOffset,
|
|
2197
2267
|
startOffset - stackTop.prevOffset
|
|
2198
2268
|
);
|
|
@@ -2220,7 +2290,7 @@ function parseJSON(input) {
|
|
|
2220
2290
|
}
|
|
2221
2291
|
}
|
|
2222
2292
|
function nextToken() {
|
|
2223
|
-
const matches = tokenizer.exec(document);
|
|
2293
|
+
const matches = tokenizer.exec(document$1);
|
|
2224
2294
|
if (null === matches) {
|
|
2225
2295
|
return ["no-more-tokens", "", null, 0, 0];
|
|
2226
2296
|
}
|
|
@@ -2250,16 +2320,16 @@ function nextToken() {
|
|
|
2250
2320
|
return ["block-opener", name, attrs, startedAt, length];
|
|
2251
2321
|
}
|
|
2252
2322
|
function addFreeform(rawLength) {
|
|
2253
|
-
const length = document.length - offset;
|
|
2323
|
+
const length = document$1.length - offset;
|
|
2254
2324
|
if (0 === length) {
|
|
2255
2325
|
return;
|
|
2256
2326
|
}
|
|
2257
|
-
output.push(Freeform(document.substr(offset, length)));
|
|
2327
|
+
output.push(Freeform(document$1.substr(offset, length)));
|
|
2258
2328
|
}
|
|
2259
2329
|
function addInnerBlock(block, tokenStart, tokenLength, lastOffset) {
|
|
2260
2330
|
const parent = stack[stack.length - 1];
|
|
2261
2331
|
parent.block.innerBlocks.push(block);
|
|
2262
|
-
const html = document.substr(
|
|
2332
|
+
const html = document$1.substr(
|
|
2263
2333
|
parent.prevOffset,
|
|
2264
2334
|
tokenStart - parent.prevOffset
|
|
2265
2335
|
);
|
|
@@ -2272,7 +2342,7 @@ function addInnerBlock(block, tokenStart, tokenLength, lastOffset) {
|
|
|
2272
2342
|
}
|
|
2273
2343
|
function addBlockFromStack(endOffset) {
|
|
2274
2344
|
const { block, leadingHtmlStart, prevOffset, tokenStart } = stack.pop();
|
|
2275
|
-
const html = endOffset ? document.substr(prevOffset, endOffset - prevOffset) : document.substr(prevOffset);
|
|
2345
|
+
const html = endOffset ? document$1.substr(prevOffset, endOffset - prevOffset) : document$1.substr(prevOffset);
|
|
2276
2346
|
if (html) {
|
|
2277
2347
|
block.innerHTML += html;
|
|
2278
2348
|
block.innerContent.push(html);
|
|
@@ -2280,7 +2350,7 @@ function addBlockFromStack(endOffset) {
|
|
|
2280
2350
|
if (null !== leadingHtmlStart) {
|
|
2281
2351
|
output.push(
|
|
2282
2352
|
Freeform(
|
|
2283
|
-
document.substr(
|
|
2353
|
+
document$1.substr(
|
|
2284
2354
|
leadingHtmlStart,
|
|
2285
2355
|
tokenStart - leadingHtmlStart
|
|
2286
2356
|
)
|