diff --git a/api.yml b/api.yml
index a78fece..89ff16f 100644
--- a/api.yml
+++ b/api.yml
@@ -62,8 +62,6 @@ channels:
- $ref: "#/components/messages/weighingFailed"
- $ref: "#/components/messages/paymentSuccess"
- $ref: "#/components/messages/paymentFailure"
- - $ref: "#/components/messages/showDialog"
- - $ref: "#/components/messages/closeDialog"
- $ref: "#/components/messages/apiError"
- $ref: "#/components/messages/apiWarning"
subscribe:
@@ -76,7 +74,6 @@ channels:
- $ref: "#/components/messages/weighArticle"
- $ref: "#/components/messages/startPayment"
- $ref: "#/components/messages/printReceipt"
- - $ref: "#/components/messages/userInput"
- $ref: "#/components/messages/reset"
- $ref: "#/components/messages/apiError"
- $ref: "#/components/messages/apiWarning"
@@ -310,37 +307,6 @@ components:
- message
additionalProperties: false
- Dialog:
- type: object
- properties:
- id:
- type: string
- description: Identifier for this kind of dialog. E.g. `cardReaderError`.
- title:
- $ref: "#/components/schemas/I18ned"
- description: Title of the dialog.
- body:
- $ref: "#/components/schemas/I18ned"
- description: Dialog body to display to the customer.
- buttons:
- type: array
- items:
- type: object
- properties:
- action:
- type: string
- description: Action the button will trigger when pressed.
- label:
- $ref: "#/components/schemas/I18ned"
- description: Label to display on the button.
- required:
- - action
- - label
- required:
- - id
- - title
- - body
- additionalProperties: false
messages:
syncArticles:
@@ -825,102 +791,3 @@ components:
- event
additionalProperties: false
- showDialog:
- summary: Show a dialog that requires user interaction.
- description: >
- The dialog will be rendered based on the data, including all buttons.
- It will report back the button that was pressed with the action that is
- attached to the button. The dialog will be closed automatically after
- a button was pressed. In case a new dialog should be opened, a new
- message has to be sent. The dialog can only be shown during checkout
- and not during scanning.
- payload:
- type: object
- properties:
- event:
- type: string
- const: showDialog
- data:
- $ref: "#/components/schemas/Dialog"
- required:
- - event
- - data
- additionalProperties: false
- examples:
- - payload:
- event: "showDialog"
- data:
- id: "survey"
- title:
- en: "Survey"
- de: "Umfrage"
- body:
- en: "How satisfied are you with the interface?"
- de: "Wie zufrieden sind Sie mit der Schnittstelle?"
- buttons:
- - action: "-1"
- label:
- en: "Not at all"
- de: "Gar nicht"
- - action: "+1"
- label:
- en: "A lot"
- de: "Sehr"
-
- closeDialog:
- summary: Close any currently open dialog.
- payload:
- type: object
- properties:
- event:
- type: string
- const: closeDialog
- data:
- type: object
- properties:
- id:
- type: string
- description: Identifier for this kind of dialog. E.g. `cardReaderError`.
- required:
- - id
- required:
- - event
- - data
- additionalProperties: false
- examples:
- - payload:
- event: "closeDialog"
- data:
- id: "survey"
-
- userInput:
- summary: Report the user's response to a dialog.
- description: >
- Reports the action of the button that was pressed in a dialog.
- The actions corresponds to what was set in the `showDialog` message.
- payload:
- type: object
- properties:
- event:
- type: string
- const: userInput
- data:
- type: object
- properties:
- id:
- type: string
- action:
- type: string
- required:
- - id
- - action
- required:
- - event
- - data
- additionalProperties: false
- examples:
- - payload:
- event: "userInput"
- data:
- id: "survey"
- action: "+1"
diff --git a/example-client/src/CashRegisterSimulator.tsx b/example-client/src/CashRegisterSimulator.tsx
index d669eac..8d0b76c 100644
--- a/example-client/src/CashRegisterSimulator.tsx
+++ b/example-client/src/CashRegisterSimulator.tsx
@@ -65,12 +65,6 @@ const CashRegisterSimulator = ({ipAddress}: Props) => {
-
-
Basket
diff --git a/example-client/src/client.ts b/example-client/src/client.ts
index 71c94df..887a4b2 100644
--- a/example-client/src/client.ts
+++ b/example-client/src/client.ts
@@ -1,7 +1,7 @@
import _ from "lodash";
import useCashRegisterStore from "./store";
import {
- PaymentFailure, PaymentSuccess, StartPayment, Reset, CloseDialog, SetBasket, ShowDialog, SyncArticles, UserInput,
+ PaymentFailure, PaymentSuccess, StartPayment, Reset, SetBasket, SyncArticles,
ArticleWeighed, WeighingFailed, WeighArticle, ApiError, AddArticles, GuestAuthenticated, GuestRemoved, ApiWarning, UpdateBasket, BasketArticle, ScanArticle, SyncedArticle, I18Ned
} from "./types";
@@ -165,52 +165,6 @@ export class CashRegister {
await this.send(message)
}
-
- async showDialog() {
- const message: ShowDialog = {
- event: "showDialog",
- data: {
- id: "survey",
- title: {
- en: "Survey",
- de: "Umfrage",
- },
- body: {
- en: "How satisfied are you with the interface?",
- de: "Wie zufrieden sind Sie mit der Schnittstelle?",
- },
- buttons: [
- {
- action: "-1",
- label: {
- en: "Not at all",
- de: "Gar nicht",
- }
- },
- {
- action: "+1",
- label: {
- en: "A lot",
- de: "Sehr",
- }
- }
- ],
- }
- }
- await this.send(message)
- }
-
- async closeDialog() {
- const message: CloseDialog = {
- event: "closeDialog",
- data: {
- id: "survey",
- }
- }
- await this.send(message)
- }
-
-
async onSetBasket(message: SetBasket) {
const ScanArticles = this.toBasketArticles(message.data.articles)
if (_.isEmpty(ScanArticles)) {
@@ -265,15 +219,6 @@ export class CashRegister {
useCashRegisterStore.getState().reset()
}
- async onUserInput(message: UserInput) {
- if (message.data.id === "survey") {
- useCashRegisterStore.setState({
- surveyResult: useCashRegisterStore.getState().surveyResult
- + parseInt(message.data.action)
- })
- }
- }
-
private async weighArticle(parsedMessage: WeighArticle) {
useCashRegisterStore.setState({ scaleArticlePlu: parsedMessage.data.article.priceLookup })
}
@@ -285,7 +230,7 @@ export class CashRegister {
}
private async receiveMessage(message: MessageEvent) {
- const parsedMessage = JSON.parse(message.data) as SetBasket | AddArticles | StartPayment | Reset | UserInput | WeighArticle | ApiError | ApiWarning
+ const parsedMessage = JSON.parse(message.data) as SetBasket | AddArticles | StartPayment | Reset | WeighArticle | ApiError | ApiWarning
console.log("Received message:", message.data)
switch (parsedMessage.event) {
case "setBasket":
@@ -300,9 +245,6 @@ export class CashRegister {
case "reset":
await this.onReset()
break;
- case "userInput":
- await this.onUserInput(parsedMessage)
- break;
case "weighArticle":
await this.weighArticle(parsedMessage)
break;
diff --git a/example-client/src/generateTypes.ts b/example-client/src/generateTypes.ts
index b0e3d8f..7664e9c 100644
--- a/example-client/src/generateTypes.ts
+++ b/example-client/src/generateTypes.ts
@@ -1,5 +1,3 @@
-
-
import * as fs from "fs/promises"
import parser from '@asyncapi/parser';
import { compile } from 'json-schema-to-typescript'
diff --git a/example-client/src/types.ts b/example-client/src/types.ts
index 773ddfe..c662a5b 100644
--- a/example-client/src/types.ts
+++ b/example-client/src/types.ts
@@ -252,71 +252,6 @@ export interface PaymentFailure {
};
}
-export interface ShowDialog {
- event: "showDialog";
- data: {
- /**
- * Identifier for this kind of dialog. E.g. `cardReaderError`.
- */
- id: string;
- /**
- * Title of the dialog.
- */
- title: {
- /**
- * The English text.
- */
- en: string;
- /**
- * The German text.
- */
- de: string;
- };
- /**
- * Dialog body to display to the customer.
- */
- body: {
- /**
- * The English text.
- */
- en: string;
- /**
- * The German text.
- */
- de: string;
- };
- buttons?: {
- /**
- * Action the button will trigger when pressed.
- */
- action: string;
- /**
- * Label to display on the button.
- */
- label: {
- /**
- * The English text.
- */
- en: string;
- /**
- * The German text.
- */
- de: string;
- };
- }[];
- };
-}
-
-export interface CloseDialog {
- event: "closeDialog";
- data: {
- /**
- * Identifier for this kind of dialog. E.g. `cardReaderError`.
- */
- id: string;
- };
-}
-
export interface ApiError {
event?: "error";
data?: {
@@ -431,14 +366,6 @@ export interface PrintReceipt {
};
}
-export interface UserInput {
- event: "userInput";
- data: {
- id: string;
- action: string;
- };
-}
-
export interface Reset {
event: "reset";
}
@@ -599,58 +526,6 @@ export interface FailedPayment {
};
}
-export interface Dialog {
- /**
- * Identifier for this kind of dialog. E.g. `cardReaderError`.
- */
- id: string;
- /**
- * Title of the dialog.
- */
- title: {
- /**
- * The English text.
- */
- en: string;
- /**
- * The German text.
- */
- de: string;
- };
- /**
- * Dialog body to display to the customer.
- */
- body: {
- /**
- * The English text.
- */
- en: string;
- /**
- * The German text.
- */
- de: string;
- };
- buttons?: {
- /**
- * Action the button will trigger when pressed.
- */
- action: string;
- /**
- * Label to display on the button.
- */
- label: {
- /**
- * The English text.
- */
- en: string;
- /**
- * The German text.
- */
- de: string;
- };
- }[];
-}
-
export interface ApiError {
reason: "malformed" | "internal" | "unexpectedEvent" | "unknown";
message: string;