@infigo-official/types-for-pricing-script 1.0.2 → 1.0.4
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/README.md +426 -9
- package/package.json +4 -4
- package/v1/CheckoutItem/CheckoutItem.d.ts +368 -0
- package/v1/Configuration/Configuration.d.ts +30 -3
- package/v1/{Core → OrderItem}/Attribute.d.ts +1 -3
- package/v1/OrderItem/Item.d.ts +912 -0
- package/v1/{Core → OrderItem}/Tier.d.ts +14 -16
- package/v1/{Core → OrderItem}/Version.d.ts +1 -3
- package/v1/SessionItem/Session.d.ts +128 -0
- package/v1/index.d.ts +7 -5
- package/v1/Core/Item.d.ts +0 -403
- /package/v1/Helpers/{index.d.ts → Helpers.d.ts} +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Tier-based pricing functionality for pricing scripts.
|
|
3
3
|
* The tier system supports sophisticated quantity-based pricing models that can
|
|
4
4
|
* account for quantity discounts and customer-specific pricing including:
|
|
5
5
|
* - Quantity-based pricing tiers
|
|
6
6
|
* - Customer role-specific pricing
|
|
7
7
|
* - Volume discount calculations
|
|
8
8
|
* - Tier boundary management
|
|
9
|
-
*
|
|
10
|
-
* @module Item / Tier
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
11
|
/**
|
|
@@ -21,19 +19,6 @@
|
|
|
21
19
|
* role-based pricing strategies.
|
|
22
20
|
*/
|
|
23
21
|
declare interface Tier {
|
|
24
|
-
/**
|
|
25
|
-
* The quantity threshold for this tier.
|
|
26
|
-
* This value represents the minimum quantity required to qualify
|
|
27
|
-
* for this pricing tier. When the order quantity meets or exceeds
|
|
28
|
-
* this threshold, the tier's price is applied.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* if (Item.Quantity >= tier.Quantity) {
|
|
32
|
-
* return tier.Price; // Use tier pricing
|
|
33
|
-
* }
|
|
34
|
-
*/
|
|
35
|
-
Quantity: number;
|
|
36
|
-
|
|
37
22
|
/**
|
|
38
23
|
* The price for this tier.
|
|
39
24
|
* This value represents the unit price that applies when the order
|
|
@@ -46,6 +31,19 @@ declare interface Tier {
|
|
|
46
31
|
* }
|
|
47
32
|
*/
|
|
48
33
|
Price: number;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The quantity threshold for this tier.
|
|
37
|
+
* This value represents the minimum quantity required to qualify
|
|
38
|
+
* for this pricing tier. When the order quantity meets or exceeds
|
|
39
|
+
* this threshold, the tier's price is applied.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* if (Item.Quantity >= tier.Quantity) {
|
|
43
|
+
* return tier.Price; // Use tier pricing
|
|
44
|
+
* }
|
|
45
|
+
*/
|
|
46
|
+
Quantity: number;
|
|
49
47
|
|
|
50
48
|
/**
|
|
51
49
|
* The customer role system name that this tier applies to.
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Version management functionality for pricing scripts.
|
|
3
3
|
* The version system supports job versioning information including quantities
|
|
4
4
|
* and custom names, useful for tracking pricing changes across job iterations including:
|
|
5
5
|
* - Individual version information
|
|
6
6
|
* - Version collection management
|
|
7
7
|
* - Quantity tracking across versions
|
|
8
8
|
* - Version status and metadata
|
|
9
|
-
*
|
|
10
|
-
* @module Item / Version
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
11
|
/**
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module provides access to session-based functionality in pricing scripts.
|
|
3
|
+
* The Session object represents session-level data and provides access to customer
|
|
4
|
+
* information and shopping cart items at the session level including:
|
|
5
|
+
* - Customer session information
|
|
6
|
+
* - Shopping cart items across the session
|
|
7
|
+
* - Session-level customer data access
|
|
8
|
+
*
|
|
9
|
+
* @module SessionItem
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The session object available in pricing scripts.
|
|
14
|
+
* Represents session-level data and provides access to customer information
|
|
15
|
+
* and shopping cart items that are available during the current session.
|
|
16
|
+
*
|
|
17
|
+
* This object provides session-wide context for pricing calculations that
|
|
18
|
+
* may need to consider multiple items or customer session data.
|
|
19
|
+
*/
|
|
20
|
+
declare interface Session {
|
|
21
|
+
/**
|
|
22
|
+
* Array of shopping cart items in the current session.
|
|
23
|
+
* Contains all active shopping cart items for the current customer session.
|
|
24
|
+
* Each item provides full access to product information, attributes, and pricing data.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* console("Session has " + Session.CartItems.length + " items");
|
|
28
|
+
* for (var i = 0; i < Session.CartItems.length; i++) {
|
|
29
|
+
* var item = Session.CartItems[i];
|
|
30
|
+
* console("Item: " + item.ProductName + " - $" + item.Price);
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
CartItems: Item[];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Alias for CartItems - array of other order items in the session.
|
|
37
|
+
* Provides the same functionality as CartItems for backward compatibility.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* var totalSessionValue = 0;
|
|
41
|
+
* for (var i = 0; i < Session.OtherOrderItems.length; i++) {
|
|
42
|
+
* totalSessionValue += Session.OtherOrderItems[i].Price * Session.OtherOrderItems[i].Quantity;
|
|
43
|
+
* }
|
|
44
|
+
* console("Total session cart value: $" + totalSessionValue);
|
|
45
|
+
*/
|
|
46
|
+
OtherOrderItems: Item[];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Customer email address for the current session.
|
|
50
|
+
* Provides access to the customer's email address associated with the session.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* console("Session customer email: " + Session.Email);
|
|
54
|
+
* if (Session.Email.endsWith(".edu")) {
|
|
55
|
+
* console("Educational customer detected");
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
Email: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Array of customer role system names for the current session.
|
|
62
|
+
* Contains all roles assigned to the customer in the current session.
|
|
63
|
+
* Used for role-based pricing and access control.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* console("Customer roles: " + Session.CustomerRoles.join(", "));
|
|
67
|
+
* if (Session.CustomerRoles.includes("VIP")) {
|
|
68
|
+
* console("VIP customer - apply special pricing");
|
|
69
|
+
* }
|
|
70
|
+
*/
|
|
71
|
+
CustomerRoles: string[];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Department name of the customer for the current session.
|
|
75
|
+
* Represents the department or organizational unit the customer belongs to.
|
|
76
|
+
* Used for department-specific pricing and business logic.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* console("Customer department: " + Session.Department);
|
|
80
|
+
* if (Session.Department === "Education") {
|
|
81
|
+
* console("Educational department - apply academic discount");
|
|
82
|
+
* }
|
|
83
|
+
*/
|
|
84
|
+
Department: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Global Session object available in pricing scripts.
|
|
89
|
+
* This constant provides access to session-level data and functionality,
|
|
90
|
+
* allowing scripts to access customer session information and shopping cart data
|
|
91
|
+
* across the entire session context.
|
|
92
|
+
*
|
|
93
|
+
* The Session object is particularly useful for pricing scripts that need to:
|
|
94
|
+
* - Consider multiple items in the cart for volume discounts
|
|
95
|
+
* - Apply session-level customer information
|
|
96
|
+
* - Implement cross-item pricing logic
|
|
97
|
+
* - Access customer roles and department information
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* // Check if customer has multiple items for volume pricing
|
|
101
|
+
* if (Session.CartItems.length > 1) {
|
|
102
|
+
* console("Multiple items in cart - check for volume discounts");
|
|
103
|
+
* var cartTotal = 0;
|
|
104
|
+
* for (var i = 0; i < Session.CartItems.length; i++) {
|
|
105
|
+
* cartTotal += Session.CartItems[i].Price * Session.CartItems[i].Quantity;
|
|
106
|
+
* }
|
|
107
|
+
*
|
|
108
|
+
* if (cartTotal > 500) {
|
|
109
|
+
* console("Cart total over $500 - apply volume discount");
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* // Apply role-based session pricing
|
|
114
|
+
* if (Session.CustomerRoles.includes("Wholesale")) {
|
|
115
|
+
* console("Wholesale customer session - apply wholesale pricing");
|
|
116
|
+
* }
|
|
117
|
+
*
|
|
118
|
+
* // Department-specific session logic
|
|
119
|
+
* if (Session.Department === "Marketing") {
|
|
120
|
+
* console("Marketing department session - apply marketing discounts");
|
|
121
|
+
* }
|
|
122
|
+
*
|
|
123
|
+
* // Customer email-based logic
|
|
124
|
+
* if (Session.Email.includes("@company.com")) {
|
|
125
|
+
* console("Internal company customer - apply employee pricing");
|
|
126
|
+
* }
|
|
127
|
+
*/
|
|
128
|
+
declare const Session: Session;
|
package/v1/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
/// <reference path="
|
|
2
|
-
/// <reference path="
|
|
3
|
-
/// <reference path="
|
|
4
|
-
/// <reference path="
|
|
1
|
+
/// <reference path="OrderItem/Item.d.ts" />
|
|
2
|
+
/// <reference path="OrderItem/Attribute.d.ts" />
|
|
3
|
+
/// <reference path="OrderItem/Tier.d.ts" />
|
|
4
|
+
/// <reference path="OrderItem/Version.d.ts" />
|
|
5
5
|
/// <reference path="File/FileInfo.d.ts" />
|
|
6
6
|
/// <reference path="Configuration/Configuration.d.ts" />
|
|
7
7
|
/// <reference path="Output/Output.d.ts" />
|
|
8
|
-
/// <reference path="Helpers/
|
|
8
|
+
/// <reference path="Helpers/Helpers.d.ts" />
|
|
9
|
+
/// <reference path="SessionItem/Session.d.ts" />
|
|
10
|
+
/// <reference path="CheckoutItem/CheckoutItem.d.ts" />
|
package/v1/Core/Item.d.ts
DELETED
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This module provides access to the main item object in pricing scripts.
|
|
3
|
-
* The Item interface represents the product variant being priced and contains all
|
|
4
|
-
* the essential information needed for pricing calculations including:
|
|
5
|
-
* - Product pricing information (base price, special prices, costs)
|
|
6
|
-
* - Product details (SKU, name, categories, dimensions)
|
|
7
|
-
* - Quantity and packaging information
|
|
8
|
-
* - Attribute management and pricing adjustments
|
|
9
|
-
* - File handling capabilities
|
|
10
|
-
* - Tier-based pricing support
|
|
11
|
-
*
|
|
12
|
-
* @module Item
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The main item object available in pricing scripts.
|
|
17
|
-
* Represents the product variant being priced and provides access to all
|
|
18
|
-
* product information, attributes, pricing data, and methods for file handling
|
|
19
|
-
* and attribute management.
|
|
20
|
-
*
|
|
21
|
-
* This object is the primary interface for accessing product data and performing
|
|
22
|
-
* pricing calculations in pricing scripts.
|
|
23
|
-
*/
|
|
24
|
-
declare interface Item {
|
|
25
|
-
/**
|
|
26
|
-
* The standard product variant price in the base currency.
|
|
27
|
-
* This is the base price before any attribute adjustments, tier pricing,
|
|
28
|
-
* or special pricing is applied.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* var basePrice = Item.Price;
|
|
32
|
-
* var adjustedPrice = basePrice * 1.2; // 20% markup
|
|
33
|
-
*/
|
|
34
|
-
Price: number;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The old price from the product variant, typically used for displaying
|
|
38
|
-
* price comparisons or discounts. This value represents the previous
|
|
39
|
-
* price before any recent price changes.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* if (Item.OldPrice > Item.Price) {
|
|
43
|
-
* var discount = Item.OldPrice - Item.Price;
|
|
44
|
-
* return "Save $" + discount.toFixed(2);
|
|
45
|
-
* }
|
|
46
|
-
*/
|
|
47
|
-
OldPrice: number;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The product cost, representing the actual cost to produce or acquire
|
|
51
|
-
* the product. This value is used for margin calculations and profit analysis.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* var margin = Item.Price - Item.ProductCost;
|
|
55
|
-
* var marginPercentage = (margin / Item.Price) * 100;
|
|
56
|
-
*/
|
|
57
|
-
ProductCost: number;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* The special price for the product variant, if applicable.
|
|
61
|
-
* This value is null if no special pricing is currently active.
|
|
62
|
-
* Special pricing typically overrides the standard price for promotional periods.
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* var finalPrice = Item.SpecialPrice || Item.Price;
|
|
66
|
-
*/
|
|
67
|
-
SpecialPrice: number | null;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* The start date for special pricing, if applicable.
|
|
71
|
-
* This value is null if no special pricing is currently active.
|
|
72
|
-
* Used to determine if special pricing should be applied based on current date.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* var now = new Date();
|
|
76
|
-
* if (Item.SpecialPriceStartDate && now >= Item.SpecialPriceStartDate) {
|
|
77
|
-
* return Item.SpecialPrice;
|
|
78
|
-
* }
|
|
79
|
-
*/
|
|
80
|
-
SpecialPriceStartDate: Date | null;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* The end date for special pricing, if applicable.
|
|
84
|
-
* This value is null if no special pricing is currently active.
|
|
85
|
-
* Used to determine if special pricing should be applied based on current date.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* var now = new Date();
|
|
89
|
-
* if (Item.SpecialPriceEndDate && now <= Item.SpecialPriceEndDate) {
|
|
90
|
-
* return Item.SpecialPrice;
|
|
91
|
-
* }
|
|
92
|
-
*/
|
|
93
|
-
SpecialPriceEndDate: Date | null;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Additional shipping charge for this specific product variant.
|
|
97
|
-
* This value is added to the base shipping cost and represents
|
|
98
|
-
* any extra shipping fees specific to this item.
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* var totalShipping = baseShippingCost + Item.AdditionalShippingCharge;
|
|
102
|
-
*/
|
|
103
|
-
AdditionalShippingCharge: number;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The weight of the item in the configured weight unit (typically grams or ounces).
|
|
107
|
-
* This value is used for shipping calculations and weight-based pricing.
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
* var shippingCost = calculateShippingByWeight(Item.Weight);
|
|
111
|
-
*/
|
|
112
|
-
Weight: number;
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Indicates whether the weight can be set or modified for this item.
|
|
116
|
-
* Some products may have fixed weights that cannot be changed,
|
|
117
|
-
* while others allow weight adjustments based on attributes or custom settings.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* if (Item.CanSetWeight) {
|
|
121
|
-
* // Allow weight adjustments in the UI
|
|
122
|
-
* }
|
|
123
|
-
*/
|
|
124
|
-
CanSetWeight: boolean;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* The Stock Keeping Unit (SKU) of the product variant.
|
|
128
|
-
* This is the unique identifier for the product variant and is used
|
|
129
|
-
* for inventory management and order processing.
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* var productIdentifier = Item.Sku;
|
|
133
|
-
*/
|
|
134
|
-
Sku: string;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* The actual SKU based on the current attribute combination.
|
|
138
|
-
* If no attributes are selected, this will be the same as the product SKU.
|
|
139
|
-
* This value reflects the specific configuration of the product being priced.
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* var configuredSku = Item.ActualSku;
|
|
143
|
-
*/
|
|
144
|
-
ActualSku: string;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* The width of the item in the configured dimension unit (typically inches or centimeters).
|
|
148
|
-
* This value is used for packaging calculations and dimensional pricing.
|
|
149
|
-
*
|
|
150
|
-
* @example
|
|
151
|
-
* var packagingCost = calculatePackagingCost(Item.Width, Item.Height, Item.Length);
|
|
152
|
-
*/
|
|
153
|
-
Width: number;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* The height of the item in the configured dimension unit (typically inches or centimeters).
|
|
157
|
-
* This value is used for packaging calculations and dimensional pricing.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* var packagingCost = calculatePackagingCost(Item.Width, Item.Height, Item.Length);
|
|
161
|
-
*/
|
|
162
|
-
Height: number;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* The length of the item in the configured dimension unit (typically inches or centimeters).
|
|
166
|
-
* This value is used for packaging calculations and dimensional pricing.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* var packagingCost = calculatePackagingCost(Item.Width, Item.Height, Item.Length);
|
|
170
|
-
*/
|
|
171
|
-
Length: number;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* The name of the product as displayed to customers.
|
|
175
|
-
* This is the human-readable product name used in the user interface
|
|
176
|
-
* and order confirmations.
|
|
177
|
-
*
|
|
178
|
-
* @example
|
|
179
|
-
* var displayName = Item.ProductName;
|
|
180
|
-
*/
|
|
181
|
-
ProductName: string;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Array of category names that this product belongs to.
|
|
185
|
-
* Categories are used for product organization, filtering, and
|
|
186
|
-
* category-specific pricing rules.
|
|
187
|
-
*
|
|
188
|
-
* @example
|
|
189
|
-
* if (Item.Categories.includes("Premium")) {
|
|
190
|
-
* return Item.Price * 1.1; // 10% premium markup
|
|
191
|
-
* }
|
|
192
|
-
*/
|
|
193
|
-
Categories: string[];
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* The order quantity for this item.
|
|
197
|
-
* This represents how many units of this product variant are being ordered.
|
|
198
|
-
* Used for quantity-based pricing and tier calculations.
|
|
199
|
-
*
|
|
200
|
-
* @example
|
|
201
|
-
* var tier = HelperMethods.FindTier(Item.Quantity, Item.PricingTiers);
|
|
202
|
-
*/
|
|
203
|
-
Quantity: number;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* The pack quantity, calculated as the order quantity divided by the product variant's
|
|
207
|
-
* OrderPackQuantity. This represents how many packs are being ordered.
|
|
208
|
-
*
|
|
209
|
-
* @example
|
|
210
|
-
* var packPrice = Item.Price * Item.PackQuantity;
|
|
211
|
-
*/
|
|
212
|
-
PackQuantity: number;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* The quantity selector mode for this product.
|
|
216
|
-
* This determines how quantity selection is handled in the user interface
|
|
217
|
-
* and affects pricing calculations.
|
|
218
|
-
*
|
|
219
|
-
* @example
|
|
220
|
-
* switch (Item.QuantitySelectorMode) {
|
|
221
|
-
* case 1: // Individual units
|
|
222
|
-
* return Item.Price * Item.Quantity;
|
|
223
|
-
* case 2: // Packs
|
|
224
|
-
* return Item.Price * Item.PackQuantity;
|
|
225
|
-
* }
|
|
226
|
-
*/
|
|
227
|
-
QuantitySelectorMode: number;
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Whether this is a batch job
|
|
231
|
-
*/
|
|
232
|
-
IsBatch: boolean;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Number of pages (-1 if not valid)
|
|
236
|
-
*/
|
|
237
|
-
NumberOfPages: number;
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Number of records (-1 if not valid)
|
|
241
|
-
*/
|
|
242
|
-
NumberOfRecords: number;
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Array of pricing tiers with Price, Quantity, and CustomerRole
|
|
246
|
-
*/
|
|
247
|
-
PricingTiers: Tier[];
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Array of batch tiers (same as PricingTiers but for batch tier table)
|
|
251
|
-
*/
|
|
252
|
-
BatchTiers: Tier[];
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Price per record (-1 if not valid)
|
|
256
|
-
*/
|
|
257
|
-
PricePerRecord: number;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Array of attributes with Key, Value, IsRequired, Prompt, PriceAdjustment, etc.
|
|
261
|
-
*/
|
|
262
|
-
Attributes: Attribute[];
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* User email
|
|
266
|
-
*/
|
|
267
|
-
Email: string;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Array of customer role system names
|
|
271
|
-
*/
|
|
272
|
-
CustomerRoles: string[];
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Department name of user
|
|
276
|
-
*/
|
|
277
|
-
Department: string;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Array of other order items using the same custom pricing script
|
|
281
|
-
*/
|
|
282
|
-
OtherOrderItems: Item[];
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Alias of OtherOrderItems
|
|
286
|
-
*/
|
|
287
|
-
CartItems: Item[];
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Index of this item in the other order item array (0 if not in array)
|
|
291
|
-
*/
|
|
292
|
-
OrderItemIndex: number;
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Index of this item in the other order item array (-1 if not in array)
|
|
296
|
-
*/
|
|
297
|
-
CartItemIndex: number;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Whether this item is in the other order item array
|
|
301
|
-
*/
|
|
302
|
-
IsInOtherOrderItems: boolean;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Value of the currently used discount code
|
|
306
|
-
*/
|
|
307
|
-
DiscountCode: string;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Array of versions with JobId, CustomName, and Quantity
|
|
311
|
-
*/
|
|
312
|
-
Versions: ItemVersion[];
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Number of versions
|
|
316
|
-
*/
|
|
317
|
-
NumberOfVersions: number;
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Whether this is a version of a job
|
|
321
|
-
*/
|
|
322
|
-
IsVersion: boolean;
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Sum of all quantities of all versions
|
|
326
|
-
*/
|
|
327
|
-
VersionsSumQuantity: number;
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* Get file information for attached files
|
|
331
|
-
* @param attributeId - ID of the attribute
|
|
332
|
-
* @param readContent - Whether to read file content
|
|
333
|
-
* @returns FileInfo object
|
|
334
|
-
*/
|
|
335
|
-
getFileInfo(attributeId: string, readContent: boolean): FileInfo;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Shortcut method to retrieve an attribute value by name
|
|
339
|
-
* @param attribute - Name of the attribute
|
|
340
|
-
* @returns Attribute value
|
|
341
|
-
*/
|
|
342
|
-
getAttributeValue(attribute: string): string;
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Set the attribute value permanently to the given value
|
|
346
|
-
* @param attribute - Name of the attribute
|
|
347
|
-
* @param value - Value to set
|
|
348
|
-
*/
|
|
349
|
-
setAttributeValue(attribute: string, value: string): void;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Get file information for a specific configurable file from Global Data
|
|
353
|
-
* @param filename - Name of the file
|
|
354
|
-
* @returns FileInfo object
|
|
355
|
-
*/
|
|
356
|
-
getGlobalFileContent(filename: string): FileInfo;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Global Item object available in pricing scripts
|
|
361
|
-
* This constant provides access to all item-related data and functionality,
|
|
362
|
-
* allowing scripts to retrieve product information, pricing data, attributes,
|
|
363
|
-
* and perform various operations on the current item being priced.
|
|
364
|
-
*
|
|
365
|
-
* The Item object contains comprehensive information about the product variant
|
|
366
|
-
* including pricing details, attributes, customer information, file attachments,
|
|
367
|
-
* and methods for data manipulation and file handling.
|
|
368
|
-
*
|
|
369
|
-
* @example
|
|
370
|
-
* // Access basic product information
|
|
371
|
-
* var productName = Item.ProductName;
|
|
372
|
-
* var basePrice = Item.Price;
|
|
373
|
-
* var quantity = Item.Quantity;
|
|
374
|
-
*
|
|
375
|
-
* // Work with attributes
|
|
376
|
-
* for (var i = 0; i < Item.Attributes.length; i++) {
|
|
377
|
-
* var attr = Item.Attributes[i];
|
|
378
|
-
* debug("Attribute: " + attr.Key + " = " + attr.Value);
|
|
379
|
-
* }
|
|
380
|
-
*
|
|
381
|
-
* // Get file information
|
|
382
|
-
* var fileInfo = Item.getFileInfo("fileAttributeId", true);
|
|
383
|
-
* if (fileInfo.NumberOfPages > 0) {
|
|
384
|
-
* debug("File has " + fileInfo.NumberOfPages + " pages");
|
|
385
|
-
* }
|
|
386
|
-
*
|
|
387
|
-
* // Access customer information
|
|
388
|
-
* if (Item.CustomerRoles.indexOf("VIP") >= 0) {
|
|
389
|
-
* // Apply VIP pricing logic
|
|
390
|
-
* }
|
|
391
|
-
*
|
|
392
|
-
* // Work with pricing tiers
|
|
393
|
-
* var tier = HelperMethods.FindTier(Item.Quantity, Item.PricingTiers, Item.CustomerRoles);
|
|
394
|
-
* if (tier) {
|
|
395
|
-
* debug("Using tier: " + tier.Quantity + " @ $" + tier.Price);
|
|
396
|
-
* }
|
|
397
|
-
*
|
|
398
|
-
* // Calculate final price
|
|
399
|
-
* var finalPrice = Item.Price;
|
|
400
|
-
* finalPrice += HelperMethods.GetAttributePriceAdjustment(Item.Quantity, Item.CustomerRoles);
|
|
401
|
-
* return finalPrice;
|
|
402
|
-
*/
|
|
403
|
-
declare const Item: Item;
|
|
File without changes
|