Skip to content

Commit

Permalink
Adds order-confirmation api
Browse files Browse the repository at this point in the history
Adds confirmationNumber to order

Fixes formatting

Fixes formatting

Adds changeset
  • Loading branch information
thitemple committed Jan 26, 2024
1 parent a1a9a88 commit 2e0c01f
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-vans-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/ui-extensions': minor
---

Exposes order-confirmation api and adds confirmationNumber to order
4 changes: 4 additions & 0 deletions packages/ui-extensions/src/surfaces/checkout/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ export type {
CheckoutApi,
} from './api/checkout/checkout';
export type {Order, OrderStatusApi} from './api/order-status/order-status';
export type {
OrderConfirmation,
OrderConfirmationApi,
} from './api/order-confirmation/order-confirmation';

export type {CartLineItemApi} from './api/cart-line/cart-line-item';
export type {PickupLocationListApi} from './api/pickup/pickup-location-list';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type {StatefulRemoteSubscribable} from '@remote-ui/async-subscription';

export interface OrderConfirmation {
order: {
/**
* The globally-uniqueID of the OrderConfirmation. This will be the ID of the Order once successfully created.
*/
id: string;
};
/**
* A randomly generated alpha-numeric identifier for the order.
* This number should always be present, but 2023 orders predate confirmation numbers and may not have it.
*/
number?: string;
}

export interface OrderConfirmationApi {
/**
* Order information that's available post-checkout.
*/
orderConfirmation: StatefulRemoteSubscribable<OrderConfirmation>;
}
47 changes: 31 additions & 16 deletions packages/ui-extensions/src/surfaces/checkout/targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type {
ShippingOptionListApi,
} from './api';
import type {AnyComponent} from './shared';
import {OrderConfirmationApi} from './api/order-confirmation/order-confirmation';

/**
* A UI extension will register for one or more extension targets using `shopify.extend()`.
Expand Down Expand Up @@ -192,7 +193,7 @@ export interface ExtensionTargets {
*
*/
'purchase.thank-you.block.render': RenderExtension<
StandardApi<'purchase.thank-you.block.render'>,
OrderConfirmationApi & StandardApi<'purchase.thank-you.block.render'>,
AnyComponent
>;
/**
Expand All @@ -206,15 +207,16 @@ export interface ExtensionTargets {
* @deprecated Use `purchase.thank-you.block.render` instead.
*/
'Checkout::ThankYou::Dynamic::Render': RenderExtension<
StandardApi<'Checkout::ThankYou::Dynamic::Render'>,
OrderConfirmationApi & StandardApi<'Checkout::ThankYou::Dynamic::Render'>,
AnyComponent
>;
/**
* A static extension target that renders on every line item, inside the details
* under the line item properties element on the **Thank you** page.
*/
'purchase.thank-you.cart-line-item.render-after': RenderExtension<
CartLineItemApi &
OrderConfirmationApi &
CartLineItemApi &
StandardApi<'purchase.thank-you.cart-line-item.render-after'>,
AnyComponent
>;
Expand All @@ -225,15 +227,17 @@ export interface ExtensionTargets {
* @deprecated Use `purchase.thank-you.cart-line-item.render-after` instead.
*/
'Checkout::ThankYou::CartLineDetails::RenderAfter': RenderExtension<
CartLineItemApi &
OrderConfirmationApi &
CartLineItemApi &
StandardApi<'Checkout::ThankYou::CartLineDetails::RenderAfter'>,
AnyComponent
>;
/**
* A static extension target that is rendered after all line items on the **Thank you** page.
*/
'purchase.thank-you.cart-line-list.render-after': RenderExtension<
StandardApi<'purchase.thank-you.cart-line-list.render-after'>,
OrderConfirmationApi &
StandardApi<'purchase.thank-you.cart-line-list.render-after'>,
AnyComponent
>;
/**
Expand All @@ -242,14 +246,16 @@ export interface ExtensionTargets {
* @deprecated Use `purchase.thank-you.cart-line-list.render-after` instead.
*/
'Checkout::ThankYou::CartLines::RenderAfter': RenderExtension<
StandardApi<'Checkout::ThankYou::CartLines::RenderAfter'>,
OrderConfirmationApi &
StandardApi<'Checkout::ThankYou::CartLines::RenderAfter'>,
AnyComponent
>;
/**
* A static extension target that is rendered after a purchase below the customer information on the **Thank you** page.
*/
'purchase.thank-you.customer-information.render-after': RenderExtension<
StandardApi<'purchase.thank-you.customer-information.render-after'>,
OrderConfirmationApi &
StandardApi<'purchase.thank-you.customer-information.render-after'>,
AnyComponent
>;
/**
Expand All @@ -258,7 +264,8 @@ export interface ExtensionTargets {
* @deprecated Use `purchase.thank-you.customer-information.render-after` instead.
*/
'Checkout::ThankYou::CustomerInformation::RenderAfter': RenderExtension<
StandardApi<'Checkout::ThankYou::CustomerInformation::RenderAfter'>,
OrderConfirmationApi &
StandardApi<'Checkout::ThankYou::CustomerInformation::RenderAfter'>,
AnyComponent
>;
/**
Expand All @@ -272,7 +279,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.block.render` from `@shopify/ui-extension/customer-account` instead.
*/
'customer-account.order-status.block.render': RenderExtension<
OrderStatusApi &
OrderConfirmationApi &
OrderStatusApi &
CustomerAccountStandardApi<'customer-account.order-status.block.render'>,
AnyComponent
>;
Expand All @@ -287,7 +295,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.block.render` from `@shopify/ui-extension/customer-account` instead.
*/
'Checkout::OrderStatus::Dynamic::Render': RenderExtension<
OrderStatusApi &
OrderConfirmationApi &
OrderStatusApi &
CustomerAccountStandardApi<'Checkout::OrderStatus::Dynamic::Render'>,
AnyComponent
>;
Expand All @@ -298,7 +307,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.cart-line-item.render-after` from `@shopify/ui-extension/customer-account` instead.
*/
'customer-account.order-status.cart-line-item.render-after': RenderExtension<
CartLineItemApi &
OrderConfirmationApi &
CartLineItemApi &
OrderStatusApi &
CustomerAccountStandardApi<'customer-account.order-status.cart-line-item.render-after'>,
AnyComponent
Expand All @@ -310,7 +320,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.cart-line-item.render-after` instead.
*/
'Checkout::OrderStatus::CartLineDetails::RenderAfter': RenderExtension<
CartLineItemApi &
OrderConfirmationApi &
CartLineItemApi &
OrderStatusApi &
CustomerAccountStandardApi<'Checkout::OrderStatus::CartLineDetails::RenderAfter'>,
AnyComponent
Expand All @@ -321,7 +332,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.cart-line-list.render-after` from `@shopify/ui-extension/customer-account` instead.
*/
'customer-account.order-status.cart-line-list.render-after': RenderExtension<
OrderStatusApi &
OrderConfirmationApi &
OrderStatusApi &
CustomerAccountStandardApi<'customer-account.order-status.cart-line-list.render-after'>,
AnyComponent
>;
Expand All @@ -331,7 +343,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.cart-line-list.render-after` from `@shopify/ui-extension/customer-account` instead.
*/
'Checkout::OrderStatus::CartLines::RenderAfter': RenderExtension<
OrderStatusApi &
OrderConfirmationApi &
OrderStatusApi &
CustomerAccountStandardApi<'Checkout::OrderStatus::CartLines::RenderAfter'>,
AnyComponent
>;
Expand All @@ -341,7 +354,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.customer-information.render-after` from `@shopify/ui-extension/customer-account` instead.
*/
'customer-account.order-status.customer-information.render-after': RenderExtension<
OrderStatusApi &
OrderConfirmationApi &
OrderStatusApi &
CustomerAccountStandardApi<'customer-account.order-status.customer-information.render-after'>,
AnyComponent
>;
Expand All @@ -351,7 +365,8 @@ export interface ExtensionTargets {
* @deprecated Use `customer-account.order-status.customer-information.render-after` from `@shopify/ui-extension/customer-account` instead.
*/
'Checkout::OrderStatus::CustomerInformation::RenderAfter': RenderExtension<
OrderStatusApi &
OrderConfirmationApi &
OrderStatusApi &
CustomerAccountStandardApi<'Checkout::OrderStatus::CustomerInformation::RenderAfter'>,
AnyComponent
>;
Expand Down
5 changes: 5 additions & 0 deletions packages/ui-extensions/src/surfaces/customer-account/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ export type {
CompanyLocationApi,
OrderApi,
} from './api/standard-api/standard-api';

export type {
OrderConfirmation,
OrderConfirmationApi,
} from './api/order-confirmation/order-confirmation';
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type {StatefulRemoteSubscribable} from '@remote-ui/async-subscription';

export interface OrderConfirmation {
order: {
/**
* The globally-uniqueID of the OrderConfirmation. This will be the ID of the Order once successfully created.
*/
id: string;
};
/**
* A randomly generated alpha-numeric identifier for the order.
* This number should always be present, but 2023 orders predate confirmation numbers and may not have it.
*/
number?: string;
}

export interface OrderConfirmationApi {
/**
* Order information that's available post-checkout.
*/
orderConfirmation: StatefulRemoteSubscribable<OrderConfirmation>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1194,4 +1194,9 @@ export interface Order {
* If cancelled, the time at which the order was cancelled.
*/
cancelledAt?: string;
/**
* A randomly generated alpha-numeric identifier for the order.
* This number should always be present, but 2023 orders predate confirmation numbers and may not have it.
*/
confirmationNumber?: string;
}

0 comments on commit 2e0c01f

Please sign in to comment.