Skip to content

Commit fbd4264

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

File tree

1 file changed

+64
-33
lines changed
  • packages/ui-extensions/src/surfaces/checkout/api/standard

1 file changed

+64
-33
lines changed

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

Lines changed: 64 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,10 @@ 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 scoped to a specific extension. Data persists across
26+
* page loads within the current checkout session but isn't guaranteed to
27+
* survive across sessions. The storage backend is implemented with
28+
* `localStorage`.
3329
*/
3430
export interface Storage {
3531
/**
@@ -50,13 +46,15 @@ export interface Storage {
5046
write(key: string, data: any): Promise<void>;
5147

5248
/**
53-
* Delete stored data by key.
49+
* Deletes a previously stored value by key.
5450
*/
5551
delete(key: string): Promise<void>;
5652
}
5753

5854
/**
59-
* The meta information about an extension target.
55+
* Metadata about the running extension, including its API version, target,
56+
* capabilities, and editor context. Use this to read configuration details or
57+
* conditionally render content based on where the extension is running.
6058
*/
6159
export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
6260
/**
@@ -130,6 +128,11 @@ export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
130128
version?: string;
131129
}
132130

131+
/**
132+
* Information about the editor environment when an extension is rendered
133+
* inside the editor. The value is `undefined` when the extension is not
134+
* rendering in an 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,6 +397,10 @@ 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.
@@ -540,7 +552,9 @@ export interface BuyerJourneyStep {
540552
/** @publicDocs */
541553
export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
542554
/**
543-
* The methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
555+
* Tracks custom events and sends visitor information to
556+
* [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
557+
* and `visitor()` to submit buyer contact details.
544558
*/
545559
analytics: Analytics;
546560

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

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

@@ -658,12 +674,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
658674
extensionPoint: Target;
659675

660676
/**
661-
* Utilities for translating content and formatting values according to the current
677+
* Utilities for translating strings, formatting currencies, numbers, and dates
678+
* according to the buyer's locale. Use alongside
662679
* [`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.
680+
* to build fully localized extensions.
667681
*/
668682
i18n: I18n;
669683

@@ -673,10 +687,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
673687
lines: SubscribableSignalLike<CartLine[]>;
674688

675689
/**
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
690+
* The buyer's language, country, currency, and timezone context. For
691+
* formatting and translation helpers, use
678692
* [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#standardapi-propertydetail-i18n)
679-
* object instead.
693+
* instead.
680694
*/
681695
localization: Localization;
682696

@@ -760,18 +774,19 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
760774
*/
761775
billingAddress?: SubscribableSignalLike<MailingAddress | undefined>;
762776

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

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

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

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

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

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

15761607
/**
1577-
* A method for capturing details about a visitor on the online store.
1608+
* Submits buyer contact details for attribution and analytics purposes.
15781609
*/
15791610
visitor(data: {email?: string; phone?: string}): Promise<VisitorResult>;
15801611
}

0 commit comments

Comments
 (0)