I suggest that you can check the examples in RetailSDK, for this case, please check the
export abstract class InventoryLookupExtensionCommandBase extends ExtensionCommandBase<IInventoryLookupToExtensionCommandMessageTypeMap> {
protected readonly context: IInventoryLookupExtensionCommandContext;
/**
* The handler for the product changed message.
* @remarks Derived classes should set the handler to execute functionality when a "ProductChanged" message is received.
*/
protected productChangedHandler: (data: InventoryLookupProductChangedData) => void;
/**
* The handler for the location selected message.
* @remarks Derived classes should set the handler to execute functionality when a "LocationSelected" message is received.
*/
protected locationSelectionHandler: (data: InventoryLookupLocationSelectedData) => void;
/**
* The handler for the location selection cleared message.
* @remarks Derived classes should set the handler to execute functionality when a "LocationSelectionCleared" message is received.
*/
protected locationSelectionClearedHandler: () => void;
/**
* Creates a new instance of the InventoryLookupExtensionCommandBase class.
* @param {IInventoryLookupExtensionCommandContext} context The command context.
* @remarks All commands added to the inventory lookup page should derive from this class.
*/
constructor(context: IInventoryLookupExtensionCommandContext);
}
/**
I think the protected productChangedHandler: (data: InventoryLookupProductChangedData) , the interface is :
type InventoryLookupProductChangedData = {
product: Proxy.Entities.SimpleProduct;
locationAvailabilities: Proxy.Entities.OrgUnitAvailability[];
};
It contains the product information
And then I suggest that you can check the WarrantAndReturn Sample, you can pass this product through click the AppBar Command such as this code:
protected execute(): void {
this.isProcessing = true;
this.context.navigator.navigate("WarrantyEnabledProductsView", <IWarrantyEnabledProductsViewModelOptions>{
customer: this._customer,
products: this._products,
salesOrder: this._selectedSalesOrder
});
this.isProcessing = false;
}
And then receive the product in the ViewModel(such as WarrantyEnabledProductsViewModel) of the new view see below:
constructor(context: IExtensionViewControllerContext, options?: IWarrantyEnabledProductsViewModelOptions) {
this._context = context;
this._options = options || { customer: undefined, products: [], salesOrder: undefined };
this._options.products = this._options.products || [];
this.title = ko.observable(StringExtensions.format(
this._context.resources.getString("WarrantyEnabledProductsTitleFormat"), this._options.salesOrder.ReceiptId));
this.isBusy = ko.observable(false);
this.warrantyEnabledProducts = ko.observableArray(this.getProductsWithWarranty());
}