@@ -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,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 */
6160export 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 editor. The value is `undefined` when the extension is not
135+ * rendering in an editor.
136+ */
133137export 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;
294298export 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 */
301305export 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+ */
310319export interface I18n {
311320 /**
312321 * Returns a localized number.
@@ -389,6 +398,11 @@ export interface Market {
389398 handle : string ;
390399}
391400
401+ /**
402+ * The buyer's language, country, and locale context. Properties on this
403+ * interface are subscribable and update automatically when the buyer's
404+ * locale changes.
405+ */
392406export interface Localization {
393407 /**
394408 * 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.
@@ -539,7 +553,9 @@ export interface BuyerJourneyStep {
539553
540554export interface StandardApi < Target extends ExtensionTarget = ExtensionTarget > {
541555 /**
542- * 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.
543559 */
544560 analytics : Analytics ;
545561
@@ -639,7 +655,9 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
639655 discountAllocations : SubscribableSignalLike < CartDiscountAllocation [ ] > ;
640656
641657 /**
642- * 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.
643661 */
644662 extension : Extension < Target > ;
645663
@@ -657,12 +675,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
657675 extensionPoint : Target ;
658676
659677 /**
660- * 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
661680 * [`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.
681+ * to build fully localized extensions.
666682 */
667683 i18n : I18n ;
668684
@@ -672,10 +688,10 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
672688 lines : SubscribableSignalLike < CartLine [ ] > ;
673689
674690 /**
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
691+ * The buyer's language, country, currency , and timezone context . For
692+ * formatting and translation helpers, use
677693 * [`i18n`](https://shopify.dev/docs/api/checkout-ui-extensions/{API_VERSION}/apis/localization#standardapi-propertydetail-i18n)
678- * object instead.
694+ * instead.
679695 */
680696 localization : Localization ;
681697
@@ -761,18 +777,19 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
761777 */
762778 billingAddress ?: SubscribableSignalLike < MailingAddress | undefined > ;
763779
764- /** The shop where the checkout is taking place. */
780+ /**
781+ * The store where the checkout is taking place, including the shop name,
782+ * primary domain, `.myshopify.com` subdomain, and globally-unique ID.
783+ */
765784 shop : Shop ;
766785
767786 /**
768- * The key -value storage for the extension.
769- *
770- * It uses `localStorage` and should persist across the customer's current checkout session .
787+ * Key -value storage that persists across page loads within the current checkout
788+ * session. Data is shared across all activated extension targets of this
789+ * extension .
771790 *
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.
791+ * > Caution: Data persistence isn't guaranteed and storage is cleared when the
792+ * buyer starts a new checkout.
776793 */
777794 storage : Storage ;
778795
@@ -803,6 +820,12 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
803820 localizedFields ?: SubscribableSignalLike < LocalizedField [ ] > ;
804821}
805822
823+ /**
824+ * Authenticates requests between your extension and your app backend.
825+ * Use session tokens to verify the identity of the customer and the shop
826+ * context when making server-side API calls. The token is a signed JWT
827+ * that contains claims such as the customer ID, shop domain, and expiration.
828+ */
806829export interface SessionToken {
807830 /**
808831 * Requests a session token that hasn't expired. You should call this method every
@@ -930,6 +953,10 @@ export interface AppliedGiftCard {
930953 balance : Money ;
931954}
932955
956+ /**
957+ * Metadata about the merchant's store, including its name, primary
958+ * domain, `.myshopify.com` subdomain, and globally-unique ID.
959+ */
933960export interface Shop {
934961 /**
935962 * A globally-unique identifier for the shop in the format `gid://shopify/Shop/<id>`.
@@ -1568,14 +1595,20 @@ export type ExtensionSettings = Record<
15681595 string | number | boolean | undefined
15691596> ;
15701597
1598+ /**
1599+ * Tracks custom events and sends visitor information to
1600+ * [Web Pixels](https://shopify.dev/docs/apps/marketing). Use `publish()` to emit events
1601+ * and `visitor()` to submit buyer contact details.
1602+ */
15711603export interface Analytics {
15721604 /**
1573- * Publish method to emit analytics events to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1605+ * Publishes a custom event to [Web Pixels](https://shopify.dev/docs/apps/marketing).
1606+ * Returns `true` when the event is successfully dispatched.
15741607 */
15751608 publish ( name : string , data : Record < string , unknown > ) : Promise < boolean > ;
15761609
15771610 /**
1578- * A method for capturing details about a visitor on the online store .
1611+ * Submits buyer contact details for attribution and analytics purposes .
15791612 */
15801613 visitor ( data : { email ?: string ; phone ?: string } ) : Promise < VisitorResult > ;
15811614}
0 commit comments