@@ -22,14 +22,11 @@ import type {SubscribableSignalLike} from '../../shared';
2222export 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+ * Persists key-value data across the buyer's session for a specific extension.
26+ * Use storage to save preferences, dismiss states, or cached data that should
27+ * survive page reloads without requiring a backend call. Stored data is only
28+ * available to this specific extension. The storage backend is implemented with
29+ * `localStorage` and data persistence isn't guaranteed.
3330 */
3431export interface Storage {
3532 /**
@@ -50,13 +47,16 @@ export interface Storage {
5047 write ( key : string , data : any ) : Promise < void > ;
5148
5249 /**
53- * Delete stored data by key.
50+ * Delete a previously stored value by key. Use this instead of writing `null`
51+ * or an empty string to cleanly remove an entry from storage.
5452 */
5553 delete ( key : string ) : Promise < void > ;
5654}
5755
5856/**
59- * The meta information about an extension target.
57+ * Metadata about the running extension, including its API version, target,
58+ * capabilities, and editor context. Use this to read configuration details or
59+ * conditionally render content based on where the extension is running.
6060 */
6161export interface Extension < Target extends ExtensionTarget = ExtensionTarget > {
6262 /**
@@ -130,6 +130,11 @@ export interface Extension<Target extends ExtensionTarget = ExtensionTarget> {
130130 version ?: string ;
131131}
132132
133+ /**
134+ * Information about the editor environment when an extension is rendered
135+ * inside the editor. The value is `undefined` when the extension is not
136+ * rendering in an editor.
137+ */
133138export interface Editor {
134139 /**
135140 * Indicates whether the extension is rendering in the [checkout editor](https://shopify.dev/docs/apps/checkout). Always `'checkout'`.
@@ -294,9 +299,9 @@ export type Version = string;
294299export type CheckoutToken = string ;
295300
296301/**
297- * This returns a translated string matching a key in a locale file .
298- *
299- * @example translate("banner.title")
302+ * Translates a key from your extension's locale files into a localized string .
303+ * Supports interpolation with placeholder replacements and pluralization
304+ * via the special `count` option.
300305 */
301306export interface I18nTranslate {
302307 < ReplacementType = string > (
@@ -307,6 +312,11 @@ export interface I18nTranslate {
307312 : ( string | ReplacementType ) [ ] ;
308313}
309314
315+ /**
316+ * Utilities for translating strings, formatting currencies, numbers,
317+ * and dates according to the buyer's locale. Use the I18n API alongside
318+ * the Localization API to build fully localized extensions.
319+ */
310320export interface I18n {
311321 /**
312322 * Returns a localized number.
@@ -389,6 +399,11 @@ export interface Market {
389399 handle : string ;
390400}
391401
402+ /**
403+ * The buyer's language, country, and locale context. Properties on this
404+ * interface are subscribable and update automatically when the buyer's
405+ * locale changes.
406+ */
392407export interface Localization {
393408 /**
394409 * 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 +555,10 @@ export interface BuyerJourneyStep {
540555/** @publicDocs */
541556export interface StandardApi < Target extends ExtensionTarget = ExtensionTarget > {
542557 /**
543- * The methods for interacting with [Web Pixels](https://shopify.dev/docs/apps/marketing), such as emitting an event.
558+ * Methods for publishing custom events to [Web Pixels](https://shopify.dev/docs/apps/marketing) and
559+ * submitting visitor contact details to the shop backend. Use `publish()` to
560+ * emit events that web pixels can listen to, and `visitor()` to send buyer
561+ * contact information for attribution.
544562 */
545563 analytics : Analytics ;
546564
@@ -640,7 +658,9 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
640658 discountAllocations : SubscribableSignalLike < CartDiscountAllocation [ ] > ;
641659
642660 /**
643- * The meta information about the extension.
661+ * Metadata about the running extension, including the current target, API version,
662+ * granted capabilities, and editor context. Use this to check permissions, detect
663+ * the editor preview, or read the published version.
644664 */
645665 extension : Extension < Target > ;
646666
@@ -658,12 +678,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
658678 extensionPoint : Target ;
659679
660680 /**
661- * Utilities for translating content and formatting values according to the current
681+ * Utilities for translating strings, formatting currencies, numbers, and dates
682+ * according to the buyer's locale. Use alongside
662683 * [`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.
684+ * to build fully localized extensions.
667685 */
668686 i18n : I18n ;
669687
@@ -673,10 +691,11 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
673691 lines : SubscribableSignalLike < CartLine [ ] > ;
674692
675693 /**
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
694+ * The buyer's language, country, currency, market, and timezone context. Properties
695+ * are subscribable and update when the buyer changes their shipping address. For
696+ * formatting and translation helpers, use
678697 * [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#standardapi-propertydetail-i18n)
679- * object instead.
698+ * instead.
680699 */
681700 localization : Localization ;
682701
@@ -744,18 +763,21 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
744763 */
745764 billingAddress ?: SubscribableSignalLike < MailingAddress | undefined > ;
746765
747- /** The shop where the checkout is taking place. */
766+ /**
767+ * The store where the checkout is taking place, including the shop name,
768+ * primary domain, `.myshopify.com` subdomain, and globally-unique ID.
769+ * Use this to display store branding or route backend requests by shop.
770+ */
748771 shop : Shop ;
749772
750773 /**
751- * The key-value storage for the extension.
752- *
753- * It uses `localStorage` and should persist across the customer's current checkout session.
774+ * Key-value storage that persists across page loads within the current checkout
775+ * session. Use this to save dismissed states, form progress, or cached data
776+ * without a backend call. Data is shared across all activated extension targets
777+ * of this extension.
754778 *
755- * > Caution: Data persistence isn't guaranteed and storage is reset when the customer starts a new checkout.
756- *
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.
779+ * > Caution: Data persistence isn't guaranteed. The storage backend uses
780+ * `localStorage` and is cleared when the buyer starts a new checkout.
759781 */
760782 storage : Storage ;
761783
@@ -786,6 +808,12 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
786808 localizedFields ?: SubscribableSignalLike < LocalizedField [ ] > ;
787809}
788810
811+ /**
812+ * Authenticates requests between your extension and your app backend.
813+ * Use session tokens to verify the identity of the customer and the shop
814+ * context when making server-side API calls. The token is a signed JWT
815+ * that contains claims such as the customer ID, shop domain, and expiration.
816+ */
789817export interface SessionToken {
790818 /**
791819 * Requests a session token that hasn't expired. You should call this method every
@@ -913,6 +941,10 @@ export interface AppliedGiftCard {
913941 balance : Money ;
914942}
915943
944+ /**
945+ * Read-only metadata about the merchant's store, including its name, primary
946+ * domain, `.myshopify.com` subdomain, and globally-unique ID.
947+ */
916948export interface Shop {
917949 /**
918950 * A globally-unique identifier for the shop in the format `gid://shopify/Shop/<id>`.
@@ -1551,14 +1583,24 @@ export type ExtensionSettings = Record<
15511583 string | number | boolean | undefined
15521584> ;
15531585
1586+ /**
1587+ * Methods for interacting with Shopify's analytics framework. Use `publish()` to
1588+ * emit custom events that all registered [Web Pixels](https://shopify.dev/docs/apps/marketing) on
1589+ * the page can listen to, and `visitor()` to submit buyer contact details
1590+ * directly to the shop backend for attribution.
1591+ */
15541592export interface Analytics {
15551593 /**
1556- * Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1594+ * Emits a custom event to all [Web Pixels](https://shopify.dev/docs/apps/marketing) registered
1595+ * on the page. The event isn't sent to the shop backend. Returns `true` when
1596+ * the event is successfully dispatched.
15571597 */
15581598 publish ( name : string , data : Record < string , unknown > ) : Promise < boolean > ;
15591599
15601600 /**
1561- * A method for capturing details about a visitor on the online store.
1601+ * Submits buyer contact details to the shop backend for attribution and
1602+ * analytics purposes. Unlike `publish()`, this data isn't forwarded to
1603+ * web pixels on the page.
15621604 */
15631605 visitor ( data : { email ?: string ; phone ?: string } ) : Promise < VisitorResult > ;
15641606}
0 commit comments