Skip to content

Commit

Permalink
Merge pull request #62 from Foxy/release/1.13.0
Browse files Browse the repository at this point in the history
chore: release v1.13.0
  • Loading branch information
brettflorio authored Jan 13, 2025
2 parents 959f4b4 + 8b12654 commit de09d60
Show file tree
Hide file tree
Showing 18 changed files with 234 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/backend/Graph/cart.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface Cart extends Graph {
/** The city of this address. */
billing_city: string;
/** 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. */
billing_region: string;
billing_state: string;
/** The postal code of the billing address. */
billing_postal_code: string;
/** The country code of the billing address. */
Expand All @@ -102,7 +102,7 @@ export interface Cart extends Graph {
/** The city of this address. */
shipping_city: string;
/** 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. */
shipping_region: string;
shipping_state: string;
/** The postal code of the shipping address. */
shipping_postal_code: string;
/** The country code of the shipping address. */
Expand Down
4 changes: 2 additions & 2 deletions src/backend/Graph/customer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export interface Customer extends Graph {
/** The date of the last time this customer authenticated with the FoxyCart checkout. */
last_login_date: string;
/** The customer's given name. */
first_name: string;
first_name: string | null;
/** The customer's surname. */
last_name: string;
last_name: string | null;
/** The customer's email address. This is used as the login to the FoxyCart checkout for this customer. */
email: string;
/** A tax identification number for this customer. */
Expand Down
2 changes: 2 additions & 0 deletions src/backend/Graph/email_template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export interface EmailTemplate extends Graph {
};

props: {
/** The template text of your receipt email subject. */
subject: string;
/** The description of your email template. */
description: string;
/** 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. */
Expand Down
19 changes: 19 additions & 0 deletions src/backend/Graph/passkey.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { Graph } from '../../core';
import type { Passkeys } from './passkeys';
import type { User } from './user';

export interface Passkey extends Graph {
curie: 'fx:passkey';
links: {
'self': Passkey;
'fx:user': User;
'fx:user_passkeys': Passkeys;
};
props: {
last_login_date: string | null;
last_login_ua: string | null;
credential_id: string;
date_created: string | null;
date_modified: string | null;
};
}
10 changes: 10 additions & 0 deletions src/backend/Graph/passkeys.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
import type { Graph } from '../../core';
import type { Passkey } from './passkey';

export interface Passkeys extends Graph {
curie: 'fx:passkeys';
links: CollectionGraphLinks<Passkeys>;
props: CollectionGraphProps;
child: Passkey;
}
9 changes: 9 additions & 0 deletions src/backend/Graph/send_webhooks.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { Graph } from '../../core';

export interface SendWebhooks extends Graph {
curie: 'fx:send_webhooks';
props: {
refeed_hooks: number[];
event: string;
};
}
47 changes: 47 additions & 0 deletions src/backend/Graph/store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import type { Taxes } from './taxes';
import type { TemplateSets } from './template_sets';
import type { Transactions } from './transactions';
import type { UserAccesses } from './user_accesses';
import type { UserInvitations } from './user_invitations';
import type { Users } from './users';
import type { Webhooks } from './webhooks';
import type { StoreShippingMethods } from './store_shipping_methods';

export interface Store extends Graph {
Expand All @@ -44,6 +46,8 @@ export interface Store extends Graph {
'fx:reports': Reports;
/** List of coupons available in this store. */
'fx:coupons': Coupons;
/** List of webhooks configured for this store. */
'fx:webhooks': Webhooks;
/** List of customers of this store. */
'fx:customers': Customers;
/** List of gift cards available in this store. */
Expand All @@ -70,6 +74,8 @@ export interface Store extends Graph {
'fx:email_templates': EmailTemplates;
/** List of item categories configured in this store. */
'fx:item_categories': ItemCategories;
/** List of user invitations for this store. */
'fx:user_invitations': UserInvitations;
/** List of fraud protection measures enabled on this store. */
'fx:fraud_protections': FraudProtections;
/** List of receipt templates for this store. */
Expand All @@ -90,6 +96,14 @@ export interface Store extends Graph {
'fx:customer_portal_settings': CustomerPortalSettings;
/** POST here to resend the daily subscription webhook notification for this store. */
'fx:process_subscription_webhook': ProcessSubscriptionWebhook;
/** Add-to-cart URL for the Standard plan with yearly billing. */
'fx:activate_store_yearly_url': { curie: 'fx:activate_store_yearly_url' };
/** Add-to-cart URL for the Standard plan with monthly billing. */
'fx:activate_store_monthly_url': { curie: 'fx:activate_store_monthly_url' };
/** Add-to-cart URL for the Advanced plan with yearly billing. */
'fx:activate_store_advanced_yearly_url': { curie: 'fx:activate_store_advanced_yearly_url' };
/** Add-to-cart URL for the Advanced plan with monthly billing. */
'fx:activate_store_advanced_monthly_url': { curie: 'fx:activate_store_advanced_monthly_url' };
};

props: {
Expand Down Expand Up @@ -181,3 +195,36 @@ export interface Store extends Graph {
date_modified: string | null;
};
}

export type StoreWebhookKeyJson = {
cart_signing: string;
xml_datafeed: string;
api_legacy: string;
sso: string;
};

export type StoreSmtpConfigJson = {
username: string;
password: string;
security: string;
host: string;
port: string;
};

export type StoreCustomDisplayIdConfigJson = {
enabled: boolean;
start: string;
length: string;
prefix: string;
suffix: string;
transaction_journal_entries: {
enabled: boolean;
transaction_separator: string;
log_detail_request_types: {
transaction_authcapture: { prefix: string };
transaction_capture: { prefix: string };
transaction_refund: { prefix: string };
transaction_void: { prefix: string };
};
};
};
2 changes: 1 addition & 1 deletion src/backend/Graph/subscription_settings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface SubscriptionSettings extends Graph {
/** 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. */
reattempt_schedule: string;
/** 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. */
reattempt_bypass_logic: 'skip_if_exists' | 'reattempt_if_exists';
reattempt_bypass_logic: 'skip_if_exists' | 'reattempt_if_exists' | '';
/** 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. */
reattempt_bypass_strings: string;
/** 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. */
Expand Down
3 changes: 3 additions & 0 deletions src/backend/Graph/transaction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type { Store } from './store';
import type { TransactionLogs } from './transaction_logs';
import type { Void } from './void';
import type { GiftCardCodeLog } from './gift_card_code_log';
import type { SendWebhooks } from './send_webhooks';
import type { TransactionLog } from './transaction_log';
import type { TransactionJournalEntry } from './transaction_journal_entry';
import type { TransactionJournalEntries } from './transaction_journal_entries';
Expand Down Expand Up @@ -60,6 +61,8 @@ export interface Transaction extends Graph {
'fx:applied_taxes': AppliedTaxes;
/** List of custom fields on this transaction. */
'fx:custom_fields': CustomFields;
/** POST here to send the webhook notification for this transaction. */
'fx:send_webhooks': SendWebhooks;
/** POST here to resend the webhook notification for this transaction. */
'fx:process_webhook': ProcessWebhook;
/** Transaction logs. */
Expand Down
6 changes: 6 additions & 0 deletions src/backend/Graph/user.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { Attributes } from './attributes';
import type { DefaultStore } from './default_store';
import type { Graph } from '../../core';
import type { Passkeys } from './passkeys';
import type { Stores } from './stores';
import type { UserInvitations } from './user_invitations';

export interface User extends Graph {
curie: 'fx:user';
Expand All @@ -13,8 +15,12 @@ export interface User extends Graph {
'fx:stores': Stores;
/** List of custom attributes on this user resource. */
'fx:attributes': Attributes;
/** List of passkeys for this user. */
'fx:user_passkeys': Passkeys;
/** Default store for this user. */
'fx:default_store': DefaultStore;
/** List of user invitations for this store. */
'fx:user_invitations': UserInvitations;
};

props: {
Expand Down
38 changes: 38 additions & 0 deletions src/backend/Graph/user_invitation.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { Graph } from '../../core';
import type { Store } from './store';
import type { User } from './user';

export interface UserInvitation extends Graph {
curie: 'fx:user_invitation';
links: {
'self': UserInvitation;
'fx:user': User;
'fx:store': Store;
'fx:resend': { curie: 'fx:resend' };
'fx:accept': { curie: 'fx:accept' };
'fx:reject': { curie: 'fx:reject' };
'fx:revoke': { curie: 'fx:revoke' };
};
props: {
/* Read-only website URL of the store that the user is invited to. */
store_url: string;
/* Read-only name of the store that the user is invited to. */
store_name: string;
/* Read-only email of the store that the user is invited to. */
store_email: string;
/* Read-only (sub)domain of the store that the user is invited to. */
store_domain: string;
/* Read-only first name of the user that is invited. */
first_name: string | null;
/* Read-only last name of the user that is invited. */
last_name: string | null;
/* Read-only email of the user that is invited. */
email: string;
/* Read-only status of the invitation, `sent` on creation. Use POST actions in links to change the status. */
status: 'sent' | 'accepted' | 'rejected' | 'revoked' | 'expired';
/* Read-only date the invitation was created. */
date_created: string;
/* Read-only date the invitation was last modified. */
date_modified: string;
};
}
10 changes: 10 additions & 0 deletions src/backend/Graph/user_invitations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { CollectionGraphLinks, CollectionGraphProps } from '../../core/defaults';
import type { Graph } from '../../core';
import type { UserInvitation } from './user_invitation';

export interface UserInvitations extends Graph {
curie: 'fx:user_accesses';
links: CollectionGraphLinks<UserInvitations>;
props: CollectionGraphProps;
child: UserInvitation;
}
5 changes: 5 additions & 0 deletions src/backend/Rels.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export * from './Graph/locale_codes';
export * from './Graph/native_integration';
export * from './Graph/native_integrations';
export * from './Graph/original_transaction';
export * from './Graph/passkey';
export * from './Graph/passkeys';
export * from './Graph/payment';
export * from './Graph/payment_gateway';
export * from './Graph/payment_gateways';
Expand Down Expand Up @@ -116,6 +118,7 @@ export * from './Graph/reporting_email_exists';
export * from './Graph/reporting_store_domain_exists';
export * from './Graph/reports';
export * from './Graph/send_emails';
export * from './Graph/send_webhooks';
export * from './Graph/shipment';
export * from './Graph/shipments';
export * from './Graph/shipping_address_types';
Expand Down Expand Up @@ -159,6 +162,8 @@ export * from './Graph/transactions';
export * from './Graph/user';
export * from './Graph/user_access';
export * from './Graph/user_accesses';
export * from './Graph/user_invitation';
export * from './Graph/user_invitations';
export * from './Graph/users';
export * from './Graph/void';
export * from './Graph/webhook_log';
Expand Down
24 changes: 24 additions & 0 deletions src/customer/API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class API extends Core.API<Graph> {
newPassword: v8n().optional(v8n().string()),
password: v8n().string(),
}),
boolean: v8n().boolean(),
email: v8n().string(),
});

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

/**
* When logged in with a temporary password, this property getter will return `true`.
* Will return `false` if password reset is not required or if the session has not been
* initiated, or if the session was initiated before the introduction of this feature.
*
* @returns {boolean} Password reset requirement.
*/
get usesTemporaryPassword(): boolean {
const session = this.storage.getItem(API.SESSION);
if (session) return !!(JSON.parse(session) as StoredSession).force_password_reset;
return false;
}

set usesTemporaryPassword(value: boolean) {
API.v8n.boolean.check(value);
const session = this.storage.getItem(API.SESSION);
if (session) {
const storedSession = JSON.parse(session) as StoredSession;
storedSession.force_password_reset = value;
this.storage.setItem(API.SESSION, JSON.stringify(storedSession));
}
}

private async __fetch(input: RequestInfo, init?: RequestInit): Promise<Response> {
let session = JSON.parse(this.storage.getItem(API.SESSION) ?? 'null') as StoredSession | null;
const request = new Request(input, init);
Expand Down
4 changes: 2 additions & 2 deletions src/customer/Graph/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ interface Customer extends Graph {
/** The date of the last time this customer authenticated with the FoxyCart checkout. */
last_login_date: string;
/** The customer's given name. */
first_name: string;
first_name: string | null;
/** The customer's surname. */
last_name: string;
last_name: string | null;
/** The customer's email address. This is used as the login to the FoxyCart checkout for this customer. */
email: string;
/** A tax identification number for this customer. */
Expand Down
4 changes: 2 additions & 2 deletions src/customer/Graph/transaction_template.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface TransactionTemplate extends Graph {
/** The city of this address. */
billing_city: string;
/** 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. */
billing_region: string;
billing_state: string;
/** The postal code of the billing address. */
billing_postal_code: string;
/** The country code of the billing address. */
Expand All @@ -54,7 +54,7 @@ export interface TransactionTemplate extends Graph {
/** The city of this address. */
shipping_city: string;
/** 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. */
shipping_region: string;
shipping_state: string;
/** The postal code of the shipping address. */
shipping_postal_code: string;
/** The country code of the shipping address. */
Expand Down
1 change: 1 addition & 0 deletions src/customer/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface SignUpParams {
}

export interface Session {
force_password_reset?: boolean;
session_token: string;
expires_in: number;
jwt: string;
Expand Down
Loading

0 comments on commit de09d60

Please sign in to comment.