Skip to content

Commit de09d60

Browse files
authored
Merge pull request #62 from Foxy/release/1.13.0
chore: release v1.13.0
2 parents 959f4b4 + 8b12654 commit de09d60

18 files changed

+234
-9
lines changed

src/backend/Graph/cart.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export interface Cart extends Graph {
8080
/** The city of this address. */
8181
billing_city: string;
8282
/** 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. */
83-
billing_region: string;
83+
billing_state: string;
8484
/** The postal code of the billing address. */
8585
billing_postal_code: string;
8686
/** The country code of the billing address. */
@@ -102,7 +102,7 @@ export interface Cart extends Graph {
102102
/** The city of this address. */
103103
shipping_city: string;
104104
/** 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. */
105-
shipping_region: string;
105+
shipping_state: string;
106106
/** The postal code of the shipping address. */
107107
shipping_postal_code: string;
108108
/** The country code of the shipping address. */

src/backend/Graph/customer.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export interface Customer extends Graph {
3838
/** The date of the last time this customer authenticated with the FoxyCart checkout. */
3939
last_login_date: string;
4040
/** The customer's given name. */
41-
first_name: string;
41+
first_name: string | null;
4242
/** The customer's surname. */
43-
last_name: string;
43+
last_name: string | null;
4444
/** The customer's email address. This is used as the login to the FoxyCart checkout for this customer. */
4545
email: string;
4646
/** A tax identification number for this customer. */

src/backend/Graph/email_template.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export interface EmailTemplate extends Graph {
1818
};
1919

2020
props: {
21+
/** The template text of your receipt email subject. */
22+
subject: string;
2123
/** The description of your email template. */
2224
description: string;
2325
/** The content of your html email template. Leave blank to use the default responsive template. You can set the content directly or set the `content_html_url` to point to your template content online and then POST to the `cache` link relationship. */

src/backend/Graph/passkey.d.ts

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { Graph } from '../../core';
2+
import type { Passkeys } from './passkeys';
3+
import type { User } from './user';
4+
5+
export interface Passkey extends Graph {
6+
curie: 'fx:passkey';
7+
links: {
8+
'self': Passkey;
9+
'fx:user': User;
10+
'fx:user_passkeys': Passkeys;
11+
};
12+
props: {
13+
last_login_date: string | null;
14+
last_login_ua: string | null;
15+
credential_id: string;
16+
date_created: string | null;
17+
date_modified: string | null;
18+
};
19+
}

src/backend/Graph/passkeys.d.ts

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
2+
import type { Graph } from '../../core';
3+
import type { Passkey } from './passkey';
4+
5+
export interface Passkeys extends Graph {
6+
curie: 'fx:passkeys';
7+
links: CollectionGraphLinks<Passkeys>;
8+
props: CollectionGraphProps;
9+
child: Passkey;
10+
}

src/backend/Graph/send_webhooks.d.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { Graph } from '../../core';
2+
3+
export interface SendWebhooks extends Graph {
4+
curie: 'fx:send_webhooks';
5+
props: {
6+
refeed_hooks: number[];
7+
event: string;
8+
};
9+
}

src/backend/Graph/store.d.ts

+47
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import type { Taxes } from './taxes';
2525
import type { TemplateSets } from './template_sets';
2626
import type { Transactions } from './transactions';
2727
import type { UserAccesses } from './user_accesses';
28+
import type { UserInvitations } from './user_invitations';
2829
import type { Users } from './users';
30+
import type { Webhooks } from './webhooks';
2931
import type { StoreShippingMethods } from './store_shipping_methods';
3032

3133
export interface Store extends Graph {
@@ -44,6 +46,8 @@ export interface Store extends Graph {
4446
'fx:reports': Reports;
4547
/** List of coupons available in this store. */
4648
'fx:coupons': Coupons;
49+
/** List of webhooks configured for this store. */
50+
'fx:webhooks': Webhooks;
4751
/** List of customers of this store. */
4852
'fx:customers': Customers;
4953
/** List of gift cards available in this store. */
@@ -70,6 +74,8 @@ export interface Store extends Graph {
7074
'fx:email_templates': EmailTemplates;
7175
/** List of item categories configured in this store. */
7276
'fx:item_categories': ItemCategories;
77+
/** List of user invitations for this store. */
78+
'fx:user_invitations': UserInvitations;
7379
/** List of fraud protection measures enabled on this store. */
7480
'fx:fraud_protections': FraudProtections;
7581
/** List of receipt templates for this store. */
@@ -90,6 +96,14 @@ export interface Store extends Graph {
9096
'fx:customer_portal_settings': CustomerPortalSettings;
9197
/** POST here to resend the daily subscription webhook notification for this store. */
9298
'fx:process_subscription_webhook': ProcessSubscriptionWebhook;
99+
/** Add-to-cart URL for the Standard plan with yearly billing. */
100+
'fx:activate_store_yearly_url': { curie: 'fx:activate_store_yearly_url' };
101+
/** Add-to-cart URL for the Standard plan with monthly billing. */
102+
'fx:activate_store_monthly_url': { curie: 'fx:activate_store_monthly_url' };
103+
/** Add-to-cart URL for the Advanced plan with yearly billing. */
104+
'fx:activate_store_advanced_yearly_url': { curie: 'fx:activate_store_advanced_yearly_url' };
105+
/** Add-to-cart URL for the Advanced plan with monthly billing. */
106+
'fx:activate_store_advanced_monthly_url': { curie: 'fx:activate_store_advanced_monthly_url' };
93107
};
94108

95109
props: {
@@ -181,3 +195,36 @@ export interface Store extends Graph {
181195
date_modified: string | null;
182196
};
183197
}
198+
199+
export type StoreWebhookKeyJson = {
200+
cart_signing: string;
201+
xml_datafeed: string;
202+
api_legacy: string;
203+
sso: string;
204+
};
205+
206+
export type StoreSmtpConfigJson = {
207+
username: string;
208+
password: string;
209+
security: string;
210+
host: string;
211+
port: string;
212+
};
213+
214+
export type StoreCustomDisplayIdConfigJson = {
215+
enabled: boolean;
216+
start: string;
217+
length: string;
218+
prefix: string;
219+
suffix: string;
220+
transaction_journal_entries: {
221+
enabled: boolean;
222+
transaction_separator: string;
223+
log_detail_request_types: {
224+
transaction_authcapture: { prefix: string };
225+
transaction_capture: { prefix: string };
226+
transaction_refund: { prefix: string };
227+
transaction_void: { prefix: string };
228+
};
229+
};
230+
};

src/backend/Graph/subscription_settings.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface SubscriptionSettings extends Graph {
2323
/** A comma separated list of numbers. Each number represents the number of days after the initial failure that a reattempt should be made. For example, a setting of `1, 3, 5, 15, 30` would direct FoxyCart to attempt to collect the past-due amount on the 1st, 3rd, 5th, and 15th days after the initial transaction. */
2424
reattempt_schedule: string;
2525
/** Used in conjunction with the "bypass strings" below, this setting determines whether Foxy should reattempt the subscription charge if the transaction's previous error string does or doesn't contain specific text. */
26-
reattempt_bypass_logic: 'skip_if_exists' | 'reattempt_if_exists';
26+
reattempt_bypass_logic: 'skip_if_exists' | 'reattempt_if_exists' | '';
2727
/** A comma separated list of strings containing text strings that should prevent or allow (based on the above setting) a rebilling attempt. For example, setting the logic to "skip if the string is present" with a value for the "strings" field of `Code: 8, Code: 37` would instruct FoxyCart to not initiate the rebilling process if the last error contained either `Code: 8` or `Code: 37`, but to attempt the rebilling in all other cases. */
2828
reattempt_bypass_strings: string;
2929
/** Enter a comma separated list of numbers. Each number represents the number of days until the payment card expires that an email notification should be sent to the customer. This only happens for customers with active subscriptions. For example, if you put in 20,15,5, 20 days before the end of the month, customers with payment cards that will expire that month will receive an email. Same with 15 days and 5 days before the end of the month. */

src/backend/Graph/transaction.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type { Store } from './store';
1818
import type { TransactionLogs } from './transaction_logs';
1919
import type { Void } from './void';
2020
import type { GiftCardCodeLog } from './gift_card_code_log';
21+
import type { SendWebhooks } from './send_webhooks';
2122
import type { TransactionLog } from './transaction_log';
2223
import type { TransactionJournalEntry } from './transaction_journal_entry';
2324
import type { TransactionJournalEntries } from './transaction_journal_entries';
@@ -60,6 +61,8 @@ export interface Transaction extends Graph {
6061
'fx:applied_taxes': AppliedTaxes;
6162
/** List of custom fields on this transaction. */
6263
'fx:custom_fields': CustomFields;
64+
/** POST here to send the webhook notification for this transaction. */
65+
'fx:send_webhooks': SendWebhooks;
6366
/** POST here to resend the webhook notification for this transaction. */
6467
'fx:process_webhook': ProcessWebhook;
6568
/** Transaction logs. */

src/backend/Graph/user.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { Attributes } from './attributes';
22
import type { DefaultStore } from './default_store';
33
import type { Graph } from '../../core';
4+
import type { Passkeys } from './passkeys';
45
import type { Stores } from './stores';
6+
import type { UserInvitations } from './user_invitations';
57

68
export interface User extends Graph {
79
curie: 'fx:user';
@@ -13,8 +15,12 @@ export interface User extends Graph {
1315
'fx:stores': Stores;
1416
/** List of custom attributes on this user resource. */
1517
'fx:attributes': Attributes;
18+
/** List of passkeys for this user. */
19+
'fx:user_passkeys': Passkeys;
1620
/** Default store for this user. */
1721
'fx:default_store': DefaultStore;
22+
/** List of user invitations for this store. */
23+
'fx:user_invitations': UserInvitations;
1824
};
1925

2026
props: {
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import type { Graph } from '../../core';
2+
import type { Store } from './store';
3+
import type { User } from './user';
4+
5+
export interface UserInvitation extends Graph {
6+
curie: 'fx:user_invitation';
7+
links: {
8+
'self': UserInvitation;
9+
'fx:user': User;
10+
'fx:store': Store;
11+
'fx:resend': { curie: 'fx:resend' };
12+
'fx:accept': { curie: 'fx:accept' };
13+
'fx:reject': { curie: 'fx:reject' };
14+
'fx:revoke': { curie: 'fx:revoke' };
15+
};
16+
props: {
17+
/* Read-only website URL of the store that the user is invited to. */
18+
store_url: string;
19+
/* Read-only name of the store that the user is invited to. */
20+
store_name: string;
21+
/* Read-only email of the store that the user is invited to. */
22+
store_email: string;
23+
/* Read-only (sub)domain of the store that the user is invited to. */
24+
store_domain: string;
25+
/* Read-only first name of the user that is invited. */
26+
first_name: string | null;
27+
/* Read-only last name of the user that is invited. */
28+
last_name: string | null;
29+
/* Read-only email of the user that is invited. */
30+
email: string;
31+
/* Read-only status of the invitation, `sent` on creation. Use POST actions in links to change the status. */
32+
status: 'sent' | 'accepted' | 'rejected' | 'revoked' | 'expired';
33+
/* Read-only date the invitation was created. */
34+
date_created: string;
35+
/* Read-only date the invitation was last modified. */
36+
date_modified: string;
37+
};
38+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
2+
import type { Graph } from '../../core';
3+
import type { UserInvitation } from './user_invitation';
4+
5+
export interface UserInvitations extends Graph {
6+
curie: 'fx:user_accesses';
7+
links: CollectionGraphLinks<UserInvitations>;
8+
props: CollectionGraphProps;
9+
child: UserInvitation;
10+
}

src/backend/Rels.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ export * from './Graph/locale_codes';
8989
export * from './Graph/native_integration';
9090
export * from './Graph/native_integrations';
9191
export * from './Graph/original_transaction';
92+
export * from './Graph/passkey';
93+
export * from './Graph/passkeys';
9294
export * from './Graph/payment';
9395
export * from './Graph/payment_gateway';
9496
export * from './Graph/payment_gateways';
@@ -116,6 +118,7 @@ export * from './Graph/reporting_email_exists';
116118
export * from './Graph/reporting_store_domain_exists';
117119
export * from './Graph/reports';
118120
export * from './Graph/send_emails';
121+
export * from './Graph/send_webhooks';
119122
export * from './Graph/shipment';
120123
export * from './Graph/shipments';
121124
export * from './Graph/shipping_address_types';
@@ -159,6 +162,8 @@ export * from './Graph/transactions';
159162
export * from './Graph/user';
160163
export * from './Graph/user_access';
161164
export * from './Graph/user_accesses';
165+
export * from './Graph/user_invitation';
166+
export * from './Graph/user_invitations';
162167
export * from './Graph/users';
163168
export * from './Graph/void';
164169
export * from './Graph/webhook_log';

src/customer/API.ts

+24
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class API extends Core.API<Graph> {
3434
newPassword: v8n().optional(v8n().string()),
3535
password: v8n().string(),
3636
}),
37+
boolean: v8n().boolean(),
3738
email: v8n().string(),
3839
});
3940

@@ -117,6 +118,29 @@ export class API extends Core.API<Graph> {
117118
this.cache.clear();
118119
}
119120

121+
/**
122+
* When logged in with a temporary password, this property getter will return `true`.
123+
* Will return `false` if password reset is not required or if the session has not been
124+
* initiated, or if the session was initiated before the introduction of this feature.
125+
*
126+
* @returns {boolean} Password reset requirement.
127+
*/
128+
get usesTemporaryPassword(): boolean {
129+
const session = this.storage.getItem(API.SESSION);
130+
if (session) return !!(JSON.parse(session) as StoredSession).force_password_reset;
131+
return false;
132+
}
133+
134+
set usesTemporaryPassword(value: boolean) {
135+
API.v8n.boolean.check(value);
136+
const session = this.storage.getItem(API.SESSION);
137+
if (session) {
138+
const storedSession = JSON.parse(session) as StoredSession;
139+
storedSession.force_password_reset = value;
140+
this.storage.setItem(API.SESSION, JSON.stringify(storedSession));
141+
}
142+
}
143+
120144
private async __fetch(input: RequestInfo, init?: RequestInit): Promise<Response> {
121145
let session = JSON.parse(this.storage.getItem(API.SESSION) ?? 'null') as StoredSession | null;
122146
const request = new Request(input, init);

src/customer/Graph/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ interface Customer extends Graph {
4141
/** The date of the last time this customer authenticated with the FoxyCart checkout. */
4242
last_login_date: string;
4343
/** The customer's given name. */
44-
first_name: string;
44+
first_name: string | null;
4545
/** The customer's surname. */
46-
last_name: string;
46+
last_name: string | null;
4747
/** The customer's email address. This is used as the login to the FoxyCart checkout for this customer. */
4848
email: string;
4949
/** A tax identification number for this customer. */

src/customer/Graph/transaction_template.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface TransactionTemplate extends Graph {
3232
/** The city of this address. */
3333
billing_city: string;
3434
/** 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. */
35-
billing_region: string;
35+
billing_state: string;
3636
/** The postal code of the billing address. */
3737
billing_postal_code: string;
3838
/** The country code of the billing address. */
@@ -54,7 +54,7 @@ export interface TransactionTemplate extends Graph {
5454
/** The city of this address. */
5555
shipping_city: string;
5656
/** 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. */
57-
shipping_region: string;
57+
shipping_state: string;
5858
/** The postal code of the shipping address. */
5959
shipping_postal_code: string;
6060
/** The country code of the shipping address. */

src/customer/types.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export interface SignUpParams {
110110
}
111111

112112
export interface Session {
113+
force_password_reset?: boolean;
113114
session_token: string;
114115
expires_in: number;
115116
jwt: string;

0 commit comments

Comments
 (0)