@ecomweb/sdk 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/index.d.ts +63 -10
- package/dist/index.js +54 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ Shared TypeScript SDK for the EcomWeb storefront API — request builders,
|
|
|
4
4
|
response types and the vocabulary (collection rules, payment methods, order
|
|
5
5
|
shapes) that the API and its consumers must agree on.
|
|
6
6
|
|
|
7
|
-
>
|
|
8
|
-
>
|
|
7
|
+
> Source: [ecomwebai/ecomweb-storefront-sdk](https://github.com/ecomwebai/ecomweb-storefront-sdk)
|
|
8
|
+
> (read-only mirror, one commit per release; issues welcome there).
|
|
9
9
|
|
|
10
10
|
## Source in the workspace, `dist/` on npm
|
|
11
11
|
|
|
@@ -38,6 +38,15 @@ The SDK lives in the storefront's pnpm workspace (`packages/sdk`). The app
|
|
|
38
38
|
imports its source directly, so edits are visible immediately. Run
|
|
39
39
|
`pnpm --filter @ecomweb/sdk test` before you push.
|
|
40
40
|
|
|
41
|
+
### The `X-Ecomweb-Client` header
|
|
42
|
+
|
|
43
|
+
`createEcomwebSdk` wraps both HTTP clients so every request sends
|
|
44
|
+
`X-Ecomweb-Client: @ecomweb/sdk/<version>` (`SDK_VERSION`, set by tsup's
|
|
45
|
+
`define` at build; `dev` when the source runs without it). Pass
|
|
46
|
+
`clientInfo: "name/version"` to put your own tokens first, as the storefront
|
|
47
|
+
kit does. A header the caller sets itself wins. `withClientHeader(http)`
|
|
48
|
+
wraps a client used outside `createEcomwebSdk`.
|
|
49
|
+
|
|
41
50
|
## Layout
|
|
42
51
|
|
|
43
52
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,26 @@ interface IHttpClient {
|
|
|
26
26
|
delete<T>(url: string, options?: RequestOptions): Promise<ApiResponse<T>>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* This package's version, baked in at build time. `dev` when the source runs
|
|
31
|
+
* without the define (the API ignores a version that isn't semver).
|
|
32
|
+
*/
|
|
33
|
+
declare const SDK_VERSION: string;
|
|
34
|
+
/** Sent on every SDK request: space-separated `name/version` tokens. */
|
|
35
|
+
declare const CLIENT_HEADER = "X-Ecomweb-Client";
|
|
36
|
+
/** This SDK's own token, `@ecomweb/sdk/<version>`. */
|
|
37
|
+
declare const SDK_CLIENT_TOKEN: string;
|
|
38
|
+
/**
|
|
39
|
+
* The `X-Ecomweb-Client` value: `clientInfo` (a caller's own tokens, such as
|
|
40
|
+
* `@ecomweb/storefront-kit/0.14.0`) followed by this SDK's token.
|
|
41
|
+
*/
|
|
42
|
+
declare function clientHeaderValue(clientInfo?: string): string;
|
|
43
|
+
/**
|
|
44
|
+
* Wraps an HTTP client so every request carries `X-Ecomweb-Client`. A header
|
|
45
|
+
* the caller already set wins, and a client wrapped once is not wrapped again.
|
|
46
|
+
*/
|
|
47
|
+
declare function withClientHeader(http: IHttpClient, clientInfo?: string): IHttpClient;
|
|
48
|
+
|
|
29
49
|
declare class ApiClientError extends Error {
|
|
30
50
|
statusCode: number;
|
|
31
51
|
code?: string;
|
|
@@ -2440,7 +2460,8 @@ interface BlogComment {
|
|
|
2440
2460
|
blog_post_id: Id | null;
|
|
2441
2461
|
parent_comment_id: Id | null;
|
|
2442
2462
|
author_name: string;
|
|
2443
|
-
|
|
2463
|
+
/** Never on public reads (the API hides commenter emails); admin reads only. */
|
|
2464
|
+
author_email?: string;
|
|
2444
2465
|
author_website: string | null;
|
|
2445
2466
|
content: string;
|
|
2446
2467
|
is_approved: boolean;
|
|
@@ -2517,7 +2538,7 @@ declare const blogCommentSchema: z.ZodObject<{
|
|
|
2517
2538
|
blog_post_id: z.ZodNullable<z.ZodOptional<z.ZodInt32>>;
|
|
2518
2539
|
parent_comment_id: z.ZodNullable<z.ZodOptional<z.ZodInt32>>;
|
|
2519
2540
|
author_name: z.ZodString;
|
|
2520
|
-
author_email: z.ZodEmail
|
|
2541
|
+
author_email: z.ZodOptional<z.ZodEmail>;
|
|
2521
2542
|
author_website: z.ZodNullable<z.ZodOptional<z.ZodURL>>;
|
|
2522
2543
|
content: z.ZodString;
|
|
2523
2544
|
is_approved: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -2584,11 +2605,11 @@ declare const createBlogPostSchema: z.ZodObject<{
|
|
|
2584
2605
|
declare const createBlogCommentSchema: z.ZodObject<{
|
|
2585
2606
|
content: z.ZodString;
|
|
2586
2607
|
author_name: z.ZodString;
|
|
2587
|
-
author_email: z.ZodEmail;
|
|
2588
2608
|
blog_post_id: z.ZodNullable<z.ZodOptional<z.ZodInt32>>;
|
|
2589
2609
|
parent_comment_id: z.ZodNullable<z.ZodOptional<z.ZodInt32>>;
|
|
2590
2610
|
author_website: z.ZodNullable<z.ZodOptional<z.ZodURL>>;
|
|
2591
2611
|
is_approved: z.ZodDefault<z.ZodBoolean>;
|
|
2612
|
+
author_email: z.ZodEmail;
|
|
2592
2613
|
}, z.core.$strip>;
|
|
2593
2614
|
declare const createBlogSettingsSchema: z.ZodObject<{
|
|
2594
2615
|
blog_title: z.ZodDefault<z.ZodString>;
|
|
@@ -2640,8 +2661,8 @@ declare const updateBlogPostSchema: z.ZodObject<{
|
|
|
2640
2661
|
declare const updateBlogCommentSchema: z.ZodObject<{
|
|
2641
2662
|
content: z.ZodOptional<z.ZodString>;
|
|
2642
2663
|
author_name: z.ZodOptional<z.ZodString>;
|
|
2643
|
-
author_email: z.ZodOptional<z.ZodEmail>;
|
|
2644
2664
|
parent_comment_id: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodInt32>>>;
|
|
2665
|
+
author_email: z.ZodOptional<z.ZodEmail>;
|
|
2645
2666
|
author_website: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodURL>>>;
|
|
2646
2667
|
is_approved: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
2647
2668
|
}, z.core.$strip>;
|
|
@@ -2670,7 +2691,9 @@ declare const blogCommentWithRepliesSchema: z.ZodType<BlogCommentWithReplies, un
|
|
|
2670
2691
|
type CreateBlogCategory = Omit<BlogCategory, "id" | keyof OptionalTimestamp>;
|
|
2671
2692
|
type CreateBlogTag = Omit<BlogTag, "id" | keyof OptionalTimestamp>;
|
|
2672
2693
|
type CreateBlogPost = Omit<BlogPost$1, "id" | "view_count" | keyof OptionalTimestamp>;
|
|
2673
|
-
type CreateBlogComment = Omit<BlogComment, "id" | "created_at"
|
|
2694
|
+
type CreateBlogComment = Omit<BlogComment, "id" | "created_at" | "author_email"> & {
|
|
2695
|
+
author_email: string;
|
|
2696
|
+
};
|
|
2674
2697
|
type CreateBlogSettings = Omit<BlogSettings, "id" | keyof OptionalTimestamp>;
|
|
2675
2698
|
type UpdateBlogCategory = Partial<CreateBlogCategory>;
|
|
2676
2699
|
type UpdateBlogTag = Partial<CreateBlogTag>;
|
|
@@ -4203,6 +4226,8 @@ interface CreateOrderRequest {
|
|
|
4203
4226
|
notes?: string;
|
|
4204
4227
|
customer_address_id?: number;
|
|
4205
4228
|
promotion_id?: number;
|
|
4229
|
+
/** The code the shopper entered for `promotion_id`; storefront checkout must send it for a discount-code promotion. */
|
|
4230
|
+
promotion_code?: string;
|
|
4206
4231
|
/** Omit to default to 'online'. Staff keying in a walk-in order must send 'pos', 'phone', or 'admin'. */
|
|
4207
4232
|
source?: AdminOrderSource;
|
|
4208
4233
|
items: CreateOrderItemRequest[];
|
|
@@ -5123,6 +5148,15 @@ interface AuthResult {
|
|
|
5123
5148
|
expires_in: number;
|
|
5124
5149
|
identity: AuthIdentity | null;
|
|
5125
5150
|
}
|
|
5151
|
+
/**
|
|
5152
|
+
* What register answers. `verification_binding` ties the mailed verification
|
|
5153
|
+
* link to this client: keep it (never show or mail it) and present it on
|
|
5154
|
+
* verify-email, or the click verifies the address but drops the password set
|
|
5155
|
+
* at registration. Absent on APIs that predate the binding.
|
|
5156
|
+
*/
|
|
5157
|
+
interface RegisterResult extends AuthResult {
|
|
5158
|
+
verification_binding?: string;
|
|
5159
|
+
}
|
|
5126
5160
|
interface AuthIdentity {
|
|
5127
5161
|
id: string;
|
|
5128
5162
|
email: string | null;
|
|
@@ -5195,6 +5229,14 @@ interface VerifyOtpPayload {
|
|
|
5195
5229
|
interface SentResult {
|
|
5196
5230
|
sent: boolean;
|
|
5197
5231
|
}
|
|
5232
|
+
/**
|
|
5233
|
+
* What change-email answers. `confirmation_binding` must accompany the
|
|
5234
|
+
* emailed confirm token (see confirmEmailChange); newer APIs refuse a confirm
|
|
5235
|
+
* without it. Absent on APIs that predate the binding.
|
|
5236
|
+
*/
|
|
5237
|
+
interface ChangeEmailResult extends SentResult {
|
|
5238
|
+
confirmation_binding?: string;
|
|
5239
|
+
}
|
|
5198
5240
|
interface VerifiedResult {
|
|
5199
5241
|
verified: boolean;
|
|
5200
5242
|
}
|
|
@@ -5228,14 +5270,20 @@ declare class AuthApi {
|
|
|
5228
5270
|
private tenantPath;
|
|
5229
5271
|
private auth;
|
|
5230
5272
|
/** Never returns tokens: a new email and an existing one respond identically. */
|
|
5231
|
-
register(payload: RegisterPayload): Promise<ApiResponse<
|
|
5273
|
+
register(payload: RegisterPayload): Promise<ApiResponse<RegisterResult>>;
|
|
5232
5274
|
login(payload: LoginPayload): Promise<ApiResponse<AuthResult>>;
|
|
5233
5275
|
refresh(refresh_token: string): Promise<ApiResponse<AuthResult>>;
|
|
5234
|
-
|
|
5276
|
+
/**
|
|
5277
|
+
* `binding` is the register response's `verification_binding`, when this
|
|
5278
|
+
* client still has it. Omitted, the address is verified but the password
|
|
5279
|
+
* set at registration is dropped.
|
|
5280
|
+
*/
|
|
5281
|
+
verifyEmail(token: string, binding?: string): Promise<ApiResponse<VerifiedResult>>;
|
|
5235
5282
|
resendVerification(email: string): Promise<ApiResponse<SentResult>>;
|
|
5236
5283
|
forgotPassword(email: string): Promise<ApiResponse<SentResult>>;
|
|
5237
5284
|
resetPassword(payload: ResetPasswordPayload): Promise<ApiResponse<ResetResult>>;
|
|
5238
|
-
|
|
5285
|
+
/** `binding` is the change-email response's `confirmation_binding`. */
|
|
5286
|
+
confirmEmailChange(token: string, binding?: string): Promise<ApiResponse<ChangedResult>>;
|
|
5239
5287
|
requestOtp(email: string): Promise<ApiResponse<SentResult>>;
|
|
5240
5288
|
verifyOtp(payload: VerifyOtpPayload): Promise<ApiResponse<AuthResult>>;
|
|
5241
5289
|
anonymous(): Promise<ApiResponse<AuthResult>>;
|
|
@@ -5247,7 +5295,7 @@ declare class AuthApi {
|
|
|
5247
5295
|
logout(access_token: string, refresh_token: string): Promise<ApiResponse<unknown>>;
|
|
5248
5296
|
logoutAll(access_token: string): Promise<ApiResponse<unknown>>;
|
|
5249
5297
|
changePassword(access_token: string, payload: ChangePasswordPayload): Promise<ApiResponse<unknown>>;
|
|
5250
|
-
changeEmail(access_token: string, payload: ChangeEmailPayload): Promise<ApiResponse<
|
|
5298
|
+
changeEmail(access_token: string, payload: ChangeEmailPayload): Promise<ApiResponse<ChangeEmailResult>>;
|
|
5251
5299
|
}
|
|
5252
5300
|
|
|
5253
5301
|
/**
|
|
@@ -5288,6 +5336,11 @@ declare function createAuthAwareHttpClient(inner: IHttpClient, { storage, auth }
|
|
|
5288
5336
|
interface EcomwebSdkOptions {
|
|
5289
5337
|
publicHttp: IHttpClient;
|
|
5290
5338
|
authHttp: IHttpClient;
|
|
5339
|
+
/**
|
|
5340
|
+
* Tokens put before this SDK's own in the `X-Ecomweb-Client` header
|
|
5341
|
+
* (space-separated `name/version`, e.g. `@ecomweb/storefront-kit/0.14.0`).
|
|
5342
|
+
*/
|
|
5343
|
+
clientInfo?: string;
|
|
5291
5344
|
}
|
|
5292
5345
|
declare function createEcomwebSdk(options: EcomwebSdkOptions): {
|
|
5293
5346
|
products: ProductsApi;
|
|
@@ -5313,4 +5366,4 @@ declare function createEcomwebSdk(options: EcomwebSdkOptions): {
|
|
|
5313
5366
|
};
|
|
5314
5367
|
type EcomwebSdk = ReturnType<typeof createEcomwebSdk>;
|
|
5315
5368
|
|
|
5316
|
-
export { ADJUSTABLE_STATES, ADMIN_ORDER_SOURCES, type AddToCartRequest, type Address, AddressesApi, type AdjustQuantitiesRequest, type AdjustableState, type AdminOrderSource, ApiClientError, type ApiError, type ApiResponse, type AppliedPromotion, type AttributeLink, AuthApi, type AuthErrorCode, type AuthIdentity, type AuthResult, type AuthTokens, type AutocompleteParams, type BankAccount, type BaseDeleteOptions, type BaseDeleteResult, type BaseQueryParams, type BatchOrderReviewInvitationsResult, BlogApi, type BlogCategory, type BlogCategoryQueryParams, type BlogComment, type BlogCommentWithReplies, type BlogPost, type BlogPostCategory, type BlogPostQueryParams, type BlogPostStatus, type BlogPostTag, type BlogPostWithRelations, type BlogSearchParams, type BlogSearchResponse, type BlogSettings, type BlogTag, type BlogTagQueryParams, COLLECTION_RULE_MATRIX, CONDITION_TYPE_LABELS, CartApi, type CartApiItem, type CartApiResponse, CategoriesApi, type Category, type CategoryQueryParams, type CategorySearchResponse, type CategoryTree, type CategoryWithChildren, type ChangeEmailPayload, type ChangePasswordPayload, type ChangedResult, type Collection, type CollectionQueryParams, type CollectionRule, type CollectionRuleSet, type CollectionRuleSetCriteria, type CollectionSearchCriteria, CollectionsApi, ConditionType, ConditionTypeSchema, type ConditionTypeType, type ContentPage, ContentPagesApi, type CreateAddressDto, type CreateBlogCategory, type CreateBlogComment, type CreateBlogPost, type CreateBlogSettings, type CreateBlogTag, type CreateCategory, type CreateContentPage, type CreateEmbeddedScript, type CreateOrder, type CreateOrderItem, type CreateOrderItemRequest, type CreateOrderRequest, type CreateProduct, type CreateProductReview, type CreateProductReviewReply, type CreateProductVariant, type CreatePromotion, CreatePromotionSchema, type CreateStore, type CreateStoreConfig, type CreateStoreSettings, type CreateVariantOption, type CreateVariantOptionValue, type CurrentIdentity, type Customer, type CustomerAccess, type CustomerOrderFilter, type CustomerOrderSummary, CustomersApi, DEFAULT_BUCKET, DISCOUNT_METHOD_LABELS, type DeleteApiFunction, type DeletedAt, DiscountMethod, DiscountMethodSchema, type DiscountMethodType, EMAIL_COLOR_PATTERN, EMAIL_PALETTE_DEFAULTS, ENTRY_HANDLE_PATTERN, type EcomwebSdk, type EcomwebSdkOptions, type EmbeddedScript, type EmbeddedScriptPlacement, type EngineResult, FILTERABLE_TYPES, type FileKind, type FulfillmentStatus, type GoogleAuthUrl, type GuestOrderLookupParams, type IHttpClient, INVENTORY_ADJUSTMENT_REASONS, INVENTORY_ERROR_CODES, INVENTORY_POLICIES, INVENTORY_STATES, INVENTORY_STATUS_LABELS, type Id, type ImageFormat, type ImageTransformOptions, type InitiatePaymentResult, type InsufficientInventoryItem, type IntegrationStatus, type InventoryActor, type InventoryAdjustmentReason, type InventoryErrorCode, type InventoryHistoryEntry, type InventoryImportResponse, type InventoryLevelRow, type InventoryLocation, type InventoryPolicy, type InventoryQuantities, type InventoryState, InventoryStatus, KNOWN_PAYMENT_METHODS, LEGACY_STATUS_MIGRATION_MAP, LEVEL_PROVINCE, LEVEL_WARD, type LegacyOrderStatus, type LegacyProductStatus, type LinkValue, type LocationArea, type LocationAreaQuery, type LocationAreasResponse, type LoginPayload, MAX_RULES_PER_SET, MAX_RULE_VALUE_ENTRIES, MEASUREMENT_UNITS, MEDIA_TYPES, MERCHANT_ADJUSTMENT_REASONS, METAFIELD_BASE_TYPES, METAFIELD_KEY_PATTERN, METAFIELD_LIMITS, METAFIELD_OWNER_TYPES, METAFIELD_TYPE_GROUPS, METAOBJECT_REFERENCE_TYPES, METAOBJECT_TYPE_PATTERN, type MeasurementType, type MeasurementValue, MemoryTokenStorage, MenusApi, type MerchantAdjustmentReason, type MessageOutboxStatus, type MetafieldBaseType, type MetafieldBound, type MetafieldContext, type MetafieldDefinitionShape, type MetafieldIssue, type MetafieldIssueCode, type MetafieldListType, type MetafieldOwnerType, type MetafieldType, type MetafieldTypeGroup, type MetafieldValidationKey, type MetafieldValidations, type MetafieldWrite, type MetaobjectDefinitionShape, type MetaobjectFieldShape, type MetaobjectListParams, type MetaobjectListResult, MetaobjectsApi, type MoneyValue, type MoveQuantitiesRequest, type MutationApiFunction, OBJECT_PREFIX, ORDER_ACTOR_TYPES, ORDER_EVENT_TYPES, ORDER_SHIPMENT_ERROR_CODES, ORDER_SOURCES, type OptionalTimestamp, type Order, type OrderActorType, type OrderCommentMutationResult, type OrderCreatedBy, type OrderEventType, type OrderItem, type PaymentMethod$1 as OrderPaymentMethod, type OrderReviewInvitationSummary, type OrderShipmentEvent, type OrderShipmentSummary, type OrderSource, type OrderStatus, type OrderTimelineActor, type OrderTimelineComment, type OrderTimelineCommentAuthor, type OrderTimelineEntry, type OrderTimelineEvent, type OrderTimelineResponse, type OrderWithItems, OrdersApi, PAGINATION_DEFAULTS, PRIVATE_REFERENCE_TYPES, PRODUCT_STATUS_LABELS, PROMOTION_MODE_COLORS, PROMOTION_MODE_LABELS, PROMOTION_STATUS_COLORS, PROMOTION_STATUS_LABELS, PROMOTION_TYPE_COLORS, PROMOTION_TYPE_LABELS, type PaginatedApiFunction, type PaginatedPromotionsResponse, PaginatedPromotionsResponseSchema, type PaginatedResponse, type PaginatedReviewsResponse, type PaginationMeta, type PasswordPolicy, type PaymentCredentialStatus, type PaymentMethod$1 as PaymentMethod, PaymentMethodsApi, type PaymentStateResult, type PaymentStatus, PaymentsApi, type Product, type ProductDetail, type ProductImage, type ProductQueryParams, type ProductReview, type ProductReviewFilters, type ProductReviewReply, type ProductReviewReplyFilters, type ProductReviewStats, type ProductReviewWithReplies, type ProductSearchParams, type ProductSearchResponse, type ProductService, ProductStatus, type ProductVariant, type ProductVariantCombination, type ProductVariantCombinationEntry, type ProductVariantWithCombinations, type ProductVideo, type ProductWithReviewStats, type ProductWithVariants, ProductsApi, type Promotion, type PromotionData, PromotionMode, PromotionModeSchema, type PromotionModeType, type PromotionQueryParams, PromotionQueryParamsSchema, PromotionSchema, type PromotionStatistics, PromotionStatisticsSchema, PromotionStatus, PromotionStatusSchema, type PromotionStatusType, type PromotionSuggestion, type PromotionSuggestionsResponse, PromotionType, PromotionTypeSchema, type PromotionTypeType, type PromotionWithDiscount, PromotionWithDiscountSchema, PromotionsApi, type PublicAuthConfig, type PublishedStoreTheme, type QuantitiesResponse, RENDER_PREFIX, RESOURCE_REFERENCE_TYPES, RULE_FIELDS, type RatingValue, RedirectsApi, type RegisterPayload, type RequestOptions, type ResetPasswordPayload, type ResetResult, type ResizeMode, type ResolvedAsset, type ResolvedBlogPostRef, type ResolvedCollectionRef, type ResolvedImage, type ResolvedMetaobjectRef, type ResolvedMetaobjectStub, type ResolvedPageRef, type ResolvedProductRef, type ResolvedVariantRef, type ReviewInvitationPublicData, type ReviewStatus, ReviewsApi, type RichTextBlock, type RichTextHeading, type RichTextInline, type RichTextLink, type RichTextList, type RichTextListItem, type RichTextNode, type RichTextParagraph, type RichTextRoot, type RichTextText, type RuleField, type RuleFieldSpec, type RuleOperator, type RuleOperatorSpec, type RuleValueKind, SHIPMENT_STATUSES, SHIPPING_CONDITION_TYPES, SHIPPING_DELIVERY_TYPES, SHIPPING_ERROR_CODES, SHIPPING_RATE_TYPES, SearchApi, type SearchCategory, type SearchProduct, type SentResult, type SeoMetadata$3 as SeoMetadata, type ServerComputedOrderAmounts, type SetQuantitiesRequest, type SetQuantitiesResponse, type ShipmentStatus, ShippingApi, type ShippingCalculationRequest, type ShippingConditionType, type ShippingDeliveryType, type ShippingOption, type ShippingQuoteChangedDetails, type ShippingRate, type ShippingRateType, type ShippingStatus, type ShippingZone, type SingleEntityApiFunction, type StaleQuantity, type Store, type StoreByDomainInfo, type StoreConfig, type StoreConfigurationInfo, type StoreEmailBrandingSettings, type StoreMenu, type StoreMenuItem, type PaymentMethod as StorePaymentMethod, type StoreSettings, type StoreStatus, type StoreWithRelations, type StorefrontMetafield, type StorefrontMetafields, type StorefrontMetaobjectEntry, StoresApi, type SubmitReviewInvitationPayload, THEME_HEX_COLOR, type ThemeDisplayItem, type ThemeMigration, type ThemeMigrationReport, type ThemeMigrationStep, type ThemeSchema, type ThemeSchemaGroup, type ThemeSchemaItem, type ThemeSetting, type ThemeSettingType, type ThemeSettingsOf, type ThemeValue, type ThemeValueError, type ThemeValues, type ThemeVisibleIf, ThemesApi, type Timestamp, type TocItem, type TokenStorage, UNAVAILABLE_STATES, type UnavailableState, type UpdateAddressDto, type UpdateBlogCategory, type UpdateBlogComment, type UpdateBlogPost, type UpdateBlogSettings, type UpdateBlogTag, type UpdateCartItemRequest, type UpdateCategory, type UpdateContentPage, type UpdateEmbeddedScript, type UpdateOrder, type UpdateOrderItem, type UpdateProduct, type UpdateProductReview, type UpdateProductReviewReply, type UpdateProductVariant, type UpdatePromotion, UpdatePromotionSchema, type UpdateStore, type UpdateStoreConfig, type UpdateStoreSettings, type UpdateVariantOption, type UpdateVariantOptionValue, type UpsertCustomerForAuthPayload, type UrlRedirect, VALIDATION_KEYS, type ValidatePromotionCodeRequest, type ValidatePromotionCodeResponse, type VariantOption, type VariantOptionValue, type VariantStatus, type VerifiedResult, type VerifyOtpPayload, type WithMetafields, type WithSeoMetadata$3 as WithSeoMetadata, allowedCustomerAccess, allowedFileKinds, allowedValuesFor, appliedPromotionSchema, applyThemeMigration, assetBaseUrl, attributeLinkSchema, attributeLinkValueSchema, baseDeleteOptionsSchema, baseDeleteResultSchema, baseQueryParamsSchema, baseTypeOf, blogCategorySchema, blogCommentSchema, blogCommentWithRepliesSchema, blogPostCategorySchema, blogPostSchema, blogPostStatusSchema, blogPostTagSchema, blogPostWithRelationsSchema, blogSettingsSchema, blogTagSchema, buildTransformQuery, categorySchema, categoryTreeSchema, categoryWithChildrenSchema, checkMetaobjectFieldChanges, colorSchema, compareDecimal, contentPageSchema, createAuthAwareHttpClient, createBlogCategorySchema, createBlogCommentSchema, createBlogPostSchema, createBlogSettingsSchema, createBlogTagSchema, createCategorySchema, createContentPageSchema, createEcomwebSdk, createEmbeddedScriptSchema, createOrderItemSchema, createOrderSchema, createProductReviewReplySchema, createProductReviewSchema, createProductSchema, createProductVariantSchema, createStoreConfigSchema, createStoreSchema, createStoreSettingsSchema, createVariantOptionSchema, createVariantOptionValueSchema, customerOrderSummarySchema, decimalSchema, deletedAtSchema, dimensionsSchema, emailBrandingSchema, emailBrandingShape, emailSchema, embeddedScriptPlacementSchema, embeddedScriptSchema, ensureSuccess, entryDisplayName, fromObjectPublicUrlToRender, fulfillmentStatusSchema, idSchema, integrationStatusSchema, inventoryStatusSchema, isBlankValue, isBlankValueFor, isEditableStatus, isListType, isMetafieldType, isPublishableStatus, isRuleField, isSafeRegex, isSettingVisible, isUnpublishedStatus, isValidEntryHandle, jsonSchema, legacyOrderStatusSchema, legacyProductStatusSchema, legalLinksSchema, measurementInBaseUnit, messageOutboxStatusSchema, metafieldIdentifier, moneySchema, normalizeDate, normalizeDateTime, normalizeDecimal, normalizeId, onHand, operatorsForField, optionalTimestampSchema, optionalUrlSchema, orderItemSchema, orderSchema, orderStatusSchema, orderWithItemsSchema, paginatedResponseSchema, paginationMetaSchema, paginationSchema, parseMetafieldIdentifier, parseStorageUrl, parseThemeMigration, parseThemeSchema, paymentMethodSchema, paymentStatusSchema, phoneSchema, positionOrderSchema, productReviewFiltersSchema, productReviewReplyFiltersSchema, productReviewReplySchema, productReviewSchema, productReviewStatsSchema, productReviewWithRepliesSchema, productSchema, productStatusSchema, productVariantCombinationEntrySchema, productVariantCombinationSchema, productVariantSchema, productVariantWithCombinationsSchema, productWithReviewStatsSchema, productWithVariantsAndReviewStatsSchema, productWithVariantsSchema, resolveAssetUrl, resolveThemeSettings, reviewStatusSchema, rewriteSupabaseUrl, richTextLength, safeParseBaseQueryParams, safeParsePaginationMeta, shippingStatusSchema, slugSchema, sortOrderSchema, storeConfigSchema, storeIdSchema, storeSchema, storeSettingsSchema, storeStatusSchema, storeWithRelationsSchema, storefrontAccessAllowed, strictUrlSchema, themeDefaults, themeMajor, themeMigrationSchema, themeSchemaSchema, themeSettings, timestampSchema, toEntryHandle, toMetafieldKey, toObjectUrl, toRenderUrl, tocItemSchema, transformationsEnabled, unavailable, unwrap, unwrapOrNull, updateBlogCategorySchema, updateBlogCommentSchema, updateBlogPostSchema, updateBlogSettingsSchema, updateBlogTagSchema, updateCategorySchema, updateContentPageSchema, updateEmbeddedScriptSchema, updateOrderItemSchema, updateOrderSchema, updateProductReviewReplySchema, updateProductReviewSchema, updateProductSchema, updateProductVariantSchema, updateStoreConfigSchema, updateStoreSchema, updateStoreSettingsSchema, updateVariantOptionSchema, updateVariantOptionValueSchema, urlSchema, uuidSchema, validateMetafieldDefinition, validateMetafieldValue, validateMetaobjectDefinition, validateMetaobjectEntry, validatePaginationMeta, validateRichText, validateThemeValues, validateValidations, valueKindFor, variantOptionSchema, variantOptionValueSchema, variantStatusSchema };
|
|
5369
|
+
export { ADJUSTABLE_STATES, ADMIN_ORDER_SOURCES, type AddToCartRequest, type Address, AddressesApi, type AdjustQuantitiesRequest, type AdjustableState, type AdminOrderSource, ApiClientError, type ApiError, type ApiResponse, type AppliedPromotion, type AttributeLink, AuthApi, type AuthErrorCode, type AuthIdentity, type AuthResult, type AuthTokens, type AutocompleteParams, type BankAccount, type BaseDeleteOptions, type BaseDeleteResult, type BaseQueryParams, type BatchOrderReviewInvitationsResult, BlogApi, type BlogCategory, type BlogCategoryQueryParams, type BlogComment, type BlogCommentWithReplies, type BlogPost, type BlogPostCategory, type BlogPostQueryParams, type BlogPostStatus, type BlogPostTag, type BlogPostWithRelations, type BlogSearchParams, type BlogSearchResponse, type BlogSettings, type BlogTag, type BlogTagQueryParams, CLIENT_HEADER, COLLECTION_RULE_MATRIX, CONDITION_TYPE_LABELS, CartApi, type CartApiItem, type CartApiResponse, CategoriesApi, type Category, type CategoryQueryParams, type CategorySearchResponse, type CategoryTree, type CategoryWithChildren, type ChangeEmailPayload, type ChangeEmailResult, type ChangePasswordPayload, type ChangedResult, type Collection, type CollectionQueryParams, type CollectionRule, type CollectionRuleSet, type CollectionRuleSetCriteria, type CollectionSearchCriteria, CollectionsApi, ConditionType, ConditionTypeSchema, type ConditionTypeType, type ContentPage, ContentPagesApi, type CreateAddressDto, type CreateBlogCategory, type CreateBlogComment, type CreateBlogPost, type CreateBlogSettings, type CreateBlogTag, type CreateCategory, type CreateContentPage, type CreateEmbeddedScript, type CreateOrder, type CreateOrderItem, type CreateOrderItemRequest, type CreateOrderRequest, type CreateProduct, type CreateProductReview, type CreateProductReviewReply, type CreateProductVariant, type CreatePromotion, CreatePromotionSchema, type CreateStore, type CreateStoreConfig, type CreateStoreSettings, type CreateVariantOption, type CreateVariantOptionValue, type CurrentIdentity, type Customer, type CustomerAccess, type CustomerOrderFilter, type CustomerOrderSummary, CustomersApi, DEFAULT_BUCKET, DISCOUNT_METHOD_LABELS, type DeleteApiFunction, type DeletedAt, DiscountMethod, DiscountMethodSchema, type DiscountMethodType, EMAIL_COLOR_PATTERN, EMAIL_PALETTE_DEFAULTS, ENTRY_HANDLE_PATTERN, type EcomwebSdk, type EcomwebSdkOptions, type EmbeddedScript, type EmbeddedScriptPlacement, type EngineResult, FILTERABLE_TYPES, type FileKind, type FulfillmentStatus, type GoogleAuthUrl, type GuestOrderLookupParams, type IHttpClient, INVENTORY_ADJUSTMENT_REASONS, INVENTORY_ERROR_CODES, INVENTORY_POLICIES, INVENTORY_STATES, INVENTORY_STATUS_LABELS, type Id, type ImageFormat, type ImageTransformOptions, type InitiatePaymentResult, type InsufficientInventoryItem, type IntegrationStatus, type InventoryActor, type InventoryAdjustmentReason, type InventoryErrorCode, type InventoryHistoryEntry, type InventoryImportResponse, type InventoryLevelRow, type InventoryLocation, type InventoryPolicy, type InventoryQuantities, type InventoryState, InventoryStatus, KNOWN_PAYMENT_METHODS, LEGACY_STATUS_MIGRATION_MAP, LEVEL_PROVINCE, LEVEL_WARD, type LegacyOrderStatus, type LegacyProductStatus, type LinkValue, type LocationArea, type LocationAreaQuery, type LocationAreasResponse, type LoginPayload, MAX_RULES_PER_SET, MAX_RULE_VALUE_ENTRIES, MEASUREMENT_UNITS, MEDIA_TYPES, MERCHANT_ADJUSTMENT_REASONS, METAFIELD_BASE_TYPES, METAFIELD_KEY_PATTERN, METAFIELD_LIMITS, METAFIELD_OWNER_TYPES, METAFIELD_TYPE_GROUPS, METAOBJECT_REFERENCE_TYPES, METAOBJECT_TYPE_PATTERN, type MeasurementType, type MeasurementValue, MemoryTokenStorage, MenusApi, type MerchantAdjustmentReason, type MessageOutboxStatus, type MetafieldBaseType, type MetafieldBound, type MetafieldContext, type MetafieldDefinitionShape, type MetafieldIssue, type MetafieldIssueCode, type MetafieldListType, type MetafieldOwnerType, type MetafieldType, type MetafieldTypeGroup, type MetafieldValidationKey, type MetafieldValidations, type MetafieldWrite, type MetaobjectDefinitionShape, type MetaobjectFieldShape, type MetaobjectListParams, type MetaobjectListResult, MetaobjectsApi, type MoneyValue, type MoveQuantitiesRequest, type MutationApiFunction, OBJECT_PREFIX, ORDER_ACTOR_TYPES, ORDER_EVENT_TYPES, ORDER_SHIPMENT_ERROR_CODES, ORDER_SOURCES, type OptionalTimestamp, type Order, type OrderActorType, type OrderCommentMutationResult, type OrderCreatedBy, type OrderEventType, type OrderItem, type PaymentMethod$1 as OrderPaymentMethod, type OrderReviewInvitationSummary, type OrderShipmentEvent, type OrderShipmentSummary, type OrderSource, type OrderStatus, type OrderTimelineActor, type OrderTimelineComment, type OrderTimelineCommentAuthor, type OrderTimelineEntry, type OrderTimelineEvent, type OrderTimelineResponse, type OrderWithItems, OrdersApi, PAGINATION_DEFAULTS, PRIVATE_REFERENCE_TYPES, PRODUCT_STATUS_LABELS, PROMOTION_MODE_COLORS, PROMOTION_MODE_LABELS, PROMOTION_STATUS_COLORS, PROMOTION_STATUS_LABELS, PROMOTION_TYPE_COLORS, PROMOTION_TYPE_LABELS, type PaginatedApiFunction, type PaginatedPromotionsResponse, PaginatedPromotionsResponseSchema, type PaginatedResponse, type PaginatedReviewsResponse, type PaginationMeta, type PasswordPolicy, type PaymentCredentialStatus, type PaymentMethod$1 as PaymentMethod, PaymentMethodsApi, type PaymentStateResult, type PaymentStatus, PaymentsApi, type Product, type ProductDetail, type ProductImage, type ProductQueryParams, type ProductReview, type ProductReviewFilters, type ProductReviewReply, type ProductReviewReplyFilters, type ProductReviewStats, type ProductReviewWithReplies, type ProductSearchParams, type ProductSearchResponse, type ProductService, ProductStatus, type ProductVariant, type ProductVariantCombination, type ProductVariantCombinationEntry, type ProductVariantWithCombinations, type ProductVideo, type ProductWithReviewStats, type ProductWithVariants, ProductsApi, type Promotion, type PromotionData, PromotionMode, PromotionModeSchema, type PromotionModeType, type PromotionQueryParams, PromotionQueryParamsSchema, PromotionSchema, type PromotionStatistics, PromotionStatisticsSchema, PromotionStatus, PromotionStatusSchema, type PromotionStatusType, type PromotionSuggestion, type PromotionSuggestionsResponse, PromotionType, PromotionTypeSchema, type PromotionTypeType, type PromotionWithDiscount, PromotionWithDiscountSchema, PromotionsApi, type PublicAuthConfig, type PublishedStoreTheme, type QuantitiesResponse, RENDER_PREFIX, RESOURCE_REFERENCE_TYPES, RULE_FIELDS, type RatingValue, RedirectsApi, type RegisterPayload, type RegisterResult, type RequestOptions, type ResetPasswordPayload, type ResetResult, type ResizeMode, type ResolvedAsset, type ResolvedBlogPostRef, type ResolvedCollectionRef, type ResolvedImage, type ResolvedMetaobjectRef, type ResolvedMetaobjectStub, type ResolvedPageRef, type ResolvedProductRef, type ResolvedVariantRef, type ReviewInvitationPublicData, type ReviewStatus, ReviewsApi, type RichTextBlock, type RichTextHeading, type RichTextInline, type RichTextLink, type RichTextList, type RichTextListItem, type RichTextNode, type RichTextParagraph, type RichTextRoot, type RichTextText, type RuleField, type RuleFieldSpec, type RuleOperator, type RuleOperatorSpec, type RuleValueKind, SDK_CLIENT_TOKEN, SDK_VERSION, SHIPMENT_STATUSES, SHIPPING_CONDITION_TYPES, SHIPPING_DELIVERY_TYPES, SHIPPING_ERROR_CODES, SHIPPING_RATE_TYPES, SearchApi, type SearchCategory, type SearchProduct, type SentResult, type SeoMetadata$3 as SeoMetadata, type ServerComputedOrderAmounts, type SetQuantitiesRequest, type SetQuantitiesResponse, type ShipmentStatus, ShippingApi, type ShippingCalculationRequest, type ShippingConditionType, type ShippingDeliveryType, type ShippingOption, type ShippingQuoteChangedDetails, type ShippingRate, type ShippingRateType, type ShippingStatus, type ShippingZone, type SingleEntityApiFunction, type StaleQuantity, type Store, type StoreByDomainInfo, type StoreConfig, type StoreConfigurationInfo, type StoreEmailBrandingSettings, type StoreMenu, type StoreMenuItem, type PaymentMethod as StorePaymentMethod, type StoreSettings, type StoreStatus, type StoreWithRelations, type StorefrontMetafield, type StorefrontMetafields, type StorefrontMetaobjectEntry, StoresApi, type SubmitReviewInvitationPayload, THEME_HEX_COLOR, type ThemeDisplayItem, type ThemeMigration, type ThemeMigrationReport, type ThemeMigrationStep, type ThemeSchema, type ThemeSchemaGroup, type ThemeSchemaItem, type ThemeSetting, type ThemeSettingType, type ThemeSettingsOf, type ThemeValue, type ThemeValueError, type ThemeValues, type ThemeVisibleIf, ThemesApi, type Timestamp, type TocItem, type TokenStorage, UNAVAILABLE_STATES, type UnavailableState, type UpdateAddressDto, type UpdateBlogCategory, type UpdateBlogComment, type UpdateBlogPost, type UpdateBlogSettings, type UpdateBlogTag, type UpdateCartItemRequest, type UpdateCategory, type UpdateContentPage, type UpdateEmbeddedScript, type UpdateOrder, type UpdateOrderItem, type UpdateProduct, type UpdateProductReview, type UpdateProductReviewReply, type UpdateProductVariant, type UpdatePromotion, UpdatePromotionSchema, type UpdateStore, type UpdateStoreConfig, type UpdateStoreSettings, type UpdateVariantOption, type UpdateVariantOptionValue, type UpsertCustomerForAuthPayload, type UrlRedirect, VALIDATION_KEYS, type ValidatePromotionCodeRequest, type ValidatePromotionCodeResponse, type VariantOption, type VariantOptionValue, type VariantStatus, type VerifiedResult, type VerifyOtpPayload, type WithMetafields, type WithSeoMetadata$3 as WithSeoMetadata, allowedCustomerAccess, allowedFileKinds, allowedValuesFor, appliedPromotionSchema, applyThemeMigration, assetBaseUrl, attributeLinkSchema, attributeLinkValueSchema, baseDeleteOptionsSchema, baseDeleteResultSchema, baseQueryParamsSchema, baseTypeOf, blogCategorySchema, blogCommentSchema, blogCommentWithRepliesSchema, blogPostCategorySchema, blogPostSchema, blogPostStatusSchema, blogPostTagSchema, blogPostWithRelationsSchema, blogSettingsSchema, blogTagSchema, buildTransformQuery, categorySchema, categoryTreeSchema, categoryWithChildrenSchema, checkMetaobjectFieldChanges, clientHeaderValue, colorSchema, compareDecimal, contentPageSchema, createAuthAwareHttpClient, createBlogCategorySchema, createBlogCommentSchema, createBlogPostSchema, createBlogSettingsSchema, createBlogTagSchema, createCategorySchema, createContentPageSchema, createEcomwebSdk, createEmbeddedScriptSchema, createOrderItemSchema, createOrderSchema, createProductReviewReplySchema, createProductReviewSchema, createProductSchema, createProductVariantSchema, createStoreConfigSchema, createStoreSchema, createStoreSettingsSchema, createVariantOptionSchema, createVariantOptionValueSchema, customerOrderSummarySchema, decimalSchema, deletedAtSchema, dimensionsSchema, emailBrandingSchema, emailBrandingShape, emailSchema, embeddedScriptPlacementSchema, embeddedScriptSchema, ensureSuccess, entryDisplayName, fromObjectPublicUrlToRender, fulfillmentStatusSchema, idSchema, integrationStatusSchema, inventoryStatusSchema, isBlankValue, isBlankValueFor, isEditableStatus, isListType, isMetafieldType, isPublishableStatus, isRuleField, isSafeRegex, isSettingVisible, isUnpublishedStatus, isValidEntryHandle, jsonSchema, legacyOrderStatusSchema, legacyProductStatusSchema, legalLinksSchema, measurementInBaseUnit, messageOutboxStatusSchema, metafieldIdentifier, moneySchema, normalizeDate, normalizeDateTime, normalizeDecimal, normalizeId, onHand, operatorsForField, optionalTimestampSchema, optionalUrlSchema, orderItemSchema, orderSchema, orderStatusSchema, orderWithItemsSchema, paginatedResponseSchema, paginationMetaSchema, paginationSchema, parseMetafieldIdentifier, parseStorageUrl, parseThemeMigration, parseThemeSchema, paymentMethodSchema, paymentStatusSchema, phoneSchema, positionOrderSchema, productReviewFiltersSchema, productReviewReplyFiltersSchema, productReviewReplySchema, productReviewSchema, productReviewStatsSchema, productReviewWithRepliesSchema, productSchema, productStatusSchema, productVariantCombinationEntrySchema, productVariantCombinationSchema, productVariantSchema, productVariantWithCombinationsSchema, productWithReviewStatsSchema, productWithVariantsAndReviewStatsSchema, productWithVariantsSchema, resolveAssetUrl, resolveThemeSettings, reviewStatusSchema, rewriteSupabaseUrl, richTextLength, safeParseBaseQueryParams, safeParsePaginationMeta, shippingStatusSchema, slugSchema, sortOrderSchema, storeConfigSchema, storeIdSchema, storeSchema, storeSettingsSchema, storeStatusSchema, storeWithRelationsSchema, storefrontAccessAllowed, strictUrlSchema, themeDefaults, themeMajor, themeMigrationSchema, themeSchemaSchema, themeSettings, timestampSchema, toEntryHandle, toMetafieldKey, toObjectUrl, toRenderUrl, tocItemSchema, transformationsEnabled, unavailable, unwrap, unwrapOrNull, updateBlogCategorySchema, updateBlogCommentSchema, updateBlogPostSchema, updateBlogSettingsSchema, updateBlogTagSchema, updateCategorySchema, updateContentPageSchema, updateEmbeddedScriptSchema, updateOrderItemSchema, updateOrderSchema, updateProductReviewReplySchema, updateProductReviewSchema, updateProductSchema, updateProductVariantSchema, updateStoreConfigSchema, updateStoreSchema, updateStoreSettingsSchema, updateVariantOptionSchema, updateVariantOptionValueSchema, urlSchema, uuidSchema, validateMetafieldDefinition, validateMetafieldValue, validateMetaobjectDefinition, validateMetaobjectEntry, validatePaginationMeta, validateRichText, validateThemeValues, validateValidations, valueKindFor, variantOptionSchema, variantOptionValueSchema, variantStatusSchema, withClientHeader };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
// src/core/client-info.ts
|
|
2
|
+
var SDK_VERSION = true ? "0.14.0" : "dev";
|
|
3
|
+
var CLIENT_HEADER = "X-Ecomweb-Client";
|
|
4
|
+
var SDK_CLIENT_TOKEN = `@ecomweb/sdk/${SDK_VERSION}`;
|
|
5
|
+
function clientHeaderValue(clientInfo) {
|
|
6
|
+
const prefix = clientInfo?.trim();
|
|
7
|
+
return prefix ? `${prefix} ${SDK_CLIENT_TOKEN}` : SDK_CLIENT_TOKEN;
|
|
8
|
+
}
|
|
9
|
+
var WRAPPED = /* @__PURE__ */ Symbol.for("ecomweb.sdk.clientHeader");
|
|
10
|
+
function withHeader(options, value) {
|
|
11
|
+
const headers = options?.headers ?? {};
|
|
12
|
+
const present2 = Object.keys(headers).some(
|
|
13
|
+
(name) => name.toLowerCase() === CLIENT_HEADER.toLowerCase()
|
|
14
|
+
);
|
|
15
|
+
return {
|
|
16
|
+
...options,
|
|
17
|
+
headers: present2 ? headers : { [CLIENT_HEADER]: value, ...headers }
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function withClientHeader(http, clientInfo) {
|
|
21
|
+
if (http[WRAPPED]) return http;
|
|
22
|
+
const value = clientHeaderValue(clientInfo);
|
|
23
|
+
const wrapped = {
|
|
24
|
+
[WRAPPED]: true,
|
|
25
|
+
get: (url, options) => http.get(url, withHeader(options, value)),
|
|
26
|
+
post: (url, data, options) => http.post(url, data, withHeader(options, value)),
|
|
27
|
+
put: (url, data, options) => http.put(url, data, withHeader(options, value)),
|
|
28
|
+
patch: (url, data, options) => http.patch(url, data, withHeader(options, value)),
|
|
29
|
+
delete: (url, options) => http.delete(url, withHeader(options, value))
|
|
30
|
+
};
|
|
31
|
+
return wrapped;
|
|
32
|
+
}
|
|
33
|
+
|
|
1
34
|
// src/core/response.ts
|
|
2
35
|
var ApiClientError = class extends Error {
|
|
3
36
|
constructor(message, statusCode = 0, code, details) {
|
|
@@ -1159,7 +1192,8 @@ var blogCommentSchema = z12.object({
|
|
|
1159
1192
|
blog_post_id: idSchema.optional().nullable(),
|
|
1160
1193
|
parent_comment_id: idSchema.optional().nullable(),
|
|
1161
1194
|
author_name: z12.string().min(1).max(100),
|
|
1162
|
-
|
|
1195
|
+
// Optional on reads: the public comment list no longer returns it.
|
|
1196
|
+
author_email: emailSchema.optional(),
|
|
1163
1197
|
author_website: z12.url().max(255).optional().nullable(),
|
|
1164
1198
|
content: z12.string().min(1),
|
|
1165
1199
|
is_approved: z12.boolean().default(false),
|
|
@@ -1205,7 +1239,7 @@ var createBlogPostSchema = blogPostSchema.omit({
|
|
|
1205
1239
|
var createBlogCommentSchema = blogCommentSchema.omit({
|
|
1206
1240
|
id: true,
|
|
1207
1241
|
created_at: true
|
|
1208
|
-
});
|
|
1242
|
+
}).extend({ author_email: emailSchema });
|
|
1209
1243
|
var createBlogSettingsSchema = blogSettingsSchema.omit({
|
|
1210
1244
|
id: true,
|
|
1211
1245
|
created_at: true,
|
|
@@ -3610,10 +3644,15 @@ var AuthApi = class {
|
|
|
3610
3644
|
void 0
|
|
3611
3645
|
);
|
|
3612
3646
|
}
|
|
3613
|
-
|
|
3647
|
+
/**
|
|
3648
|
+
* `binding` is the register response's `verification_binding`, when this
|
|
3649
|
+
* client still has it. Omitted, the address is verified but the password
|
|
3650
|
+
* set at registration is dropped.
|
|
3651
|
+
*/
|
|
3652
|
+
async verifyEmail(token, binding) {
|
|
3614
3653
|
return this.http.post(
|
|
3615
3654
|
this.publicPath("verify-email"),
|
|
3616
|
-
{ token },
|
|
3655
|
+
binding ? { token, binding } : { token },
|
|
3617
3656
|
void 0
|
|
3618
3657
|
);
|
|
3619
3658
|
}
|
|
@@ -3638,10 +3677,11 @@ var AuthApi = class {
|
|
|
3638
3677
|
void 0
|
|
3639
3678
|
);
|
|
3640
3679
|
}
|
|
3641
|
-
|
|
3680
|
+
/** `binding` is the change-email response's `confirmation_binding`. */
|
|
3681
|
+
async confirmEmailChange(token, binding) {
|
|
3642
3682
|
return this.http.post(
|
|
3643
3683
|
this.publicPath("change-email/confirm"),
|
|
3644
|
-
{ token },
|
|
3684
|
+
binding ? { token, binding } : { token },
|
|
3645
3685
|
void 0
|
|
3646
3686
|
);
|
|
3647
3687
|
}
|
|
@@ -3932,7 +3972,8 @@ var SHIPPING_ERROR_CODES = {
|
|
|
3932
3972
|
|
|
3933
3973
|
// src/index.ts
|
|
3934
3974
|
function createEcomwebSdk(options) {
|
|
3935
|
-
const
|
|
3975
|
+
const publicHttp = withClientHeader(options.publicHttp, options.clientInfo);
|
|
3976
|
+
const authHttp = withClientHeader(options.authHttp, options.clientInfo);
|
|
3936
3977
|
return {
|
|
3937
3978
|
products: new ProductsApi(publicHttp),
|
|
3938
3979
|
collections: new CollectionsApi(publicHttp),
|
|
@@ -3963,6 +4004,7 @@ export {
|
|
|
3963
4004
|
ApiClientError,
|
|
3964
4005
|
AuthApi,
|
|
3965
4006
|
BlogApi,
|
|
4007
|
+
CLIENT_HEADER,
|
|
3966
4008
|
COLLECTION_RULE_MATRIX,
|
|
3967
4009
|
CONDITION_TYPE_LABELS,
|
|
3968
4010
|
CartApi,
|
|
@@ -4042,6 +4084,8 @@ export {
|
|
|
4042
4084
|
RULE_FIELDS,
|
|
4043
4085
|
RedirectsApi,
|
|
4044
4086
|
ReviewsApi,
|
|
4087
|
+
SDK_CLIENT_TOKEN,
|
|
4088
|
+
SDK_VERSION,
|
|
4045
4089
|
SHIPMENT_STATUSES,
|
|
4046
4090
|
SHIPPING_CONDITION_TYPES,
|
|
4047
4091
|
SHIPPING_DELIVERY_TYPES,
|
|
@@ -4082,6 +4126,7 @@ export {
|
|
|
4082
4126
|
categoryTreeSchema,
|
|
4083
4127
|
categoryWithChildrenSchema,
|
|
4084
4128
|
checkMetaobjectFieldChanges,
|
|
4129
|
+
clientHeaderValue,
|
|
4085
4130
|
colorSchema,
|
|
4086
4131
|
compareDecimal,
|
|
4087
4132
|
contentPageSchema,
|
|
@@ -4244,6 +4289,7 @@ export {
|
|
|
4244
4289
|
valueKindFor,
|
|
4245
4290
|
variantOptionSchema,
|
|
4246
4291
|
variantOptionValueSchema,
|
|
4247
|
-
variantStatusSchema
|
|
4292
|
+
variantStatusSchema,
|
|
4293
|
+
withClientHeader
|
|
4248
4294
|
};
|
|
4249
4295
|
//# sourceMappingURL=index.js.map
|