@shopify/ui-extensions
Advanced tools
Comparing version 0.0.0-unstable-20230203194854 to 0.0.0-unstable-20230224190256
@@ -13,2 +13,3 @@ 'use strict'; | ||
var Checkbox = require('./admin/components/Checkbox/Checkbox.js'); | ||
var CustomerSegmentationTemplate = require('./admin/components/CustomerSegmentationTemplate/CustomerSegmentationTemplate.js'); | ||
var Heading = require('./admin/components/Heading/Heading.js'); | ||
@@ -43,2 +44,3 @@ var Icon = require('./admin/components/Icon/Icon.js'); | ||
exports.Checkbox = Checkbox.Checkbox; | ||
exports.CustomerSegmentationTemplate = CustomerSegmentationTemplate.CustomerSegmentationTemplate; | ||
exports.Heading = Heading.Heading; | ||
@@ -45,0 +47,0 @@ exports.Icon = Icon.Icon; |
export interface StandardApi { | ||
readonly extensionPoint: string; | ||
} | ||
/** | ||
* This defines the i18n.translate() signature. | ||
*/ | ||
export interface I18nTranslate { | ||
/** | ||
* This returns a translated string matching a key in a locale file. | ||
* | ||
* @example translate("banner.title") | ||
*/ | ||
<ReplacementType = string>(key: string, options?: { | ||
[placeholderKey: string]: ReplacementType | string | number; | ||
}): ReplacementType extends string | number ? string : (string | ReplacementType)[]; | ||
} | ||
export interface I18n { | ||
/** | ||
* Returns a localized number. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `decimal` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatNumber: (number: number | bigint, options?: { | ||
inExtensionLocale?: boolean; | ||
} & Intl.NumberFormatOptions) => string; | ||
/** | ||
* Returns a localized currency value. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `currency` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatCurrency: (number: number | bigint, options?: { | ||
inExtensionLocale?: boolean; | ||
} & Intl.NumberFormatOptions) => string; | ||
/** | ||
* Returns a localized date value. | ||
* | ||
* This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses | ||
* the buyer's locale by default. Formatting options can be passed in as | ||
* options. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatDate: (date: Date, options?: { | ||
inExtensionLocale?: boolean; | ||
} & Intl.DateTimeFormatOptions) => string; | ||
/** | ||
* Returns translated content in the buyer's locale, | ||
* as supported by the extension. | ||
* | ||
* - `options.count` is a special numeric value used in pluralization. | ||
* - The other option keys and values are treated as replacements for interpolation. | ||
* - If the replacements are all primitives, then `translate()` returns a single string. | ||
* - If replacements contain UI components, then `translate()` returns an array of elements. | ||
*/ | ||
translate: I18nTranslate; | ||
} | ||
//# sourceMappingURL=api.d.ts.map |
@@ -0,2 +1,4 @@ | ||
export type { I18n, I18nTranslate } from '../../api'; | ||
export type { StandardApi } from './api/standard/standard'; | ||
export type { CustomerSegmentationTemplateApi } from './api/customer-segmentation-template/customer-segmentation-template'; | ||
//# sourceMappingURL=api.d.ts.map |
@@ -15,2 +15,4 @@ export { Badge } from './components/Badge/Badge'; | ||
export type { CheckboxProps } from './components/Checkbox/Checkbox'; | ||
export { CustomerSegmentationTemplate } from './components/CustomerSegmentationTemplate/CustomerSegmentationTemplate'; | ||
export type { CustomerSegmentationTemplateProps } from './components/CustomerSegmentationTemplate/CustomerSegmentationTemplate'; | ||
export { Heading } from './components/Heading/Heading'; | ||
@@ -17,0 +19,0 @@ export type { HeadingProps } from './components/Heading/Heading'; |
import type { RenderExtension } from '../../extension'; | ||
import type { AnyComponent } from './shared'; | ||
import type { StandardApi } from './api'; | ||
import type { AnyComponent, Components } from './shared'; | ||
import type { StandardApi, CustomerSegmentationTemplateApi } from './api'; | ||
import { AnyComponentBuilder } from '../../shared'; | ||
type CustomerSegmentationTemplateComponent = AnyComponentBuilder<Pick<Components, 'CustomerSegmentationTemplate'>>; | ||
export interface ExtensionPoints { | ||
Playground: RenderExtension<StandardApi<'Playground'>, AnyComponent>; | ||
'admin.customers.segmentation-templates.render': RenderExtension<CustomerSegmentationTemplateApi<'admin.customers.segmentation-templates.render'>, CustomerSegmentationTemplateComponent>; | ||
} | ||
@@ -7,0 +10,0 @@ export type ExtensionPoint = keyof ExtensionPoints; |
@@ -0,4 +1,5 @@ | ||
export type { I18n, I18nTranslate } from '../../api'; | ||
export type { CountryCode, CurrencyCode, Timezone } from './api/shared'; | ||
export type { StandardApi, ExtensionInstance, ExtensionSettings, BuyerIdentity, Capability, CartCost, CartLineCost, Customer, Editor, Interceptor, InterceptorRequest, Storage, Version, Shop, NoteChange, NoteChangeResult, NoteChangeResultSuccess, NoteChangeResultError, MailingAddress, Metafield, MetafieldRemoveChange, MetafieldUpdateChange, MetafieldChange, MetafieldChangeResultError, MetafieldChangeResultSuccess, MetafieldChangeResult, AppMetafield, AppMetafieldEntryTarget, AppMetafieldEntry, Attribute, AttributeChange, AttributeChangeResult, Merchandise, ImageDetails, Product, ProductVariant, SelectedOption, Money, CartLine, CartLineChange, CartLineChangeResult, CartLineChangeResultError, CartLineChangeResultSuccess, CartLineAddChange, CartLineUpdateChange, CartLineRemoveChange, PresentmentCartLine, CartDiscountCode, CartDiscountAllocation, CartCodeDiscountAllocation, CartAutomaticDiscountAllocation, CartCustomDiscountAllocation, DiscountCodeAddChange, DiscountCodeRemoveChange, DiscountCodeChange, DiscountCodeChangeResult, DiscountCodeChangeResultError, DiscountCodeChangeResultSuccess, I18n, I18nTranslate, Currency, Language, Localization, } from './api/standard/standard'; | ||
export type { StandardApi, ExtensionInstance, ExtensionSettings, BuyerIdentity, Capability, CartCost, CartLineCost, Customer, Editor, Interceptor, InterceptorRequest, Storage, Version, Shop, NoteChange, NoteChangeResult, NoteChangeResultSuccess, NoteChangeResultError, MailingAddress, Metafield, MetafieldRemoveChange, MetafieldUpdateChange, MetafieldChange, MetafieldChangeResultError, MetafieldChangeResultSuccess, MetafieldChangeResult, AppMetafield, AppMetafieldEntryTarget, AppMetafieldEntry, Attribute, AttributeChange, AttributeChangeResult, Merchandise, ImageDetails, Product, ProductVariant, SelectedOption, Money, CartLine, CartLineChange, CartLineChangeResult, CartLineChangeResultError, CartLineChangeResultSuccess, CartLineAddChange, CartLineUpdateChange, CartLineRemoveChange, PresentmentCartLine, CartDiscountCode, CartDiscountAllocation, CartCodeDiscountAllocation, CartAutomaticDiscountAllocation, CartCustomDiscountAllocation, DiscountCodeAddChange, DiscountCodeRemoveChange, DiscountCodeChange, DiscountCodeChangeResult, DiscountCodeChangeResultError, DiscountCodeChangeResultSuccess, Currency, Language, Localization, } from './api/standard/standard'; | ||
export type { CartLineDetailsRenderAfterApi } from './api/cart-line-details/render-after'; | ||
//# sourceMappingURL=api.d.ts.map |
import type { StatefulRemoteSubscribable } from '@remote-ui/async-subscription'; | ||
import type { StandardApi as BaseStandardApi } from '../../../../api'; | ||
import type { StandardApi as BaseStandardApi, I18n } from '../../../../api'; | ||
import type { ExtensionPoint as AnyExtensionPoint } from '../../extension-points'; | ||
@@ -296,64 +296,2 @@ import type { CurrencyCode, CountryCode, Timezone } from '../shared'; | ||
export type Version = 'unstable'; | ||
/** | ||
* This defines the i18n.translate() signature. | ||
*/ | ||
export interface I18nTranslate { | ||
/** | ||
* This returns a translated string matching a key in a locale file. | ||
* | ||
* @example translate("banner.title") | ||
*/ | ||
<ReplacementType = string>(key: string, options?: { | ||
[placeholderKey: string]: ReplacementType | string | number; | ||
}): ReplacementType extends string | number ? string : (string | ReplacementType)[]; | ||
} | ||
export interface I18n { | ||
/** | ||
* Returns a localized number. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `decimal` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatNumber: (number: number | bigint, options?: { | ||
inExtensionLocale?: boolean; | ||
} & Intl.NumberFormatOptions) => string; | ||
/** | ||
* Returns a localized currency value. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `currency` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatCurrency: (number: number | bigint, options?: { | ||
inExtensionLocale?: boolean; | ||
} & Intl.NumberFormatOptions) => string; | ||
/** | ||
* Returns a localized date value. | ||
* | ||
* This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses | ||
* the buyer's locale by default. Formatting options can be passed in as | ||
* options. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatDate: (date: Date, options?: { | ||
inExtensionLocale?: boolean; | ||
} & Intl.DateTimeFormatOptions) => string; | ||
/** | ||
* Returns translated content in the buyer's locale, | ||
* as supported by the extension. | ||
* | ||
* - `options.count` is a special numeric value used in pluralization. | ||
* - The other option keys and values are treated as replacements for interpolation. | ||
* - If the replacements are all primitives, then `translate()` returns a single string. | ||
* - If replacements contain UI components, then `translate()` returns an array of elements. | ||
*/ | ||
translate: I18nTranslate; | ||
} | ||
export interface Language { | ||
@@ -360,0 +298,0 @@ /** |
{ | ||
"name": "@shopify/ui-extensions", | ||
"version": "0.0.0-unstable-20230203194854", | ||
"version": "0.0.0-unstable-20230224190256", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "module": "index.mjs", |
export interface StandardApi { | ||
readonly extensionPoint: string; | ||
} | ||
/** | ||
* This defines the i18n.translate() signature. | ||
*/ | ||
export interface I18nTranslate { | ||
/** | ||
* This returns a translated string matching a key in a locale file. | ||
* | ||
* @example translate("banner.title") | ||
*/ | ||
<ReplacementType = string>( | ||
key: string, | ||
options?: {[placeholderKey: string]: ReplacementType | string | number}, | ||
): ReplacementType extends string | number | ||
? string | ||
: (string | ReplacementType)[]; | ||
} | ||
export interface I18n { | ||
/** | ||
* Returns a localized number. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `decimal` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatNumber: ( | ||
number: number | bigint, | ||
options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, | ||
) => string; | ||
/** | ||
* Returns a localized currency value. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `currency` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatCurrency: ( | ||
number: number | bigint, | ||
options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, | ||
) => string; | ||
/** | ||
* Returns a localized date value. | ||
* | ||
* This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses | ||
* the buyer's locale by default. Formatting options can be passed in as | ||
* options. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatDate: ( | ||
date: Date, | ||
options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, | ||
) => string; | ||
/** | ||
* Returns translated content in the buyer's locale, | ||
* as supported by the extension. | ||
* | ||
* - `options.count` is a special numeric value used in pluralization. | ||
* - The other option keys and values are treated as replacements for interpolation. | ||
* - If the replacements are all primitives, then `translate()` returns a single string. | ||
* - If replacements contain UI components, then `translate()` returns an array of elements. | ||
*/ | ||
translate: I18nTranslate; | ||
} |
@@ -0,1 +1,3 @@ | ||
export type {I18n, I18nTranslate} from '../../api'; | ||
export type {StandardApi} from './api/standard/standard'; | ||
export type {CustomerSegmentationTemplateApi} from './api/customer-segmentation-template/customer-segmentation-template'; |
@@ -15,2 +15,4 @@ export {Badge} from './components/Badge/Badge'; | ||
export type {CheckboxProps} from './components/Checkbox/Checkbox'; | ||
export {CustomerSegmentationTemplate} from './components/CustomerSegmentationTemplate/CustomerSegmentationTemplate'; | ||
export type {CustomerSegmentationTemplateProps} from './components/CustomerSegmentationTemplate/CustomerSegmentationTemplate'; | ||
export {Heading} from './components/Heading/Heading'; | ||
@@ -17,0 +19,0 @@ export type {HeadingProps} from './components/Heading/Heading'; |
import type {RenderExtension} from '../../extension'; | ||
import type {AnyComponent} from './shared'; | ||
import type {StandardApi} from './api'; | ||
import type {AnyComponent, Components} from './shared'; | ||
import type {StandardApi, CustomerSegmentationTemplateApi} from './api'; | ||
import {AnyComponentBuilder} from '../../shared'; | ||
type CustomerSegmentationTemplateComponent = AnyComponentBuilder< | ||
Pick<Components, 'CustomerSegmentationTemplate'> | ||
>; | ||
export interface ExtensionPoints { | ||
Playground: RenderExtension<StandardApi<'Playground'>, AnyComponent>; | ||
'admin.customers.segmentation-templates.render': RenderExtension< | ||
CustomerSegmentationTemplateApi<'admin.customers.segmentation-templates.render'>, | ||
CustomerSegmentationTemplateComponent | ||
>; | ||
} | ||
@@ -9,0 +18,0 @@ |
@@ -0,1 +1,2 @@ | ||
export type {I18n, I18nTranslate} from '../../api'; | ||
export type {CountryCode, CurrencyCode, Timezone} from './api/shared'; | ||
@@ -61,4 +62,2 @@ export type { | ||
DiscountCodeChangeResultSuccess, | ||
I18n, | ||
I18nTranslate, | ||
Currency, | ||
@@ -65,0 +64,0 @@ Language, |
import type {StatefulRemoteSubscribable} from '@remote-ui/async-subscription'; | ||
import type {StandardApi as BaseStandardApi} from '../../../../api'; | ||
import type {StandardApi as BaseStandardApi, I18n} from '../../../../api'; | ||
import type {ExtensionPoint as AnyExtensionPoint} from '../../extension-points'; | ||
@@ -353,75 +352,2 @@ import type {CurrencyCode, CountryCode, Timezone} from '../shared'; | ||
/** | ||
* This defines the i18n.translate() signature. | ||
*/ | ||
export interface I18nTranslate { | ||
/** | ||
* This returns a translated string matching a key in a locale file. | ||
* | ||
* @example translate("banner.title") | ||
*/ | ||
<ReplacementType = string>( | ||
key: string, | ||
options?: {[placeholderKey: string]: ReplacementType | string | number}, | ||
): ReplacementType extends string | number | ||
? string | ||
: (string | ReplacementType)[]; | ||
} | ||
export interface I18n { | ||
/** | ||
* Returns a localized number. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `decimal` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatNumber: ( | ||
number: number | bigint, | ||
options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, | ||
) => string; | ||
/** | ||
* Returns a localized currency value. | ||
* | ||
* This function behaves like the standard `Intl.NumberFormat()` | ||
* with a style of `currency` applied. It uses the buyer's locale by default. | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatCurrency: ( | ||
number: number | bigint, | ||
options?: {inExtensionLocale?: boolean} & Intl.NumberFormatOptions, | ||
) => string; | ||
/** | ||
* Returns a localized date value. | ||
* | ||
* This function behaves like the standard `Intl.DateTimeFormatOptions()` and uses | ||
* the buyer's locale by default. Formatting options can be passed in as | ||
* options. | ||
* | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat0 | ||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options | ||
* | ||
* @param options.inExtensionLocale - if true, use the extension's locale | ||
*/ | ||
formatDate: ( | ||
date: Date, | ||
options?: {inExtensionLocale?: boolean} & Intl.DateTimeFormatOptions, | ||
) => string; | ||
/** | ||
* Returns translated content in the buyer's locale, | ||
* as supported by the extension. | ||
* | ||
* - `options.count` is a special numeric value used in pluralization. | ||
* - The other option keys and values are treated as replacements for interpolation. | ||
* - If the replacements are all primitives, then `translate()` returns a single string. | ||
* - If replacements contain UI components, then `translate()` returns an array of elements. | ||
*/ | ||
translate: I18nTranslate; | ||
} | ||
export interface Language { | ||
@@ -428,0 +354,0 @@ /** |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1169868
652
13601