Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cash tracking session event targets for POS Compliance #2567

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/funny-walls-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions': minor
---

Add "pos.cash-tracking-session-start.event.observe", "pos.cash-tracking-session-cancel.event.observe", and "pos.cash-tracking-session-complete.event.observe" and renamed "pos.transaction-completed.event.observe".
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
import {ExtensionTargetType} from '../types/ExtensionTargetType';

const data: ReferenceEntityTemplateSchema = {
name: ExtensionTargetType.PosCashTrackingSessionCancelObserve,
description:
'An event extension target that observes when cash tracking session is canceled',
category: 'Targets',
subCategory: 'Cash tracking',
isVisualComponent: false,
related: [
{
name: ExtensionTargetType.PosCashTrackingSessionStartObserve,
url: '/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-start-observe',
},
{
name: ExtensionTargetType.PosCashTrackingSessionCompleteObserve,
url: '/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-complete-observe',
},
],
type: 'Target',
};

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

const data: ReferenceEntityTemplateSchema = {
name: ExtensionTargetType.PosCashTrackingSessionCompleteObserve,
description:
'An event extension target that observes when cash tracking session completes',
category: 'Targets',
subCategory: 'Cash tracking',
isVisualComponent: false,
related: [
{
name: ExtensionTargetType.PosCashTrackingSessionCancelObserve,
url: '/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-cancel-observe',
},
{
name: ExtensionTargetType.PosCashTrackingSessionStartObserve,
url: '/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-start-observe',
},
],
type: 'Target',
};

export default data;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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: [
{
name: ExtensionTargetType.PosCashTrackingSessionCancelObserve,
url: '/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-cancel-observe',
},
{
name: ExtensionTargetType.PosCashTrackingSessionCompleteObserve,
url: '/docs/api/pos-ui-extensions/targets/cash-tracking/pos-cash-tracking-session-complete-observe',
},
],
type: 'Target',
};

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

const data: ReferenceEntityTemplateSchema = {
name: ExtensionTargetType.PosTransactionCompletedObserve,
name: ExtensionTargetType.PosTransactionCompleteObserve,
description: 'An event extension target that observes completed transactions',
category: 'Targets',
subCategory: 'Post-purchase',
Expand Down
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',
PosTransactionCompleteObserve = 'pos.transaction-complete.event.observe',
PosCashTrackingSessionStartObserve = 'pos.cash-tracking-session-start.event.observe',
PosCashTrackingSessionCancelObserve = 'pos.cash-tracking-session-cancel.event.observe',
PosCashTrackingSessionCompleteObserve = '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)',
PosTransactionCompleteObserve = '[pos.transaction-complete.event.observe](/docs/api/pos-ui-extensions/targets/post-purchase/pos-transaction-complete-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)',
PosCashTrackingSessionCompleteObserve = '[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 @@ -48,7 +48,8 @@ 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 the ${TargetLink.PosTransactionCompleteObserve} target.
- Added support for cash tracking session. ${TargetLink.PosCashTrackingSessionStartObserve}, ${TargetLink.PosCashTrackingSessionCancelObserve}, ${TargetLink.PosCashTrackingSessionCompleteObserve} targets.
`,
},
{
Expand Down
fatbattk marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {BaseInput} from './BaseInput';

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

export interface CashTrackingSessionCompleteInput extends BaseInput {
cashTrackingSession: {
id: number;
openingTime: string;
closingTime: string;
};
}

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

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

export type EventExtensionTarget = keyof EventExtensionTargets;
Loading