@gravity-rail/sdk 0.46.0 → 0.47.0

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.
@@ -2340,6 +2340,45 @@ var CustomToolkitsApi = class extends BaseApiClient {
2340
2340
 
2341
2341
  // src/api/data-types.ts
2342
2342
  var DataTypesApi = class extends BaseApiClient {
2343
+ /** Read an anonymous Form's visitor-writable schema without a Member session. */
2344
+ async getAnonymousFormSchema(wid, formUuid) {
2345
+ return this.fetchPublicAnonymousForm(
2346
+ `w/${encodeURIComponent(wid)}/anonymous-forms/${encodeURIComponent(formUuid)}`
2347
+ );
2348
+ }
2349
+ /** Submit visitor-provided values. No cookie or API credential is sent. */
2350
+ async submitAnonymousForm(wid, formUuid, input) {
2351
+ return this.fetchPublicAnonymousForm(
2352
+ `w/${encodeURIComponent(wid)}/anonymous-forms/${encodeURIComponent(formUuid)}/submissions`,
2353
+ { method: "POST", body: JSON.stringify(input) }
2354
+ );
2355
+ }
2356
+ async fetchPublicAnonymousForm(endpoint, options = {}) {
2357
+ const headers = new Headers(options.headers);
2358
+ if (options.body !== void 0) headers.set("Content-Type", "application/json");
2359
+ let response;
2360
+ try {
2361
+ response = await this.fetchFunction(`${this.baseUrl}/api/v2/${endpoint}`, {
2362
+ ...options,
2363
+ credentials: "omit",
2364
+ headers
2365
+ });
2366
+ } catch {
2367
+ throw new ApiError("Anonymous Form request failed", 0);
2368
+ }
2369
+ if (!response.ok) {
2370
+ let message = `Request failed with status ${response.status}`;
2371
+ try {
2372
+ const body = await response.json();
2373
+ if (typeof body.detail === "string" && body.detail.length > 0) {
2374
+ message = body.detail;
2375
+ }
2376
+ } catch {
2377
+ }
2378
+ throw new ApiError(message, response.status);
2379
+ }
2380
+ return await response.json();
2381
+ }
2343
2382
  /** Read the local Form's draft and optimistic publication counters. */
2344
2383
  async getDataTypeDraft(wid, id) {
2345
2384
  return this.fetch(`w/${wid}/data-types/${id}/schema-draft`);
@@ -12037,6 +12076,7 @@ var WORKSPACE_METHOD_NAMES = [
12037
12076
  "getAgents",
12038
12077
  "getAnonymousResolution",
12039
12078
  "getAnonymousFormSubmission",
12079
+ "getAnonymousFormSchema",
12040
12080
  "getAnonymousResolutions",
12041
12081
  "getApiKeys",
12042
12082
  "getArchiveBlockers",
@@ -12422,6 +12462,7 @@ var WORKSPACE_METHOD_NAMES = [
12422
12462
  "linkUnlinkedSalesforceMembersByIdentity",
12423
12463
  "listAbilities",
12424
12464
  "listAnonymousFormSubmissions",
12465
+ "submitAnonymousForm",
12425
12466
  "listAppConnections",
12426
12467
  "listAvailableAppConnections",
12427
12468
  "listInstallations",
@@ -12875,6 +12916,8 @@ function bindTrackedLinksMethods(target, trackedLinks) {
12875
12916
 
12876
12917
  // src/client/bindings/data-types.ts
12877
12918
  function bindDataTypesMethods(target, dataTypes) {
12919
+ target.getAnonymousFormSchema = dataTypes.getAnonymousFormSchema.bind(dataTypes);
12920
+ target.submitAnonymousForm = dataTypes.submitAnonymousForm.bind(dataTypes);
12878
12921
  target.getDataTypeDraft = dataTypes.getDataTypeDraft.bind(dataTypes);
12879
12922
  target.saveDataTypeDraft = dataTypes.saveDataTypeDraft.bind(dataTypes);
12880
12923
  target.publishDataTypeDraft = dataTypes.publishDataTypeDraft.bind(dataTypes);
@@ -14069,6 +14112,8 @@ var GravityRailClient = class {
14069
14112
  getCelContext;
14070
14113
  validateCelExpression;
14071
14114
  // Data Types API
14115
+ getAnonymousFormSchema;
14116
+ submitAnonymousForm;
14072
14117
  getDataTypes;
14073
14118
  getDataTypeDraft;
14074
14119
  saveDataTypeDraft;
@@ -16924,4 +16969,4 @@ export {
16924
16969
  SCOPE_PRESETS,
16925
16970
  getRevisionState
16926
16971
  };
16927
- //# sourceMappingURL=chunk-I7BMDNPO.js.map
16972
+ //# sourceMappingURL=chunk-N4GQWNGU.js.map