@shoppexio/storefront 1.0.90 → 1.0.92
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 +15 -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 +22165 -24427
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -4
- package/dist/index.d.ts +76 -4
- package/dist/index.js +303 -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
|
/**
|
|
@@ -593,7 +603,7 @@ interface BuyerRewards {
|
|
|
593
603
|
lifetime_earned: string;
|
|
594
604
|
redeemed: string | null;
|
|
595
605
|
currency: string;
|
|
596
|
-
};
|
|
606
|
+
} | null;
|
|
597
607
|
activity: BuyerRewardActivityItem[];
|
|
598
608
|
earned_after_invoice: BuyerRewardActivityItem[];
|
|
599
609
|
pending_after_invoice: BuyerRewardActivityItem[];
|
|
@@ -920,7 +930,9 @@ interface CartItem {
|
|
|
920
930
|
* to the line for the life of the cart, and every quote-driven heal that tried
|
|
921
931
|
* to clear it was a silent no-op.
|
|
922
932
|
*/
|
|
923
|
-
type CartItemUpdate = Partial<Omit<CartItem, 'line_id' | 'product_id' | 'variant_id' | 'min_quantity' | 'max_quantity'>> & {
|
|
933
|
+
type CartItemUpdate = Partial<Omit<CartItem, 'line_id' | 'product_id' | 'variant_id' | 'variant_title' | 'min_quantity' | 'max_quantity'>> & {
|
|
934
|
+
/** `null` clears the stored option name (the product has no options). */
|
|
935
|
+
variant_title?: string | null;
|
|
924
936
|
/** `null` clears the stored minimum. */
|
|
925
937
|
min_quantity?: number | null;
|
|
926
938
|
/** `null` clears the stored ceiling. */
|
|
@@ -1013,6 +1025,10 @@ interface EligibleBundleDeal {
|
|
|
1013
1025
|
* `product_id` the product identifier the cart sent, echoed exactly.
|
|
1014
1026
|
* `variant_id` the resolved option id, `null` for a product with no variants.
|
|
1015
1027
|
* `quantity` the quantity this line was quoted at.
|
|
1028
|
+
* `product_title` / `variant_title` the catalog's names for the product and the option
|
|
1029
|
+
* (`variant_title` null for a product with no variants), the names the invoice line
|
|
1030
|
+
* carries. `product_title` is the base-language title; a storefront that shows
|
|
1031
|
+
* translated titles keeps its own. Never compose or substitute them.
|
|
1016
1032
|
* `min_quantity` ABSENT when it is 1. Present values are the stepper's floor.
|
|
1017
1033
|
* `max_quantity` ABSENT when nothing bounds the line — absence is the unbounded sentinel, and
|
|
1018
1034
|
* `-1` is never sent. Never coerce an absent key to 0.
|
|
@@ -1046,6 +1062,10 @@ interface EligibleBundleDeal {
|
|
|
1046
1062
|
interface CartQuoteLine {
|
|
1047
1063
|
product_id: string;
|
|
1048
1064
|
variant_id: string | null;
|
|
1065
|
+
/** Absent on servers older than this field. */
|
|
1066
|
+
product_title?: string;
|
|
1067
|
+
/** Absent on servers older than this field. */
|
|
1068
|
+
variant_title?: string | null;
|
|
1049
1069
|
quantity: number;
|
|
1050
1070
|
/** Absent when 1. */
|
|
1051
1071
|
min_quantity?: number;
|
|
@@ -1065,6 +1085,12 @@ interface CartQuote {
|
|
|
1065
1085
|
* signing secret configured; absent on older backends.
|
|
1066
1086
|
*/
|
|
1067
1087
|
quote_token?: string | null;
|
|
1088
|
+
/**
|
|
1089
|
+
* True when the cart holds a physical product. Shipping is priced at
|
|
1090
|
+
* checkout from the buyer's address, so `total` excludes it; show
|
|
1091
|
+
* "shipping calculated at checkout" next to the total.
|
|
1092
|
+
*/
|
|
1093
|
+
requires_shipping: boolean;
|
|
1068
1094
|
coupon_applied: boolean;
|
|
1069
1095
|
coupon_source: CartCodeSource | null;
|
|
1070
1096
|
coupon_discount_order_type: 'TOTAL' | 'PAYMENT_FEES' | null;
|
|
@@ -1781,6 +1807,24 @@ interface CustomerEmailPreferencesPatch {
|
|
|
1781
1807
|
subscribed: boolean;
|
|
1782
1808
|
}>;
|
|
1783
1809
|
}
|
|
1810
|
+
/** Which order mails the buyer receives. A key left out is left as it is. */
|
|
1811
|
+
interface CustomerNotificationPreferencesPatch {
|
|
1812
|
+
order_created_emails?: boolean;
|
|
1813
|
+
order_completed_emails?: boolean;
|
|
1814
|
+
payment_issue_emails?: boolean;
|
|
1815
|
+
}
|
|
1816
|
+
interface CustomerAffiliateLinkInput {
|
|
1817
|
+
code: string;
|
|
1818
|
+
label: string;
|
|
1819
|
+
/** Asking for a rate of one's own sends the link to the shop for approval. */
|
|
1820
|
+
requested_affiliate_revenue_percent?: number;
|
|
1821
|
+
requested_affiliate_customer_discount_percent?: number;
|
|
1822
|
+
}
|
|
1823
|
+
interface CustomerInvoicePdf {
|
|
1824
|
+
blob: Blob;
|
|
1825
|
+
/** From the producer's `Content-Disposition`; null when it named none. */
|
|
1826
|
+
filename: string | null;
|
|
1827
|
+
}
|
|
1784
1828
|
/** One basket line for a QUOTE. `variant_id` is omitted, never null, when a product has no variants. */
|
|
1785
1829
|
interface ResellerOrderItem {
|
|
1786
1830
|
product_id: string;
|
|
@@ -1820,6 +1864,14 @@ declare function dashboard(): Promise<SDKResponse<CustomerPortalDashboardWire>>;
|
|
|
1820
1864
|
*/
|
|
1821
1865
|
declare function orders(options?: CustomerOrdersQuery): Promise<SDKResponse<CustomerPortalPaginatedInvoicesWire>>;
|
|
1822
1866
|
declare function order(id: string): Promise<SDKResponse<CustomerPortalInvoiceDetailWire>>;
|
|
1867
|
+
/**
|
|
1868
|
+
* The invoice as a PDF, for the buyer to save.
|
|
1869
|
+
*
|
|
1870
|
+
* A file, not the JSON envelope, so it does not go through `requestCustomer`.
|
|
1871
|
+
* Anything but a PDF on a 2xx is a contract failure rather than a download: a
|
|
1872
|
+
* proxy's HTML error page saved as `invoice.pdf` is a file that will not open.
|
|
1873
|
+
*/
|
|
1874
|
+
declare function invoicePdf(id: string): Promise<SDKResponse<CustomerInvoicePdf>>;
|
|
1823
1875
|
declare function loyalty(): Promise<SDKResponse<CustomerLoyaltyWire>>;
|
|
1824
1876
|
declare function redeemLoyaltyPoints(input: {
|
|
1825
1877
|
points: number;
|
|
@@ -1846,6 +1898,15 @@ declare function addFavorite(productUniqid: string): Promise<SDKResponse<unknown
|
|
|
1846
1898
|
declare function removeFavorite(productUniqid: string): Promise<SDKResponse<unknown>>;
|
|
1847
1899
|
declare function affiliate(): Promise<SDKResponse<unknown>>;
|
|
1848
1900
|
declare function affiliateStats(days?: number): Promise<SDKResponse<unknown>>;
|
|
1901
|
+
/**
|
|
1902
|
+
* A referral link with a code of the buyer's choosing.
|
|
1903
|
+
*
|
|
1904
|
+
* `status` in the answer is `pending` when the shop approves links first, or
|
|
1905
|
+
* when the link asks for rates of its own. Nothing here pays out, converts or
|
|
1906
|
+
* shares a commission: those decide where earned money goes and are not
|
|
1907
|
+
* reachable from a storefront.
|
|
1908
|
+
*/
|
|
1909
|
+
declare function createAffiliateLink(input: CustomerAffiliateLinkInput): Promise<SDKResponse<CustomerPortalAffiliateCreateLinkWire>>;
|
|
1849
1910
|
declare function createTicket(payload: CustomerTicketPayload): Promise<SDKResponse<unknown>>;
|
|
1850
1911
|
declare function ticket(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
1851
1912
|
declare function replyToTicket(uniqid: string, message: string): Promise<SDKResponse<unknown>>;
|
|
@@ -1860,6 +1921,13 @@ declare function updateAvatar(file: File): Promise<SDKResponse<unknown>>;
|
|
|
1860
1921
|
declare function removeAvatar(): Promise<SDKResponse<unknown>>;
|
|
1861
1922
|
declare function emailPreferences(): Promise<SDKResponse<unknown>>;
|
|
1862
1923
|
declare function updateEmailPreferences(patch: CustomerEmailPreferencesPatch): Promise<SDKResponse<unknown>>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Order mail, as opposed to the marketing lists above: order placed, order
|
|
1926
|
+
* completed, payment needs attention. Its own producer
|
|
1927
|
+
* (`routes/v1/customer-notifications.ts`), and it answers the saved set.
|
|
1928
|
+
*/
|
|
1929
|
+
declare function notificationPreferences(): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1930
|
+
declare function updateNotificationPreferences(patch: CustomerNotificationPreferencesPatch): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1863
1931
|
declare function sessions(): Promise<SDKResponse<unknown>>;
|
|
1864
1932
|
declare function revokeSession(id: string): Promise<SDKResponse<unknown>>;
|
|
1865
1933
|
/**
|
|
@@ -2080,6 +2148,7 @@ declare const shoppex: {
|
|
|
2080
2148
|
dashboard: typeof dashboard;
|
|
2081
2149
|
orders: typeof orders;
|
|
2082
2150
|
order: typeof order;
|
|
2151
|
+
invoicePdf: typeof invoicePdf;
|
|
2083
2152
|
loyalty: typeof loyalty;
|
|
2084
2153
|
redeemLoyaltyPoints: typeof redeemLoyaltyPoints;
|
|
2085
2154
|
warranties: typeof warranties;
|
|
@@ -2094,6 +2163,7 @@ declare const shoppex: {
|
|
|
2094
2163
|
removeFavorite: typeof removeFavorite;
|
|
2095
2164
|
affiliate: typeof affiliate;
|
|
2096
2165
|
affiliateStats: typeof affiliateStats;
|
|
2166
|
+
createAffiliateLink: typeof createAffiliateLink;
|
|
2097
2167
|
createTicket: typeof createTicket;
|
|
2098
2168
|
ticket: typeof ticket;
|
|
2099
2169
|
replyToTicket: typeof replyToTicket;
|
|
@@ -2102,6 +2172,8 @@ declare const shoppex: {
|
|
|
2102
2172
|
removeAvatar: typeof removeAvatar;
|
|
2103
2173
|
emailPreferences: typeof emailPreferences;
|
|
2104
2174
|
updateEmailPreferences: typeof updateEmailPreferences;
|
|
2175
|
+
notificationPreferences: typeof notificationPreferences;
|
|
2176
|
+
updateNotificationPreferences: typeof updateNotificationPreferences;
|
|
2105
2177
|
sessions: typeof sessions;
|
|
2106
2178
|
revokeSession: typeof revokeSession;
|
|
2107
2179
|
revokeAllSessions: typeof revokeAllSessions;
|
|
@@ -2142,4 +2214,4 @@ declare const shoppex: {
|
|
|
2142
2214
|
mergeSettings: typeof mergeSettings;
|
|
2143
2215
|
};
|
|
2144
2216
|
|
|
2145
|
-
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 };
|
|
2217
|
+
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
|
/**
|
|
@@ -593,7 +603,7 @@ interface BuyerRewards {
|
|
|
593
603
|
lifetime_earned: string;
|
|
594
604
|
redeemed: string | null;
|
|
595
605
|
currency: string;
|
|
596
|
-
};
|
|
606
|
+
} | null;
|
|
597
607
|
activity: BuyerRewardActivityItem[];
|
|
598
608
|
earned_after_invoice: BuyerRewardActivityItem[];
|
|
599
609
|
pending_after_invoice: BuyerRewardActivityItem[];
|
|
@@ -920,7 +930,9 @@ interface CartItem {
|
|
|
920
930
|
* to the line for the life of the cart, and every quote-driven heal that tried
|
|
921
931
|
* to clear it was a silent no-op.
|
|
922
932
|
*/
|
|
923
|
-
type CartItemUpdate = Partial<Omit<CartItem, 'line_id' | 'product_id' | 'variant_id' | 'min_quantity' | 'max_quantity'>> & {
|
|
933
|
+
type CartItemUpdate = Partial<Omit<CartItem, 'line_id' | 'product_id' | 'variant_id' | 'variant_title' | 'min_quantity' | 'max_quantity'>> & {
|
|
934
|
+
/** `null` clears the stored option name (the product has no options). */
|
|
935
|
+
variant_title?: string | null;
|
|
924
936
|
/** `null` clears the stored minimum. */
|
|
925
937
|
min_quantity?: number | null;
|
|
926
938
|
/** `null` clears the stored ceiling. */
|
|
@@ -1013,6 +1025,10 @@ interface EligibleBundleDeal {
|
|
|
1013
1025
|
* `product_id` the product identifier the cart sent, echoed exactly.
|
|
1014
1026
|
* `variant_id` the resolved option id, `null` for a product with no variants.
|
|
1015
1027
|
* `quantity` the quantity this line was quoted at.
|
|
1028
|
+
* `product_title` / `variant_title` the catalog's names for the product and the option
|
|
1029
|
+
* (`variant_title` null for a product with no variants), the names the invoice line
|
|
1030
|
+
* carries. `product_title` is the base-language title; a storefront that shows
|
|
1031
|
+
* translated titles keeps its own. Never compose or substitute them.
|
|
1016
1032
|
* `min_quantity` ABSENT when it is 1. Present values are the stepper's floor.
|
|
1017
1033
|
* `max_quantity` ABSENT when nothing bounds the line — absence is the unbounded sentinel, and
|
|
1018
1034
|
* `-1` is never sent. Never coerce an absent key to 0.
|
|
@@ -1046,6 +1062,10 @@ interface EligibleBundleDeal {
|
|
|
1046
1062
|
interface CartQuoteLine {
|
|
1047
1063
|
product_id: string;
|
|
1048
1064
|
variant_id: string | null;
|
|
1065
|
+
/** Absent on servers older than this field. */
|
|
1066
|
+
product_title?: string;
|
|
1067
|
+
/** Absent on servers older than this field. */
|
|
1068
|
+
variant_title?: string | null;
|
|
1049
1069
|
quantity: number;
|
|
1050
1070
|
/** Absent when 1. */
|
|
1051
1071
|
min_quantity?: number;
|
|
@@ -1065,6 +1085,12 @@ interface CartQuote {
|
|
|
1065
1085
|
* signing secret configured; absent on older backends.
|
|
1066
1086
|
*/
|
|
1067
1087
|
quote_token?: string | null;
|
|
1088
|
+
/**
|
|
1089
|
+
* True when the cart holds a physical product. Shipping is priced at
|
|
1090
|
+
* checkout from the buyer's address, so `total` excludes it; show
|
|
1091
|
+
* "shipping calculated at checkout" next to the total.
|
|
1092
|
+
*/
|
|
1093
|
+
requires_shipping: boolean;
|
|
1068
1094
|
coupon_applied: boolean;
|
|
1069
1095
|
coupon_source: CartCodeSource | null;
|
|
1070
1096
|
coupon_discount_order_type: 'TOTAL' | 'PAYMENT_FEES' | null;
|
|
@@ -1781,6 +1807,24 @@ interface CustomerEmailPreferencesPatch {
|
|
|
1781
1807
|
subscribed: boolean;
|
|
1782
1808
|
}>;
|
|
1783
1809
|
}
|
|
1810
|
+
/** Which order mails the buyer receives. A key left out is left as it is. */
|
|
1811
|
+
interface CustomerNotificationPreferencesPatch {
|
|
1812
|
+
order_created_emails?: boolean;
|
|
1813
|
+
order_completed_emails?: boolean;
|
|
1814
|
+
payment_issue_emails?: boolean;
|
|
1815
|
+
}
|
|
1816
|
+
interface CustomerAffiliateLinkInput {
|
|
1817
|
+
code: string;
|
|
1818
|
+
label: string;
|
|
1819
|
+
/** Asking for a rate of one's own sends the link to the shop for approval. */
|
|
1820
|
+
requested_affiliate_revenue_percent?: number;
|
|
1821
|
+
requested_affiliate_customer_discount_percent?: number;
|
|
1822
|
+
}
|
|
1823
|
+
interface CustomerInvoicePdf {
|
|
1824
|
+
blob: Blob;
|
|
1825
|
+
/** From the producer's `Content-Disposition`; null when it named none. */
|
|
1826
|
+
filename: string | null;
|
|
1827
|
+
}
|
|
1784
1828
|
/** One basket line for a QUOTE. `variant_id` is omitted, never null, when a product has no variants. */
|
|
1785
1829
|
interface ResellerOrderItem {
|
|
1786
1830
|
product_id: string;
|
|
@@ -1820,6 +1864,14 @@ declare function dashboard(): Promise<SDKResponse<CustomerPortalDashboardWire>>;
|
|
|
1820
1864
|
*/
|
|
1821
1865
|
declare function orders(options?: CustomerOrdersQuery): Promise<SDKResponse<CustomerPortalPaginatedInvoicesWire>>;
|
|
1822
1866
|
declare function order(id: string): Promise<SDKResponse<CustomerPortalInvoiceDetailWire>>;
|
|
1867
|
+
/**
|
|
1868
|
+
* The invoice as a PDF, for the buyer to save.
|
|
1869
|
+
*
|
|
1870
|
+
* A file, not the JSON envelope, so it does not go through `requestCustomer`.
|
|
1871
|
+
* Anything but a PDF on a 2xx is a contract failure rather than a download: a
|
|
1872
|
+
* proxy's HTML error page saved as `invoice.pdf` is a file that will not open.
|
|
1873
|
+
*/
|
|
1874
|
+
declare function invoicePdf(id: string): Promise<SDKResponse<CustomerInvoicePdf>>;
|
|
1823
1875
|
declare function loyalty(): Promise<SDKResponse<CustomerLoyaltyWire>>;
|
|
1824
1876
|
declare function redeemLoyaltyPoints(input: {
|
|
1825
1877
|
points: number;
|
|
@@ -1846,6 +1898,15 @@ declare function addFavorite(productUniqid: string): Promise<SDKResponse<unknown
|
|
|
1846
1898
|
declare function removeFavorite(productUniqid: string): Promise<SDKResponse<unknown>>;
|
|
1847
1899
|
declare function affiliate(): Promise<SDKResponse<unknown>>;
|
|
1848
1900
|
declare function affiliateStats(days?: number): Promise<SDKResponse<unknown>>;
|
|
1901
|
+
/**
|
|
1902
|
+
* A referral link with a code of the buyer's choosing.
|
|
1903
|
+
*
|
|
1904
|
+
* `status` in the answer is `pending` when the shop approves links first, or
|
|
1905
|
+
* when the link asks for rates of its own. Nothing here pays out, converts or
|
|
1906
|
+
* shares a commission: those decide where earned money goes and are not
|
|
1907
|
+
* reachable from a storefront.
|
|
1908
|
+
*/
|
|
1909
|
+
declare function createAffiliateLink(input: CustomerAffiliateLinkInput): Promise<SDKResponse<CustomerPortalAffiliateCreateLinkWire>>;
|
|
1849
1910
|
declare function createTicket(payload: CustomerTicketPayload): Promise<SDKResponse<unknown>>;
|
|
1850
1911
|
declare function ticket(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
1851
1912
|
declare function replyToTicket(uniqid: string, message: string): Promise<SDKResponse<unknown>>;
|
|
@@ -1860,6 +1921,13 @@ declare function updateAvatar(file: File): Promise<SDKResponse<unknown>>;
|
|
|
1860
1921
|
declare function removeAvatar(): Promise<SDKResponse<unknown>>;
|
|
1861
1922
|
declare function emailPreferences(): Promise<SDKResponse<unknown>>;
|
|
1862
1923
|
declare function updateEmailPreferences(patch: CustomerEmailPreferencesPatch): Promise<SDKResponse<unknown>>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Order mail, as opposed to the marketing lists above: order placed, order
|
|
1926
|
+
* completed, payment needs attention. Its own producer
|
|
1927
|
+
* (`routes/v1/customer-notifications.ts`), and it answers the saved set.
|
|
1928
|
+
*/
|
|
1929
|
+
declare function notificationPreferences(): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1930
|
+
declare function updateNotificationPreferences(patch: CustomerNotificationPreferencesPatch): Promise<SDKResponse<CustomerPortalNotificationPreferencesWire>>;
|
|
1863
1931
|
declare function sessions(): Promise<SDKResponse<unknown>>;
|
|
1864
1932
|
declare function revokeSession(id: string): Promise<SDKResponse<unknown>>;
|
|
1865
1933
|
/**
|
|
@@ -2080,6 +2148,7 @@ declare const shoppex: {
|
|
|
2080
2148
|
dashboard: typeof dashboard;
|
|
2081
2149
|
orders: typeof orders;
|
|
2082
2150
|
order: typeof order;
|
|
2151
|
+
invoicePdf: typeof invoicePdf;
|
|
2083
2152
|
loyalty: typeof loyalty;
|
|
2084
2153
|
redeemLoyaltyPoints: typeof redeemLoyaltyPoints;
|
|
2085
2154
|
warranties: typeof warranties;
|
|
@@ -2094,6 +2163,7 @@ declare const shoppex: {
|
|
|
2094
2163
|
removeFavorite: typeof removeFavorite;
|
|
2095
2164
|
affiliate: typeof affiliate;
|
|
2096
2165
|
affiliateStats: typeof affiliateStats;
|
|
2166
|
+
createAffiliateLink: typeof createAffiliateLink;
|
|
2097
2167
|
createTicket: typeof createTicket;
|
|
2098
2168
|
ticket: typeof ticket;
|
|
2099
2169
|
replyToTicket: typeof replyToTicket;
|
|
@@ -2102,6 +2172,8 @@ declare const shoppex: {
|
|
|
2102
2172
|
removeAvatar: typeof removeAvatar;
|
|
2103
2173
|
emailPreferences: typeof emailPreferences;
|
|
2104
2174
|
updateEmailPreferences: typeof updateEmailPreferences;
|
|
2175
|
+
notificationPreferences: typeof notificationPreferences;
|
|
2176
|
+
updateNotificationPreferences: typeof updateNotificationPreferences;
|
|
2105
2177
|
sessions: typeof sessions;
|
|
2106
2178
|
revokeSession: typeof revokeSession;
|
|
2107
2179
|
revokeAllSessions: typeof revokeAllSessions;
|
|
@@ -2142,4 +2214,4 @@ declare const shoppex: {
|
|
|
2142
2214
|
mergeSettings: typeof mergeSettings;
|
|
2143
2215
|
};
|
|
2144
2216
|
|
|
2145
|
-
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 };
|
|
2217
|
+
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 };
|