Skip to content

Commit 05b0e20

Browse files
committed
Enrich JSDoc for Platform APIs property descriptions, 2026-01
Port enriched JSDoc descriptions from checkout-web to ui-extensions 2026-01. Covers Analytics, Extension, Localization, Metafields, Session Token, Settings, Shop, Storage, and Storefront APIs. Every description verified against the 2026-01 TypeScript types. Partially closes shop/issues-learn#1046 Made-with: Cursor
1 parent 6866883 commit 05b0e20

1 file changed

Lines changed: 66 additions & 35 deletions

File tree

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

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

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +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.
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.
3330
*/
3431
export interface Storage {
3532
/**
3633
* Read and return a stored value by key.
3734
*
3835
* The stored data is deserialized from JSON and returned as
39-
* its original primitive.
36+
* its original type.
4037
*
4138
* Returns `null` if no stored data exists.
4239
*/
@@ -50,13 +47,15 @@ export interface Storage {
5047
write(key: string, data: any): Promise<void>;
5148

5249
/**
53-
* Delete stored data by key.
50+
* Deletes a previously stored value by key.
5451
*/
5552
delete(key: string): Promise<void>;
5653
}
5754

5855
/**
59-
* The meta information about an extension target.
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.
6059
*/
6160
export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
6261
/**
@@ -130,6 +129,10 @@ export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
130129
version?: string;
131130
}
132131

132+
/**
133+
* Information about the editor environment when an extension is rendered
134+
* inside the checkout editor.
135+
*/
133136
export interface Editor {
134137
/**
135138
* Indicates whether the extension is rendering in the [checkout editor](https://shopify.dev/docs/apps/checkout). Always `'checkout'`.
@@ -294,9 +297,9 @@ export type Version = string;
294297
export type CheckoutToken = string;
295298

296299
/**
297-
* This returns a translated string matching a key in a locale file.
298-
*
299-
* @example translate("banner.title")
300+
* Translates a key from your extension's locale files into a localized string.
301+
* Supports interpolation with placeholder replacements and pluralization
302+
* via the special `count` option.
300303
*/
301304
export interface I18nTranslate {
302305
<ReplacementType = string>(
@@ -307,6 +310,11 @@ export interface I18nTranslate {
307310
: (string | ReplacementType)[];
308311
}
309312

313+
/**
314+
* Utilities for translating strings, formatting currencies, numbers,
315+
* and dates according to the buyer's locale. Use the I18n API alongside
316+
* the Localization API to build fully localized extensions.
317+
*/
310318
export interface I18n {
311319
/**
312320
* Returns a localized number.
@@ -389,14 +397,18 @@ export interface Market {
389397
handle: string;
390398
}
391399

400+
/**
401+
* The buyer's language, country, currency, and timezone context. Use this
402+
* to adapt your extension to the buyer's region and display localized content.
403+
*/
392404
export interface Localization {
393405
/**
394406
* 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.
395407
*/
396408
currency: SubscribableSignalLike<Currency>;
397409

398410
/**
399-
* 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.
411+
* 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.
400412
*/
401413
timezone: SubscribableSignalLike<Timezone>;
402414

@@ -539,7 +551,9 @@ export interface BuyerJourneyStep {
539551

540552
export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
541553
/**
542-
* The methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
554+
* Tracks custom events and sends visitor information to
555+
* [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
556+
* and `visitor()` to submit buyer contact details.
543557
*/
544558
analytics: Analytics;
545559

@@ -639,7 +653,9 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
639653
discountAllocations: SubscribableSignalLike<CartDiscountAllocation[]>;
640654

641655
/**
642-
* The meta information about the extension.
656+
* Metadata about the running extension, including the current target, API version,
657+
* capabilities, and editor context. Use this to conditionally render content
658+
* based on where the extension is running.
643659
*/
644660
extension: Extension<Target>;
645661

@@ -657,12 +673,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
657673
extensionPoint: Target;
658674

659675
/**
660-
* Utilities for translating content and formatting values according to the current
676+
* Utilities for translating strings, formatting currencies, numbers, and dates
677+
* according to the buyer's locale. Use alongside
661678
* [`localization`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization)
662-
* of the checkout.
663-
*
664-
* Refer to [`localization` examples](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#examples)
665-
* for more information.
679+
* to build fully localized extensions.
666680
*/
667681
i18n: I18n;
668682

@@ -672,8 +686,8 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
672686
lines: SubscribableSignalLike<CartLine[]>;
673687

674688
/**
675-
* The details about the location, language, and currency of the customer. For utilities to easily
676-
* format and translate content based on these details, you can use the
689+
* The buyer's language, country, currency, and timezone context. For
690+
* formatting and translation helpers, use the
677691
* [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#standardapi-propertydetail-i18n)
678692
* object instead.
679693
*/
@@ -761,18 +775,19 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
761775
*/
762776
billingAddress?: SubscribableSignalLike<MailingAddress | undefined>;
763777

764-
/** The shop where the checkout is taking place. */
778+
/**
779+
* The store where the checkout is taking place, including the shop name,
780+
* primary domain, `.myshopify.com` subdomain, and a globally-unique ID.
781+
*/
765782
shop: Shop;
766783

767784
/**
768-
* The key-value storage for the extension.
769-
*
770-
* It uses `localStorage` and should persist across the customer's current checkout session.
785+
* Key-value storage that persists across page loads within the current checkout
786+
* session. Data is shared across all activated extension targets of this
787+
* extension.
771788
*
772-
* > Caution: Data persistence isn't guaranteed and storage is reset when the customer starts a new checkout.
773-
*
774-
* Data is shared across all activated extension targets of this extension. In versions 2023-07 and earlier,
775-
* each activated extension target had its own storage.
789+
* > Caution: Data persistence isn't guaranteed and storage is cleared when the
790+
* buyer starts a new checkout.
776791
*/
777792
storage: Storage;
778793

@@ -803,6 +818,12 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
803818
localizedFields?: SubscribableSignalLike<LocalizedField[]>;
804819
}
805820

821+
/**
822+
* Authenticates requests between your extension and your app backend.
823+
* Use session tokens to verify the identity of the buyer and the shop
824+
* context when making server-side API calls. The token is a signed JWT
825+
* that contains claims such as the customer ID, shop domain, and expiration.
826+
*/
806827
export interface SessionToken {
807828
/**
808829
* Requests a session token that hasn't expired. You should call this method every
@@ -930,6 +951,10 @@ export interface AppliedGiftCard {
930951
balance: Money;
931952
}
932953

954+
/**
955+
* Metadata about the merchant's store, including its name, primary
956+
* domain, `.myshopify.com` subdomain, and a globally-unique ID.
957+
*/
933958
export interface Shop {
934959
/**
935960
* A globally-unique identifier for the shop in the format `gid://shopify/Shop/<id>`.
@@ -1568,14 +1593,20 @@ export type ExtensionSettings = Record<
15681593
string | number | boolean | undefined
15691594
>;
15701595

1596+
/**
1597+
* Tracks custom events and sends visitor information to
1598+
* [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
1599+
* and `visitor()` to submit buyer contact details.
1600+
*/
15711601
export interface Analytics {
15721602
/**
1573-
* Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1603+
* Publishes a custom event to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1604+
* Returns `true` when the event is successfully dispatched.
15741605
*/
15751606
publish(name: string, data: Record<string, unknown>): Promise<boolean>;
15761607

15771608
/**
1578-
* A method for capturing details about a visitor on the online store.
1609+
* Submits buyer contact details for attribution and analytics purposes.
15791610
*/
15801611
visitor(data: {email?: string; phone?: string}): Promise<VisitorResult>;
15811612
}
@@ -1600,7 +1631,7 @@ export interface VisitorSuccess {
16001631
export interface VisitorError {
16011632
/**
16021633
* Indicates that the visitor information is invalid and wasn't submitted.
1603-
* Examples are using the wrong data type or missing a required property.
1634+
* Common causes include using the wrong data type or omitting a required property.
16041635
*/
16051636
type: 'error';
16061637

0 commit comments

Comments
 (0)