@foxy.io/sdk 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,6 +122,28 @@ class API extends Core.API {
122
122
  this.cache.clear();
123
123
  });
124
124
  }
125
+ /**
126
+ * When logged in with a temporary password, this property getter will return `true`.
127
+ * Will return `false` if password reset is not required or if the session has not been
128
+ * initiated, or if the session was initiated before the introduction of this feature.
129
+ *
130
+ * @returns {boolean} Password reset requirement.
131
+ */
132
+ get usesTemporaryPassword() {
133
+ const session = this.storage.getItem(API.SESSION);
134
+ if (session)
135
+ return !!JSON.parse(session).force_password_reset;
136
+ return false;
137
+ }
138
+ set usesTemporaryPassword(value) {
139
+ API.v8n.boolean.check(value);
140
+ const session = this.storage.getItem(API.SESSION);
141
+ if (session) {
142
+ const storedSession = JSON.parse(session);
143
+ storedSession.force_password_reset = value;
144
+ this.storage.setItem(API.SESSION, JSON.stringify(storedSession));
145
+ }
146
+ }
125
147
  __fetch(input, init) {
126
148
  var _a;
127
149
  return __awaiter(this, void 0, void 0, function* () {
@@ -172,5 +194,6 @@ API.v8n = Object.assign({}, Core.API.v8n, {
172
194
  newPassword: v8n_js_1.v8n().optional(v8n_js_1.v8n().string()),
173
195
  password: v8n_js_1.v8n().string(),
174
196
  }),
197
+ boolean: v8n_js_1.v8n().boolean(),
175
198
  email: v8n_js_1.v8n().string(),
176
199
  });
@@ -100,6 +100,28 @@ export class API extends Core.API {
100
100
  this.cache.clear();
101
101
  });
102
102
  }
103
+ /**
104
+ * When logged in with a temporary password, this property getter will return `true`.
105
+ * Will return `false` if password reset is not required or if the session has not been
106
+ * initiated, or if the session was initiated before the introduction of this feature.
107
+ *
108
+ * @returns {boolean} Password reset requirement.
109
+ */
110
+ get usesTemporaryPassword() {
111
+ const session = this.storage.getItem(API.SESSION);
112
+ if (session)
113
+ return !!JSON.parse(session).force_password_reset;
114
+ return false;
115
+ }
116
+ set usesTemporaryPassword(value) {
117
+ API.v8n.boolean.check(value);
118
+ const session = this.storage.getItem(API.SESSION);
119
+ if (session) {
120
+ const storedSession = JSON.parse(session);
121
+ storedSession.force_password_reset = value;
122
+ this.storage.setItem(API.SESSION, JSON.stringify(storedSession));
123
+ }
124
+ }
103
125
  __fetch(input, init) {
104
126
  var _a;
105
127
  return __awaiter(this, void 0, void 0, function* () {
@@ -149,5 +171,6 @@ API.v8n = Object.assign({}, Core.API.v8n, {
149
171
  newPassword: v8n().optional(v8n().string()),
150
172
  password: v8n().string(),
151
173
  }),
174
+ boolean: v8n().boolean(),
152
175
  email: v8n().string(),
153
176
  });
@@ -80,7 +80,7 @@ export interface Cart extends Graph {
80
80
  /** The city of this address. */
81
81
  billing_city: string;
82
82
  /** 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;
84
84
  /** The postal code of the billing address. */
85
85
  billing_postal_code: string;
86
86
  /** The country code of the billing address. */
@@ -102,7 +102,7 @@ export interface Cart extends Graph {
102
102
  /** The city of this address. */
103
103
  shipping_city: string;
104
104
  /** 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;
106
106
  /** The postal code of the shipping address. */
107
107
  shipping_postal_code: string;
108
108
  /** The country code of the shipping address. */
@@ -38,9 +38,9 @@ export interface Customer extends Graph {
38
38
  /** The date of the last time this customer authenticated with the FoxyCart checkout. */
39
39
  last_login_date: string;
40
40
  /** The customer's given name. */
41
- first_name: string;
41
+ first_name: string | null;
42
42
  /** The customer's surname. */
43
- last_name: string;
43
+ last_name: string | null;
44
44
  /** The customer's email address. This is used as the login to the FoxyCart checkout for this customer. */
45
45
  email: string;
46
46
  /** A tax identification number for this customer. */
@@ -18,6 +18,8 @@ export interface EmailTemplate extends Graph {
18
18
  };
19
19
 
20
20
  props: {
21
+ /** The template text of your receipt email subject. */
22
+ subject: string;
21
23
  /** The description of your email template. */
22
24
  description: string;
23
25
  /** 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. */
@@ -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
+ }
@@ -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
+ }
@@ -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
+ }
@@ -25,7 +25,9 @@ import type { Taxes } from './taxes';
25
25
  import type { TemplateSets } from './template_sets';
26
26
  import type { Transactions } from './transactions';
27
27
  import type { UserAccesses } from './user_accesses';
28
+ import type { UserInvitations } from './user_invitations';
28
29
  import type { Users } from './users';
30
+ import type { Webhooks } from './webhooks';
29
31
  import type { StoreShippingMethods } from './store_shipping_methods';
30
32
 
31
33
  export interface Store extends Graph {
@@ -44,6 +46,8 @@ export interface Store extends Graph {
44
46
  'fx:reports': Reports;
45
47
  /** List of coupons available in this store. */
46
48
  'fx:coupons': Coupons;
49
+ /** List of webhooks configured for this store. */
50
+ 'fx:webhooks': Webhooks;
47
51
  /** List of customers of this store. */
48
52
  'fx:customers': Customers;
49
53
  /** List of gift cards available in this store. */
@@ -70,6 +74,8 @@ export interface Store extends Graph {
70
74
  'fx:email_templates': EmailTemplates;
71
75
  /** List of item categories configured in this store. */
72
76
  'fx:item_categories': ItemCategories;
77
+ /** List of user invitations for this store. */
78
+ 'fx:user_invitations': UserInvitations;
73
79
  /** List of fraud protection measures enabled on this store. */
74
80
  'fx:fraud_protections': FraudProtections;
75
81
  /** List of receipt templates for this store. */
@@ -90,6 +96,14 @@ export interface Store extends Graph {
90
96
  'fx:customer_portal_settings': CustomerPortalSettings;
91
97
  /** POST here to resend the daily subscription webhook notification for this store. */
92
98
  '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' };
93
107
  };
94
108
 
95
109
  props: {
@@ -181,3 +195,36 @@ export interface Store extends Graph {
181
195
  date_modified: string | null;
182
196
  };
183
197
  }
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
+ };
@@ -23,7 +23,7 @@ export interface SubscriptionSettings extends Graph {
23
23
  /** 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. */
24
24
  reattempt_schedule: string;
25
25
  /** 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' | '';
27
27
  /** 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. */
28
28
  reattempt_bypass_strings: string;
29
29
  /** 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. */
@@ -18,6 +18,7 @@ import type { Store } from './store';
18
18
  import type { TransactionLogs } from './transaction_logs';
19
19
  import type { Void } from './void';
20
20
  import type { GiftCardCodeLog } from './gift_card_code_log';
21
+ import type { SendWebhooks } from './send_webhooks';
21
22
  import type { TransactionLog } from './transaction_log';
22
23
  import type { TransactionJournalEntry } from './transaction_journal_entry';
23
24
  import type { TransactionJournalEntries } from './transaction_journal_entries';
@@ -60,6 +61,8 @@ export interface Transaction extends Graph {
60
61
  'fx:applied_taxes': AppliedTaxes;
61
62
  /** List of custom fields on this transaction. */
62
63
  'fx:custom_fields': CustomFields;
64
+ /** POST here to send the webhook notification for this transaction. */
65
+ 'fx:send_webhooks': SendWebhooks;
63
66
  /** POST here to resend the webhook notification for this transaction. */
64
67
  'fx:process_webhook': ProcessWebhook;
65
68
  /** Transaction logs. */
@@ -1,7 +1,9 @@
1
1
  import type { Attributes } from './attributes';
2
2
  import type { DefaultStore } from './default_store';
3
3
  import type { Graph } from '../../core';
4
+ import type { Passkeys } from './passkeys';
4
5
  import type { Stores } from './stores';
6
+ import type { UserInvitations } from './user_invitations';
5
7
 
6
8
  export interface User extends Graph {
7
9
  curie: 'fx:user';
@@ -13,8 +15,12 @@ export interface User extends Graph {
13
15
  'fx:stores': Stores;
14
16
  /** List of custom attributes on this user resource. */
15
17
  'fx:attributes': Attributes;
18
+ /** List of passkeys for this user. */
19
+ 'fx:user_passkeys': Passkeys;
16
20
  /** Default store for this user. */
17
21
  'fx:default_store': DefaultStore;
22
+ /** List of user invitations for this store. */
23
+ 'fx:user_invitations': UserInvitations;
18
24
  };
19
25
 
20
26
  props: {
@@ -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
+ }
@@ -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_invitations';
7
+ links: CollectionGraphLinks<UserInvitations>;
8
+ props: CollectionGraphProps;
9
+ child: UserInvitation;
10
+ }
@@ -89,6 +89,8 @@ export * from './Graph/locale_codes';
89
89
  export * from './Graph/native_integration';
90
90
  export * from './Graph/native_integrations';
91
91
  export * from './Graph/original_transaction';
92
+ export * from './Graph/passkey';
93
+ export * from './Graph/passkeys';
92
94
  export * from './Graph/payment';
93
95
  export * from './Graph/payment_gateway';
94
96
  export * from './Graph/payment_gateways';
@@ -116,6 +118,7 @@ export * from './Graph/reporting_email_exists';
116
118
  export * from './Graph/reporting_store_domain_exists';
117
119
  export * from './Graph/reports';
118
120
  export * from './Graph/send_emails';
121
+ export * from './Graph/send_webhooks';
119
122
  export * from './Graph/shipment';
120
123
  export * from './Graph/shipments';
121
124
  export * from './Graph/shipping_address_types';
@@ -159,6 +162,8 @@ export * from './Graph/transactions';
159
162
  export * from './Graph/user';
160
163
  export * from './Graph/user_access';
161
164
  export * from './Graph/user_accesses';
165
+ export * from './Graph/user_invitation';
166
+ export * from './Graph/user_invitations';
162
167
  export * from './Graph/users';
163
168
  export * from './Graph/void';
164
169
  export * from './Graph/webhook_log';
@@ -17,6 +17,7 @@ export declare class API extends Core.API<Graph> {
17
17
  } & {
18
18
  signUpParams: any;
19
19
  credentials: any;
20
+ boolean: any;
20
21
  email: any;
21
22
  };
22
23
  constructor(params: ConstructorParameters<typeof Core.API>[0]);
@@ -48,5 +49,14 @@ export declare class API extends Core.API<Graph> {
48
49
  }): Promise<void>;
49
50
  /** Destroys current session and clears local session data. */
50
51
  signOut(): Promise<void>;
52
+ /**
53
+ * When logged in with a temporary password, this property getter will return `true`.
54
+ * Will return `false` if password reset is not required or if the session has not been
55
+ * initiated, or if the session was initiated before the introduction of this feature.
56
+ *
57
+ * @returns {boolean} Password reset requirement.
58
+ */
59
+ get usesTemporaryPassword(): boolean;
60
+ set usesTemporaryPassword(value: boolean);
51
61
  private __fetch;
52
62
  }
@@ -64,6 +64,18 @@ export interface CustomerPortalSettings extends Graph {
64
64
  /** Public URL of your terms of service agreement. */
65
65
  url: string;
66
66
  };
67
+ /** List of display preferences that comes from `cart_display_config` in the active `fx:template_config`. */
68
+ cart_display_config: {
69
+ show_product_weight: boolean;
70
+ show_product_category: boolean;
71
+ show_product_code: boolean;
72
+ show_product_options: boolean;
73
+ show_sub_frequency: boolean;
74
+ show_sub_startdate: boolean;
75
+ show_sub_nextdate: boolean;
76
+ show_sub_enddate: boolean;
77
+ hidden_product_options: string[];
78
+ };
67
79
  /** Self-registration settings. Self-registration is disabled if this field is undefined. */
68
80
  sign_up?: {
69
81
  /** Client verification settings. */
@@ -41,9 +41,9 @@ interface Customer extends Graph {
41
41
  /** The date of the last time this customer authenticated with the FoxyCart checkout. */
42
42
  last_login_date: string;
43
43
  /** The customer's given name. */
44
- first_name: string;
44
+ first_name: string | null;
45
45
  /** The customer's surname. */
46
- last_name: string;
46
+ last_name: string | null;
47
47
  /** The customer's email address. This is used as the login to the FoxyCart checkout for this customer. */
48
48
  email: string;
49
49
  /** A tax identification number for this customer. */
@@ -32,7 +32,7 @@ export interface TransactionTemplate extends Graph {
32
32
  /** The city of this address. */
33
33
  billing_city: string;
34
34
  /** 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;
36
36
  /** The postal code of the billing address. */
37
37
  billing_postal_code: string;
38
38
  /** The country code of the billing address. */
@@ -54,7 +54,7 @@ export interface TransactionTemplate extends Graph {
54
54
  /** The city of this address. */
55
55
  shipping_city: string;
56
56
  /** 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;
58
58
  /** The postal code of the shipping address. */
59
59
  shipping_postal_code: string;
60
60
  /** The country code of the shipping address. */
@@ -110,6 +110,7 @@ export interface SignUpParams {
110
110
  }
111
111
 
112
112
  export interface Session {
113
+ force_password_reset?: boolean;
113
114
  session_token: string;
114
115
  expires_in: number;
115
116
  jwt: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/sdk",
3
3
  "type": "commonjs",
4
- "version": "1.12.0",
4
+ "version": "1.14.0",
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",