@foxy.io/sdk 1.6.0 → 1.8.0

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 (95) hide show
  1. package/README.md +4 -4
  2. package/dist/cdn/FoxySDKCustomer.js +1 -1
  3. package/dist/cjs/backend/API.js +2 -2
  4. package/dist/cjs/backend/createSSOURL.js +1 -1
  5. package/dist/cjs/core/API/Node.js +11 -11
  6. package/dist/cjs/core/Rumour/Rumour.js +4 -1
  7. package/dist/esm/backend/API.js +2 -2
  8. package/dist/esm/backend/createSSOURL.js +1 -1
  9. package/dist/esm/core/API/Node.js +11 -11
  10. package/dist/esm/core/Rumour/Rumour.js +4 -1
  11. package/dist/types/backend/API.d.ts +2 -2
  12. package/dist/types/backend/Graph/applied_coupon_code.d.ts +2 -2
  13. package/dist/types/backend/Graph/applied_tax.d.ts +2 -2
  14. package/dist/types/backend/Graph/attribute.d.ts +2 -2
  15. package/dist/types/backend/Graph/billing_address.d.ts +2 -2
  16. package/dist/types/backend/Graph/cart.d.ts +2 -2
  17. package/dist/types/backend/Graph/cart_include_template.d.ts +2 -2
  18. package/dist/types/backend/Graph/cart_template.d.ts +2 -2
  19. package/dist/types/backend/Graph/checkout_template.d.ts +2 -2
  20. package/dist/types/backend/Graph/client.d.ts +2 -2
  21. package/dist/types/backend/Graph/coupon.d.ts +4 -4
  22. package/dist/types/backend/Graph/coupon_code.d.ts +2 -2
  23. package/dist/types/backend/Graph/coupon_code_transaction.d.ts +2 -2
  24. package/dist/types/backend/Graph/coupon_detail.d.ts +2 -2
  25. package/dist/types/backend/Graph/coupon_item_category.d.ts +2 -2
  26. package/dist/types/backend/Graph/custom_field.d.ts +2 -2
  27. package/dist/types/backend/Graph/customer.d.ts +2 -2
  28. package/dist/types/backend/Graph/customer_address.d.ts +4 -4
  29. package/dist/types/backend/Graph/customer_portal_settings.d.ts +2 -2
  30. package/dist/types/backend/Graph/default_payment_method.d.ts +2 -2
  31. package/dist/types/backend/Graph/discount.d.ts +2 -2
  32. package/dist/types/backend/Graph/discount_detail.d.ts +2 -2
  33. package/dist/types/backend/Graph/downloadable.d.ts +2 -2
  34. package/dist/types/backend/Graph/downloadable_purchase.d.ts +2 -2
  35. package/dist/types/backend/Graph/email_template.d.ts +2 -2
  36. package/dist/types/backend/Graph/error_entry.d.ts +2 -2
  37. package/dist/types/backend/Graph/fraud_protection.d.ts +2 -2
  38. package/dist/types/backend/Graph/gift_card.d.ts +42 -0
  39. package/dist/types/backend/Graph/gift_card_code.d.ts +35 -0
  40. package/dist/types/backend/Graph/gift_card_code_logs.d.ts +10 -0
  41. package/dist/types/backend/Graph/gift_card_codes.d.ts +10 -0
  42. package/dist/types/backend/Graph/gift_card_item_categories.d.ts +10 -0
  43. package/dist/types/backend/Graph/gift_card_item_category.d.ts +30 -0
  44. package/dist/types/backend/Graph/gift_cards.d.ts +10 -0
  45. package/dist/types/backend/Graph/hosted_payment_gateways_helper.d.ts +56 -0
  46. package/dist/types/backend/Graph/integration.d.ts +10 -10
  47. package/dist/types/backend/Graph/item.d.ts +2 -2
  48. package/dist/types/backend/Graph/item_category.d.ts +2 -2
  49. package/dist/types/backend/Graph/item_option.d.ts +2 -2
  50. package/dist/types/backend/Graph/language_override.d.ts +2 -2
  51. package/dist/types/backend/Graph/language_strings.d.ts +1 -5
  52. package/dist/types/backend/Graph/native_integration.d.ts +2 -2
  53. package/dist/types/backend/Graph/payment.d.ts +2 -2
  54. package/dist/types/backend/Graph/payment_gateway.d.ts +2 -2
  55. package/dist/types/backend/Graph/payment_gateways_helper.d.ts +56 -0
  56. package/dist/types/backend/Graph/payment_method_expiring.d.ts +2 -2
  57. package/dist/types/backend/Graph/payment_method_set.d.ts +2 -2
  58. package/dist/types/backend/Graph/payment_method_set_fraud_protection.d.ts +2 -2
  59. package/dist/types/backend/Graph/payment_method_set_hosted_payment_gateway.d.ts +2 -2
  60. package/dist/types/backend/Graph/property_helpers.d.ts +4 -4
  61. package/dist/types/backend/Graph/receipt_template.d.ts +2 -2
  62. package/dist/types/backend/Graph/regions.d.ts +0 -2
  63. package/dist/types/backend/Graph/shipment.d.ts +2 -2
  64. package/dist/types/backend/Graph/shipping_container.d.ts +2 -2
  65. package/dist/types/backend/Graph/shipping_drop_type.d.ts +2 -2
  66. package/dist/types/backend/Graph/shipping_method.d.ts +2 -2
  67. package/dist/types/backend/Graph/shipping_service.d.ts +2 -2
  68. package/dist/types/backend/Graph/store.d.ts +5 -2
  69. package/dist/types/backend/Graph/store_shipping_method.d.ts +2 -2
  70. package/dist/types/backend/Graph/store_shipping_service.d.ts +2 -2
  71. package/dist/types/backend/Graph/store_version.d.ts +21 -3
  72. package/dist/types/backend/Graph/subscription.d.ts +2 -2
  73. package/dist/types/backend/Graph/subscription_settings.d.ts +2 -2
  74. package/dist/types/backend/Graph/tax.d.ts +2 -2
  75. package/dist/types/backend/Graph/tax_item_category.d.ts +2 -2
  76. package/dist/types/backend/Graph/template_config.d.ts +2 -2
  77. package/dist/types/backend/Graph/template_set.d.ts +2 -2
  78. package/dist/types/backend/Graph/transaction.d.ts +2 -2
  79. package/dist/types/backend/Graph/transaction_log.d.ts +1 -1
  80. package/dist/types/backend/Graph/user.d.ts +2 -2
  81. package/dist/types/backend/Graph/user_access.d.ts +2 -2
  82. package/dist/types/backend/Rels.d.ts +9 -0
  83. package/dist/types/backend/createSSOURL.d.ts +5 -3
  84. package/dist/types/core/Resource/Link.d.ts +1 -1
  85. package/dist/types/core/Rumour/Rumour.d.ts +1 -0
  86. package/dist/types/customer/Graph/attribute.d.ts +2 -2
  87. package/dist/types/customer/Graph/customer_address.d.ts +4 -4
  88. package/dist/types/customer/Graph/customer_portal_settings.d.ts +2 -2
  89. package/dist/types/customer/Graph/default_payment_method.d.ts +2 -2
  90. package/dist/types/customer/Graph/index.d.ts +2 -2
  91. package/dist/types/customer/Graph/item.d.ts +2 -2
  92. package/dist/types/customer/Graph/subscription.d.ts +2 -2
  93. package/dist/types/customer/Graph/transaction.d.ts +2 -2
  94. package/dist/types/customer/Graph/transaction_template.d.ts +2 -2
  95. 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);
@@ -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
  }
@@ -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);
@@ -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
  }
@@ -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;
@@ -31,7 +31,7 @@ declare type Token = {
31
31
  token_type: string;
32
32
  scope: string;
33
33
  };
34
- /** 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. */
34
+ /** 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. */
35
35
  export declare class API extends Core.API<Graph> {
36
36
  static readonly REFRESH_THRESHOLD: number;
37
37
  static readonly ACCESS_TOKEN = "access_token";
@@ -43,7 +43,7 @@ export declare class API extends Core.API<Graph> {
43
43
  };
44
44
  /**
45
45
  * Fetches a new access token in exchange for an authorization code
46
- * or a refresh token. See more in our [authentication docs](https://api.foxycart.com/docs/authentication).
46
+ * or a refresh token. See more in our [authentication docs](https://api.foxy.io/docs/authentication).
47
47
  *
48
48
  * @param opts Request options.
49
49
  * @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
  }
@@ -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. */
@@ -28,8 +28,8 @@ export interface DefaultPaymentMethod extends Graph {
28
28
  /** The payment card expiration year in the YYYY format. */
29
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
  }
@@ -29,8 +29,8 @@ export interface EmailTemplate extends Graph {
29
29
  /** The URL of your text email template hosted on your own server online and publicly available for our server to cache. */
30
30
  content_text_url: string;
31
31
  /** The date this resource was created. */
32
- date_created: string;
32
+ date_created: string | null;
33
33
  /** The date this resource was last modified. */
34
- date_modified: string;
34
+ date_modified: string | null;
35
35
  };
36
36
  }
@@ -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
  }
@@ -0,0 +1,42 @@
1
+ import type { GenerateCodes } from './generate_codes';
2
+ import type { GiftCardCodes } from './gift_card_codes';
3
+ import type { GiftCardItemCategories } from './gift_card_item_categories';
4
+ import type { Graph } from '../../core';
5
+ import type { Store } from './store';
6
+
7
+ export interface GiftCard extends Graph {
8
+ curie: 'fx:gift_card';
9
+
10
+ links: {
11
+ /** This resource. */
12
+ 'self': GiftCard;
13
+ /** Store this gift card is assigned to. */
14
+ 'fx:store': Store;
15
+ /** POST here to generate random gift card codes. */
16
+ 'fx:generate_codes': GenerateCodes;
17
+ /** Collection of codes for this gift card. */
18
+ 'fx:gift_card_codes': GiftCardCodes;
19
+ /** Collection of item category to gift card mappings for this card. */
20
+ 'fx:gift_card_item_categories': GiftCardItemCategories;
21
+ };
22
+
23
+ props: {
24
+ /** The name of this gift card. This will be displayed to the customer, such as "Gift Card" or "Store Credit". Required. 50 characters or less. */
25
+ name: string;
26
+ /** Currency code for this gift card. Note that gift cards are only usable if the cart's currency matches. Optional. The 3 character ISO code for the currency. */
27
+ currency_code: string;
28
+ /** This determines when the gift card will expire. The format is a number followed by a date type such as `d` (day), `w` (week), `m` (month), or `y` (year). You can also use `.5m` for twice a month, as with subscription frequency settings. Check with your local laws to ensure expiring gift cards is legal, according to your use case. The actual expiration date will be set on the `gift_card_code` resources when they are created, according to this setting. Optional. If present, the format must be valid, such as `1m`, `3w`, `45d`, etc. */
29
+ expires_after: string | null;
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
+ product_code_restrictions: string | null;
32
+ /** The date this resource was created. ISO date. Read only. */
33
+ date_created: string | null;
34
+ /** The date this resource was last modified. ISO date. Read only. */
35
+ date_modified: string | null;
36
+ };
37
+
38
+ zooms: {
39
+ gift_card_codes?: GiftCardCodes;
40
+ gift_card_item_categories?: GiftCardItemCategories;
41
+ };
42
+ }
@@ -0,0 +1,35 @@
1
+ import type { Customer } from './customer';
2
+ import type { GiftCard } from './gift_card';
3
+ import type { GiftCardCodeLogs } from './gift_card_code_logs';
4
+ import type { Graph } from '../../core';
5
+ import type { Store } from './store';
6
+
7
+ export interface GiftCardCode extends Graph {
8
+ curie: 'fx:gift_card_code';
9
+
10
+ links: {
11
+ /** This resource. */
12
+ 'self': GiftCardCode;
13
+ /** Store this gift card code belongs to. */
14
+ 'fx:store': Store;
15
+ /** Customer this gift card belongs to. */
16
+ 'fx:customer': Customer;
17
+ /** Gift card this code corresponds to. */
18
+ 'fx:gift_card': GiftCard;
19
+ /** Transactions using this gift card code. */
20
+ 'fx:gift_card_code_logs': GiftCardCodeLogs;
21
+ };
22
+
23
+ props: {
24
+ /** The string value of this gift card code which your customer will add to their cart to use this gift card. Required. 50 characters or less. */
25
+ code: string;
26
+ /** The date when this gift card code will expire. ISO date. Optional. */
27
+ end_date: string | null;
28
+ /** Current balance on the gift card. Decimal. Required. */
29
+ current_balance: number;
30
+ /** The date this resource was created. Readonly. */
31
+ date_created: string | null;
32
+ /** The date this resource was last modified. Readonly. */
33
+ date_modified: string | null;
34
+ };
35
+ }
@@ -0,0 +1,10 @@
1
+ import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
2
+ import type { Graph } from '../../core';
3
+ import type { Transaction } from './transaction';
4
+
5
+ export interface GiftCardCodeLogs extends Graph {
6
+ curie: 'fx:gift_card_code_logs';
7
+ links: CollectionGraphLinks<GiftCardCodeLogs>;
8
+ props: CollectionGraphProps;
9
+ child: Transaction;
10
+ }
@@ -0,0 +1,10 @@
1
+ import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
2
+ import type { GiftCardCode } from './gift_card_code';
3
+ import type { Graph } from '../../core';
4
+
5
+ export interface GiftCardCodes extends Graph {
6
+ curie: 'fx:gift_card_codes';
7
+ links: CollectionGraphLinks<GiftCardCodes>;
8
+ props: CollectionGraphProps;
9
+ child: GiftCardCode;
10
+ }