Skip to content

Commit eb62833

Browse files
committed
Enrich JSDoc for Platform APIs property descriptions, 2026-04-rc
Port enriched JSDoc descriptions for Platform API properties. Covers Analytics, Extension, Localization, Metafields, Session Token, Settings, Shop, Storage, and Storefront APIs. Every description verified against the 2026-04-rc TypeScript types. Partially closes shop/issues-learn#1046 Made-with: Cursor
1 parent 45466e5 commit eb62833

1 file changed

Lines changed: 67 additions & 38 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 & 38 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,11 @@ 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. The value is `undefined` when the extension
135+
* is not rendering in an editor.
136+
*/
133137
export interface Editor {
134138
/**
135139
* Indicates whether the extension is rendering in the [checkout editor](https://shopify.dev/docs/apps/checkout). Always `'checkout'`.
@@ -294,9 +298,9 @@ export type Version = string;
294298
export type CheckoutToken = string;
295299

296300
/**
297-
* This returns a translated string matching a key in a locale file.
298-
*
299-
* @example translate("banner.title")
301+
* Translates a key from your extension's locale files into a localized string.
302+
* Supports interpolation with placeholder replacements and pluralization
303+
* via the special `count` option.
300304
*/
301305
export interface I18nTranslate {
302306
<ReplacementType = string>(
@@ -307,6 +311,11 @@ export interface I18nTranslate {
307311
: (string | ReplacementType)[];
308312
}
309313

314+
/**
315+
* Utilities for translating strings, formatting currencies, numbers,
316+
* and dates according to the buyer's locale. Use the I18n API alongside
317+
* the Localization API to build fully localized extensions.
318+
*/
310319
export interface I18n {
311320
/**
312321
* Returns a localized number.
@@ -389,14 +398,18 @@ export interface Market {
389398
handle: string;
390399
}
391400

401+
/**
402+
* The buyer's language, country, currency, and timezone context. Use this
403+
* to adapt your extension to the buyer's region and display localized content.
404+
*/
392405
export interface Localization {
393406
/**
394407
* 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.
395408
*/
396409
currency: SubscribableSignalLike<Currency>;
397410

398411
/**
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.
412+
* 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.
400413
*/
401414
timezone: SubscribableSignalLike<Timezone>;
402415

@@ -540,7 +553,9 @@ export interface BuyerJourneyStep {
540553
/** @publicDocs */
541554
export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
542555
/**
543-
* The methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
556+
* Tracks custom events and sends visitor information to
557+
* [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
558+
* and `visitor()` to submit buyer contact details.
544559
*/
545560
analytics: Analytics;
546561

@@ -640,7 +655,9 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
640655
discountAllocations: SubscribableSignalLike<CartDiscountAllocation[]>;
641656

642657
/**
643-
* The meta information about the extension.
658+
* Metadata about the running extension, including the current target, API version,
659+
* capabilities, and editor context. Use this to conditionally render content
660+
* based on where the extension is running.
644661
*/
645662
extension: Extension<Target>;
646663

@@ -658,12 +675,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
658675
extensionPoint: Target;
659676

660677
/**
661-
* Utilities for translating content and formatting values according to the current
678+
* Utilities for translating strings, formatting currencies, numbers, and dates
679+
* according to the buyer's locale. Use alongside
662680
* [`localization`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization)
663-
* of the checkout.
664-
*
665-
* Refer to [`localization` examples](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#examples)
666-
* for more information.
681+
* to build fully localized extensions.
667682
*/
668683
i18n: I18n;
669684

@@ -673,8 +688,8 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
673688
lines: SubscribableSignalLike<CartLine[]>;
674689

675690
/**
676-
* The details about the location, language, and currency of the customer. For utilities to easily
677-
* format and translate content based on these details, you can use the
691+
* The buyer's language, country, currency, and timezone context. For
692+
* formatting and translation helpers, use the
678693
* [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#standardapi-propertydetail-i18n)
679694
* object instead.
680695
*/
@@ -744,18 +759,19 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
744759
*/
745760
billingAddress?: SubscribableSignalLike<MailingAddress | undefined>;
746761

747-
/** The shop where the checkout is taking place. */
762+
/**
763+
* The store where the checkout is taking place, including the shop name,
764+
* storefront URL, `.myshopify.com` subdomain, and a globally-unique ID.
765+
*/
748766
shop: Shop;
749767

750768
/**
751-
* The key-value storage for the extension.
752-
*
753-
* It uses `localStorage` and should persist across the customer's current checkout session.
754-
*
755-
* > Caution: Data persistence isn't guaranteed and storage is reset when the customer starts a new checkout.
769+
* Key-value storage that persists across page loads within the current checkout
770+
* session. Data is shared across all activated extension targets of this
771+
* extension.
756772
*
757-
* Data is shared across all activated extension targets of this extension. In versions 2023-07 and earlier,
758-
* each activated extension target had its own storage.
773+
* > Caution: Data persistence isn't guaranteed and storage is cleared when the
774+
* buyer starts a new checkout.
759775
*/
760776
storage: Storage;
761777

@@ -786,6 +802,12 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
786802
localizedFields?: SubscribableSignalLike<LocalizedField[]>;
787803
}
788804

805+
/**
806+
* Authenticates requests between your extension and your app backend.
807+
* Use session tokens to verify the identity of the buyer and the shop
808+
* context when making server-side API calls. The token is a signed JWT
809+
* that contains claims such as the customer ID, shop domain, and expiration.
810+
*/
789811
export interface SessionToken {
790812
/**
791813
* Requests a session token that hasn't expired. You should call this method every
@@ -913,6 +935,10 @@ export interface AppliedGiftCard {
913935
balance: Money;
914936
}
915937

938+
/**
939+
* Metadata about the merchant's store, including its name, storefront
940+
* URL, `.myshopify.com` subdomain, and a globally-unique ID.
941+
*/
916942
export interface Shop {
917943
/**
918944
* A globally-unique identifier for the shop in the format `gid://shopify/Shop/<id>`.
@@ -926,9 +952,6 @@ export interface Shop {
926952
name: string;
927953
/**
928954
* 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.
929-
*
930-
* > Caution:
931-
* > As of version `2024-04` this value no longer has a trailing slash.
932955
*/
933956
storefrontUrl?: string;
934957
/**
@@ -1551,14 +1574,20 @@ export type ExtensionSettings = Record<
15511574
string | number | boolean | undefined
15521575
>;
15531576

1577+
/**
1578+
* Tracks custom events and sends visitor information to
1579+
* [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
1580+
* and `visitor()` to submit buyer contact details.
1581+
*/
15541582
export interface Analytics {
15551583
/**
1556-
* Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1584+
* Publishes a custom event to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1585+
* Returns `true` when the event is successfully dispatched.
15571586
*/
15581587
publish(name: string, data: Record<string, unknown>): Promise<boolean>;
15591588

15601589
/**
1561-
* A method for capturing details about a visitor on the online store.
1590+
* Submits buyer contact details for attribution and analytics purposes.
15621591
*/
15631592
visitor(data: {email?: string; phone?: string}): Promise<VisitorResult>;
15641593
}
@@ -1583,7 +1612,7 @@ export interface VisitorSuccess {
15831612
export interface VisitorError {
15841613
/**
15851614
* Indicates that the visitor information is invalid and wasn't submitted.
1586-
* Examples are using the wrong data type or missing a required property.
1615+
* Common causes include using the wrong data type or omitting a required property.
15871616
*/
15881617
type: 'error';
15891618

0 commit comments

Comments
 (0)