@final-commerce/command-frame 0.9.0-preprod.4 → 0.9.0-preprod.5

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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get MOTO config action
3
+ * Calls the getMotoConfig action on the parent window
4
+ */
5
+ import type { GetMotoConfig } from './types';
6
+ export declare const getMotoConfig: GetMotoConfig;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get MOTO config action
3
+ * Calls the getMotoConfig action on the parent window
4
+ */
5
+ import { commandFrameClient } from '../../client';
6
+ export const getMotoConfig = async () => {
7
+ return await commandFrameClient.call('getMotoConfig', undefined);
8
+ };
@@ -0,0 +1,7 @@
1
+ import { GetMotoConfig } from './types';
2
+ /**
3
+ * The mock has no Adyen account to mount card fields against, so it answers honestly: not
4
+ * available. A flow that hides its manual card tender on `available: false` behaves the same
5
+ * in a preview as on a host without a key.
6
+ */
7
+ export declare const mockGetMotoConfig: GetMotoConfig;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The mock has no Adyen account to mount card fields against, so it answers honestly: not
3
+ * available. A flow that hides its manual card tender on `available: false` behaves the same
4
+ * in a preview as on a host without a key.
5
+ */
6
+ export const mockGetMotoConfig = async () => {
7
+ console.log('[Mock] getMotoConfig called');
8
+ return { success: true, timestamp: new Date().toISOString(), available: false, reason: 'no-client-key' };
9
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Get MOTO config — everything a flow needs to take a keyed (card-not-present) payment itself:
3
+ * mount the processor's own card-entry fields, then send what they produce to `chargeMoto`.
4
+ */
5
+ /** Why manual card entry is not available here. */
6
+ export type MotoUnavailableReason =
7
+ /** The company does not take new sales on Adyen (keyed charges are Adyen-only today). */
8
+ 'provider-unsupported'
9
+ /** The host injected no Adyen client key (an older host, or an environment without one). */
10
+ | 'no-client-key'
11
+ /** The company's Adyen integration has no country yet. */
12
+ | 'no-country'
13
+ /** No active company. */
14
+ | 'no-company';
15
+ export type GetMotoConfigResponse = {
16
+ success: boolean;
17
+ timestamp: string;
18
+ } & ({
19
+ available: true;
20
+ provider: 'adyen';
21
+ /**
22
+ * Adyen's PUBLISHABLE client key for `@adyen/adyen-web`'s `AdyenCheckout({ clientKey })`.
23
+ * Injected by the host at runtime — never bake one into a flow build.
24
+ */
25
+ clientKey: string;
26
+ /** `AdyenCheckout({ environment })`. */
27
+ environment: 'test' | 'live';
28
+ /** The company's country, ISO 3166-1 alpha-2 — `AdyenCheckout({ countryCode })`. */
29
+ countryCode: string;
30
+ } | {
31
+ available: false;
32
+ reason: MotoUnavailableReason;
33
+ });
34
+ export type GetMotoConfig = () => Promise<GetMotoConfigResponse>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Get MOTO config — everything a flow needs to take a keyed (card-not-present) payment itself:
3
+ * mount the processor's own card-entry fields, then send what they produce to `chargeMoto`.
4
+ */
5
+ export {};
package/dist/index.d.ts CHANGED
@@ -62,6 +62,7 @@ export declare const command: {
62
62
  readonly integrationPayment: import(".").IntegrationPayment;
63
63
  readonly createPaymentLink: import(".").CreatePaymentLink;
64
64
  readonly chargeMoto: import(".").ChargeMoto;
65
+ readonly getMotoConfig: import(".").GetMotoConfig;
65
66
  readonly addCustomerNote: import(".").AddCustomerNote;
66
67
  readonly removeCustomerNote: import(".").RemoveCustomerNote;
67
68
  readonly removeCustomerFromCart: import(".").RemoveCustomerFromCart;
@@ -216,6 +217,7 @@ export type { RedeemPayment, RedeemPaymentParams, RedeemPaymentResponse } from '
216
217
  export type { IntegrationPayment, IntegrationPaymentParams, IntegrationPaymentResponse, IntegrationEmvData, } from './actions/integration-payment/types';
217
218
  export type { CreatePaymentLink, CreatePaymentLinkParams, CreatePaymentLinkResponse, } from './actions/create-payment-link/types';
218
219
  export type { ChargeMoto, ChargeMotoParams, ChargeMotoResponse, ChargeMotoCardFields, } from './actions/charge-moto/types';
220
+ export type { GetMotoConfig, GetMotoConfigResponse, MotoUnavailableReason } from './actions/get-moto-config/types';
219
221
  export type { AddCustomerNote, AddCustomerNoteParams, AddCustomerNoteResponse, } from './actions/add-customer-note/types';
220
222
  export type { RemoveCustomerNote, RemoveCustomerNoteParams, RemoveCustomerNoteResponse, } from './actions/remove-customer-note/types';
221
223
  export type { RemoveCustomerFromCart, RemoveCustomerFromCartResponse } from './actions/remove-customer-from-cart/types';
package/dist/index.js CHANGED
@@ -62,6 +62,7 @@ import { redeemPayment } from './actions/redeem-payment/action';
62
62
  import { integrationPayment } from './actions/integration-payment/action';
63
63
  import { createPaymentLink } from './actions/create-payment-link/action';
64
64
  import { chargeMoto } from './actions/charge-moto/action';
65
+ import { getMotoConfig } from './actions/get-moto-config/action';
65
66
  // Customer Actions
66
67
  import { addCustomerNote } from './actions/add-customer-note/action';
67
68
  import { removeCustomerNote } from './actions/remove-customer-note/action';
@@ -218,6 +219,7 @@ export const command = {
218
219
  integrationPayment,
219
220
  createPaymentLink,
220
221
  chargeMoto,
222
+ getMotoConfig,
221
223
  // Customer Actions
222
224
  addCustomerNote,
223
225
  removeCustomerNote,
@@ -35,6 +35,7 @@ import { mockRecordExternalPayment } from '../../actions/record-external-payment
35
35
  import { mockGetCashRoundingAmount } from '../../actions/get-cash-rounding-amount/mock';
36
36
  import { mockCreatePaymentLink } from '../../actions/create-payment-link/mock';
37
37
  import { mockChargeMoto } from '../../actions/charge-moto/mock';
38
+ import { mockGetMotoConfig } from '../../actions/get-moto-config/mock';
38
39
  import { mockGetTimeClockStatus } from '../../actions/get-time-clock-status/mock';
39
40
  import { mockClearCart } from '../../actions/clear-cart/mock';
40
41
  import { mockDeleteParkedOrder } from '../../actions/delete-parked-order/mock';
@@ -151,6 +152,7 @@ export const RENDER_MOCKS = {
151
152
  getCashRoundingAmount: mockGetCashRoundingAmount,
152
153
  createPaymentLink: mockCreatePaymentLink,
153
154
  chargeMoto: mockChargeMoto,
155
+ getMotoConfig: mockGetMotoConfig,
154
156
  clearCart: mockClearCart,
155
157
  deleteParkedOrder: mockDeleteParkedOrder,
156
158
  voidOrder: mockVoidOrder,
@@ -1,4 +1,4 @@
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, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, 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, GetTimeClockStatus } from '../../index';
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, SetProductModifierSelections, SetActiveProductFee, SetActiveProductDiscount, GetActiveProduct, SetActiveProduct, AdjustInventory, 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, GetMotoConfig, GetTimeClockStatus } from '../../index';
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -62,6 +62,7 @@ export interface RenderProviderActions {
62
62
  integrationPayment: IntegrationPayment;
63
63
  createPaymentLink: CreatePaymentLink;
64
64
  chargeMoto: ChargeMoto;
65
+ getMotoConfig: GetMotoConfig;
65
66
  addNonRevenueItem: AddNonRevenueItem;
66
67
  addCustomerNote: AddCustomerNote;
67
68
  removeCustomerNote: RemoveCustomerNote;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.9.0-preprod.4",
3
+ "version": "0.9.0-preprod.5",
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.5.1-preprod.8"
60
+ "@final-commerce/common": "2.5.1-preprod.9"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@commitlint/cli": "^19.0.0",