Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formsort/custom-question-api

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formsort/custom-question-api - npm Package Compare versions

Comparing version 0.0.24 to 0.0.25

10

lib/index.d.ts
import { AnswerSemanticType } from '@formsort/constants';
declare type AnswerPrimitiveType = number | string | boolean;
declare type AnswerPrimitiveType = number | string | boolean | object;
declare type AnswerType = AnswerPrimitiveType | AnswerPrimitiveType[];
export declare const setQuestionSize: (width?: number | undefined, height?: number | undefined) => void;
export declare const getAnswerValue: () => Promise<AnswerType>;
export declare const getSemanticAnswerValue: (semanticType: AnswerSemanticType) => Promise<AnswerType>;
export declare const getAnswerValue: <T extends AnswerType = AnswerType>() => Promise<T | undefined>;
export declare const getSemanticAnswerValue: <T extends AnswerType = AnswerType>(semanticType: AnswerSemanticType) => Promise<T>;
export declare const getAllAnswerValues: () => Promise<{
[key: string]: AnswerType;
[key: string]: string | number | boolean | object | AnswerPrimitiveType[] | undefined;
}>;
export declare const getResponderUuid: () => Promise<string>;
export declare const clearAnswerValue: () => void;
export declare const setAnswerValue: (value: string | number | boolean) => void;
export declare const setAnswerValue: (value: AnswerType) => void;
export {};
{
"name": "@formsort/custom-question-api",
"version": "0.0.24",
"version": "0.0.25",
"description": "Helpers for implementing custom questions in Formsort",

@@ -52,3 +52,3 @@ "main": "lib/index.js",

},
"gitHead": "43ee92db5831a9f38f3019e0e86bb5c541cce432"
"gitHead": "a7b0156bbc2ce661ad75fa222c7edcc40942fa26"
}

@@ -41,4 +41,4 @@ # @formsort/custom-question-api

getResponderUuid,
setQuestionSize
} from "@formsort/custom-question-api";
setQuestionSize,
} from '@formsort/custom-question-api';
```

@@ -56,6 +56,14 @@

Optionally, the type of the answer can be defined by passing a generic parameter:
```tsx
getAllAnswerValues() => Promise<{ [key: string]: any}>
getAnswerValue<string>()
```
The type parameter can be either a number, string, boolean, object, or an array consisting of one of these types. The returned value will still be `undefined` if the answer has not been set.
```tsx
getAllAnswerValues() => Promise<{ [key: string]: any }>
```
Returns a promise for an object containing _all_ of the answers provided by the receipient thus far in filling out their flow. The keys are the variable names as defined within Formsort.

@@ -70,3 +78,3 @@

```tsx
setAnswerValue(value: number | string | boolean) => void
setAnswerValue(value: number | string | boolean | object) => void
```

@@ -100,3 +108,3 @@

```
```tsx
setQuestionSize(width?: number, height?: number) => void

@@ -112,4 +120,4 @@ ```

```tsx
import React, { useEffect, useRef } from "react";
import { setQuestionSize } from "@formsort/custom-question-api";
import React, { useEffect, useRef } from 'react';
import { setQuestionSize } from '@formsort/custom-question-api';

@@ -120,3 +128,3 @@ const MyCustomComponent = () => {

useEffect(() => {
const containerEl = this.containerElRef.current;
const containerEl = containerElRef.current;
if (!containerEl) {

@@ -139,4 +147,4 @@ return;

```tsx
import * as React from "react";
import { setQuestionSize } from "@formsort/custom-question-api";
import * as React from 'react';
import { setQuestionSize } from '@formsort/custom-question-api';

@@ -143,0 +151,0 @@ class MyCustomComponent extends React.Component {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc