@gravitywiz/types 0.0.5 → 0.0.7

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 +94 -4
  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;
@@ -65,6 +89,26 @@ declare global {
65
89
  value: number | string;
66
90
  }
67
91
 
92
+ type Feed<M = {}> = {
93
+ id: string;
94
+ form_id: string;
95
+ is_active: '1' | '0';
96
+ feed_order: string;
97
+ addon_slug: string;
98
+ meta: FeedMeta<M>
99
+ }
100
+
101
+ type FeedMeta<M = {}> = M & {
102
+ feed_name: string;
103
+ }
104
+
105
+ type GFConditionalLogicOperators = 'is' | 'isnot' | '>' | '<' | 'contains' | 'starts_with' | 'ends_with';
106
+
107
+ type GFConditionalLogicLogicType = 'all' | 'any';
108
+
109
+
110
+ type GFConditionalLogicActionType = 'show' | 'hide';
111
+
68
112
  interface Window {
69
113
  jQuery: JQueryStatic;
70
114
 
@@ -88,8 +132,16 @@ declare global {
88
132
  HasPageField: () => boolean;
89
133
  HasPostField: () => boolean;
90
134
  ToggleMultiFile: (isInit: boolean) => void;
135
+ ToggleConditionalLogic: (isInit: boolean, objectType: string) => void;
91
136
  GetInputType: (field: GFField) => string;
92
137
  SetFieldPhoneFormat: (format: string) => void;
138
+ GetRuleValuesDropDown: (
139
+ choices: Array<{ text: string; value: string | number }>,
140
+ objectType: string,
141
+ ruleIndex: number,
142
+ selectedValue: string,
143
+ inputName: string | false
144
+ ) => string;
93
145
 
94
146
  // Frontend
95
147
  gform: {
@@ -119,6 +171,10 @@ declare global {
119
171
  ) => S;
120
172
  };
121
173
 
174
+ ConditionalLogic: typeof GFConditionalLogic;
175
+
176
+ Currency: typeof GFCurrency;
177
+
122
178
  gformCalculateTotalPrice: (formId: string | number) => void;
123
179
 
124
180
  gfMultiFileUploader: {
@@ -133,13 +189,38 @@ declare global {
133
189
  deleteButton: HTMLElement
134
190
  ) => void;
135
191
 
136
- mOxie: any;
192
+ gformFormatMoney: (text: number | string, isNumeric?: boolean) => string;
193
+
194
+ gformToNumber(text: string): number;
195
+
196
+ gform_initialize_tooltips(): void;
197
+
198
+ gf_global: {
199
+ base_url: string;
200
+ gf_currency_config: GFCurrencyConfig;
201
+ number_formats: Array<any>; // placeholder
202
+ spinnerUrl: string;
203
+ strings: { [key: string]: string };
204
+ version_hash: string;
205
+ };
206
+
207
+ gfMergeTags: {
208
+ getMergeTags: () => {
209
+ custom: MergeTagGroup;
210
+ optional: MergeTagGroup;
211
+ other: MergeTagGroup;
212
+ pricing: MergeTagGroup;
213
+ required: MergeTagGroup;
214
+ ungrouped: MergeTagGroup;
215
+ };
216
+ // placeholder
217
+ [key: string]: any
218
+ };
137
219
 
138
220
  // Placeholders
139
- gfMergeTagsObj: any;
221
+ mOxie: any;
140
222
  gf_raw_input_change: any;
141
223
  gf_check_field_rule: any;
142
- gf_global: any;
143
224
  gf_vars: any;
144
225
  gformInitChosenFields: any;
145
226
  ToggleCalculationOptions: any;
@@ -149,11 +230,20 @@ declare global {
149
230
  gfAjaxSpinner: any;
150
231
  gformIsHidden: any;
151
232
  gf_form_conditional_logic: any;
152
- Currency: any;
153
233
  gf_matches_operation: any;
154
234
  gf_apply_rules: any;
155
235
  }
156
236
 
237
+ interface MergeTag {
238
+ tag: string;
239
+ label: string;
240
+ }
241
+
242
+ interface MergeTagGroup {
243
+ label: string;
244
+ tags: MergeTag[];
245
+ }
246
+
157
247
  interface String {
158
248
  // Deprecated, being removed in GF 2.8.
159
249
  format: (...format: any[]) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitywiz/types",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "TypesScript type definitions for Gravity Forms and Gravity Wiz.",
5
5
  "author": "Gravity Wiz",
6
6
  "license": "MIT",