Skip to content

Commit

Permalink
Add cash tracking session event targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
fatbattk committed Jan 17, 2025
1 parent 46f5749 commit d9bd94c
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
import {ExtensionTargetType} from '../types/ExtensionTargetType';

const data: ReferenceEntityTemplateSchema = {
name: ExtensionTargetType.PosCashTrackingSessionStartObserve,
description:
'An event extension target that observes when cash tracking session is canceled',
category: 'Targets',
subCategory: 'Cash tracking',
isVisualComponent: false,
related: [],
type: 'Target',
};

export default data;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
import {ExtensionTargetType} from '../types/ExtensionTargetType';

const data: ReferenceEntityTemplateSchema = {
name: ExtensionTargetType.PosCashTrackingSessionStartObserve,
description:
'An event extension target that observes when cash tracking session completes',
category: 'Targets',
subCategory: 'Cash tracking',
isVisualComponent: false,
related: [],
type: 'Target',
};

export default data;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
import {ExtensionTargetType} from '../types/ExtensionTargetType';

const data: ReferenceEntityTemplateSchema = {
name: ExtensionTargetType.PosCashTrackingSessionStartObserve,
description:
'An event extension target that observes when cash tracking session starts',
category: 'Targets',
subCategory: 'Cash tracking',
isVisualComponent: false,
related: [],
type: 'Target',
};

export default data;
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export enum ExtensionTargetType {
PosDraftOrderDetailsActionMenuItemRender = 'pos.draft-order-details.action.menu-item.render',
PosDraftOrderDetailsActionRender = 'pos.draft-order-details.action.render',
PosDraftOrderDetailsBlockRender = 'pos.draft-order-details.block.render',
PosTransactionCompletedObserve = 'pos.transaction-completed.observe',
PosTransactionCompletedObserve = 'pos.transaction-completed.event.observe',
PosCashTrackingSessionStartObserve = 'pos.cash-tracking-session-start.event.observe',
PosCashTrackingSessionCancelObserve = 'pos.cash-tracking-session-cancel.event.observe',
PosCashTrackingSessionCompleteObserver = 'pos.cash-tracking-session-complete.event.observe',
}

export enum TargetLink {
Expand All @@ -37,5 +40,8 @@ export enum TargetLink {
PosDraftOrderDetailsActionMenuItemRender = '[pos.draft-order-details.action.menu-item.render](/docs/api/pos-ui-extensions/targets/draft-order-details/pos-draft-order-details-action-menu-item-render)',
PosDraftOrderDetailsActionRender = '[pos.draft-order-details.action.render](/docs/api/pos-ui-extensions/targets/draft-order-details/pos-draft-order-details-action-render)',
PosDraftOrderDetailsBlockRender = '[pos.draft-order-details.block.render](/docs/api/pos-ui-extensions/targets/draft-order-details/pos-draft-order-details-block-render)',
PosTransactionCompletedObserve = '[pos.transaction-completed.observe](/docs/api/pos-ui-extensions/targets/post-purchase/pos-transaction-completed-observe)',
PosTransactionCompletedObserve = '[pos.transaction-completed.event.observe](/docs/api/pos-ui-extensions/targets/post-purchase/pos-transaction-completed-observe)',
PosCashTrackingSessionStartObserve = '[pos.cash-tracking-session-start.event.observe](/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-start-observe)',
PosCashTrackingSessionCancelObserve = '[pos.cash-tracking-session-cancel.event.observe](/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-cancel-observe)',
PosCashTrackingSessionCompleteObserver = '[pos.cash-tracking-session-complete.event.observe](/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-complete-observe)',
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Refer to the [migration guide](/docs/api/pos-ui-extensions/migrating) for more i
### Features
- Added support for the ${TargetLink.PosTransactionCompletedObserve} target.
- Added support for cash tracking session. ${TargetLink.PosCashTrackingSessionStartObserve}, ${TargetLink.PosCashTrackingSessionCancelObserve}, ${TargetLink.PosCashTrackingSessionCompleteObserver} targets.
`,
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {BaseInput} from './BaseInput';

export interface CashTrackingSessionStartInput extends BaseInput {
id: string;
openingTime: string;
}

export interface CashTrackingSessionEndInput extends BaseInput {
id: string;
closingTime: string;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import {BaseIntent} from '../intent';
import {
CashTrackingSessionStartInput,
CashTrackingSessionEndInput,
} from './input/CashTrackingSessionInput';
import {PurchaseCompleteInput} from './input/PurchaseCompleteInput';

export interface EventExtensionTargets {
'pos.transaction-completed.observe': (
'pos.transaction-completed.event.observe': (
input: PurchaseCompleteInput,
) => BaseIntent;
'pos.cash-tracking-session-start.event.observe': (
input: CashTrackingSessionStartInput,
) => BaseIntent;
'pos.cash-tracking-session-cancel.event.observe': (
input: CashTrackingSessionEndInput,
) => BaseIntent;
'pos.cash-tracking-session-complete.event.observe': (
input: CashTrackingSessionEndInput,
) => BaseIntent;
}

export type EventExtensionTarget = keyof EventExtensionTargets;

0 comments on commit d9bd94c

Please sign in to comment.