@marvalt/wadapter 2.3.2 → 2.3.4
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.map +1 -1
- package/dist/index.esm.js +20 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -326,22 +326,32 @@ class GravityFormsClient {
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
async getForm(id) {
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
329
|
+
// If using custom endpoint (gf-api plugin), use it for both modes
|
|
330
|
+
// Otherwise: proxy uses gf-api/v1, direct uses official gf/v2
|
|
331
|
+
const useCustom = this.config.useCustomEndpoint;
|
|
332
|
+
const endpoint = useCustom
|
|
333
|
+
? `/forms/${id}` // apiUrl already includes /wp-json/gf-api/v1
|
|
334
|
+
: (this.config.authMode === 'cloudflare_proxy'
|
|
335
|
+
? `/gf-api/v1/forms/${id}`
|
|
336
|
+
: `/wp-json/gf/v2/forms/${id}`);
|
|
333
337
|
return this.makeRequest(endpoint);
|
|
334
338
|
}
|
|
335
339
|
async getForms() {
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
|
|
340
|
+
const useCustom = this.config.useCustomEndpoint;
|
|
341
|
+
const endpoint = useCustom
|
|
342
|
+
? '/forms' // apiUrl already includes /wp-json/gf-api/v1
|
|
343
|
+
: (this.config.authMode === 'cloudflare_proxy'
|
|
344
|
+
? '/gf-api/v1/forms'
|
|
345
|
+
: '/wp-json/gf/v2/forms');
|
|
339
346
|
return this.makeRequest(endpoint);
|
|
340
347
|
}
|
|
341
348
|
async getFormConfig(id) {
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
349
|
+
const useCustom = this.config.useCustomEndpoint;
|
|
350
|
+
const endpoint = useCustom
|
|
351
|
+
? `/forms/${id}/config` // apiUrl already includes /wp-json/gf-api/v1
|
|
352
|
+
: (this.config.authMode === 'cloudflare_proxy'
|
|
353
|
+
? `/gf-api/v1/forms/${id}/config`
|
|
354
|
+
: `/wp-json/gf/v2/forms/${id}`); // v2 returns full form including settings
|
|
345
355
|
return this.makeRequest(endpoint);
|
|
346
356
|
}
|
|
347
357
|
async submitForm(formId, submission) {
|