Skip to content

Commit 035db5d

Browse files
authored
Merge pull request #4270 from Shopify/2026-04-rc-platform-api-descriptions
Enrich JSDoc for Platform APIs property descriptions (2026-04-rc)
2 parents 0a36833 + fabee42 commit 035db5d

1 file changed

Lines changed: 67 additions & 47 deletions

File tree

  • packages/ui-extensions/src/surfaces/checkout/api/standard

packages/ui-extensions/src/surfaces/checkout/api/standard/standard.ts

Lines changed: 67 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,18 @@ import type {SubscribableSignalLike} from '../../shared';
2222
export type {ApiVersion, Capability} from '../../../../shared';
2323

2424
/**
25-
* A key-value storage object for the extension.
26-
*
27-
* Stored data is available only to this specific extension
28-
* and any of its instances.
29-
*
30-
* The storage backend is implemented with `localStorage` and
31-
* should persist across the buyer's checkout session.
32-
* However, data persistence isn't guaranteed.
33-
* @publicDocs
25+
* Key-value storage for a specific extension. Use storage to save
26+
* preferences or cached data that should survive page reloads without
27+
* requiring a backend call. Stored data is only available to this
28+
* specific extension. The storage backend is implemented with
29+
* `localStorage` and data persistence isn't guaranteed.
3430
*/
3531
export interface Storage {
3632
/**
3733
* Read and return a stored value by key.
3834
*
3935
* The stored data is deserialized from JSON and returned as
40-
* its original primitive.
36+
* its original type.
4137
*
4238
* Returns `null` if no stored data exists.
4339
*/
@@ -51,14 +47,15 @@ export interface Storage {
5147
write(key: string, data: any): Promise<void>;
5248

5349
/**
54-
* Delete stored data by key.
50+
* Deletes a previously stored value by key.
5551
*/
5652
delete(key: string): Promise<void>;
5753
}
5854

5955
/**
60-
* The meta information about an extension target.
61-
* @publicDocs
56+
* Metadata about the running extension, including its API version, target,
57+
* capabilities, and editor context. Use this to read configuration details or
58+
* conditionally render content based on where the extension is running.
6259
*/
6360
export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
6461
/**
@@ -132,7 +129,11 @@ export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
132129
version?: string;
133130
}
134131

135-
/** @publicDocs */
132+
/**
133+
* Information about the editor environment when an extension is rendered
134+
* inside the checkout editor. The value is `undefined` when the extension
135+
* is not rendering in an editor.
136+
*/
136137
export interface Editor {
137138
/**
138139
* Indicates whether the extension is rendering in the [checkout editor](https://shopify.dev/docs/apps/checkout). Always `'checkout'`.
@@ -304,10 +305,9 @@ export type Version = string;
304305
export type CheckoutToken = string;
305306

306307
/**
307-
* This returns a translated string matching a key in a locale file.
308-
*
309-
* @example translate("banner.title")
310-
* @publicDocs
308+
* Translates a key from your extension's locale files into a localized string.
309+
* Supports interpolation with placeholder replacements and pluralization
310+
* via the special `count` option.
311311
*/
312312
export interface I18nTranslate {
313313
<ReplacementType = string>(
@@ -318,7 +318,11 @@ export interface I18nTranslate {
318318
: (string | ReplacementType)[];
319319
}
320320

321-
/** @publicDocs */
321+
/**
322+
* Utilities for translating strings, formatting currencies, numbers,
323+
* and dates according to the buyer's locale. Use the I18n API alongside
324+
* the Localization API to build fully localized extensions.
325+
*/
322326
export interface I18n {
323327
/**
324328
* Returns a localized number.
@@ -404,15 +408,18 @@ export interface Market {
404408
handle: string;
405409
}
406410

407-
/** @publicDocs */
411+
/**
412+
* The buyer's language, country, currency, and timezone context. Use this
413+
* to adapt your extension to the buyer's region and display localized content.
414+
*/
408415
export interface Localization {
409416
/**
410417
* The currency that the buyer sees for money amounts in the checkout. Use this value to format prices and totals in the buyer's expected currency.
411418
*/
412419
currency: SubscribableSignalLike<Currency>;
413420

414421
/**
415-
* The buyer's time zone, derived from their browser or account settings. Use this value to format dates and times relative to the buyer's local time.
422+
* The buyer's time zone, based on their browser or account settings. Use this value to format dates and times relative to the buyer's local time.
416423
*/
417424
timezone: SubscribableSignalLike<Timezone>;
418425

@@ -559,7 +566,9 @@ export interface BuyerJourneyStep {
559566
/** @publicDocs */
560567
export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
561568
/**
562-
* The methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
569+
* Tracks custom events and sends visitor information to
570+
* [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
571+
* and `visitor()` to submit buyer contact details.
563572
*/
564573
analytics: Analytics;
565574

@@ -659,7 +668,9 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
659668
discountAllocations: SubscribableSignalLike<CartDiscountAllocation[]>;
660669

661670
/**
662-
* The meta information about the extension.
671+
* Metadata about the running extension, including the current target, API version,
672+
* capabilities, and editor context. Use this to conditionally render content
673+
* based on where the extension is running.
663674
*/
664675
extension: Extension<Target>;
665676

@@ -677,12 +688,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
677688
extensionPoint: Target;
678689

679690
/**
680-
* Utilities for translating content and formatting values according to the current
691+
* Utilities for translating strings, formatting currencies, numbers, and dates
692+
* according to the buyer's locale. Use alongside
681693
* [`localization`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization)
682-
* of the checkout.
683-
*
684-
* Refer to [`localization` examples](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#examples)
685-
* for more information.
694+
* to build fully localized extensions.
686695
*/
687696
i18n: I18n;
688697

@@ -692,8 +701,8 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
692701
lines: SubscribableSignalLike<CartLine[]>;
693702

694703
/**
695-
* The details about the location, language, and currency of the customer. For utilities to easily
696-
* format and translate content based on these details, you can use the
704+
* The buyer's language, country, currency, and timezone context. For
705+
* formatting and translation helpers, use the
697706
* [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#standardapi-propertydetail-i18n)
698707
* object instead.
699708
*/
@@ -763,18 +772,19 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
763772
*/
764773
billingAddress?: SubscribableSignalLike<MailingAddress | undefined>;
765774

766-
/** The shop where the checkout is taking place. */
775+
/**
776+
* The store where the checkout is taking place, including the shop name,
777+
* storefront URL, `.myshopify.com` subdomain, and a globally-unique ID.
778+
*/
767779
shop: Shop;
768780

769781
/**
770-
* The key-value storage for the extension.
771-
*
772-
* It uses `localStorage` and should persist across the customer's current checkout session.
782+
* Key-value storage that persists across page loads within the current checkout
783+
* session. Data is shared across all activated extension targets of this
784+
* extension.
773785
*
774-
* > Caution: Data persistence isn't guaranteed and storage is reset when the customer starts a new checkout.
775-
*
776-
* Data is shared across all activated extension targets of this extension. In versions 2023-07 and earlier,
777-
* each activated extension target had its own storage.
786+
* > Caution: Data persistence isn't guaranteed and storage is cleared when the
787+
* buyer starts a new checkout.
778788
*/
779789
storage: Storage;
780790

@@ -805,7 +815,12 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
805815
localizedFields?: SubscribableSignalLike<LocalizedField[]>;
806816
}
807817

808-
/** @publicDocs */
818+
/**
819+
* Authenticates requests between your extension and your app backend.
820+
* Use session tokens to verify the identity of the buyer and the shop
821+
* context when making server-side API calls. The token is a signed JWT
822+
* that contains claims such as the customer ID, shop domain, and expiration.
823+
*/
809824
export interface SessionToken {
810825
/**
811826
* Requests a session token that hasn't expired. You should call this method every
@@ -938,7 +953,10 @@ export interface AppliedGiftCard {
938953
balance: Money;
939954
}
940955

941-
/** @publicDocs */
956+
/**
957+
* Metadata about the merchant's store, including its name, storefront
958+
* URL, `.myshopify.com` subdomain, and a globally-unique ID.
959+
*/
942960
export interface Shop {
943961
/**
944962
* A globally-unique identifier for the shop in the format `gid://shopify/Shop/<id>`.
@@ -952,9 +970,6 @@ export interface Shop {
952970
name: string;
953971
/**
954972
* The primary storefront URL for the shop, such as `'https://example.myshopify.com'`. Use this to build links back to the merchant's online store.
955-
*
956-
* > Caution:
957-
* > As of version `2024-04` this value no longer has a trailing slash.
958973
*/
959974
storefrontUrl?: string;
960975
/**
@@ -1606,15 +1621,20 @@ export type ExtensionSettings = Record<
16061621
string | number | boolean | undefined
16071622
>;
16081623

1609-
/** @publicDocs */
1624+
/**
1625+
* Tracks custom events and sends visitor information to
1626+
* [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
1627+
* and `visitor()` to submit buyer contact details.
1628+
*/
16101629
export interface Analytics {
16111630
/**
1612-
* Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1631+
* Publishes a custom event to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1632+
* Returns `true` when the event is successfully dispatched.
16131633
*/
16141634
publish(name: string, data: Record<string, unknown>): Promise<boolean>;
16151635

16161636
/**
1617-
* A method for capturing details about a visitor on the online store.
1637+
* Submits buyer contact details for attribution and analytics purposes.
16181638
*/
16191639
visitor(data: {email?: string; phone?: string}): Promise<VisitorResult>;
16201640
}
@@ -1642,7 +1662,7 @@ export interface VisitorSuccess {
16421662
export interface VisitorError {
16431663
/**
16441664
* Indicates that the visitor information is invalid and wasn't submitted.
1645-
* Examples are using the wrong data type or missing a required property.
1665+
* Common causes include using the wrong data type or omitting a required property.
16461666
*/
16471667
type: 'error';
16481668

0 commit comments

Comments
 (0)