@fullstory/form-core
v0.0.11
Published
FullStory Forms Core is a JavaScript Survey Library powered by Survey.js. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.
Downloads
13
Readme
Fullstory Forms Core Library
This project is a fork of survey.js customized for compatibility with Fullstory tools.
Purpose
This form solution seemlessly integrates with the Fullstory by creating auto generated api defined elements on the form, fields, and buttons.
How it differs from SurveyJS Core Library
Updates to the Survey Model, Base Model, individual Question Models, and Action Models have been created in order to maintain and update element data properties.
Survey Class Updates
In survey.ts
createBlockListfunction which is to be called after model instantiation. The purpose of this is to call Fullstory's blocklist at the beginning of the session and store it with the model as a way to maintain privacy rules.updateButtonValuesCallBackupdates the button with the form field values as data properties.deleteButtonValuesCallBackdeletes values on the button when the corresponding field values are deleted from the form.
Base Class Updates
In base.ts
getDataElementgets the initial data properties for the element.createElementData: creates the data properties and corresponding property schemagetDataType: returns the data type of the property for the property schemagetTypeOfObject: returns the type of object being used on the propertygetDataElementItem: gets the initial data properties for an element that is an item like a checkbox item or radio item. It utilizes the same functions asgetDataElementThe difference is this function applies a selected property to the element which indicates if the item was selected or not.traverseBlocked: traverses an elements children to looked for blocked elements. If a child element is blocked return true otherwise return false.isBlocked: matches the element against the Fullstory blocklistupdateDataValue: Updates the element with the form field values.updatePropertySchema: updates the property schema with the new property and value data typedeleteFromPropertySchema: deletes a property and data type from the elements property schema
Action Class
In src/actions/action.ts
dataProperties: property that lives on the Action class and holds property dataelementData: gets the data properties.getElementData: returns the data created by the function in thecreateElementDatain the Base classdeleteElementData: deletes properties from the buttonupdateElementData: updates properties on the button.setButtonProperties: sets the properties directly on the button
Pages and Panels
Pages and Panels also sustain data properties with elementData those changes can be found in the classes:
- PanelModel
- PageModel
Question Classes
Select classes have been updated to communicated property data to the library consuming the survey model.
Each class is given the property elementData and a function to update and delete properties from the element.
The list below is going to highlight which classes sustained updates
- QuestionBooleanModel
- QuestionCheckboxModel
- QuestionDropdownModel
- QuestionFileModel
- QuestionImagePickerModel
- MatrixCells
- QuestionMatrixModel
- MatrixRowModel
- QuestionMatrixDynamicModel
- QuestionMultipleTextModel
- QuestionPanelDynamicModel
- QuestionRadiogroupModel
- QuestionRankingModel
- QuestionRatingModel
- RenderedRatingItem
- QuestionSignaturePadModel
- QuestionTagboxModel
- QuestionTextModel
- TextAreaModel
- ItemValue (this class handles checkbox items, radio items, and matrix columns)
Survey Model (Platform-Independent Part)
A platform-independent survey model for SurveyJS Form Library. This package should be used with one of platform-specific UI rendering packages. Refer to the following Get Started tutorials for more information:
Resources
Build Survey Model from Sources
Clone the repo
git clone https://github.com/surveyjs/survey-library.git cd survey-library/packages/survey-coreInstall dependencies
Make sure that you have Node.js v16 or later and a compatible npm version installed.``` npm install ```Build the library
npm run build:allYou can find the built scripts and style sheets in folders under the
builddirectory.Run unit tests
npm run testThe unit tests use Karma.
After that, you can build one of the UI packages:
Licensing
SurveyJS Form Library is distributed under the MIT license.
