@gravitywiz/types 0.0.1 → 0.0.2

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/.editorconfig ADDED
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ indent_style = tab
7
+ insert_final_newline = true
8
+ trim_trailing_whitespace = true
9
+ indent_size = 4
package/README.md CHANGED
@@ -28,5 +28,5 @@ To use the ambient module definitions to make types available on the `window` ob
28
28
  This also supports importing individual types like so:
29
29
 
30
30
  ```ts
31
- import type { Field } from 'types-gravity-wiz/gravityforms';
31
+ import type { GFField } from 'types-gravity-wiz/gravityforms';
32
32
  ```
package/gravityforms.d.ts CHANGED
@@ -1,43 +1,67 @@
1
1
  /**
2
2
  * Type definitions for Gravity Forms.
3
3
  */
4
+ declare global {
5
+ type GFFieldID = number | string;
6
+ type GFFormID = number | string;
4
7
 
5
- export interface Form {
6
- }
8
+ interface GFField {
9
+ inputs: any;
10
+ choices: GFChoice[];
11
+ label: string;
12
+ adminLabel?: string;
13
+ id: number;
14
+ formId: number;
15
+ type: string;
16
+ enableEnhancedUI?: boolean;
17
+ inputType: string;
18
+ }
7
19
 
8
- export interface Field {
9
- id: number
10
- formId: number
11
- type: string
12
- enableEnhancedUI: boolean
13
- choices: MultiSelectChoice[]
14
- }
20
+ interface GFChoice {
21
+ isSelected?: boolean;
22
+ price?: string;
23
+ text: string;
24
+ value: string;
25
+ }
15
26
 
16
- export interface MultiSelectChoice {
17
- isSelected: boolean;
18
- price: string;
19
- text: string;
20
- value: string;
21
- }
27
+ interface GFForm {
28
+ button: {
29
+ type: string;
30
+ text: string;
31
+ imageUrl: string;
32
+ };
33
+ confirmations: any;
34
+ description: string;
35
+ descriptionPlacement: string;
36
+ fields: GFField[];
37
+ firstPageCssClass: string;
38
+ id: number;
39
+ labelPlacement: string;
40
+ lastPageButton: string;
41
+ markupVersion: number;
42
+ nextFieldId: number;
43
+ notifications: any;
44
+ pagination: any;
45
+ postContentTemplate: string;
46
+ postContentTemplateEnabled: boolean;
47
+ postTitleTemplate: string;
48
+ postTitleTemplateEnabled: boolean;
49
+ title: string;
50
+ useCurrentUserAsAuthor: boolean;
51
+ version: string;
52
+ [key: string]: any;
53
+ }
22
54
 
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
55
+ interface GFConditionalLogicRuleField {
56
+ label: string;
57
+ value: string | number;
58
+ }
25
59
 
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
- }
60
+ interface GFConditionalLogicRule {
61
+ fieldId: string;
62
+ operator: string;
63
+ value: number | string;
64
+ }
65
+ }
66
+
67
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitywiz/types",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "TypesScript type definitions for Gravity Forms and Gravity Wiz.",
5
5
  "main": "index.d.ts",
6
6
  "type": "module",
@@ -8,6 +8,7 @@
8
8
  "license": "MIT",
9
9
  "private": false,
10
10
  "devDependencies": {
11
- "@types/jquery": "^3.5.16"
11
+ "@types/jquery": "^3.5.16",
12
+ "@types/plupload": "^2.0.10"
12
13
  }
13
14
  }
package/window.d.ts ADDED
@@ -0,0 +1,104 @@
1
+ import * as Plupload from "plupload";
2
+
3
+ // TODO type ...any better (e.g. provide a way to for the caller to declare what these arguments should be).
4
+ export type HookCallback = (...args: any[]) => void;
5
+
6
+ declare global {
7
+ interface Window {
8
+ jQuery: JQueryStatic;
9
+
10
+ // Form Editor
11
+ field: GFField;
12
+ fieldSettings: { [fieldType: string]: string };
13
+ form: GFForm;
14
+ UpdateFieldChoices: (fieldType: string) => void;
15
+ SetFieldProperty: (setting: string, value: any) => void;
16
+ SetFieldEnhancedUI: (enabled: boolean) => void;
17
+ GetSelectedField: () => GFField;
18
+ GetFieldById: (fieldId: GFFieldID) => GFField;
19
+ GetLabel: (
20
+ field: GFField,
21
+ inputId?: number,
22
+ inputOnly?: boolean
23
+ ) => string;
24
+ has_entry: (fieldId: GFFieldID) => boolean;
25
+ IsPricingField: (fieldType: string) => boolean;
26
+ IsProductField: (fieldType: string) => boolean;
27
+ HasPageField: () => boolean;
28
+ HasPostField: () => boolean;
29
+ ToggleMultiFile: (isInit: boolean) => void;
30
+ GetInputType: (field: GFField) => string;
31
+ SetFieldPhoneFormat: (format: string) => void;
32
+
33
+ // Frontend
34
+ gform: {
35
+ addAction: (
36
+ actionName: string,
37
+ cb: HookCallback,
38
+ priority?: number,
39
+ tag?: string
40
+ ) => void;
41
+ removeAction: (actionName: string, tag?: string) => void;
42
+ addFilter: (
43
+ filterName: string,
44
+ cb: HookCallback,
45
+ priority?: number,
46
+ tag?: string
47
+ ) => void;
48
+ removeFilter: (
49
+ filterName: string,
50
+ priority?: number,
51
+ tag?: string
52
+ ) => void;
53
+ doAction: (actionName: string, ...args: any[]) => void;
54
+ applyFilters: <S>(
55
+ filterName: string,
56
+ subject: S,
57
+ ...args: any[]
58
+ ) => S;
59
+ };
60
+
61
+ gformCalculateTotalPrice: (formId: string | number) => void;
62
+
63
+ gfMultiFileUploader: {
64
+ uploaders: { [name: string]: Plupload.Uploader };
65
+ setup: Function;
66
+ toggleDisabled: Function;
67
+ };
68
+
69
+ gformDeleteUploadedFile: (
70
+ formId: string,
71
+ fieldId: string,
72
+ deleteButton: HTMLElement
73
+ ) => void;
74
+
75
+ mOxie: any;
76
+
77
+ // Placeholders
78
+ gfMergeTagsObj: any;
79
+ gf_raw_input_change: any;
80
+ gf_check_field_rule: any;
81
+ gf_global: any;
82
+ gf_vars: any;
83
+ gformInitChosenFields: any;
84
+ ToggleCalculationOptions: any;
85
+ gformInitDatepicker: any;
86
+ GFCalc: any;
87
+ GFMergeTag: any;
88
+ gfAjaxSpinner: any;
89
+ gformIsHidden: any;
90
+ gf_form_conditional_logic: any;
91
+ Currency: any;
92
+ gf_matches_operation: any;
93
+ gf_apply_rules: any;
94
+ }
95
+
96
+ interface String {
97
+ // Deprecated, being removed in GF 2.8.
98
+ format: (...format: any[]) => string;
99
+
100
+ gformFormat: (...format: any[]) => string;
101
+ }
102
+ }
103
+
104
+ export {};