@shoppexio/storefront 1.0.92 → 1.0.93
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 +9 -0
- package/dist/{chunk-UW6DFRB5.js → chunk-ESI3HWQF.js} +2 -1
- package/dist/{chunk-UW6DFRB5.js.map → chunk-ESI3HWQF.js.map} +1 -1
- package/dist/customer.cjs +13 -1
- package/dist/customer.cjs.map +1 -1
- package/dist/customer.d.cts +2 -0
- package/dist/customer.d.ts +2 -0
- package/dist/customer.js +13 -2
- package/dist/customer.js.map +1 -1
- package/dist/index.cjs +22076 -22049
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +566 -565
- package/dist/index.d.ts +566 -565
- package/dist/index.js +3373 -3348
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import { createApiClient } from '@shoppex/contracts/api-client';
|
|
2
1
|
import { NavigationMenuSlot } from '@shoppex/contracts/navigation';
|
|
3
2
|
export { NavigationMenuSlot } from '@shoppex/contracts/navigation';
|
|
3
|
+
import { StorefrontDeliveryType } from '@shoppex/contracts/storefront-delivery-type';
|
|
4
4
|
import * as src from 'src';
|
|
5
|
+
import { createApiClient } from '@shoppex/contracts/api-client';
|
|
5
6
|
import { CustomerWarrantyClaimWire, CustomerPortalAffiliateCreateLinkWire, CustomerPortalDashboardWire, CustomerPortalPaginatedInvoicesWire, CustomerPortalInvoiceDetailWire, CustomerLoyaltyWire, CustomerLoyaltyRedeemWire, CustomerWarrantyListWire, CustomerPortalNotificationPreferencesWire } from '@shoppex/contracts/customer-account-wire';
|
|
6
7
|
export { CATALOG_UNIT_PRICE_DECIMAL_PLACES, CATALOG_UNIT_PRICE_FORMAT_OPTIONS, PAYABLE_AMOUNT_DECIMAL_PLACES, roundPayableAmount } from '@shoppex/contracts/catalog-unit-price';
|
|
7
8
|
|
|
9
|
+
interface CacheStats {
|
|
10
|
+
hits: number;
|
|
11
|
+
misses: number;
|
|
12
|
+
pendingRequests: number;
|
|
13
|
+
entries: number;
|
|
14
|
+
}
|
|
15
|
+
declare function getCacheStats(): CacheStats;
|
|
16
|
+
declare function clearCache(): void;
|
|
17
|
+
declare function invalidateCache(prefixOrKey: string): void;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Formatting Utilities
|
|
21
|
+
*/
|
|
22
|
+
declare function createFormatter(currency?: string, locale?: string): Intl.NumberFormat;
|
|
23
|
+
declare function formatPrice(amount: number | string, currency?: string, locale?: string): string;
|
|
24
|
+
|
|
8
25
|
/**
|
|
9
26
|
* SDK Configuration Types
|
|
10
27
|
*/
|
|
@@ -321,6 +338,8 @@ interface Product {
|
|
|
321
338
|
bestseller?: boolean | number;
|
|
322
339
|
type?: string;
|
|
323
340
|
subtype?: string | null;
|
|
341
|
+
/** What the buyer receives, read off the delivery mechanism; null when the mechanism does not say. */
|
|
342
|
+
delivery_type?: StorefrontDeliveryType | null;
|
|
324
343
|
isSubscription?: boolean;
|
|
325
344
|
isGroup?: boolean;
|
|
326
345
|
images: ProductImage[];
|
|
@@ -332,11 +351,18 @@ interface Product {
|
|
|
332
351
|
soldCount?: number;
|
|
333
352
|
variants?: ProductVariant[];
|
|
334
353
|
addons?: ProductAddon[];
|
|
354
|
+
/**
|
|
355
|
+
* Buyers must pick one of `addons`: the server refuses a line that names none
|
|
356
|
+
* (`errors.checkout.addon_required`). Asks nothing when `addons` is empty.
|
|
357
|
+
*/
|
|
358
|
+
addons_required?: boolean;
|
|
335
359
|
price_variants?: PriceVariant[];
|
|
336
360
|
volume_discounts?: unknown;
|
|
337
361
|
custom_fields?: string | unknown[] | null;
|
|
338
362
|
categories?: ProductCategory[];
|
|
339
363
|
bundles?: ProductBundle[];
|
|
364
|
+
/** The merchant's upsell picks, as product uniqids in the merchant's order; empty when they picked none. */
|
|
365
|
+
upsell_product_ids?: string[];
|
|
340
366
|
faqs?: ProductFaq[];
|
|
341
367
|
subscription?: Subscription;
|
|
342
368
|
feedbacks?: Feedback[];
|
|
@@ -976,6 +1002,11 @@ interface EligibleCartDeal {
|
|
|
976
1002
|
label: string;
|
|
977
1003
|
missing_quantity: number;
|
|
978
1004
|
required_quantity: number;
|
|
1005
|
+
/** Units of `required_quantity` the deal discounts. */
|
|
1006
|
+
discounted_quantity: number;
|
|
1007
|
+
discount_type: 'PERCENTAGE' | 'FREE';
|
|
1008
|
+
/** The percent off those units as a 2-dp string; `"100.00"` for FREE. */
|
|
1009
|
+
discount_value: string;
|
|
979
1010
|
}
|
|
980
1011
|
interface EligibleBundleDealProduct {
|
|
981
1012
|
product_id: string;
|
|
@@ -1133,102 +1164,30 @@ interface CartStats {
|
|
|
1133
1164
|
}
|
|
1134
1165
|
|
|
1135
1166
|
/**
|
|
1136
|
-
*
|
|
1137
|
-
*/
|
|
1138
|
-
|
|
1139
|
-
declare function getConfig(): ShoppexConfig;
|
|
1140
|
-
declare function isInitialized(): boolean;
|
|
1141
|
-
|
|
1142
|
-
/**
|
|
1143
|
-
* Typed OpenAPI client factory.
|
|
1144
|
-
*
|
|
1145
|
-
* Surfaces the generated `createApiClient` from `@shoppex/contracts` with the
|
|
1146
|
-
* SDK's configured `apiBaseUrl`. This lets consumers of `@shoppexio/storefront`
|
|
1147
|
-
* call any public Dev API endpoint with full end-to-end types without
|
|
1148
|
-
* rebuilding a client from scratch.
|
|
1167
|
+
* Pages Module
|
|
1149
1168
|
*
|
|
1150
|
-
*
|
|
1151
|
-
* read flows — they handle caching, pagination defaults, and storefront
|
|
1152
|
-
* scoping. Drop down to `shoppex.client()` only when you need an endpoint
|
|
1153
|
-
* the high-level API does not cover yet.
|
|
1154
|
-
*/
|
|
1155
|
-
|
|
1156
|
-
type ApiClient = ReturnType<typeof createApiClient>;
|
|
1157
|
-
/**
|
|
1158
|
-
* Return a typed OpenAPI client bound to the SDK's configured API base URL.
|
|
1159
|
-
* The client is cached per base URL and recreated when the SDK is re-initialized
|
|
1160
|
-
* against a different host.
|
|
1169
|
+
* API methods for public pages.
|
|
1161
1170
|
*/
|
|
1162
|
-
declare function getTypedClient(token?: string): ApiClient;
|
|
1163
1171
|
|
|
1164
1172
|
/**
|
|
1165
|
-
*
|
|
1173
|
+
* Get all public pages for the store
|
|
1166
1174
|
*/
|
|
1175
|
+
declare function getPages(): Promise<SDKResponse<Page[]>>;
|
|
1167
1176
|
/**
|
|
1168
|
-
*
|
|
1169
|
-
* not sell in (ADR-0066). `errorParams.requested` names the currency,
|
|
1170
|
-
* `errorParams.available` lists the enabled ones.
|
|
1177
|
+
* Get a public page by slug
|
|
1171
1178
|
*/
|
|
1172
|
-
declare
|
|
1173
|
-
|
|
1174
|
-
readonly code: string;
|
|
1175
|
-
readonly statusCode?: number;
|
|
1176
|
-
constructor(message: string, code: string, statusCode?: number);
|
|
1177
|
-
}
|
|
1178
|
-
declare class NotInitializedError extends ShoppexError {
|
|
1179
|
-
constructor();
|
|
1180
|
-
}
|
|
1181
|
-
declare class NetworkError extends ShoppexError {
|
|
1182
|
-
constructor(message: string, statusCode?: number);
|
|
1183
|
-
}
|
|
1179
|
+
declare function getPage(slug: string): Promise<SDKResponse<Page>>;
|
|
1180
|
+
|
|
1184
1181
|
/**
|
|
1185
|
-
*
|
|
1186
|
-
* (e.g. `errors.checkout.coupon_no_longer_valid`) — the branchable identity of
|
|
1187
|
-
* the refusal, stable across locales, unlike the localized `message`.
|
|
1182
|
+
* Invoices Module
|
|
1188
1183
|
*
|
|
1189
|
-
*
|
|
1190
|
-
* that one means "the request did not produce a named answer".
|
|
1184
|
+
* Invoice status checking after payment.
|
|
1191
1185
|
*/
|
|
1192
|
-
declare class ApiError extends ShoppexError {
|
|
1193
|
-
readonly errorParams?: Record<string, unknown>;
|
|
1194
|
-
constructor(message: string, code: string, statusCode?: number, errorParams?: Record<string, unknown>);
|
|
1195
|
-
}
|
|
1196
|
-
declare class ValidationError extends ShoppexError {
|
|
1197
|
-
readonly invalidFields?: string[];
|
|
1198
|
-
constructor(message: string, invalidFields?: string[]);
|
|
1199
|
-
}
|
|
1200
|
-
declare class CartError extends ShoppexError {
|
|
1201
|
-
constructor(message: string);
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
interface StorefrontCustomField {
|
|
1205
|
-
name: string;
|
|
1206
|
-
type: string;
|
|
1207
|
-
required: boolean;
|
|
1208
|
-
defaultValue: string;
|
|
1209
|
-
placeholder: string;
|
|
1210
|
-
regex?: string;
|
|
1211
|
-
}
|
|
1212
|
-
declare function normalizeStorefrontCustomFields(raw: unknown): StorefrontCustomField[];
|
|
1213
|
-
declare function isStorefrontCheckboxCustomFieldValueChecked(value: string | undefined): boolean;
|
|
1214
|
-
declare function validateStorefrontCustomFieldValue(field: StorefrontCustomField, value: string): string | null;
|
|
1215
|
-
declare function buildStorefrontCustomFieldPayload(fields: StorefrontCustomField[], values: Record<string, string>): Record<string, string>;
|
|
1216
|
-
|
|
1217
|
-
type VariantLike = Pick<ProductVariant, 'stock' | 'orderable' | 'supplier_backed'> | Pick<PriceVariant, 'stock' | 'orderable' | 'supplier_backed'>;
|
|
1218
|
-
type ProductLike = Pick<Product, 'type' | 'stock' | 'orderable' | 'supplier_backed' | 'on_hold' | 'price_variants' | 'variants'> & {
|
|
1219
|
-
onHold?: boolean | number | string | null;
|
|
1220
|
-
is_on_hold?: boolean | number | string | null;
|
|
1221
|
-
isOnHold?: boolean | number | string | null;
|
|
1222
|
-
};
|
|
1223
|
-
declare function resolveVariantStockValue(variant: VariantLike | null | undefined): number;
|
|
1224
|
-
declare function resolveDisplayStock(product: ProductLike | null | undefined): number;
|
|
1225
|
-
declare function isProductOutOfStock(product: ProductLike | null | undefined): boolean;
|
|
1226
|
-
declare function isProductInStock(product: ProductLike | null | undefined): boolean;
|
|
1227
|
-
declare function isVariantOutOfStock(variant: VariantLike | null | undefined): boolean;
|
|
1228
1186
|
|
|
1229
|
-
declare function
|
|
1230
|
-
declare function
|
|
1231
|
-
|
|
1187
|
+
declare function getInvoice(invoiceId: string): Promise<SDKResponse<Invoice>>;
|
|
1188
|
+
declare function getInvoiceStatus(invoiceId: string): Promise<SDKResponse<{
|
|
1189
|
+
status: string;
|
|
1190
|
+
}>>;
|
|
1232
1191
|
|
|
1233
1192
|
interface StorefrontSearchFilterOptions {
|
|
1234
1193
|
hideOutOfStock?: boolean;
|
|
@@ -1251,269 +1210,121 @@ declare function filterProductsBySearchQuery(products: Product[], query: string,
|
|
|
1251
1210
|
declare function searchMergedStorefrontCatalogItems(products: Product[], groups: ProductGroup[], query: string, options?: StorefrontSearchFilterOptions): StorefrontCatalogSearchItem[];
|
|
1252
1211
|
declare function searchMergedStorefrontCatalog(products: Product[], groups: ProductGroup[], query: string, options?: StorefrontSearchFilterOptions): Product[];
|
|
1253
1212
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
apiBaseUrl?: string;
|
|
1262
|
-
};
|
|
1263
|
-
type StorefrontContactTicketResult = {
|
|
1264
|
-
uniqid: string;
|
|
1265
|
-
};
|
|
1266
|
-
declare function resolveStorefrontApiBaseUrl(options?: {
|
|
1267
|
-
apiBaseUrl?: string;
|
|
1268
|
-
hostname?: string;
|
|
1269
|
-
}): string;
|
|
1270
|
-
declare function buildStorefrontContactMessage(input: {
|
|
1271
|
-
name?: string;
|
|
1272
|
-
message: string;
|
|
1273
|
-
maxLength?: number;
|
|
1274
|
-
}): string;
|
|
1275
|
-
declare function submitStorefrontContactTicket(input: StorefrontContactTicketInput): Promise<StorefrontContactTicketResult>;
|
|
1276
|
-
type StorefrontSocialLinks = {
|
|
1277
|
-
discord?: string | null;
|
|
1278
|
-
telegram?: string | null;
|
|
1279
|
-
};
|
|
1280
|
-
declare function resolveStorefrontSocialLinks(store: {
|
|
1281
|
-
discord_link?: string | null;
|
|
1282
|
-
telegram_link?: string | null;
|
|
1283
|
-
social?: Record<string, string | null | undefined> | null;
|
|
1284
|
-
} | null | undefined): StorefrontSocialLinks;
|
|
1213
|
+
interface SearchOptions {
|
|
1214
|
+
hideOutOfStock?: boolean;
|
|
1215
|
+
maxResults?: number;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
declare function searchCatalogItems(query: string, options?: SearchOptions): Promise<SDKResponse<StorefrontCatalogSearchItem[]>>;
|
|
1219
|
+
declare function searchProducts(query: string, options?: SearchOptions): Promise<SDKResponse<Product[]>>;
|
|
1285
1220
|
|
|
1286
1221
|
/**
|
|
1287
|
-
*
|
|
1222
|
+
* Reviews Module
|
|
1223
|
+
*
|
|
1224
|
+
* Shop-level feedback/reviews.
|
|
1225
|
+
* Note: Shoppex has shop-level feedback, not product-level reviews.
|
|
1288
1226
|
*/
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1299
|
-
interface RangeField extends BaseSettingField {
|
|
1300
|
-
type: 'range';
|
|
1301
|
-
default: number;
|
|
1302
|
-
min: number;
|
|
1303
|
-
max: number;
|
|
1304
|
-
step?: number;
|
|
1305
|
-
unit?: string;
|
|
1306
|
-
}
|
|
1307
|
-
interface SelectField extends BaseSettingField {
|
|
1308
|
-
type: 'select';
|
|
1309
|
-
default: string;
|
|
1310
|
-
options: string[] | {
|
|
1311
|
-
value: string;
|
|
1312
|
-
label: string;
|
|
1313
|
-
}[];
|
|
1314
|
-
}
|
|
1315
|
-
interface BooleanField extends BaseSettingField {
|
|
1316
|
-
type: 'boolean';
|
|
1317
|
-
default: boolean;
|
|
1318
|
-
}
|
|
1319
|
-
interface TextField extends BaseSettingField {
|
|
1320
|
-
type: 'text';
|
|
1321
|
-
default: string;
|
|
1322
|
-
}
|
|
1323
|
-
interface ImageField extends BaseSettingField {
|
|
1324
|
-
type: 'image';
|
|
1325
|
-
default: string | null;
|
|
1326
|
-
}
|
|
1327
|
-
interface FontField extends BaseSettingField {
|
|
1328
|
-
type: 'font';
|
|
1329
|
-
default: string;
|
|
1330
|
-
options?: string[];
|
|
1331
|
-
}
|
|
1332
|
-
interface RichtextField extends BaseSettingField {
|
|
1333
|
-
type: 'richtext';
|
|
1334
|
-
default: string;
|
|
1335
|
-
}
|
|
1336
|
-
interface ProductsField extends BaseSettingField {
|
|
1337
|
-
type: 'products';
|
|
1338
|
-
default: string[];
|
|
1339
|
-
max?: number;
|
|
1340
|
-
}
|
|
1341
|
-
interface ImagesField extends BaseSettingField {
|
|
1342
|
-
type: 'images';
|
|
1343
|
-
default: string[];
|
|
1344
|
-
max?: number;
|
|
1345
|
-
}
|
|
1346
|
-
type SettingField = ColorField | RangeField | SelectField | BooleanField | TextField | ImageField | FontField | RichtextField | ProductsField | ImagesField;
|
|
1347
|
-
interface SectionDefinition {
|
|
1348
|
-
name: string;
|
|
1349
|
-
description?: string;
|
|
1350
|
-
icon?: string;
|
|
1351
|
-
settings: Record<string, SettingField>;
|
|
1352
|
-
}
|
|
1353
|
-
interface BlockDefinition {
|
|
1354
|
-
name: string;
|
|
1355
|
-
description?: string;
|
|
1356
|
-
icon?: string;
|
|
1357
|
-
settings: Record<string, SettingField>;
|
|
1358
|
-
allowedPages?: string[];
|
|
1359
|
-
maxPerPage?: number;
|
|
1360
|
-
}
|
|
1361
|
-
interface BlockInstance {
|
|
1362
|
-
id: string;
|
|
1363
|
-
type: string;
|
|
1364
|
-
visible?: boolean;
|
|
1365
|
-
settings?: Record<string, SettingValue>;
|
|
1366
|
-
}
|
|
1367
|
-
interface PageLayout {
|
|
1368
|
-
blocks: BlockInstance[];
|
|
1369
|
-
}
|
|
1370
|
-
interface ThemeBlockManifest {
|
|
1371
|
-
pages: string[];
|
|
1372
|
-
blocks: Record<string, BlockDefinition>;
|
|
1373
|
-
defaultLayouts?: Record<string, PageLayout>;
|
|
1227
|
+
|
|
1228
|
+
/** `code` of a filtered request the API answered without applying the filter. */
|
|
1229
|
+
declare const PRODUCT_FILTER_UNSUPPORTED = "reviews_product_filter_unsupported";
|
|
1230
|
+
interface ShopReviewsPageOptions {
|
|
1231
|
+
/**
|
|
1232
|
+
* One product's reviews, by the product's public id (the `id` the catalog
|
|
1233
|
+
* carries). The page's `summary` then counts that product's reviews only.
|
|
1234
|
+
*/
|
|
1235
|
+
product?: string | null;
|
|
1374
1236
|
}
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
name: string;
|
|
1378
|
-
description?: string;
|
|
1379
|
-
version: string;
|
|
1380
|
-
author?: string;
|
|
1381
|
-
preview?: string;
|
|
1382
|
-
settings: Record<string, Record<string, SettingField>>;
|
|
1383
|
-
sections: Record<string, SectionDefinition>;
|
|
1384
|
-
blocks?: Record<string, BlockDefinition>;
|
|
1385
|
-
pageLayouts?: Record<string, PageLayout>;
|
|
1386
|
-
builder?: ThemeBlockManifest;
|
|
1387
|
-
}
|
|
1388
|
-
type SettingValue = string | number | boolean | null | string[] | Record<string, unknown>;
|
|
1389
|
-
type ResolvedThemeSettings = {
|
|
1390
|
-
[Category: string]: {
|
|
1391
|
-
[Key: string]: SettingValue;
|
|
1392
|
-
};
|
|
1393
|
-
};
|
|
1394
|
-
|
|
1395
|
-
type JsonRecord = Record<string, unknown>;
|
|
1396
|
-
interface PublishedBuilderSettings {
|
|
1397
|
-
version: number;
|
|
1398
|
-
revision: number;
|
|
1399
|
-
theme: {
|
|
1400
|
-
content: JsonRecord;
|
|
1401
|
-
layout: JsonRecord;
|
|
1402
|
-
style_slots: JsonRecord;
|
|
1403
|
-
pages?: unknown[];
|
|
1404
|
-
terms?: JsonRecord;
|
|
1405
|
-
[key: string]: unknown;
|
|
1406
|
-
};
|
|
1407
|
-
[key: string]: unknown;
|
|
1408
|
-
}
|
|
1409
|
-
interface PublishedThemeSettingsPayload {
|
|
1410
|
-
settings: ResolvedThemeSettings;
|
|
1411
|
-
builder_settings: PublishedBuilderSettings | null;
|
|
1412
|
-
content: JsonRecord;
|
|
1413
|
-
style_slots: JsonRecord;
|
|
1414
|
-
}
|
|
1415
|
-
declare function fetchPublishedBuilderSettings(shopSlug: string): Promise<PublishedThemeSettingsPayload | null>;
|
|
1416
|
-
declare function fetchPublishedThemeSettings(shopSlug: string): Promise<ResolvedThemeSettings | null>;
|
|
1417
|
-
declare function resolveDefaults(config: ThemeConfig): ResolvedThemeSettings;
|
|
1418
|
-
declare function mergeSettings(defaults: ResolvedThemeSettings, overrides: Partial<ResolvedThemeSettings>): ResolvedThemeSettings;
|
|
1237
|
+
declare function getShopReviewsPage(cursor?: string | null, options?: ShopReviewsPageOptions): Promise<SDKResponse<ShopReviewsPage>>;
|
|
1238
|
+
declare function getShopReviews(): Promise<SDKResponse<Feedback[]>>;
|
|
1419
1239
|
|
|
1420
1240
|
/**
|
|
1421
|
-
*
|
|
1241
|
+
* Coupons Module
|
|
1422
1242
|
*
|
|
1423
|
-
*
|
|
1243
|
+
* Coupon validation before checkout.
|
|
1424
1244
|
*/
|
|
1425
1245
|
|
|
1426
|
-
|
|
1427
|
-
productsLimit?: number;
|
|
1428
|
-
productsCursor?: string | null;
|
|
1429
|
-
}
|
|
1430
|
-
declare function getStore(): Promise<SDKResponse<Shop>>;
|
|
1431
|
-
declare function resolveStoreByDomain(domain?: string, apiBaseUrl?: string): Promise<SDKResponse<Shop>>;
|
|
1432
|
-
declare function getStorefront(options?: GetStorefrontOptions): Promise<SDKResponse<StorefrontData>>;
|
|
1433
|
-
declare function getStoreLogoUrl(): Promise<string | null>;
|
|
1434
|
-
declare function getStoreBannerUrl(): Promise<string | null>;
|
|
1246
|
+
declare function validateCoupon(code: string, productOrOptions?: string | CouponValidationOptions): Promise<SDKResponse<CouponValidation>>;
|
|
1435
1247
|
|
|
1248
|
+
type AffiliateAttributionMode = 'LAST_CLICK' | 'FIRST_CLICK';
|
|
1249
|
+
declare function setAffiliateCode(code: string | null | undefined, ttlDays?: number, mode?: AffiliateAttributionMode): string | null;
|
|
1436
1250
|
/**
|
|
1437
|
-
*
|
|
1251
|
+
* The stored attribution, or null when nothing valid is held.
|
|
1438
1252
|
*
|
|
1439
|
-
*
|
|
1253
|
+
* Unlike `getAffiliateCode()` this also reports the mode the entry was written
|
|
1254
|
+
* under, which is what `captureAffiliateFromUrl` needs BEFORE it decides
|
|
1255
|
+
* whether it may overwrite.
|
|
1440
1256
|
*/
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
declare function
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1257
|
+
declare function getStoredAffiliate(): {
|
|
1258
|
+
code: string;
|
|
1259
|
+
mode: AffiliateAttributionMode;
|
|
1260
|
+
windowDays: number;
|
|
1261
|
+
/**
|
|
1262
|
+
* When this entry expires, as written. Reported so a hold that has to be put
|
|
1263
|
+
* back after an early overwrite keeps its original expiry — the window runs
|
|
1264
|
+
* from the click that earned it, not from the landing that failed to take it.
|
|
1265
|
+
*/
|
|
1266
|
+
expiresAt: number;
|
|
1267
|
+
} | null;
|
|
1268
|
+
declare function clearAffiliateCode(): void;
|
|
1269
|
+
declare function getAffiliateCode(): string | null;
|
|
1270
|
+
declare function trackAffiliateEvent(eventType: 'add_to_cart' | 'checkout_started', options?: {
|
|
1271
|
+
/**
|
|
1272
|
+
* The code the surrounding call actually resolved and submitted (e.g.
|
|
1273
|
+
* checkout()'s tri-state result). `null` means the caller explicitly
|
|
1274
|
+
* submitted WITHOUT a referral — no event is recorded, so an ambient
|
|
1275
|
+
* stored code is never credited for a sale it did not get. Omit the
|
|
1276
|
+
* options object entirely to attribute to the stored ambient code.
|
|
1277
|
+
*/
|
|
1278
|
+
code: string | null;
|
|
1279
|
+
/**
|
|
1280
|
+
* Overrides the per-browser-session dedupe key. checkout entry points
|
|
1281
|
+
* pass `inv:<invoiceId>` so every created invoice counts as exactly one
|
|
1282
|
+
* checkout — a session-wide key would drop the second checkout of a
|
|
1283
|
+
* buyer who orders twice in one session while both sales still count.
|
|
1284
|
+
*/
|
|
1285
|
+
dedupeKey?: string;
|
|
1286
|
+
}): Promise<void>;
|
|
1287
|
+
declare function validateAffiliateCode(code: string): Promise<SDKResponse<AffiliateValidation>>;
|
|
1467
1288
|
/**
|
|
1468
|
-
*
|
|
1289
|
+
* Validate a manually entered code and store it (ADR-0067).
|
|
1469
1290
|
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1291
|
+
* Attribution is governed by the same rules as a `?ref=` landing, deliberately:
|
|
1292
|
+
* a themed "apply code" box must not be a way around first-click, or the rule
|
|
1293
|
+
* is bypassed by any storefront that offers one. So a still-protected hold
|
|
1294
|
+
* keeps the sale, and the stored entry always carries the mode and window the
|
|
1295
|
+
* server just reported — the old unconditional `setAffiliateCode(code)` wrote
|
|
1296
|
+
* a 30-day last-click entry whatever the shop or tier had configured.
|
|
1473
1297
|
*
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1479
|
-
*
|
|
1480
|
-
* function's job: `normalizeCartItems` clamps and repairs on every READ, which
|
|
1481
|
-
* is the chokepoint every access already flows through.
|
|
1298
|
+
* The result reports what is now ATTRIBUTED, not merely what was validated:
|
|
1299
|
+
* `affiliate_code` carries the winning code and `applied` says whether that is
|
|
1300
|
+
* the one you passed. The documented integration hands `affiliate_code`
|
|
1301
|
+
* straight to `checkout({ affiliateCode })`, and an explicit checkout code
|
|
1302
|
+
* overrides storage — so returning the losing code here would credit it and
|
|
1303
|
+
* walk right around the hold this function just honoured.
|
|
1482
1304
|
*/
|
|
1483
|
-
declare function
|
|
1484
|
-
declare function removeFromCart(lineId: string): void;
|
|
1305
|
+
declare function applyAffiliateCode(code: string): Promise<SDKResponse<AffiliateValidation>>;
|
|
1485
1306
|
/**
|
|
1486
|
-
*
|
|
1307
|
+
* Capture an affiliate code from the current URL and store it (ADR-0067).
|
|
1487
1308
|
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
* re-adds (Buy Now REPLACES the cart) hands `/from-cart` a token bound to the
|
|
1492
|
-
* previous cart's hash, which is refused as `quote_token_stale` — a hand-off
|
|
1493
|
-
* dead-ended by a proof nobody asked for. And with no re-quote in between there
|
|
1494
|
-
* is nothing to replace it with, so the retry is refused identically.
|
|
1309
|
+
* Example:
|
|
1310
|
+
* - URL: https://mystore.com/product/abc?ref=deadbeef
|
|
1311
|
+
* - captureAffiliateFromUrl() stores "deadbeef" and returns it.
|
|
1495
1312
|
*
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1313
|
+
* Under LAST_CLICK (the default, and the only behaviour before ADR-0067) a new
|
|
1314
|
+
* `?ref=` replaces whatever was stored. Under FIRST_CLICK an existing,
|
|
1315
|
+
* unexpired attribution wins and the new code is NOT stored — the landing is
|
|
1316
|
+
* still reported to the server so the affiliate's click statistics stay
|
|
1317
|
+
* honest, but the credit stays with whoever was there first.
|
|
1318
|
+
*
|
|
1319
|
+
* The mode comes from the server, which means the FIRST landing in a browser
|
|
1320
|
+
* can never be blocked by it — correct, because there is nothing to protect
|
|
1321
|
+
* yet. From then on the mode travels with the stored entry.
|
|
1322
|
+
*
|
|
1323
|
+
* Enforcement is client-side. A buyer who edits localStorage can re-attribute
|
|
1324
|
+
* their own visit; this is the same trust level as the window itself and must
|
|
1325
|
+
* not be presented to merchants as fraud protection.
|
|
1502
1326
|
*/
|
|
1503
|
-
declare function
|
|
1504
|
-
declare function createCartBackup(): void;
|
|
1505
|
-
declare function restoreCartFromBackup(): boolean;
|
|
1506
|
-
declare function mergeBaskets(items: CartBasketMergeLine[]): CartItem[];
|
|
1507
|
-
declare function moveBasketItem(fromProductId: string, fromVariantId: string, toProductId: string, toVariantId: string): void;
|
|
1508
|
-
declare function validateCartIntegrity(): boolean;
|
|
1509
|
-
declare function getCartStats(): CartStats;
|
|
1510
|
-
/** @internal — read by checkout(); exported only across module boundaries. */
|
|
1511
|
-
declare function getLatestQuoteToken(): string | null;
|
|
1512
|
-
declare function quoteCart(coupon?: string, currency?: string): Promise<src.SDKResponse<CartQuote>>;
|
|
1513
|
-
|
|
1514
|
-
type CartLineIdentityInput = Pick<CartItem, 'product_id' | 'variant_id' | 'price_variant_id' | 'addons' | 'custom_fields' | 'price_data' | 'pay_what_you_want_price'>;
|
|
1515
|
-
declare function computeCartLineId(input: CartLineIdentityInput): string;
|
|
1516
|
-
declare function ensureCartLineId(item: CartItem): CartItem;
|
|
1327
|
+
declare function captureAffiliateFromUrl(param?: string): Promise<string | null>;
|
|
1517
1328
|
|
|
1518
1329
|
/**
|
|
1519
1330
|
* Checkout Module
|
|
@@ -1652,121 +1463,369 @@ declare function buildCheckoutUrl(couponOrOptions?: string | CheckoutOptions, op
|
|
|
1652
1463
|
*/
|
|
1653
1464
|
declare function buildCheckoutUrlSync(): never;
|
|
1654
1465
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
declare function
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
declare function
|
|
1466
|
+
declare function getCartCoupon(): string | null;
|
|
1467
|
+
declare function getCartCouponSource(): CartCodeSource | null;
|
|
1468
|
+
declare function setCartCoupon(coupon: string | null | undefined, source?: CartCodeSource): string | null;
|
|
1469
|
+
declare function clearCartCoupon(): void;
|
|
1470
|
+
declare function getCart(): CartItem[];
|
|
1471
|
+
/** Resolve a cart line_id for product+variant. When multiple configs exist, returns the first line. */
|
|
1472
|
+
declare function resolveCartLineId(productId: string, variantId: string, cart?: CartItem[]): string;
|
|
1473
|
+
declare function getCartItemCount(): number;
|
|
1474
|
+
declare function addToCart(productId: string, variantId: string, quantity?: number, options?: CartAddOptions): void;
|
|
1475
|
+
declare function setCartItem(productId: string, variantId: string, quantity?: number, options?: CartAddOptions): void;
|
|
1665
1476
|
/**
|
|
1666
|
-
*
|
|
1477
|
+
* Patch one cart line.
|
|
1667
1478
|
*
|
|
1668
|
-
*
|
|
1669
|
-
*
|
|
1670
|
-
*
|
|
1479
|
+
* TRI-STATE BOUNDS: `min_quantity`/`max_quantity` accept `null` to DELETE the
|
|
1480
|
+
* stored bound — see {@link CartItemUpdate}. `undefined` (or an absent key)
|
|
1481
|
+
* leaves it alone, which is why a removed ceiling needs its own spelling.
|
|
1482
|
+
*
|
|
1483
|
+
* NO-OP UPDATES DO NOT WRITE. An update that leaves the cart byte-identical
|
|
1484
|
+
* returns without touching storage: no metadata bump, no `version` increment,
|
|
1485
|
+
* and — because the storage write is what other tabs observe — no `storage`
|
|
1486
|
+
* event. Writing anyway made an ineffective heal indistinguishable from a real
|
|
1487
|
+
* cart change, and two tabs healing the same line could hand the event back and
|
|
1488
|
+
* forth indefinitely. Line-shape healing of a legacy stored row is NOT this
|
|
1489
|
+
* function's job: `normalizeCartItems` clamps and repairs on every READ, which
|
|
1490
|
+
* is the chokepoint every access already flows through.
|
|
1671
1491
|
*/
|
|
1672
|
-
declare function
|
|
1673
|
-
|
|
1674
|
-
mode: AffiliateAttributionMode;
|
|
1675
|
-
windowDays: number;
|
|
1676
|
-
/**
|
|
1677
|
-
* When this entry expires, as written. Reported so a hold that has to be put
|
|
1678
|
-
* back after an early overwrite keeps its original expiry — the window runs
|
|
1679
|
-
* from the click that earned it, not from the landing that failed to take it.
|
|
1680
|
-
*/
|
|
1681
|
-
expiresAt: number;
|
|
1682
|
-
} | null;
|
|
1683
|
-
declare function clearAffiliateCode(): void;
|
|
1684
|
-
declare function getAffiliateCode(): string | null;
|
|
1685
|
-
declare function trackAffiliateEvent(eventType: 'add_to_cart' | 'checkout_started', options?: {
|
|
1686
|
-
/**
|
|
1687
|
-
* The code the surrounding call actually resolved and submitted (e.g.
|
|
1688
|
-
* checkout()'s tri-state result). `null` means the caller explicitly
|
|
1689
|
-
* submitted WITHOUT a referral — no event is recorded, so an ambient
|
|
1690
|
-
* stored code is never credited for a sale it did not get. Omit the
|
|
1691
|
-
* options object entirely to attribute to the stored ambient code.
|
|
1692
|
-
*/
|
|
1693
|
-
code: string | null;
|
|
1694
|
-
/**
|
|
1695
|
-
* Overrides the per-browser-session dedupe key. checkout entry points
|
|
1696
|
-
* pass `inv:<invoiceId>` so every created invoice counts as exactly one
|
|
1697
|
-
* checkout — a session-wide key would drop the second checkout of a
|
|
1698
|
-
* buyer who orders twice in one session while both sales still count.
|
|
1699
|
-
*/
|
|
1700
|
-
dedupeKey?: string;
|
|
1701
|
-
}): Promise<void>;
|
|
1702
|
-
declare function validateAffiliateCode(code: string): Promise<SDKResponse<AffiliateValidation>>;
|
|
1492
|
+
declare function updateCartItem(lineId: string, updates: CartItemUpdate): void;
|
|
1493
|
+
declare function removeFromCart(lineId: string): void;
|
|
1703
1494
|
/**
|
|
1704
|
-
*
|
|
1495
|
+
* Discards the cart entirely — and with it the proof that describes it.
|
|
1705
1496
|
*
|
|
1706
|
-
*
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
*
|
|
1710
|
-
*
|
|
1711
|
-
* a
|
|
1497
|
+
* PAYMENT PATH. `latestQuoteToken` is evidence about a specific cart, and this
|
|
1498
|
+
* is the one mutation after which that cart does not exist in any form. Held
|
|
1499
|
+
* across the clear, the proof outlives its subject: a caller that clears and
|
|
1500
|
+
* re-adds (Buy Now REPLACES the cart) hands `/from-cart` a token bound to the
|
|
1501
|
+
* previous cart's hash, which is refused as `quote_token_stale` — a hand-off
|
|
1502
|
+
* dead-ended by a proof nobody asked for. And with no re-quote in between there
|
|
1503
|
+
* is nothing to replace it with, so the retry is refused identically.
|
|
1712
1504
|
*
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
* the
|
|
1716
|
-
*
|
|
1717
|
-
*
|
|
1718
|
-
*
|
|
1505
|
+
* Only this path clears it. Every OTHER mutation turns one cart into another
|
|
1506
|
+
* cart, where a proof that no longer matches is the server's to refuse: it
|
|
1507
|
+
* answers `quote_token_stale`, the surfaces re-quote, and the buyer approves the
|
|
1508
|
+
* new total. Dropping the proof there instead would silently remove the approved
|
|
1509
|
+
* -total ceiling from a checkout that raced the re-quote, which is the failure
|
|
1510
|
+
* the token exists to prevent.
|
|
1719
1511
|
*/
|
|
1720
|
-
declare function
|
|
1512
|
+
declare function clearCart(): void;
|
|
1513
|
+
declare function createCartBackup(): void;
|
|
1514
|
+
declare function restoreCartFromBackup(): boolean;
|
|
1515
|
+
declare function mergeBaskets(items: CartBasketMergeLine[]): CartItem[];
|
|
1516
|
+
declare function moveBasketItem(fromProductId: string, fromVariantId: string, toProductId: string, toVariantId: string): void;
|
|
1517
|
+
declare function validateCartIntegrity(): boolean;
|
|
1518
|
+
declare function getCartStats(): CartStats;
|
|
1519
|
+
/** @internal — read by checkout(); exported only across module boundaries. */
|
|
1520
|
+
declare function getLatestQuoteToken(): string | null;
|
|
1521
|
+
declare function quoteCart(coupon?: string, currency?: string): Promise<src.SDKResponse<CartQuote>>;
|
|
1522
|
+
|
|
1721
1523
|
/**
|
|
1722
|
-
*
|
|
1524
|
+
* Products Module
|
|
1723
1525
|
*
|
|
1724
|
-
*
|
|
1725
|
-
|
|
1726
|
-
|
|
1526
|
+
* API methods for product data.
|
|
1527
|
+
*/
|
|
1528
|
+
|
|
1529
|
+
interface GetStorefrontProductsPageOptions {
|
|
1530
|
+
cursor?: string | null;
|
|
1531
|
+
limit?: number;
|
|
1532
|
+
sort?: 'featured' | 'newest' | 'price-asc' | 'price-desc' | string | null;
|
|
1533
|
+
category?: string | null;
|
|
1534
|
+
hideOutOfStock?: boolean;
|
|
1535
|
+
}
|
|
1536
|
+
declare function getProducts(): Promise<SDKResponse<Product[]>>;
|
|
1537
|
+
declare function getStorefrontProductsPage(options?: GetStorefrontProductsPageOptions): Promise<SDKResponse<{
|
|
1538
|
+
products: Product[];
|
|
1539
|
+
pagination: CursorPagination | null;
|
|
1540
|
+
}>>;
|
|
1541
|
+
declare function getProduct(idOrSlug: string): Promise<SDKResponse<Product>>;
|
|
1542
|
+
declare function getCategories(): Promise<SDKResponse<string[]>>;
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Store Module
|
|
1727
1546
|
*
|
|
1728
|
-
*
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1547
|
+
* API methods for store data.
|
|
1548
|
+
*/
|
|
1549
|
+
|
|
1550
|
+
interface GetStorefrontOptions {
|
|
1551
|
+
productsLimit?: number;
|
|
1552
|
+
productsCursor?: string | null;
|
|
1553
|
+
}
|
|
1554
|
+
declare function getStore(): Promise<SDKResponse<Shop>>;
|
|
1555
|
+
declare function resolveStoreByDomain(domain?: string, apiBaseUrl?: string): Promise<SDKResponse<Shop>>;
|
|
1556
|
+
declare function getStorefront(options?: GetStorefrontOptions): Promise<SDKResponse<StorefrontData>>;
|
|
1557
|
+
declare function getStoreLogoUrl(): Promise<string | null>;
|
|
1558
|
+
declare function getStoreBannerUrl(): Promise<string | null>;
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* Typed OpenAPI client factory.
|
|
1733
1562
|
*
|
|
1734
|
-
*
|
|
1735
|
-
*
|
|
1736
|
-
*
|
|
1563
|
+
* Surfaces the generated `createApiClient` from `@shoppex/contracts` with the
|
|
1564
|
+
* SDK's configured `apiBaseUrl`. This lets consumers of `@shoppexio/storefront`
|
|
1565
|
+
* call any public Dev API endpoint with full end-to-end types without
|
|
1566
|
+
* rebuilding a client from scratch.
|
|
1737
1567
|
*
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1740
|
-
*
|
|
1568
|
+
* Prefer the high-level modules (`shoppex.getProducts()` etc.) for common
|
|
1569
|
+
* read flows — they handle caching, pagination defaults, and storefront
|
|
1570
|
+
* scoping. Drop down to `shoppex.client()` only when you need an endpoint
|
|
1571
|
+
* the high-level API does not cover yet.
|
|
1741
1572
|
*/
|
|
1742
|
-
declare function captureAffiliateFromUrl(param?: string): Promise<string | null>;
|
|
1743
1573
|
|
|
1574
|
+
type ApiClient = ReturnType<typeof createApiClient>;
|
|
1744
1575
|
/**
|
|
1745
|
-
*
|
|
1746
|
-
*
|
|
1747
|
-
*
|
|
1576
|
+
* Return a typed OpenAPI client bound to the SDK's configured API base URL.
|
|
1577
|
+
* The client is cached per base URL and recreated when the SDK is re-initialized
|
|
1578
|
+
* against a different host.
|
|
1748
1579
|
*/
|
|
1580
|
+
declare function getTypedClient(token?: string): ApiClient;
|
|
1749
1581
|
|
|
1750
|
-
|
|
1582
|
+
/**
|
|
1583
|
+
* SDK Configuration Management
|
|
1584
|
+
*/
|
|
1585
|
+
|
|
1586
|
+
declare function getConfig(): ShoppexConfig;
|
|
1587
|
+
declare function isInitialized(): boolean;
|
|
1751
1588
|
|
|
1752
1589
|
/**
|
|
1753
|
-
*
|
|
1590
|
+
* SDK Error Classes
|
|
1591
|
+
*/
|
|
1592
|
+
/**
|
|
1593
|
+
* `SDKResponse.code` of a priced read that asked for a currency the shop does
|
|
1594
|
+
* not sell in (ADR-0066). `errorParams.requested` names the currency,
|
|
1595
|
+
* `errorParams.available` lists the enabled ones.
|
|
1596
|
+
*/
|
|
1597
|
+
declare const CURRENCY_UNAVAILABLE_ERROR_CODE = "errors.storefront.currency_unavailable";
|
|
1598
|
+
declare class ShoppexError extends Error {
|
|
1599
|
+
readonly code: string;
|
|
1600
|
+
readonly statusCode?: number;
|
|
1601
|
+
constructor(message: string, code: string, statusCode?: number);
|
|
1602
|
+
}
|
|
1603
|
+
declare class NotInitializedError extends ShoppexError {
|
|
1604
|
+
constructor();
|
|
1605
|
+
}
|
|
1606
|
+
declare class NetworkError extends ShoppexError {
|
|
1607
|
+
constructor(message: string, statusCode?: number);
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* A refusal the SERVER made and named. `code` is the backend's `error_code`
|
|
1611
|
+
* (e.g. `errors.checkout.coupon_no_longer_valid`) — the branchable identity of
|
|
1612
|
+
* the refusal, stable across locales, unlike the localized `message`.
|
|
1754
1613
|
*
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1614
|
+
* Distinct from {@link NetworkError}, whose `code` is always `NETWORK_ERROR`:
|
|
1615
|
+
* that one means "the request did not produce a named answer".
|
|
1616
|
+
*/
|
|
1617
|
+
declare class ApiError extends ShoppexError {
|
|
1618
|
+
readonly errorParams?: Record<string, unknown>;
|
|
1619
|
+
constructor(message: string, code: string, statusCode?: number, errorParams?: Record<string, unknown>);
|
|
1620
|
+
}
|
|
1621
|
+
declare class ValidationError extends ShoppexError {
|
|
1622
|
+
readonly invalidFields?: string[];
|
|
1623
|
+
constructor(message: string, invalidFields?: string[]);
|
|
1624
|
+
}
|
|
1625
|
+
declare class CartError extends ShoppexError {
|
|
1626
|
+
constructor(message: string);
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
interface StorefrontCustomField {
|
|
1630
|
+
name: string;
|
|
1631
|
+
type: string;
|
|
1632
|
+
required: boolean;
|
|
1633
|
+
defaultValue: string;
|
|
1634
|
+
placeholder: string;
|
|
1635
|
+
regex?: string;
|
|
1636
|
+
/** Only on a `select`: the labels the buyer picks one of. */
|
|
1637
|
+
options?: string[];
|
|
1638
|
+
}
|
|
1639
|
+
declare function normalizeStorefrontCustomFields(raw: unknown): StorefrontCustomField[];
|
|
1640
|
+
declare function isStorefrontCheckboxCustomFieldValueChecked(value: string | undefined): boolean;
|
|
1641
|
+
declare function validateStorefrontCustomFieldValue(field: StorefrontCustomField, value: string): string | null;
|
|
1642
|
+
declare function buildStorefrontCustomFieldPayload(fields: StorefrontCustomField[], values: Record<string, string>): Record<string, string>;
|
|
1643
|
+
|
|
1644
|
+
type VariantLike = Pick<ProductVariant, 'stock' | 'orderable' | 'supplier_backed'> | Pick<PriceVariant, 'stock' | 'orderable' | 'supplier_backed'>;
|
|
1645
|
+
type ProductLike = Pick<Product, 'type' | 'stock' | 'orderable' | 'supplier_backed' | 'on_hold' | 'price_variants' | 'variants'> & {
|
|
1646
|
+
onHold?: boolean | number | string | null;
|
|
1647
|
+
is_on_hold?: boolean | number | string | null;
|
|
1648
|
+
isOnHold?: boolean | number | string | null;
|
|
1649
|
+
};
|
|
1650
|
+
declare function resolveVariantStockValue(variant: VariantLike | null | undefined): number;
|
|
1651
|
+
declare function resolveDisplayStock(product: ProductLike | null | undefined): number;
|
|
1652
|
+
declare function isProductOutOfStock(product: ProductLike | null | undefined): boolean;
|
|
1653
|
+
declare function isProductInStock(product: ProductLike | null | undefined): boolean;
|
|
1654
|
+
declare function isVariantOutOfStock(variant: VariantLike | null | undefined): boolean;
|
|
1655
|
+
|
|
1656
|
+
declare function buildStorefrontProductLookup(products?: Product[]): Map<string, Product>;
|
|
1657
|
+
declare function getStorefrontGroupProducts(group: ProductGroup, productsOrLookup?: Product[] | Map<string, Product>): Product[];
|
|
1658
|
+
declare function getMergedStorefrontProducts(products?: Product[]): Product[];
|
|
1659
|
+
|
|
1660
|
+
type StorefrontContactTicketInput = {
|
|
1661
|
+
shopSlug: string;
|
|
1662
|
+
email: string;
|
|
1663
|
+
message: string;
|
|
1664
|
+
title?: string;
|
|
1665
|
+
name?: string;
|
|
1666
|
+
invoiceId?: string;
|
|
1667
|
+
apiBaseUrl?: string;
|
|
1668
|
+
};
|
|
1669
|
+
type StorefrontContactTicketResult = {
|
|
1670
|
+
uniqid: string;
|
|
1671
|
+
};
|
|
1672
|
+
declare function resolveStorefrontApiBaseUrl(options?: {
|
|
1673
|
+
apiBaseUrl?: string;
|
|
1674
|
+
hostname?: string;
|
|
1675
|
+
}): string;
|
|
1676
|
+
declare function buildStorefrontContactMessage(input: {
|
|
1677
|
+
name?: string;
|
|
1678
|
+
message: string;
|
|
1679
|
+
maxLength?: number;
|
|
1680
|
+
}): string;
|
|
1681
|
+
declare function submitStorefrontContactTicket(input: StorefrontContactTicketInput): Promise<StorefrontContactTicketResult>;
|
|
1682
|
+
type StorefrontSocialLinks = {
|
|
1683
|
+
discord?: string | null;
|
|
1684
|
+
telegram?: string | null;
|
|
1685
|
+
};
|
|
1686
|
+
declare function resolveStorefrontSocialLinks(store: {
|
|
1687
|
+
discord_link?: string | null;
|
|
1688
|
+
telegram_link?: string | null;
|
|
1689
|
+
social?: Record<string, string | null | undefined> | null;
|
|
1690
|
+
} | null | undefined): StorefrontSocialLinks;
|
|
1691
|
+
|
|
1692
|
+
/**
|
|
1693
|
+
* Theme configuration types (framework agnostic)
|
|
1757
1694
|
*/
|
|
1695
|
+
type SettingFieldType = 'color' | 'text' | 'range' | 'select' | 'boolean' | 'image' | 'font' | 'richtext' | 'products' | 'images';
|
|
1696
|
+
interface BaseSettingField {
|
|
1697
|
+
type: SettingFieldType;
|
|
1698
|
+
label: string;
|
|
1699
|
+
description?: string;
|
|
1700
|
+
}
|
|
1701
|
+
interface ColorField extends BaseSettingField {
|
|
1702
|
+
type: 'color';
|
|
1703
|
+
default: string;
|
|
1704
|
+
}
|
|
1705
|
+
interface RangeField extends BaseSettingField {
|
|
1706
|
+
type: 'range';
|
|
1707
|
+
default: number;
|
|
1708
|
+
min: number;
|
|
1709
|
+
max: number;
|
|
1710
|
+
step?: number;
|
|
1711
|
+
unit?: string;
|
|
1712
|
+
}
|
|
1713
|
+
interface SelectField extends BaseSettingField {
|
|
1714
|
+
type: 'select';
|
|
1715
|
+
default: string;
|
|
1716
|
+
options: string[] | {
|
|
1717
|
+
value: string;
|
|
1718
|
+
label: string;
|
|
1719
|
+
}[];
|
|
1720
|
+
}
|
|
1721
|
+
interface BooleanField extends BaseSettingField {
|
|
1722
|
+
type: 'boolean';
|
|
1723
|
+
default: boolean;
|
|
1724
|
+
}
|
|
1725
|
+
interface TextField extends BaseSettingField {
|
|
1726
|
+
type: 'text';
|
|
1727
|
+
default: string;
|
|
1728
|
+
}
|
|
1729
|
+
interface ImageField extends BaseSettingField {
|
|
1730
|
+
type: 'image';
|
|
1731
|
+
default: string | null;
|
|
1732
|
+
}
|
|
1733
|
+
interface FontField extends BaseSettingField {
|
|
1734
|
+
type: 'font';
|
|
1735
|
+
default: string;
|
|
1736
|
+
options?: string[];
|
|
1737
|
+
}
|
|
1738
|
+
interface RichtextField extends BaseSettingField {
|
|
1739
|
+
type: 'richtext';
|
|
1740
|
+
default: string;
|
|
1741
|
+
}
|
|
1742
|
+
interface ProductsField extends BaseSettingField {
|
|
1743
|
+
type: 'products';
|
|
1744
|
+
default: string[];
|
|
1745
|
+
max?: number;
|
|
1746
|
+
}
|
|
1747
|
+
interface ImagesField extends BaseSettingField {
|
|
1748
|
+
type: 'images';
|
|
1749
|
+
default: string[];
|
|
1750
|
+
max?: number;
|
|
1751
|
+
}
|
|
1752
|
+
type SettingField = ColorField | RangeField | SelectField | BooleanField | TextField | ImageField | FontField | RichtextField | ProductsField | ImagesField;
|
|
1753
|
+
interface SectionDefinition {
|
|
1754
|
+
name: string;
|
|
1755
|
+
description?: string;
|
|
1756
|
+
icon?: string;
|
|
1757
|
+
settings: Record<string, SettingField>;
|
|
1758
|
+
}
|
|
1759
|
+
interface BlockDefinition {
|
|
1760
|
+
name: string;
|
|
1761
|
+
description?: string;
|
|
1762
|
+
icon?: string;
|
|
1763
|
+
settings: Record<string, SettingField>;
|
|
1764
|
+
allowedPages?: string[];
|
|
1765
|
+
maxPerPage?: number;
|
|
1766
|
+
}
|
|
1767
|
+
interface BlockInstance {
|
|
1768
|
+
id: string;
|
|
1769
|
+
type: string;
|
|
1770
|
+
visible?: boolean;
|
|
1771
|
+
settings?: Record<string, SettingValue>;
|
|
1772
|
+
}
|
|
1773
|
+
interface PageLayout {
|
|
1774
|
+
blocks: BlockInstance[];
|
|
1775
|
+
}
|
|
1776
|
+
interface ThemeBlockManifest {
|
|
1777
|
+
pages: string[];
|
|
1778
|
+
blocks: Record<string, BlockDefinition>;
|
|
1779
|
+
defaultLayouts?: Record<string, PageLayout>;
|
|
1780
|
+
}
|
|
1781
|
+
interface ThemeConfig {
|
|
1782
|
+
id: string;
|
|
1783
|
+
name: string;
|
|
1784
|
+
description?: string;
|
|
1785
|
+
version: string;
|
|
1786
|
+
author?: string;
|
|
1787
|
+
preview?: string;
|
|
1788
|
+
settings: Record<string, Record<string, SettingField>>;
|
|
1789
|
+
sections: Record<string, SectionDefinition>;
|
|
1790
|
+
blocks?: Record<string, BlockDefinition>;
|
|
1791
|
+
pageLayouts?: Record<string, PageLayout>;
|
|
1792
|
+
builder?: ThemeBlockManifest;
|
|
1793
|
+
}
|
|
1794
|
+
type SettingValue = string | number | boolean | null | string[] | Record<string, unknown>;
|
|
1795
|
+
type ResolvedThemeSettings = {
|
|
1796
|
+
[Category: string]: {
|
|
1797
|
+
[Key: string]: SettingValue;
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1758
1800
|
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1801
|
+
type JsonRecord = Record<string, unknown>;
|
|
1802
|
+
interface PublishedBuilderSettings {
|
|
1803
|
+
version: number;
|
|
1804
|
+
revision: number;
|
|
1805
|
+
theme: {
|
|
1806
|
+
content: JsonRecord;
|
|
1807
|
+
layout: JsonRecord;
|
|
1808
|
+
style_slots: JsonRecord;
|
|
1809
|
+
pages?: unknown[];
|
|
1810
|
+
terms?: JsonRecord;
|
|
1811
|
+
[key: string]: unknown;
|
|
1812
|
+
};
|
|
1813
|
+
[key: string]: unknown;
|
|
1767
1814
|
}
|
|
1768
|
-
|
|
1769
|
-
|
|
1815
|
+
interface PublishedThemeSettingsPayload {
|
|
1816
|
+
settings: ResolvedThemeSettings;
|
|
1817
|
+
builder_settings: PublishedBuilderSettings | null;
|
|
1818
|
+
content: JsonRecord;
|
|
1819
|
+
style_slots: JsonRecord;
|
|
1820
|
+
}
|
|
1821
|
+
declare function fetchPublishedBuilderSettings(shopSlug: string): Promise<PublishedThemeSettingsPayload | null>;
|
|
1822
|
+
declare function fetchPublishedThemeSettings(shopSlug: string): Promise<ResolvedThemeSettings | null>;
|
|
1823
|
+
declare function resolveDefaults(config: ThemeConfig): ResolvedThemeSettings;
|
|
1824
|
+
declare function mergeSettings(defaults: ResolvedThemeSettings, overrides: Partial<ResolvedThemeSettings>): ResolvedThemeSettings;
|
|
1825
|
+
|
|
1826
|
+
type CartLineIdentityInput = Pick<CartItem, 'product_id' | 'variant_id' | 'price_variant_id' | 'addons' | 'custom_fields' | 'price_data' | 'pay_what_you_want_price'>;
|
|
1827
|
+
declare function computeCartLineId(input: CartLineIdentityInput): string;
|
|
1828
|
+
declare function ensureCartLineId(item: CartItem): CartItem;
|
|
1770
1829
|
|
|
1771
1830
|
/**
|
|
1772
1831
|
* Customer Module
|
|
@@ -1892,6 +1951,7 @@ declare function subscriptionBillingHistory(uniqid: string): Promise<SDKResponse
|
|
|
1892
1951
|
declare function cancelSubscription(uniqid: string, options?: CustomerSubscriptionCancelOptions): Promise<SDKResponse<unknown>>;
|
|
1893
1952
|
declare function pauseSubscription(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
1894
1953
|
declare function resumeSubscription(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
1954
|
+
declare function undoSubscriptionCancel(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
1895
1955
|
declare function favorites(): Promise<SDKResponse<unknown>>;
|
|
1896
1956
|
/** Idempotent upstream, and a PUT — `customer-favorites.ts` has no POST route. */
|
|
1897
1957
|
declare function addFavorite(productUniqid: string): Promise<SDKResponse<unknown>>;
|
|
@@ -1964,56 +2024,6 @@ declare function resellerOrder(uniqid: string): Promise<SDKResponse<unknown>>;
|
|
|
1964
2024
|
declare function resellerWallet(): Promise<SDKResponse<unknown>>;
|
|
1965
2025
|
declare function resellerApiKeys(): Promise<SDKResponse<unknown>>;
|
|
1966
2026
|
|
|
1967
|
-
/**
|
|
1968
|
-
* Invoices Module
|
|
1969
|
-
*
|
|
1970
|
-
* Invoice status checking after payment.
|
|
1971
|
-
*/
|
|
1972
|
-
|
|
1973
|
-
declare function getInvoice(invoiceId: string): Promise<SDKResponse<Invoice>>;
|
|
1974
|
-
declare function getInvoiceStatus(invoiceId: string): Promise<SDKResponse<{
|
|
1975
|
-
status: string;
|
|
1976
|
-
}>>;
|
|
1977
|
-
|
|
1978
|
-
/**
|
|
1979
|
-
* Pages Module
|
|
1980
|
-
*
|
|
1981
|
-
* API methods for public pages.
|
|
1982
|
-
*/
|
|
1983
|
-
|
|
1984
|
-
/**
|
|
1985
|
-
* Get all public pages for the store
|
|
1986
|
-
*/
|
|
1987
|
-
declare function getPages(): Promise<SDKResponse<Page[]>>;
|
|
1988
|
-
/**
|
|
1989
|
-
* Get a public page by slug
|
|
1990
|
-
*/
|
|
1991
|
-
declare function getPage(slug: string): Promise<SDKResponse<Page>>;
|
|
1992
|
-
|
|
1993
|
-
/**
|
|
1994
|
-
* Navigation Module
|
|
1995
|
-
*
|
|
1996
|
-
* API methods for menus and navigation.
|
|
1997
|
-
*/
|
|
1998
|
-
|
|
1999
|
-
/**
|
|
2000
|
-
* Get all menus for the store
|
|
2001
|
-
*/
|
|
2002
|
-
declare function getMenus(): Promise<SDKResponse<Menu[]>>;
|
|
2003
|
-
/**
|
|
2004
|
-
* Get a menu by its exact title.
|
|
2005
|
-
*/
|
|
2006
|
-
declare function getMenuByTitle(title: string): Promise<SDKResponse<Menu>>;
|
|
2007
|
-
/**
|
|
2008
|
-
* Get a menu by its exact title.
|
|
2009
|
-
*/
|
|
2010
|
-
declare function getMenu(title: string): Promise<SDKResponse<Menu>>;
|
|
2011
|
-
/**
|
|
2012
|
-
* Get a menu by canonical slot. The backend resolves legacy menu titles too.
|
|
2013
|
-
*/
|
|
2014
|
-
declare function getMenuBySlot(slot: NavigationMenuSlot): Promise<SDKResponse<Menu>>;
|
|
2015
|
-
declare function getMenuSlotTitles(slot: NavigationMenuSlot): string[];
|
|
2016
|
-
|
|
2017
2027
|
/**
|
|
2018
2028
|
* Counts a page view. Call it once per page load or client-side navigation.
|
|
2019
2029
|
* Passing the cart also records it for the live visitor map.
|
|
@@ -2051,96 +2061,33 @@ declare function touchStorefrontPresence(): Promise<SDKResponse<{
|
|
|
2051
2061
|
}>>;
|
|
2052
2062
|
|
|
2053
2063
|
/**
|
|
2054
|
-
*
|
|
2064
|
+
* Navigation Module
|
|
2065
|
+
*
|
|
2066
|
+
* API methods for menus and navigation.
|
|
2055
2067
|
*/
|
|
2056
|
-
declare function createFormatter(currency?: string, locale?: string): Intl.NumberFormat;
|
|
2057
|
-
declare function formatPrice(amount: number | string, currency?: string, locale?: string): string;
|
|
2058
|
-
|
|
2059
|
-
interface CacheStats {
|
|
2060
|
-
hits: number;
|
|
2061
|
-
misses: number;
|
|
2062
|
-
pendingRequests: number;
|
|
2063
|
-
entries: number;
|
|
2064
|
-
}
|
|
2065
|
-
declare function getCacheStats(): CacheStats;
|
|
2066
|
-
declare function clearCache(): void;
|
|
2067
|
-
declare function invalidateCache(prefixOrKey: string): void;
|
|
2068
2068
|
|
|
2069
2069
|
/**
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
* Usage:
|
|
2073
|
-
* ```html
|
|
2074
|
-
* <script src="https://cdn.shoppex.io/sdk/v1.0/shoppex.umd.js"></script>
|
|
2075
|
-
* <script>
|
|
2076
|
-
* shoppex.init('my-store');
|
|
2077
|
-
*
|
|
2078
|
-
* shoppex.getStore().then(store => console.log(store));
|
|
2079
|
-
* shoppex.addToCart('product-id', 'variant-id', 2);
|
|
2080
|
-
* shoppex.checkout();
|
|
2081
|
-
* </script>
|
|
2082
|
-
* ```
|
|
2070
|
+
* Get all menus for the store
|
|
2083
2071
|
*/
|
|
2084
|
-
|
|
2072
|
+
declare function getMenus(): Promise<SDKResponse<Menu[]>>;
|
|
2073
|
+
/**
|
|
2074
|
+
* Get a menu by its exact title.
|
|
2075
|
+
*/
|
|
2076
|
+
declare function getMenuByTitle(title: string): Promise<SDKResponse<Menu>>;
|
|
2077
|
+
/**
|
|
2078
|
+
* Get a menu by its exact title.
|
|
2079
|
+
*/
|
|
2080
|
+
declare function getMenu(title: string): Promise<SDKResponse<Menu>>;
|
|
2085
2081
|
/**
|
|
2086
|
-
*
|
|
2082
|
+
* Get a menu by canonical slot. The backend resolves legacy menu titles too.
|
|
2087
2083
|
*/
|
|
2088
|
-
declare function
|
|
2089
|
-
declare function
|
|
2090
|
-
|
|
2091
|
-
}): void;
|
|
2084
|
+
declare function getMenuBySlot(slot: NavigationMenuSlot): Promise<SDKResponse<Menu>>;
|
|
2085
|
+
declare function getMenuSlotTitles(slot: NavigationMenuSlot): string[];
|
|
2086
|
+
|
|
2092
2087
|
/**
|
|
2093
2088
|
* Shoppex SDK instance
|
|
2094
2089
|
*/
|
|
2095
2090
|
declare const shoppex: {
|
|
2096
|
-
init: typeof init;
|
|
2097
|
-
isInitialized: typeof isInitialized;
|
|
2098
|
-
getConfig: typeof getConfig;
|
|
2099
|
-
client: typeof getTypedClient;
|
|
2100
|
-
getStore: typeof getStore;
|
|
2101
|
-
getStorefront: typeof getStorefront;
|
|
2102
|
-
getStoreLogoUrl: typeof getStoreLogoUrl;
|
|
2103
|
-
getStoreBannerUrl: typeof getStoreBannerUrl;
|
|
2104
|
-
resolveStoreByDomain: typeof resolveStoreByDomain;
|
|
2105
|
-
getProducts: typeof getProducts;
|
|
2106
|
-
getStorefrontProductsPage: typeof getStorefrontProductsPage;
|
|
2107
|
-
getProduct: typeof getProduct;
|
|
2108
|
-
getCategories: typeof getCategories;
|
|
2109
|
-
getCart: typeof getCart;
|
|
2110
|
-
getCartItemCount: typeof getCartItemCount;
|
|
2111
|
-
getCartCoupon: typeof getCartCoupon;
|
|
2112
|
-
getCartCouponSource: typeof getCartCouponSource;
|
|
2113
|
-
setCartCoupon: typeof setCartCoupon;
|
|
2114
|
-
clearCartCoupon: typeof clearCartCoupon;
|
|
2115
|
-
addToCart: typeof addToCart;
|
|
2116
|
-
setCartItem: typeof setCartItem;
|
|
2117
|
-
updateCartItem: typeof updateCartItem;
|
|
2118
|
-
removeFromCart: typeof removeFromCart;
|
|
2119
|
-
clearCart: typeof clearCart;
|
|
2120
|
-
createCartBackup: typeof createCartBackup;
|
|
2121
|
-
restoreCartFromBackup: typeof restoreCartFromBackup;
|
|
2122
|
-
mergeBaskets: typeof mergeBaskets;
|
|
2123
|
-
moveBasketItem: typeof moveBasketItem;
|
|
2124
|
-
getCartStats: typeof getCartStats;
|
|
2125
|
-
validateCartIntegrity: typeof validateCartIntegrity;
|
|
2126
|
-
quoteCart: typeof quoteCart;
|
|
2127
|
-
getLatestQuoteToken: typeof getLatestQuoteToken;
|
|
2128
|
-
resolveCartLineId: typeof resolveCartLineId;
|
|
2129
|
-
checkout: typeof checkout;
|
|
2130
|
-
buildCheckoutUrl: typeof buildCheckoutUrl;
|
|
2131
|
-
buildCheckoutUrlSync: typeof buildCheckoutUrlSync;
|
|
2132
|
-
getRequestedCheckoutCurrency: typeof getRequestedCheckoutCurrency;
|
|
2133
|
-
captureAffiliateFromUrl: typeof captureAffiliateFromUrl;
|
|
2134
|
-
validateAffiliateCode: typeof validateAffiliateCode;
|
|
2135
|
-
applyAffiliateCode: typeof applyAffiliateCode;
|
|
2136
|
-
getAffiliateCode: typeof getAffiliateCode;
|
|
2137
|
-
getStoredAffiliate: typeof getStoredAffiliate;
|
|
2138
|
-
setAffiliateCode: typeof setAffiliateCode;
|
|
2139
|
-
clearAffiliateCode: typeof clearAffiliateCode;
|
|
2140
|
-
trackAffiliateEvent: typeof trackAffiliateEvent;
|
|
2141
|
-
validateCoupon: typeof validateCoupon;
|
|
2142
|
-
getShopReviews: typeof getShopReviews;
|
|
2143
|
-
getShopReviewsPage: typeof getShopReviewsPage;
|
|
2144
2091
|
requestOtp: typeof requestOtp;
|
|
2145
2092
|
verifyOtp: typeof verifyOtp;
|
|
2146
2093
|
logout: typeof logout;
|
|
@@ -2158,6 +2105,7 @@ declare const shoppex: {
|
|
|
2158
2105
|
cancelSubscription: typeof cancelSubscription;
|
|
2159
2106
|
pauseSubscription: typeof pauseSubscription;
|
|
2160
2107
|
resumeSubscription: typeof resumeSubscription;
|
|
2108
|
+
undoSubscriptionCancel: typeof undoSubscriptionCancel;
|
|
2161
2109
|
favorites: typeof favorites;
|
|
2162
2110
|
addFavorite: typeof addFavorite;
|
|
2163
2111
|
removeFavorite: typeof removeFavorite;
|
|
@@ -2187,31 +2135,84 @@ declare const shoppex: {
|
|
|
2187
2135
|
resellerOrder: typeof resellerOrder;
|
|
2188
2136
|
resellerWallet: typeof resellerWallet;
|
|
2189
2137
|
resellerApiKeys: typeof resellerApiKeys;
|
|
2138
|
+
init: {
|
|
2139
|
+
(storeSlug: string, options?: src.ShoppexInitOptions): void;
|
|
2140
|
+
(options: src.ShoppexInitOptions & {
|
|
2141
|
+
storeId: string;
|
|
2142
|
+
}): void;
|
|
2143
|
+
};
|
|
2144
|
+
isInitialized: typeof isInitialized;
|
|
2145
|
+
getConfig: typeof getConfig;
|
|
2146
|
+
client: typeof getTypedClient;
|
|
2147
|
+
getStore: typeof getStore;
|
|
2148
|
+
getStorefront: typeof getStorefront;
|
|
2149
|
+
getStoreLogoUrl: typeof getStoreLogoUrl;
|
|
2150
|
+
getStoreBannerUrl: typeof getStoreBannerUrl;
|
|
2151
|
+
resolveStoreByDomain: typeof resolveStoreByDomain;
|
|
2152
|
+
getProducts: typeof getProducts;
|
|
2153
|
+
getStorefrontProductsPage: typeof getStorefrontProductsPage;
|
|
2154
|
+
getProduct: typeof getProduct;
|
|
2155
|
+
getCategories: typeof getCategories;
|
|
2156
|
+
getCart: typeof getCart;
|
|
2157
|
+
getCartItemCount: typeof getCartItemCount;
|
|
2158
|
+
getCartCoupon: typeof getCartCoupon;
|
|
2159
|
+
getCartCouponSource: typeof getCartCouponSource;
|
|
2160
|
+
setCartCoupon: typeof setCartCoupon;
|
|
2161
|
+
clearCartCoupon: typeof clearCartCoupon;
|
|
2162
|
+
addToCart: typeof addToCart;
|
|
2163
|
+
setCartItem: typeof setCartItem;
|
|
2164
|
+
updateCartItem: typeof updateCartItem;
|
|
2165
|
+
removeFromCart: typeof removeFromCart;
|
|
2166
|
+
clearCart: typeof clearCart;
|
|
2167
|
+
createCartBackup: typeof createCartBackup;
|
|
2168
|
+
restoreCartFromBackup: typeof restoreCartFromBackup;
|
|
2169
|
+
mergeBaskets: typeof mergeBaskets;
|
|
2170
|
+
moveBasketItem: typeof moveBasketItem;
|
|
2171
|
+
getCartStats: typeof getCartStats;
|
|
2172
|
+
validateCartIntegrity: typeof validateCartIntegrity;
|
|
2173
|
+
quoteCart: typeof quoteCart;
|
|
2174
|
+
getLatestQuoteToken: typeof getLatestQuoteToken;
|
|
2175
|
+
resolveCartLineId: typeof resolveCartLineId;
|
|
2176
|
+
checkout: typeof checkout;
|
|
2177
|
+
buildCheckoutUrl: typeof buildCheckoutUrl;
|
|
2178
|
+
buildCheckoutUrlSync: typeof buildCheckoutUrlSync;
|
|
2179
|
+
getRequestedCheckoutCurrency: typeof getRequestedCheckoutCurrency;
|
|
2180
|
+
captureAffiliateFromUrl: typeof captureAffiliateFromUrl;
|
|
2181
|
+
validateAffiliateCode: typeof validateAffiliateCode;
|
|
2182
|
+
applyAffiliateCode: typeof applyAffiliateCode;
|
|
2183
|
+
getAffiliateCode: typeof getAffiliateCode;
|
|
2184
|
+
getStoredAffiliate: typeof getStoredAffiliate;
|
|
2185
|
+
setAffiliateCode: typeof setAffiliateCode;
|
|
2186
|
+
clearAffiliateCode: typeof clearAffiliateCode;
|
|
2187
|
+
trackAffiliateEvent: typeof trackAffiliateEvent;
|
|
2188
|
+
validateCoupon: typeof validateCoupon;
|
|
2189
|
+
getShopReviews: typeof getShopReviews;
|
|
2190
|
+
getShopReviewsPage: typeof src.getShopReviewsPage;
|
|
2190
2191
|
searchProducts: typeof searchProducts;
|
|
2191
2192
|
searchCatalogItems: typeof searchCatalogItems;
|
|
2192
2193
|
getInvoice: typeof getInvoice;
|
|
2193
2194
|
getInvoiceStatus: typeof getInvoiceStatus;
|
|
2194
2195
|
getPages: typeof getPages;
|
|
2195
2196
|
getPage: typeof getPage;
|
|
2196
|
-
getMenus: typeof getMenus;
|
|
2197
|
-
getMenu: typeof getMenu;
|
|
2198
|
-
getMenuBySlot: typeof getMenuBySlot;
|
|
2199
|
-
getMenuByTitle: typeof getMenuByTitle;
|
|
2200
|
-
getMenuSlotTitles: typeof getMenuSlotTitles;
|
|
2201
|
-
trackPageView: typeof trackPageView;
|
|
2202
|
-
trackCartActivity: typeof trackCartActivity;
|
|
2203
|
-
getStorefrontOnlineUsers: typeof getStorefrontOnlineUsers;
|
|
2204
|
-
getStorefrontRecentSales: typeof getStorefrontRecentSales;
|
|
2205
|
-
touchStorefrontPresence: typeof touchStorefrontPresence;
|
|
2197
|
+
getMenus: typeof src.getMenus;
|
|
2198
|
+
getMenu: typeof src.getMenu;
|
|
2199
|
+
getMenuBySlot: typeof src.getMenuBySlot;
|
|
2200
|
+
getMenuByTitle: typeof src.getMenuByTitle;
|
|
2201
|
+
getMenuSlotTitles: typeof src.getMenuSlotTitles;
|
|
2202
|
+
trackPageView: typeof src.trackPageView;
|
|
2203
|
+
trackCartActivity: typeof src.trackCartActivity;
|
|
2204
|
+
getStorefrontOnlineUsers: typeof src.getStorefrontOnlineUsers;
|
|
2205
|
+
getStorefrontRecentSales: typeof src.getStorefrontRecentSales;
|
|
2206
|
+
touchStorefrontPresence: typeof src.touchStorefrontPresence;
|
|
2206
2207
|
createFormatter: typeof createFormatter;
|
|
2207
2208
|
formatPrice: typeof formatPrice;
|
|
2208
2209
|
clearCache: typeof clearCache;
|
|
2209
2210
|
invalidateCache: typeof invalidateCache;
|
|
2210
2211
|
getCacheStats: typeof getCacheStats;
|
|
2211
|
-
fetchPublishedBuilderSettings: typeof fetchPublishedBuilderSettings;
|
|
2212
|
-
fetchPublishedThemeSettings: typeof fetchPublishedThemeSettings;
|
|
2213
|
-
resolveDefaults: typeof resolveDefaults;
|
|
2214
|
-
mergeSettings: typeof mergeSettings;
|
|
2212
|
+
fetchPublishedBuilderSettings: typeof src.fetchPublishedBuilderSettings;
|
|
2213
|
+
fetchPublishedThemeSettings: typeof src.fetchPublishedThemeSettings;
|
|
2214
|
+
resolveDefaults: typeof src.resolveDefaults;
|
|
2215
|
+
mergeSettings: typeof src.mergeSettings;
|
|
2215
2216
|
};
|
|
2216
2217
|
|
|
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 };
|
|
2218
|
+
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, undoSubscriptionCancel, updateAvatar, updateEmailPreferences, updateNotificationPreferences, updateProfile, validateStorefrontCustomFieldValue, verifyOtp, warranties };
|