Open ax365 opened 1 year ago
Hi ax365, thank you for providing all of details and screenshots. I see that the CustomViewController implements the INumPadInputSubscriberEndpoint interface by declaring the implementsINumPadInputSubscriberEndpoint field. Can you please confirm that this field is initialized and set to true in the view's constructor? I did not see that initialization in the code snippets provided. Thanks!
Thank you lukedgr,
Initializing implementsINumPadInputSubscriberEndpoint
in the constructor has now resolved this issue.
Now upon loading of the custom view, the NumPad will immediately respond to keyboard input.
Hi @lukedgr,
Two follow-up questions related to this:
Do we have access to only a numeric NumPad? I'm currently implementing a payment screen and don't want the option for letters:
Inside Pos.Controls.js
, I found this property clearOnEnter
. Are we able to specify this as false
somehow? I also tried to return a Promise.reject()
inside the NumPad callback method. But it still doesn't prevent the framework from clearing out the value upon clicking enter.
Extensibility request:
Provide support for adding
NumPad
andINumPadInputBroker
to custom pos -views- that extend fromCustomViewControllerBase
. Similar to how custom pos -dialogs- extend fromExtensionTemplatedDialogBase
and thus get theNumPad
andINumPadInputBroker
brokers “for free” (without requiring extension code to initialize it).Context:
In the legacy RetailSDK, when creating custom views, we extended the
ExtensionViewControllerBase
abstract class. With the introduction of the CommerceSDK,ExtensionViewControllerBase
is now deprecated.This deprecated abstract class
ExtensionViewControllerBase
had some useful properties:NumPad
to a custom viewINumPadInputBroker
inherited from implementingINumPadContainer
which allowed theNumPad
to intercept keyboard (or scanner) inputWith the new CommerceSDK, the requirement is to extend
CustomViewControllerBase
abstract class instead.NumPad
(with OOTBINumPadInputBroker
) to a custom view.The official sample extension on GitHub for the InStore.BarcodeMsrDialogSample utilizes
IAlphanumericNumPad
but this is for a -dialog- (not a -view-).BarcodeMsrDialog.ts
ExtensionTemplatedDialogBase
which provides the implementation of an input broker "for free" (no need for the extension code to initialize it)As a potential workaround, I've attempted the following:
Implement![image](https://github.com/microsoft/Dynamics365Commerce.Solutions/assets/138946791/161ede6a-74fc-42bb-97ec-53202afbed14)
INumPadInputSubscriberEndpoint
:Instantiate the broker from the subscriber:![image](https://github.com/microsoft/Dynamics365Commerce.Solutions/assets/138946791/e61fb2ec-3f44-4603-845f-0d8ad4c14e28)
Initialize options and bind the![image](https://github.com/microsoft/Dynamics365Commerce.Solutions/assets/138946791/c9430df5-0587-4a47-bdad-c1a98d1ddd0f)
NumPad
:The workaround described above allows the
NumPad
to render on the custom view. But it's still not behaving fully as intended.Below describes the main issue:
The screenshot below has been taken immediately upon loading of the custom view. And I’m typing on the keyboard but none of the digits are rendering on the![image](https://github.com/microsoft/Dynamics365Commerce.Solutions/assets/138946791/d6f38c71-52c6-4e58-9295-9320d9df698f)
NumPad
(it doesn’t recognize it).Because of that, as a test, I decided to click the![image](https://github.com/microsoft/Dynamics365Commerce.Solutions/assets/138946791/93da3d03-47b1-4f53-98f4-1e90affc973b)
NumPad
“input bar” – you can see the dotted lines:Now when I enter keyboard input, the digits show up:![image](https://github.com/microsoft/Dynamics365Commerce.Solutions/assets/138946791/df59679e-c020-422b-9d1d-e5d5979bda27)
^ If I “click out” of the input bar (no more dotted lines) – then it goes back to the first screenshot behaviour (it does not recognize/update keyboard input).