@foxy.io/sdk 1.11.3 → 1.13.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.
Files changed (29) hide show
  1. package/dist/cdn/FoxySDKCustomer.js +3 -3
  2. package/dist/cjs/customer/API.js +23 -0
  3. package/dist/cjs/customer/PaymentCardEmbed.js +170 -0
  4. package/dist/cjs/customer/index.js +3 -1
  5. package/dist/esm/customer/API.js +23 -0
  6. package/dist/esm/customer/PaymentCardEmbed.js +166 -0
  7. package/dist/esm/customer/index.js +1 -0
  8. package/dist/types/backend/Graph/cart.d.ts +2 -2
  9. package/dist/types/backend/Graph/customer.d.ts +2 -2
  10. package/dist/types/backend/Graph/default_payment_method.d.ts +2 -0
  11. package/dist/types/backend/Graph/email_template.d.ts +2 -0
  12. package/dist/types/backend/Graph/passkey.d.ts +19 -0
  13. package/dist/types/backend/Graph/passkeys.d.ts +10 -0
  14. package/dist/types/backend/Graph/send_webhooks.d.ts +9 -0
  15. package/dist/types/backend/Graph/store.d.ts +47 -0
  16. package/dist/types/backend/Graph/subscription_settings.d.ts +1 -1
  17. package/dist/types/backend/Graph/transaction.d.ts +3 -0
  18. package/dist/types/backend/Graph/user.d.ts +6 -0
  19. package/dist/types/backend/Graph/user_invitation.d.ts +38 -0
  20. package/dist/types/backend/Graph/user_invitations.d.ts +10 -0
  21. package/dist/types/backend/Rels.d.ts +5 -0
  22. package/dist/types/customer/API.d.ts +10 -0
  23. package/dist/types/customer/Graph/default_payment_method.d.ts +2 -2
  24. package/dist/types/customer/Graph/index.d.ts +2 -2
  25. package/dist/types/customer/Graph/transaction_template.d.ts +2 -2
  26. package/dist/types/customer/PaymentCardEmbed.d.ts +69 -0
  27. package/dist/types/customer/index.d.ts +1 -0
  28. package/dist/types/customer/types.d.ts +85 -0
  29. package/package.json +1 -1
@@ -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
  });
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.PaymentCardEmbed = void 0;
15
+ /**
16
+ * A convenience wrapper for the payment card embed iframe. You don't have to use
17
+ * this class to embed the payment card iframe, but it provides a more convenient
18
+ * way to interact with the iframe and listen to its events.
19
+ *
20
+ * @example
21
+ * const embed = new PaymentCardEmbed({
22
+ * url: 'https://embed.foxy.io/v1.html?template_set_id=123'
23
+ * });
24
+ *
25
+ * await embed.mount(document.body);
26
+ * console.log('Token:', await embed.tokenize());
27
+ */
28
+ class PaymentCardEmbed {
29
+ constructor(_a) {
30
+ var { url } = _a, config = __rest(_a, ["url"]);
31
+ /**
32
+ * An event handler that is triggered when Enter is pressed in the card form.
33
+ * This feature is not available for template sets configured with the `stripe_connect`
34
+ * hosted payment gateway due to the limitations of Stripe.js.
35
+ */
36
+ this.onsubmit = null;
37
+ this.__tokenizationRequests = [];
38
+ this.__iframeMessageHandler = (evt) => {
39
+ var _a, _b;
40
+ const data = JSON.parse(evt.data);
41
+ switch (data.type) {
42
+ case 'tokenization_response': {
43
+ const request = this.__tokenizationRequests.find(r => r.id === data.id);
44
+ data.token ? request === null || request === void 0 ? void 0 : request.resolve(data.token) : request === null || request === void 0 ? void 0 : request.reject();
45
+ this.__tokenizationRequests = this.__tokenizationRequests.filter(r => r.id !== data.id);
46
+ break;
47
+ }
48
+ case 'submit': {
49
+ (_a = this.onsubmit) === null || _a === void 0 ? void 0 : _a.call(this);
50
+ break;
51
+ }
52
+ case 'resize': {
53
+ if (this.__iframe)
54
+ this.__iframe.style.height = data.height;
55
+ break;
56
+ }
57
+ case 'ready': {
58
+ this.configure(this.__config);
59
+ (_b = this.__mountingTask) === null || _b === void 0 ? void 0 : _b.resolve();
60
+ break;
61
+ }
62
+ }
63
+ };
64
+ this.__iframeLoadHandler = (evt) => {
65
+ if (this.__channel) {
66
+ const contentWindow = evt.currentTarget.contentWindow;
67
+ if (!contentWindow)
68
+ throw new Error('Content window is not available.');
69
+ contentWindow.postMessage('connect', '*', [this.__channel.port2]);
70
+ }
71
+ };
72
+ this.__mountingTask = null;
73
+ this.__channel = null;
74
+ this.__iframe = null;
75
+ this.__config = config;
76
+ this.__url = url;
77
+ }
78
+ /**
79
+ * Updates the configuration of the payment card embed.
80
+ * You can change style, translations, language and interactivity settings.
81
+ * To change the URL of the payment card embed, you need to create a new instance.
82
+ * You are not required to provide the full configuration object, only the properties you want to change.
83
+ *
84
+ * @param config - The new configuration.
85
+ */
86
+ configure(config) {
87
+ var _a;
88
+ this.__config = config;
89
+ const message = Object.assign({ type: 'config' }, config);
90
+ (_a = this.__channel) === null || _a === void 0 ? void 0 : _a.port1.postMessage(JSON.stringify(message));
91
+ }
92
+ /**
93
+ * Requests the tokenization of the card data.
94
+ *
95
+ * @returns A promise that resolves with the tokenized card data.
96
+ */
97
+ tokenize() {
98
+ return new Promise((resolve, reject) => {
99
+ if (this.__channel) {
100
+ const id = this._createId();
101
+ this.__tokenizationRequests.push({ id, reject, resolve });
102
+ this.__channel.port1.postMessage(JSON.stringify({ id, type: 'tokenization_request' }));
103
+ }
104
+ else {
105
+ reject();
106
+ }
107
+ });
108
+ }
109
+ /**
110
+ * Safely removes the embed iframe from the parent node,
111
+ * closing the message channel and cleaning up event listeners.
112
+ */
113
+ unmount() {
114
+ var _a, _b, _c, _d, _e, _f;
115
+ (_a = this.__channel) === null || _a === void 0 ? void 0 : _a.port1.removeEventListener('message', this.__iframeMessageHandler);
116
+ (_b = this.__channel) === null || _b === void 0 ? void 0 : _b.port1.close();
117
+ (_c = this.__channel) === null || _c === void 0 ? void 0 : _c.port2.close();
118
+ this.__channel = null;
119
+ (_d = this.__iframe) === null || _d === void 0 ? void 0 : _d.removeEventListener('load', this.__iframeLoadHandler);
120
+ (_e = this.__iframe) === null || _e === void 0 ? void 0 : _e.remove();
121
+ this.__iframe = null;
122
+ (_f = this.__mountingTask) === null || _f === void 0 ? void 0 : _f.reject();
123
+ this.__mountingTask = null;
124
+ }
125
+ /**
126
+ * Mounts the payment card embed in the given root element. If the embed is already mounted,
127
+ * it will be unmounted first.
128
+ *
129
+ * @param root - The root element to mount the embed in.
130
+ * @returns A promise that resolves when the embed is mounted.
131
+ */
132
+ mount(root) {
133
+ this.unmount();
134
+ this.__channel = this._createMessageChannel();
135
+ this.__channel.port1.addEventListener('message', this.__iframeMessageHandler);
136
+ this.__channel.port1.start();
137
+ this.__iframe = this._createIframe(root);
138
+ this.__iframe.addEventListener('load', this.__iframeLoadHandler);
139
+ this.__iframe.style.transition = 'height 0.15s ease';
140
+ this.__iframe.style.margin = '-2px';
141
+ this.__iframe.style.height = '100px';
142
+ this.__iframe.style.width = 'calc(100% + 4px)';
143
+ this.__iframe.src = this.__url;
144
+ root.append(this.__iframe);
145
+ return new Promise((resolve, reject) => {
146
+ this.__mountingTask = { reject, resolve };
147
+ });
148
+ }
149
+ /**
150
+ * Clears the card data from the embed.
151
+ * No-op if the embed is not mounted.
152
+ */
153
+ clear() {
154
+ var _a;
155
+ (_a = this.__channel) === null || _a === void 0 ? void 0 : _a.port1.postMessage(JSON.stringify({ type: 'clear' }));
156
+ }
157
+ /* v8 ignore next */
158
+ _createMessageChannel() {
159
+ return new MessageChannel();
160
+ }
161
+ /* v8 ignore next */
162
+ _createIframe(root) {
163
+ return root.ownerDocument.createElement('iframe');
164
+ }
165
+ /* v8 ignore next */
166
+ _createId() {
167
+ return `${Date.now()}${Math.random().toFixed(6).slice(2)}`;
168
+ }
169
+ }
170
+ exports.PaymentCardEmbed = PaymentCardEmbed;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isNextTransactionDate = exports.getTimeFromFrequency = exports.getNextTransactionDateConstraints = exports.getAllowedFrequencies = exports.API = void 0;
3
+ exports.PaymentCardEmbed = exports.isNextTransactionDate = exports.getTimeFromFrequency = exports.getNextTransactionDateConstraints = exports.getAllowedFrequencies = exports.API = void 0;
4
4
  var API_js_1 = require("./API.js");
5
5
  Object.defineProperty(exports, "API", { enumerable: true, get: function () { return API_js_1.API; } });
6
6
  var getAllowedFrequencies_js_1 = require("./getAllowedFrequencies.js");
@@ -11,3 +11,5 @@ var getTimeFromFrequency_js_1 = require("../backend/getTimeFromFrequency.js");
11
11
  Object.defineProperty(exports, "getTimeFromFrequency", { enumerable: true, get: function () { return getTimeFromFrequency_js_1.getTimeFromFrequency; } });
12
12
  var isNextTransactionDate_js_1 = require("./isNextTransactionDate.js");
13
13
  Object.defineProperty(exports, "isNextTransactionDate", { enumerable: true, get: function () { return isNextTransactionDate_js_1.isNextTransactionDate; } });
14
+ var PaymentCardEmbed_js_1 = require("./PaymentCardEmbed.js");
15
+ Object.defineProperty(exports, "PaymentCardEmbed", { enumerable: true, get: function () { return PaymentCardEmbed_js_1.PaymentCardEmbed; } });
@@ -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
  });
@@ -0,0 +1,166 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ /**
13
+ * A convenience wrapper for the payment card embed iframe. You don't have to use
14
+ * this class to embed the payment card iframe, but it provides a more convenient
15
+ * way to interact with the iframe and listen to its events.
16
+ *
17
+ * @example
18
+ * const embed = new PaymentCardEmbed({
19
+ * url: 'https://embed.foxy.io/v1.html?template_set_id=123'
20
+ * });
21
+ *
22
+ * await embed.mount(document.body);
23
+ * console.log('Token:', await embed.tokenize());
24
+ */
25
+ export class PaymentCardEmbed {
26
+ constructor(_a) {
27
+ var { url } = _a, config = __rest(_a, ["url"]);
28
+ /**
29
+ * An event handler that is triggered when Enter is pressed in the card form.
30
+ * This feature is not available for template sets configured with the `stripe_connect`
31
+ * hosted payment gateway due to the limitations of Stripe.js.
32
+ */
33
+ this.onsubmit = null;
34
+ this.__tokenizationRequests = [];
35
+ this.__iframeMessageHandler = (evt) => {
36
+ var _a, _b;
37
+ const data = JSON.parse(evt.data);
38
+ switch (data.type) {
39
+ case 'tokenization_response': {
40
+ const request = this.__tokenizationRequests.find(r => r.id === data.id);
41
+ data.token ? request === null || request === void 0 ? void 0 : request.resolve(data.token) : request === null || request === void 0 ? void 0 : request.reject();
42
+ this.__tokenizationRequests = this.__tokenizationRequests.filter(r => r.id !== data.id);
43
+ break;
44
+ }
45
+ case 'submit': {
46
+ (_a = this.onsubmit) === null || _a === void 0 ? void 0 : _a.call(this);
47
+ break;
48
+ }
49
+ case 'resize': {
50
+ if (this.__iframe)
51
+ this.__iframe.style.height = data.height;
52
+ break;
53
+ }
54
+ case 'ready': {
55
+ this.configure(this.__config);
56
+ (_b = this.__mountingTask) === null || _b === void 0 ? void 0 : _b.resolve();
57
+ break;
58
+ }
59
+ }
60
+ };
61
+ this.__iframeLoadHandler = (evt) => {
62
+ if (this.__channel) {
63
+ const contentWindow = evt.currentTarget.contentWindow;
64
+ if (!contentWindow)
65
+ throw new Error('Content window is not available.');
66
+ contentWindow.postMessage('connect', '*', [this.__channel.port2]);
67
+ }
68
+ };
69
+ this.__mountingTask = null;
70
+ this.__channel = null;
71
+ this.__iframe = null;
72
+ this.__config = config;
73
+ this.__url = url;
74
+ }
75
+ /**
76
+ * Updates the configuration of the payment card embed.
77
+ * You can change style, translations, language and interactivity settings.
78
+ * To change the URL of the payment card embed, you need to create a new instance.
79
+ * You are not required to provide the full configuration object, only the properties you want to change.
80
+ *
81
+ * @param config - The new configuration.
82
+ */
83
+ configure(config) {
84
+ var _a;
85
+ this.__config = config;
86
+ const message = Object.assign({ type: 'config' }, config);
87
+ (_a = this.__channel) === null || _a === void 0 ? void 0 : _a.port1.postMessage(JSON.stringify(message));
88
+ }
89
+ /**
90
+ * Requests the tokenization of the card data.
91
+ *
92
+ * @returns A promise that resolves with the tokenized card data.
93
+ */
94
+ tokenize() {
95
+ return new Promise((resolve, reject) => {
96
+ if (this.__channel) {
97
+ const id = this._createId();
98
+ this.__tokenizationRequests.push({ id, reject, resolve });
99
+ this.__channel.port1.postMessage(JSON.stringify({ id, type: 'tokenization_request' }));
100
+ }
101
+ else {
102
+ reject();
103
+ }
104
+ });
105
+ }
106
+ /**
107
+ * Safely removes the embed iframe from the parent node,
108
+ * closing the message channel and cleaning up event listeners.
109
+ */
110
+ unmount() {
111
+ var _a, _b, _c, _d, _e, _f;
112
+ (_a = this.__channel) === null || _a === void 0 ? void 0 : _a.port1.removeEventListener('message', this.__iframeMessageHandler);
113
+ (_b = this.__channel) === null || _b === void 0 ? void 0 : _b.port1.close();
114
+ (_c = this.__channel) === null || _c === void 0 ? void 0 : _c.port2.close();
115
+ this.__channel = null;
116
+ (_d = this.__iframe) === null || _d === void 0 ? void 0 : _d.removeEventListener('load', this.__iframeLoadHandler);
117
+ (_e = this.__iframe) === null || _e === void 0 ? void 0 : _e.remove();
118
+ this.__iframe = null;
119
+ (_f = this.__mountingTask) === null || _f === void 0 ? void 0 : _f.reject();
120
+ this.__mountingTask = null;
121
+ }
122
+ /**
123
+ * Mounts the payment card embed in the given root element. If the embed is already mounted,
124
+ * it will be unmounted first.
125
+ *
126
+ * @param root - The root element to mount the embed in.
127
+ * @returns A promise that resolves when the embed is mounted.
128
+ */
129
+ mount(root) {
130
+ this.unmount();
131
+ this.__channel = this._createMessageChannel();
132
+ this.__channel.port1.addEventListener('message', this.__iframeMessageHandler);
133
+ this.__channel.port1.start();
134
+ this.__iframe = this._createIframe(root);
135
+ this.__iframe.addEventListener('load', this.__iframeLoadHandler);
136
+ this.__iframe.style.transition = 'height 0.15s ease';
137
+ this.__iframe.style.margin = '-2px';
138
+ this.__iframe.style.height = '100px';
139
+ this.__iframe.style.width = 'calc(100% + 4px)';
140
+ this.__iframe.src = this.__url;
141
+ root.append(this.__iframe);
142
+ return new Promise((resolve, reject) => {
143
+ this.__mountingTask = { reject, resolve };
144
+ });
145
+ }
146
+ /**
147
+ * Clears the card data from the embed.
148
+ * No-op if the embed is not mounted.
149
+ */
150
+ clear() {
151
+ var _a;
152
+ (_a = this.__channel) === null || _a === void 0 ? void 0 : _a.port1.postMessage(JSON.stringify({ type: 'clear' }));
153
+ }
154
+ /* v8 ignore next */
155
+ _createMessageChannel() {
156
+ return new MessageChannel();
157
+ }
158
+ /* v8 ignore next */
159
+ _createIframe(root) {
160
+ return root.ownerDocument.createElement('iframe');
161
+ }
162
+ /* v8 ignore next */
163
+ _createId() {
164
+ return `${Date.now()}${Math.random().toFixed(6).slice(2)}`;
165
+ }
166
+ }
@@ -3,3 +3,4 @@ export { getAllowedFrequencies } from './getAllowedFrequencies.js';
3
3
  export { getNextTransactionDateConstraints } from './getNextTransactionDateConstraints.js';
4
4
  export { getTimeFromFrequency } from '../backend/getTimeFromFrequency.js';
5
5
  export { isNextTransactionDate } from './isNextTransactionDate.js';
6
+ export { PaymentCardEmbed } from './PaymentCardEmbed.js';
@@ -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. */
@@ -19,6 +19,8 @@ export interface DefaultPaymentMethod extends Graph {
19
19
  save_cc: boolean;
20
20
  /** The credit card or debit card type. This will be determined automatically once the payment card is saved. */
21
21
  cc_type: string | null;
22
+ /** Token returned by our Tokenization Embed. Send this field with PATCH to update customer's payment method. */
23
+ cc_token?: string;
22
24
  /** The payment card number. This property will not be displayed as part of this resource, but can be used to modify this payment method. */
23
25
  cc_number?: number;
24
26
  /** A masked version of this payment card showing only the last 4 digits. */
@@ -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: {