@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
@@ -59,9 +59,9 @@ export interface StoreShippingMethod extends Graph {
59
59
  /** For the `CUSTOM-CODE` shipping method. Values are `deploying`, `deployed`, and `error`. */
60
60
  deployment_status: 'deploying' | 'deployed' | 'error';
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
  zooms: {
@@ -29,8 +29,8 @@ export interface StoreShippingService extends Graph {
29
29
  /** The full API URI of the shipping method shipping service defined in our property helpers. Each shipping method will have it's own shipping services. */
30
30
  shipping_service_uri: 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
  }
@@ -24,7 +24,25 @@ export interface StoreVersion extends Graph {
24
24
  /** Full content of the changelog as HTML */
25
25
  changelog_content: string;
26
26
  /** A JSON object for various cart types supported by this version. Examples include colorbox with links to the JavaScript library, FoxyCart JavaScript files, and FoxyCart CSS files. */
27
- cart_types: string;
27
+ cart_types: {
28
+ [key: string]: {
29
+ /** Links to FoxyCart CSS files. */
30
+ css: string[];
31
+ /** Links to FoxyCart JS files. */
32
+ javascript: string[];
33
+ /** JS library needed for FoxyCart JS files to work. If none is needed, this will be an empty array. */
34
+ javascript_library:
35
+ | []
36
+ | {
37
+ /** Name of the JS library. */
38
+ name: string;
39
+ /** Version of the JS library. */
40
+ version: string;
41
+ /** URL of the JS library hosted on a CDN. */
42
+ url: string;
43
+ };
44
+ };
45
+ };
28
46
  /** The date this version was publicly released. */
29
47
  version_date: string;
30
48
  /** If this version is currently visible in the FoxyCart admin. At times, FoxyCart may launch a private beta of the latest version. */
@@ -32,8 +50,8 @@ export interface StoreVersion extends Graph {
32
50
  /** If this version is currently considered a beta release. */
33
51
  is_beta: boolean;
34
52
  /** The date this resource was created. */
35
- date_created: string;
53
+ date_created: string | null;
36
54
  /** The date this resource was last modified. */
37
- date_modified: string;
55
+ date_modified: string | null;
38
56
  };
39
57
  }
@@ -50,9 +50,9 @@ export interface Subscription extends Graph {
50
50
  /** If this subscription is using a third party subscription system such as PayPal Express, their identifier will be set here. */
51
51
  third_party_id: string;
52
52
  /** The date this resource was created. */
53
- date_created: string;
53
+ date_created: string | null;
54
54
  /** The date this resource was last modified. */
55
- date_modified: string;
55
+ date_modified: string | null;
56
56
  };
57
57
 
58
58
  zooms: {
@@ -35,8 +35,8 @@ export interface SubscriptionSettings extends Graph {
35
35
  /** When subscriptions run automatically to bill your customers, turning this setting off will prevent the normal receipt emails from being sent for their automated payment. The default value is true. */
36
36
  send_email_receipts_for_automated_billing: boolean;
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
  }
@@ -41,8 +41,8 @@ export interface Tax extends Graph {
41
41
  /** The tax rate to be applied for this tax. For 10%, use 10. */
42
42
  rate: number;
43
43
  /** The date this resource was created. */
44
- date_created: string;
44
+ date_created: string | null;
45
45
  /** The date this resource was last modified. */
46
- date_modified: string;
46
+ date_modified: string | null;
47
47
  };
48
48
  }
@@ -23,8 +23,8 @@ export interface TaxItemCategory extends Graph {
23
23
  /** A full API URI of the tax resource used in this relationship. When working with hypermedia, it's important to save URIs and not just numeric ids. */
24
24
  store_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
  }
@@ -20,8 +20,8 @@ export interface TemplateConfig extends Graph {
20
20
  /** This is the template configuration settings for your store. */
21
21
  json: string;
22
22
  /** The date this resource was created. */
23
- date_created: string;
23
+ date_created: string | null;
24
24
  /** The date this resource was last modified. */
25
- date_modified: string;
25
+ date_modified: string | null;
26
26
  };
27
27
  }
@@ -53,9 +53,9 @@ export interface TemplateSet extends Graph {
53
53
  /** This is the template configuration settings for your store. */
54
54
  config: string;
55
55
  /** The date this resource was created. */
56
- date_created: string;
56
+ date_created: string | null;
57
57
  /** The date this resource was last modified. */
58
- date_modified: string;
58
+ date_modified: string | null;
59
59
  };
60
60
 
61
61
  zooms: {
@@ -106,9 +106,9 @@ export interface Transaction extends Graph {
106
106
  /** The currency symbol, such as $, £, €, etc. */
107
107
  currency_symbol: string;
108
108
  /** The date this resource was created. */
109
- date_created: string;
109
+ date_created: string | null;
110
110
  /** The date this resource was last modified. */
111
- date_modified: string;
111
+ date_modified: string | null;
112
112
  };
113
113
 
114
114
  zooms: {
@@ -29,6 +29,6 @@ export interface TransactionLog extends Graph {
29
29
  /** Describes the source transaction modification such as admin or hAPI. */
30
30
  request_source: string;
31
31
  /** The date this resource was created. */
32
- date_created: string;
32
+ date_created: string | null;
33
33
  };
34
34
  }
@@ -37,8 +37,8 @@ export interface User extends Graph {
37
37
  /** If this user is a a merchant or store admin involved in the item and money side of the e-commerce business. */
38
38
  is_merchant: 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
  }
@@ -22,8 +22,8 @@ export interface UserAccess extends Graph {
22
22
  /** Set this to true to make this store the default store for this user. That means it will be the first store they see when the log in to the FoxyCart admin. */
23
23
  is_default_store: 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
  }
@@ -63,8 +63,16 @@ export * from './Graph/error_entry';
63
63
  export * from './Graph/fraud_protection';
64
64
  export * from './Graph/fraud_protections';
65
65
  export * from './Graph/generate_codes';
66
+ export * from './Graph/gift_card_code_logs';
67
+ export * from './Graph/gift_card_code';
68
+ export * from './Graph/gift_card_codes';
69
+ export * from './Graph/gift_card_item_categories';
70
+ export * from './Graph/gift_card_item_category';
71
+ export * from './Graph/gift_card';
72
+ export * from './Graph/gift_cards';
66
73
  export * from './Graph/hosted_payment_gateway';
67
74
  export * from './Graph/hosted_payment_gateways';
75
+ export * from './Graph/hosted_payment_gateways_helper';
68
76
  export * from './Graph/integration';
69
77
  export * from './Graph/item';
70
78
  export * from './Graph/item_categories';
@@ -84,6 +92,7 @@ export * from './Graph/original_transaction';
84
92
  export * from './Graph/payment';
85
93
  export * from './Graph/payment_gateway';
86
94
  export * from './Graph/payment_gateways';
95
+ export * from './Graph/payment_gateways_helper';
87
96
  export * from './Graph/payment_method_expiring';
88
97
  export * from './Graph/payment_method_set';
89
98
  export * from './Graph/payment_method_set_fraud_protection';
@@ -1,11 +1,13 @@
1
1
  interface Options {
2
2
  /**
3
- * Integer, epoch time. The future time that this authentication token will expire.
3
+ * Integer, epoch time (seconds). The future time that this authentication token will expire.
4
4
  * If a customer makes a checkout request with an expired authentication token, then FoxyCart
5
5
  * will redirect them to the endpoint in order to generate a new token. You can make use of the
6
6
  * timestamp value you received to your endpoint in the GET parameters, and add additional time
7
7
  * to it for how long you want it to be valid for. For example, adding 3600 to the timestamp will
8
- * extend it by 3600 seconds, or 30 minutes.
8
+ * extend it by 3600 seconds, or 60 minutes.
9
+ *
10
+ * Defaults to an hour from now.
9
11
  *
10
12
  * @see https://docs.foxycart.com/v/2.0/sso#the_details
11
13
  */
@@ -37,7 +39,7 @@ interface Options {
37
39
  * that usually looks like this: `https://yourdomain.foxycart.com`.
38
40
  *
39
41
  * @see https://docs.foxycart.com/v/2.0/sso#the_details
40
- * @see https://api.foxycart.com/rels/store
42
+ * @see https://api.foxy.io/rels/store
41
43
  */
42
44
  domain: string;
43
45
  }
@@ -28,6 +28,7 @@ export type Context<TData extends Data = Data, TError = unknown, TFailure = unkn
28
28
  */
29
29
  export type Event<TData extends Data = Data> =
30
30
  | { type: 'SET_DATA'; data: TData | null }
31
+ | { type: 'REFRESH' }
31
32
  | { type: 'EDIT'; data: Partial<TData> }
32
33
  | { type: 'UNDO' }
33
34
  | { type: 'FETCH' }
@@ -51,7 +52,7 @@ export type State<TData extends Data = Data, TError = unknown, TFailure = unknow
51
52
  }
52
53
  | {
53
54
  value: { busy: 'fetching' };
54
- context: Context<TData, TError> & { data: null; edits: null; failure: null };
55
+ context: Context<TData, TError> & { failure: null };
55
56
  }
56
57
  | {
57
58
  value: { busy: 'creating' };
@@ -1,6 +1,6 @@
1
1
  /** Represents a hAPI relation link. */
2
2
  export type Link = {
3
- /** True if this is a template link (example: `https://api.foxycart.com/rels/{rel}`) */
3
+ /** True if this is a template link (example: `https://api.foxy.io/rels/{rel}`) */
4
4
  templated?: boolean;
5
5
  /** Short description of this link. */
6
6
  title?: string;
@@ -78,6 +78,7 @@ export declare class Rumour {
78
78
  track(callback: TrackCallback): CeaseCallback;
79
79
  /** Removes all update listeners. */
80
80
  cease(): void;
81
+ private static __isCollection;
81
82
  private static __isResource;
82
83
  private static __approximateURI;
83
84
  private static __createPatch;
@@ -19,8 +19,8 @@ export interface Attribute extends Graph {
19
19
  /** The value of this attribute. */
20
20
  value: string;
21
21
  /** The date this resource was created. */
22
- date_created: string;
22
+ date_created: string | null;
23
23
  /** The date this resource was last modified. */
24
- date_modified: string;
24
+ date_modified: string | null;
25
25
  };
26
26
  }
@@ -35,12 +35,12 @@ export interface CustomerAddress extends Graph {
35
35
  /** The phone of this address. */
36
36
  phone: string;
37
37
  /** Specifies if this address is the default billing address for the customer. */
38
- is_default_billing: string;
38
+ is_default_billing: boolean;
39
39
  /** Specifies if this address is the default shipping address for the customer. */
40
- is_default_shipping: string;
40
+ is_default_shipping: boolean;
41
41
  /** The date this resource was created. */
42
- date_created: string;
42
+ date_created: string | null;
43
43
  /** The date this resource was last modified. */
44
- date_modified: string;
44
+ date_modified: string | null;
45
45
  };
46
46
  }
@@ -54,8 +54,8 @@ export interface CustomerPortalSettings extends Graph {
54
54
  /** Life span of session in minutes. Maximum 40320 (4 weeks). */
55
55
  session_lifespan_in_minutes: number;
56
56
  /** The date this resource was created. */
57
- date_created: string;
57
+ date_created: string | null;
58
58
  /** The date this resource was last modified. */
59
- date_modified: string;
59
+ date_modified: string | null;
60
60
  };
61
61
  }
@@ -14,18 +14,18 @@ export interface DefaultPaymentMethod extends Graph {
14
14
  /** If the customer selected to save their payment information, this will be true. To clear out the payment information, set this to false. */
15
15
  save_cc: boolean;
16
16
  /** The credit card or debit card type. This will be determined automatically once the payment card is saved. */
17
- cc_type: string;
17
+ cc_type: string | null;
18
18
  /** The payment card number. This property will not be displayed as part of this resource, but can be used to modify this payment method. */
19
- cc_number: number;
19
+ cc_number?: number;
20
20
  /** A masked version of this payment card showing only the last 4 digits. */
21
- cc_number_masked: string;
21
+ cc_number_masked: string | null;
22
22
  /** The payment card expiration month in the MM format. */
23
- cc_exp_month: string;
23
+ cc_exp_month: string | null;
24
24
  /** The payment card expiration year in the YYYY format. */
25
- cc_exp_year: string;
25
+ cc_exp_year: string | null;
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
  }
@@ -49,9 +49,9 @@ interface Customer extends Graph {
49
49
  /** A tax identification number for this customer. */
50
50
  tax_id: string;
51
51
  /** The date this resource was created. */
52
- date_created: string;
52
+ date_created: string | null;
53
53
  /** The date this resource was last modified. */
54
- date_modified: string;
54
+ date_modified: string | null;
55
55
  };
56
56
 
57
57
  zooms: {
@@ -58,8 +58,8 @@ export interface Item extends Graph {
58
58
  /** As a unix timestamp, this is the point in the future when this item will no longer be valid and will be removed from the cart. */
59
59
  expires: number;
60
60
  /** The date this resource was created. */
61
- date_created: string;
61
+ date_created: string | null;
62
62
  /** The date this resource was last modified. */
63
- date_modified: string;
63
+ date_modified: string | null;
64
64
  };
65
65
  }
@@ -47,9 +47,9 @@ export interface Subscription extends Graph {
47
47
  /** If this subscription is using a third party subscription system such as PayPal Express, their identifier will be set here. */
48
48
  third_party_id: string;
49
49
  /** The date this resource was created. */
50
- date_created: string;
50
+ date_created: string | null;
51
51
  /** The date this resource was last modified. */
52
- date_modified: string;
52
+ date_modified: string | null;
53
53
  };
54
54
 
55
55
  zooms: {
@@ -65,9 +65,9 @@ export interface Transaction extends Graph {
65
65
  /** The currency symbol, such as $, £, €, etc. */
66
66
  currency_symbol: string;
67
67
  /** The date this resource was created. */
68
- date_created: string;
68
+ date_created: string | null;
69
69
  /** The date this resource was last modified. */
70
- date_modified: string;
70
+ date_modified: string | null;
71
71
  };
72
72
 
73
73
  zooms: {
@@ -80,9 +80,9 @@ export interface TransactionTemplate extends Graph {
80
80
  /** The currency symbol, such as $, £, €, etc. */
81
81
  currency_symbol: string;
82
82
  /** The date this resource was created. */
83
- date_created: string;
83
+ date_created: string | null;
84
84
  /** The date this resource was last modified. */
85
- date_modified: string;
85
+ date_modified: string | null;
86
86
  };
87
87
 
88
88
  zooms: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/sdk",
3
3
  "type": "commonjs",
4
- "version": "2.0.0-beta.1",
4
+ "version": "2.0.0-beta.2",
5
5
  "description": "Universal SDK for a full server-side and a limited in-browser access to Foxy hAPI.",
6
6
  "main": "dist/cjs/index.js",
7
7
  "module": "dist/esm/index.js",