@hantera/portal-app 20230818.1.0

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.
Files changed (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/backend-api.d.ts +60 -0
  4. package/dist/commands.d.ts +137 -0
  5. package/dist/composition/use-backend-api.d.ts +5 -0
  6. package/dist/composition/use-context.d.ts +6 -0
  7. package/dist/composition/use-dialogs.d.ts +7 -0
  8. package/dist/composition/use-formatting.d.ts +13 -0
  9. package/dist/composition/use-host.d.ts +8 -0
  10. package/dist/composition/use-phrases.d.ts +3 -0
  11. package/dist/formatting.d.ts +20 -0
  12. package/dist/host.d.ts +16 -0
  13. package/dist/index.d.ts +58 -0
  14. package/dist/keys.d.ts +42 -0
  15. package/dist/models/activity-log.d.ts +12 -0
  16. package/dist/models/address.d.ts +14 -0
  17. package/dist/models/adjustment-category.d.ts +4 -0
  18. package/dist/models/adjustment.d.ts +9 -0
  19. package/dist/models/customer.d.ts +6 -0
  20. package/dist/models/delivery.d.ts +29 -0
  21. package/dist/models/draft-command.d.ts +4 -0
  22. package/dist/models/field.d.ts +5 -0
  23. package/dist/models/index.d.ts +24 -0
  24. package/dist/models/inventory-item.d.ts +6 -0
  25. package/dist/models/invoice.d.ts +11 -0
  26. package/dist/models/item.d.ts +5 -0
  27. package/dist/models/order-draft-changes.d.ts +10 -0
  28. package/dist/models/order-ledger-entry.d.ts +10 -0
  29. package/dist/models/order-row.d.ts +19 -0
  30. package/dist/models/order.d.ts +47 -0
  31. package/dist/models/payment-capture.d.ts +10 -0
  32. package/dist/models/payment.d.ts +15 -0
  33. package/dist/models/rma-row.d.ts +29 -0
  34. package/dist/models/rma.d.ts +20 -0
  35. package/dist/models/rule.d.ts +13 -0
  36. package/dist/models/state-transition.d.ts +5 -0
  37. package/dist/models/stock.d.ts +4 -0
  38. package/dist/models/tag.d.ts +6 -0
  39. package/dist/models/unidentified-rma-row.d.ts +5 -0
  40. package/dist/user-permissions.d.ts +21 -0
  41. package/package.json +21 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Hantera AB
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ This package contains the type definitions needed to author Hantera Apps. See @hantera/cli for more info.
@@ -0,0 +1,60 @@
1
+ import { Command } from "./commands";
2
+ import { Order, Stock } from './models';
3
+ export interface BackendApi {
4
+ fetch: BackendFetch;
5
+ orders: BackendApiOrders;
6
+ stock: BackendApiStock;
7
+ }
8
+ export interface BackendFetch {
9
+ (path: RequestInfo, options?: RequestInit): Promise<Response>;
10
+ }
11
+ export interface CommandGroup {
12
+ /**
13
+ * Adds a command to the command group
14
+ * @param type of the command
15
+ * @param body the command arguments
16
+ */
17
+ command<T>(type: Command<T>, body: T): CommandGroup;
18
+ /**
19
+ * Adds/Saves the command group to the draft
20
+ */
21
+ send(): Promise<void>;
22
+ }
23
+ export interface BackendApiOrders {
24
+ /**
25
+ * Get a specific order. Will return a reactive cached version if available, that will be rehydrated against backend
26
+ * @param orderId
27
+ */
28
+ get(orderId: string): Promise<Order | undefined>;
29
+ /**
30
+ * Force Hantera to refresh the order from server
31
+ * @param orderId
32
+ */
33
+ refresh(orderId: string): Promise<void>;
34
+ /**
35
+ * Creates a new draft command group
36
+ * @param orderId of the order to save the command group to
37
+ * @param phraseTemplate is a Phrase template displayed to the user in the draft changes list
38
+ * @param fields is a list of dynamic values that can be bind to the message template with curly braces to make phraseTemplate translatable
39
+ */
40
+ buildCommandGroup(orderId: string, message: string, fields: {
41
+ [name: string]: any;
42
+ }): CommandGroup;
43
+ /**
44
+ * Saves all draft command groups of the specified order
45
+ * @param orderId of the order to save
46
+ */
47
+ save<T>(orderId: string): Promise<void>;
48
+ /**
49
+ * Removes all draft command groups starting from the specified one. All subsequent groups will be removed to maintain integrity of those commands.
50
+ * @param orderId
51
+ */
52
+ removeCommandGroup<T>(orderId: string, commandGroupId: string): Promise<void>;
53
+ }
54
+ export interface BackendApiStock {
55
+ /**
56
+ * Fetches the current stock for the given items
57
+ * @param itemNumbers to fetch stock information of
58
+ */
59
+ get(itemNumbers: string[]): Promise<Stock | undefined>;
60
+ }
@@ -0,0 +1,137 @@
1
+ import { Decimal } from "decimal.js";
2
+ import * as models from './models';
3
+ export interface Command<T> {
4
+ type: string;
5
+ }
6
+ export declare const order: {
7
+ updateRowQuantity: Command<{
8
+ rowId: string;
9
+ newQuantity: Decimal;
10
+ }>;
11
+ addOrderTag: Command<{
12
+ tagNumber: Decimal;
13
+ }>;
14
+ removeOrderTag: Command<{
15
+ tagNumber: Decimal;
16
+ }>;
17
+ addDeliveryTag: Command<{
18
+ deliveryId: string;
19
+ tagNumber: Decimal;
20
+ }>;
21
+ removeDeliveryTag: Command<{
22
+ deliveryId: string;
23
+ tagNumber: Decimal;
24
+ }>;
25
+ addDelivery: Command<{
26
+ deliveryId: string;
27
+ deliveryMethodId: string;
28
+ inventoryId: string;
29
+ deliveryAddress: models.Address;
30
+ priceWithVat?: Decimal | undefined;
31
+ }>;
32
+ upsertDeliveryField: Command<{
33
+ deliveryId: string;
34
+ fieldKey: string;
35
+ fieldValue: any;
36
+ }>;
37
+ addRow: Command<{
38
+ deliveryId: string;
39
+ newRowId: string;
40
+ articleNumber: string;
41
+ quantity: Decimal;
42
+ unitPriceWithoutVat?: Decimal | undefined;
43
+ }>;
44
+ upsertRowField: Command<{
45
+ rowId: string;
46
+ fieldKey: string;
47
+ fieldValue: any;
48
+ }>;
49
+ updateRowLostQuantity: Command<{
50
+ rowId: string;
51
+ newQuantity: Decimal;
52
+ }>;
53
+ addActivityLog: Command<{
54
+ message: string;
55
+ fields: {
56
+ [fieldKey: string]: any;
57
+ };
58
+ }>;
59
+ setDeliveryAddress: Command<{
60
+ deliveryId: string;
61
+ address: models.Address;
62
+ }>;
63
+ setBillingAddress: Command<{
64
+ address: models.Address;
65
+ }>;
66
+ updateRmaRowQuantity: Command<{
67
+ rmaId: string;
68
+ rmaRowId: string;
69
+ quantity: Decimal;
70
+ }>;
71
+ upsertRmaRowField: Command<{
72
+ rmaId: string;
73
+ rmaRowId: string;
74
+ fieldKey: string;
75
+ fieldValue: any;
76
+ }>;
77
+ upsertRmaRowExchange: Command<{
78
+ rmaId: string;
79
+ rmaRowId: string;
80
+ exchangeArticleNumber: string | null;
81
+ exchangeQuantity?: Decimal | undefined;
82
+ inventorySystemId?: string | undefined;
83
+ unitPriceWithVat?: Decimal | undefined;
84
+ }>;
85
+ setRmaRowApproval: Command<{
86
+ rmaId: string;
87
+ rmaRowId: string;
88
+ approved: boolean;
89
+ }>;
90
+ completeRma: Command<{
91
+ rmaId: string;
92
+ }>;
93
+ setDeliveryAsProcessing: Command<{
94
+ deliveryId: string;
95
+ }>;
96
+ setDeliveryAsReleased: Command<{
97
+ deliveryId: string;
98
+ }>;
99
+ setRmaRowReference: Command<{
100
+ rmaId: string;
101
+ rmaRowId: string;
102
+ newOrderRowId: string;
103
+ }>;
104
+ addOrUpdateRmaAdjustment: Command<{
105
+ rmaId: string;
106
+ rmaAdjustmentId: string;
107
+ priceWithVat: Decimal;
108
+ }>;
109
+ upsertRmaAdjustmentField: Command<{
110
+ rmaId: string;
111
+ rmaAdjustmentId: string;
112
+ fieldKey: string;
113
+ fieldValue: any;
114
+ }>;
115
+ removeRmaAdjustment: Command<{
116
+ rmaId: string;
117
+ rmaAdjustmentId: string;
118
+ }>;
119
+ addOrUpdateAdjustment: Command<{
120
+ adjustmentId: string;
121
+ priceWithVat: Decimal;
122
+ affectedRows?: string[] | undefined;
123
+ }>;
124
+ upsertAdjustmentField: Command<{
125
+ adjustmentId: string;
126
+ fieldKey: string;
127
+ fieldValue: any;
128
+ }>;
129
+ removeAdjustment: Command<{
130
+ adjustmentId: string;
131
+ }>;
132
+ rebalancePayments: Command<{}>;
133
+ upsertOrderField: Command<{
134
+ fieldKey: string;
135
+ fieldValue: any;
136
+ }>;
137
+ };
@@ -0,0 +1,5 @@
1
+ export default function useBackendApi(): {
2
+ fetch: import('../backend-api').BackendFetch;
3
+ orders: import('../backend-api').BackendApiOrders;
4
+ stock: import('../backend-api').BackendApiStock;
5
+ };
@@ -0,0 +1,6 @@
1
+ export default function (): {
2
+ serverUrl(): string;
3
+ instanceName(): string;
4
+ legacyUrl(): string;
5
+ permissions(): import("..").UserPermissions;
6
+ };
@@ -0,0 +1,7 @@
1
+ export default function (): {
2
+ add(label: string, component: any, showClose?: boolean, props?: object): {
3
+ open: () => void;
4
+ openModal: () => void;
5
+ close: () => void;
6
+ };
7
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @returns functions to format values to strings based on the user's settings
3
+ */
4
+ export default function useFormatting(): {
5
+ currency(value: import("decimal.js").default, currencyCode: string, display?: import('../formatting').CurrencyDisplay | undefined): string;
6
+ percent(value: import("decimal.js").default): string;
7
+ number(value: number | import("decimal.js").default): string;
8
+ country(countryCode: string): string;
9
+ dateTime(date: Date): string;
10
+ date(date: Date): string;
11
+ time(date: Date): string;
12
+ cleanNumberInput(input: string): string;
13
+ };
@@ -0,0 +1,8 @@
1
+ export default function (): {
2
+ send(message: import("@hantera/portal-contracts").Message): void;
3
+ createProcess(description: string): {
4
+ complete: () => void;
5
+ fail: (reason: string) => void;
6
+ };
7
+ error(reason: string): void;
8
+ };
@@ -0,0 +1,3 @@
1
+ export default function usePhrases(context?: string): (template: string, fields?: {
2
+ [key: string]: any;
3
+ }) => string;
@@ -0,0 +1,20 @@
1
+ import Decimal from "decimal.js";
2
+ export interface Formatting {
3
+ currency(value: Decimal, currencyCode: string, display?: CurrencyDisplay): string;
4
+ percent(value: Decimal): string;
5
+ number(value: Decimal | number): string;
6
+ country(countryCode: string): string;
7
+ dateTime(date: Date): string;
8
+ date(date: Date): string;
9
+ time(date: Date): string;
10
+ /**
11
+ * Cleans user input in browser's locale to invariant culture.
12
+ */
13
+ cleanNumberInput(input: string): string;
14
+ }
15
+ export declare enum CurrencyDisplay {
16
+ localized = 0,
17
+ symbol = 1,
18
+ code = 2,
19
+ none = 3
20
+ }
package/dist/host.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Message } from '@hantera/portal-contracts';
2
+ export interface Host {
3
+ /**
4
+ * Send a message to the portal host
5
+ * @param message
6
+ */
7
+ send(message: Message): void;
8
+ /**
9
+ * Creates and sends process information to the host to be displayed to the user.
10
+ */
11
+ createProcess(description: string): {
12
+ complete: () => void;
13
+ fail: (reason: string) => void;
14
+ };
15
+ error(reason: string): void;
16
+ }
@@ -0,0 +1,58 @@
1
+ import { Component } from 'vue';
2
+ import { PortalContext } from './keys';
3
+ export interface AppSlot {
4
+ key: string;
5
+ }
6
+ export interface Portal {
7
+ context: PortalContext;
8
+ registerComponent: (slot: AppSlot, component: Component) => void;
9
+ }
10
+ export declare const StandardSlots: {
11
+ order: {
12
+ details: {
13
+ beforeSummary: AppSlot;
14
+ afterSummary: AppSlot;
15
+ beforeNotes: AppSlot;
16
+ afterNotes: AppSlot;
17
+ beforeAddress: AppSlot;
18
+ afterAddress: AppSlot;
19
+ beforeCustomer: AppSlot;
20
+ afterCustomer: AppSlot;
21
+ };
22
+ delivery: {
23
+ header: AppSlot;
24
+ footer: AppSlot;
25
+ details: AppSlot;
26
+ rows: AppSlot;
27
+ contextMenu: AppSlot;
28
+ rowDetails: AppSlot;
29
+ };
30
+ contextMenu: AppSlot;
31
+ rma: {
32
+ details: AppSlot;
33
+ footer: AppSlot;
34
+ rows: AppSlot;
35
+ contextMenu: AppSlot;
36
+ row: AppSlot;
37
+ };
38
+ };
39
+ payment: {
40
+ contextMenu: AppSlot;
41
+ };
42
+ };
43
+ export { default as useContext } from './composition/use-context';
44
+ export { default as useHost } from './composition/use-host';
45
+ export { default as useBackendApi } from './composition/use-backend-api';
46
+ export { default as useFormatting } from './composition/use-formatting';
47
+ export { default as usePhrases } from './composition/use-phrases';
48
+ export { default as useDialogs } from './composition/use-dialogs';
49
+ export type { Host } from './host';
50
+ export type { Command } from './commands';
51
+ export type { UserPermissions } from './user-permissions';
52
+ export type { Formatting } from './formatting';
53
+ export { CurrencyDisplay } from './formatting';
54
+ export * from './keys';
55
+ export * as models from './models';
56
+ export * as commands from './commands';
57
+ export * from './backend-api';
58
+ export * from '@hantera/design-system';
package/dist/keys.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import { Delivery, Order, OrderRow } from './models';
3
+ import { Host } from './host';
4
+ import { BackendApi } from './backend-api';
5
+ import { UserPermissions } from './user-permissions';
6
+ export interface PortalContext {
7
+ serverUrl(): string;
8
+ instanceName(): string;
9
+ /**
10
+ * URL to legacy Hantera. Used for legacy customizations.
11
+ * @deprecated Avoid using if possible as it will be removed
12
+ */
13
+ legacyUrl(): string;
14
+ /**
15
+ * Current user's permissions
16
+ */
17
+ permissions(): UserPermissions;
18
+ }
19
+ /**
20
+ * Provides contextual information about the current session
21
+ */
22
+ export declare const contextKey: InjectionKey<PortalContext>;
23
+ /**
24
+ * Provides access to backend API for fetching and saving data
25
+ */
26
+ export declare const backendApiKey: InjectionKey<BackendApi>;
27
+ /**
28
+ * Interface for communicating with the Portal Host
29
+ */
30
+ export declare const hostKey: InjectionKey<Host>;
31
+ /**
32
+ * Provides the current order if any
33
+ */
34
+ export declare const orderKey: InjectionKey<Ref<Order>>;
35
+ /**
36
+ * Provides the current delivery if any
37
+ */
38
+ export declare const deliveryKey: InjectionKey<Delivery>;
39
+ /**
40
+ * Provides the current order row if any
41
+ */
42
+ export declare const orderRowKey: InjectionKey<OrderRow>;
@@ -0,0 +1,12 @@
1
+ export interface ActivityLog {
2
+ createdUtc: Date;
3
+ user: string;
4
+ userId: string;
5
+ template: string;
6
+ fields: [
7
+ {
8
+ name: string;
9
+ value: any;
10
+ }
11
+ ];
12
+ }
@@ -0,0 +1,14 @@
1
+ export interface Address {
2
+ firstName: string;
3
+ lastName: string;
4
+ organizationName: string;
5
+ careOf: string;
6
+ address1: string;
7
+ address2: string;
8
+ city: string;
9
+ countryCode: string;
10
+ state: string;
11
+ postalCode: string;
12
+ email: string;
13
+ phoneNumber: string;
14
+ }
@@ -0,0 +1,4 @@
1
+ export interface AdjustmentCategory {
2
+ code: string;
3
+ name: string;
4
+ }
@@ -0,0 +1,9 @@
1
+ import Decimal from "decimal.js";
2
+ import { Field } from "./field";
3
+ import { Rule } from "./rule";
4
+ export interface Adjustment {
5
+ adjustmentTotal: Decimal;
6
+ adjustmentVat: Decimal;
7
+ fields: Field[];
8
+ orderRule: Rule;
9
+ }
@@ -0,0 +1,6 @@
1
+ export interface Customer {
2
+ customerName: string;
3
+ customerNumber: string;
4
+ email: string;
5
+ phoneNumber: string;
6
+ }
@@ -0,0 +1,29 @@
1
+ import Decimal from "decimal.js";
2
+ import { Tag } from "./tag";
3
+ import { StateTransition } from "./state-transition";
4
+ import { Adjustment } from "./adjustment";
5
+ import { OrderRow } from "./order-row";
6
+ import { Address } from "./address";
7
+ export interface Delivery {
8
+ adjustments: Adjustment[];
9
+ deliveryId: string;
10
+ deliveryNumber: string;
11
+ rows: OrderRow[];
12
+ deliveryTotal: Decimal;
13
+ deliveryVat: Decimal;
14
+ deliveryMethodId: string;
15
+ deliveryMethod: string;
16
+ createdUtc: Date;
17
+ inventoryId: string;
18
+ inventoryName: string;
19
+ inventoryDateUtc: Date;
20
+ state: 'Picking' | 'Open' | 'Cancelled' | 'Shipped' | 'Delivered' | 'Lost';
21
+ stateTransitions: StateTransition[];
22
+ deliveryAddress: Address;
23
+ fields: {
24
+ [key: string]: any;
25
+ };
26
+ tags: Tag[];
27
+ trackingNumber: string;
28
+ trackingUrl: string;
29
+ }
@@ -0,0 +1,4 @@
1
+ export interface DraftCommand {
2
+ type: string;
3
+ body: any;
4
+ }
@@ -0,0 +1,5 @@
1
+ export interface Field {
2
+ id: string;
3
+ name: string;
4
+ value: string;
5
+ }
@@ -0,0 +1,24 @@
1
+ export type { ActivityLog } from './activity-log';
2
+ export type { Address } from './address';
3
+ export type { AdjustmentCategory } from './adjustment-category';
4
+ export type { Adjustment } from './adjustment';
5
+ export type { Customer } from './customer';
6
+ export type { Delivery } from './delivery';
7
+ export type { DraftCommand } from './draft-command';
8
+ export type { Field } from './field';
9
+ export type { Invoice } from './invoice';
10
+ export type { Item } from './item';
11
+ export type { OrderDraftChanges } from './order-draft-changes';
12
+ export type { OrderRow } from './order-row';
13
+ export type { Order } from './order';
14
+ export type { PaymentCapture } from './payment-capture';
15
+ export type { Payment } from './payment';
16
+ export type { RmaRow } from './rma-row';
17
+ export type { Rma } from './rma';
18
+ export type { Rule } from './rule';
19
+ export type { StateTransition } from './state-transition';
20
+ export type { Tag } from './tag';
21
+ export type { UnidentifiedRmaRow } from './unidentified-rma-row';
22
+ export type { Stock } from './stock';
23
+ export type { InventoryItem } from './inventory-item';
24
+ export type { OrderLedgerEntry } from './order-ledger-entry';
@@ -0,0 +1,6 @@
1
+ import Decimal from "decimal.js";
2
+ export interface InventoryItem {
3
+ physicalStock: Decimal;
4
+ availablePhysicalStock: Decimal;
5
+ inventoryId: string;
6
+ }
@@ -0,0 +1,11 @@
1
+ import Decimal from "decimal.js";
2
+ import { PaymentCapture } from "./payment-capture";
3
+ export interface Invoice {
4
+ createdUtc: Date;
5
+ invoiceId: string;
6
+ invoiceNumber: Decimal;
7
+ invoiceTotal: Decimal;
8
+ invoiceVat: Decimal;
9
+ isCancelled: boolean;
10
+ captures: PaymentCapture;
11
+ }
@@ -0,0 +1,5 @@
1
+ export interface Item {
2
+ articleNumber: string;
3
+ name: string;
4
+ image: string;
5
+ }
@@ -0,0 +1,10 @@
1
+ import { DraftCommand } from "./draft-command";
2
+ export interface OrderDraftChanges {
3
+ commandGroupId: string;
4
+ orderId: string;
5
+ message: string;
6
+ fields: {
7
+ [key: string]: any;
8
+ };
9
+ commands: DraftCommand[];
10
+ }
@@ -0,0 +1,10 @@
1
+ import Decimal from "decimal.js";
2
+ export interface OrderLedgerEntry {
3
+ actionType: string;
4
+ amount: Decimal;
5
+ invoiceId: string;
6
+ ledgerRowId: string;
7
+ paymentExternalId: string;
8
+ timestampUtc: Date;
9
+ transactionExternalId: string;
10
+ }
@@ -0,0 +1,19 @@
1
+ import Decimal from "decimal.js";
2
+ import { Item } from "./item";
3
+ import { Adjustment } from "./adjustment";
4
+ import { Field } from "./field";
5
+ import { InventoryItem } from "./inventory-item";
6
+ export interface OrderRow {
7
+ unitPrice: Decimal;
8
+ quantity: Decimal;
9
+ reservedQuantity: Decimal;
10
+ returnedQuantity: Decimal;
11
+ lostQuantity: Decimal;
12
+ rowId: string;
13
+ item: Item;
14
+ rowTotal: Decimal;
15
+ vatPercentage: Decimal;
16
+ adjustments: Adjustment[];
17
+ fields: Field[];
18
+ stock: InventoryItem[];
19
+ }
@@ -0,0 +1,47 @@
1
+ import { StateTransition } from "./state-transition";
2
+ import { AdjustmentCategory } from "./adjustment-category";
3
+ import Decimal from "decimal.js";
4
+ import { Customer } from "./customer";
5
+ import { Delivery } from "./delivery";
6
+ import { Rule } from "./rule";
7
+ import { Payment } from "./payment";
8
+ import { Invoice } from "./invoice";
9
+ import { Tag } from "./tag";
10
+ import { ActivityLog } from "./activity-log";
11
+ import { OrderDraftChanges } from "./order-draft-changes";
12
+ import { Rma } from "./rma";
13
+ import { Address } from "./address";
14
+ import { OrderLedgerEntry } from "./order-ledger-entry";
15
+ export interface Order {
16
+ orderId: string;
17
+ orderNumber: string;
18
+ channelId: string;
19
+ channelName: string;
20
+ customer: Customer;
21
+ grandTotal: Decimal;
22
+ orderTotal: Decimal;
23
+ orderVat: Decimal;
24
+ deliveriesTotal: Decimal;
25
+ deliveries: Delivery[];
26
+ rules: Rule[];
27
+ currencyCode: string;
28
+ countryCode: string;
29
+ payments: Payment[];
30
+ invoices: Invoice[];
31
+ state: string;
32
+ createdUtc: Date;
33
+ stateTransitions: StateTransition[];
34
+ tags: Tag[];
35
+ draftChanges?: OrderDraftChanges[];
36
+ activityLogs: ActivityLog[];
37
+ includeVat: boolean;
38
+ rmas: Rma[];
39
+ adjustmentCategories: AdjustmentCategory[];
40
+ invoiceAddress: Address;
41
+ ledger: OrderLedgerEntry[];
42
+ comments: string;
43
+ language: string;
44
+ fields: {
45
+ [key: string]: any;
46
+ };
47
+ }
@@ -0,0 +1,10 @@
1
+ import Decimal from "decimal.js";
2
+ export interface PaymentCapture {
3
+ amount: Decimal;
4
+ capturedAmount: Decimal;
5
+ captureExternalId: string;
6
+ isSuccessful: boolean;
7
+ payment: {
8
+ paymentId: string;
9
+ };
10
+ }
@@ -0,0 +1,15 @@
1
+ import Decimal from "decimal.js";
2
+ export interface Payment {
3
+ reservedAmount: Decimal;
4
+ unreservedAmount: Decimal;
5
+ refundedAmount: Decimal;
6
+ paidAmount: Decimal;
7
+ providerName: string;
8
+ paymentId: string;
9
+ paymentNumber: string;
10
+ methodName: string;
11
+ paymentDateUtc: Date;
12
+ externalId: string;
13
+ description: string;
14
+ clearedAmount: Decimal;
15
+ }
@@ -0,0 +1,29 @@
1
+ import Decimal from "decimal.js";
2
+ import { OrderRow } from "./order-row";
3
+ export interface RmaRow {
4
+ rmaRowId: string;
5
+ approved: boolean;
6
+ quantity: Decimal;
7
+ received: Decimal;
8
+ exchange?: {
9
+ article: {
10
+ articleNumber: string;
11
+ image: string;
12
+ name: string;
13
+ };
14
+ exchangeTotal: Decimal;
15
+ exchangeVat: Decimal;
16
+ quantity: Decimal;
17
+ reservedQuantity: Decimal;
18
+ unitPrice: Decimal;
19
+ };
20
+ refundRowTotal: Decimal;
21
+ inventoryComment: string;
22
+ inventoryDecision: string;
23
+ inventoryDecisions: {
24
+ name: string;
25
+ value: string;
26
+ }[];
27
+ reason: string;
28
+ orderRow: OrderRow;
29
+ }
@@ -0,0 +1,20 @@
1
+ import Decimal from "decimal.js";
2
+ import { StateTransition } from "./state-transition";
3
+ import { UnidentifiedRmaRow } from "./unidentified-rma-row";
4
+ import { Adjustment } from "./adjustment";
5
+ import { RmaRow } from "./rma-row";
6
+ export interface Rma {
7
+ rmaId: string;
8
+ rmaNumber: string;
9
+ state: 'Init' | 'PackageReceived' | 'Processing' | 'Completed';
10
+ stateTransitions: StateTransition[];
11
+ comments: string;
12
+ createdUtc: Date;
13
+ lastUpdatedUtc: Date;
14
+ images: string[];
15
+ refundTotal: Decimal;
16
+ refundVat: Decimal;
17
+ rows: RmaRow[];
18
+ adjustments: Adjustment[];
19
+ unidentifiedProducts: UnidentifiedRmaRow[];
20
+ }
@@ -0,0 +1,13 @@
1
+ import Decimal from "decimal.js";
2
+ import { Field } from "./field";
3
+ export interface Rule {
4
+ orderRuleId: string;
5
+ ruleId: string;
6
+ ruleExternalId: string;
7
+ name: string;
8
+ description: string;
9
+ ruleTotal: Decimal;
10
+ ruleVat: Decimal;
11
+ sourceType: string;
12
+ fields: Field[];
13
+ }
@@ -0,0 +1,5 @@
1
+ export interface StateTransition {
2
+ fromState: string;
3
+ toState: string;
4
+ timestampUtc: Date;
5
+ }
@@ -0,0 +1,4 @@
1
+ import { InventoryItem } from "./inventory-item";
2
+ export interface Stock {
3
+ [itemNumber: string]: InventoryItem[];
4
+ }
@@ -0,0 +1,6 @@
1
+ import Decimal from "decimal.js";
2
+ export interface Tag {
3
+ tagName: string;
4
+ tagNumber: Decimal;
5
+ actionId: string;
6
+ }
@@ -0,0 +1,5 @@
1
+ export interface UnidentifiedRmaRow {
2
+ description: string;
3
+ id: string;
4
+ images: string[];
5
+ }
@@ -0,0 +1,21 @@
1
+ export interface UserPermissions {
2
+ fields: {
3
+ customer: string[];
4
+ delivery: string[];
5
+ inventoryItem: string[];
6
+ invoice: string[];
7
+ item: string[];
8
+ order: string[];
9
+ orderRow: string[];
10
+ payment: string[];
11
+ rma: string[];
12
+ rmaExchange: string[];
13
+ rmaRow: string[];
14
+ };
15
+ orderCommands: string[];
16
+ custom: {
17
+ portal: {
18
+ developer: boolean;
19
+ };
20
+ };
21
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@hantera/portal-app",
3
+ "version": "20230818.1.0",
4
+ "types": "./dist/index.d.ts",
5
+ "scripts": {
6
+ "build": "cpx ../../portal/portal-app/dist/**/*.d.ts ./dist -C"
7
+ },
8
+ "files": [
9
+ "dist/*",
10
+ "LICENSE"
11
+ ],
12
+ "license": "MIT",
13
+ "dependencies": {
14
+ "decimal.js": "^10.4.2",
15
+ "vue": "^3.3.4"
16
+ },
17
+ "devDependencies": {
18
+ "cpx": "^1.5.0",
19
+ "rimraf": "^5.0.1"
20
+ }
21
+ }