@foxy.io/sdk 1.8.2 → 1.9.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/dist/cdn/FoxySDKCustomer.js +3 -3
- package/dist/cjs/core/BooleanSelector.js +233 -102
- package/dist/esm/core/BooleanSelector.js +232 -101
- package/dist/types/backend/Graph/download_url.d.ts +5 -0
- package/dist/types/backend/Graph/report.d.ts +30 -0
- package/dist/types/backend/Graph/reports.d.ts +10 -0
- package/dist/types/backend/Graph/store.d.ts +3 -0
- package/dist/types/backend/Graph/webhook.d.ts +43 -0
- package/dist/types/backend/Graph/webhook_log.d.ts +42 -0
- package/dist/types/backend/Graph/webhook_logs.d.ts +10 -0
- package/dist/types/backend/Graph/webhook_status.d.ts +40 -0
- package/dist/types/backend/Graph/webhook_statuses.d.ts +10 -0
- package/dist/types/backend/Graph/webhooks.d.ts +10 -0
- package/dist/types/backend/Rels.d.ts +9 -0
- package/dist/types/core/BooleanSelector.d.ts +11 -7
- package/package.json +1 -1
|
@@ -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
|
|
134
|
-
* @returns
|
|
128
|
+
* @param path path to look for
|
|
129
|
+
* @returns zoomed BooleanSelector
|
|
135
130
|
*/
|
|
136
|
-
zoom(
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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.
|
|
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
|
-
|
|
170
|
-
if (
|
|
177
|
+
const serializedSelector = this.toString();
|
|
178
|
+
if (serializedSelector === 'not=*')
|
|
171
179
|
return truthyValue;
|
|
172
|
-
return
|
|
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
|
|
175
|
-
if (
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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
|
-
|
|
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,
|
|
195
|
-
const preview = trim(
|
|
196
|
-
const pointer = ' '.repeat(hint.length) + trim('^'.padStart(
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
265
|
-
}
|
|
266
|
-
}
|
|
395
|
+
return parts.join(' ');
|
|
396
|
+
}
|
|
397
|
+
}
|
|
267
398
|
const falseBooleanSelectorSingleton = new BooleanSelector('');
|
|
268
399
|
const trueBooleanSelectorSingleton = new BooleanSelector('not=*');
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DownloadUrl } from './download_url';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { User } from './user';
|
|
4
|
+
|
|
5
|
+
export interface Report extends Graph {
|
|
6
|
+
curie: 'fx:report';
|
|
7
|
+
|
|
8
|
+
links: {
|
|
9
|
+
'self': Report;
|
|
10
|
+
'fx:download_url': DownloadUrl;
|
|
11
|
+
'fx:user': User;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
props: {
|
|
15
|
+
/** The type of report generated, indicating the content of the report. `complete` includes transaction details, summaries, coupon usage, subscription forecasts, and more. `customers` is for exporting customers to import elsewhere. `customers_ltv` includes the lifetime value per customer. */
|
|
16
|
+
name: 'complete' | 'customers' | 'customers_ltv';
|
|
17
|
+
/** In the event a report changes significantly, a new version of the report may be available. Leave this empty to retrieve the latest version, or pass a 1 to request a specific version. In the future, additional versions of each named report may be available. */
|
|
18
|
+
version: '1';
|
|
19
|
+
/** Current status of the report. Possible values include `queued`, `error`, and `ready`. */
|
|
20
|
+
status: 'queued' | 'error' | 'ready';
|
|
21
|
+
/** A timestamp in the `YYYY-MM-DD HH:MM:SS` format, for the start of the reporting period, for your store's configured timezone. Note that any offset will be ignored, and the datetime passed in will be used as your store's configured timezone. */
|
|
22
|
+
datetime_start: string;
|
|
23
|
+
/** Same as `datetime_start`, but for the end of the report's timeframe. Note that you likely want to pass `23:59:59` as the time portion, or you may inadvertently miss data from the last day of the reporting period. */
|
|
24
|
+
datetime_end: string;
|
|
25
|
+
/** The date this resource was created. */
|
|
26
|
+
date_created: string | null;
|
|
27
|
+
/** The date this resource was last modified. */
|
|
28
|
+
date_modified: string | null;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { Report } from './report';
|
|
4
|
+
|
|
5
|
+
export interface Reports extends Graph {
|
|
6
|
+
curie: 'fx:reports';
|
|
7
|
+
links: CollectionGraphLinks<Reports>;
|
|
8
|
+
props: CollectionGraphProps;
|
|
9
|
+
child: Report;
|
|
10
|
+
}
|
|
@@ -17,6 +17,7 @@ import type { ItemCategories } from './item_categories';
|
|
|
17
17
|
import type { PaymentMethodSets } from './payment_method_sets';
|
|
18
18
|
import type { ProcessSubscriptionWebhook } from './process_subscription_webhook';
|
|
19
19
|
import type { ReceiptTemplates } from './receipt_templates';
|
|
20
|
+
import type { Reports } from './reports';
|
|
20
21
|
import type { StoreVersion } from './store_version';
|
|
21
22
|
import type { SubscriptionSettings } from './subscription_settings';
|
|
22
23
|
import type { Subscriptions } from './subscriptions';
|
|
@@ -38,6 +39,8 @@ export interface Store extends Graph {
|
|
|
38
39
|
'fx:users': Users;
|
|
39
40
|
/** List of taxes configured for this store. */
|
|
40
41
|
'fx:taxes': Taxes;
|
|
42
|
+
/** List of reports for this store. */
|
|
43
|
+
'fx:reports': Reports;
|
|
41
44
|
/** List of coupons available in this store. */
|
|
42
45
|
'fx:coupons': Coupons;
|
|
43
46
|
/** List of customers of this store. */
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Customer } from './customer';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { Store } from './store';
|
|
4
|
+
import type { Subscription } from './subscription';
|
|
5
|
+
import type { Transaction } from './transaction';
|
|
6
|
+
import type { Webhook } from './webhook';
|
|
7
|
+
|
|
8
|
+
export interface WebhookLog extends Graph {
|
|
9
|
+
curie: 'fx:webhook_log';
|
|
10
|
+
|
|
11
|
+
links: {
|
|
12
|
+
/** This resource. */
|
|
13
|
+
'self': WebhookLog;
|
|
14
|
+
/** The store this webhook status is associated with. */
|
|
15
|
+
'fx:store': Store;
|
|
16
|
+
/** The webhook this status is associated with. */
|
|
17
|
+
'fx:webhook': Webhook;
|
|
18
|
+
/** The resource changes in which have triggered the webhook. */
|
|
19
|
+
'fx:resource': Transaction | Subscription | Customer;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
/** The type of resource changes were observed on. */
|
|
24
|
+
resource_type: 'subscription' | 'transaction' | 'customer';
|
|
25
|
+
/** The ID of the resource changes in which have triggered the webhook. */
|
|
26
|
+
resource_id: number;
|
|
27
|
+
/** The ID of the webhook this status is associated with. */
|
|
28
|
+
webhook_id: number;
|
|
29
|
+
/** The code received from the server the webhook was sent to. */
|
|
30
|
+
response_code: string;
|
|
31
|
+
/** The content received from the server the webhook was sent to. */
|
|
32
|
+
response_body: string | null;
|
|
33
|
+
/** The date this resource was created. */
|
|
34
|
+
date_created: string | null;
|
|
35
|
+
/** The date this resource was last modified. */
|
|
36
|
+
date_modified: string | null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
zooms: {
|
|
40
|
+
webhook?: Webhook;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { WebhookLog } from './webhook_log';
|
|
4
|
+
|
|
5
|
+
export interface WebhookLogs extends Graph {
|
|
6
|
+
curie: 'fx:webhook_logs';
|
|
7
|
+
links: CollectionGraphLinks<WebhookLogs>;
|
|
8
|
+
props: CollectionGraphProps;
|
|
9
|
+
child: WebhookLog;
|
|
10
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Customer } from './customer';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { Store } from './store';
|
|
4
|
+
import type { Subscription } from './subscription';
|
|
5
|
+
import type { Transaction } from './transaction';
|
|
6
|
+
import type { Webhook } from './webhook';
|
|
7
|
+
|
|
8
|
+
export interface WebhookStatus extends Graph {
|
|
9
|
+
curie: 'fx:webhook_status';
|
|
10
|
+
|
|
11
|
+
links: {
|
|
12
|
+
/** This resource. */
|
|
13
|
+
'self': WebhookStatus;
|
|
14
|
+
/** The store this webhook status is associated with. */
|
|
15
|
+
'fx:store': Store;
|
|
16
|
+
/** The webhook this status is associated with. */
|
|
17
|
+
'fx:webhook': Webhook;
|
|
18
|
+
/** The resource changes in which have triggered the webhook. */
|
|
19
|
+
'fx:resource': Transaction | Subscription | Customer;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
/** The type of resource changes were observed on. */
|
|
24
|
+
resource_type: 'subscription' | 'transaction' | 'customer';
|
|
25
|
+
/** The ID of the resource changes in which have triggered the webhook. */
|
|
26
|
+
resource_id: number;
|
|
27
|
+
/** The ID of the webhook this status is associated with. */
|
|
28
|
+
webhook_id: number;
|
|
29
|
+
/** The current state of this attempt. */
|
|
30
|
+
status: 'pending' | 'failed' | 'successful';
|
|
31
|
+
/** The date this resource was created. */
|
|
32
|
+
date_created: string | null;
|
|
33
|
+
/** The date this resource was last modified. */
|
|
34
|
+
date_modified: string | null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
zooms: {
|
|
38
|
+
webhook?: Webhook;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { WebhookStatus } from './webhook_status';
|
|
4
|
+
|
|
5
|
+
export interface WebhookStatuses extends Graph {
|
|
6
|
+
curie: 'fx:webhook_statuses';
|
|
7
|
+
links: CollectionGraphLinks<WebhookStatuses>;
|
|
8
|
+
props: CollectionGraphProps;
|
|
9
|
+
child: WebhookStatus;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { Webhook } from './webhook';
|
|
4
|
+
|
|
5
|
+
export interface Webhooks extends Graph {
|
|
6
|
+
curie: 'fx:webhooks';
|
|
7
|
+
links: CollectionGraphLinks<Webhooks>;
|
|
8
|
+
props: CollectionGraphProps;
|
|
9
|
+
child: Webhook;
|
|
10
|
+
}
|
|
@@ -109,9 +109,12 @@ export * from './Graph/receipt_template';
|
|
|
109
109
|
export * from './Graph/receipt_templates';
|
|
110
110
|
export * from './Graph/refund';
|
|
111
111
|
export * from './Graph/regions';
|
|
112
|
+
export * from './Graph/report';
|
|
113
|
+
export * from './Graph/download_url';
|
|
112
114
|
export * from './Graph/reporting';
|
|
113
115
|
export * from './Graph/reporting_email_exists';
|
|
114
116
|
export * from './Graph/reporting_store_domain_exists';
|
|
117
|
+
export * from './Graph/reports';
|
|
115
118
|
export * from './Graph/send_emails';
|
|
116
119
|
export * from './Graph/shipment';
|
|
117
120
|
export * from './Graph/shipments';
|
|
@@ -155,3 +158,9 @@ export * from './Graph/user_access';
|
|
|
155
158
|
export * from './Graph/user_accesses';
|
|
156
159
|
export * from './Graph/users';
|
|
157
160
|
export * from './Graph/void';
|
|
161
|
+
export * from './Graph/webhook_log';
|
|
162
|
+
export * from './Graph/webhook_logs';
|
|
163
|
+
export * from './Graph/webhook_status';
|
|
164
|
+
export * from './Graph/webhook_statuses';
|
|
165
|
+
export * from './Graph/webhook';
|
|
166
|
+
export * from './Graph/webhooks';
|