@reactionary/hcl 0.9.8 → 0.9.12
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/capabilities/cart.capability.js +411 -0
- package/capabilities/category.capability.js +111 -35
- package/capabilities/checkout.capability.js +337 -0
- package/capabilities/identity.capability.js +214 -0
- package/capabilities/inventory.capability.js +75 -0
- package/capabilities/order-search.capability.js +79 -0
- package/capabilities/order.capability.js +62 -0
- package/capabilities/price.capability.js +122 -0
- package/capabilities/product-search.capability.js +64 -13
- package/capabilities/product.capability.js +114 -28
- package/capabilities/profile.capability.js +215 -0
- package/core/client.js +81 -90
- package/core/initialize.js +170 -7
- package/core/session-keys.js +14 -0
- package/factories/cart/cart.factory.js +135 -0
- package/factories/checkout/checkout.factory.js +131 -0
- package/factories/identity/identity.factory.js +12 -0
- package/factories/index.js +8 -0
- package/factories/inventory/inventory.factory.js +38 -0
- package/factories/order/order.factory.js +124 -0
- package/factories/order-search/order-search.factory.js +59 -0
- package/factories/price/price.factory.js +39 -0
- package/factories/profile/profile.factory.js +49 -0
- package/index.js +8 -0
- package/package.json +8 -5
- package/schema/capabilities.schema.js +10 -2
- package/schema/configuration.schema.js +9 -1
- package/src/capabilities/cart.capability.d.ts +69 -0
- package/src/capabilities/category.capability.d.ts +20 -1
- package/src/capabilities/checkout.capability.d.ts +41 -0
- package/src/capabilities/identity.capability.d.ts +29 -0
- package/src/capabilities/inventory.capability.d.ts +13 -0
- package/src/capabilities/order-search.capability.d.ts +13 -0
- package/src/capabilities/order.capability.d.ts +13 -0
- package/src/capabilities/price.capability.d.ts +16 -0
- package/src/capabilities/product-search.capability.d.ts +7 -2
- package/src/capabilities/product.capability.d.ts +14 -2
- package/src/capabilities/profile.capability.d.ts +31 -0
- package/src/core/client.d.ts +41 -14
- package/src/core/initialize.types.d.ts +17 -5
- package/src/core/session-keys.d.ts +14 -0
- package/src/factories/cart/cart.factory.d.ts +11 -0
- package/src/factories/checkout/checkout.factory.d.ts +11 -0
- package/src/factories/identity/identity.factory.d.ts +7 -0
- package/src/factories/index.d.ts +8 -0
- package/src/factories/inventory/inventory.factory.d.ts +29 -0
- package/src/factories/order/order.factory.d.ts +11 -0
- package/src/factories/order-search/order-search.factory.d.ts +9 -0
- package/src/factories/price/price.factory.d.ts +26 -0
- package/src/factories/profile/profile.factory.d.ts +9 -0
- package/src/index.d.ts +8 -0
- package/src/schema/capabilities.schema.d.ts +25 -1
- package/src/schema/configuration.schema.d.ts +6 -0
- package/src/schema/hcl.schema.d.ts +384 -0
- package/src/test/test-utils.d.ts +5 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Cache, RequestContext, CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability } from '@reactionary/core';
|
|
1
|
+
import type { Cache, RequestContext, CartFactory, CartFactoryWithOutput, CartCapability, CategoryFactory, CategoryFactoryWithOutput, CategoryCapability, CheckoutFactory, CheckoutFactoryWithOutput, CheckoutCapability, IdentityFactory, IdentityFactoryWithOutput, IdentityCapability, InventoryFactory, InventoryFactoryWithOutput, InventoryCapability, OrderFactory, OrderFactoryWithOutput, OrderCapability, OrderSearchFactory, OrderSearchFactoryWithOutput, OrderSearchCapability, PriceFactory, PriceFactoryWithOutput, PriceCapability, ProductFactory, ProductFactoryWithOutput, ProductCapability, ProductSearchFactory, ProductSearchFactoryWithOutput, ProductSearchCapability, ProfileFactory, ProfileFactoryWithOutput, ProfileCapability } from '@reactionary/core';
|
|
2
2
|
import type { HclConfiguration } from './configuration.schema.js';
|
|
3
3
|
import type { HclClient } from '../core/client.js';
|
|
4
4
|
import * as z from 'zod';
|
|
@@ -33,11 +33,31 @@ export declare const HclCapabilitiesSchema: z.ZodObject<{
|
|
|
33
33
|
factory: z.ZodOptional<z.ZodUnknown>;
|
|
34
34
|
capability: z.ZodOptional<z.ZodUnknown>;
|
|
35
35
|
}, z.core.$loose>>>;
|
|
36
|
+
identity: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
37
|
+
enabled: z.ZodBoolean;
|
|
38
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
39
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
40
|
+
}, z.core.$loose>>>;
|
|
36
41
|
productSearch: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
37
42
|
enabled: z.ZodBoolean;
|
|
38
43
|
factory: z.ZodOptional<z.ZodUnknown>;
|
|
39
44
|
capability: z.ZodOptional<z.ZodUnknown>;
|
|
40
45
|
}, z.core.$loose>>>;
|
|
46
|
+
profile: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
47
|
+
enabled: z.ZodBoolean;
|
|
48
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
49
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
50
|
+
}, z.core.$loose>>>;
|
|
51
|
+
order: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
52
|
+
enabled: z.ZodBoolean;
|
|
53
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
54
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
+
}, z.core.$loose>>>;
|
|
56
|
+
orderSearch: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
57
|
+
enabled: z.ZodBoolean;
|
|
58
|
+
factory: z.ZodOptional<z.ZodUnknown>;
|
|
59
|
+
capability: z.ZodOptional<z.ZodUnknown>;
|
|
60
|
+
}, z.core.$loose>>>;
|
|
41
61
|
}, z.core.$loose>;
|
|
42
62
|
export type HclCapabilities = z.infer<typeof HclCapabilitiesSchema>;
|
|
43
63
|
export interface HclCapabilityFactoryArgs {
|
|
@@ -61,3 +81,7 @@ export type HclInventoryCapabilityConfig = HclCapabilityConfig<InventoryFactoryW
|
|
|
61
81
|
export type HclPriceCapabilityConfig = HclCapabilityConfig<PriceFactoryWithOutput<PriceFactory>, PriceCapability>;
|
|
62
82
|
export type HclProductCapabilityConfig = HclCapabilityConfig<ProductFactoryWithOutput<ProductFactory>, ProductCapability>;
|
|
63
83
|
export type HclProductSearchCapabilityConfig = HclCapabilityConfig<ProductSearchFactoryWithOutput<ProductSearchFactory>, ProductSearchCapability>;
|
|
84
|
+
export type HclIdentityCapabilityConfig = HclCapabilityConfig<IdentityFactoryWithOutput<IdentityFactory>, IdentityCapability>;
|
|
85
|
+
export type HclProfileCapabilityConfig = HclCapabilityConfig<ProfileFactoryWithOutput<ProfileFactory>, ProfileCapability>;
|
|
86
|
+
export type HclOrderCapabilityConfig = HclCapabilityConfig<OrderFactoryWithOutput<OrderFactory>, OrderCapability>;
|
|
87
|
+
export type HclOrderSearchCapabilityConfig = HclCapabilityConfig<OrderSearchFactoryWithOutput<OrderSearchFactory>, OrderSearchCapability>;
|
|
@@ -15,5 +15,11 @@ export declare const HclConfigurationSchema: z.ZodObject<{
|
|
|
15
15
|
productSearch: z.ZodDefault<z.ZodString>;
|
|
16
16
|
categoryBrowse: z.ZodDefault<z.ZodString>;
|
|
17
17
|
}, z.core.$loose>>;
|
|
18
|
+
/**
|
|
19
|
+
* Optional price rule ID passed to /display_price?q=byPartNumbersAndPriceRuleId.
|
|
20
|
+
* When omitted the server applies its default configured price rule.
|
|
21
|
+
* In Karkkainen this is '10003'.
|
|
22
|
+
*/
|
|
23
|
+
priceRuleId: z.ZodOptional<z.ZodString>;
|
|
18
24
|
}, z.core.$loose>;
|
|
19
25
|
export type HclConfiguration = z.infer<typeof HclConfigurationSchema>;
|
|
@@ -8,6 +8,108 @@ export interface HclPrice {
|
|
|
8
8
|
description: string;
|
|
9
9
|
currency: string;
|
|
10
10
|
value: string;
|
|
11
|
+
/** B2B contract identifier. Present on Offer-usage entries when a contract price applies. */
|
|
12
|
+
contractId?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A single unit price entry in a /display_price response item.
|
|
16
|
+
* `value` is already a number (unlike the inline `HclPrice.value` which is a string).
|
|
17
|
+
*/
|
|
18
|
+
export interface HclDisplayPriceUnitPrice {
|
|
19
|
+
price?: {
|
|
20
|
+
currency?: string;
|
|
21
|
+
/** Numeric value — already a number, not a string. */
|
|
22
|
+
value?: number;
|
|
23
|
+
};
|
|
24
|
+
quantity?: {
|
|
25
|
+
value?: number;
|
|
26
|
+
uom?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A single item in the `resultList` of a /display_price response.
|
|
31
|
+
* Returned for both `byPartNumbersAndPriceRuleId` and `byCatalogEntryIds*` query variants.
|
|
32
|
+
*/
|
|
33
|
+
export interface HclDisplayPriceItem {
|
|
34
|
+
partNumber: string;
|
|
35
|
+
priceRuleId?: string;
|
|
36
|
+
priceRuleName?: string;
|
|
37
|
+
catalogEntryId?: string;
|
|
38
|
+
unitPrice?: HclDisplayPriceUnitPrice[];
|
|
39
|
+
userDataField?: {
|
|
40
|
+
value?: string;
|
|
41
|
+
key: string;
|
|
42
|
+
}[];
|
|
43
|
+
}
|
|
44
|
+
/** Top-level response from GET /wcs/resources/store/{storeId}/display_price */
|
|
45
|
+
export interface HclDisplayPriceResponse {
|
|
46
|
+
resourceId?: string;
|
|
47
|
+
resourceName?: string;
|
|
48
|
+
resultList?: HclDisplayPriceItem[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A single unit price entry in a /price?q=byPartNumbers response item.
|
|
52
|
+
* Note: HCL uses `UnitPrice` (capital U) on this endpoint.
|
|
53
|
+
*/
|
|
54
|
+
export interface HclEntitledPriceUnitPrice {
|
|
55
|
+
price?: {
|
|
56
|
+
currency?: string;
|
|
57
|
+
/** Numeric value. */
|
|
58
|
+
value?: number;
|
|
59
|
+
};
|
|
60
|
+
quantity?: {
|
|
61
|
+
value?: number;
|
|
62
|
+
uom?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A single item in the `EntitledPrice` array of a /price?q=byPartNumbers response.
|
|
67
|
+
*/
|
|
68
|
+
export interface HclEntitledPriceItem {
|
|
69
|
+
partNumber?: string;
|
|
70
|
+
productId?: string;
|
|
71
|
+
contractId?: string;
|
|
72
|
+
UnitPrice?: HclEntitledPriceUnitPrice[];
|
|
73
|
+
}
|
|
74
|
+
/** Top-level response from GET /wcs/resources/store/{storeId}/price?q=byPartNumbers */
|
|
75
|
+
export interface HclEntitledPriceResponse {
|
|
76
|
+
resourceId?: string;
|
|
77
|
+
resourceName?: string;
|
|
78
|
+
EntitledPrice?: HclEntitledPriceItem[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A single item in the `InventoryAvailability` array of the inventoryavailability response.
|
|
82
|
+
*/
|
|
83
|
+
export interface HclInventoryAvailabilityItem {
|
|
84
|
+
/** Internal HCL product ID (numeric string). */
|
|
85
|
+
productId?: string;
|
|
86
|
+
/** Inventory status string, e.g. 'Available'. */
|
|
87
|
+
inventoryStatus?: string;
|
|
88
|
+
/** Available quantity as a string (format: double). */
|
|
89
|
+
availableQuantity?: string;
|
|
90
|
+
unitOfMeasure?: string;
|
|
91
|
+
/** ID of the physical store, if this is a store-specific record. */
|
|
92
|
+
physicalStoreId?: string;
|
|
93
|
+
/** Name/key of the physical store, e.g. '1004/0001'. */
|
|
94
|
+
physicalStoreName?: string;
|
|
95
|
+
/** Name/key of the online store. Present on online inventory records. */
|
|
96
|
+
onlineStoreName?: string;
|
|
97
|
+
/** Online store ID. Present on online inventory records. */
|
|
98
|
+
onlineStoreId?: string;
|
|
99
|
+
availabilityDateTime?: string;
|
|
100
|
+
x_customField1?: string | null;
|
|
101
|
+
x_customField2?: string | null;
|
|
102
|
+
x_customField3?: string | null;
|
|
103
|
+
userDataField?: {
|
|
104
|
+
value?: string;
|
|
105
|
+
key: string;
|
|
106
|
+
}[];
|
|
107
|
+
}
|
|
108
|
+
/** Top-level response from GET /wcs/resources/store/{storeId}/inventoryavailability/byPartNumber/{partNumbers} */
|
|
109
|
+
export interface HclInventoryAvailabilityResponse {
|
|
110
|
+
resourceId: string;
|
|
111
|
+
resourceName: string;
|
|
112
|
+
InventoryAvailability?: HclInventoryAvailabilityItem[];
|
|
11
113
|
}
|
|
12
114
|
export interface HclProductAttributeValue {
|
|
13
115
|
identifier: string | string[];
|
|
@@ -310,3 +412,285 @@ export interface HclFindProductsQuery {
|
|
|
310
412
|
*/
|
|
311
413
|
facets?: string[];
|
|
312
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Response from POST /wcs/resources/store/{storeId}/guestidentity
|
|
417
|
+
* and POST /wcs/resources/store/{storeId}/loginidentity.
|
|
418
|
+
*/
|
|
419
|
+
export interface HclWcsIdentityResponse {
|
|
420
|
+
/** Opaque session token — must be forwarded as `WCToken` header on subsequent requests. */
|
|
421
|
+
WCToken: string;
|
|
422
|
+
/** Trusted token — must be forwarded as `WCTrustedToken` header. */
|
|
423
|
+
WCTrustedToken: string;
|
|
424
|
+
/** Numeric user ID string assigned by WCS. */
|
|
425
|
+
userId: string;
|
|
426
|
+
/** Personalization tracking ID. */
|
|
427
|
+
personalizationID?: string;
|
|
428
|
+
resourceName?: string;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* A single entry in a WCS person address book (contact list).
|
|
432
|
+
* Returned as part of the GET /person/@self response (contact[] field)
|
|
433
|
+
* and used for POST/PUT /person/@self/contact operations.
|
|
434
|
+
*/
|
|
435
|
+
export interface HclWcsPersonContact {
|
|
436
|
+
/** Unique identifier / display name for this address (e.g. 'Home', 'Work', 'Billing'). */
|
|
437
|
+
nickName: string;
|
|
438
|
+
firstName?: string;
|
|
439
|
+
lastName?: string;
|
|
440
|
+
/** Street address lines. Index 0 = street, index 1 = apartment / second line. */
|
|
441
|
+
addressLine?: string[];
|
|
442
|
+
/** Alternative single-field address (some WCS endpoint variants). */
|
|
443
|
+
address1?: string;
|
|
444
|
+
city?: string;
|
|
445
|
+
stateOrProvinceName?: string;
|
|
446
|
+
zipCode?: string;
|
|
447
|
+
/** ISO country code, e.g. 'US'. */
|
|
448
|
+
country?: string;
|
|
449
|
+
phone1?: string;
|
|
450
|
+
email1?: string;
|
|
451
|
+
/** '1' marks this as the default / primary shipping address. */
|
|
452
|
+
primary?: string;
|
|
453
|
+
addressType?: string;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Response from GET /wcs/resources/store/{storeId}/person/@self.
|
|
457
|
+
* Only the fields we use are typed; the full WCS schema has many more.
|
|
458
|
+
*/
|
|
459
|
+
export interface HclPersonResponse {
|
|
460
|
+
/** Numeric user ID string. */
|
|
461
|
+
userId: string;
|
|
462
|
+
/** Customer's email / logon ID. Only populated for registered users. */
|
|
463
|
+
logonId?: string;
|
|
464
|
+
email1?: string;
|
|
465
|
+
firstName?: string;
|
|
466
|
+
lastName?: string;
|
|
467
|
+
phone1?: string;
|
|
468
|
+
resourceName?: string;
|
|
469
|
+
/** Organization ID. `-2000` indicates the default anonymous org. */
|
|
470
|
+
orgizationId?: string;
|
|
471
|
+
/** Address book entries embedded in the person/@self response. */
|
|
472
|
+
contact?: HclWcsPersonContact[];
|
|
473
|
+
}
|
|
474
|
+
/** A single order item embedded in a WCS cart/@self response. */
|
|
475
|
+
export interface HclWcsOrderItem {
|
|
476
|
+
orderItemId: string;
|
|
477
|
+
/** Internal HCL catalog entry ID (numeric string). */
|
|
478
|
+
productId?: string;
|
|
479
|
+
/** SKU part number. Use this as the variant identifier. */
|
|
480
|
+
partNumber: string;
|
|
481
|
+
/** Quantity as a string — coerce with Number(). */
|
|
482
|
+
quantity: string;
|
|
483
|
+
/** Total line price as a string (unitPrice × quantity). */
|
|
484
|
+
orderItemPrice: string;
|
|
485
|
+
/** Price per single unit as a string. */
|
|
486
|
+
unitPrice: string;
|
|
487
|
+
/** ISO 4217 currency code. */
|
|
488
|
+
currency: string;
|
|
489
|
+
orderItemInventoryStatus?: string;
|
|
490
|
+
/** 'true' | 'false' — marks free-gift promotional items. */
|
|
491
|
+
freeGift?: string;
|
|
492
|
+
comments?: string;
|
|
493
|
+
/** Ship mode ID assigned to this item (present in shipping_info response). */
|
|
494
|
+
shipModeId?: string;
|
|
495
|
+
shipModeCode?: string;
|
|
496
|
+
shipModeDescription?: string;
|
|
497
|
+
carrier?: string;
|
|
498
|
+
shippingCharge?: string;
|
|
499
|
+
}
|
|
500
|
+
/** A single price adjustment on a WCS cart (discount, surcharge, tax, shipping). */
|
|
501
|
+
export interface HclWcsAdjustment {
|
|
502
|
+
code: string;
|
|
503
|
+
/** Adjustment amount as a string — negative for discounts. */
|
|
504
|
+
amount: string;
|
|
505
|
+
currency: string;
|
|
506
|
+
/** 'Order' | 'OrderItem' | 'Shipping' */
|
|
507
|
+
displayLevel?: string;
|
|
508
|
+
/** 'Discount' | 'Tax' | 'Surcharge' | 'Shipping' */
|
|
509
|
+
usage?: string;
|
|
510
|
+
description?: string;
|
|
511
|
+
}
|
|
512
|
+
/** A promotion/coupon code applied to a WCS cart. */
|
|
513
|
+
export interface HclWcsPromoCode {
|
|
514
|
+
code: string;
|
|
515
|
+
reason?: string;
|
|
516
|
+
associatedPromotion?: {
|
|
517
|
+
promotionId?: string;
|
|
518
|
+
promotionCode?: string;
|
|
519
|
+
}[];
|
|
520
|
+
}
|
|
521
|
+
/** Key-value pair carried in a WCS payment instruction. */
|
|
522
|
+
export interface HclWcsPaymentProtocolData {
|
|
523
|
+
name: string;
|
|
524
|
+
value: string;
|
|
525
|
+
}
|
|
526
|
+
/** A payment instruction attached to a WCS cart. */
|
|
527
|
+
export interface HclWcsPaymentInstruction {
|
|
528
|
+
piId: string;
|
|
529
|
+
payMethodId: string;
|
|
530
|
+
/** Authorized amount as a string. */
|
|
531
|
+
piAmount?: string;
|
|
532
|
+
currency?: string;
|
|
533
|
+
protocolData?: HclWcsPaymentProtocolData[];
|
|
534
|
+
piStatus?: string;
|
|
535
|
+
piDescription?: string;
|
|
536
|
+
}
|
|
537
|
+
/** An address embedded in a WCS cart/order response. */
|
|
538
|
+
export interface HclWcsAddress {
|
|
539
|
+
addressId?: string;
|
|
540
|
+
firstName?: string;
|
|
541
|
+
lastName?: string;
|
|
542
|
+
/** Array of street address lines — index 0 is the primary line. */
|
|
543
|
+
addressLine?: string[];
|
|
544
|
+
/** Single-field street address (some WCS endpoints prefer this over addressLine). */
|
|
545
|
+
address1?: string;
|
|
546
|
+
city?: string;
|
|
547
|
+
/** State/province/region code. */
|
|
548
|
+
state?: string;
|
|
549
|
+
zipCode?: string;
|
|
550
|
+
country?: string;
|
|
551
|
+
phone1?: string;
|
|
552
|
+
email1?: string;
|
|
553
|
+
addressType?: string;
|
|
554
|
+
nickName?: string;
|
|
555
|
+
}
|
|
556
|
+
/** A single available ship mode returned by the WCS shipping_info endpoint. */
|
|
557
|
+
export interface HclWcsShipMode {
|
|
558
|
+
shipModeId: string;
|
|
559
|
+
carrier: string;
|
|
560
|
+
shipModeCode: string;
|
|
561
|
+
shipModeDescription: string;
|
|
562
|
+
/** Store-defined extra field (varies by HCL configuration). */
|
|
563
|
+
field1?: string;
|
|
564
|
+
/** Estimated delivery time (store-defined). */
|
|
565
|
+
field2?: string;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Top-level response from GET /wcs/resources/store/{storeId}/cart/@self.
|
|
569
|
+
* All monetary amounts are returned as strings and must be parsed with Number().
|
|
570
|
+
*/
|
|
571
|
+
export interface HclWcsCartResponse {
|
|
572
|
+
orderId: string;
|
|
573
|
+
storeId?: string;
|
|
574
|
+
buyerId?: string;
|
|
575
|
+
orgUniqueID?: string;
|
|
576
|
+
grandTotal?: string;
|
|
577
|
+
grandTotalCurrency?: string;
|
|
578
|
+
totalProductPrice?: string;
|
|
579
|
+
totalProductPriceCurrency?: string;
|
|
580
|
+
totalShippingCharge?: string;
|
|
581
|
+
totalShippingChargeCurrency?: string;
|
|
582
|
+
totalAdjustment?: string;
|
|
583
|
+
totalAdjustmentCurrency?: string;
|
|
584
|
+
totalSalesTax?: string;
|
|
585
|
+
totalSalesTaxCurrency?: string;
|
|
586
|
+
totalShippingTax?: string;
|
|
587
|
+
/** Shipping address embedded in the cart (when set). */
|
|
588
|
+
x_shippingAddress?: HclWcsAddress;
|
|
589
|
+
/** Billing address embedded in the cart (when set). */
|
|
590
|
+
x_billingAddress?: HclWcsAddress;
|
|
591
|
+
orderItem?: HclWcsOrderItem[];
|
|
592
|
+
adjustment?: HclWcsAdjustment[];
|
|
593
|
+
promotionCode?: HclWcsPromoCode[];
|
|
594
|
+
paymentInstruction?: HclWcsPaymentInstruction[];
|
|
595
|
+
/** Currently selected shipping mode ID. */
|
|
596
|
+
shipModeId?: string;
|
|
597
|
+
shipModeCode?: string;
|
|
598
|
+
shipModeDescription?: string;
|
|
599
|
+
carrier?: string;
|
|
600
|
+
/** '0' | '1' — locked orders cannot be modified. */
|
|
601
|
+
x_isPurchaseLocked?: string;
|
|
602
|
+
/** WCS order status, e.g. 'P' = pending, 'C' = submitted. */
|
|
603
|
+
orderStatus?: string;
|
|
604
|
+
lastUpdateDate?: string;
|
|
605
|
+
/** Order description / name as persisted in WCS. Returned by GET /order/{orderId} and GET /order/byStatus/P. */
|
|
606
|
+
orderDescription?: string;
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Response from GET /store/{storeId}/order/byStatus/P.
|
|
610
|
+
* Returns a list of pending orders (multi-cart B2B support).
|
|
611
|
+
*/
|
|
612
|
+
export interface HclWcsOrderListResponse {
|
|
613
|
+
Order: HclWcsCartResponse[];
|
|
614
|
+
recordSetTotal?: string;
|
|
615
|
+
recordSetCount?: string;
|
|
616
|
+
recordSetComplete?: string;
|
|
617
|
+
recordSetStartNumber?: string;
|
|
618
|
+
}
|
|
619
|
+
/** Response from the precheckout / checkout endpoints. */
|
|
620
|
+
export interface HclWcsOrderIdContainer {
|
|
621
|
+
orderId: string;
|
|
622
|
+
resourceName?: string;
|
|
623
|
+
}
|
|
624
|
+
/** Response from GET cart/@self/shipping_info with usable shipping modes. */
|
|
625
|
+
export interface HclWcsShipModesResponse {
|
|
626
|
+
/** Present in newer WCS versions when using IBM_usableShippingMode profile. */
|
|
627
|
+
usableShippingMode?: HclWcsShipMode[];
|
|
628
|
+
/** Present in older WCS versions — shipping mode embedded per orderItem. */
|
|
629
|
+
orderItem?: Array<{
|
|
630
|
+
orderItemId: string;
|
|
631
|
+
shipModeId?: string;
|
|
632
|
+
shipModeCode?: string;
|
|
633
|
+
shipModeDescription?: string;
|
|
634
|
+
carrier?: string;
|
|
635
|
+
description?: string;
|
|
636
|
+
}>;
|
|
637
|
+
}
|
|
638
|
+
/** A single usable payment method entry returned by WCS. */
|
|
639
|
+
export interface HclWcsPaymentMethod {
|
|
640
|
+
paymentMethodName: string;
|
|
641
|
+
xucc?: string;
|
|
642
|
+
description?: string;
|
|
643
|
+
}
|
|
644
|
+
/** Response listing available payment methods for the store. */
|
|
645
|
+
export interface HclWcsPaymentMethodsResponse {
|
|
646
|
+
usablePaymentInformation?: HclWcsPaymentMethod[];
|
|
647
|
+
}
|
|
648
|
+
/** Minimal response from addOrderItem / updateOrderItem operations. */
|
|
649
|
+
export interface HclWcsOrderItemUpdateResponse {
|
|
650
|
+
orderId: string;
|
|
651
|
+
orderItem?: {
|
|
652
|
+
orderItemId: string;
|
|
653
|
+
}[];
|
|
654
|
+
}
|
|
655
|
+
/** Response from POST /store/{storeId}/cart/create_order */
|
|
656
|
+
export interface HclWcsCreateOrderResponse {
|
|
657
|
+
/** The newly created order ID. */
|
|
658
|
+
outOrderId: string;
|
|
659
|
+
redirecturl?: string;
|
|
660
|
+
viewTaskName?: string;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* A full order as returned by GET /wcs/resources/store/{storeId}/order/{orderId}.
|
|
664
|
+
* Extends the cart response shape with the `placedDate` field that is only
|
|
665
|
+
* present on placed (non-active) orders.
|
|
666
|
+
*/
|
|
667
|
+
export interface HclWcsOrderDetailResponse extends HclWcsCartResponse {
|
|
668
|
+
/** Date/time when the order was placed, e.g. '2024-01-15T10:30:00.000Z'. */
|
|
669
|
+
placedDate?: string;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* A single summary entry in a GET /wcs/resources/store/{storeId}/order/@history response.
|
|
673
|
+
* Contains only the fields available in the history list; use getById for full detail.
|
|
674
|
+
*/
|
|
675
|
+
export interface HclWcsOrderHistoryItem {
|
|
676
|
+
orderId: string;
|
|
677
|
+
/** WCS order status code, e.g. 'P', 'M', 'S', 'X'. */
|
|
678
|
+
status: string;
|
|
679
|
+
placedDate?: string;
|
|
680
|
+
grandTotal?: string;
|
|
681
|
+
grandTotalCurrency?: string;
|
|
682
|
+
totalProductPrice?: string;
|
|
683
|
+
orderDescription?: string;
|
|
684
|
+
buyerDistinguishedName?: string;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Top-level response from GET /wcs/resources/store/{storeId}/order/@history.
|
|
688
|
+
* Returns a paginated list of the buyer's past orders.
|
|
689
|
+
*/
|
|
690
|
+
export interface HclWcsOrderHistoryResponse {
|
|
691
|
+
Order?: HclWcsOrderHistoryItem[];
|
|
692
|
+
recordSetTotal?: string;
|
|
693
|
+
recordSetCount?: string;
|
|
694
|
+
recordSetStartNumber?: string;
|
|
695
|
+
recordSetComplete?: string;
|
|
696
|
+
}
|
package/src/test/test-utils.d.ts
CHANGED
|
@@ -5,11 +5,15 @@ export declare function createHclClient(contextOverrides?: Partial<RequestContex
|
|
|
5
5
|
product?: true | undefined;
|
|
6
6
|
productSearch?: true | undefined;
|
|
7
7
|
price?: false | undefined;
|
|
8
|
+
order?: false | undefined;
|
|
8
9
|
cart?: false | undefined;
|
|
9
10
|
checkout?: false | undefined;
|
|
11
|
+
identity?: false | undefined;
|
|
12
|
+
profile?: false | undefined;
|
|
10
13
|
inventory?: false | undefined;
|
|
11
14
|
category?: true | undefined;
|
|
12
|
-
|
|
15
|
+
orderSearch?: false | undefined;
|
|
16
|
+
}>, "product" | "productSearch" | "price" | "order" | "cart" | "checkout" | "identity" | "profile" | "inventory" | "category" | "orderSearch"> & {
|
|
13
17
|
product: import("../index.js").HclProductCapability<import("../index.js").HclProductFactory<import("zod").ZodObject<{
|
|
14
18
|
identifier: import("zod").ZodObject<{
|
|
15
19
|
key: import("zod").ZodString;
|