@marvalt/wadapter 2.3.3 → 2.3.5

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.
@@ -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;YAIxB,WAAW;IAuDzB,OAAO,CAAC,UAAU;IASZ,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQzC,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAOlC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAO/C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAUnG,SAAS,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;CAM1F"}
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;YAIxB,WAAW;IAuDzB,OAAO,CAAC,UAAU;IASZ,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAYzC,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAUlC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAU/C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAUnG,SAAS,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;CAM1F"}
package/dist/index.esm.js CHANGED
@@ -324,22 +324,32 @@ class GravityFormsClient {
324
324
  }
325
325
  }
326
326
  async getForm(id) {
327
- // proxy: use enhanced gf-api/v1; direct: use official GF REST v2 (under /wp-json)
328
- const endpoint = this.config.authMode === 'cloudflare_proxy'
329
- ? `/gf-api/v1/forms/${id}`
330
- : `/wp-json/gf/v2/forms/${id}`;
327
+ // If using custom endpoint (gf-api plugin), use it for both modes
328
+ // Otherwise: proxy uses gf-api/v1, direct uses official gf/v2
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}`);
331
335
  return this.makeRequest(endpoint);
332
336
  }
333
337
  async getForms() {
334
- const endpoint = this.config.authMode === 'cloudflare_proxy'
335
- ? '/gf-api/v1/forms'
336
- : '/wp-json/gf/v2/forms';
338
+ const useCustom = this.config.useCustomEndpoint;
339
+ const endpoint = useCustom
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');
337
344
  return this.makeRequest(endpoint);
338
345
  }
339
346
  async getFormConfig(id) {
340
- const endpoint = this.config.authMode === 'cloudflare_proxy'
341
- ? `/gf-api/v1/forms/${id}/config`
342
- : `/wp-json/gf/v2/forms/${id}`; // v2 returns full form including settings
347
+ const useCustom = this.config.useCustomEndpoint;
348
+ const endpoint = useCustom
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
343
353
  return this.makeRequest(endpoint);
344
354
  }
345
355
  async submitForm(formId, submission) {