Skip to content

Commit

Permalink
chore: made suggested changes in js sdk comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-skyflow committed Jul 19, 2023
1 parent 70d6619 commit 50bb513
Show file tree
Hide file tree
Showing 8 changed files with 147 additions and 147 deletions.
48 changes: 24 additions & 24 deletions src/core/external/collect/collect-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,35 @@ import {
import Container from '../common/container';
import CollectElement from './collect-element';

/** Type of Skyflow element. */
/** Type of Skyflow Element. */
export interface CollectElementInput {
/** The table this data belongs to */
/** Table this data belongs to */
table?: string;
/** The data should be inserted into the column. */
/** Data should be inserted into the column. */
column?: string;
/** The styles should be applied to the form element. */
/** Styles should be applied to the form element. */
inputStyles?: object;
/** The label for the form element. */
/** Label for the form element. */
label?: string;
/** The styles applied to the label of the collect element. */
/** Styles applied to the label of the collect element. */
labelStyles?: object;
/** The styles that apply to the error text of the collect element will be added. */
/** Styles that apply to the error text of the collect element will be added. */
errorTextStyles?: object;
/** This is a placeholder for the form element. */
/** A placeholder for the form element. */
placeholder?: string;
/** Skyflow.ElementType enum */
type: ElementType;
/** The string acts as an initial value for the collect element. */
/** It string acts as an initial value for the Collect Element. */
altText?: string;
/** A set of validations for collect element. */
/** A set of validations for Collect Element. */
validations?: IValidationRule[]
/** The element's SkyflowID. */
/** SkyflowID fo the element. */
skyflowID?: string;
}

/** This class wraps the options for the Collect method. */
/** Wraps the options for the Collect method. */
export interface ICollectOptions {
/** The property indicates whether to return tokens for the collected data. It defaults to 'true'. */
/** Indicates whether to return tokens for the collected data. It defaults to 'true'. */
tokens?: boolean;
/** Insert the non-PCI elements data into the vault in the format of the records object. */
additionalFields?: IInsertRecordInput;
Expand All @@ -71,7 +71,7 @@ export interface ICollectOptions {
const CLASS_NAME = 'CollectContainer';

/**
* @class This class wraps all collect elements.
* @class Wraps all collect elements.
*/
class CollectContainer extends Container {
#containerId: string;
Expand All @@ -83,7 +83,7 @@ class CollectContainer extends Container {
#context:Context;

#skyflowElements:any;
/** The type of the container. */
/** Type of the container. */
type:string = ContainerType.COLLECT;

/** @internal */
Expand Down Expand Up @@ -128,10 +128,10 @@ class CollectContainer extends Container {
}

/**
* We call this method to create the Skyflow Collect element.
* @param input Collect element input.
* @param options Collect element options.
* @returns The method returns the collect element.
* Creates the Skyflow Collect Element.
* @param input Collect Element input.
* @param options Collect Element options.
* @returns Returns the collect element.
*/
create = (input: CollectElementInput, options: any = {
required: false,
Expand Down Expand Up @@ -272,9 +272,9 @@ class CollectContainer extends Container {
};

/**
* This method collects the data and sends it to the vault.
* @param options It collects the data and sends it to the vault.
* @returns It returns the inserted data or the error.
* Collects the data and sends it to the vault.
* @param options Collects the data and sends it to the vault.
* @returns Returns the inserted data or the error.
*/
collect = (options: ICollectOptions = { tokens: true }) => new Promise((resolve, reject) => {
try {
Expand Down Expand Up @@ -326,8 +326,8 @@ class CollectContainer extends Container {
});

/**
* This method inserts file type data into the vault.
* @returns It returns the inserted data.
* Inserts file type data into the vault.
* @returns Returns the inserted data.
*/
uploadFiles = (options) => new Promise((resolve, reject) => {
try {
Expand Down
26 changes: 13 additions & 13 deletions src/core/external/collect/collect-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ import { ContainerType } from '../../../skyflow';
const CLASS_NAME = 'Element';

/**
* The create method returns the type of Skyflow collect elements.
* The create method returns the type of Skyflow Collect Elements.
* @class CollectElement
*/
class CollectElement extends SkyflowElement {
/** The type of collect element. */
/** Type of the Collect Element. */
elementType: string;
/** The type of container. */
/** Type of the container. */
type: string = ContainerType.COLLECT;

#elementId: string;
/** The id of the container. */
/** Id of the container. */
containerId: string;

#isSingleElementAPI: boolean = false;
Expand Down Expand Up @@ -143,7 +143,7 @@ class CollectElement extends SkyflowElement {
getID = () => this.#elementId;

/**
* This method inserts the element into the specified div.
* Inserts the element into the specified div.
* @param domElement The native HTML element that mounts inside the iframe.
*/
mount = (domElement) => {
Expand Down Expand Up @@ -187,7 +187,7 @@ class CollectElement extends SkyflowElement {
};

/**
* This method resets any collect element to its initial state.
* Resets any collect element to its initial state.
*/
unmount = () => {
this.#iframe.unmount();
Expand Down Expand Up @@ -331,8 +331,8 @@ class CollectElement extends SkyflowElement {
// listening to element events and error messages on iframe
// todo: off methods
/**
* This method communicates with Skyflow elements/iframes by listening to an event.
* @param eventName The name of the event.
* Communicates with Skyflow elements/iframes by listening to an event.
* @param eventName Name of the event.
* @param handler You provide a callback function that gets called when the event is fired with the state.
*/
on(eventName: string, handler) {
Expand Down Expand Up @@ -493,8 +493,8 @@ class CollectElement extends SkyflowElement {
}

/**
* This method sets the error text for the element, overriding all current errors on the element with the custom error message passed.
* @param clientErrorText The error text value.
* Sets the error text for the element, overriding all current errors on the element with the custom error message passed.
* @param clientErrorText Error text value.
*/
setError(clientErrorText:string) {
this.#bus.emit(ELEMENT_EVENTS_TO_IFRAME.COLLECT_ELEMENT_SET_ERROR,
Expand All @@ -506,7 +506,7 @@ class CollectElement extends SkyflowElement {
}

/**
* This method clears the custom error message that is set using setError.
* Clears the custom error message that is set using setError.
*/
resetError() {
this.#bus.emit(ELEMENT_EVENTS_TO_IFRAME.COLLECT_ELEMENT_SET_ERROR,
Expand All @@ -517,7 +517,7 @@ class CollectElement extends SkyflowElement {
}

/**
* This method sets the value of the element.
* Sets the value of the element.
* @param elementValue Any value for the element.
*/
setValue(elementValue:string) {
Expand All @@ -540,7 +540,7 @@ class CollectElement extends SkyflowElement {
}

/**
* This method resets the value of the element.
* Resets the value of the element.
*/
clearValue() {
if (this.#context.env === Env.PROD) {
Expand Down
20 changes: 10 additions & 10 deletions src/core/external/collect/compose-collect-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface ICollectOptions {
const CLASS_NAME = 'CollectContainer';

/**
* This container wraps all the composable elements.
* Wraps all the Composable Elements.
* @class ComposableContainer
*/
class ComposableContainer extends Container {
Expand All @@ -85,7 +85,7 @@ class ComposableContainer extends Container {
#options: any;

#containerElement:any;
/** The type of container. */
/** Type of the container. */
type:string = ContainerType.COMPOSABLE;

#containerMounted: boolean = false;
Expand Down Expand Up @@ -143,10 +143,10 @@ class ComposableContainer extends Container {
}

/**
* This method creates the skyflow collect element.
* Creates the Skyflow Collect Element.
* @param input Collect element input.
* @param options Collect element options.
* @returns This method returns the collect element.
* @returns Returns the collect element.
*/
create = (input: CollectElementInput, options: any = {
required: false,
Expand Down Expand Up @@ -265,8 +265,8 @@ class ComposableContainer extends Container {
};

/**
* This method helps to communicate with Skyflow elements/iframes by listening to an event.
* @param eventName The name of the event.
* Helps to communicate with Skyflow elements/iframes by listening to an event.
* @param eventName Name of the event.
* @param handler You provide a callback function that gets called when the event is fired with the state.
*/
on = (eventName:string, handler:any) => {
Expand Down Expand Up @@ -298,7 +298,7 @@ class ComposableContainer extends Container {
};

/**
* This method inserts the element into the specified div.
* Inserts the element into the specified div.
* @param domElement The native HTML element that mounts inside the iframe.
*/
mount = (domElement) => {
Expand Down Expand Up @@ -353,16 +353,16 @@ class ComposableContainer extends Container {
};

/**
* This method resets any collect element to its initial state.
* Resets any collect element to its initial state.
*/
unmount = () => {
this.#containerElement.unmount();
};

/**
* This method collects the data and sends it to the vault.
* Collects the data and sends it to the vault.
* @param options Takes collect options as input.
* @returns This method returns the inserted data or the error.
* @returns Returns the inserted data or the error.
*/
collect = (options: ICollectOptions = { tokens: true }) => new Promise((resolve, reject) => {
try {
Expand Down
10 changes: 5 additions & 5 deletions src/core/external/collect/compose-collect-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import SKYFLOW_ERROR_CODE from '../../../utils/constants';
import { ELEMENT_EVENTS_TO_CLIENT, ELEMENT_EVENTS_TO_IFRAME } from '../../constants';

/**
* The create method returns an instance of Skyflow composable elements.
* The create method returns an instance of Skyflow Composable Elements.
* @class ComposableElement
*/
class ComposableElement {
Expand All @@ -33,8 +33,8 @@ class ComposableElement {
}

/**
* This method helps to communicate with Skyflow elements/iframes by listening to an event.
* @param eventName The name of the event.
* Helps to communicate with Skyflow elements/iframes by listening to an event.
* @param eventName Name of the event.
* @param handler You provide a callback function that gets called when the event is fired with the state.
*/
on(eventName: string, handler: any) {
Expand Down Expand Up @@ -71,8 +71,8 @@ class ComposableElement {
}

/**
* The configuration of elements inside the composable container is updated.
* @param options This parameter takes an object for the insertion.
* Updates the configuration of elements inside the composable container.
* @param options Takes an object for the insertion.
*/
update = (options) => {
this.#isUpdateCalled = true;
Expand Down
32 changes: 16 additions & 16 deletions src/core/external/reveal/reveal-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,38 @@ import {
import Container from '../common/container';
import RevealElement from './reveal-element';

/** This configuration handles skyflow reveal elements. */
/** This configuration handles Skyflow Reveal Elements. */
export interface IRevealElementInput {
/** A Skyflow token that would be detokenised. */
token?: string;
/** The redaction type of the revealed data. */
/** Redaction type of the revealed data. */
redaction?: RedactionType;
/** The styles for the input in reveal element. */
/** Styles for the input in reveal element. */
inputStyles?: object;
/** The label value for the reveal elements. */
/** Label value for the reveal elements. */
label?: string;
/** The styles for the label in reveal element. */
/** Styles for the label in reveal element. */
labelStyles?: object;
/** An alternate text for the reveal element. */
altText?: string;
/** The styles for the error text in the reveal element. */
/** Styles for the error text in the reveal element. */
errorTextStyles?: object;
}

/** This provides additional configuration options for the reveal element. */
/** Provides an additional configuration options for the reveal element. */
export interface IRevealElementOptions {
/** The copy icon enables revealing elements to copy text to the clipboard. It defaults to 'false'. */
/** Copy icon enables revealing elements to copy text to the clipboard. It defaults to 'false'. */
enableCopy?: boolean;
/** Tohe format for the element. */
/** Format for the element. */
format?: string;
/** This property indicates the allowed data type value for the format. */
/** It indicates the allowed data type value for the format. */
translation?:Record<string, string>
}

const CLASS_NAME = 'RevealContainer';

/**
* The container wraps all the Skyflow reveal elements.
* Wraps all the Skyflow reveal elements.
* @class RevealContainer
*/
class RevealContainer extends Container {
Expand All @@ -77,7 +77,7 @@ class RevealContainer extends Container {
#context: Context;

#skyflowElements: any;
/** The type of the container. */
/** Type of the container. */
type:string = ContainerType.REVEAL;

/** @internal */
Expand Down Expand Up @@ -148,8 +148,8 @@ class RevealContainer extends Container {
}

/**
* This method creates a skyflow reveal element.
* @param record The input configuration for the reveal element.
* Creates a skyflow reveal element.
* @param record Input configuration for the reveal element.
* @param options An additional configuration for reveal element.
* @returns This method returns the reveal element.
*/
Expand All @@ -165,8 +165,8 @@ class RevealContainer extends Container {
}

/**
* The method is called when the sensitive data is ready to retrieve and reveal.
* @returns It returns the retrieved and revealed data.
* Called when the sensitive data is ready to retrieve and reveal.
* @returns Returns the retrieved and revealed data.
*/
reveal() {
this.#isRevealCalled = true;
Expand Down
Loading

0 comments on commit 50bb513

Please sign in to comment.