@gravitywiz/types 0.0.5 → 0.0.6

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.
Files changed (2) hide show
  1. package/index.d.ts +56 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -17,6 +17,7 @@ declare global {
17
17
  type: string;
18
18
  enableEnhancedUI?: boolean;
19
19
  inputType: string;
20
+ productId: string;
20
21
  }
21
22
 
22
23
  interface GFChoice {
@@ -54,6 +55,29 @@ declare global {
54
55
  [key: string]: any;
55
56
  }
56
57
 
58
+ class GFConditionalLogic {
59
+ actionType: GFConditionalLogicActionType;
60
+ logicType: GFConditionalLogicLogicType;
61
+ rules: GFConditionalLogicRule[];
62
+ }
63
+
64
+ interface GFCurrencyConfig {
65
+ name: string;
66
+ symbol_left: string;
67
+ symbol_right: string;
68
+ symbol_padding: string;
69
+ thousand_separator: string;
70
+ decimal_separator: string;
71
+ decimals: number
72
+ code: string;
73
+ }
74
+
75
+ class GFCurrency {
76
+ constructor(currency: GFCurrencyConfig);
77
+ toNumber(text: string): number;
78
+ toMoney(number: string | number, isNumeric?: boolean): string;
79
+ }
80
+
57
81
  interface GFConditionalLogicRuleField {
58
82
  label: string;
59
83
  value: string | number;
@@ -64,6 +88,13 @@ declare global {
64
88
  operator: string;
65
89
  value: number | string;
66
90
  }
91
+
92
+ type GFConditionalLogicOperators = 'is' | 'isnot' | '>' | '<' | 'contains' | 'starts_with' | 'ends_with';
93
+
94
+ type GFConditionalLogicLogicType = 'all' | 'any';
95
+
96
+
97
+ type GFConditionalLogicActionType = 'show' | 'hide';
67
98
 
68
99
  interface Window {
69
100
  jQuery: JQueryStatic;
@@ -88,8 +119,16 @@ declare global {
88
119
  HasPageField: () => boolean;
89
120
  HasPostField: () => boolean;
90
121
  ToggleMultiFile: (isInit: boolean) => void;
122
+ ToggleConditionalLogic: (isInit: boolean, objectType: string) => void;
91
123
  GetInputType: (field: GFField) => string;
92
124
  SetFieldPhoneFormat: (format: string) => void;
125
+ GetRuleValuesDropDown: (
126
+ choices: Array<{ text: string; value: string | number }>,
127
+ objectType: string,
128
+ ruleIndex: number,
129
+ selectedValue: string,
130
+ inputName: string | false
131
+ ) => string;
93
132
 
94
133
  // Frontend
95
134
  gform: {
@@ -119,6 +158,10 @@ declare global {
119
158
  ) => S;
120
159
  };
121
160
 
161
+ ConditionalLogic: typeof GFConditionalLogic;
162
+
163
+ Currency: typeof GFCurrency;
164
+
122
165
  gformCalculateTotalPrice: (formId: string | number) => void;
123
166
 
124
167
  gfMultiFileUploader: {
@@ -133,13 +176,24 @@ declare global {
133
176
  deleteButton: HTMLElement
134
177
  ) => void;
135
178
 
136
- mOxie: any;
179
+ gformFormatMoney: (text: number | string, isNumeric?: boolean) => string;
180
+
181
+ gformToNumber(text: string): number;
182
+
183
+ gf_global: {
184
+ base_url: string;
185
+ gf_currency_config: GFCurrencyConfig;
186
+ number_formats: Array<any>; // placeholder
187
+ spinnerUrl: string;
188
+ strings: { [key: string]: string };
189
+ version_hash: string;
190
+ };
137
191
 
138
192
  // Placeholders
193
+ mOxie: any;
139
194
  gfMergeTagsObj: any;
140
195
  gf_raw_input_change: any;
141
196
  gf_check_field_rule: any;
142
- gf_global: any;
143
197
  gf_vars: any;
144
198
  gformInitChosenFields: any;
145
199
  ToggleCalculationOptions: any;
@@ -149,7 +203,6 @@ declare global {
149
203
  gfAjaxSpinner: any;
150
204
  gformIsHidden: any;
151
205
  gf_form_conditional_logic: any;
152
- Currency: any;
153
206
  gf_matches_operation: any;
154
207
  gf_apply_rules: any;
155
208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitywiz/types",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "TypesScript type definitions for Gravity Forms and Gravity Wiz.",
5
5
  "author": "Gravity Wiz",
6
6
  "license": "MIT",