@gravitywiz/types 0.0.1

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.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # 🧙‍♂️ Hi! Welcome to Gravity Wiz's Typescript Definitions.
2
+
3
+ Herein find TypeScript definitions for Gravity Forms, Perks crafted by Gravity Wiz and other Gravity Forms plugins.
4
+
5
+ # 🚀 Usage
6
+
7
+ ### Install
8
+
9
+ ```sh
10
+ yarn add -D types-gravity-wiz
11
+ ```
12
+
13
+ or...
14
+ ```sh
15
+ npm install --save-dev types-gravity-wiz
16
+ ```
17
+
18
+ ### Extending `window`
19
+
20
+ To use the ambient module definitions to make types available on the `window` object, reference the respective types files you need like this. (Make sure to the path is correct for your setup.)
21
+
22
+ ```ts
23
+ /// <reference path="../../../node_modules/types-gravity-wiz/gravityforms.d.ts" />
24
+ ```
25
+
26
+ ### Importing types individually
27
+
28
+ This also supports importing individual types like so:
29
+
30
+ ```ts
31
+ import type { Field } from 'types-gravity-wiz/gravityforms';
32
+ ```
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Type definitions for Gravity Forms.
3
+ */
4
+
5
+ export interface Form {
6
+ }
7
+
8
+ export interface Field {
9
+ id: number
10
+ formId: number
11
+ type: string
12
+ enableEnhancedUI: boolean
13
+ choices: MultiSelectChoice[]
14
+ }
15
+
16
+ export interface MultiSelectChoice {
17
+ isSelected: boolean;
18
+ price: string;
19
+ text: string;
20
+ value: string;
21
+ }
22
+
23
+ // TODO type ...any better (e.g. provide a way to for the caller to declare what these arguments should be).
24
+ export type HookCallback = (...args: any[]) => void
25
+
26
+ declare global {
27
+ interface Window {
28
+ jQuery: JQueryStatic
29
+ gform: {
30
+ addAction: (actionName: string, cb: HookCallback, priority?: number, tag?: string) => void;
31
+ addFilter: (filterName: string, cb: HookCallback, priority?: number, tag?: string) => void;
32
+ doAction: (actionName: string, ...any) => void;
33
+ applyFilters: (filterName: string, ...any) => any;
34
+ removeAction: (actionName: string, tag?:string) => void;
35
+ removeFilter: (actionName: string, priority?: number, tag?: string) => void;
36
+ }
37
+ field: Field
38
+ form: Form
39
+ UpdateFieldChoices: (fieldType: string) => void
40
+ SetFieldProperty: (setting: string, value: any) => void
41
+ SetFieldEnhancedUI: (enabled: boolean) => void
42
+ }
43
+ }
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export {};
2
+
3
+ declare global {
4
+ interface Window {
5
+ }
6
+ }
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@gravitywiz/types",
3
+ "version": "0.0.1",
4
+ "description": "TypesScript type definitions for Gravity Forms and Gravity Wiz.",
5
+ "main": "index.d.ts",
6
+ "type": "module",
7
+ "author": "Gravity Wiz",
8
+ "license": "MIT",
9
+ "private": false,
10
+ "devDependencies": {
11
+ "@types/jquery": "^3.5.16"
12
+ }
13
+ }