@foxy.io/sdk 2.0.0-beta.1 → 2.0.0-beta.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.
Files changed (102) hide show
  1. package/README.md +4 -4
  2. package/dist/cdn/FoxySDKCustomer.js +3 -3
  3. package/dist/cjs/backend/API.js +2 -2
  4. package/dist/cjs/backend/createSSOURL.js +1 -1
  5. package/dist/cjs/core/API/AuthError.js +1 -1
  6. package/dist/cjs/core/API/Node.js +11 -11
  7. package/dist/cjs/core/Nucleon/machine.js +1 -0
  8. package/dist/cjs/core/Rumour/Rumour.js +4 -1
  9. package/dist/esm/backend/API.js +2 -2
  10. package/dist/esm/backend/createSSOURL.js +1 -1
  11. package/dist/esm/core/API/AuthError.js +1 -1
  12. package/dist/esm/core/API/Node.js +11 -11
  13. package/dist/esm/core/Nucleon/machine.js +1 -0
  14. package/dist/esm/core/Rumour/Rumour.js +4 -1
  15. package/dist/types/backend/API.d.ts +2 -2
  16. package/dist/types/backend/Graph/applied_coupon_code.d.ts +2 -2
  17. package/dist/types/backend/Graph/applied_tax.d.ts +2 -2
  18. package/dist/types/backend/Graph/attribute.d.ts +2 -2
  19. package/dist/types/backend/Graph/billing_address.d.ts +2 -2
  20. package/dist/types/backend/Graph/cart.d.ts +2 -2
  21. package/dist/types/backend/Graph/cart_include_template.d.ts +2 -2
  22. package/dist/types/backend/Graph/cart_template.d.ts +2 -2
  23. package/dist/types/backend/Graph/checkout_template.d.ts +2 -2
  24. package/dist/types/backend/Graph/client.d.ts +2 -2
  25. package/dist/types/backend/Graph/coupon.d.ts +4 -4
  26. package/dist/types/backend/Graph/coupon_code.d.ts +2 -2
  27. package/dist/types/backend/Graph/coupon_code_transaction.d.ts +2 -2
  28. package/dist/types/backend/Graph/coupon_codes.d.ts +9 -0
  29. package/dist/types/backend/Graph/coupon_detail.d.ts +2 -2
  30. package/dist/types/backend/Graph/coupon_item_category.d.ts +2 -2
  31. package/dist/types/backend/Graph/custom_field.d.ts +2 -2
  32. package/dist/types/backend/Graph/customer.d.ts +2 -2
  33. package/dist/types/backend/Graph/customer_address.d.ts +4 -4
  34. package/dist/types/backend/Graph/customer_portal_settings.d.ts +2 -2
  35. package/dist/types/backend/Graph/default_payment_method.d.ts +7 -7
  36. package/dist/types/backend/Graph/discount.d.ts +2 -2
  37. package/dist/types/backend/Graph/discount_detail.d.ts +2 -2
  38. package/dist/types/backend/Graph/downloadable.d.ts +2 -2
  39. package/dist/types/backend/Graph/downloadable_purchase.d.ts +2 -2
  40. package/dist/types/backend/Graph/email_template.d.ts +2 -2
  41. package/dist/types/backend/Graph/error_entry.d.ts +2 -2
  42. package/dist/types/backend/Graph/fraud_protection.d.ts +2 -2
  43. package/dist/types/backend/Graph/generate_codes.d.ts +2 -0
  44. package/dist/types/backend/Graph/gift_card.d.ts +42 -0
  45. package/dist/types/backend/Graph/gift_card_code.d.ts +35 -0
  46. package/dist/types/backend/Graph/gift_card_code_logs.d.ts +10 -0
  47. package/dist/types/backend/Graph/gift_card_codes.d.ts +21 -0
  48. package/dist/types/backend/Graph/gift_card_item_categories.d.ts +10 -0
  49. package/dist/types/backend/Graph/gift_card_item_category.d.ts +30 -0
  50. package/dist/types/backend/Graph/gift_cards.d.ts +10 -0
  51. package/dist/types/backend/Graph/hosted_payment_gateways_helper.d.ts +56 -0
  52. package/dist/types/backend/Graph/integration.d.ts +10 -10
  53. package/dist/types/backend/Graph/item.d.ts +2 -2
  54. package/dist/types/backend/Graph/item_category.d.ts +2 -2
  55. package/dist/types/backend/Graph/item_option.d.ts +2 -2
  56. package/dist/types/backend/Graph/language_override.d.ts +2 -2
  57. package/dist/types/backend/Graph/language_strings.d.ts +1 -5
  58. package/dist/types/backend/Graph/native_integration.d.ts +2 -2
  59. package/dist/types/backend/Graph/payment.d.ts +5 -5
  60. package/dist/types/backend/Graph/payment_gateway.d.ts +2 -2
  61. package/dist/types/backend/Graph/payment_gateways_helper.d.ts +56 -0
  62. package/dist/types/backend/Graph/payment_method_expiring.d.ts +2 -2
  63. package/dist/types/backend/Graph/payment_method_set.d.ts +2 -2
  64. package/dist/types/backend/Graph/payment_method_set_fraud_protection.d.ts +2 -2
  65. package/dist/types/backend/Graph/payment_method_set_hosted_payment_gateway.d.ts +2 -2
  66. package/dist/types/backend/Graph/property_helpers.d.ts +4 -4
  67. package/dist/types/backend/Graph/receipt_template.d.ts +2 -2
  68. package/dist/types/backend/Graph/regions.d.ts +0 -2
  69. package/dist/types/backend/Graph/shipment.d.ts +2 -2
  70. package/dist/types/backend/Graph/shipping_container.d.ts +2 -2
  71. package/dist/types/backend/Graph/shipping_drop_type.d.ts +2 -2
  72. package/dist/types/backend/Graph/shipping_method.d.ts +2 -2
  73. package/dist/types/backend/Graph/shipping_service.d.ts +2 -2
  74. package/dist/types/backend/Graph/store.d.ts +5 -2
  75. package/dist/types/backend/Graph/store_shipping_method.d.ts +2 -2
  76. package/dist/types/backend/Graph/store_shipping_service.d.ts +2 -2
  77. package/dist/types/backend/Graph/store_version.d.ts +21 -3
  78. package/dist/types/backend/Graph/subscription.d.ts +2 -2
  79. package/dist/types/backend/Graph/subscription_settings.d.ts +2 -2
  80. package/dist/types/backend/Graph/tax.d.ts +2 -2
  81. package/dist/types/backend/Graph/tax_item_category.d.ts +2 -2
  82. package/dist/types/backend/Graph/template_config.d.ts +2 -2
  83. package/dist/types/backend/Graph/template_set.d.ts +2 -2
  84. package/dist/types/backend/Graph/transaction.d.ts +2 -2
  85. package/dist/types/backend/Graph/transaction_log.d.ts +1 -1
  86. package/dist/types/backend/Graph/user.d.ts +2 -2
  87. package/dist/types/backend/Graph/user_access.d.ts +2 -2
  88. package/dist/types/backend/Rels.d.ts +9 -0
  89. package/dist/types/backend/createSSOURL.d.ts +5 -3
  90. package/dist/types/core/Nucleon/types.d.ts +2 -1
  91. package/dist/types/core/Resource/Link.d.ts +1 -1
  92. package/dist/types/core/Rumour/Rumour.d.ts +1 -0
  93. package/dist/types/customer/Graph/attribute.d.ts +2 -2
  94. package/dist/types/customer/Graph/customer_address.d.ts +4 -4
  95. package/dist/types/customer/Graph/customer_portal_settings.d.ts +2 -2
  96. package/dist/types/customer/Graph/default_payment_method.d.ts +7 -7
  97. package/dist/types/customer/Graph/index.d.ts +2 -2
  98. package/dist/types/customer/Graph/item.d.ts +2 -2
  99. package/dist/types/customer/Graph/subscription.d.ts +2 -2
  100. package/dist/types/customer/Graph/transaction.d.ts +2 -2
  101. package/dist/types/customer/Graph/transaction_template.d.ts +2 -2
  102. package/package.json +1 -1
@@ -36,7 +36,7 @@ const Core = __importStar(require("../core/index.js"));
36
36
  const cross_fetch_1 = require("cross-fetch");
37
37
  const v8n_js_1 = require("../core/v8n.js");
38
38
  const fake_storage_1 = __importDefault(require("fake-storage"));
39
- /** JS SDK for building backends with [Foxy Hypermedia API](https://api.foxycart.com/docs). Hypermedia API is designed to give you complete control over all aspects of your Foxy accounts, whether working with a single store or automating the provisioning of thousands. Anything you can do within the Foxy administration, you can also do through the API. This means that you can embed Foxy into any application (CMS, LMS, CRM, etc.) and expose as much or as little of Foxy's functionality as desired. */
39
+ /** JS SDK for building backends with [Foxy Hypermedia API](https://api.foxy.io/docs). Hypermedia API is designed to give you complete control over all aspects of your Foxy accounts, whether working with a single store or automating the provisioning of thousands. Anything you can do within the Foxy administration, you can also do through the API. This means that you can embed Foxy into any application (CMS, LMS, CRM, etc.) and expose as much or as little of Foxy's functionality as desired. */
40
40
  class API extends Core.API {
41
41
  constructor(params) {
42
42
  var _a, _b, _c, _d;
@@ -125,7 +125,7 @@ class API extends Core.API {
125
125
  exports.API = API;
126
126
  API.REFRESH_THRESHOLD = 5 * 60 * 1000;
127
127
  API.ACCESS_TOKEN = 'access_token';
128
- API.BASE_URL = new URL('https://api.foxycart.com/');
128
+ API.BASE_URL = new URL('https://api.foxy.io/');
129
129
  API.VERSION = '1';
130
130
  API.v8n = {
131
131
  classConstructor: v8n_js_1.v8n().schema({
@@ -51,7 +51,7 @@ const optionsV8N = v8n_1.default().schema({
51
51
  function createSSOURL(options) {
52
52
  var _a;
53
53
  optionsV8N.check(options);
54
- const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Date.now();
54
+ const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Math.floor(Date.now() / 1000) + 3600;
55
55
  const decodedToken = `${options.customer}|${timestamp}|${options.secret}`;
56
56
  const encodedToken = crypto.createHash('sha1').update(decodedToken);
57
57
  const url = new url_1.URL('/checkout', options.domain);
@@ -31,6 +31,6 @@ AuthError.UNKNOWN = 'UNKNOWN';
31
31
  /** Available class member validators. */
32
32
  AuthError.v8n = {
33
33
  constructor: v8n_1.default().schema({
34
- code: v8n_1.default().passesAnyOf(v8n_1.default().exact(AuthError.NEW_PASSWORD_REQUIRED), v8n_1.default().exact(AuthError.UNAUTHORIZED), v8n_1.default().exact(AuthError.UNKNOWN)),
34
+ code: v8n_1.default().passesAnyOf(v8n_1.default().exact(AuthError.NEW_PASSWORD_REQUIRED), v8n_1.default().exact(AuthError.INVALID_NEW_PASSWORD), v8n_1.default().exact(AuthError.UNAUTHORIZED), v8n_1.default().exact(AuthError.UNKNOWN)),
35
35
  }),
36
36
  };
@@ -197,18 +197,18 @@ class Node {
197
197
  }
198
198
  const response = yield this._fetch(baseURL.toString());
199
199
  if (response.ok) {
200
- const json = yield response.json();
201
- const url = new URL(json._links[curie].href);
202
- const reducedPath = [url, ...this._path.slice(2)];
203
- this._cache.setItem(key, url.toString());
204
- this._console.trace(`Cached ${url.toString()} for ${key}.`);
205
- this._console.success(`Resolved ${key} to ${url.toString()} online.`);
206
- return new Node(Object.assign(Object.assign({}, config), { path: reducedPath }))._resolve();
207
- }
208
- else {
209
- this._console.error(`Failed to resolve ${key}.`);
210
- throw new ResolutionError_js_1.ResolutionError(response);
200
+ const json = yield response.clone().json();
201
+ if (json._links[curie]) {
202
+ const url = new URL(json._links[curie].href);
203
+ const reducedPath = [url, ...this._path.slice(2)];
204
+ this._cache.setItem(key, url.toString());
205
+ this._console.trace(`Cached ${url.toString()} for ${key}.`);
206
+ this._console.success(`Resolved ${key} to ${url.toString()} online.`);
207
+ return new Node(Object.assign(Object.assign({}, config), { path: reducedPath }))._resolve();
208
+ }
211
209
  }
210
+ this._console.error(`Failed to resolve ${key}.`);
211
+ throw new ResolutionError_js_1.ResolutionError(response);
212
212
  });
213
213
  }
214
214
  }
@@ -36,6 +36,7 @@ exports.machine = xstate_1.createMachine({
36
36
  on: {
37
37
  DELETE: { actions: ['clearData', 'clearEdits', 'clearErrors'], target: '#nucleon.busy.deleting' },
38
38
  FETCH: { actions: ['clearData', 'clearEdits', 'clearErrors'], target: '#nucleon.busy.fetching' },
39
+ REFRESH: { target: '#nucleon.busy.fetching' },
39
40
  SET_DATA: { actions: ['setData', 'clearEdits', 'clearErrors'], target: '#nucleon.init' },
40
41
  },
41
42
  states: {
@@ -99,6 +99,9 @@ class Rumour {
99
99
  cease() {
100
100
  this.__callbacks.length = 0;
101
101
  }
102
+ static __isCollection(json) {
103
+ return typeof lodash_1.get(json, '_links.first.href') === 'string';
104
+ }
102
105
  static __isResource(json) {
103
106
  return typeof lodash_1.get(json, '_links.self.href') === 'string';
104
107
  }
@@ -115,7 +118,7 @@ class Rumour {
115
118
  }
116
119
  static __createPatch(data) {
117
120
  return traverse_1.default(data).reduce(function (patch, value) {
118
- if (!Rumour.__isResource(value))
121
+ if (!Rumour.__isResource(value) || Rumour.__isCollection(value))
119
122
  return patch;
120
123
  const props = traverse_1.default(value).map(function () {
121
124
  var _a;
@@ -11,7 +11,7 @@ import * as Core from '../core/index.js';
11
11
  import { Headers, Request, fetch } from 'cross-fetch';
12
12
  import { storageV8N, v8n } from '../core/v8n.js';
13
13
  import MemoryStorage from 'fake-storage';
14
- /** JS SDK for building backends with [Foxy Hypermedia API](https://api.foxycart.com/docs). Hypermedia API is designed to give you complete control over all aspects of your Foxy accounts, whether working with a single store or automating the provisioning of thousands. Anything you can do within the Foxy administration, you can also do through the API. This means that you can embed Foxy into any application (CMS, LMS, CRM, etc.) and expose as much or as little of Foxy's functionality as desired. */
14
+ /** JS SDK for building backends with [Foxy Hypermedia API](https://api.foxy.io/docs). Hypermedia API is designed to give you complete control over all aspects of your Foxy accounts, whether working with a single store or automating the provisioning of thousands. Anything you can do within the Foxy administration, you can also do through the API. This means that you can embed Foxy into any application (CMS, LMS, CRM, etc.) and expose as much or as little of Foxy's functionality as desired. */
15
15
  export class API extends Core.API {
16
16
  constructor(params) {
17
17
  var _a, _b, _c, _d;
@@ -99,7 +99,7 @@ export class API extends Core.API {
99
99
  }
100
100
  API.REFRESH_THRESHOLD = 5 * 60 * 1000;
101
101
  API.ACCESS_TOKEN = 'access_token';
102
- API.BASE_URL = new URL('https://api.foxycart.com/');
102
+ API.BASE_URL = new URL('https://api.foxy.io/');
103
103
  API.VERSION = '1';
104
104
  API.v8n = {
105
105
  classConstructor: v8n().schema({
@@ -26,7 +26,7 @@ const optionsV8N = v8n().schema({
26
26
  export function createSSOURL(options) {
27
27
  var _a;
28
28
  optionsV8N.check(options);
29
- const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Date.now();
29
+ const timestamp = (_a = options.timestamp) !== null && _a !== void 0 ? _a : Math.floor(Date.now() / 1000) + 3600;
30
30
  const decodedToken = `${options.customer}|${timestamp}|${options.secret}`;
31
31
  const encodedToken = crypto.createHash('sha1').update(decodedToken);
32
32
  const url = new URL('/checkout', options.domain);
@@ -24,6 +24,6 @@ AuthError.UNKNOWN = 'UNKNOWN';
24
24
  /** Available class member validators. */
25
25
  AuthError.v8n = {
26
26
  constructor: v8n().schema({
27
- code: v8n().passesAnyOf(v8n().exact(AuthError.NEW_PASSWORD_REQUIRED), v8n().exact(AuthError.UNAUTHORIZED), v8n().exact(AuthError.UNKNOWN)),
27
+ code: v8n().passesAnyOf(v8n().exact(AuthError.NEW_PASSWORD_REQUIRED), v8n().exact(AuthError.INVALID_NEW_PASSWORD), v8n().exact(AuthError.UNAUTHORIZED), v8n().exact(AuthError.UNKNOWN)),
28
28
  }),
29
29
  };
@@ -191,18 +191,18 @@ export class Node {
191
191
  }
192
192
  const response = yield this._fetch(baseURL.toString());
193
193
  if (response.ok) {
194
- const json = yield response.json();
195
- const url = new URL(json._links[curie].href);
196
- const reducedPath = [url, ...this._path.slice(2)];
197
- this._cache.setItem(key, url.toString());
198
- this._console.trace(`Cached ${url.toString()} for ${key}.`);
199
- this._console.success(`Resolved ${key} to ${url.toString()} online.`);
200
- return new Node(Object.assign(Object.assign({}, config), { path: reducedPath }))._resolve();
201
- }
202
- else {
203
- this._console.error(`Failed to resolve ${key}.`);
204
- throw new ResolutionError(response);
194
+ const json = yield response.clone().json();
195
+ if (json._links[curie]) {
196
+ const url = new URL(json._links[curie].href);
197
+ const reducedPath = [url, ...this._path.slice(2)];
198
+ this._cache.setItem(key, url.toString());
199
+ this._console.trace(`Cached ${url.toString()} for ${key}.`);
200
+ this._console.success(`Resolved ${key} to ${url.toString()} online.`);
201
+ return new Node(Object.assign(Object.assign({}, config), { path: reducedPath }))._resolve();
202
+ }
205
203
  }
204
+ this._console.error(`Failed to resolve ${key}.`);
205
+ throw new ResolutionError(response);
206
206
  });
207
207
  }
208
208
  }
@@ -14,6 +14,7 @@ export const machine = createMachine({
14
14
  on: {
15
15
  DELETE: { actions: ['clearData', 'clearEdits', 'clearErrors'], target: '#nucleon.busy.deleting' },
16
16
  FETCH: { actions: ['clearData', 'clearEdits', 'clearErrors'], target: '#nucleon.busy.fetching' },
17
+ REFRESH: { target: '#nucleon.busy.fetching' },
17
18
  SET_DATA: { actions: ['setData', 'clearEdits', 'clearErrors'], target: '#nucleon.init' },
18
19
  },
19
20
  states: {
@@ -93,6 +93,9 @@ export class Rumour {
93
93
  cease() {
94
94
  this.__callbacks.length = 0;
95
95
  }
96
+ static __isCollection(json) {
97
+ return typeof get(json, '_links.first.href') === 'string';
98
+ }
96
99
  static __isResource(json) {
97
100
  return typeof get(json, '_links.self.href') === 'string';
98
101
  }
@@ -109,7 +112,7 @@ export class Rumour {
109
112
  }
110
113
  static __createPatch(data) {
111
114
  return traverse(data).reduce(function (patch, value) {
112
- if (!Rumour.__isResource(value))
115
+ if (!Rumour.__isResource(value) || Rumour.__isCollection(value))
113
116
  return patch;
114
117
  const props = traverse(value).map(function () {
115
118
  var _a;
@@ -32,7 +32,7 @@ declare type Token = {
32
32
  token_type: string;
33
33
  scope: string;
34
34
  };
35
- /** JS SDK for building backends with [Foxy Hypermedia API](https://api.foxycart.com/docs). Hypermedia API is designed to give you complete control over all aspects of your Foxy accounts, whether working with a single store or automating the provisioning of thousands. Anything you can do within the Foxy administration, you can also do through the API. This means that you can embed Foxy into any application (CMS, LMS, CRM, etc.) and expose as much or as little of Foxy's functionality as desired. */
35
+ /** JS SDK for building backends with [Foxy Hypermedia API](https://api.foxy.io/docs). Hypermedia API is designed to give you complete control over all aspects of your Foxy accounts, whether working with a single store or automating the provisioning of thousands. Anything you can do within the Foxy administration, you can also do through the API. This means that you can embed Foxy into any application (CMS, LMS, CRM, etc.) and expose as much or as little of Foxy's functionality as desired. */
36
36
  export declare class API extends Core.API<Graph> {
37
37
  static readonly REFRESH_THRESHOLD: number;
38
38
  static readonly ACCESS_TOKEN = "access_token";
@@ -44,7 +44,7 @@ export declare class API extends Core.API<Graph> {
44
44
  };
45
45
  /**
46
46
  * Fetches a new access token in exchange for an authorization code
47
- * or a refresh token. See more in our [authentication docs](https://api.foxycart.com/docs/authentication).
47
+ * or a refresh token. See more in our [authentication docs](https://api.foxy.io/docs/authentication).
48
48
  *
49
49
  * @param opts Request options.
50
50
  * @param throwOnFailure If true, this method will throw an error instead of returning null on failure to obtain a token.
@@ -24,8 +24,8 @@ export interface AppliedCouponCode extends Graph {
24
24
  /** The coupon code applied to this cart. */
25
25
  code: string;
26
26
  /** The date this resource was created. */
27
- date_created: string;
27
+ date_created: string | null;
28
28
  /** The date this resource was last modified. */
29
- date_modified: string;
29
+ date_modified: string | null;
30
30
  };
31
31
  }
@@ -33,8 +33,8 @@ export interface AppliedTax extends Graph {
33
33
  /** If this tax only applied to a specific shipto shipment, the shipto address name will be listed here. */
34
34
  shipto: string;
35
35
  /** The date this resource was created. */
36
- date_created: string;
36
+ date_created: string | null;
37
37
  /** The date this resource was last modified. */
38
- date_modified: string;
38
+ date_modified: string | null;
39
39
  };
40
40
  }
@@ -16,8 +16,8 @@ export interface Attribute extends Graph {
16
16
  /** The value of this attribute. */
17
17
  value: string;
18
18
  /** The date this resource was created. */
19
- date_created: string;
19
+ date_created: string | null;
20
20
  /** The date this resource was last modified. */
21
- date_modified: string;
21
+ date_modified: string | null;
22
22
  };
23
23
  }
@@ -51,8 +51,8 @@ export interface BillingAddress extends Graph {
51
51
  /** Specifies if this address is the default shipping address for the customer. */
52
52
  is_default_shipping: boolean;
53
53
  /** The date this resource was created. */
54
- date_created: string;
54
+ date_created: string | null;
55
55
  /** The date this resource was last modified. */
56
- date_modified: string;
56
+ date_modified: string | null;
57
57
  };
58
58
  }
@@ -124,9 +124,9 @@ export interface Cart extends Graph {
124
124
  /** Total order amount of this cart including all items, taxes, shipping costs and discounts. */
125
125
  total_order: string;
126
126
  /** The date this resource was created. */
127
- date_created: string;
127
+ date_created: string | null;
128
128
  /** The date this resource was last modified. */
129
- date_modified: string;
129
+ date_modified: string | null;
130
130
  };
131
131
 
132
132
  zooms: {
@@ -25,8 +25,8 @@ export interface CartIncludeTemplate extends Graph {
25
25
  /** The URL of your cart include template hosted on your own server online and publicly available for our server to cache. */
26
26
  content_url: string;
27
27
  /** The date this resource was created. */
28
- date_created: string;
28
+ date_created: string | null;
29
29
  /** The date this resource was last modified. */
30
- date_modified: string;
30
+ date_modified: string | null;
31
31
  };
32
32
  }
@@ -25,8 +25,8 @@ export interface CartTemplate extends Graph {
25
25
  /** The URL of your cart template hosted on your own server online and publicly available for our server to cache. */
26
26
  content_url: string;
27
27
  /** The date this resource was created. */
28
- date_created: string;
28
+ date_created: string | null;
29
29
  /** The date this resource was last modified. */
30
- date_modified: string;
30
+ date_modified: string | null;
31
31
  };
32
32
  }
@@ -28,8 +28,8 @@ export interface CheckoutTemplate extends Graph {
28
28
  /** The URL of your checkout template hosted on your own server online and publicly available for our server to cache. */
29
29
  content_url: string;
30
30
  /** The date this resource was created. */
31
- date_created: string;
31
+ date_created: string | null;
32
32
  /** The date this resource was last modified. */
33
- date_modified: string;
33
+ date_modified: string | null;
34
34
  };
35
35
  }
@@ -35,8 +35,8 @@ export interface Client extends Graph {
35
35
  /** The phone number of the individual responsible for this integration. */
36
36
  contact_phone: string;
37
37
  /** The date this resource was created. */
38
- date_created: string;
38
+ date_created: string | null;
39
39
  /** The date this resource was last modified. */
40
- date_modified: string;
40
+ date_modified: string | null;
41
41
  };
42
42
  }
@@ -24,9 +24,9 @@ export interface Coupon extends Graph {
24
24
  /** The name of this coupon. This will be for your own use and displayed to the customer. */
25
25
  name: string;
26
26
  /** If you want this coupon's usage to be limited by a time frame or start in the future, add a start date here. To clear it out, set an empty value or use 0000-00-00. */
27
- start_date: string;
27
+ start_date: string | null;
28
28
  /** If you want this coupon's usage to be limited by a time frame or end in the future, add an end date here. To clear it out, set an empty value or use 0000-00-00. */
29
- end_date: string;
29
+ end_date: string | null;
30
30
  /** This is the total number of times this coupon is allowed to be used. This can be helpful for promotions that involve offering a discount to the first 100 customers, as an example, even though more than 100 coupon codes were given out. Leave as 0 to ignore this feature. */
31
31
  number_of_uses_allowed: number;
32
32
  /** For informational purposes, this shows you how many times this coupon has already been used. */
@@ -52,9 +52,9 @@ export interface Coupon extends Graph {
52
52
  /** Set to true to apply taxes before this coupon's discount is applied. Check with your tax professional if you have questions about how you should calculate taxes. */
53
53
  is_taxable: boolean;
54
54
  /** The date this resource was created. */
55
- date_created: string;
55
+ date_created: string | null;
56
56
  /** The date this resource was last modified. */
57
- date_modified: string;
57
+ date_modified: string | null;
58
58
  };
59
59
 
60
60
  zooms: {
@@ -23,8 +23,8 @@ export interface CouponCode extends Graph {
23
23
  /** For informational purposes, this shows you how many times this coupon code has already been used. */
24
24
  number_of_uses_to_date: number;
25
25
  /** The date this resource was created. */
26
- date_created: string;
26
+ date_created: string | null;
27
27
  /** The date this resource was last modified. */
28
- date_modified: string;
28
+ date_modified: string | null;
29
29
  };
30
30
  }
@@ -22,8 +22,8 @@ export interface CouponCodeTransaction extends Graph {
22
22
 
23
23
  props: {
24
24
  /** The date this resource was created. */
25
- date_created: string;
25
+ date_created: string | null;
26
26
  /** The date this resource was last modified. */
27
- date_modified: string;
27
+ date_modified: string | null;
28
28
  };
29
29
  }
@@ -8,3 +8,12 @@ export interface CouponCodes extends Graph {
8
8
  props: CollectionGraphProps;
9
9
  child: CouponCode;
10
10
  }
11
+
12
+ export interface CouponCodesImport extends Graph {
13
+ curie: 'fx:coupon_codes';
14
+
15
+ props: {
16
+ /** List of codes to import. */
17
+ coupon_codes: string[];
18
+ };
19
+ }
@@ -33,8 +33,8 @@ export interface CouponDetail extends Graph {
33
33
  /** The amount of discount applied to this item. */
34
34
  amount_per: number;
35
35
  /** The date this resource was created. */
36
- date_created: string;
36
+ date_created: string | null;
37
37
  /** The date this resource was last modified. */
38
- date_modified: string;
38
+ date_modified: string | null;
39
39
  };
40
40
  }
@@ -23,8 +23,8 @@ export interface CouponItemCategory extends Graph {
23
23
  /** The full API URI of the item category associated with this coupon item category. */
24
24
  item_category_uri: string;
25
25
  /** The date this resource was created. */
26
- date_created: string;
26
+ date_created: string | null;
27
27
  /** The date this resource was last modified. */
28
- date_modified: string;
28
+ date_modified: string | null;
29
29
  };
30
30
  }
@@ -22,8 +22,8 @@ export interface CustomField extends Graph {
22
22
  /** Whether or not this custom field is visible on the receipt and email receipt. This correlates to custom fields with a "h:" prefix when added to the cart. */
23
23
  is_hidden: boolean;
24
24
  /** The date this resource was created. */
25
- date_created: string;
25
+ date_created: string | null;
26
26
  /** The date this resource was last modified. */
27
- date_modified: string;
27
+ date_modified: string | null;
28
28
  };
29
29
  }
@@ -62,9 +62,9 @@ export interface Customer extends Graph {
62
62
  /** If this customer checks out as a guest, this will be set to true. Once it is set, it can not be changed. */
63
63
  is_anonymous: boolean;
64
64
  /** The date this resource was created. */
65
- date_created: string;
65
+ date_created: string | null;
66
66
  /** The date this resource was last modified. */
67
- date_modified: string;
67
+ date_modified: string | null;
68
68
  };
69
69
 
70
70
  zooms: {
@@ -40,12 +40,12 @@ export interface CustomerAddress extends Graph {
40
40
  /** The phone of this address. */
41
41
  phone: string;
42
42
  /** Specifies if this address is the default billing address for the customer. */
43
- is_default_billing: string;
43
+ is_default_billing: boolean;
44
44
  /** Specifies if this address is the default shipping address for the customer. */
45
- is_default_shipping: string;
45
+ is_default_shipping: boolean;
46
46
  /** The date this resource was created. */
47
- date_created: string;
47
+ date_created: string | null;
48
48
  /** The date this resource was last modified. */
49
- date_modified: string;
49
+ date_modified: string | null;
50
50
  };
51
51
  }
@@ -59,9 +59,9 @@ export interface CustomerPortalSettings extends Graph {
59
59
  /** Life span of session in minutes. Maximum 40320 (4 weeks). */
60
60
  sessionLifespanInMinutes: number;
61
61
  /** The date this resource was created. */
62
- date_created: string;
62
+ date_created: string | null;
63
63
  /** The date this resource was last modified. */
64
- date_modified: string;
64
+ date_modified: string | null;
65
65
  } & (
66
66
  | {
67
67
  /** Shared secret key. */
@@ -18,18 +18,18 @@ export interface DefaultPaymentMethod extends Graph {
18
18
  /** If the customer selected to save their payment information, this will be true. To clear out the payment information, set this to false. */
19
19
  save_cc: boolean;
20
20
  /** The credit card or debit card type. This will be determined automatically once the payment card is saved. */
21
- cc_type: string;
21
+ cc_type: string | null;
22
22
  /** The payment card number. This property will not be displayed as part of this resource, but can be used to modify this payment method. */
23
- cc_number: number;
23
+ cc_number?: number;
24
24
  /** A masked version of this payment card showing only the last 4 digits. */
25
- cc_number_masked: string;
25
+ cc_number_masked: string | null;
26
26
  /** The payment card expiration month in the MM format. */
27
- cc_exp_month: string;
27
+ cc_exp_month: string | null;
28
28
  /** The payment card expiration year in the YYYY format. */
29
- cc_exp_year: string;
29
+ cc_exp_year: string | null;
30
30
  /** The date this resource was created. */
31
- date_created: string;
31
+ date_created: string | null;
32
32
  /** The date this resource was last modified. */
33
- date_modified: string;
33
+ date_modified: string | null;
34
34
  };
35
35
  }
@@ -37,8 +37,8 @@ export interface Discount extends Graph {
37
37
  /** Whether or not this discount is part of a subscription that is to be charged in the future based on when this transaction was processed. */
38
38
  is_future_discount: boolean;
39
39
  /** The date this resource was created. */
40
- date_created: string;
40
+ date_created: string | null;
41
41
  /** The date this resource was last modified. */
42
- date_modified: string;
42
+ date_modified: string | null;
43
43
  };
44
44
  }
@@ -25,8 +25,8 @@ export interface DiscountDetail extends Graph {
25
25
  /** The amount of discount applied to this item. */
26
26
  amount_per: number;
27
27
  /** The date this resource was created. */
28
- date_created: string;
28
+ date_created: string | null;
29
29
  /** The date this resource was last modified. */
30
- date_modified: string;
30
+ date_modified: string | null;
31
31
  };
32
32
  }
@@ -33,8 +33,8 @@ export interface Downloadable extends Graph {
33
33
  /** The date this file was last uploaded. */
34
34
  upload_date: string;
35
35
  /** The date this resource was created. */
36
- date_created: string;
36
+ date_created: string | null;
37
37
  /** The date this resource was last modified. */
38
- date_modified: string;
38
+ date_modified: string | null;
39
39
  };
40
40
  }
@@ -31,8 +31,8 @@ export interface DownloadablePurchase extends Graph {
31
31
  /** This is the passcode for downloading this item after a purchase. To construct the download link, use `https://{store_domain}.foxycart.com/dl?p={download_passcode}` */
32
32
  download_passcode: string;
33
33
  /** The date this resource was created. */
34
- date_created: string;
34
+ date_created: string | null;
35
35
  /** The date this resource was last modified. */
36
- date_modified: string;
36
+ date_modified: string | null;
37
37
  };
38
38
  }
@@ -31,8 +31,8 @@ export interface EmailTemplate extends Graph {
31
31
  /** The URL of your text email template hosted on your own server online and publicly available for our server to cache. */
32
32
  content_text_url: string;
33
33
  /** The date this resource was created. */
34
- date_created: string;
34
+ date_created: string | null;
35
35
  /** The date this resource was last modified. */
36
- date_modified: string;
36
+ date_modified: string | null;
37
37
  };
38
38
  }
@@ -31,8 +31,8 @@ export interface ErrorEntry extends Graph {
31
31
  /** Set this to false to hide this error entry from the Foxy administrative interface. This may be a helpful way to manage and acknowledge errors for your store. */
32
32
  hide_error: boolean;
33
33
  /** The date this resource was created. */
34
- date_created: string;
34
+ date_created: string | null;
35
35
  /** The date this resource was last modified. */
36
- date_modified: string;
36
+ date_modified: string | null;
37
37
  };
38
38
  }
@@ -24,8 +24,8 @@ export interface FraudProtection extends Graph {
24
24
  /** The score threshold used for minfraud. This should be set between 0 and 100. 0 will disable minFraud and 100 will turn it on for logging but still allow all transactions to go through. */
25
25
  score_threshold_reject: number;
26
26
  /** The date this resource was created. */
27
- date_created: string;
27
+ date_created: string | null;
28
28
  /** The date this resource was last modified. */
29
- date_modified: string;
29
+ date_modified: string | null;
30
30
  };
31
31
  }
@@ -10,5 +10,7 @@ export interface GenerateCodes extends Graph {
10
10
  number_of_codes: number;
11
11
  /** Optional number of coupon code variations you would like to generate. For example, if you would like all the coupon code variations to have a "summer_special" prefix, set that here. */
12
12
  prefix: string;
13
+ /** Optional initial balance (gift cards only). Defaults to 0. */
14
+ current_balance?: number;
13
15
  };
14
16
  }