@simpleapps-com/augur-utils 2.0.20 → 2.0.22
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 +78 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -154
- package/dist/index.d.ts +76 -154
- package/dist/index.js +65 -52
- 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,8 +1022,9 @@ 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
|
-
*
|
|
1025
|
+
* - InStock: quantity > 0
|
|
1026
|
+
* - OutOfStock: discontinued at all locations with zero inventory
|
|
1027
|
+
* - BackOrder: zero stock but not discontinued (accepts backorders)
|
|
1001
1028
|
*/
|
|
1002
1029
|
declare function getSchemaAvailability(resolved: ResolvedStock | null | undefined): SchemaAvailability;
|
|
1003
1030
|
|
|
@@ -1210,157 +1237,17 @@ declare const BillingAddressInvoiceSchema: v.ObjectSchema<{
|
|
|
1210
1237
|
type ShippingAddress = v.InferOutput<typeof ShippingAddressSchema>;
|
|
1211
1238
|
type BillingAddress = v.InferOutput<typeof BillingAddressSchema>;
|
|
1212
1239
|
|
|
1213
|
-
/**
|
|
1214
|
-
|
|
1215
|
-
*/
|
|
1216
|
-
declare const US_STATES:
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
readonly name: "Arkansas";
|
|
1225
|
-
}, {
|
|
1226
|
-
readonly code: "CA";
|
|
1227
|
-
readonly name: "California";
|
|
1228
|
-
}, {
|
|
1229
|
-
readonly code: "CO";
|
|
1230
|
-
readonly name: "Colorado";
|
|
1231
|
-
}, {
|
|
1232
|
-
readonly code: "CT";
|
|
1233
|
-
readonly name: "Connecticut";
|
|
1234
|
-
}, {
|
|
1235
|
-
readonly code: "DC";
|
|
1236
|
-
readonly name: "District of Columbia";
|
|
1237
|
-
}, {
|
|
1238
|
-
readonly code: "DE";
|
|
1239
|
-
readonly name: "Delaware";
|
|
1240
|
-
}, {
|
|
1241
|
-
readonly code: "FL";
|
|
1242
|
-
readonly name: "Florida";
|
|
1243
|
-
}, {
|
|
1244
|
-
readonly code: "GA";
|
|
1245
|
-
readonly name: "Georgia";
|
|
1246
|
-
}, {
|
|
1247
|
-
readonly code: "ID";
|
|
1248
|
-
readonly name: "Idaho";
|
|
1249
|
-
}, {
|
|
1250
|
-
readonly code: "IL";
|
|
1251
|
-
readonly name: "Illinois";
|
|
1252
|
-
}, {
|
|
1253
|
-
readonly code: "IN";
|
|
1254
|
-
readonly name: "Indiana";
|
|
1255
|
-
}, {
|
|
1256
|
-
readonly code: "IA";
|
|
1257
|
-
readonly name: "Iowa";
|
|
1258
|
-
}, {
|
|
1259
|
-
readonly code: "KS";
|
|
1260
|
-
readonly name: "Kansas";
|
|
1261
|
-
}, {
|
|
1262
|
-
readonly code: "KY";
|
|
1263
|
-
readonly name: "Kentucky";
|
|
1264
|
-
}, {
|
|
1265
|
-
readonly code: "LA";
|
|
1266
|
-
readonly name: "Louisiana";
|
|
1267
|
-
}, {
|
|
1268
|
-
readonly code: "ME";
|
|
1269
|
-
readonly name: "Maine";
|
|
1270
|
-
}, {
|
|
1271
|
-
readonly code: "MD";
|
|
1272
|
-
readonly name: "Maryland";
|
|
1273
|
-
}, {
|
|
1274
|
-
readonly code: "MA";
|
|
1275
|
-
readonly name: "Massachusetts";
|
|
1276
|
-
}, {
|
|
1277
|
-
readonly code: "MI";
|
|
1278
|
-
readonly name: "Michigan";
|
|
1279
|
-
}, {
|
|
1280
|
-
readonly code: "MN";
|
|
1281
|
-
readonly name: "Minnesota";
|
|
1282
|
-
}, {
|
|
1283
|
-
readonly code: "MS";
|
|
1284
|
-
readonly name: "Mississippi";
|
|
1285
|
-
}, {
|
|
1286
|
-
readonly code: "MO";
|
|
1287
|
-
readonly name: "Missouri";
|
|
1288
|
-
}, {
|
|
1289
|
-
readonly code: "MT";
|
|
1290
|
-
readonly name: "Montana";
|
|
1291
|
-
}, {
|
|
1292
|
-
readonly code: "NE";
|
|
1293
|
-
readonly name: "Nebraska";
|
|
1294
|
-
}, {
|
|
1295
|
-
readonly code: "NV";
|
|
1296
|
-
readonly name: "Nevada";
|
|
1297
|
-
}, {
|
|
1298
|
-
readonly code: "NH";
|
|
1299
|
-
readonly name: "New Hampshire";
|
|
1300
|
-
}, {
|
|
1301
|
-
readonly code: "NJ";
|
|
1302
|
-
readonly name: "New Jersey";
|
|
1303
|
-
}, {
|
|
1304
|
-
readonly code: "NM";
|
|
1305
|
-
readonly name: "New Mexico";
|
|
1306
|
-
}, {
|
|
1307
|
-
readonly code: "NY";
|
|
1308
|
-
readonly name: "New York";
|
|
1309
|
-
}, {
|
|
1310
|
-
readonly code: "NC";
|
|
1311
|
-
readonly name: "North Carolina";
|
|
1312
|
-
}, {
|
|
1313
|
-
readonly code: "ND";
|
|
1314
|
-
readonly name: "North Dakota";
|
|
1315
|
-
}, {
|
|
1316
|
-
readonly code: "OH";
|
|
1317
|
-
readonly name: "Ohio";
|
|
1318
|
-
}, {
|
|
1319
|
-
readonly code: "OK";
|
|
1320
|
-
readonly name: "Oklahoma";
|
|
1321
|
-
}, {
|
|
1322
|
-
readonly code: "OR";
|
|
1323
|
-
readonly name: "Oregon";
|
|
1324
|
-
}, {
|
|
1325
|
-
readonly code: "PA";
|
|
1326
|
-
readonly name: "Pennsylvania";
|
|
1327
|
-
}, {
|
|
1328
|
-
readonly code: "RI";
|
|
1329
|
-
readonly name: "Rhode Island";
|
|
1330
|
-
}, {
|
|
1331
|
-
readonly code: "SC";
|
|
1332
|
-
readonly name: "South Carolina";
|
|
1333
|
-
}, {
|
|
1334
|
-
readonly code: "SD";
|
|
1335
|
-
readonly name: "South Dakota";
|
|
1336
|
-
}, {
|
|
1337
|
-
readonly code: "TN";
|
|
1338
|
-
readonly name: "Tennessee";
|
|
1339
|
-
}, {
|
|
1340
|
-
readonly code: "TX";
|
|
1341
|
-
readonly name: "Texas";
|
|
1342
|
-
}, {
|
|
1343
|
-
readonly code: "UT";
|
|
1344
|
-
readonly name: "Utah";
|
|
1345
|
-
}, {
|
|
1346
|
-
readonly code: "VT";
|
|
1347
|
-
readonly name: "Vermont";
|
|
1348
|
-
}, {
|
|
1349
|
-
readonly code: "VA";
|
|
1350
|
-
readonly name: "Virginia";
|
|
1351
|
-
}, {
|
|
1352
|
-
readonly code: "WA";
|
|
1353
|
-
readonly name: "Washington";
|
|
1354
|
-
}, {
|
|
1355
|
-
readonly code: "WV";
|
|
1356
|
-
readonly name: "West Virginia";
|
|
1357
|
-
}, {
|
|
1358
|
-
readonly code: "WI";
|
|
1359
|
-
readonly name: "Wisconsin";
|
|
1360
|
-
}, {
|
|
1361
|
-
readonly code: "WY";
|
|
1362
|
-
readonly name: "Wyoming";
|
|
1363
|
-
}];
|
|
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[];
|
|
1364
1251
|
type USStateCode = (typeof US_STATES)[number]["code"];
|
|
1365
1252
|
|
|
1366
1253
|
/**
|
|
@@ -1409,5 +1296,40 @@ interface ViewItemEventParams {
|
|
|
1409
1296
|
* Track view_item event to Google Analytics dataLayer.
|
|
1410
1297
|
*/
|
|
1411
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;
|
|
1412
1334
|
|
|
1413
|
-
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 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 USStateCode, US_STATES, type UserAddress, VALIDATION_PATTERNS, type ViewItemEventParams, buildCheckoutPayload, buildImageLoader, createImageConfig, derivePrice, formatPrice, generateBreadcrumbJsonLd, generateProductJsonLd, getBusinessDay, getDefaultImageUrl, getImageSrcSet, getImageUrl, getPaymentStatus, getSchemaAvailability, getShippingLeadDate, isAddressDifferent, normalizePath, resolveStock, sanitizeHtmlImages, serializeTransforms, trackAddToCart, trackViewItem, transformShipToAddress, unwrap, unwrapOr };
|
|
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,8 +1022,9 @@ 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
|
-
*
|
|
1025
|
+
* - InStock: quantity > 0
|
|
1026
|
+
* - OutOfStock: discontinued at all locations with zero inventory
|
|
1027
|
+
* - BackOrder: zero stock but not discontinued (accepts backorders)
|
|
1001
1028
|
*/
|
|
1002
1029
|
declare function getSchemaAvailability(resolved: ResolvedStock | null | undefined): SchemaAvailability;
|
|
1003
1030
|
|
|
@@ -1210,157 +1237,17 @@ declare const BillingAddressInvoiceSchema: v.ObjectSchema<{
|
|
|
1210
1237
|
type ShippingAddress = v.InferOutput<typeof ShippingAddressSchema>;
|
|
1211
1238
|
type BillingAddress = v.InferOutput<typeof BillingAddressSchema>;
|
|
1212
1239
|
|
|
1213
|
-
/**
|
|
1214
|
-
|
|
1215
|
-
*/
|
|
1216
|
-
declare const US_STATES:
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
readonly name: "Arkansas";
|
|
1225
|
-
}, {
|
|
1226
|
-
readonly code: "CA";
|
|
1227
|
-
readonly name: "California";
|
|
1228
|
-
}, {
|
|
1229
|
-
readonly code: "CO";
|
|
1230
|
-
readonly name: "Colorado";
|
|
1231
|
-
}, {
|
|
1232
|
-
readonly code: "CT";
|
|
1233
|
-
readonly name: "Connecticut";
|
|
1234
|
-
}, {
|
|
1235
|
-
readonly code: "DC";
|
|
1236
|
-
readonly name: "District of Columbia";
|
|
1237
|
-
}, {
|
|
1238
|
-
readonly code: "DE";
|
|
1239
|
-
readonly name: "Delaware";
|
|
1240
|
-
}, {
|
|
1241
|
-
readonly code: "FL";
|
|
1242
|
-
readonly name: "Florida";
|
|
1243
|
-
}, {
|
|
1244
|
-
readonly code: "GA";
|
|
1245
|
-
readonly name: "Georgia";
|
|
1246
|
-
}, {
|
|
1247
|
-
readonly code: "ID";
|
|
1248
|
-
readonly name: "Idaho";
|
|
1249
|
-
}, {
|
|
1250
|
-
readonly code: "IL";
|
|
1251
|
-
readonly name: "Illinois";
|
|
1252
|
-
}, {
|
|
1253
|
-
readonly code: "IN";
|
|
1254
|
-
readonly name: "Indiana";
|
|
1255
|
-
}, {
|
|
1256
|
-
readonly code: "IA";
|
|
1257
|
-
readonly name: "Iowa";
|
|
1258
|
-
}, {
|
|
1259
|
-
readonly code: "KS";
|
|
1260
|
-
readonly name: "Kansas";
|
|
1261
|
-
}, {
|
|
1262
|
-
readonly code: "KY";
|
|
1263
|
-
readonly name: "Kentucky";
|
|
1264
|
-
}, {
|
|
1265
|
-
readonly code: "LA";
|
|
1266
|
-
readonly name: "Louisiana";
|
|
1267
|
-
}, {
|
|
1268
|
-
readonly code: "ME";
|
|
1269
|
-
readonly name: "Maine";
|
|
1270
|
-
}, {
|
|
1271
|
-
readonly code: "MD";
|
|
1272
|
-
readonly name: "Maryland";
|
|
1273
|
-
}, {
|
|
1274
|
-
readonly code: "MA";
|
|
1275
|
-
readonly name: "Massachusetts";
|
|
1276
|
-
}, {
|
|
1277
|
-
readonly code: "MI";
|
|
1278
|
-
readonly name: "Michigan";
|
|
1279
|
-
}, {
|
|
1280
|
-
readonly code: "MN";
|
|
1281
|
-
readonly name: "Minnesota";
|
|
1282
|
-
}, {
|
|
1283
|
-
readonly code: "MS";
|
|
1284
|
-
readonly name: "Mississippi";
|
|
1285
|
-
}, {
|
|
1286
|
-
readonly code: "MO";
|
|
1287
|
-
readonly name: "Missouri";
|
|
1288
|
-
}, {
|
|
1289
|
-
readonly code: "MT";
|
|
1290
|
-
readonly name: "Montana";
|
|
1291
|
-
}, {
|
|
1292
|
-
readonly code: "NE";
|
|
1293
|
-
readonly name: "Nebraska";
|
|
1294
|
-
}, {
|
|
1295
|
-
readonly code: "NV";
|
|
1296
|
-
readonly name: "Nevada";
|
|
1297
|
-
}, {
|
|
1298
|
-
readonly code: "NH";
|
|
1299
|
-
readonly name: "New Hampshire";
|
|
1300
|
-
}, {
|
|
1301
|
-
readonly code: "NJ";
|
|
1302
|
-
readonly name: "New Jersey";
|
|
1303
|
-
}, {
|
|
1304
|
-
readonly code: "NM";
|
|
1305
|
-
readonly name: "New Mexico";
|
|
1306
|
-
}, {
|
|
1307
|
-
readonly code: "NY";
|
|
1308
|
-
readonly name: "New York";
|
|
1309
|
-
}, {
|
|
1310
|
-
readonly code: "NC";
|
|
1311
|
-
readonly name: "North Carolina";
|
|
1312
|
-
}, {
|
|
1313
|
-
readonly code: "ND";
|
|
1314
|
-
readonly name: "North Dakota";
|
|
1315
|
-
}, {
|
|
1316
|
-
readonly code: "OH";
|
|
1317
|
-
readonly name: "Ohio";
|
|
1318
|
-
}, {
|
|
1319
|
-
readonly code: "OK";
|
|
1320
|
-
readonly name: "Oklahoma";
|
|
1321
|
-
}, {
|
|
1322
|
-
readonly code: "OR";
|
|
1323
|
-
readonly name: "Oregon";
|
|
1324
|
-
}, {
|
|
1325
|
-
readonly code: "PA";
|
|
1326
|
-
readonly name: "Pennsylvania";
|
|
1327
|
-
}, {
|
|
1328
|
-
readonly code: "RI";
|
|
1329
|
-
readonly name: "Rhode Island";
|
|
1330
|
-
}, {
|
|
1331
|
-
readonly code: "SC";
|
|
1332
|
-
readonly name: "South Carolina";
|
|
1333
|
-
}, {
|
|
1334
|
-
readonly code: "SD";
|
|
1335
|
-
readonly name: "South Dakota";
|
|
1336
|
-
}, {
|
|
1337
|
-
readonly code: "TN";
|
|
1338
|
-
readonly name: "Tennessee";
|
|
1339
|
-
}, {
|
|
1340
|
-
readonly code: "TX";
|
|
1341
|
-
readonly name: "Texas";
|
|
1342
|
-
}, {
|
|
1343
|
-
readonly code: "UT";
|
|
1344
|
-
readonly name: "Utah";
|
|
1345
|
-
}, {
|
|
1346
|
-
readonly code: "VT";
|
|
1347
|
-
readonly name: "Vermont";
|
|
1348
|
-
}, {
|
|
1349
|
-
readonly code: "VA";
|
|
1350
|
-
readonly name: "Virginia";
|
|
1351
|
-
}, {
|
|
1352
|
-
readonly code: "WA";
|
|
1353
|
-
readonly name: "Washington";
|
|
1354
|
-
}, {
|
|
1355
|
-
readonly code: "WV";
|
|
1356
|
-
readonly name: "West Virginia";
|
|
1357
|
-
}, {
|
|
1358
|
-
readonly code: "WI";
|
|
1359
|
-
readonly name: "Wisconsin";
|
|
1360
|
-
}, {
|
|
1361
|
-
readonly code: "WY";
|
|
1362
|
-
readonly name: "Wyoming";
|
|
1363
|
-
}];
|
|
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[];
|
|
1364
1251
|
type USStateCode = (typeof US_STATES)[number]["code"];
|
|
1365
1252
|
|
|
1366
1253
|
/**
|
|
@@ -1409,5 +1296,40 @@ interface ViewItemEventParams {
|
|
|
1409
1296
|
* Track view_item event to Google Analytics dataLayer.
|
|
1410
1297
|
*/
|
|
1411
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;
|
|
1412
1334
|
|
|
1413
|
-
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 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 USStateCode, US_STATES, type UserAddress, VALIDATION_PATTERNS, type ViewItemEventParams, buildCheckoutPayload, buildImageLoader, createImageConfig, derivePrice, formatPrice, generateBreadcrumbJsonLd, generateProductJsonLd, getBusinessDay, getDefaultImageUrl, getImageSrcSet, getImageUrl, getPaymentStatus, getSchemaAvailability, getShippingLeadDate, isAddressDifferent, normalizePath, resolveStock, sanitizeHtmlImages, serializeTransforms, trackAddToCart, trackViewItem, transformShipToAddress, unwrap, unwrapOr };
|
|
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 };
|