@simpleapps-com/augur-utils 2.0.18 → 2.0.21
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/dist/index.cjs +75 -117
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -171
- package/dist/index.d.ts +77 -171
- package/dist/index.js +71 -113
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { cn } from './web.cjs';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
+
import { State } from 'states-us';
|
|
4
|
+
export { State as USState } from 'states-us';
|
|
3
5
|
import 'clsx';
|
|
4
6
|
|
|
5
7
|
type TCartLine = {
|
|
@@ -258,6 +260,8 @@ type TInvMastDoc = {
|
|
|
258
260
|
userDefined: string[];
|
|
259
261
|
invMastText: string[];
|
|
260
262
|
stock: TStock;
|
|
263
|
+
brandName?: string;
|
|
264
|
+
parkerProductCd?: string;
|
|
261
265
|
onlineCd: number;
|
|
262
266
|
statusCd: number;
|
|
263
267
|
deleteFlag: string;
|
|
@@ -776,6 +780,7 @@ type TAccountQuery = {
|
|
|
776
780
|
TransactionSetupID?: string;
|
|
777
781
|
ExpressResponseCode?: string;
|
|
778
782
|
ExpressResponseMessage?: string;
|
|
783
|
+
ValidationCode?: string;
|
|
779
784
|
TruncatedCardNumber?: string;
|
|
780
785
|
ExpirationMonth?: string;
|
|
781
786
|
ExpirationYear?: string;
|
|
@@ -800,6 +805,26 @@ type TPaymentValidation = {
|
|
|
800
805
|
valid: boolean;
|
|
801
806
|
message?: string;
|
|
802
807
|
};
|
|
808
|
+
type CheckoutPayment = {
|
|
809
|
+
first_name: string;
|
|
810
|
+
last_name: string;
|
|
811
|
+
street_address1: string;
|
|
812
|
+
street_address2: string;
|
|
813
|
+
city: string;
|
|
814
|
+
state: string;
|
|
815
|
+
zip_code: string;
|
|
816
|
+
country: string;
|
|
817
|
+
processor: "invoice" | "element";
|
|
818
|
+
paymentType: "unified" | "invoice";
|
|
819
|
+
TransactionSetupID?: string;
|
|
820
|
+
PaymentAccountID?: string;
|
|
821
|
+
LastFour?: string;
|
|
822
|
+
ValidationCode?: string;
|
|
823
|
+
ExpirationMonth?: string;
|
|
824
|
+
ExpirationYear?: string;
|
|
825
|
+
PaymentBrand?: string;
|
|
826
|
+
Bin?: string;
|
|
827
|
+
};
|
|
803
828
|
|
|
804
829
|
type TCheckoutResult = {
|
|
805
830
|
checkoutUid?: number;
|
|
@@ -983,6 +1008,7 @@ interface ResolvedStock {
|
|
|
983
1008
|
quantity: number;
|
|
984
1009
|
isInStock: boolean;
|
|
985
1010
|
isLowStock: boolean;
|
|
1011
|
+
isDiscontinued: boolean;
|
|
986
1012
|
displayQuantity: number | null;
|
|
987
1013
|
}
|
|
988
1014
|
/**
|
|
@@ -996,20 +1022,17 @@ type SchemaAvailability = "https://schema.org/InStock" | "https://schema.org/Out
|
|
|
996
1022
|
/**
|
|
997
1023
|
* Maps resolved stock to a Schema.org availability URL.
|
|
998
1024
|
*
|
|
999
|
-
*
|
|
1000
|
-
*
|
|
1001
|
-
*
|
|
1002
|
-
* Returns `"https://schema.org/OutOfStock"` when `resolved` is null/undefined
|
|
1003
|
-
* and no back-order quantity exists.
|
|
1025
|
+
* - InStock: quantity > 0
|
|
1026
|
+
* - OutOfStock: discontinued at all locations with zero inventory
|
|
1027
|
+
* - BackOrder: zero stock but not discontinued (accepts backorders)
|
|
1004
1028
|
*/
|
|
1005
|
-
declare function getSchemaAvailability(resolved: ResolvedStock | null | undefined
|
|
1029
|
+
declare function getSchemaAvailability(resolved: ResolvedStock | null | undefined): SchemaAvailability;
|
|
1006
1030
|
|
|
1007
1031
|
interface BreadcrumbJsonLdItem {
|
|
1008
1032
|
name: string;
|
|
1009
1033
|
url: string;
|
|
1010
1034
|
}
|
|
1011
1035
|
declare function generateBreadcrumbJsonLd(items: BreadcrumbJsonLdItem[]): Record<string, unknown>;
|
|
1012
|
-
type SchemaCondition = "https://schema.org/NewCondition" | "https://schema.org/UsedCondition" | "https://schema.org/RefurbishedCondition";
|
|
1013
1036
|
interface ProductJsonLdAggregateRating {
|
|
1014
1037
|
ratingValue: number;
|
|
1015
1038
|
reviewCount: number;
|
|
@@ -1018,30 +1041,18 @@ interface ProductJsonLdSeller {
|
|
|
1018
1041
|
name: string;
|
|
1019
1042
|
url?: string;
|
|
1020
1043
|
}
|
|
1021
|
-
interface ProductJsonLdAttributeMapping {
|
|
1022
|
-
brand: string[];
|
|
1023
|
-
mpn: string[];
|
|
1024
|
-
color: string[];
|
|
1025
|
-
material: string[];
|
|
1026
|
-
size: string[];
|
|
1027
|
-
pattern: string[];
|
|
1028
|
-
}
|
|
1029
1044
|
interface ProductJsonLdOptions {
|
|
1030
1045
|
unitPrice: number;
|
|
1031
1046
|
currency?: string;
|
|
1032
1047
|
siteUrl?: string;
|
|
1033
1048
|
itemPath?: string;
|
|
1034
1049
|
seller?: ProductJsonLdSeller;
|
|
1035
|
-
condition?: SchemaCondition;
|
|
1036
1050
|
priceValidDays?: number;
|
|
1037
|
-
brandFallback?: string;
|
|
1038
1051
|
imageUrlTransform?: (path: string) => string;
|
|
1039
1052
|
returnPolicy?: Record<string, unknown>;
|
|
1040
1053
|
shippingDetails?: Record<string, unknown>;
|
|
1041
1054
|
aggregateRating?: ProductJsonLdAggregateRating;
|
|
1042
|
-
attributeMapping?: Partial<ProductJsonLdAttributeMapping>;
|
|
1043
1055
|
companyKey?: string;
|
|
1044
|
-
categoryResolver?: (categoryIds: number[]) => string | undefined;
|
|
1045
1056
|
weightUnit?: string;
|
|
1046
1057
|
dimensionUnit?: string;
|
|
1047
1058
|
overrides?: Record<string, unknown>;
|
|
@@ -1226,157 +1237,17 @@ declare const BillingAddressInvoiceSchema: v.ObjectSchema<{
|
|
|
1226
1237
|
type ShippingAddress = v.InferOutput<typeof ShippingAddressSchema>;
|
|
1227
1238
|
type BillingAddress = v.InferOutput<typeof BillingAddressSchema>;
|
|
1228
1239
|
|
|
1229
|
-
/**
|
|
1230
|
-
|
|
1231
|
-
*/
|
|
1232
|
-
declare const US_STATES:
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
readonly name: "Arkansas";
|
|
1241
|
-
}, {
|
|
1242
|
-
readonly code: "CA";
|
|
1243
|
-
readonly name: "California";
|
|
1244
|
-
}, {
|
|
1245
|
-
readonly code: "CO";
|
|
1246
|
-
readonly name: "Colorado";
|
|
1247
|
-
}, {
|
|
1248
|
-
readonly code: "CT";
|
|
1249
|
-
readonly name: "Connecticut";
|
|
1250
|
-
}, {
|
|
1251
|
-
readonly code: "DC";
|
|
1252
|
-
readonly name: "District of Columbia";
|
|
1253
|
-
}, {
|
|
1254
|
-
readonly code: "DE";
|
|
1255
|
-
readonly name: "Delaware";
|
|
1256
|
-
}, {
|
|
1257
|
-
readonly code: "FL";
|
|
1258
|
-
readonly name: "Florida";
|
|
1259
|
-
}, {
|
|
1260
|
-
readonly code: "GA";
|
|
1261
|
-
readonly name: "Georgia";
|
|
1262
|
-
}, {
|
|
1263
|
-
readonly code: "ID";
|
|
1264
|
-
readonly name: "Idaho";
|
|
1265
|
-
}, {
|
|
1266
|
-
readonly code: "IL";
|
|
1267
|
-
readonly name: "Illinois";
|
|
1268
|
-
}, {
|
|
1269
|
-
readonly code: "IN";
|
|
1270
|
-
readonly name: "Indiana";
|
|
1271
|
-
}, {
|
|
1272
|
-
readonly code: "IA";
|
|
1273
|
-
readonly name: "Iowa";
|
|
1274
|
-
}, {
|
|
1275
|
-
readonly code: "KS";
|
|
1276
|
-
readonly name: "Kansas";
|
|
1277
|
-
}, {
|
|
1278
|
-
readonly code: "KY";
|
|
1279
|
-
readonly name: "Kentucky";
|
|
1280
|
-
}, {
|
|
1281
|
-
readonly code: "LA";
|
|
1282
|
-
readonly name: "Louisiana";
|
|
1283
|
-
}, {
|
|
1284
|
-
readonly code: "ME";
|
|
1285
|
-
readonly name: "Maine";
|
|
1286
|
-
}, {
|
|
1287
|
-
readonly code: "MD";
|
|
1288
|
-
readonly name: "Maryland";
|
|
1289
|
-
}, {
|
|
1290
|
-
readonly code: "MA";
|
|
1291
|
-
readonly name: "Massachusetts";
|
|
1292
|
-
}, {
|
|
1293
|
-
readonly code: "MI";
|
|
1294
|
-
readonly name: "Michigan";
|
|
1295
|
-
}, {
|
|
1296
|
-
readonly code: "MN";
|
|
1297
|
-
readonly name: "Minnesota";
|
|
1298
|
-
}, {
|
|
1299
|
-
readonly code: "MS";
|
|
1300
|
-
readonly name: "Mississippi";
|
|
1301
|
-
}, {
|
|
1302
|
-
readonly code: "MO";
|
|
1303
|
-
readonly name: "Missouri";
|
|
1304
|
-
}, {
|
|
1305
|
-
readonly code: "MT";
|
|
1306
|
-
readonly name: "Montana";
|
|
1307
|
-
}, {
|
|
1308
|
-
readonly code: "NE";
|
|
1309
|
-
readonly name: "Nebraska";
|
|
1310
|
-
}, {
|
|
1311
|
-
readonly code: "NV";
|
|
1312
|
-
readonly name: "Nevada";
|
|
1313
|
-
}, {
|
|
1314
|
-
readonly code: "NH";
|
|
1315
|
-
readonly name: "New Hampshire";
|
|
1316
|
-
}, {
|
|
1317
|
-
readonly code: "NJ";
|
|
1318
|
-
readonly name: "New Jersey";
|
|
1319
|
-
}, {
|
|
1320
|
-
readonly code: "NM";
|
|
1321
|
-
readonly name: "New Mexico";
|
|
1322
|
-
}, {
|
|
1323
|
-
readonly code: "NY";
|
|
1324
|
-
readonly name: "New York";
|
|
1325
|
-
}, {
|
|
1326
|
-
readonly code: "NC";
|
|
1327
|
-
readonly name: "North Carolina";
|
|
1328
|
-
}, {
|
|
1329
|
-
readonly code: "ND";
|
|
1330
|
-
readonly name: "North Dakota";
|
|
1331
|
-
}, {
|
|
1332
|
-
readonly code: "OH";
|
|
1333
|
-
readonly name: "Ohio";
|
|
1334
|
-
}, {
|
|
1335
|
-
readonly code: "OK";
|
|
1336
|
-
readonly name: "Oklahoma";
|
|
1337
|
-
}, {
|
|
1338
|
-
readonly code: "OR";
|
|
1339
|
-
readonly name: "Oregon";
|
|
1340
|
-
}, {
|
|
1341
|
-
readonly code: "PA";
|
|
1342
|
-
readonly name: "Pennsylvania";
|
|
1343
|
-
}, {
|
|
1344
|
-
readonly code: "RI";
|
|
1345
|
-
readonly name: "Rhode Island";
|
|
1346
|
-
}, {
|
|
1347
|
-
readonly code: "SC";
|
|
1348
|
-
readonly name: "South Carolina";
|
|
1349
|
-
}, {
|
|
1350
|
-
readonly code: "SD";
|
|
1351
|
-
readonly name: "South Dakota";
|
|
1352
|
-
}, {
|
|
1353
|
-
readonly code: "TN";
|
|
1354
|
-
readonly name: "Tennessee";
|
|
1355
|
-
}, {
|
|
1356
|
-
readonly code: "TX";
|
|
1357
|
-
readonly name: "Texas";
|
|
1358
|
-
}, {
|
|
1359
|
-
readonly code: "UT";
|
|
1360
|
-
readonly name: "Utah";
|
|
1361
|
-
}, {
|
|
1362
|
-
readonly code: "VT";
|
|
1363
|
-
readonly name: "Vermont";
|
|
1364
|
-
}, {
|
|
1365
|
-
readonly code: "VA";
|
|
1366
|
-
readonly name: "Virginia";
|
|
1367
|
-
}, {
|
|
1368
|
-
readonly code: "WA";
|
|
1369
|
-
readonly name: "Washington";
|
|
1370
|
-
}, {
|
|
1371
|
-
readonly code: "WV";
|
|
1372
|
-
readonly name: "West Virginia";
|
|
1373
|
-
}, {
|
|
1374
|
-
readonly code: "WI";
|
|
1375
|
-
readonly name: "Wisconsin";
|
|
1376
|
-
}, {
|
|
1377
|
-
readonly code: "WY";
|
|
1378
|
-
readonly name: "Wyoming";
|
|
1379
|
-
}];
|
|
1240
|
+
/** All US states and territories — full data from states-us. */
|
|
1241
|
+
declare const US_STATES_FULL: State[];
|
|
1242
|
+
/** All US states and territories — backward-compatible {code, name} shape. */
|
|
1243
|
+
declare const US_STATES: {
|
|
1244
|
+
code: string;
|
|
1245
|
+
name: string;
|
|
1246
|
+
}[];
|
|
1247
|
+
/** Lower 48 contiguous states. */
|
|
1248
|
+
declare const CONTIGUOUS_STATES: State[];
|
|
1249
|
+
/** US territories (PR, GU, VI, AS, MP). */
|
|
1250
|
+
declare const US_TERRITORIES: State[];
|
|
1380
1251
|
type USStateCode = (typeof US_STATES)[number]["code"];
|
|
1381
1252
|
|
|
1382
1253
|
/**
|
|
@@ -1425,5 +1296,40 @@ interface ViewItemEventParams {
|
|
|
1425
1296
|
* Track view_item event to Google Analytics dataLayer.
|
|
1426
1297
|
*/
|
|
1427
1298
|
declare function trackViewItem({ itemId, itemName, price, category, }: ViewItemEventParams): void;
|
|
1299
|
+
interface TrackingItem {
|
|
1300
|
+
item_id: string;
|
|
1301
|
+
item_name: string;
|
|
1302
|
+
currency: string;
|
|
1303
|
+
index: number;
|
|
1304
|
+
item_category: string;
|
|
1305
|
+
price: number;
|
|
1306
|
+
quantity: number;
|
|
1307
|
+
}
|
|
1308
|
+
interface TrackingData {
|
|
1309
|
+
event: string;
|
|
1310
|
+
currency: string;
|
|
1311
|
+
value: number;
|
|
1312
|
+
items: TrackingItem[];
|
|
1313
|
+
}
|
|
1314
|
+
interface BuildTrackingDataInput {
|
|
1315
|
+
cartLines: {
|
|
1316
|
+
itemId: string;
|
|
1317
|
+
quantity: number;
|
|
1318
|
+
}[];
|
|
1319
|
+
itemDetails: Record<string, {
|
|
1320
|
+
itemDesc?: string;
|
|
1321
|
+
classId5?: string;
|
|
1322
|
+
}>;
|
|
1323
|
+
getUnitPrice: (itemId: string) => number;
|
|
1324
|
+
currency?: string;
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Build a GA4 begin_checkout ecommerce payload from cart lines, item details, and prices.
|
|
1328
|
+
*/
|
|
1329
|
+
declare function buildTrackingData({ cartLines, itemDetails, getUnitPrice, currency, }: BuildTrackingDataInput): TrackingData;
|
|
1330
|
+
/**
|
|
1331
|
+
* Push ecommerce tracking data to window.dataLayer using the GA4 clear-then-push pattern.
|
|
1332
|
+
*/
|
|
1333
|
+
declare function pushTrackingData(data: TrackingData): void;
|
|
1428
1334
|
|
|
1429
|
-
export { type AddToCartEventParams, BLUR_DATA_URL, type BillingAddress, BillingAddressInvoiceSchema, BillingAddressSchema, type BreadcrumbJsonLdItem, CACHE_CONFIG, type CacheTier, type CheckoutInput, type CustomerDocument, type DerivePriceInput, type DerivedPrice, type ImageConfig, type ImageTransforms, type ImageUrlOptions, type MenuItem, type OeHdr, type OeLine, type OrderHeader, type OrderLine, type OrderNote, type OrderPayment, type PaymentStatus, type PaymentStatusInvoice, type ProductJsonLdAggregateRating, type
|
|
1335
|
+
export { type AddToCartEventParams, BLUR_DATA_URL, type BillingAddress, BillingAddressInvoiceSchema, BillingAddressSchema, type BreadcrumbJsonLdItem, type BuildTrackingDataInput, CACHE_CONFIG, CONTIGUOUS_STATES, type CacheTier, type CheckoutInput, type CheckoutPayment, type CustomerDocument, type DerivePriceInput, type DerivedPrice, type ImageConfig, type ImageTransforms, type ImageUrlOptions, type MenuItem, type OeHdr, type OeLine, type OrderHeader, type OrderLine, type OrderNote, type OrderPayment, type PaymentStatus, type PaymentStatusInvoice, type ProductJsonLdAggregateRating, type ProductJsonLdOptions, type ProductJsonLdSeller, type ResolveStockInput, type ResolvedStock, type SafeActionResult, type SchemaAvailability, type ShipToAddress, type ShippingAddress, ShippingAddressSchema, type TAccountQuery, type TApiResponse, type TAttribute, type TAttributeValue, type TBillingUpdate, type TCardInfo, type TCartHdrUid, type TCartLine, type TCartLookUp, type TCategory, type TCategoryChild, type TCategoryItemsResult, type TCheckoutResult, type TInvMast, type TInvMastDoc, type TInventorySupplier, type TItemAccessory, type TItemAttribute, type TItemAttributes, type TItemCategory, type TItemDetails, type TItemRelatedProduct, type TItemUom, type TItemsFilters, type TJoomlaContent, type TJoomlaContentFilters, type TLibraryPriceBreak, type TLibraryPriceData, type TLtlRatesResponse, type TLtlShipmentData, type TMenu, type TMenuFilters, type TMetaTags, type TOrderCartLine, type TPasswordVerification, type TPaymentValidation, type TPriceData, type TProductCategory, type TProductItem, type TProductStockData, type TProfileValues, type TRelatedProduct, type TSearchSuggestion, type TSearchSuggestionsResponse, type TShippingMethod, type TSmartyStreets, type TStock, type TStockData, type TSurcharge, type TTax, type TTaxItem, type TTransactionSetup, type TUserProfile, type TWebDesc, type TrackingData, type TrackingItem, type USStateCode, US_STATES, US_STATES_FULL, US_TERRITORIES, type UserAddress, VALIDATION_PATTERNS, type ViewItemEventParams, buildCheckoutPayload, buildImageLoader, buildTrackingData, createImageConfig, derivePrice, formatPrice, generateBreadcrumbJsonLd, generateProductJsonLd, getBusinessDay, getDefaultImageUrl, getImageSrcSet, getImageUrl, getPaymentStatus, getSchemaAvailability, getShippingLeadDate, isAddressDifferent, normalizePath, pushTrackingData, resolveStock, sanitizeHtmlImages, serializeTransforms, trackAddToCart, trackViewItem, transformShipToAddress, unwrap, unwrapOr };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { cn } from './web.js';
|
|
2
2
|
import * as v from 'valibot';
|
|
3
|
+
import { State } from 'states-us';
|
|
4
|
+
export { State as USState } from 'states-us';
|
|
3
5
|
import 'clsx';
|
|
4
6
|
|
|
5
7
|
type TCartLine = {
|
|
@@ -258,6 +260,8 @@ type TInvMastDoc = {
|
|
|
258
260
|
userDefined: string[];
|
|
259
261
|
invMastText: string[];
|
|
260
262
|
stock: TStock;
|
|
263
|
+
brandName?: string;
|
|
264
|
+
parkerProductCd?: string;
|
|
261
265
|
onlineCd: number;
|
|
262
266
|
statusCd: number;
|
|
263
267
|
deleteFlag: string;
|
|
@@ -776,6 +780,7 @@ type TAccountQuery = {
|
|
|
776
780
|
TransactionSetupID?: string;
|
|
777
781
|
ExpressResponseCode?: string;
|
|
778
782
|
ExpressResponseMessage?: string;
|
|
783
|
+
ValidationCode?: string;
|
|
779
784
|
TruncatedCardNumber?: string;
|
|
780
785
|
ExpirationMonth?: string;
|
|
781
786
|
ExpirationYear?: string;
|
|
@@ -800,6 +805,26 @@ type TPaymentValidation = {
|
|
|
800
805
|
valid: boolean;
|
|
801
806
|
message?: string;
|
|
802
807
|
};
|
|
808
|
+
type CheckoutPayment = {
|
|
809
|
+
first_name: string;
|
|
810
|
+
last_name: string;
|
|
811
|
+
street_address1: string;
|
|
812
|
+
street_address2: string;
|
|
813
|
+
city: string;
|
|
814
|
+
state: string;
|
|
815
|
+
zip_code: string;
|
|
816
|
+
country: string;
|
|
817
|
+
processor: "invoice" | "element";
|
|
818
|
+
paymentType: "unified" | "invoice";
|
|
819
|
+
TransactionSetupID?: string;
|
|
820
|
+
PaymentAccountID?: string;
|
|
821
|
+
LastFour?: string;
|
|
822
|
+
ValidationCode?: string;
|
|
823
|
+
ExpirationMonth?: string;
|
|
824
|
+
ExpirationYear?: string;
|
|
825
|
+
PaymentBrand?: string;
|
|
826
|
+
Bin?: string;
|
|
827
|
+
};
|
|
803
828
|
|
|
804
829
|
type TCheckoutResult = {
|
|
805
830
|
checkoutUid?: number;
|
|
@@ -983,6 +1008,7 @@ interface ResolvedStock {
|
|
|
983
1008
|
quantity: number;
|
|
984
1009
|
isInStock: boolean;
|
|
985
1010
|
isLowStock: boolean;
|
|
1011
|
+
isDiscontinued: boolean;
|
|
986
1012
|
displayQuantity: number | null;
|
|
987
1013
|
}
|
|
988
1014
|
/**
|
|
@@ -996,20 +1022,17 @@ type SchemaAvailability = "https://schema.org/InStock" | "https://schema.org/Out
|
|
|
996
1022
|
/**
|
|
997
1023
|
* Maps resolved stock to a Schema.org availability URL.
|
|
998
1024
|
*
|
|
999
|
-
*
|
|
1000
|
-
*
|
|
1001
|
-
*
|
|
1002
|
-
* Returns `"https://schema.org/OutOfStock"` when `resolved` is null/undefined
|
|
1003
|
-
* and no back-order quantity exists.
|
|
1025
|
+
* - InStock: quantity > 0
|
|
1026
|
+
* - OutOfStock: discontinued at all locations with zero inventory
|
|
1027
|
+
* - BackOrder: zero stock but not discontinued (accepts backorders)
|
|
1004
1028
|
*/
|
|
1005
|
-
declare function getSchemaAvailability(resolved: ResolvedStock | null | undefined
|
|
1029
|
+
declare function getSchemaAvailability(resolved: ResolvedStock | null | undefined): SchemaAvailability;
|
|
1006
1030
|
|
|
1007
1031
|
interface BreadcrumbJsonLdItem {
|
|
1008
1032
|
name: string;
|
|
1009
1033
|
url: string;
|
|
1010
1034
|
}
|
|
1011
1035
|
declare function generateBreadcrumbJsonLd(items: BreadcrumbJsonLdItem[]): Record<string, unknown>;
|
|
1012
|
-
type SchemaCondition = "https://schema.org/NewCondition" | "https://schema.org/UsedCondition" | "https://schema.org/RefurbishedCondition";
|
|
1013
1036
|
interface ProductJsonLdAggregateRating {
|
|
1014
1037
|
ratingValue: number;
|
|
1015
1038
|
reviewCount: number;
|
|
@@ -1018,30 +1041,18 @@ interface ProductJsonLdSeller {
|
|
|
1018
1041
|
name: string;
|
|
1019
1042
|
url?: string;
|
|
1020
1043
|
}
|
|
1021
|
-
interface ProductJsonLdAttributeMapping {
|
|
1022
|
-
brand: string[];
|
|
1023
|
-
mpn: string[];
|
|
1024
|
-
color: string[];
|
|
1025
|
-
material: string[];
|
|
1026
|
-
size: string[];
|
|
1027
|
-
pattern: string[];
|
|
1028
|
-
}
|
|
1029
1044
|
interface ProductJsonLdOptions {
|
|
1030
1045
|
unitPrice: number;
|
|
1031
1046
|
currency?: string;
|
|
1032
1047
|
siteUrl?: string;
|
|
1033
1048
|
itemPath?: string;
|
|
1034
1049
|
seller?: ProductJsonLdSeller;
|
|
1035
|
-
condition?: SchemaCondition;
|
|
1036
1050
|
priceValidDays?: number;
|
|
1037
|
-
brandFallback?: string;
|
|
1038
1051
|
imageUrlTransform?: (path: string) => string;
|
|
1039
1052
|
returnPolicy?: Record<string, unknown>;
|
|
1040
1053
|
shippingDetails?: Record<string, unknown>;
|
|
1041
1054
|
aggregateRating?: ProductJsonLdAggregateRating;
|
|
1042
|
-
attributeMapping?: Partial<ProductJsonLdAttributeMapping>;
|
|
1043
1055
|
companyKey?: string;
|
|
1044
|
-
categoryResolver?: (categoryIds: number[]) => string | undefined;
|
|
1045
1056
|
weightUnit?: string;
|
|
1046
1057
|
dimensionUnit?: string;
|
|
1047
1058
|
overrides?: Record<string, unknown>;
|
|
@@ -1226,157 +1237,17 @@ declare const BillingAddressInvoiceSchema: v.ObjectSchema<{
|
|
|
1226
1237
|
type ShippingAddress = v.InferOutput<typeof ShippingAddressSchema>;
|
|
1227
1238
|
type BillingAddress = v.InferOutput<typeof BillingAddressSchema>;
|
|
1228
1239
|
|
|
1229
|
-
/**
|
|
1230
|
-
|
|
1231
|
-
*/
|
|
1232
|
-
declare const US_STATES:
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
readonly name: "Arkansas";
|
|
1241
|
-
}, {
|
|
1242
|
-
readonly code: "CA";
|
|
1243
|
-
readonly name: "California";
|
|
1244
|
-
}, {
|
|
1245
|
-
readonly code: "CO";
|
|
1246
|
-
readonly name: "Colorado";
|
|
1247
|
-
}, {
|
|
1248
|
-
readonly code: "CT";
|
|
1249
|
-
readonly name: "Connecticut";
|
|
1250
|
-
}, {
|
|
1251
|
-
readonly code: "DC";
|
|
1252
|
-
readonly name: "District of Columbia";
|
|
1253
|
-
}, {
|
|
1254
|
-
readonly code: "DE";
|
|
1255
|
-
readonly name: "Delaware";
|
|
1256
|
-
}, {
|
|
1257
|
-
readonly code: "FL";
|
|
1258
|
-
readonly name: "Florida";
|
|
1259
|
-
}, {
|
|
1260
|
-
readonly code: "GA";
|
|
1261
|
-
readonly name: "Georgia";
|
|
1262
|
-
}, {
|
|
1263
|
-
readonly code: "ID";
|
|
1264
|
-
readonly name: "Idaho";
|
|
1265
|
-
}, {
|
|
1266
|
-
readonly code: "IL";
|
|
1267
|
-
readonly name: "Illinois";
|
|
1268
|
-
}, {
|
|
1269
|
-
readonly code: "IN";
|
|
1270
|
-
readonly name: "Indiana";
|
|
1271
|
-
}, {
|
|
1272
|
-
readonly code: "IA";
|
|
1273
|
-
readonly name: "Iowa";
|
|
1274
|
-
}, {
|
|
1275
|
-
readonly code: "KS";
|
|
1276
|
-
readonly name: "Kansas";
|
|
1277
|
-
}, {
|
|
1278
|
-
readonly code: "KY";
|
|
1279
|
-
readonly name: "Kentucky";
|
|
1280
|
-
}, {
|
|
1281
|
-
readonly code: "LA";
|
|
1282
|
-
readonly name: "Louisiana";
|
|
1283
|
-
}, {
|
|
1284
|
-
readonly code: "ME";
|
|
1285
|
-
readonly name: "Maine";
|
|
1286
|
-
}, {
|
|
1287
|
-
readonly code: "MD";
|
|
1288
|
-
readonly name: "Maryland";
|
|
1289
|
-
}, {
|
|
1290
|
-
readonly code: "MA";
|
|
1291
|
-
readonly name: "Massachusetts";
|
|
1292
|
-
}, {
|
|
1293
|
-
readonly code: "MI";
|
|
1294
|
-
readonly name: "Michigan";
|
|
1295
|
-
}, {
|
|
1296
|
-
readonly code: "MN";
|
|
1297
|
-
readonly name: "Minnesota";
|
|
1298
|
-
}, {
|
|
1299
|
-
readonly code: "MS";
|
|
1300
|
-
readonly name: "Mississippi";
|
|
1301
|
-
}, {
|
|
1302
|
-
readonly code: "MO";
|
|
1303
|
-
readonly name: "Missouri";
|
|
1304
|
-
}, {
|
|
1305
|
-
readonly code: "MT";
|
|
1306
|
-
readonly name: "Montana";
|
|
1307
|
-
}, {
|
|
1308
|
-
readonly code: "NE";
|
|
1309
|
-
readonly name: "Nebraska";
|
|
1310
|
-
}, {
|
|
1311
|
-
readonly code: "NV";
|
|
1312
|
-
readonly name: "Nevada";
|
|
1313
|
-
}, {
|
|
1314
|
-
readonly code: "NH";
|
|
1315
|
-
readonly name: "New Hampshire";
|
|
1316
|
-
}, {
|
|
1317
|
-
readonly code: "NJ";
|
|
1318
|
-
readonly name: "New Jersey";
|
|
1319
|
-
}, {
|
|
1320
|
-
readonly code: "NM";
|
|
1321
|
-
readonly name: "New Mexico";
|
|
1322
|
-
}, {
|
|
1323
|
-
readonly code: "NY";
|
|
1324
|
-
readonly name: "New York";
|
|
1325
|
-
}, {
|
|
1326
|
-
readonly code: "NC";
|
|
1327
|
-
readonly name: "North Carolina";
|
|
1328
|
-
}, {
|
|
1329
|
-
readonly code: "ND";
|
|
1330
|
-
readonly name: "North Dakota";
|
|
1331
|
-
}, {
|
|
1332
|
-
readonly code: "OH";
|
|
1333
|
-
readonly name: "Ohio";
|
|
1334
|
-
}, {
|
|
1335
|
-
readonly code: "OK";
|
|
1336
|
-
readonly name: "Oklahoma";
|
|
1337
|
-
}, {
|
|
1338
|
-
readonly code: "OR";
|
|
1339
|
-
readonly name: "Oregon";
|
|
1340
|
-
}, {
|
|
1341
|
-
readonly code: "PA";
|
|
1342
|
-
readonly name: "Pennsylvania";
|
|
1343
|
-
}, {
|
|
1344
|
-
readonly code: "RI";
|
|
1345
|
-
readonly name: "Rhode Island";
|
|
1346
|
-
}, {
|
|
1347
|
-
readonly code: "SC";
|
|
1348
|
-
readonly name: "South Carolina";
|
|
1349
|
-
}, {
|
|
1350
|
-
readonly code: "SD";
|
|
1351
|
-
readonly name: "South Dakota";
|
|
1352
|
-
}, {
|
|
1353
|
-
readonly code: "TN";
|
|
1354
|
-
readonly name: "Tennessee";
|
|
1355
|
-
}, {
|
|
1356
|
-
readonly code: "TX";
|
|
1357
|
-
readonly name: "Texas";
|
|
1358
|
-
}, {
|
|
1359
|
-
readonly code: "UT";
|
|
1360
|
-
readonly name: "Utah";
|
|
1361
|
-
}, {
|
|
1362
|
-
readonly code: "VT";
|
|
1363
|
-
readonly name: "Vermont";
|
|
1364
|
-
}, {
|
|
1365
|
-
readonly code: "VA";
|
|
1366
|
-
readonly name: "Virginia";
|
|
1367
|
-
}, {
|
|
1368
|
-
readonly code: "WA";
|
|
1369
|
-
readonly name: "Washington";
|
|
1370
|
-
}, {
|
|
1371
|
-
readonly code: "WV";
|
|
1372
|
-
readonly name: "West Virginia";
|
|
1373
|
-
}, {
|
|
1374
|
-
readonly code: "WI";
|
|
1375
|
-
readonly name: "Wisconsin";
|
|
1376
|
-
}, {
|
|
1377
|
-
readonly code: "WY";
|
|
1378
|
-
readonly name: "Wyoming";
|
|
1379
|
-
}];
|
|
1240
|
+
/** All US states and territories — full data from states-us. */
|
|
1241
|
+
declare const US_STATES_FULL: State[];
|
|
1242
|
+
/** All US states and territories — backward-compatible {code, name} shape. */
|
|
1243
|
+
declare const US_STATES: {
|
|
1244
|
+
code: string;
|
|
1245
|
+
name: string;
|
|
1246
|
+
}[];
|
|
1247
|
+
/** Lower 48 contiguous states. */
|
|
1248
|
+
declare const CONTIGUOUS_STATES: State[];
|
|
1249
|
+
/** US territories (PR, GU, VI, AS, MP). */
|
|
1250
|
+
declare const US_TERRITORIES: State[];
|
|
1380
1251
|
type USStateCode = (typeof US_STATES)[number]["code"];
|
|
1381
1252
|
|
|
1382
1253
|
/**
|
|
@@ -1425,5 +1296,40 @@ interface ViewItemEventParams {
|
|
|
1425
1296
|
* Track view_item event to Google Analytics dataLayer.
|
|
1426
1297
|
*/
|
|
1427
1298
|
declare function trackViewItem({ itemId, itemName, price, category, }: ViewItemEventParams): void;
|
|
1299
|
+
interface TrackingItem {
|
|
1300
|
+
item_id: string;
|
|
1301
|
+
item_name: string;
|
|
1302
|
+
currency: string;
|
|
1303
|
+
index: number;
|
|
1304
|
+
item_category: string;
|
|
1305
|
+
price: number;
|
|
1306
|
+
quantity: number;
|
|
1307
|
+
}
|
|
1308
|
+
interface TrackingData {
|
|
1309
|
+
event: string;
|
|
1310
|
+
currency: string;
|
|
1311
|
+
value: number;
|
|
1312
|
+
items: TrackingItem[];
|
|
1313
|
+
}
|
|
1314
|
+
interface BuildTrackingDataInput {
|
|
1315
|
+
cartLines: {
|
|
1316
|
+
itemId: string;
|
|
1317
|
+
quantity: number;
|
|
1318
|
+
}[];
|
|
1319
|
+
itemDetails: Record<string, {
|
|
1320
|
+
itemDesc?: string;
|
|
1321
|
+
classId5?: string;
|
|
1322
|
+
}>;
|
|
1323
|
+
getUnitPrice: (itemId: string) => number;
|
|
1324
|
+
currency?: string;
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Build a GA4 begin_checkout ecommerce payload from cart lines, item details, and prices.
|
|
1328
|
+
*/
|
|
1329
|
+
declare function buildTrackingData({ cartLines, itemDetails, getUnitPrice, currency, }: BuildTrackingDataInput): TrackingData;
|
|
1330
|
+
/**
|
|
1331
|
+
* Push ecommerce tracking data to window.dataLayer using the GA4 clear-then-push pattern.
|
|
1332
|
+
*/
|
|
1333
|
+
declare function pushTrackingData(data: TrackingData): void;
|
|
1428
1334
|
|
|
1429
|
-
export { type AddToCartEventParams, BLUR_DATA_URL, type BillingAddress, BillingAddressInvoiceSchema, BillingAddressSchema, type BreadcrumbJsonLdItem, CACHE_CONFIG, type CacheTier, type CheckoutInput, type CustomerDocument, type DerivePriceInput, type DerivedPrice, type ImageConfig, type ImageTransforms, type ImageUrlOptions, type MenuItem, type OeHdr, type OeLine, type OrderHeader, type OrderLine, type OrderNote, type OrderPayment, type PaymentStatus, type PaymentStatusInvoice, type ProductJsonLdAggregateRating, type
|
|
1335
|
+
export { type AddToCartEventParams, BLUR_DATA_URL, type BillingAddress, BillingAddressInvoiceSchema, BillingAddressSchema, type BreadcrumbJsonLdItem, type BuildTrackingDataInput, CACHE_CONFIG, CONTIGUOUS_STATES, type CacheTier, type CheckoutInput, type CheckoutPayment, type CustomerDocument, type DerivePriceInput, type DerivedPrice, type ImageConfig, type ImageTransforms, type ImageUrlOptions, type MenuItem, type OeHdr, type OeLine, type OrderHeader, type OrderLine, type OrderNote, type OrderPayment, type PaymentStatus, type PaymentStatusInvoice, type ProductJsonLdAggregateRating, type ProductJsonLdOptions, type ProductJsonLdSeller, type ResolveStockInput, type ResolvedStock, type SafeActionResult, type SchemaAvailability, type ShipToAddress, type ShippingAddress, ShippingAddressSchema, type TAccountQuery, type TApiResponse, type TAttribute, type TAttributeValue, type TBillingUpdate, type TCardInfo, type TCartHdrUid, type TCartLine, type TCartLookUp, type TCategory, type TCategoryChild, type TCategoryItemsResult, type TCheckoutResult, type TInvMast, type TInvMastDoc, type TInventorySupplier, type TItemAccessory, type TItemAttribute, type TItemAttributes, type TItemCategory, type TItemDetails, type TItemRelatedProduct, type TItemUom, type TItemsFilters, type TJoomlaContent, type TJoomlaContentFilters, type TLibraryPriceBreak, type TLibraryPriceData, type TLtlRatesResponse, type TLtlShipmentData, type TMenu, type TMenuFilters, type TMetaTags, type TOrderCartLine, type TPasswordVerification, type TPaymentValidation, type TPriceData, type TProductCategory, type TProductItem, type TProductStockData, type TProfileValues, type TRelatedProduct, type TSearchSuggestion, type TSearchSuggestionsResponse, type TShippingMethod, type TSmartyStreets, type TStock, type TStockData, type TSurcharge, type TTax, type TTaxItem, type TTransactionSetup, type TUserProfile, type TWebDesc, type TrackingData, type TrackingItem, type USStateCode, US_STATES, US_STATES_FULL, US_TERRITORIES, type UserAddress, VALIDATION_PATTERNS, type ViewItemEventParams, buildCheckoutPayload, buildImageLoader, buildTrackingData, createImageConfig, derivePrice, formatPrice, generateBreadcrumbJsonLd, generateProductJsonLd, getBusinessDay, getDefaultImageUrl, getImageSrcSet, getImageUrl, getPaymentStatus, getSchemaAvailability, getShippingLeadDate, isAddressDifferent, normalizePath, pushTrackingData, resolveStock, sanitizeHtmlImages, serializeTransforms, trackAddToCart, trackViewItem, transformShipToAddress, unwrap, unwrapOr };
|