@final-commerce/command-frame 0.14.1-online.3 → 0.15.0-staging.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/README.md +10 -0
- package/dist/CommonTypes.d.ts +2 -1
- package/dist/actions/add-booking-to-cart/mock.js +1 -1
- package/dist/actions/add-booking-to-cart/types.d.ts +33 -4
- package/dist/actions/attach-checkout-contact/types.d.ts +2 -14
- package/dist/actions/delete-custom-table-data/mock.js +2 -0
- package/dist/actions/get-active-user/mock.js +3 -1
- package/dist/actions/get-booking-rental-ends/action.d.ts +6 -0
- package/dist/actions/get-booking-rental-ends/action.js +8 -0
- package/dist/actions/get-booking-rental-ends/mock.d.ts +2 -0
- package/dist/actions/get-booking-rental-ends/mock.js +6 -0
- package/dist/actions/get-booking-rental-ends/types.d.ts +31 -0
- package/dist/actions/get-booking-rental-ends/types.js +1 -0
- package/dist/actions/get-cash-change/action.d.ts +2 -0
- package/dist/actions/get-cash-change/action.js +8 -0
- package/dist/actions/get-cash-change/mock.d.ts +2 -0
- package/dist/actions/get-cash-change/mock.js +6 -0
- package/dist/actions/get-cash-change/types.d.ts +23 -0
- package/dist/actions/get-cash-change/types.js +1 -0
- package/dist/actions/get-checkout-status/types.d.ts +0 -9
- package/dist/actions/get-custom-table-data/mock.d.ts +5 -0
- package/dist/actions/get-custom-table-data/mock.js +16 -27
- package/dist/actions/get-orders-summary/action.d.ts +2 -0
- package/dist/actions/get-orders-summary/action.js +5 -0
- package/dist/actions/get-orders-summary/mock.d.ts +2 -0
- package/dist/actions/get-orders-summary/mock.js +5 -0
- package/dist/actions/get-orders-summary/types.d.ts +24 -0
- package/dist/actions/get-orders-summary/types.js +1 -0
- package/dist/actions/hold-booking/mock.d.ts +1 -0
- package/dist/actions/hold-booking/mock.js +27 -13
- package/dist/actions/hold-booking/types.d.ts +35 -6
- package/dist/actions/partial-payment/types.d.ts +5 -0
- package/dist/actions/process-partial-refund/mock.js +5 -0
- package/dist/actions/tap-to-pay-payment/mock.js +2 -1
- package/dist/actions/terminal-payment/mock.js +2 -1
- package/dist/actions/upsert-custom-table-data/mock.d.ts +6 -0
- package/dist/actions/upsert-custom-table-data/mock.js +25 -9
- package/dist/demo/database.d.ts +16 -0
- package/dist/demo/database.js +18 -2
- package/dist/demo/mocks/custom-tables.d.ts +4 -1
- package/dist/demo/mocks/custom-tables.js +1 -0
- package/dist/index.d.ts +6 -16
- package/dist/index.js +6 -17
- package/dist/projects/render/mocks.js +6 -16
- package/dist/projects/render/types.d.ts +4 -10
- package/package.json +2 -2
- package/dist/actions/get-address-details/action.d.ts +0 -6
- package/dist/actions/get-address-details/action.js +0 -8
- package/dist/actions/get-address-details/mock.d.ts +0 -2
- package/dist/actions/get-address-details/mock.js +0 -7
- package/dist/actions/get-address-details/types.d.ts +0 -22
- package/dist/actions/get-address-details/types.js +0 -3
- package/dist/actions/get-shopper-account/action.d.ts +0 -6
- package/dist/actions/get-shopper-account/action.js +0 -8
- package/dist/actions/get-shopper-account/mock.d.ts +0 -3
- package/dist/actions/get-shopper-account/mock.js +0 -12
- package/dist/actions/get-shopper-account/types.d.ts +0 -46
- package/dist/actions/get-shopper-account/types.js +0 -6
- package/dist/actions/get-shopper-order/action.d.ts +0 -6
- package/dist/actions/get-shopper-order/action.js +0 -8
- package/dist/actions/get-shopper-order/mock.d.ts +0 -2
- package/dist/actions/get-shopper-order/mock.js +0 -24
- package/dist/actions/get-shopper-order/types.d.ts +0 -32
- package/dist/actions/get-shopper-order/types.js +0 -6
- package/dist/actions/get-shopper-orders/action.d.ts +0 -6
- package/dist/actions/get-shopper-orders/action.js +0 -8
- package/dist/actions/get-shopper-orders/mock.d.ts +0 -2
- package/dist/actions/get-shopper-orders/mock.js +0 -18
- package/dist/actions/get-shopper-orders/types.d.ts +0 -29
- package/dist/actions/get-shopper-orders/types.js +0 -6
- package/dist/actions/request-shopper-code/action.d.ts +0 -6
- package/dist/actions/request-shopper-code/action.js +0 -8
- package/dist/actions/request-shopper-code/mock.d.ts +0 -2
- package/dist/actions/request-shopper-code/mock.js +0 -4
- package/dist/actions/request-shopper-code/types.d.ts +0 -17
- package/dist/actions/request-shopper-code/types.js +0 -6
- package/dist/actions/search-addresses/action.d.ts +0 -6
- package/dist/actions/search-addresses/action.js +0 -8
- package/dist/actions/search-addresses/mock.d.ts +0 -3
- package/dist/actions/search-addresses/mock.js +0 -24
- package/dist/actions/search-addresses/types.d.ts +0 -31
- package/dist/actions/search-addresses/types.js +0 -5
- package/dist/actions/sign-in-shopper/action.d.ts +0 -6
- package/dist/actions/sign-in-shopper/action.js +0 -8
- package/dist/actions/sign-in-shopper/mock.d.ts +0 -2
- package/dist/actions/sign-in-shopper/mock.js +0 -7
- package/dist/actions/sign-in-shopper/types.d.ts +0 -19
- package/dist/actions/sign-in-shopper/types.js +0 -6
- package/dist/actions/sign-out-shopper/action.d.ts +0 -6
- package/dist/actions/sign-out-shopper/action.js +0 -8
- package/dist/actions/sign-out-shopper/mock.d.ts +0 -2
- package/dist/actions/sign-out-shopper/mock.js +0 -4
- package/dist/actions/sign-out-shopper/types.d.ts +0 -7
- package/dist/actions/sign-out-shopper/types.js +0 -6
|
@@ -1,17 +1,33 @@
|
|
|
1
|
+
import { MOCK_CUSTOM_TABLE_DATA } from '../../demo/mocks/custom-tables';
|
|
2
|
+
import { assertMockCustomTableWriteNotDeclined, mockPublishEvent } from '../../demo/database';
|
|
3
|
+
import { generateMongoID } from '@final-commerce/common';
|
|
4
|
+
/**
|
|
5
|
+
* The host's upsert (kaching upsert-custom-table-data/handler.ts, customTables.ts:120-271): an `_id` of an existing row
|
|
6
|
+
* updates it, anything else inserts (a given `_id` kept as-is); `createdAt`/`updatedAt` are the host's; the row is
|
|
7
|
+
* stored, so getCustomTableData reads it back. Not modelled: the table's field schema — the host drops keys that are
|
|
8
|
+
* not fields of the table and refuses an unknown table; the mock stores every key.
|
|
9
|
+
*/
|
|
1
10
|
export const mockUpsertCustomTableData = async (params) => {
|
|
11
|
+
var _a;
|
|
2
12
|
console.log('[Mock] upsertCustomTableData called', params);
|
|
3
|
-
|
|
13
|
+
if (!params?.tableName)
|
|
14
|
+
throw new Error('tableName is required');
|
|
15
|
+
assertMockCustomTableWriteNotDeclined(params.tableName);
|
|
16
|
+
const { _id: givenId, ...fields } = (params.data ?? {});
|
|
17
|
+
delete fields.createdAt;
|
|
18
|
+
delete fields.updatedAt;
|
|
19
|
+
const rows = (MOCK_CUSTOM_TABLE_DATA[_a = params.tableName] ?? (MOCK_CUSTOM_TABLE_DATA[_a] = []));
|
|
4
20
|
const now = new Date().toISOString();
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
21
|
+
const existing = typeof givenId === 'string' ? rows.find((row) => row._id === givenId) : undefined;
|
|
22
|
+
const row = existing
|
|
23
|
+
? Object.assign(existing, fields, { updatedAt: now })
|
|
24
|
+
: { _id: typeof givenId === 'string' ? givenId : generateMongoID(), ...fields, createdAt: now, updatedAt: now };
|
|
25
|
+
if (!existing)
|
|
26
|
+
rows.push(row);
|
|
27
|
+
mockPublishEvent('custom-tables', existing ? 'row-updated' : 'row-created', { tableName: params.tableName, ...row });
|
|
12
28
|
return {
|
|
13
29
|
success: true,
|
|
14
|
-
data:
|
|
30
|
+
data: { ...row },
|
|
15
31
|
timestamp: now,
|
|
16
32
|
};
|
|
17
33
|
};
|
package/dist/demo/database.d.ts
CHANGED
|
@@ -23,6 +23,17 @@ export interface MockDatabaseConfig {
|
|
|
23
23
|
orderStatuses?: CFOrderStatusDefinition[];
|
|
24
24
|
/** Products hidden at an outlet (the host's `catalog-visibility`, product-level rows). Empty = sold everywhere. */
|
|
25
25
|
catalogVisibility?: MockCatalogVisibility[];
|
|
26
|
+
/** MOCK ONLY — the switch a test flips to make the host refuse. Absent = everything succeeds. */
|
|
27
|
+
declines?: MockDeclines;
|
|
28
|
+
}
|
|
29
|
+
/** MOCK ONLY: what the mock host refuses, so a test can see how a flow treats a failure. A real till never reads this. */
|
|
30
|
+
export interface MockDeclines {
|
|
31
|
+
/** Card payments that are declined: `terminalPayment` (cloud or reader) and `tapToPayPayment`. Cash never declines. */
|
|
32
|
+
payments?: ('terminal' | 'tapToPay')[];
|
|
33
|
+
/** Every `processPartialRefund` fails. */
|
|
34
|
+
refunds?: boolean;
|
|
35
|
+
/** Every `upsertCustomTableData` / `deleteCustomTableData` rejects with the till's only refusal text for a table write. */
|
|
36
|
+
customTableWrites?: boolean;
|
|
26
37
|
}
|
|
27
38
|
export interface MockCatalogVisibility {
|
|
28
39
|
productId: string;
|
|
@@ -124,6 +135,11 @@ export declare const MOCK_ORDER_STATUSES: CFOrderStatusDefinition[];
|
|
|
124
135
|
export declare function setMockDatabase(config: Partial<MockDatabaseConfig>): void;
|
|
125
136
|
export declare const safeSerialize: <T>(data: T) => T;
|
|
126
137
|
type MockEventCallback = (event: any) => void;
|
|
138
|
+
export declare let MOCK_DECLINES: MockDeclines;
|
|
139
|
+
/** MOCK ONLY: the dataset's `declines.payments` switch, failing with the till processor's text (kaching `dispatchPay.ts:208-220`). */
|
|
140
|
+
export declare const assertMockPaymentNotDeclined: (paymentType: "terminal" | "tapToPay", cloud: boolean) => void;
|
|
141
|
+
/** MOCK ONLY: the dataset's `declines.customTableWrites` switch, refusing with the till's text (kaching `customTables.ts:131,291`). */
|
|
142
|
+
export declare const assertMockCustomTableWriteNotDeclined: (tableName: string) => void;
|
|
127
143
|
export declare const mockPublishEvent: (topic: string, eventType: string, data: any) => void;
|
|
128
144
|
export declare const mockSubscribeToTopic: (topic: string, callback: MockEventCallback) => void;
|
|
129
145
|
export declare const createOrderFromCart: (paymentType: string, amount: number, processor?: string) => CFActiveOrder;
|
package/dist/demo/database.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { CFProductType, CFUserTypes, CurrencyCode, } from '../CommonTypes';
|
|
6
6
|
import { cheapestCompositeItem, cheapestCompositePrice, extendPrice, resolveUnit, toBase, } from '@final-commerce/common';
|
|
7
|
-
import { BookingRatePeriod, BookingResourceKind,
|
|
7
|
+
import { BookingRatePeriod, BookingResourceKind, ReservationStatus } from '@final-commerce/common';
|
|
8
8
|
export * from './mocks';
|
|
9
9
|
// Asset Imports - Using Remote URLs to avoid build complexity with asset copying
|
|
10
10
|
const ASSETS_BASE_URL = 'https://raw.githubusercontent.com/Final-Commerce/command-frame/refs/heads/main/src/demo/assets';
|
|
@@ -1006,6 +1006,8 @@ export function setMockDatabase(config) {
|
|
|
1006
1006
|
if (config.catalogVisibility !== undefined) {
|
|
1007
1007
|
MOCK_CATALOG_VISIBILITY.splice(0, MOCK_CATALOG_VISIBILITY.length, ...config.catalogVisibility);
|
|
1008
1008
|
}
|
|
1009
|
+
if (config.declines !== undefined)
|
|
1010
|
+
MOCK_DECLINES = config.declines;
|
|
1009
1011
|
if (MOCK_OUTLETS.length > 0) {
|
|
1010
1012
|
Object.assign(MOCK_OUTLET_MAIN, MOCK_OUTLETS[0]);
|
|
1011
1013
|
if (MOCK_OUTLET_MAIN.id === undefined && MOCK_OUTLET_MAIN._id !== undefined) {
|
|
@@ -1028,6 +1030,21 @@ export const safeSerialize = (data) => {
|
|
|
1028
1030
|
return JSON.parse(JSON.stringify(data));
|
|
1029
1031
|
};
|
|
1030
1032
|
const mockTopicSubscribers = {};
|
|
1033
|
+
export let MOCK_DECLINES = {};
|
|
1034
|
+
/** MOCK ONLY: the dataset's `declines.payments` switch, failing with the till processor's text (kaching `dispatchPay.ts:208-220`). */
|
|
1035
|
+
export const assertMockPaymentNotDeclined = (paymentType, cloud) => {
|
|
1036
|
+
if (!MOCK_DECLINES.payments?.includes(paymentType))
|
|
1037
|
+
return;
|
|
1038
|
+
console.warn(`[Mock] ${paymentType}Payment declined — the mock dataset sets declines.payments`);
|
|
1039
|
+
throw new Error(`${cloud ? 'CLOUD_PAYMENT_FAILED' : 'NATIVE_PAYMENT_FAILED'}: Card declined`);
|
|
1040
|
+
};
|
|
1041
|
+
/** MOCK ONLY: the dataset's `declines.customTableWrites` switch, refusing with the till's text (kaching `customTables.ts:131,291`). */
|
|
1042
|
+
export const assertMockCustomTableWriteNotDeclined = (tableName) => {
|
|
1043
|
+
if (!MOCK_DECLINES.customTableWrites)
|
|
1044
|
+
return;
|
|
1045
|
+
console.warn('[Mock] custom table write refused — the mock dataset sets declines.customTableWrites');
|
|
1046
|
+
throw new Error(`Table "${tableName}" not found`);
|
|
1047
|
+
};
|
|
1031
1048
|
export const mockPublishEvent = (topic, eventType, data) => {
|
|
1032
1049
|
const subscribers = mockTopicSubscribers[topic] || [];
|
|
1033
1050
|
const event = {
|
|
@@ -1338,7 +1355,6 @@ export const mockBookingAvailability = (productId, from, to, resourceId) => {
|
|
|
1338
1355
|
return {
|
|
1339
1356
|
productId,
|
|
1340
1357
|
bookingRulesId: MOCK_BOOKING_RULES_ID,
|
|
1341
|
-
bookingType: BookingType.APPOINTMENT,
|
|
1342
1358
|
ratePeriod: BookingRatePeriod.SLOT,
|
|
1343
1359
|
slots,
|
|
1344
1360
|
timeZone: MOCK_SHOP_TIME_ZONE,
|
|
@@ -10,5 +10,8 @@ export interface CustomTableDataRow {
|
|
|
10
10
|
createdAt: string;
|
|
11
11
|
updatedAt: string;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
/** Rows by table name — what getCustomTableData reads and upsertCustomTableData writes. */
|
|
14
|
+
export declare const MOCK_CUSTOM_TABLE_DATA: Record<string, (Record<string, unknown> & {
|
|
15
|
+
_id: string;
|
|
16
|
+
})[]>;
|
|
14
17
|
export declare const MOCK_CUSTOM_EXTENSIONS: CustomExtension[];
|
|
@@ -133,6 +133,7 @@ export const MOCK_CUSTOM_TABLE_FIELDS = [
|
|
|
133
133
|
updatedAt: "2024-01-03T09:00:00.000Z"
|
|
134
134
|
}
|
|
135
135
|
];
|
|
136
|
+
/** Rows by table name — what getCustomTableData reads and upsertCustomTableData writes. */
|
|
136
137
|
export const MOCK_CUSTOM_TABLE_DATA = {
|
|
137
138
|
users: [
|
|
138
139
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const command: {
|
|
|
4
4
|
readonly getProducts: import(".").GetProducts;
|
|
5
5
|
readonly getBookingResources: import(".").GetBookingResources;
|
|
6
6
|
readonly getBookingAvailability: import(".").GetBookingAvailability;
|
|
7
|
+
readonly getBookingRentalEnds: import(".").GetBookingRentalEnds;
|
|
7
8
|
readonly getBookings: import(".").GetBookings;
|
|
8
9
|
readonly holdBooking: import(".").HoldBooking;
|
|
9
10
|
readonly addBookingToCart: import(".").AddBookingToCart;
|
|
@@ -58,6 +59,8 @@ export declare const command: {
|
|
|
58
59
|
readonly cashPayment: import(".").CashPayment;
|
|
59
60
|
readonly recordExternalPayment: import(".").RecordExternalPayment;
|
|
60
61
|
readonly getCashRoundingAmount: import(".").GetCashRoundingAmount;
|
|
62
|
+
readonly getCashChange: import(".").GetCashChange;
|
|
63
|
+
readonly getOrdersSummary: import(".").GetOrdersSummary;
|
|
61
64
|
readonly tapToPayPayment: import(".").TapToPayPayment;
|
|
62
65
|
readonly terminalPayment: import(".").TerminalPayment;
|
|
63
66
|
readonly extensionPayment: import(".").ExtensionPayment;
|
|
@@ -68,20 +71,12 @@ export declare const command: {
|
|
|
68
71
|
readonly startCheckout: import(".").StartCheckout;
|
|
69
72
|
readonly attachCheckoutContact: import(".").AttachCheckoutContact;
|
|
70
73
|
readonly getAddressOptions: import(".").GetAddressOptions;
|
|
71
|
-
readonly searchAddresses: import(".").SearchAddresses;
|
|
72
|
-
readonly getAddressDetails: import(".").GetAddressDetails;
|
|
73
74
|
readonly setOrderAddress: import(".").SetOrderAddress;
|
|
74
75
|
readonly getShippingOptions: import(".").GetShippingOptions;
|
|
75
76
|
readonly selectShippingOption: import(".").SelectShippingOption;
|
|
76
77
|
readonly setOutlet: import(".").SetOutlet;
|
|
77
78
|
readonly resumeCheckout: import(".").ResumeCheckout;
|
|
78
79
|
readonly getCheckoutStatus: import(".").GetCheckoutStatus;
|
|
79
|
-
readonly getShopperAccount: import(".").GetShopperAccount;
|
|
80
|
-
readonly requestShopperCode: import(".").RequestShopperCode;
|
|
81
|
-
readonly signInShopper: import(".").SignInShopper;
|
|
82
|
-
readonly signOutShopper: import(".").SignOutShopper;
|
|
83
|
-
readonly getShopperOrders: import(".").GetShopperOrders;
|
|
84
|
-
readonly getShopperOrder: import(".").GetShopperOrder;
|
|
85
80
|
readonly getMotoConfig: import(".").GetMotoConfig;
|
|
86
81
|
readonly addCustomerNote: import(".").AddCustomerNote;
|
|
87
82
|
readonly removeCustomerNote: import(".").RemoveCustomerNote;
|
|
@@ -161,6 +156,7 @@ export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } fro
|
|
|
161
156
|
export type { GetProducts, GetProductsParams, GetProductsResponse } from './actions/get-products/types';
|
|
162
157
|
export type { GetBookingResources, GetBookingResourcesParams, GetBookingResourcesResponse, } from './actions/get-booking-resources/types';
|
|
163
158
|
export type { GetBookingAvailability, GetBookingAvailabilityParams, GetBookingAvailabilityResponse, } from './actions/get-booking-availability/types';
|
|
159
|
+
export type { GetBookingRentalEnds, GetBookingRentalEndsParams, GetBookingRentalEndsResponse, } from './actions/get-booking-rental-ends/types';
|
|
164
160
|
export type { GetBookings, GetBookingsParams, GetBookingsResponse } from './actions/get-bookings/types';
|
|
165
161
|
export type { HoldBooking, HoldBookingParams, HoldBookingResponse } from './actions/hold-booking/types';
|
|
166
162
|
export type { AddBookingToCart, AddBookingToCartParams, AddBookingToCartResponse, } from './actions/add-booking-to-cart/types';
|
|
@@ -233,6 +229,8 @@ export type { VoidOrder, VoidOrderParams, VoidOrderResponse, VoidOrderOutcome }
|
|
|
233
229
|
export type { CashPayment, CashPaymentParams, CashPaymentResponse } from './actions/cash-payment/types';
|
|
234
230
|
export type { RecordExternalPayment, RecordExternalPaymentParams, RecordExternalPaymentResponse, RecordExternalPaymentTip, } from './actions/record-external-payment/types';
|
|
235
231
|
export type { GetCashRoundingAmount, GetCashRoundingAmountParams, GetCashRoundingAmountResponse, } from './actions/get-cash-rounding-amount/types';
|
|
232
|
+
export type { GetCashChange, GetCashChangeParams, GetCashChangeResponse } from './actions/get-cash-change/types';
|
|
233
|
+
export type { GetOrdersSummary, GetOrdersSummaryParams, GetOrdersSummaryResponse, } from './actions/get-orders-summary/types';
|
|
236
234
|
export type { TapToPayPayment, TapToPayPaymentParams, TapToPayPaymentResponse, } from './actions/tap-to-pay-payment/types';
|
|
237
235
|
export type { TerminalPayment, TerminalPaymentParams, TerminalPaymentResponse } from './actions/terminal-payment/types';
|
|
238
236
|
export type { ExtensionPayment, ExtensionPaymentParams, ExtensionPaymentResponse, } from './actions/extension-payment/types';
|
|
@@ -249,14 +247,6 @@ export type { SelectShippingOption, SelectShippingOptionParams, SelectShippingOp
|
|
|
249
247
|
export type { SetOutlet, SetOutletParams, SetOutletResponse } from './actions/set-outlet/types';
|
|
250
248
|
export type { ResumeCheckout, ResumeCheckoutParams, ResumeCheckoutResponse, ResumeCheckoutResult, } from './actions/resume-checkout/types';
|
|
251
249
|
export type { GetCheckoutStatus, GetCheckoutStatusParams, GetCheckoutStatusResponse, CheckoutOrderStatus, CheckoutCancelReason, } from './actions/get-checkout-status/types';
|
|
252
|
-
export type { GetShopperAccount, GetShopperAccountParams, GetShopperAccountResponse, ShopperCheckoutBox, ShopperAccountView, ShopperAddressView, } from './actions/get-shopper-account/types';
|
|
253
|
-
export type { RequestShopperCode, RequestShopperCodeParams, RequestShopperCodeResponse, } from './actions/request-shopper-code/types';
|
|
254
|
-
export type { SignInShopper, SignInShopperParams, SignInShopperResponse } from './actions/sign-in-shopper/types';
|
|
255
|
-
export type { SignOutShopper, SignOutShopperParams, SignOutShopperResponse } from './actions/sign-out-shopper/types';
|
|
256
|
-
export type { SearchAddresses, SearchAddressesParams, SearchAddressesResponse, AddressSuggestion, } from './actions/search-addresses/types';
|
|
257
|
-
export type { GetAddressDetails, GetAddressDetailsParams, GetAddressDetailsResponse, AddressDetails, } from './actions/get-address-details/types';
|
|
258
|
-
export type { GetShopperOrders, GetShopperOrdersParams, GetShopperOrdersResponse, ShopperOrderView, } from './actions/get-shopper-orders/types';
|
|
259
|
-
export type { GetShopperOrder, GetShopperOrderParams, GetShopperOrderResponse, ShopperOrderDetailView, ShopperOrderItemView, } from './actions/get-shopper-order/types';
|
|
260
250
|
export type { GetMotoConfig, GetMotoConfigResponse, MotoUnavailableReason } from './actions/get-moto-config/types';
|
|
261
251
|
export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse, } from './actions/add-customer-note/types';
|
|
262
252
|
export type { RemoveCustomerNote, RemoveCustomerNoteParams, RemoveCustomerNoteResponse, } from './actions/remove-customer-note/types';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { exampleFunction } from './actions/example-function/action';
|
|
|
3
3
|
import { getProducts } from './actions/get-products/action';
|
|
4
4
|
import { getBookingResources } from './actions/get-booking-resources/action';
|
|
5
5
|
import { getBookingAvailability } from './actions/get-booking-availability/action';
|
|
6
|
+
import { getBookingRentalEnds } from './actions/get-booking-rental-ends/action';
|
|
6
7
|
import { getBookings } from './actions/get-bookings/action';
|
|
7
8
|
import { holdBooking } from './actions/hold-booking/action';
|
|
8
9
|
import { addBookingToCart } from './actions/add-booking-to-cart/action';
|
|
@@ -58,6 +59,8 @@ import { voidOrder } from './actions/void-order/action';
|
|
|
58
59
|
import { cashPayment } from './actions/cash-payment/action';
|
|
59
60
|
import { recordExternalPayment } from './actions/record-external-payment/action';
|
|
60
61
|
import { getCashRoundingAmount } from './actions/get-cash-rounding-amount/action';
|
|
62
|
+
import { getCashChange } from './actions/get-cash-change/action';
|
|
63
|
+
import { getOrdersSummary } from './actions/get-orders-summary/action';
|
|
61
64
|
import { tapToPayPayment } from './actions/tap-to-pay-payment/action';
|
|
62
65
|
import { terminalPayment } from './actions/terminal-payment/action';
|
|
63
66
|
import { extensionPayment } from './actions/extension-payment/action';
|
|
@@ -68,21 +71,12 @@ import { chargeMoto } from './actions/charge-moto/action';
|
|
|
68
71
|
import { startCheckout } from './actions/start-checkout/action';
|
|
69
72
|
import { attachCheckoutContact } from './actions/attach-checkout-contact/action';
|
|
70
73
|
import { getAddressOptions } from './actions/get-address-options/action';
|
|
71
|
-
import { searchAddresses } from './actions/search-addresses/action';
|
|
72
|
-
import { getAddressDetails } from './actions/get-address-details/action';
|
|
73
74
|
import { setOrderAddress } from './actions/set-order-address/action';
|
|
74
75
|
import { getShippingOptions } from './actions/get-shipping-options/action';
|
|
75
76
|
import { selectShippingOption } from './actions/select-shipping-option/action';
|
|
76
77
|
import { setOutlet } from './actions/set-outlet/action';
|
|
77
78
|
import { resumeCheckout } from './actions/resume-checkout/action';
|
|
78
79
|
import { getCheckoutStatus } from './actions/get-checkout-status/action';
|
|
79
|
-
// Shopper account (store websites)
|
|
80
|
-
import { getShopperAccount } from './actions/get-shopper-account/action';
|
|
81
|
-
import { requestShopperCode } from './actions/request-shopper-code/action';
|
|
82
|
-
import { signInShopper } from './actions/sign-in-shopper/action';
|
|
83
|
-
import { signOutShopper } from './actions/sign-out-shopper/action';
|
|
84
|
-
import { getShopperOrders } from './actions/get-shopper-orders/action';
|
|
85
|
-
import { getShopperOrder } from './actions/get-shopper-order/action';
|
|
86
80
|
import { getMotoConfig } from './actions/get-moto-config/action';
|
|
87
81
|
// Customer Actions
|
|
88
82
|
import { addCustomerNote } from './actions/add-customer-note/action';
|
|
@@ -180,6 +174,7 @@ export const command = {
|
|
|
180
174
|
getProducts,
|
|
181
175
|
getBookingResources,
|
|
182
176
|
getBookingAvailability,
|
|
177
|
+
getBookingRentalEnds,
|
|
183
178
|
getBookings,
|
|
184
179
|
holdBooking,
|
|
185
180
|
addBookingToCart,
|
|
@@ -236,6 +231,8 @@ export const command = {
|
|
|
236
231
|
cashPayment,
|
|
237
232
|
recordExternalPayment,
|
|
238
233
|
getCashRoundingAmount,
|
|
234
|
+
getCashChange,
|
|
235
|
+
getOrdersSummary,
|
|
239
236
|
tapToPayPayment,
|
|
240
237
|
terminalPayment,
|
|
241
238
|
extensionPayment,
|
|
@@ -246,20 +243,12 @@ export const command = {
|
|
|
246
243
|
startCheckout,
|
|
247
244
|
attachCheckoutContact,
|
|
248
245
|
getAddressOptions,
|
|
249
|
-
searchAddresses,
|
|
250
|
-
getAddressDetails,
|
|
251
246
|
setOrderAddress,
|
|
252
247
|
getShippingOptions,
|
|
253
248
|
selectShippingOption,
|
|
254
249
|
setOutlet,
|
|
255
250
|
resumeCheckout,
|
|
256
251
|
getCheckoutStatus,
|
|
257
|
-
getShopperAccount,
|
|
258
|
-
requestShopperCode,
|
|
259
|
-
signInShopper,
|
|
260
|
-
signOutShopper,
|
|
261
|
-
getShopperOrders,
|
|
262
|
-
getShopperOrder,
|
|
263
252
|
getMotoConfig,
|
|
264
253
|
// Customer Actions
|
|
265
254
|
addCustomerNote,
|
|
@@ -36,6 +36,8 @@ import { mockCalculateRefundTotal } from '../../actions/calculate-refund-total/m
|
|
|
36
36
|
import { mockCashPayment } from '../../actions/cash-payment/mock';
|
|
37
37
|
import { mockRecordExternalPayment } from '../../actions/record-external-payment/mock';
|
|
38
38
|
import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
|
|
39
|
+
import { mockGetCashChange } from '../../actions/get-cash-change/mock';
|
|
40
|
+
import { mockGetOrdersSummary } from '../../actions/get-orders-summary/mock';
|
|
39
41
|
import { mockCreatePaymentLink } from '../../actions/create-payment-link/mock';
|
|
40
42
|
import { mockChargeMoto } from '../../actions/charge-moto/mock';
|
|
41
43
|
import { mockStartCheckout } from '../../actions/start-checkout/mock';
|
|
@@ -48,14 +50,6 @@ import { mockGetOutlets } from '../../actions/get-outlets/mock';
|
|
|
48
50
|
import { mockSetOutlet } from '../../actions/set-outlet/mock';
|
|
49
51
|
import { mockResumeCheckout } from '../../actions/resume-checkout/mock';
|
|
50
52
|
import { mockGetCheckoutStatus } from '../../actions/get-checkout-status/mock';
|
|
51
|
-
import { mockGetShopperAccount } from '../../actions/get-shopper-account/mock';
|
|
52
|
-
import { mockRequestShopperCode } from '../../actions/request-shopper-code/mock';
|
|
53
|
-
import { mockSignInShopper } from '../../actions/sign-in-shopper/mock';
|
|
54
|
-
import { mockSignOutShopper } from '../../actions/sign-out-shopper/mock';
|
|
55
|
-
import { mockGetShopperOrders } from '../../actions/get-shopper-orders/mock';
|
|
56
|
-
import { mockSearchAddresses } from '../../actions/search-addresses/mock';
|
|
57
|
-
import { mockGetAddressDetails } from '../../actions/get-address-details/mock';
|
|
58
|
-
import { mockGetShopperOrder } from '../../actions/get-shopper-order/mock';
|
|
59
53
|
import { mockGetMotoConfig } from '../../actions/get-moto-config/mock';
|
|
60
54
|
import { mockGetTimeClockStatus } from '../../actions/get-time-clock-status/mock';
|
|
61
55
|
import { mockClearCart } from '../../actions/clear-cart/mock';
|
|
@@ -70,6 +64,7 @@ import { mockGetOrders } from '../../actions/get-orders/mock';
|
|
|
70
64
|
import { mockGetProducts } from '../../actions/get-products/mock';
|
|
71
65
|
import { mockGetBookingResources } from '../../actions/get-booking-resources/mock';
|
|
72
66
|
import { mockGetBookingAvailability } from '../../actions/get-booking-availability/mock';
|
|
67
|
+
import { mockGetBookingRentalEnds } from '../../actions/get-booking-rental-ends/mock';
|
|
73
68
|
import { mockGetBookings } from '../../actions/get-bookings/mock';
|
|
74
69
|
import { mockHoldBooking } from '../../actions/hold-booking/mock';
|
|
75
70
|
import { mockAddBookingToCart } from '../../actions/add-booking-to-cart/mock';
|
|
@@ -174,13 +169,13 @@ export const RENDER_MOCKS = {
|
|
|
174
169
|
cashPayment: mockCashPayment,
|
|
175
170
|
recordExternalPayment: mockRecordExternalPayment,
|
|
176
171
|
getCashRoundingAmount: mockGetCashRoundingAmount,
|
|
172
|
+
getCashChange: mockGetCashChange,
|
|
173
|
+
getOrdersSummary: mockGetOrdersSummary,
|
|
177
174
|
createPaymentLink: mockCreatePaymentLink,
|
|
178
175
|
chargeMoto: mockChargeMoto,
|
|
179
176
|
startCheckout: mockStartCheckout,
|
|
180
177
|
attachCheckoutContact: mockAttachCheckoutContact,
|
|
181
178
|
getAddressOptions: mockGetAddressOptions,
|
|
182
|
-
searchAddresses: mockSearchAddresses,
|
|
183
|
-
getAddressDetails: mockGetAddressDetails,
|
|
184
179
|
setOrderAddress: mockSetOrderAddress,
|
|
185
180
|
getShippingOptions: mockGetShippingOptions,
|
|
186
181
|
selectShippingOption: mockSelectShippingOption,
|
|
@@ -188,12 +183,6 @@ export const RENDER_MOCKS = {
|
|
|
188
183
|
setOutlet: mockSetOutlet,
|
|
189
184
|
resumeCheckout: mockResumeCheckout,
|
|
190
185
|
getCheckoutStatus: mockGetCheckoutStatus,
|
|
191
|
-
getShopperAccount: mockGetShopperAccount,
|
|
192
|
-
requestShopperCode: mockRequestShopperCode,
|
|
193
|
-
signInShopper: mockSignInShopper,
|
|
194
|
-
signOutShopper: mockSignOutShopper,
|
|
195
|
-
getShopperOrders: mockGetShopperOrders,
|
|
196
|
-
getShopperOrder: mockGetShopperOrder,
|
|
197
186
|
getMotoConfig: mockGetMotoConfig,
|
|
198
187
|
clearCart: mockClearCart,
|
|
199
188
|
deleteParkedOrder: mockDeleteParkedOrder,
|
|
@@ -207,6 +196,7 @@ export const RENDER_MOCKS = {
|
|
|
207
196
|
getProducts: mockGetProducts,
|
|
208
197
|
getBookingResources: mockGetBookingResources,
|
|
209
198
|
getBookingAvailability: mockGetBookingAvailability,
|
|
199
|
+
getBookingRentalEnds: mockGetBookingRentalEnds,
|
|
210
200
|
getBookings: mockGetBookings,
|
|
211
201
|
holdBooking: mockHoldBooking,
|
|
212
202
|
addBookingToCart: mockAddBookingToCart,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, GetCustomStockActions, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, GetCompositePrice, GetCompositeAvailability, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, SetVariantUnavailable, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, ResumeOrder, SetOrderMetadata, AssignOrderUser, ReleaseFromCart, SetOrderType, SetScheduledFor, SetOrderStatus, GetOrderStatuses, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, RecordExternalPayment, GetCashRoundingAmount, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms, GetBookingResources, GetBookingAvailability, GetBookings, HoldBooking, AddBookingToCart, RemoveBookingFromCart, CancelBooking, CreatePaymentLink, ChargeMoto, StartCheckout, AttachCheckoutContact, GetAddressOptions, SetOrderAddress, GetShippingOptions, SelectShippingOption, GetOutlets, SetOutlet, ResumeCheckout, GetCheckoutStatus,
|
|
1
|
+
import type { ExampleFunction, GetProducts, AddCustomSale, EditCustomSale, GetCustomers, AssignCustomer, AddCustomer, EditCustomer, GetCategories, GetOrders, GetRefunds, GetTaxTables, GetCustomStockActions, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, GetProductModifierSelections, GetCompositePrice, GetCompositeAvailability, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, SetVariantUnavailable, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, ResumeOrder, SetOrderMetadata, AssignOrderUser, ReleaseFromCart, SetOrderType, SetScheduledFor, SetOrderStatus, GetOrderStatuses, DeleteParkedOrder, VoidOrder, InitiateRefund, CashPayment, RecordExternalPayment, GetCashRoundingAmount, GetCashChange, GetOrdersSummary, TapToPayPayment, TerminalPayment, ExtensionPayment, RedeemPayment, AddNonRevenueItem, AddCustomerNote, RemoveCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, RedeemRefund, GetRefundPlan, CheckPermission, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal, GetUsers, GetRoles, RemoveCartDiscount, GetActiveOrder, GetActiveCustomer, SetActiveCustomer, GetActiveOutlet, GetActiveStation, GetActiveSession, GetActiveUser, SetActiveUser, SetActiveRefund, RemoveProductDiscount, RemoveProductFee, RemoveProductNote, RemoveCartFee, RemoveOrderNote, RemoveCustomSale, RemoveNonRevenueItem, CanTransition, GetAvailableTransitions, ApplyTransition, IntegrationPayment, GetSmartGridLayout, SaveSmartGridLayout, SendEmail, SendSms, GetBookingResources, GetBookingAvailability, GetBookingRentalEnds, GetBookings, HoldBooking, AddBookingToCart, RemoveBookingFromCart, CancelBooking, CreatePaymentLink, ChargeMoto, StartCheckout, AttachCheckoutContact, GetAddressOptions, SetOrderAddress, GetShippingOptions, SelectShippingOption, GetOutlets, SetOutlet, ResumeCheckout, GetCheckoutStatus, GetMotoConfig, GetTimeClockStatus } from '../../index';
|
|
2
2
|
export interface RenderProviderActions {
|
|
3
3
|
exampleFunction: ExampleFunction;
|
|
4
4
|
getProducts: GetProducts;
|
|
5
5
|
getBookingResources: GetBookingResources;
|
|
6
6
|
getBookingAvailability: GetBookingAvailability;
|
|
7
|
+
getBookingRentalEnds: GetBookingRentalEnds;
|
|
7
8
|
getBookings: GetBookings;
|
|
8
9
|
holdBooking: HoldBooking;
|
|
9
10
|
addBookingToCart: AddBookingToCart;
|
|
@@ -58,6 +59,8 @@ export interface RenderProviderActions {
|
|
|
58
59
|
cashPayment: CashPayment;
|
|
59
60
|
recordExternalPayment: RecordExternalPayment;
|
|
60
61
|
getCashRoundingAmount: GetCashRoundingAmount;
|
|
62
|
+
getCashChange: GetCashChange;
|
|
63
|
+
getOrdersSummary: GetOrdersSummary;
|
|
61
64
|
tapToPayPayment: TapToPayPayment;
|
|
62
65
|
terminalPayment: TerminalPayment;
|
|
63
66
|
extensionPayment: ExtensionPayment;
|
|
@@ -74,8 +77,6 @@ export interface RenderProviderActions {
|
|
|
74
77
|
attachCheckoutContact: AttachCheckoutContact;
|
|
75
78
|
/** Shipping, on the till (ship-to) and the website alike. The runtime prices; the flow renders. */
|
|
76
79
|
getAddressOptions: GetAddressOptions;
|
|
77
|
-
searchAddresses: SearchAddresses;
|
|
78
|
-
getAddressDetails: GetAddressDetails;
|
|
79
80
|
setOrderAddress: SetOrderAddress;
|
|
80
81
|
getShippingOptions: GetShippingOptions;
|
|
81
82
|
selectShippingOption: SelectShippingOption;
|
|
@@ -89,13 +90,6 @@ export interface RenderProviderActions {
|
|
|
89
90
|
resumeCheckout: ResumeCheckout;
|
|
90
91
|
/** Where an online order stands now, by its order password. Storefront-only. */
|
|
91
92
|
getCheckoutStatus: GetCheckoutStatus;
|
|
92
|
-
/** The shopper account on a store's website (sign in, this store's orders). Storefront-only. */
|
|
93
|
-
getShopperAccount: GetShopperAccount;
|
|
94
|
-
requestShopperCode: RequestShopperCode;
|
|
95
|
-
signInShopper: SignInShopper;
|
|
96
|
-
signOutShopper: SignOutShopper;
|
|
97
|
-
getShopperOrders: GetShopperOrders;
|
|
98
|
-
getShopperOrder: GetShopperOrder;
|
|
99
93
|
getMotoConfig: GetMotoConfig;
|
|
100
94
|
addNonRevenueItem: AddNonRevenueItem;
|
|
101
95
|
addCustomerNote: AddCustomerNote;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@final-commerce/command-frame",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0-staging.2",
|
|
4
4
|
"description": "Commands Frame library",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"ignoreBranchesMissingTickets": true
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@final-commerce/common": "2.
|
|
60
|
+
"@final-commerce/common": "2.12.0-staging.2"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@commitlint/cli": "^19.0.0",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getAddressDetails action
|
|
3
|
-
* Calls the getAddressDetails action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from '../../client';
|
|
6
|
-
export const getAddressDetails = async (params) => {
|
|
7
|
-
return await commandFrameClient.call('getAddressDetails', params);
|
|
8
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** In the cart's shape: country ISO 3166-1 alpha-2, province or state as its code. */
|
|
2
|
-
export interface AddressDetails {
|
|
3
|
-
address1: string;
|
|
4
|
-
address2?: string;
|
|
5
|
-
city?: string;
|
|
6
|
-
state?: string;
|
|
7
|
-
postCode?: string;
|
|
8
|
-
country: string;
|
|
9
|
-
}
|
|
10
|
-
export interface GetAddressDetailsParams {
|
|
11
|
-
/** A suggestion's `id`, from searchAddresses. */
|
|
12
|
-
id: string;
|
|
13
|
-
language?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface GetAddressDetailsResponse {
|
|
16
|
-
success: boolean;
|
|
17
|
-
/** Ready for setOrderAddress. Add the shopper's name; keep anything they edit afterwards. */
|
|
18
|
-
address?: AddressDetails;
|
|
19
|
-
reason?: string;
|
|
20
|
-
}
|
|
21
|
-
/** The picked suggestion as a full address. Ends the lookup session the searches opened. */
|
|
22
|
-
export type GetAddressDetails = (params: GetAddressDetailsParams) => Promise<GetAddressDetailsResponse>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getShopperAccount action
|
|
3
|
-
* Calls the getShopperAccount action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from '../../client';
|
|
6
|
-
export const getShopperAccount = async (params) => {
|
|
7
|
-
return await commandFrameClient.call('getShopperAccount', params ?? {});
|
|
8
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/** Standalone mock: a guest, with the two checkout boxes. */
|
|
2
|
-
export const mockGetShopperAccount = async () => {
|
|
3
|
-
console.log('[Mock] getShopperAccount called');
|
|
4
|
-
return {
|
|
5
|
-
success: true,
|
|
6
|
-
signedIn: false,
|
|
7
|
-
boxes: [
|
|
8
|
-
{ id: 'accountOptIn', label: 'Track this order and check out faster next time', checked: false },
|
|
9
|
-
{ id: 'marketingOptIn', label: 'Email me news and offers from this store', checked: false },
|
|
10
|
-
],
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/** A checkbox the checkout shows, with its wording and default. */
|
|
2
|
-
export interface ShopperCheckoutBox {
|
|
3
|
-
/** `saveAddress` is offered to a signed-in shopper only; send it with the shipping address step's contact. */
|
|
4
|
-
id: 'accountOptIn' | 'marketingOptIn' | 'saveAddress';
|
|
5
|
-
label: string;
|
|
6
|
-
checked: boolean;
|
|
7
|
-
}
|
|
8
|
-
export interface ShopperAccountView {
|
|
9
|
-
name: string;
|
|
10
|
-
/** null for an account made with a phone that has not added an email yet. */
|
|
11
|
-
email: string | null;
|
|
12
|
-
phone: string | null;
|
|
13
|
-
}
|
|
14
|
-
/** A saved address, as stored, plus one line to show it by. */
|
|
15
|
-
export interface ShopperAddressView {
|
|
16
|
-
id: string;
|
|
17
|
-
label: string | null;
|
|
18
|
-
/** "12 Water St, St. John's, NL A1C 1A1" */
|
|
19
|
-
line: string;
|
|
20
|
-
isDefault: boolean;
|
|
21
|
-
firstName?: string;
|
|
22
|
-
lastName?: string;
|
|
23
|
-
address1?: string;
|
|
24
|
-
address2?: string;
|
|
25
|
-
city?: string;
|
|
26
|
-
state?: string;
|
|
27
|
-
postCode?: string;
|
|
28
|
-
country?: string;
|
|
29
|
-
}
|
|
30
|
-
export type GetShopperAccountParams = Record<string, never>;
|
|
31
|
-
export interface GetShopperAccountResponse {
|
|
32
|
-
success: boolean;
|
|
33
|
-
signedIn: boolean;
|
|
34
|
-
/** Present when signed in. */
|
|
35
|
-
shopper?: ShopperAccountView;
|
|
36
|
-
/** Signed in only: the saved addresses, the default first. The checkout prefills the default itself. */
|
|
37
|
-
addresses?: ShopperAddressView[];
|
|
38
|
-
/**
|
|
39
|
-
* The account boxes for the checkout's contact step. A guest gets "Track this order" and the news
|
|
40
|
-
* box; a signed-in shopper gets the news box and "Save this address" (ticked).
|
|
41
|
-
*/
|
|
42
|
-
boxes: ShopperCheckoutBox[];
|
|
43
|
-
reason?: string;
|
|
44
|
-
}
|
|
45
|
-
/** Who is signed in at this store, their saved addresses, and the checkout boxes to show. */
|
|
46
|
-
export type GetShopperAccount = (params?: GetShopperAccountParams) => Promise<GetShopperAccountResponse>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// The shopper account on a store's website (My Account's store-scoped twin): sign in or sign up
|
|
2
|
-
// with a code by email or text, see this store's orders. Served ONLY by the storefront runtime; on a
|
|
3
|
-
// register it does not exist. Every value comes back READY TO DISPLAY (the runtime formats money,
|
|
4
|
-
// dates and labels), so a flow shows it as it is and computes nothing. Failures resolve with
|
|
5
|
-
// `success: false` and a `reason` written for the shopper; these never throw.
|
|
6
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* getShopperOrder action
|
|
3
|
-
* Calls the getShopperOrder action on the parent window
|
|
4
|
-
*/
|
|
5
|
-
import { commandFrameClient } from '../../client';
|
|
6
|
-
export const getShopperOrder = async (params) => {
|
|
7
|
-
return await commandFrameClient.call('getShopperOrder', params ?? {});
|
|
8
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const mockGetShopperOrder = async (params) => {
|
|
2
|
-
console.log('[Mock] getShopperOrder called', params);
|
|
3
|
-
return {
|
|
4
|
-
success: true,
|
|
5
|
-
order: {
|
|
6
|
-
orderId: params.orderId,
|
|
7
|
-
receiptId: '#1042',
|
|
8
|
-
placedAtLabel: 'Nov 1, 2026',
|
|
9
|
-
status: 'paid',
|
|
10
|
-
statusLabel: 'Paid',
|
|
11
|
-
totalLabel: '$42.50',
|
|
12
|
-
itemsLabel: '2 items',
|
|
13
|
-
items: [{ name: 'Harbour mug', variant: 'Slate', quantity: 2, totalLabel: '$40.00' }],
|
|
14
|
-
totals: [
|
|
15
|
-
{ label: 'Subtotal', amountLabel: '$40.00' },
|
|
16
|
-
{ label: 'Tax', amountLabel: '$2.50' },
|
|
17
|
-
{ label: 'Total', amountLabel: '$42.50' },
|
|
18
|
-
],
|
|
19
|
-
paidWithLabel: 'Visa •••• 4242',
|
|
20
|
-
deliveryLabel: 'Pickup at Water St.',
|
|
21
|
-
returnLabel: null,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
};
|