@foxy.io/sdk 1.9.0 → 1.9.3

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.
@@ -1,8 +1,3 @@
1
- var Entity;
2
- (function (Entity) {
3
- Entity[Entity["List"] = 0] = "List";
4
- Entity[Entity["Set"] = 1] = "Set";
5
- })(Entity || (Entity = {}));
6
1
  /**
7
2
  * Boolean selector is an HTML boolean attribute value format that allows
8
3
  * developers to write configurations for elements deep in a shadow DOM. Here's
@@ -54,7 +49,6 @@ export class BooleanSelector {
54
49
  * @param value boolean selector value, e.g. `foo:bar baz:not=qux`
55
50
  */
56
51
  constructor(value) {
57
- this.__value = value;
58
52
  this.__tree = BooleanSelector.__parse(value);
59
53
  }
60
54
  /**
@@ -123,24 +117,38 @@ export class BooleanSelector {
123
117
  return isFullMatch ? selector === 'not=*' : selector !== '';
124
118
  }
125
119
  /**
126
- * Zooms on the given top-level identifier.
120
+ * Zooms on the given top-level identifier or follows a path.
127
121
  *
128
122
  * @example
123
+ * new BooleanSelector('foo:bar:baz').zoom('foo:bar').toString() // => "baz"
129
124
  * new BooleanSelector('foo:bar:baz').zoom('foo').toString() // => "bar:baz"
130
125
  * new BooleanSelector('not=foo').zoom('bar').toString() // => "not=*"
131
126
  * new BooleanSelector('not=foo').zoom('foo').toString() // => ""
132
127
  *
133
- * @param id identifier to look for
134
- * @returns `true` is current selector includes rules for the given identifier
128
+ * @param path path to look for
129
+ * @returns zoomed BooleanSelector
135
130
  */
136
- zoom(id) {
137
- const [firstPart, ...rest] = id.split(':');
138
- const { only, not } = this.__tree;
139
- if (only === null || only === void 0 ? void 0 : only[firstPart]) {
140
- const selector = new BooleanSelector(BooleanSelector.__stringify(only[firstPart]));
141
- return rest.length === 0 ? selector : selector.zoom(rest.join(':'));
142
- }
143
- return !not || not.includes(firstPart) ? BooleanSelector.False : BooleanSelector.True;
131
+ zoom(path) {
132
+ const zoomedSelector = new BooleanSelector('');
133
+ zoomedSelector.__tree = path.split(':').reduce((currentTree, id) => {
134
+ let zoomedTree;
135
+ if ('include' in currentTree) {
136
+ zoomedTree = currentTree.include[id];
137
+ if (zoomedTree === undefined)
138
+ return { include: {} };
139
+ if (zoomedTree === true)
140
+ return { exclude: { '*': true } };
141
+ }
142
+ else {
143
+ zoomedTree = currentTree.exclude[id];
144
+ if (zoomedTree === undefined)
145
+ return { exclude: { '*': true } };
146
+ if (zoomedTree === true)
147
+ return { include: {} };
148
+ }
149
+ return zoomedTree;
150
+ }, this.__tree);
151
+ return zoomedSelector;
144
152
  }
145
153
  /**
146
154
  * Converts this selector to string.
@@ -151,7 +159,7 @@ export class BooleanSelector {
151
159
  * @returns serialized representation of this selector
152
160
  */
153
161
  toString() {
154
- return this.__value;
162
+ return BooleanSelector.__stringifyTree(this.__tree);
155
163
  }
156
164
  /**
157
165
  * Converts this selector to an attribute value.
@@ -166,103 +174,226 @@ export class BooleanSelector {
166
174
  * @returns attribute value representing this selector.
167
175
  */
168
176
  toAttribute(truthyValue = '') {
169
- var _a;
170
- if (((_a = this.__tree.not) === null || _a === void 0 ? void 0 : _a[0]) === '*')
177
+ const serializedSelector = this.toString();
178
+ if (serializedSelector === 'not=*')
171
179
  return truthyValue;
172
- return this.__value.trim().length === 0 ? null : this.toString();
180
+ return serializedSelector.length === 0 ? null : serializedSelector;
181
+ }
182
+ static __parsePath(path, tree) {
183
+ const firstSeparatorIndex = path.indexOf(':');
184
+ const topLevelId = path.substring(0, firstSeparatorIndex);
185
+ const nestedPath = path.substring(firstSeparatorIndex + 1);
186
+ if ('exclude' in tree) {
187
+ const subTree = tree.exclude[topLevelId];
188
+ if (subTree)
189
+ tree.exclude[topLevelId] = this.__parseListItem(nestedPath, subTree === true ? void 0 : subTree);
190
+ }
191
+ else {
192
+ const subTree = tree.include[topLevelId];
193
+ if (subTree !== true)
194
+ tree.include[topLevelId] = this.__parseListItem(nestedPath, subTree);
195
+ }
196
+ return tree;
197
+ }
198
+ static __parseSet(set, tree) {
199
+ const setItems = set.split(',');
200
+ if ('include' in tree) {
201
+ tree = { exclude: tree.include };
202
+ for (const id in tree.exclude)
203
+ if (!setItems.includes(id))
204
+ delete tree.exclude[id];
205
+ for (const item of setItems) {
206
+ if (item in tree.exclude) {
207
+ delete tree.exclude[item];
208
+ }
209
+ else {
210
+ tree.exclude[item] = true;
211
+ }
212
+ }
213
+ }
214
+ else {
215
+ for (const id in tree.exclude)
216
+ if (!setItems.includes(id))
217
+ delete tree.exclude[id];
218
+ }
219
+ return tree;
173
220
  }
174
- static __stringify(tree, path = '') {
175
- if (tree.only) {
176
- return Object.entries(tree.only).reduce((output, [key, subtree]) => {
177
- const result = BooleanSelector.__stringify(subtree, path.length === 0 ? key : `${path}:${key}`);
178
- return output.length === 0 ? result : `${output} ${result}`;
179
- }, '');
221
+ static __parseListItem(listItem, tree = { include: {} }) {
222
+ if (listItem.includes(':'))
223
+ return this.__parsePath(listItem, tree);
224
+ if (listItem.startsWith('not='))
225
+ return this.__parseSet(listItem.substring(4), tree);
226
+ if ('include' in tree) {
227
+ tree.include[listItem] = true;
180
228
  }
181
- if (tree.not)
182
- return `${path.length === 0 ? '' : `${path}:`}not=${tree.not.join(',')}`;
183
- return path;
229
+ else {
230
+ for (const id in tree.exclude)
231
+ if (id === listItem)
232
+ delete tree.exclude[id];
233
+ }
234
+ return tree;
184
235
  }
185
- static __parse(value) {
186
- const tree = {};
187
- const output = { branch: tree, buffer: '', entity: Entity.List, tree };
188
- Array.from(`${value} `).forEach((character, position) => {
236
+ static __parseList(list, tree = { include: {} }) {
237
+ return list.split(' ').reduce((newTree, listItem) => this.__parseListItem(listItem, newTree), tree);
238
+ }
239
+ static __lintList(list) {
240
+ var _a;
241
+ let position = 'list';
242
+ let result = '';
243
+ for (let i = 0; i < list.length; ++i) {
244
+ const character = list.charAt(i);
189
245
  try {
190
- BooleanSelector.__processors[output.entity](output, character);
246
+ if (position === 'list') {
247
+ if (/^\s$/.test(character)) {
248
+ if (!/^\s$/.test((_a = list[i - 1]) !== null && _a !== void 0 ? _a : ' '))
249
+ result += ' ';
250
+ continue;
251
+ }
252
+ if (/^[a-z]$/.test(character)) {
253
+ result += character;
254
+ position = 'path';
255
+ continue;
256
+ }
257
+ throw new SyntaxError(`Expected [a-z] or a whitespace, but got "${character}" instead.`);
258
+ }
259
+ if (position === 'path') {
260
+ if (/^[a-z]$/.test(character)) {
261
+ result += character;
262
+ continue;
263
+ }
264
+ if (character === '-') {
265
+ if (list[i - 1] === '-' || list[i - 1] === ':') {
266
+ throw new SyntaxError(`Expected [a-z], but got "${character}" instead.`);
267
+ }
268
+ else {
269
+ result += character;
270
+ continue;
271
+ }
272
+ }
273
+ if (character === ':') {
274
+ if (list[i - 1] === ':' || list[i - 1] === '-') {
275
+ throw new SyntaxError(`Expected [a-z], but got "${character}" instead.`);
276
+ }
277
+ else {
278
+ result += character;
279
+ continue;
280
+ }
281
+ }
282
+ if (character === '=') {
283
+ if (list[i - 1] === '=' || list[i - 1] === ':' || list[i - 1] === '-') {
284
+ throw new SyntaxError(`Expected [a-z], but got "${character}" instead.`);
285
+ }
286
+ if (result.endsWith('not') && (result.length === 3 || !/[a-z]|-/.test(result[i - 4]))) {
287
+ result += character;
288
+ position = 'set';
289
+ continue;
290
+ }
291
+ else {
292
+ throw new SyntaxError(`Expected [a-z] or ":", but got "${character}" instead.`);
293
+ }
294
+ }
295
+ if (/^\s$/.test(character)) {
296
+ result += ' ';
297
+ position = 'list';
298
+ continue;
299
+ }
300
+ throw new SyntaxError(`Expected [a-z], ",", ":", ":" or a whitespace, but got "${character}" instead.`);
301
+ }
302
+ if (position === 'set') {
303
+ if (/^\s$/.test(character))
304
+ continue;
305
+ if (/^[a-z]|\*$/.test(character)) {
306
+ position = 'set-item';
307
+ result += character;
308
+ continue;
309
+ }
310
+ throw new SyntaxError(`Expected [a-z] or a whitespace, but got "${character}" instead.`);
311
+ }
312
+ if (position === 'set-item') {
313
+ if (list[i - 1] === '*') {
314
+ if (character === ',') {
315
+ result += character;
316
+ position = 'set';
317
+ continue;
318
+ }
319
+ if (/^\s$/.test(character)) {
320
+ if (i !== list.length - 1)
321
+ result += ' ';
322
+ position = 'list';
323
+ continue;
324
+ }
325
+ throw new SyntaxError(`Expected "," or a whitespace, but got "${character}" instead.`);
326
+ }
327
+ else {
328
+ if (/^[a-z]$/.test(character)) {
329
+ result += character;
330
+ continue;
331
+ }
332
+ if (character === '-') {
333
+ if (list[i - 1] === '-' || list[i - 1] === ':' || list[i - 1] === '=') {
334
+ throw new SyntaxError(`Expected [a-z], but got "${character}" instead.`);
335
+ }
336
+ else {
337
+ result += character;
338
+ continue;
339
+ }
340
+ }
341
+ if (character === ',') {
342
+ result += character;
343
+ position = 'set';
344
+ continue;
345
+ }
346
+ if (/^\s$/.test(character)) {
347
+ if (i !== list.length - 1)
348
+ result += ' ';
349
+ position = 'list';
350
+ continue;
351
+ }
352
+ throw new SyntaxError(`Expected [a-z], "," or a whitespace, but got "${character}" instead.`);
353
+ }
354
+ }
191
355
  }
192
356
  catch (err) {
193
357
  const hint = 'This error occured at: ';
194
- const trim = (v) => v.substring(Math.max(0, position - 30), position + 30);
195
- const preview = trim(value);
196
- const pointer = ' '.repeat(hint.length) + trim('^'.padStart(position + 1, ' '));
358
+ const trim = (v) => v.substring(Math.max(0, i - 30), i + 30);
359
+ const preview = trim(list);
360
+ const pointer = ' '.repeat(hint.length) + trim('^'.padStart(i + 1, ' '));
197
361
  throw new SyntaxError([err.message, `${hint}${preview}`, pointer].join('\n'));
198
362
  }
199
- });
200
- return tree;
201
- }
202
- }
203
- BooleanSelector.__processors = {
204
- [Entity.List](output, character) {
205
- var _a, _b, _c, _d;
206
- /* istanbul ignore next */
207
- if (Array.isArray(output.branch))
208
- throw new SyntaxError('Paths are not allowed in sets.');
209
- if (character === '=') {
210
- if (output.buffer === 'not') {
211
- const newBranch = (_a = output.branch.not) !== null && _a !== void 0 ? _a : [];
212
- delete output.branch.only;
213
- output.branch.not = newBranch;
214
- output.entity = Entity.Set;
215
- output.branch = newBranch;
216
- output.buffer = '';
217
- return;
218
- }
219
- else {
220
- throw new SyntaxError(`Unknown modifier "${output.buffer}".`);
221
- }
222
363
  }
223
- if (/^\s$/.test(character) || character === ':') {
224
- if (output.buffer.length > 0) {
225
- const selector = output.buffer;
226
- const newBranch = (_c = (_b = output.branch.only) === null || _b === void 0 ? void 0 : _b[selector]) !== null && _c !== void 0 ? _c : {};
227
- if (character !== ':')
228
- newBranch.not = ['*'];
229
- if (((_d = output.branch.not) === null || _d === void 0 ? void 0 : _d.includes('*')) !== true) {
230
- output.branch.only = Object.assign(Object.assign({}, output.branch.only), { [selector]: newBranch });
231
- delete output.branch.not;
364
+ return result.trimEnd();
365
+ }
366
+ static __parse(list) {
367
+ return this.__parseList(this.__lintList(list));
368
+ }
369
+ static __stringifyTree(tree, path) {
370
+ const parts = [];
371
+ if ('include' in tree) {
372
+ for (const id in tree.include) {
373
+ const nestedTree = tree.include[id];
374
+ const newPath = path ? [path, id].join(':') : id;
375
+ if (nestedTree === true) {
376
+ parts.push(newPath);
377
+ }
378
+ else {
379
+ parts.push(this.__stringifyTree(nestedTree, newPath));
232
380
  }
233
- output.branch = character === ':' ? newBranch : output.tree;
234
- output.buffer = '';
235
381
  }
236
- return;
237
382
  }
238
- if (/^[a-z]|-$/.test(character)) {
239
- output.buffer += character;
240
- return;
241
- }
242
- throw new SyntaxError(`Expected [a-z], "-", ":" or a whitespace, but got "${character}" instead.`);
243
- },
244
- [Entity.Set](output, character) {
245
- /* istanbul ignore next */
246
- if (!Array.isArray(output.branch))
247
- throw new SyntaxError('Unexpected set item.');
248
- if (output.buffer.length === 0 && /^\s$/.test(character))
249
- return;
250
- if (character === ',' || character === '*' || /^\s$/.test(character)) {
251
- const newItem = character === '*' ? '*' : output.buffer;
252
- const updatedSet = new Set([...output.branch, newItem]);
253
- const normalizedSet = updatedSet.has('*') ? new Set(['*']) : updatedSet;
254
- output.branch.splice(0, output.branch.length, ...normalizedSet);
255
- output.entity = character === ',' ? Entity.Set : Entity.List;
256
- output.branch = character === ',' ? output.branch : output.tree;
257
- output.buffer = '';
258
- return;
259
- }
260
- if (/^[a-z]|-$/.test(character)) {
261
- output.buffer += character;
262
- return;
383
+ else {
384
+ const ids = [];
385
+ const partsToPush = [];
386
+ for (const id in tree.exclude) {
387
+ const nestedTree = tree.exclude[id];
388
+ const newPath = path ? [path, id].join(':') : id;
389
+ ids.push(id);
390
+ if (nestedTree !== true)
391
+ partsToPush.push(this.__stringifyTree(nestedTree, newPath));
392
+ }
393
+ parts.push(`${path ? `${path}:` : ''}not=${ids.join(',')}`, ...partsToPush);
263
394
  }
264
- throw new SyntaxError(`Expected [a-z], "-", "," or a whitespace, but got "${character}" instead.`);
265
- },
266
- };
395
+ return parts.join(' ');
396
+ }
397
+ }
267
398
  const falseBooleanSelectorSingleton = new BooleanSelector('');
268
399
  const trueBooleanSelectorSingleton = new BooleanSelector('not=*');
@@ -29,6 +29,17 @@ export interface GiftCard extends Graph {
29
29
  expires_after: string | null;
30
30
  /** If you want to limit which products can use this gift card, you can enter a comma separated listed of product codes or partial product codes using `*` as a wild card at the beginning or end of the value. So `abc123`, `fun_*`, `*-small` would match `abc123`, `fun_` and `fun_times`, and `example-small`. It wouldn't match `abc12`, `abc1234`, `fun`, or `good-smalls`. Optional. 5000 characters or less. */
31
31
  product_code_restrictions: string | null;
32
+ /** SKU used to add the gift card to the cart in order to buy it. Optional. 200 characters or less. */
33
+ sku: string | null;
34
+ /** Used for provisioning the gift card. */
35
+ provisioning_config: {
36
+ /** Set to `true` to activate automatic code provisioning for this gift card. */
37
+ allow_autoprovisioning: boolean;
38
+ /** Minimum initial gift card code balance. When this gift card is added to a cart, its price will have to be greater or equal to this value. */
39
+ initial_balance_min: number;
40
+ /** Maximum initial gift card code balance. When this gift card is added to a cart, its price will have to be less or equal to this value. */
41
+ initial_balance_max: number;
42
+ } | null;
32
43
  /** The date this resource was created. ISO date. Read only. */
33
44
  date_created: string | null;
34
45
  /** The date this resource was last modified. ISO date. Read only. */
@@ -3,6 +3,7 @@ import type { GiftCard } from './gift_card';
3
3
  import type { GiftCardCodeLogs } from './gift_card_code_logs';
4
4
  import type { Graph } from '../../core';
5
5
  import type { Store } from './store';
6
+ import type { Transaction } from './transaction';
6
7
 
7
8
  export interface GiftCardCode extends Graph {
8
9
  curie: 'fx:gift_card_code';
@@ -18,6 +19,8 @@ export interface GiftCardCode extends Graph {
18
19
  'fx:gift_card': GiftCard;
19
20
  /** Transactions using this gift card code. */
20
21
  'fx:gift_card_code_logs': GiftCardCodeLogs;
22
+ /** Transaction that resulted in the creation of this gift card code, if applicable. */
23
+ 'fx:provisioned_by_transaction_detail_id': Transaction;
21
24
  };
22
25
 
23
26
  props: {
@@ -0,0 +1,43 @@
1
+ import type { GiftCard } from './gift_card';
2
+ import type { GiftCardCode } from './gift_card_code';
3
+ import type { Graph } from '../../core';
4
+ import type { Store } from './store';
5
+ import type { Transaction } from './transaction';
6
+
7
+ export interface GiftCardCodeLog extends Graph {
8
+ curie: 'fx:gift_card_code_log';
9
+
10
+ links: {
11
+ /** This resource. */
12
+ 'self': GiftCardCodeLog;
13
+ /** Store this resource belongs to. */
14
+ 'fx:store': Store;
15
+ /** Transaction involving the relevant gift card code. */
16
+ 'fx:transaction': Transaction;
17
+ /** Gift card this log belongs to. */
18
+ 'fx:gift_card': GiftCard;
19
+ /** Gift card code this log was created for. */
20
+ 'fx:gift_card_code': GiftCardCode;
21
+ };
22
+
23
+ props: {
24
+ /** User id that made the change, for store admin or API initiated balance adjustments. Integer, optional. */
25
+ user_id: number | null;
26
+ /** External id associated with gift card. If you maintain gift card balances across multiple systems, you can use this field to track non-Foxy transactions. Optional. 50 characters or less. */
27
+ external_id: string | null;
28
+ /** The Foxy transaction ID associated with gift card usage. Integer, optional. */
29
+ transaction_id: number | null;
30
+ /** Balance adjustment for the gift card. Decimal, optional. */
31
+ balance_adjustment: number | null;
32
+ /** Source that made the change for the gift card. Readonly. */
33
+ source: string | null;
34
+ /** The date this resource was created. Readonly. */
35
+ date_created: string | null;
36
+ /** The date this resource was last modified. Readonly. */
37
+ date_modified: string | null;
38
+ };
39
+
40
+ zooms: {
41
+ gift_card?: GiftCard;
42
+ };
43
+ }
@@ -1,10 +1,10 @@
1
1
  import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
2
+ import type { GiftCardCodeLog } from './gift_card_code_log';
2
3
  import type { Graph } from '../../core';
3
- import type { Transaction } from './transaction';
4
4
 
5
5
  export interface GiftCardCodeLogs extends Graph {
6
6
  curie: 'fx:gift_card_code_logs';
7
7
  links: CollectionGraphLinks<GiftCardCodeLogs>;
8
8
  props: CollectionGraphProps;
9
- child: Transaction;
9
+ child: GiftCardCodeLog;
10
10
  }
@@ -1,3 +1,4 @@
1
+ import type { EmailTemplate } from './email_template';
1
2
  import type { EmailTemplates } from './email_templates';
2
3
  import type { Graph } from '../../core';
3
4
  import type { Store } from './store';
@@ -15,6 +16,8 @@ export interface ItemCategory extends Graph {
15
16
  'fx:email_templates': EmailTemplates;
16
17
  /** Related tax item categories. */
17
18
  'fx:tax_item_categories': TaxItemCategories;
19
+ /** Gift recipient email template for this item category, if applicable. */
20
+ 'fx:gift_recipient_email_template': EmailTemplate;
18
21
  };
19
22
 
20
23
  props: {
@@ -22,12 +25,14 @@ export interface ItemCategory extends Graph {
22
25
  admin_email_template_uri: string;
23
26
  /** The full API URI of the email template used by this category for sending an additional customer email if send_customer_email is true. */
24
27
  customer_email_template_uri: string;
28
+ /** The full API URI of the email template used by this category for sending an additional customer email for gift items that are in the cart. URL, optional. */
29
+ gift_recipient_email_template_uri: string | null;
25
30
  /** The category code used when applying this item category to the cart. */
26
31
  code: string;
27
32
  /** The name of this category. */
28
33
  name: string;
29
- /** The delivery type of the items in this category. */
30
- item_delivery_type: string;
34
+ /** The delivery type of the items in this category. Required. Defaults to `notshipped`. */
35
+ item_delivery_type: 'shipped' | 'downloaded' | 'flat_rate' | 'pickup' | 'notshipped';
31
36
  /** Determines how many times the same customer can attempt to download a purchased downloadable item before they are given an error. */
32
37
  max_downloads_per_customer: number;
33
38
  /** Determines how long in hours after the initial purchase a customer can attempt to download a purchased downloadable item before they are given an error. Some helpful values include: 1 day = 24 hours, 1 Week = 168 hours, 1 Month = 672 hours, 6 Months = 4032 hours */
@@ -1,3 +1,5 @@
1
+ import type { Attributes } from './attributes';
2
+ import type { CustomFields } from './custom_fields';
1
3
  import type { Customer } from './customer';
2
4
  import type { CustomerAddress } from './customer_address';
3
5
  import type { Graph } from '../../core';
@@ -24,6 +26,10 @@ export interface Shipment extends Graph {
24
26
  'fx:transaction': Transaction;
25
27
  /** Customer's address. */
26
28
  'fx:customer_address': CustomerAddress;
29
+ /** Custom fields associated with this shipment. */
30
+ 'fx:custom_fields': CustomFields;
31
+ /** Attributes associated with this shipment. */
32
+ 'fx:attributes': Attributes;
27
33
  };
28
34
 
29
35
  props: {
@@ -66,4 +72,10 @@ export interface Shipment extends Graph {
66
72
  /** The date this resource was last modified. */
67
73
  date_modified: string | null;
68
74
  };
75
+
76
+ zooms: {
77
+ custom_fields?: CustomFields;
78
+ attributes?: Attributes;
79
+ items?: Items;
80
+ };
69
81
  }
@@ -39,25 +39,25 @@ export interface StoreShippingMethod extends Graph {
39
39
  /** The full API URI of the shipping method defined in our property helpers. */
40
40
  shipping_method_uri: string;
41
41
  /** The full API URI of the shipping method container defined in our property helpers. Each shipping method will have it's own shipping containers. */
42
- shipping_container_uri: string;
42
+ shipping_container_uri?: string;
43
43
  /** The full API URI of the shipping method drop type defined in our property helpers. Each shipping method will have it's own shipping drop types. */
44
- shipping_drop_type_uri: string;
45
- /** If using account specific rates, enter your shipping account id here. */
46
- accountid: string;
44
+ shipping_drop_type_uri?: string;
45
+ /** If using account specific rates, enter your shipping account id here. If using the `CUSTOM-ENDPOINT-POST` method, enter your endpoint URL here. */
46
+ accountid?: string | null;
47
47
  /** If using account specific rates, enter your shipping account password here. */
48
- password: string;
48
+ password?: string | null;
49
49
  /** If using account specific rates, enter your shipping account meter number here, if applicable. */
50
- meter_number: string;
50
+ meter_number?: string | null;
51
51
  /** If using account specific rates, enter your shipping account authentication key here, if applicable. */
52
- authentication_key: string;
52
+ authentication_key?: string | null;
53
53
  /** Set to true if you want this shipping method to apply to domestic shipping rate requests. <br>Note: This value is read only `true` for `CUSTOM-CODE`. */
54
- use_for_domestic: string;
54
+ use_for_domestic: boolean;
55
55
  /** Set to true if you want this shipping method to apply to international shipping rate requests. <br>Note: This value is read only `true` for `CUSTOM-CODE`. */
56
- use_for_international: string;
56
+ use_for_international: boolean;
57
57
  /** For the `CUSTOM-CODE` shipping method. JavaScript used to create and modify shipping rates. */
58
- custom_code: string;
58
+ custom_code?: string;
59
59
  /** For the `CUSTOM-CODE` shipping method. Values are `deploying`, `deployed`, and `error`. */
60
- deployment_status: 'deploying' | 'deployed' | 'error';
60
+ deployment_status?: 'deploying' | 'deployed' | 'error';
61
61
  /** The date this resource was created. */
62
62
  date_created: string | null;
63
63
  /** The date this resource was last modified. */
@@ -65,9 +65,9 @@ export interface StoreShippingMethod extends Graph {
65
65
  };
66
66
 
67
67
  zooms: {
68
- store_shipping_services: StoreShippingServices;
69
- shipping_container: ShippingContainer;
70
- shipping_drop_type: ShippingDropType;
71
- shipping_method: ShippingMethod;
68
+ store_shipping_services?: StoreShippingServices;
69
+ shipping_container?: ShippingContainer;
70
+ shipping_drop_type?: ShippingDropType;
71
+ shipping_method?: ShippingMethod;
72
72
  };
73
73
  }
@@ -0,0 +1,43 @@
1
+ import type { Graph } from '../../core';
2
+ import type { Store } from './store';
3
+ import type { WebhookLogs } from './webhook_logs';
4
+ import type { WebhookStatuses } from './webhook_statuses';
5
+ import type { Webhooks } from './webhooks';
6
+
7
+ export interface Webhook extends Graph {
8
+ curie: 'fx:webhook';
9
+
10
+ links: {
11
+ /** This resource. */
12
+ 'self': Webhook;
13
+ /** Store this webhook was created in. */
14
+ 'fx:store': Store;
15
+ /** List of all webhooks for the store. */
16
+ 'fx:webhooks': Webhooks;
17
+ /** List of all webhook delivery attempts and their current states. */
18
+ 'fx:statuses': WebhookStatuses;
19
+ /** List of all endpoint responses received during webhook delivery attempts. */
20
+ 'fx:logs': WebhookLogs;
21
+ };
22
+
23
+ props: {
24
+ /** The type of this webhook. Required. */
25
+ format: 'json' | 'webflow' | 'zapier';
26
+ /** The version of this webhook. Should not be modified unless you have specific instructions from Foxy. Default value is 2. */
27
+ version: number;
28
+ /** The name of this webhook. Required. 255 characters or less. */
29
+ name: string;
30
+ /** The endpoint where we will send the webhook data. 1000 characters or less. */
31
+ url: string | null;
32
+ /** The webhook payload mirrors the API, and you can include more or less data according to your needs (using `zoom` and other modifiers). 1000 characters or less. Something like `zoom=items,items:options,customer`. */
33
+ query: string | null;
34
+ /** The JSON webhooks are encrypted in certain situations. This key is also used to generate a signature to verify the integrity of the payload. 1000 characters or less. */
35
+ encryption_key: string | null;
36
+ /** The type of resource to observe changes on. */
37
+ event_resource: ('subscription' | 'transaction' | 'customer')[];
38
+ /** The date this resource was created. */
39
+ date_created: string | null;
40
+ /** The date this resource was last modified. */
41
+ date_modified: string | null;
42
+ };
43
+ }