@shoppexio/storefront 1.0.89 → 1.0.91
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/CHANGELOG.md +24 -0
- package/dist/{chunk-ROQI7BO6.js → chunk-UW6DFRB5.js} +90 -424
- package/dist/chunk-UW6DFRB5.js.map +1 -0
- package/dist/customer.cjs +268 -244
- package/dist/customer.cjs.map +1 -1
- package/dist/customer.d.cts +8 -11
- package/dist/customer.d.ts +8 -11
- package/dist/customer.js +346 -56
- package/dist/customer.js.map +1 -1
- package/dist/index.cjs +22162 -24428
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +87 -3
- package/dist/index.d.ts +87 -3
- package/dist/index.js +299 -2290
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ROQI7BO6.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createApiClient
|
|
1
|
+
import { createApiClient } from '@shoppex/contracts/api-client';
|
|
2
2
|
import { NavigationMenuSlot } from '@shoppex/contracts/navigation';
|
|
3
3
|
export { NavigationMenuSlot } from '@shoppex/contracts/navigation';
|
|
4
4
|
import * as src from 'src';
|
|
5
|
+
import { CustomerWarrantyClaimWire, CustomerPortalAffiliateCreateLinkWire, CustomerPortalDashboardWire, CustomerPortalPaginatedInvoicesWire, CustomerPortalInvoiceDetailWire, CustomerLoyaltyWire, CustomerLoyaltyRedeemWire, CustomerWarrantyListWire, CustomerPortalNotificationPreferencesWire } from '@shoppex/contracts/customer-account-wire';
|
|
5
6
|
export { CATALOG_UNIT_PRICE_DECIMAL_PLACES, CATALOG_UNIT_PRICE_FORMAT_OPTIONS, PAYABLE_AMOUNT_DECIMAL_PLACES, roundPayableAmount } from '@shoppex/contracts/catalog-unit-price';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -14,6 +15,7 @@ interface ShoppexConfig {
|
|
|
14
15
|
currency?: string;
|
|
15
16
|
apiBaseUrl?: string;
|
|
16
17
|
checkoutBaseUrl?: string;
|
|
18
|
+
preview: boolean;
|
|
17
19
|
}
|
|
18
20
|
interface ShoppexInitOptions {
|
|
19
21
|
locale?: string;
|
|
@@ -29,6 +31,14 @@ interface ShoppexInitOptions {
|
|
|
29
31
|
apiBaseUrl?: string;
|
|
30
32
|
checkoutBaseUrl?: string;
|
|
31
33
|
shopId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Set on pages that render an unpublished draft (preview links): the page
|
|
36
|
+
* has no live side effects. The cart (lines, metadata, coupon) lives in this
|
|
37
|
+
* tab's sessionStorage under `shoppex_cart_<storeSlug>_preview`-style keys,
|
|
38
|
+
* never in the buyer's localStorage cart, and the SDK sends no presence or
|
|
39
|
+
* affiliate funnel events.
|
|
40
|
+
*/
|
|
41
|
+
preview?: boolean;
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
/**
|
|
@@ -155,6 +165,12 @@ interface Shop {
|
|
|
155
165
|
feedback?: ShopFeedback;
|
|
156
166
|
trusted_checks?: TrustedChecks | null;
|
|
157
167
|
available_gateways?: string[];
|
|
168
|
+
payment_methods?: Array<{
|
|
169
|
+
id: string;
|
|
170
|
+
label: string;
|
|
171
|
+
kind: 'card' | 'wallet' | 'crypto';
|
|
172
|
+
}>;
|
|
173
|
+
stock_alerts_enabled?: boolean;
|
|
158
174
|
payment_gateways_fees?: unknown[];
|
|
159
175
|
reward_program_summary?: RewardProgramSummary | null;
|
|
160
176
|
}
|
|
@@ -221,6 +237,20 @@ interface Product {
|
|
|
221
237
|
title: string;
|
|
222
238
|
slug?: string | null;
|
|
223
239
|
description?: string | null;
|
|
240
|
+
/** One plain-text line the merchant wrote for under the title; null when unset. */
|
|
241
|
+
short_description?: string | null;
|
|
242
|
+
/** The merchant's word for one / several delivered units of a SERIALS product ("License key"); null when unset. */
|
|
243
|
+
label_singular?: string | null;
|
|
244
|
+
label_plural?: string | null;
|
|
245
|
+
/**
|
|
246
|
+
* The merchant's explicit service status for storefront `/status` pages; null
|
|
247
|
+
* when they set none (the product is then not listed there).
|
|
248
|
+
*/
|
|
249
|
+
service_status?: {
|
|
250
|
+
state: 'operational' | 'updating' | 'detected' | 'offline';
|
|
251
|
+
note: string | null;
|
|
252
|
+
updated_at: string;
|
|
253
|
+
} | null;
|
|
224
254
|
/** Merchant-defined description tabs; present when the shop configured them. */
|
|
225
255
|
description_tabs?: ProductDescriptionTab[];
|
|
226
256
|
product_highlights?: string[];
|
|
@@ -409,6 +439,8 @@ interface PriceVariant {
|
|
|
409
439
|
id: string;
|
|
410
440
|
label?: string;
|
|
411
441
|
title?: string;
|
|
442
|
+
/** The merchant's one-line note on this option ("1 seat"); absent when unset. */
|
|
443
|
+
description?: string;
|
|
412
444
|
price: number;
|
|
413
445
|
/**
|
|
414
446
|
* RAW local stock for this price variant only. `-1` (or any negative value)
|
|
@@ -571,7 +603,7 @@ interface BuyerRewards {
|
|
|
571
603
|
lifetime_earned: string;
|
|
572
604
|
redeemed: string | null;
|
|
573
605
|
currency: string;
|
|
574
|
-
};
|
|
606
|
+
} | null;
|
|
575
607
|
activity: BuyerRewardActivityItem[];
|
|
576
608
|
earned_after_invoice: BuyerRewardActivityItem[];
|
|
577
609
|
pending_after_invoice: BuyerRewardActivityItem[];
|
|
@@ -1043,6 +1075,12 @@ interface CartQuote {
|
|
|
1043
1075
|
* signing secret configured; absent on older backends.
|
|
1044
1076
|
*/
|
|
1045
1077
|
quote_token?: string | null;
|
|
1078
|
+
/**
|
|
1079
|
+
* True when the cart holds a physical product. Shipping is priced at
|
|
1080
|
+
* checkout from the buyer's address, so `total` excludes it; show
|
|
1081
|
+
* "shipping calculated at checkout" next to the total.
|
|
1082
|
+
*/
|
|
1083
|
+
requires_shipping: boolean;
|
|
1046
1084
|
coupon_applied: boolean;
|
|
1047
1085
|
coupon_source: CartCodeSource | null;
|
|
1048
1086
|
coupon_discount_order_type: 'TOTAL' | 'PAYMENT_FEES' | null;
|
|
@@ -1759,6 +1797,24 @@ interface CustomerEmailPreferencesPatch {
|
|
|
1759
1797
|
subscribed: boolean;
|
|
1760
1798
|
}>;
|
|
1761
1799
|
}
|
|
1800
|
+
/** Which order mails the buyer receives. A key left out is left as it is. */
|
|
1801
|
+
interface CustomerNotificationPreferencesPatch {
|
|
1802
|
+
order_created_emails?: boolean;
|
|
1803
|
+
order_completed_emails?: boolean;
|
|
1804
|
+
payment_issue_emails?: boolean;
|
|
1805
|
+
}
|
|
1806
|
+
interface CustomerAffiliateLinkInput {
|
|
1807
|
+
code: string;
|
|
1808
|
+
label: string;
|
|
1809
|
+
/** Asking for a rate of one's own sends the link to the shop for approval. */
|
|
1810
|
+
requested_affiliate_revenue_percent?: number;
|
|
1811
|
+
requested_affiliate_customer_discount_percent?: number;
|
|
1812
|
+
}
|
|
1813
|
+
interface CustomerInvoicePdf {
|
|
1814
|
+
blob: Blob;
|
|
1815
|
+
/** From the producer's `Content-Disposition`; null when it named none. */
|
|
1816
|
+
filename: string | null;
|
|
1817
|
+
}
|
|
1762
1818
|
/** One basket line for a QUOTE. `variant_id` is omitted, never null, when a product has no variants. */
|
|
1763
1819
|
interface ResellerOrderItem {
|
|
1764
1820
|
product_id: string;
|
|
@@ -1798,6 +1854,14 @@ declare function dashboard(): Promise<SDKResponse<CustomerPortalDashboardWire>>;
|
|
|
1798
1854
|
*/
|
|
1799
1855
|
declare function orders(options?: CustomerOrdersQuery): Promise<SDKResponse<CustomerPortalPaginatedInvoicesWire>>;
|
|
1800
1856
|
declare function order(id: string): Promise<SDKResponse<CustomerPortalInvoiceDetailWire>>;
|
|
1857
|
+
/**
|
|
1858
|
+
* The invoice as a PDF, for the buyer to save.
|
|
1859
|
+
*
|
|
1860
|
+
* A file, not the JSON envelope, so it does not go through `requestCustomer`.
|
|
1861
|
+
* Anything but a PDF on a 2xx is a contract failure rather than a download: a
|
|
1862
|
+
* proxy's HTML error page saved as `invoice.pdf` is a file that will not open.
|
|
1863
|
+
*/
|
|
1864
|
+
declare function invoicePdf(id: string): Promise<SDKResponse<CustomerInvoicePdf>>;
|
|
1801
1865
|
declare function loyalty(): Promise<SDKResponse<CustomerLoyaltyWire>>;
|
|
1802
1866
|
declare function redeemLoyaltyPoints(input: {
|
|
1803
1867
|
points: number;
|
|
@@ -1824,6 +1888,15 @@ declare function addFavorite(productUniqid: string): Promise<SDKResponse<unknown
|
|
|
1824
1888
|
declare function removeFavorite(productUniqid: string): Promise<SDKResponse<unknown>>;
|
|
1825
1889
|
declare function affiliate(): Promise<SDKResponse<unknown>>;
|
|
1826
1890
|
declare function affiliateStats(days?: number): Promise<SDKResponse<unknown>>;
|
|
1891
|
+
/**
|
|
1892
|
+
* A referral link with a code of the buyer's choosing.
|
|
1893
|
+
*
|
|
1894
|
+
* `status` in the answer is `pending` when the shop approves links first, or
|
|
1895
|
+
* when the link asks for rates of its own. Nothing here pays out, converts or
|
|
1896
|
+
* shares a commission: those decide where earned money goes and are not
|
|
1897
|
+
* reachable from a storefront.
|
|
1898
|
+
*/
|
|
1899
|
+
declare function createAffiliateLink(input: CustomerAffiliateLinkInput): Promise<SDKResponse<CustomerPortalAffiliateCreateLinkWire>>;
|
|
1827
1900
|
declare function createTicket(payload: CustomerTicketPayload): Promise<SDKResponse<unknown>>;
|
|
1828
1901
|
declare function ticket(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
1829
1902
|
declare function replyToTicket(uniqid: string, message: string): Promise<SDKResponse<unknown>>;
|
|
@@ -1838,6 +1911,13 @@ declare function updateAvatar(file: File): Promise<SDKResponse<unknown>>;
|
|
|
1838
1911
|
declare function removeAvatar(): Promise<SDKResponse<unknown>>;
|
|
1839
1912
|
declare function emailPreferences(): Promise<SDKResponse<unknown>>;
|
|
1840
1913
|
declare function updateEmailPreferences(patch: CustomerEmailPreferencesPatch): Promise<SDKResponse<unknown>>;
|
|
1914
|
+
/**
|
|
1915
|
+
* Order mail, as opposed to the marketing lists above: order placed, order
|
|
1916
|
+
* completed, payment needs attention. Its own producer
|
|
1917
|
+
* (`routes/v1/customer-notifications.ts`), and it answers the saved set.
|
|
1918
|
+
*/
|
|
1919
|
+
declare function notificationPreferences(): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1920
|
+
declare function updateNotificationPreferences(patch: CustomerNotificationPreferencesPatch): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1841
1921
|
declare function sessions(): Promise<SDKResponse<unknown>>;
|
|
1842
1922
|
declare function revokeSession(id: string): Promise<SDKResponse<unknown>>;
|
|
1843
1923
|
/**
|
|
@@ -2058,6 +2138,7 @@ declare const shoppex: {
|
|
|
2058
2138
|
dashboard: typeof dashboard;
|
|
2059
2139
|
orders: typeof orders;
|
|
2060
2140
|
order: typeof order;
|
|
2141
|
+
invoicePdf: typeof invoicePdf;
|
|
2061
2142
|
loyalty: typeof loyalty;
|
|
2062
2143
|
redeemLoyaltyPoints: typeof redeemLoyaltyPoints;
|
|
2063
2144
|
warranties: typeof warranties;
|
|
@@ -2072,6 +2153,7 @@ declare const shoppex: {
|
|
|
2072
2153
|
removeFavorite: typeof removeFavorite;
|
|
2073
2154
|
affiliate: typeof affiliate;
|
|
2074
2155
|
affiliateStats: typeof affiliateStats;
|
|
2156
|
+
createAffiliateLink: typeof createAffiliateLink;
|
|
2075
2157
|
createTicket: typeof createTicket;
|
|
2076
2158
|
ticket: typeof ticket;
|
|
2077
2159
|
replyToTicket: typeof replyToTicket;
|
|
@@ -2080,6 +2162,8 @@ declare const shoppex: {
|
|
|
2080
2162
|
removeAvatar: typeof removeAvatar;
|
|
2081
2163
|
emailPreferences: typeof emailPreferences;
|
|
2082
2164
|
updateEmailPreferences: typeof updateEmailPreferences;
|
|
2165
|
+
notificationPreferences: typeof notificationPreferences;
|
|
2166
|
+
updateNotificationPreferences: typeof updateNotificationPreferences;
|
|
2083
2167
|
sessions: typeof sessions;
|
|
2084
2168
|
revokeSession: typeof revokeSession;
|
|
2085
2169
|
revokeAllSessions: typeof revokeAllSessions;
|
|
@@ -2120,4 +2204,4 @@ declare const shoppex: {
|
|
|
2120
2204
|
mergeSettings: typeof mergeSettings;
|
|
2121
2205
|
};
|
|
2122
2206
|
|
|
2123
|
-
export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerEmailPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, PRODUCT_FILTER_UNSUPPORTED, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, normalizeSearchQuery, normalizeStorefrontCustomFields, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
|
|
2207
|
+
export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerAffiliateLinkInput, type CustomerEmailPreferencesPatch, type CustomerInvoicePdf, type CustomerNotificationPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, PRODUCT_FILTER_UNSUPPORTED, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createAffiliateLink, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, invoicePdf, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, normalizeSearchQuery, normalizeStorefrontCustomFields, notificationPreferences, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateNotificationPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createApiClient
|
|
1
|
+
import { createApiClient } from '@shoppex/contracts/api-client';
|
|
2
2
|
import { NavigationMenuSlot } from '@shoppex/contracts/navigation';
|
|
3
3
|
export { NavigationMenuSlot } from '@shoppex/contracts/navigation';
|
|
4
4
|
import * as src from 'src';
|
|
5
|
+
import { CustomerWarrantyClaimWire, CustomerPortalAffiliateCreateLinkWire, CustomerPortalDashboardWire, CustomerPortalPaginatedInvoicesWire, CustomerPortalInvoiceDetailWire, CustomerLoyaltyWire, CustomerLoyaltyRedeemWire, CustomerWarrantyListWire, CustomerPortalNotificationPreferencesWire } from '@shoppex/contracts/customer-account-wire';
|
|
5
6
|
export { CATALOG_UNIT_PRICE_DECIMAL_PLACES, CATALOG_UNIT_PRICE_FORMAT_OPTIONS, PAYABLE_AMOUNT_DECIMAL_PLACES, roundPayableAmount } from '@shoppex/contracts/catalog-unit-price';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -14,6 +15,7 @@ interface ShoppexConfig {
|
|
|
14
15
|
currency?: string;
|
|
15
16
|
apiBaseUrl?: string;
|
|
16
17
|
checkoutBaseUrl?: string;
|
|
18
|
+
preview: boolean;
|
|
17
19
|
}
|
|
18
20
|
interface ShoppexInitOptions {
|
|
19
21
|
locale?: string;
|
|
@@ -29,6 +31,14 @@ interface ShoppexInitOptions {
|
|
|
29
31
|
apiBaseUrl?: string;
|
|
30
32
|
checkoutBaseUrl?: string;
|
|
31
33
|
shopId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Set on pages that render an unpublished draft (preview links): the page
|
|
36
|
+
* has no live side effects. The cart (lines, metadata, coupon) lives in this
|
|
37
|
+
* tab's sessionStorage under `shoppex_cart_<storeSlug>_preview`-style keys,
|
|
38
|
+
* never in the buyer's localStorage cart, and the SDK sends no presence or
|
|
39
|
+
* affiliate funnel events.
|
|
40
|
+
*/
|
|
41
|
+
preview?: boolean;
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
/**
|
|
@@ -155,6 +165,12 @@ interface Shop {
|
|
|
155
165
|
feedback?: ShopFeedback;
|
|
156
166
|
trusted_checks?: TrustedChecks | null;
|
|
157
167
|
available_gateways?: string[];
|
|
168
|
+
payment_methods?: Array<{
|
|
169
|
+
id: string;
|
|
170
|
+
label: string;
|
|
171
|
+
kind: 'card' | 'wallet' | 'crypto';
|
|
172
|
+
}>;
|
|
173
|
+
stock_alerts_enabled?: boolean;
|
|
158
174
|
payment_gateways_fees?: unknown[];
|
|
159
175
|
reward_program_summary?: RewardProgramSummary | null;
|
|
160
176
|
}
|
|
@@ -221,6 +237,20 @@ interface Product {
|
|
|
221
237
|
title: string;
|
|
222
238
|
slug?: string | null;
|
|
223
239
|
description?: string | null;
|
|
240
|
+
/** One plain-text line the merchant wrote for under the title; null when unset. */
|
|
241
|
+
short_description?: string | null;
|
|
242
|
+
/** The merchant's word for one / several delivered units of a SERIALS product ("License key"); null when unset. */
|
|
243
|
+
label_singular?: string | null;
|
|
244
|
+
label_plural?: string | null;
|
|
245
|
+
/**
|
|
246
|
+
* The merchant's explicit service status for storefront `/status` pages; null
|
|
247
|
+
* when they set none (the product is then not listed there).
|
|
248
|
+
*/
|
|
249
|
+
service_status?: {
|
|
250
|
+
state: 'operational' | 'updating' | 'detected' | 'offline';
|
|
251
|
+
note: string | null;
|
|
252
|
+
updated_at: string;
|
|
253
|
+
} | null;
|
|
224
254
|
/** Merchant-defined description tabs; present when the shop configured them. */
|
|
225
255
|
description_tabs?: ProductDescriptionTab[];
|
|
226
256
|
product_highlights?: string[];
|
|
@@ -409,6 +439,8 @@ interface PriceVariant {
|
|
|
409
439
|
id: string;
|
|
410
440
|
label?: string;
|
|
411
441
|
title?: string;
|
|
442
|
+
/** The merchant's one-line note on this option ("1 seat"); absent when unset. */
|
|
443
|
+
description?: string;
|
|
412
444
|
price: number;
|
|
413
445
|
/**
|
|
414
446
|
* RAW local stock for this price variant only. `-1` (or any negative value)
|
|
@@ -571,7 +603,7 @@ interface BuyerRewards {
|
|
|
571
603
|
lifetime_earned: string;
|
|
572
604
|
redeemed: string | null;
|
|
573
605
|
currency: string;
|
|
574
|
-
};
|
|
606
|
+
} | null;
|
|
575
607
|
activity: BuyerRewardActivityItem[];
|
|
576
608
|
earned_after_invoice: BuyerRewardActivityItem[];
|
|
577
609
|
pending_after_invoice: BuyerRewardActivityItem[];
|
|
@@ -1043,6 +1075,12 @@ interface CartQuote {
|
|
|
1043
1075
|
* signing secret configured; absent on older backends.
|
|
1044
1076
|
*/
|
|
1045
1077
|
quote_token?: string | null;
|
|
1078
|
+
/**
|
|
1079
|
+
* True when the cart holds a physical product. Shipping is priced at
|
|
1080
|
+
* checkout from the buyer's address, so `total` excludes it; show
|
|
1081
|
+
* "shipping calculated at checkout" next to the total.
|
|
1082
|
+
*/
|
|
1083
|
+
requires_shipping: boolean;
|
|
1046
1084
|
coupon_applied: boolean;
|
|
1047
1085
|
coupon_source: CartCodeSource | null;
|
|
1048
1086
|
coupon_discount_order_type: 'TOTAL' | 'PAYMENT_FEES' | null;
|
|
@@ -1759,6 +1797,24 @@ interface CustomerEmailPreferencesPatch {
|
|
|
1759
1797
|
subscribed: boolean;
|
|
1760
1798
|
}>;
|
|
1761
1799
|
}
|
|
1800
|
+
/** Which order mails the buyer receives. A key left out is left as it is. */
|
|
1801
|
+
interface CustomerNotificationPreferencesPatch {
|
|
1802
|
+
order_created_emails?: boolean;
|
|
1803
|
+
order_completed_emails?: boolean;
|
|
1804
|
+
payment_issue_emails?: boolean;
|
|
1805
|
+
}
|
|
1806
|
+
interface CustomerAffiliateLinkInput {
|
|
1807
|
+
code: string;
|
|
1808
|
+
label: string;
|
|
1809
|
+
/** Asking for a rate of one's own sends the link to the shop for approval. */
|
|
1810
|
+
requested_affiliate_revenue_percent?: number;
|
|
1811
|
+
requested_affiliate_customer_discount_percent?: number;
|
|
1812
|
+
}
|
|
1813
|
+
interface CustomerInvoicePdf {
|
|
1814
|
+
blob: Blob;
|
|
1815
|
+
/** From the producer's `Content-Disposition`; null when it named none. */
|
|
1816
|
+
filename: string | null;
|
|
1817
|
+
}
|
|
1762
1818
|
/** One basket line for a QUOTE. `variant_id` is omitted, never null, when a product has no variants. */
|
|
1763
1819
|
interface ResellerOrderItem {
|
|
1764
1820
|
product_id: string;
|
|
@@ -1798,6 +1854,14 @@ declare function dashboard(): Promise<SDKResponse<CustomerPortalDashboardWire>>;
|
|
|
1798
1854
|
*/
|
|
1799
1855
|
declare function orders(options?: CustomerOrdersQuery): Promise<SDKResponse<CustomerPortalPaginatedInvoicesWire>>;
|
|
1800
1856
|
declare function order(id: string): Promise<SDKResponse<CustomerPortalInvoiceDetailWire>>;
|
|
1857
|
+
/**
|
|
1858
|
+
* The invoice as a PDF, for the buyer to save.
|
|
1859
|
+
*
|
|
1860
|
+
* A file, not the JSON envelope, so it does not go through `requestCustomer`.
|
|
1861
|
+
* Anything but a PDF on a 2xx is a contract failure rather than a download: a
|
|
1862
|
+
* proxy's HTML error page saved as `invoice.pdf` is a file that will not open.
|
|
1863
|
+
*/
|
|
1864
|
+
declare function invoicePdf(id: string): Promise<SDKResponse<CustomerInvoicePdf>>;
|
|
1801
1865
|
declare function loyalty(): Promise<SDKResponse<CustomerLoyaltyWire>>;
|
|
1802
1866
|
declare function redeemLoyaltyPoints(input: {
|
|
1803
1867
|
points: number;
|
|
@@ -1824,6 +1888,15 @@ declare function addFavorite(productUniqid: string): Promise<SDKResponse<unknown
|
|
|
1824
1888
|
declare function removeFavorite(productUniqid: string): Promise<SDKResponse<unknown>>;
|
|
1825
1889
|
declare function affiliate(): Promise<SDKResponse<unknown>>;
|
|
1826
1890
|
declare function affiliateStats(days?: number): Promise<SDKResponse<unknown>>;
|
|
1891
|
+
/**
|
|
1892
|
+
* A referral link with a code of the buyer's choosing.
|
|
1893
|
+
*
|
|
1894
|
+
* `status` in the answer is `pending` when the shop approves links first, or
|
|
1895
|
+
* when the link asks for rates of its own. Nothing here pays out, converts or
|
|
1896
|
+
* shares a commission: those decide where earned money goes and are not
|
|
1897
|
+
* reachable from a storefront.
|
|
1898
|
+
*/
|
|
1899
|
+
declare function createAffiliateLink(input: CustomerAffiliateLinkInput): Promise<SDKResponse<CustomerPortalAffiliateCreateLinkWire>>;
|
|
1827
1900
|
declare function createTicket(payload: CustomerTicketPayload): Promise<SDKResponse<unknown>>;
|
|
1828
1901
|
declare function ticket(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
1829
1902
|
declare function replyToTicket(uniqid: string, message: string): Promise<SDKResponse<unknown>>;
|
|
@@ -1838,6 +1911,13 @@ declare function updateAvatar(file: File): Promise<SDKResponse<unknown>>;
|
|
|
1838
1911
|
declare function removeAvatar(): Promise<SDKResponse<unknown>>;
|
|
1839
1912
|
declare function emailPreferences(): Promise<SDKResponse<unknown>>;
|
|
1840
1913
|
declare function updateEmailPreferences(patch: CustomerEmailPreferencesPatch): Promise<SDKResponse<unknown>>;
|
|
1914
|
+
/**
|
|
1915
|
+
* Order mail, as opposed to the marketing lists above: order placed, order
|
|
1916
|
+
* completed, payment needs attention. Its own producer
|
|
1917
|
+
* (`routes/v1/customer-notifications.ts`), and it answers the saved set.
|
|
1918
|
+
*/
|
|
1919
|
+
declare function notificationPreferences(): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1920
|
+
declare function updateNotificationPreferences(patch: CustomerNotificationPreferencesPatch): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1841
1921
|
declare function sessions(): Promise<SDKResponse<unknown>>;
|
|
1842
1922
|
declare function revokeSession(id: string): Promise<SDKResponse<unknown>>;
|
|
1843
1923
|
/**
|
|
@@ -2058,6 +2138,7 @@ declare const shoppex: {
|
|
|
2058
2138
|
dashboard: typeof dashboard;
|
|
2059
2139
|
orders: typeof orders;
|
|
2060
2140
|
order: typeof order;
|
|
2141
|
+
invoicePdf: typeof invoicePdf;
|
|
2061
2142
|
loyalty: typeof loyalty;
|
|
2062
2143
|
redeemLoyaltyPoints: typeof redeemLoyaltyPoints;
|
|
2063
2144
|
warranties: typeof warranties;
|
|
@@ -2072,6 +2153,7 @@ declare const shoppex: {
|
|
|
2072
2153
|
removeFavorite: typeof removeFavorite;
|
|
2073
2154
|
affiliate: typeof affiliate;
|
|
2074
2155
|
affiliateStats: typeof affiliateStats;
|
|
2156
|
+
createAffiliateLink: typeof createAffiliateLink;
|
|
2075
2157
|
createTicket: typeof createTicket;
|
|
2076
2158
|
ticket: typeof ticket;
|
|
2077
2159
|
replyToTicket: typeof replyToTicket;
|
|
@@ -2080,6 +2162,8 @@ declare const shoppex: {
|
|
|
2080
2162
|
removeAvatar: typeof removeAvatar;
|
|
2081
2163
|
emailPreferences: typeof emailPreferences;
|
|
2082
2164
|
updateEmailPreferences: typeof updateEmailPreferences;
|
|
2165
|
+
notificationPreferences: typeof notificationPreferences;
|
|
2166
|
+
updateNotificationPreferences: typeof updateNotificationPreferences;
|
|
2083
2167
|
sessions: typeof sessions;
|
|
2084
2168
|
revokeSession: typeof revokeSession;
|
|
2085
2169
|
revokeAllSessions: typeof revokeAllSessions;
|
|
@@ -2120,4 +2204,4 @@ declare const shoppex: {
|
|
|
2120
2204
|
mergeSettings: typeof mergeSettings;
|
|
2121
2205
|
};
|
|
2122
2206
|
|
|
2123
|
-
export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerEmailPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, PRODUCT_FILTER_UNSUPPORTED, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, normalizeSearchQuery, normalizeStorefrontCustomFields, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
|
|
2207
|
+
export { type AffiliateValidation, ApiError, type ApiResponse, type BlockDefinition, type BlockInstance, type BuyerRewardActivityItem, type BuyerRewards, CURRENCY_UNAVAILABLE_ERROR_CODE, type CartAddOptions, type CartAddon, type CartAppliedDiscount, type CartBasketMergeLine, type CartCodeSource, CartError, type CartItem, type CartItemUpdate, type CartLineIdentityInput, type CartMetadata, type CartPayload, type CartQuote, type CartQuoteLine, type CartStats, type Category, CheckoutCreateError, type CheckoutOptions, type CheckoutResult, type CouponValidation, type CouponValidationOptions, type CursorPagination, type CustomFieldDefinition, type CustomerAffiliateLinkInput, type CustomerEmailPreferencesPatch, type CustomerInvoicePdf, type CustomerNotificationPreferencesPatch, type CustomerProfilePatch, type CustomerSubscriptionCancelOptions, type CustomerTicketPayload, type EligibleBundleDeal, type EligibleBundleDealProduct, type EligibleCartDeal, type Feedback, type Invoice, type InvoiceProduct, type Menu, type MenuItem, NetworkError, NotInitializedError, PRODUCT_FILTER_UNSUPPORTED, type Page, type PageLayout, type PriceVariant, type Product, type ProductAddon, type ProductBundle, type ProductBundleProduct, type ProductCategory, type ProductDescriptionTab, type ProductFaq, type ProductFeedback, type ProductGroup, type ProductImage, type ProductVariant, type PublishedBuilderSettings, type PublishedThemeSettingsPayload, type ResellerCatalogQuery, type ResellerOrderItem, type ResellerOrdersQuery, type ResolvedThemeSettings, type RewardActionType, type RewardGrantStatus, type RewardProgramSummary, type RewardProgramTeaserItem, type RewardReason, type SDKResponse, type SearchOptions, type SectionDefinition, type SettingField, type Shop, type ShopFeedback, type ShopReviewsPage, type ShopReviewsSummary, type ShopTheme, type ShoppexConfig, ShoppexError, type ShoppexInitOptions, type StorefrontAddon, type StorefrontAddonBootstrap, type StorefrontAnnouncementBarAddon, type StorefrontCatalogSearchItem, type StorefrontContactTicketInput, type StorefrontContactTicketResult, type StorefrontCountdownBarAddon, type StorefrontCouponPopupModalAddon, type StorefrontCustomField, type StorefrontData, type StorefrontItem, type StorefrontOnlineUsers, type StorefrontPromoInfoCardAddon, type StorefrontRecentPurchasePopupAddon, type StorefrontRecentSaleEntry, type StorefrontRecentSales, type StorefrontSearchFilterOptions, type StorefrontSocialLinks, type Subscription, type SubscriptionFlags, type SubscriptionInterval, type ThemeBlockManifest, type ThemeConfig, type TrustedChecks, ValidationError, acceptResellerInvite, addFavorite, affiliate, affiliateStats, applyForReseller, buildStorefrontContactMessage, buildStorefrontCustomFieldPayload, buildStorefrontProductLookup, cancelSubscription, claimWarranty, collectProductSearchHaystack, computeCartLineId, createAffiliateLink, createTicket, dashboard, shoppex as default, emailPreferences, enrollAsReseller, ensureCartLineId, favorites, fetchPublishedBuilderSettings, fetchPublishedThemeSettings, filterProductsBySearchQuery, getMenu, getMenuBySlot, getMenuByTitle, getMenuSlotTitles, getMenus, getMergedStorefrontProducts, getShopReviewsPage, getStorefrontGroupProducts, getStorefrontOnlineUsers, getStorefrontRecentSales, groupMatchesSearchQuery, invoicePdf, isProductInStock, isProductOutOfStock, isStorefrontCheckboxCustomFieldValueChecked, isVariantOutOfStock, logout, loyalty, me, mergeSettings, normalizeSearchQuery, normalizeStorefrontCustomFields, notificationPreferences, order, orders, pauseSubscription, productMatchesSearchQuery, quoteResellerOrder, redeemLoyaltyPoints, removeAvatar, removeFavorite, replyToTicket, requestOtp, reseller, resellerApiKeys, resellerCatalog, resellerOrder, resellerOrders, resellerWallet, resetLicenseHwid, resolveDefaults, resolveDisplayStock, resolveStorefrontApiBaseUrl, resolveStorefrontSocialLinks, resolveVariantStockValue, resumeSubscription, revokeAllSessions, revokeSession, searchMergedStorefrontCatalog, searchMergedStorefrontCatalogItems, sessions, shoppex, stripHtmlFromText, submitStorefrontContactTicket, subscriptionBillingHistory, ticket, touchStorefrontPresence, trackCartActivity, trackPageView, updateAvatar, updateEmailPreferences, updateNotificationPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
|