@foxy.io/sdk 1.14.0 → 1.15.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.
- package/dist/cdn/FoxySDKCustomer.js +1 -1
- package/dist/cjs/backend/API.js +47 -21
- package/dist/cjs/core/Rumour/Rumour.js +11 -0
- package/dist/esm/backend/API.js +47 -21
- package/dist/esm/core/Rumour/Rumour.js +11 -0
- package/dist/types/backend/Graph/cart.d.ts +5 -0
- package/dist/types/backend/Graph/charge_past_due.d.ts +5 -0
- package/dist/types/backend/Graph/countries.d.ts +15 -15
- package/dist/types/backend/Graph/hosted_payment_gateways_helper.d.ts +6 -0
- package/dist/types/backend/Graph/payment_gateway.d.ts +8 -0
- package/dist/types/backend/Graph/payment_gateways_helper.d.ts +6 -0
- package/dist/types/backend/Graph/store.d.ts +14 -5
- package/dist/types/backend/Graph/store_transaction_folder.d.ts +28 -0
- package/dist/types/backend/Graph/store_transaction_folders.d.ts +10 -0
- package/dist/types/backend/Graph/subscription.d.ts +5 -0
- package/dist/types/backend/Graph/tax.d.ts +2 -2
- package/dist/types/backend/Graph/transaction.d.ts +15 -10
- package/dist/types/backend/Graph/webhook.d.ts +3 -1
- package/dist/types/backend/Rels.d.ts +3 -0
- package/dist/types/customer/Graph/item.d.ts +5 -0
- package/dist/types/customer/Graph/item_option.d.ts +31 -0
- package/dist/types/customer/Graph/item_options.d.ts +10 -0
- package/dist/types/customer/Graph/subscription.d.ts +2 -0
- package/dist/types/customer/Graph/transaction_template.d.ts +1 -1
- package/dist/types/customer/Rels.d.ts +4 -0
- package/package.json +1 -1
package/dist/cjs/backend/API.js
CHANGED
|
@@ -84,41 +84,67 @@ class API extends Core.API {
|
|
|
84
84
|
var _a, _b, _c;
|
|
85
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
86
|
let token = JSON.parse((_a = this.storage.getItem(API.ACCESS_TOKEN)) !== null && _a !== void 0 ? _a : 'null');
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (expiresAt < refreshAt) {
|
|
92
|
-
this.storage.removeItem(API.ACCESS_TOKEN);
|
|
93
|
-
this.console.info('Removed old access token from the storage.');
|
|
94
|
-
token = null;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (token === null) {
|
|
98
|
-
this.console.trace("Access token isn't present in the storage. Fetching a new one...");
|
|
87
|
+
let request = new cross_fetch_1.Request(input, init);
|
|
88
|
+
let headers = request.headers;
|
|
89
|
+
const fetchNewAccessToken = () => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
this.console.trace('Fetching a new access token...');
|
|
99
91
|
const rawToken = yield API.getToken(this, true).catch(err => {
|
|
100
92
|
this.console.error(err.message);
|
|
101
93
|
return null;
|
|
102
94
|
});
|
|
103
95
|
if (rawToken) {
|
|
104
|
-
token = Object.assign(Object.assign({}, rawToken), { date_created: new Date().toISOString() });
|
|
96
|
+
const token = Object.assign(Object.assign({}, rawToken), { date_created: new Date().toISOString() });
|
|
105
97
|
this.storage.setItem(API.ACCESS_TOKEN, JSON.stringify(token));
|
|
106
98
|
this.console.info('Access token updated.');
|
|
99
|
+
return token;
|
|
107
100
|
}
|
|
108
101
|
else {
|
|
109
102
|
this.console.warn('Failed to fetch access token. Proceeding without authentication.');
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
const setHeaders = (accessToken) => {
|
|
107
|
+
if (!headers.get('Authorization') && accessToken)
|
|
108
|
+
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
109
|
+
if (!headers.get('Content-Type'))
|
|
110
|
+
headers.set('Content-Type', 'application/json');
|
|
111
|
+
if (!headers.get('FOXY-API-VERSION'))
|
|
112
|
+
headers.set('FOXY-API-VERSION', this.version);
|
|
113
|
+
};
|
|
114
|
+
if (token) {
|
|
115
|
+
const expiresAt = new Date(token.date_created).getTime() + token.expires_in * 1000;
|
|
116
|
+
const refreshAt = Date.now() + API.REFRESH_THRESHOLD;
|
|
117
|
+
if (expiresAt < refreshAt) {
|
|
118
|
+
this.storage.removeItem(API.ACCESS_TOKEN);
|
|
119
|
+
this.console.info('Removed old access token from the storage.');
|
|
120
|
+
token = yield fetchNewAccessToken();
|
|
110
121
|
}
|
|
111
122
|
}
|
|
112
|
-
|
|
123
|
+
else {
|
|
124
|
+
this.console.trace("Access token isn't present in the storage.");
|
|
125
|
+
token = yield fetchNewAccessToken();
|
|
126
|
+
}
|
|
127
|
+
setHeaders(token === null || token === void 0 ? void 0 : token.access_token);
|
|
113
128
|
const method = (_c = (_b = init === null || init === void 0 ? void 0 : init.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : 'GET';
|
|
114
|
-
if (!headers.get('Authorization') && token)
|
|
115
|
-
headers.set('Authorization', `Bearer ${token.access_token}`);
|
|
116
|
-
if (!headers.get('Content-Type'))
|
|
117
|
-
headers.set('Content-Type', 'application/json');
|
|
118
|
-
if (!headers.get('FOXY-API-VERSION'))
|
|
119
|
-
headers.set('FOXY-API-VERSION', this.version);
|
|
120
129
|
this.console.trace(`${method} ${request.url}`);
|
|
121
|
-
|
|
130
|
+
let response = yield cross_fetch_1.fetch(request);
|
|
131
|
+
if (response.status === 401) {
|
|
132
|
+
const { error } = (yield response.clone().json());
|
|
133
|
+
if (error === 'invalid_token') {
|
|
134
|
+
this.console.info('Access token is invalid or expired.');
|
|
135
|
+
this.storage.removeItem(API.ACCESS_TOKEN);
|
|
136
|
+
this.console.info('Removed old access token from the storage.');
|
|
137
|
+
token = yield fetchNewAccessToken();
|
|
138
|
+
if (token) {
|
|
139
|
+
request = new cross_fetch_1.Request(input, init);
|
|
140
|
+
headers = request.headers;
|
|
141
|
+
setHeaders(token.access_token);
|
|
142
|
+
this.console.trace(`Retrying ${method} ${request.url}`);
|
|
143
|
+
response = yield cross_fetch_1.fetch(request);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return response;
|
|
122
148
|
});
|
|
123
149
|
}
|
|
124
150
|
}
|
|
@@ -143,6 +143,17 @@ class Rumour {
|
|
|
143
143
|
throw new Rumour.UpdateError();
|
|
144
144
|
if (patch.has(exactURI)) {
|
|
145
145
|
const props = patch.get(exactURI);
|
|
146
|
+
// When props ending with `_uri` or `_id` change, it's possible that the embedded content
|
|
147
|
+
// will change as well, so we throw an error to ask the data host to reload its state.
|
|
148
|
+
if (props) {
|
|
149
|
+
for (const key in props) {
|
|
150
|
+
if (!key.endsWith('_uri') && !key.endsWith('_id'))
|
|
151
|
+
continue;
|
|
152
|
+
if (node[key] === props[key])
|
|
153
|
+
continue;
|
|
154
|
+
throw new Rumour.UpdateError();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
146
157
|
if (props)
|
|
147
158
|
return this.update(Object.assign(Object.assign({}, node), props), true);
|
|
148
159
|
if (!this.parent.parent)
|
package/dist/esm/backend/API.js
CHANGED
|
@@ -59,41 +59,67 @@ export class API extends Core.API {
|
|
|
59
59
|
var _a, _b, _c;
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
61
|
let token = JSON.parse((_a = this.storage.getItem(API.ACCESS_TOKEN)) !== null && _a !== void 0 ? _a : 'null');
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (expiresAt < refreshAt) {
|
|
67
|
-
this.storage.removeItem(API.ACCESS_TOKEN);
|
|
68
|
-
this.console.info('Removed old access token from the storage.');
|
|
69
|
-
token = null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (token === null) {
|
|
73
|
-
this.console.trace("Access token isn't present in the storage. Fetching a new one...");
|
|
62
|
+
let request = new Request(input, init);
|
|
63
|
+
let headers = request.headers;
|
|
64
|
+
const fetchNewAccessToken = () => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
this.console.trace('Fetching a new access token...');
|
|
74
66
|
const rawToken = yield API.getToken(this, true).catch(err => {
|
|
75
67
|
this.console.error(err.message);
|
|
76
68
|
return null;
|
|
77
69
|
});
|
|
78
70
|
if (rawToken) {
|
|
79
|
-
token = Object.assign(Object.assign({}, rawToken), { date_created: new Date().toISOString() });
|
|
71
|
+
const token = Object.assign(Object.assign({}, rawToken), { date_created: new Date().toISOString() });
|
|
80
72
|
this.storage.setItem(API.ACCESS_TOKEN, JSON.stringify(token));
|
|
81
73
|
this.console.info('Access token updated.');
|
|
74
|
+
return token;
|
|
82
75
|
}
|
|
83
76
|
else {
|
|
84
77
|
this.console.warn('Failed to fetch access token. Proceeding without authentication.');
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const setHeaders = (accessToken) => {
|
|
82
|
+
if (!headers.get('Authorization') && accessToken)
|
|
83
|
+
headers.set('Authorization', `Bearer ${accessToken}`);
|
|
84
|
+
if (!headers.get('Content-Type'))
|
|
85
|
+
headers.set('Content-Type', 'application/json');
|
|
86
|
+
if (!headers.get('FOXY-API-VERSION'))
|
|
87
|
+
headers.set('FOXY-API-VERSION', this.version);
|
|
88
|
+
};
|
|
89
|
+
if (token) {
|
|
90
|
+
const expiresAt = new Date(token.date_created).getTime() + token.expires_in * 1000;
|
|
91
|
+
const refreshAt = Date.now() + API.REFRESH_THRESHOLD;
|
|
92
|
+
if (expiresAt < refreshAt) {
|
|
93
|
+
this.storage.removeItem(API.ACCESS_TOKEN);
|
|
94
|
+
this.console.info('Removed old access token from the storage.');
|
|
95
|
+
token = yield fetchNewAccessToken();
|
|
85
96
|
}
|
|
86
97
|
}
|
|
87
|
-
|
|
98
|
+
else {
|
|
99
|
+
this.console.trace("Access token isn't present in the storage.");
|
|
100
|
+
token = yield fetchNewAccessToken();
|
|
101
|
+
}
|
|
102
|
+
setHeaders(token === null || token === void 0 ? void 0 : token.access_token);
|
|
88
103
|
const method = (_c = (_b = init === null || init === void 0 ? void 0 : init.method) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : 'GET';
|
|
89
|
-
if (!headers.get('Authorization') && token)
|
|
90
|
-
headers.set('Authorization', `Bearer ${token.access_token}`);
|
|
91
|
-
if (!headers.get('Content-Type'))
|
|
92
|
-
headers.set('Content-Type', 'application/json');
|
|
93
|
-
if (!headers.get('FOXY-API-VERSION'))
|
|
94
|
-
headers.set('FOXY-API-VERSION', this.version);
|
|
95
104
|
this.console.trace(`${method} ${request.url}`);
|
|
96
|
-
|
|
105
|
+
let response = yield fetch(request);
|
|
106
|
+
if (response.status === 401) {
|
|
107
|
+
const { error } = (yield response.clone().json());
|
|
108
|
+
if (error === 'invalid_token') {
|
|
109
|
+
this.console.info('Access token is invalid or expired.');
|
|
110
|
+
this.storage.removeItem(API.ACCESS_TOKEN);
|
|
111
|
+
this.console.info('Removed old access token from the storage.');
|
|
112
|
+
token = yield fetchNewAccessToken();
|
|
113
|
+
if (token) {
|
|
114
|
+
request = new Request(input, init);
|
|
115
|
+
headers = request.headers;
|
|
116
|
+
setHeaders(token.access_token);
|
|
117
|
+
this.console.trace(`Retrying ${method} ${request.url}`);
|
|
118
|
+
response = yield fetch(request);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return response;
|
|
97
123
|
});
|
|
98
124
|
}
|
|
99
125
|
}
|
|
@@ -137,6 +137,17 @@ export class Rumour {
|
|
|
137
137
|
throw new Rumour.UpdateError();
|
|
138
138
|
if (patch.has(exactURI)) {
|
|
139
139
|
const props = patch.get(exactURI);
|
|
140
|
+
// When props ending with `_uri` or `_id` change, it's possible that the embedded content
|
|
141
|
+
// will change as well, so we throw an error to ask the data host to reload its state.
|
|
142
|
+
if (props) {
|
|
143
|
+
for (const key in props) {
|
|
144
|
+
if (!key.endsWith('_uri') && !key.endsWith('_id'))
|
|
145
|
+
continue;
|
|
146
|
+
if (node[key] === props[key])
|
|
147
|
+
continue;
|
|
148
|
+
throw new Rumour.UpdateError();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
140
151
|
if (props)
|
|
141
152
|
return this.update(Object.assign(Object.assign({}, node), props), true);
|
|
142
153
|
if (!this.parent.parent)
|
|
@@ -4,6 +4,7 @@ import type { CreateSession } from './create_session';
|
|
|
4
4
|
import type { CustomFields } from './custom_fields';
|
|
5
5
|
import type { Customer } from './customer';
|
|
6
6
|
import type { Discounts } from './discounts';
|
|
7
|
+
import type { GiftCardCodeLogs } from './gift_card_code_logs';
|
|
7
8
|
import type { Graph } from '../../core';
|
|
8
9
|
import type { Items } from './items';
|
|
9
10
|
import type { Store } from './store';
|
|
@@ -33,6 +34,8 @@ export interface Cart extends Graph {
|
|
|
33
34
|
'fx:create_session': CreateSession;
|
|
34
35
|
/** Coupon codes applied to the items in this cart. */
|
|
35
36
|
'fx:applied_coupon_codes': AppliedCouponCodes;
|
|
37
|
+
/** Gift card codes applied to the items in this cart. */
|
|
38
|
+
'fx:applied_gift_card_codes': GiftCardCodeLogs;
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
props: {
|
|
@@ -134,6 +137,8 @@ export interface Cart extends Graph {
|
|
|
134
137
|
};
|
|
135
138
|
|
|
136
139
|
zooms: {
|
|
140
|
+
applied_coupon_codes?: AppliedCouponCodes;
|
|
141
|
+
gift_card_code_logs?: GiftCardCodeLogs; // the zoom name is `applied_gift_card_codes`, but the resource is `gift_card_code_logs` so we use that here due to the limitations of the SDK types
|
|
137
142
|
custom_fields?: CustomFields;
|
|
138
143
|
attributes: Attributes;
|
|
139
144
|
discounts?: Discounts;
|
|
@@ -27,21 +27,21 @@ export interface Countries extends Graph {
|
|
|
27
27
|
alternate_values: string[];
|
|
28
28
|
/** This value determines which countries will show up first in our find-as-you-type system. */
|
|
29
29
|
boost: number;
|
|
30
|
-
/**
|
|
31
|
-
has_regions
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
30
|
+
/** Whether this country has known regions on file in our system. If `?include_regions=true` is passed in, this property will be omitted. */
|
|
31
|
+
has_regions?: boolean;
|
|
32
|
+
/** Known regions for this country if Foxy is aware of them. If `?include_regions=true` is not passed in, this property will be omitted. */
|
|
33
|
+
regions?: {
|
|
34
|
+
/** The default name for this region. */
|
|
35
|
+
n: string;
|
|
36
|
+
/** The official region code. */
|
|
37
|
+
c: string;
|
|
38
|
+
/** Array of alternative names for this region. */
|
|
39
|
+
alt: string[];
|
|
40
|
+
/** This value determines which regions will show up first in our find-as-you-type system. */
|
|
41
|
+
boost: number;
|
|
42
|
+
/** If this region is currently recognized. */
|
|
43
|
+
active: boolean;
|
|
44
|
+
}[];
|
|
45
45
|
/** Whether this country requires regions for shipping or not. */
|
|
46
46
|
regions_required: boolean;
|
|
47
47
|
/** What type of region this is such as state, province, etc. */
|
|
@@ -37,6 +37,12 @@ export interface HostedPaymentGatewaysHelper extends Graph {
|
|
|
37
37
|
third_party_key_description: string;
|
|
38
38
|
/** Marks hosted payment gateways that are no longer supported. */
|
|
39
39
|
is_deprecated: boolean;
|
|
40
|
+
/** Whether or not this hosted gateway supports card verification. */
|
|
41
|
+
supports_card_verification: boolean;
|
|
42
|
+
/** Default card verification mode if this gateway supports it. */
|
|
43
|
+
card_verification: 'disabled' | 'enabled_automatically' | 'enabled_override';
|
|
44
|
+
/** Default configuration for card verification amounts. This is a serialized JSON string that contains the amounts for each card type. Example: `{"verification_amounts": {"visa": 1, "mastercard": 1, "american_express": 1, "discover": 1, "default": 1}}`. */
|
|
45
|
+
card_verification_config: string;
|
|
40
46
|
/** If this hosted gateway requires additional information, this will contain details about the data which needs to be collected to configure this hosted gateway. */
|
|
41
47
|
additional_fields: null | {
|
|
42
48
|
blocks: {
|
|
@@ -40,6 +40,14 @@ export interface PaymentGateway extends Graph {
|
|
|
40
40
|
test_account_key: string;
|
|
41
41
|
/** Your test payment gateway third party key. To view the specific description of this field for the given payment gateway, see {@link https://api-sandbox.foxycart.com/hal-browser/browser.html#https://api-sandbox.foxycart.com/property_helpers/payment_gateways payment_gateways} property helper `third_party_key_description` field. */
|
|
42
42
|
test_third_party_key: string;
|
|
43
|
+
/** Live card verification mode if this gateway supports it. */
|
|
44
|
+
card_verification: 'disabled' | 'enabled_automatically' | 'enabled_override';
|
|
45
|
+
/** Live configuration for card verification amounts. This is a serialized JSON string that contains the amounts for each card type. Example: `{"verification_amounts": {"visa": 1, "mastercard": 1, "american_express": 1, "discover": 1, "default": 1}}`. */
|
|
46
|
+
card_verification_config: string;
|
|
47
|
+
/** Test card verification mode if this gateway supports it. */
|
|
48
|
+
test_card_verification: 'disabled' | 'enabled_automatically' | 'enabled_override';
|
|
49
|
+
/** Test configuration for card verification amounts. This is a serialized JSON string that contains the amounts for each card type. Example: `{"verification_amounts": {"visa": 1, "mastercard": 1, "american_express": 1, "discover": 1, "default": 1}}`. */
|
|
50
|
+
test_card_verification_config: string;
|
|
43
51
|
/** The date this resource was created. */
|
|
44
52
|
date_created: string | null;
|
|
45
53
|
/** The date this resource was last modified. */
|
|
@@ -37,6 +37,12 @@ export interface PaymentGatewaysHelper extends Graph {
|
|
|
37
37
|
third_party_key_description: string;
|
|
38
38
|
/** Marks payment gateways that are no longer supported. */
|
|
39
39
|
is_deprecated: boolean;
|
|
40
|
+
/** Whether or not this gateway supports card verification. */
|
|
41
|
+
supports_card_verification: boolean;
|
|
42
|
+
/** Default card verification mode if this gateway supports it. */
|
|
43
|
+
card_verification: 'disabled' | 'enabled_automatically' | 'enabled_override';
|
|
44
|
+
/** Default configuration for card verification amounts. This is a serialized JSON string that contains the amounts for each card type. Example: `{"verification_amounts": {"visa": 1, "mastercard": 1, "american_express": 1, "discover": 1, "default": 1}}`. */
|
|
45
|
+
card_verification_config: string;
|
|
40
46
|
/** If this gateway requires additional information, this will contain details about the data which needs to be collected to configure this gateway. */
|
|
41
47
|
additional_fields: null | {
|
|
42
48
|
blocks: {
|
|
@@ -18,6 +18,8 @@ import type { PaymentMethodSets } from './payment_method_sets';
|
|
|
18
18
|
import type { ProcessSubscriptionWebhook } from './process_subscription_webhook';
|
|
19
19
|
import type { ReceiptTemplates } from './receipt_templates';
|
|
20
20
|
import type { Reports } from './reports';
|
|
21
|
+
import type { StoreShippingMethods } from './store_shipping_methods';
|
|
22
|
+
import type { StoreTransactionFolders } from './store_transaction_folders';
|
|
21
23
|
import type { StoreVersion } from './store_version';
|
|
22
24
|
import type { SubscriptionSettings } from './subscription_settings';
|
|
23
25
|
import type { Subscriptions } from './subscriptions';
|
|
@@ -28,7 +30,6 @@ import type { UserAccesses } from './user_accesses';
|
|
|
28
30
|
import type { UserInvitations } from './user_invitations';
|
|
29
31
|
import type { Users } from './users';
|
|
30
32
|
import type { Webhooks } from './webhooks';
|
|
31
|
-
import type { StoreShippingMethods } from './store_shipping_methods';
|
|
32
33
|
|
|
33
34
|
export interface Store extends Graph {
|
|
34
35
|
curie: 'fx:store';
|
|
@@ -84,6 +85,8 @@ export interface Store extends Graph {
|
|
|
84
85
|
'fx:checkout_templates': CheckoutTemplates;
|
|
85
86
|
/** List of payment method sets configured for this store. */
|
|
86
87
|
'fx:payment_method_sets': PaymentMethodSets;
|
|
88
|
+
/** List of transaction folders for this store. */
|
|
89
|
+
'fx:transaction_folders': StoreTransactionFolders;
|
|
87
90
|
/** Subscription settings for this store. */
|
|
88
91
|
'fx:subscription_settings': SubscriptionSettings;
|
|
89
92
|
/** List of cart include templates available in this store. */
|
|
@@ -96,10 +99,14 @@ export interface Store extends Graph {
|
|
|
96
99
|
'fx:customer_portal_settings': CustomerPortalSettings;
|
|
97
100
|
/** POST here to resend the daily subscription webhook notification for this store. */
|
|
98
101
|
'fx:process_subscription_webhook': ProcessSubscriptionWebhook;
|
|
99
|
-
/** Add-to-cart URL for the
|
|
100
|
-
'fx:
|
|
101
|
-
/** Add-to-cart URL for the
|
|
102
|
-
'fx:
|
|
102
|
+
/** Add-to-cart URL for the Starter plan with yearly billing. */
|
|
103
|
+
'fx:activate_store_starter_yearly_url': { curie: 'fx:activate_store_starter_yearly_url' };
|
|
104
|
+
/** Add-to-cart URL for the Starter plan with monthly billing. */
|
|
105
|
+
'fx:activate_store_starter_monthly_url': { curie: 'fx:activate_store_starter_monthly_url' };
|
|
106
|
+
/** Add-to-cart URL for the Growth plan with yearly billing. */
|
|
107
|
+
'fx:activate_store_growth_yearly_url': { curie: 'fx:activate_store_growth_yearly_url' };
|
|
108
|
+
/** Add-to-cart URL for the Growth plan with monthly billing. */
|
|
109
|
+
'fx:activate_store_growth_monthly_url': { curie: 'fx:activate_store_growth_monthly_url' };
|
|
103
110
|
/** Add-to-cart URL for the Advanced plan with yearly billing. */
|
|
104
111
|
'fx:activate_store_advanced_yearly_url': { curie: 'fx:activate_store_advanced_yearly_url' };
|
|
105
112
|
/** Add-to-cart URL for the Advanced plan with monthly billing. */
|
|
@@ -129,6 +136,8 @@ export interface Store extends Graph {
|
|
|
129
136
|
use_email_dns: boolean;
|
|
130
137
|
/** If you'd like to configure your own SMTP server for sending transaction receipt emails, you can do so here. The JSON supports the following fields: `username`,`password`,`host`,`port`,`security`. The security value can be blank, `ssl`, or `tls` */
|
|
131
138
|
smtp_config: string;
|
|
139
|
+
/** Set to true if you would like to send HTML formatted emails. */
|
|
140
|
+
send_html_email: boolean;
|
|
132
141
|
/** The postal code of your store. This will be used for calculating shipping costs if you sell shippable items. */
|
|
133
142
|
postal_code: string;
|
|
134
143
|
/** The two character code for states in the United States. Other countries may call this a province. When a two character code isn't available, use the full region name. This will be used for calculating shipping costs if you sell shippable items. */
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Graph } from '../../core';
|
|
2
|
+
import type { Store } from './store';
|
|
3
|
+
|
|
4
|
+
export interface StoreTransactionFolder extends Graph {
|
|
5
|
+
curie: 'fx:folder';
|
|
6
|
+
|
|
7
|
+
links: {
|
|
8
|
+
/** This resource. */
|
|
9
|
+
'self': StoreTransactionFolder;
|
|
10
|
+
/** Related store resource. */
|
|
11
|
+
'fx:store': Store;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
props: {
|
|
15
|
+
/** Name of the folder. Required. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** When set to `1`, new transactions will be automatically assigned to this folder. Only one folder can be default at a time. If you update one folder to be the default one we will mark others as non default. Optional. Default: `0`.*/
|
|
18
|
+
is_default: 0 | 1;
|
|
19
|
+
/** Optional display order for this folder. Our admin dashboard will sort folders by this value (ascending). Default: `0`. */
|
|
20
|
+
sort_order: number;
|
|
21
|
+
/** Optional display color for this folder. API will accept any value, however our admin dashboard will recognize only the following: `red`, `red_pale`, `green`, `green_pale`, `blue`, `blue_pale`, `orange`, `orange_pale`, `violet`, `violet_pale`. Default: `null`. */
|
|
22
|
+
color: string | null;
|
|
23
|
+
/** The date and time this folder was created in ISO 8601 format. */
|
|
24
|
+
date_created: string;
|
|
25
|
+
/** The date and time this folder was last modified in ISO 8601 format. */
|
|
26
|
+
date_modified: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { StoreTransactionFolder } from './store_transaction_folder';
|
|
4
|
+
|
|
5
|
+
export interface StoreTransactionFolders extends Graph {
|
|
6
|
+
curie: 'fx:transaction_folders';
|
|
7
|
+
links: CollectionGraphLinks<StoreTransactionFolders>;
|
|
8
|
+
props: CollectionGraphProps;
|
|
9
|
+
child: StoreTransactionFolder;
|
|
10
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Attributes } from './attributes';
|
|
2
|
+
import type { ChargePastDue } from './charge_past_due';
|
|
2
3
|
import type { Customer } from './customer';
|
|
3
4
|
import type { Graph } from '../../core';
|
|
4
5
|
import type { LastTransaction } from './last_transaction';
|
|
@@ -31,6 +32,8 @@ export interface Subscription extends Graph {
|
|
|
31
32
|
'fx:sub_token_url': SubTokenUrl;
|
|
32
33
|
/** URL of the page where the customer can modify this subscription. This link is available only when configured in subscription settings. */
|
|
33
34
|
'fx:sub_modification_url': SubModificationUrl;
|
|
35
|
+
/** POST to this endpoint to charge any past due payments for this subscription. Not present when there's no past due amount to charge. */
|
|
36
|
+
'fx:charge_past_due': ChargePastDue;
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
props: {
|
|
@@ -52,6 +55,8 @@ export interface Subscription extends Graph {
|
|
|
52
55
|
is_active: boolean;
|
|
53
56
|
/** If this subscription is using a third party subscription system such as PayPal Express, their identifier will be set here. */
|
|
54
57
|
third_party_id: string;
|
|
58
|
+
/** The type of payment method used for this subscription. Can be `null` if payment method info is unavailable via this API. */
|
|
59
|
+
payment_type: 'plastic' | 'paypal' | 'ach' | 'amazon' | null;
|
|
55
60
|
/** The date this resource was created. */
|
|
56
61
|
date_created: string | null;
|
|
57
62
|
/** The date this resource was last modified. */
|
|
@@ -21,7 +21,7 @@ export interface Tax extends Graph {
|
|
|
21
21
|
/** The name of this tax which will be displayed to the customer. */
|
|
22
22
|
name: string;
|
|
23
23
|
/** The type of tax rate which determines when this tax will be applied. */
|
|
24
|
-
type: 'global' | 'union' | 'country' | 'region' | 'local';
|
|
24
|
+
type: 'global' | 'union' | 'country' | 'region' | 'local' | 'custom_tax_endpoint';
|
|
25
25
|
/** The country which will be matched against the customer shipping country to determine if a country tax will be applied. */
|
|
26
26
|
country: string;
|
|
27
27
|
/** The region (also known as a state or province) which will be matched against the customer shipping region to determine if a regional tax will be applied. */
|
|
@@ -31,7 +31,7 @@ export interface Tax extends Graph {
|
|
|
31
31
|
/** Set to true if the tax rate will be determined automatically by the postal code. */
|
|
32
32
|
is_live: boolean;
|
|
33
33
|
/** If using a live tax rate service provider, this value can be set to determine which provider you would like to use. */
|
|
34
|
-
service_provider: 'avalara' | '';
|
|
34
|
+
service_provider: 'avalara' | 'custom_tax' | 'onesource' | 'taxjar' | '';
|
|
35
35
|
/** Set to true if the tax rate will also be applied to the shipping costs. */
|
|
36
36
|
apply_to_shipping: boolean;
|
|
37
37
|
/** For a Union tax type, set to true to use the origin country tax rates. */
|
|
@@ -5,6 +5,7 @@ import type { Capture } from './capture';
|
|
|
5
5
|
import type { CustomFields } from './custom_fields';
|
|
6
6
|
import type { Customer } from './customer';
|
|
7
7
|
import type { Discounts } from './discounts';
|
|
8
|
+
import type { GiftCardCodeLogs } from './gift_card_code_logs';
|
|
8
9
|
import type { Graph } from '../../core';
|
|
9
10
|
import type { Items } from './items';
|
|
10
11
|
import type { NativeIntegrations } from './native_integrations';
|
|
@@ -13,17 +14,14 @@ import type { ProcessWebhook } from './process_webhook';
|
|
|
13
14
|
import type { Receipt } from './receipt';
|
|
14
15
|
import type { Refund } from './refund';
|
|
15
16
|
import type { SendEmails } from './send_emails';
|
|
17
|
+
import type { SendWebhooks } from './send_webhooks';
|
|
16
18
|
import type { Shipments } from './shipments';
|
|
17
19
|
import type { Store } from './store';
|
|
20
|
+
import type { StoreTransactionFolder } from './store_transaction_folder';
|
|
21
|
+
import type { Subscription } from './subscription';
|
|
22
|
+
import type { TransactionJournalEntries } from './transaction_journal_entries';
|
|
18
23
|
import type { TransactionLogs } from './transaction_logs';
|
|
19
24
|
import type { Void } from './void';
|
|
20
|
-
import type { GiftCardCodeLog } from './gift_card_code_log';
|
|
21
|
-
import type { SendWebhooks } from './send_webhooks';
|
|
22
|
-
import type { TransactionLog } from './transaction_log';
|
|
23
|
-
import type { TransactionJournalEntry } from './transaction_journal_entry';
|
|
24
|
-
import type { TransactionJournalEntries } from './transaction_journal_entries';
|
|
25
|
-
import type { GiftCardCodeLogs } from './gift_card_code_logs';
|
|
26
|
-
import type { Subscription } from './subscription';
|
|
27
25
|
|
|
28
26
|
export interface Transaction extends Graph {
|
|
29
27
|
curie: 'fx:transaction';
|
|
@@ -37,6 +35,8 @@ export interface Transaction extends Graph {
|
|
|
37
35
|
'fx:store': Store;
|
|
38
36
|
/** List of items in this transaction. */
|
|
39
37
|
'fx:items': Items;
|
|
38
|
+
/** Folder this transaction is assigned to. Not present when not assigned. */
|
|
39
|
+
'fx:folder': StoreTransactionFolder;
|
|
40
40
|
/** POST here to refund this transaction. */
|
|
41
41
|
'fx:refund': Refund;
|
|
42
42
|
/** Open this link in a browser to see a receipt for this transaction. */
|
|
@@ -149,6 +149,10 @@ export interface Transaction extends Graph {
|
|
|
149
149
|
| 'mit_recurring_reattempt_manual'
|
|
150
150
|
| 'cit_recurring_cancellation'
|
|
151
151
|
| 'mit_recurring_cancellation';
|
|
152
|
+
/** ID of the folder this transaction is assigned to. When not assigned, this will be `null`. */
|
|
153
|
+
folder_id: number | null;
|
|
154
|
+
/** The URI of the folder this transaction is assigned to. When not assigned, this will be an empty string. */
|
|
155
|
+
folder_uri: string;
|
|
152
156
|
/** The date this resource was created. */
|
|
153
157
|
date_created: string | null;
|
|
154
158
|
/** The date this resource was last modified. */
|
|
@@ -156,10 +160,10 @@ export interface Transaction extends Graph {
|
|
|
156
160
|
};
|
|
157
161
|
|
|
158
162
|
zooms: {
|
|
159
|
-
transaction_journal_entries?:
|
|
160
|
-
|
|
163
|
+
transaction_journal_entries?: TransactionJournalEntries;
|
|
164
|
+
gift_card_code_logs?: GiftCardCodeLogs; // the zoom name is `applied_gift_card_codes` but we use `gift_card_code_logs` here due to the constraints of the SDK type system
|
|
161
165
|
billing_addresses?: BillingAddresses;
|
|
162
|
-
transaction_logs?:
|
|
166
|
+
transaction_logs?: TransactionLogs;
|
|
163
167
|
applied_taxes?: AppliedTaxes;
|
|
164
168
|
custom_fields?: CustomFields;
|
|
165
169
|
attributes: Attributes;
|
|
@@ -167,6 +171,7 @@ export interface Transaction extends Graph {
|
|
|
167
171
|
shipments?: Shipments;
|
|
168
172
|
customer?: Customer;
|
|
169
173
|
payments?: Payments;
|
|
174
|
+
folder?: StoreTransactionFolder;
|
|
170
175
|
items?: Items;
|
|
171
176
|
};
|
|
172
177
|
}
|
|
@@ -34,7 +34,9 @@ export interface Webhook extends Graph {
|
|
|
34
34
|
/** The JSON webhooks are encrypted in certain situations. This key is also used to generate a signature to verify the integrity of the payload. 1000 characters or less. */
|
|
35
35
|
encryption_key: string | null;
|
|
36
36
|
/** The type of resource to observe changes on. */
|
|
37
|
-
event_resource:
|
|
37
|
+
event_resource: 'subscription' | 'transaction' | 'transaction_log' | 'customer';
|
|
38
|
+
/** If set to `0`, events will not be triggered for this webhook. This can also be set to `0` automatically if there are too many consecutive failed attempts to send a payload to this endpoint. */
|
|
39
|
+
is_active: 0 | 1;
|
|
38
40
|
/** The date this resource was created. */
|
|
39
41
|
date_created: string | null;
|
|
40
42
|
/** The date this resource was last modified. */
|
|
@@ -15,6 +15,7 @@ export * from './Graph/cart_include_templates';
|
|
|
15
15
|
export * from './Graph/cart_template';
|
|
16
16
|
export * from './Graph/cart_templates';
|
|
17
17
|
export * from './Graph/carts';
|
|
18
|
+
export * from './Graph/charge_past_due';
|
|
18
19
|
export * from './Graph/checkout_template';
|
|
19
20
|
export * from './Graph/checkout_templates';
|
|
20
21
|
export * from './Graph/checkout_types';
|
|
@@ -135,6 +136,8 @@ export * from './Graph/store_shipping_method';
|
|
|
135
136
|
export * from './Graph/store_shipping_methods';
|
|
136
137
|
export * from './Graph/store_shipping_service';
|
|
137
138
|
export * from './Graph/store_shipping_services';
|
|
139
|
+
export * from './Graph/store_transaction_folder';
|
|
140
|
+
export * from './Graph/store_transaction_folders';
|
|
138
141
|
export * from './Graph/store_version';
|
|
139
142
|
export * from './Graph/store_versions';
|
|
140
143
|
export * from './Graph/stores';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Graph } from '../../core';
|
|
2
|
+
import type { ItemOptions } from './item_options';
|
|
2
3
|
|
|
3
4
|
export interface Item extends Graph {
|
|
4
5
|
curie: 'fx:item';
|
|
@@ -62,4 +63,8 @@ export interface Item extends Graph {
|
|
|
62
63
|
/** The date this resource was last modified. */
|
|
63
64
|
date_modified: string | null;
|
|
64
65
|
};
|
|
66
|
+
|
|
67
|
+
zooms: {
|
|
68
|
+
item_options?: ItemOptions;
|
|
69
|
+
};
|
|
65
70
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Graph } from '../../core';
|
|
2
|
+
import type { Item } from './item';
|
|
3
|
+
import type { Transaction } from './transaction';
|
|
4
|
+
|
|
5
|
+
export interface ItemOption extends Graph {
|
|
6
|
+
curie: 'fx:item_option';
|
|
7
|
+
|
|
8
|
+
links: {
|
|
9
|
+
/** This resource. */
|
|
10
|
+
'self': ItemOption;
|
|
11
|
+
/** Item this option is attached to. */
|
|
12
|
+
'fx:item': Item;
|
|
13
|
+
/** Related transaction resource. */
|
|
14
|
+
'fx:transaction': Transaction;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
props: {
|
|
18
|
+
/** The name of this item option. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** The value of this item option. */
|
|
21
|
+
value: string;
|
|
22
|
+
/** The price modifier for this item option. The price of the item in the cart will be adjusted by this amount because of this item option. */
|
|
23
|
+
price_mod: number;
|
|
24
|
+
/** The weight modifier for this item option. The weight of the item in the cart will be adjusted by this amount because of this item option. */
|
|
25
|
+
weight_mod: number;
|
|
26
|
+
/** The date this resource was created. */
|
|
27
|
+
date_created: string | null;
|
|
28
|
+
/** The date this resource was last modified. */
|
|
29
|
+
date_modified: string | null;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
|
|
2
|
+
import type { Graph } from '../../core';
|
|
3
|
+
import type { ItemOption } from './item_option';
|
|
4
|
+
|
|
5
|
+
export interface ItemOptions extends Graph {
|
|
6
|
+
curie: 'fx:item_options';
|
|
7
|
+
links: CollectionGraphLinks<ItemOptions>;
|
|
8
|
+
props: CollectionGraphProps;
|
|
9
|
+
child: ItemOption;
|
|
10
|
+
}
|