@infigo-official/types-for-pricing-script 1.0.2 → 1.0.3

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/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@infigo-official/types-for-pricing-script",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Type definitions for Pricing Script Scripting",
5
5
  "types": "v1/index.d.ts",
6
6
  "devDependencies": {
7
+ "http-server": "^14.1.1",
7
8
  "typedoc": "^0.24.8",
8
9
  "typescript": "^4.9.5"
9
10
  },
@@ -0,0 +1,368 @@
1
+ /**
2
+ * This module provides access to checkout-specific functionality in pricing scripts.
3
+ * The CheckoutItem object represents checkout-level data and provides access to
4
+ * comprehensive checkout information including:
5
+ * - Customer checkout information
6
+ * - Shipping address details
7
+ * - Geographic information (country, state/province)
8
+ * - Checkout properties and mode
9
+ * - All items being checked out
10
+ *
11
+ * @module CheckoutItem
12
+ */
13
+
14
+ /**
15
+ * Represents customer information during checkout.
16
+ * Provides access to customer details that are relevant during the checkout process
17
+ * including personal information, roles, and organizational details.
18
+ */
19
+ declare interface CheckoutCustomer {
20
+ /**
21
+ * Customer's first name.
22
+ *
23
+ * @example
24
+ * console("Customer first name: " + CheckoutItem.Customer.FirstName);
25
+ */
26
+ FirstName: string;
27
+
28
+ /**
29
+ * Customer's last name.
30
+ *
31
+ * @example
32
+ * console("Customer last name: " + CheckoutItem.Customer.LastName);
33
+ */
34
+ LastName: string;
35
+
36
+ /**
37
+ * Customer's email address.
38
+ *
39
+ * @example
40
+ * console("Customer email: " + CheckoutItem.Customer.Email);
41
+ * if (CheckoutItem.Customer.Email.endsWith(".edu")) {
42
+ * console("Educational customer - apply academic pricing");
43
+ * }
44
+ */
45
+ Email: string;
46
+
47
+ /**
48
+ * Array of customer role system names.
49
+ * Contains all roles assigned to the customer for role-based pricing logic.
50
+ *
51
+ * @example
52
+ * console("Customer roles: " + CheckoutItem.Customer.Roles.join(", "));
53
+ * if (CheckoutItem.Customer.Roles.includes("VIP")) {
54
+ * console("VIP customer checkout");
55
+ * }
56
+ */
57
+ Roles: string[];
58
+
59
+ /**
60
+ * Department name of the customer.
61
+ * Represents the organizational department the customer belongs to.
62
+ *
63
+ * @example
64
+ * if (CheckoutItem.Customer.DepartmentName === "Procurement") {
65
+ * console("Procurement department checkout - apply bulk pricing");
66
+ * }
67
+ */
68
+ DepartmentName: string;
69
+ }
70
+
71
+ /**
72
+ * Represents country information during checkout.
73
+ * Provides access to country details for geographic-based pricing and shipping calculations.
74
+ */
75
+ declare interface CheckoutCountry {
76
+ /**
77
+ * Full country name.
78
+ *
79
+ * @example
80
+ * console("Shipping to country: " + CheckoutItem.CountryFrom.Name);
81
+ */
82
+ Name: string;
83
+
84
+ /**
85
+ * Two-letter ISO country code.
86
+ *
87
+ * @example
88
+ * if (CheckoutItem.CountryFrom.TwoLetterIsoCode === "US") {
89
+ * console("Domestic US shipping");
90
+ * }
91
+ */
92
+ TwoLetterIsoCode: string;
93
+
94
+ /**
95
+ * Three-letter ISO country code.
96
+ *
97
+ * @example
98
+ * console("Country code: " + CheckoutItem.CountryFrom.ThreeLetterIsoCode);
99
+ */
100
+ ThreeLetterIsoCode: string;
101
+
102
+ /**
103
+ * Numeric ISO country code.
104
+ *
105
+ * @example
106
+ * console("Numeric country code: " + CheckoutItem.CountryFrom.NumericIsoCode);
107
+ */
108
+ NumericIsoCode: number;
109
+ }
110
+
111
+ /**
112
+ * Represents state/province information during checkout.
113
+ * Provides access to state or province details for regional pricing and shipping.
114
+ */
115
+ declare interface CheckoutStateProvince {
116
+ /**
117
+ * Full state or province name.
118
+ *
119
+ * @example
120
+ * console("Shipping to state: " + CheckoutItem.StateProvince.Name);
121
+ */
122
+ Name: string;
123
+
124
+ /**
125
+ * State or province abbreviation.
126
+ *
127
+ * @example
128
+ * if (CheckoutItem.StateProvince.Abbreviation === "CA") {
129
+ * console("California shipping - apply CA tax");
130
+ * }
131
+ */
132
+ Abbreviation: string;
133
+ }
134
+
135
+ /**
136
+ * Represents shipping address information during checkout.
137
+ * Provides comprehensive access to the shipping address details.
138
+ */
139
+ declare interface CheckoutAddress {
140
+ /**
141
+ * First name on the shipping address.
142
+ */
143
+ FirstName: string;
144
+
145
+ /**
146
+ * Last name on the shipping address.
147
+ */
148
+ LastName: string;
149
+
150
+ /**
151
+ * Email address on the shipping address.
152
+ */
153
+ Email: string;
154
+
155
+ /**
156
+ * Company name on the shipping address.
157
+ *
158
+ * @example
159
+ * if (CheckoutItem.Address.Company) {
160
+ * console("Business address - company: " + CheckoutItem.Address.Company);
161
+ * }
162
+ */
163
+ Company: string;
164
+
165
+ /**
166
+ * City name on the shipping address.
167
+ *
168
+ * @example
169
+ * console("Shipping to city: " + CheckoutItem.Address.City);
170
+ */
171
+ City: string;
172
+
173
+ /**
174
+ * Primary address line.
175
+ */
176
+ Address1: string;
177
+
178
+ /**
179
+ * Secondary address line (apartment, suite, etc.).
180
+ */
181
+ Address2: string;
182
+
183
+ /**
184
+ * ZIP or postal code.
185
+ *
186
+ * @example
187
+ * console("Shipping ZIP: " + CheckoutItem.Address.ZipPostalCode);
188
+ */
189
+ ZipPostalCode: string;
190
+
191
+ /**
192
+ * Phone number on the shipping address.
193
+ */
194
+ PhoneNumber: string;
195
+
196
+ /**
197
+ * Fax number on the shipping address.
198
+ */
199
+ FaxNumber: string;
200
+
201
+ /**
202
+ * Country information for the shipping address.
203
+ */
204
+ Country: CheckoutCountry;
205
+
206
+ /**
207
+ * State/province information for the shipping address.
208
+ */
209
+ StateProvince: CheckoutStateProvince;
210
+ }
211
+
212
+ /**
213
+ * The checkout item object available in checkout pricing scripts.
214
+ * Represents comprehensive checkout information including all items being purchased,
215
+ * customer details, shipping information, and checkout context.
216
+ *
217
+ * This object provides complete checkout context for pricing calculations that
218
+ * need to consider shipping, customer information, and multi-item scenarios.
219
+ */
220
+ declare interface CheckoutItem {
221
+ /**
222
+ * Array of all items being checked out.
223
+ * Contains complete item information for all products in the checkout process.
224
+ *
225
+ * @example
226
+ * console("Checkout contains " + CheckoutItem.Items.length + " items");
227
+ * var checkoutTotal = 0;
228
+ * for (var i = 0; i < CheckoutItem.Items.length; i++) {
229
+ * var item = CheckoutItem.Items[i];
230
+ * checkoutTotal += item.Price * item.Quantity;
231
+ * console("Item " + (i + 1) + ": " + item.ProductName + " - $" + item.Price);
232
+ * }
233
+ * console("Checkout subtotal: $" + checkoutTotal);
234
+ */
235
+ Items: Item[];
236
+
237
+ /**
238
+ * Customer information for the checkout.
239
+ * Provides access to customer details including name, email, roles, and department.
240
+ *
241
+ * @example
242
+ * var customer = CheckoutItem.Customer;
243
+ * console("Checkout for: " + customer.FirstName + " " + customer.LastName);
244
+ * console("Email: " + customer.Email);
245
+ * console("Department: " + customer.DepartmentName);
246
+ */
247
+ Customer: CheckoutCustomer;
248
+
249
+ /**
250
+ * Origin country information for shipping calculations.
251
+ * Represents the country from which items are being shipped.
252
+ *
253
+ * @example
254
+ * if (CheckoutItem.CountryFrom) {
255
+ * console("Shipping from: " + CheckoutItem.CountryFrom.Name);
256
+ * }
257
+ */
258
+ CountryFrom: CheckoutCountry;
259
+
260
+ /**
261
+ * Origin ZIP/postal code for shipping calculations.
262
+ * Represents the postal code from which items are being shipped.
263
+ *
264
+ * @example
265
+ * console("Origin ZIP: " + CheckoutItem.ZipPostalCodeFrom);
266
+ */
267
+ ZipPostalCodeFrom: string;
268
+
269
+ /**
270
+ * Additional properties for the checkout.
271
+ * Contains key-value pairs of additional checkout-specific information.
272
+ *
273
+ * @example
274
+ * console("Checkout properties:");
275
+ * for (var key in CheckoutItem.Properties) {
276
+ * console(" " + key + ": " + CheckoutItem.Properties[key]);
277
+ * }
278
+ */
279
+ Properties: { [key: string]: string };
280
+
281
+ /**
282
+ * Checkout mode or type.
283
+ * Indicates the type of checkout being performed (e.g., "standard", "express", etc.).
284
+ *
285
+ * @example
286
+ * console("Checkout mode: " + CheckoutItem.Mode);
287
+ * if (CheckoutItem.Mode === "express") {
288
+ * console("Express checkout - apply expedited processing");
289
+ * }
290
+ */
291
+ Mode: string;
292
+
293
+ /**
294
+ * State/province information for shipping destination.
295
+ * Provides state or province details for the shipping destination.
296
+ *
297
+ * @example
298
+ * if (CheckoutItem.StateProvince) {
299
+ * console("Shipping to state: " + CheckoutItem.StateProvince.Name);
300
+ * console("State abbreviation: " + CheckoutItem.StateProvince.Abbreviation);
301
+ * }
302
+ */
303
+ StateProvince: CheckoutStateProvince;
304
+
305
+ /**
306
+ * Complete shipping address information.
307
+ * Provides comprehensive shipping address details including contact information.
308
+ *
309
+ * @example
310
+ * var address = CheckoutItem.Address;
311
+ * if (address) {
312
+ * console("Shipping Address:");
313
+ * console(" " + address.FirstName + " " + address.LastName);
314
+ * if (address.Company) console(" " + address.Company);
315
+ * console(" " + address.Address1);
316
+ * if (address.Address2) console(" " + address.Address2);
317
+ * console(" " + address.City + ", " + address.StateProvince.Abbreviation + " " + address.ZipPostalCode);
318
+ * console(" " + address.Country.Name);
319
+ * }
320
+ */
321
+ Address: CheckoutAddress;
322
+ }
323
+
324
+ /**
325
+ * Global CheckoutItem object available in checkout pricing scripts.
326
+ * This constant provides access to comprehensive checkout information,
327
+ * allowing scripts to access customer details, shipping information,
328
+ * and all items being processed during checkout.
329
+ *
330
+ * The CheckoutItem object is essential for checkout-specific pricing scripts that need to:
331
+ * - Calculate shipping costs based on destination
332
+ * - Apply geographic-based pricing or taxes
333
+ * - Consider multiple items for checkout-level discounts
334
+ * - Access customer information for personalized pricing
335
+ * - Implement address-based business logic
336
+ *
337
+ * @example
338
+ * // Geographic-based pricing
339
+ * if (CheckoutItem.Address && CheckoutItem.Address.Country.TwoLetterIsoCode === "CA") {
340
+ * console("Canadian shipping - apply CAD pricing");
341
+ * }
342
+ *
343
+ * // Multi-item checkout discounts
344
+ * if (CheckoutItem.Items.length >= 3) {
345
+ * console("Multi-item checkout - apply bundle discount");
346
+ * }
347
+ *
348
+ * // Customer role-based checkout pricing
349
+ * if (CheckoutItem.Customer.Roles.includes("Premium")) {
350
+ * console("Premium customer checkout - free shipping");
351
+ * }
352
+ *
353
+ * // Business address detection
354
+ * if (CheckoutItem.Address.Company) {
355
+ * console("Business checkout - apply B2B pricing");
356
+ * }
357
+ *
358
+ * // Express checkout handling
359
+ * if (CheckoutItem.Mode === "express") {
360
+ * console("Express checkout - add expedited processing fee");
361
+ * }
362
+ *
363
+ * // State-specific tax calculation
364
+ * if (CheckoutItem.StateProvince && CheckoutItem.StateProvince.Abbreviation === "NY") {
365
+ * console("New York delivery - apply NY state tax");
366
+ * }
367
+ */
368
+ declare const CheckoutItem: CheckoutItem;
@@ -10,6 +10,23 @@
10
10
  * @module Configuration
11
11
  */
12
12
 
13
+ /**
14
+ * Interface representing the configuration object.
15
+ */
16
+ interface Configuration {
17
+ /**
18
+ * Retrieves the script configuration.
19
+ * @returns The script configuration object.
20
+ */
21
+ ScriptConfig: () => any;
22
+
23
+ /**
24
+ * Retrieves the parameters configuration.
25
+ * @returns `null` as parameters are not yet supported.
26
+ */
27
+ Parameters: () => any | null;
28
+ }
29
+
13
30
  /**
14
31
  * Provides access to script configuration settings and parameters.
15
32
  * This interface allows pricing scripts to retrieve configuration data
@@ -36,15 +53,25 @@ declare interface ConfigurationInterface {
36
53
  ScriptConfig: any;
37
54
  }
38
55
 
56
+ /**
57
+ * Represents a Configuration interface.
58
+ */
59
+
39
60
  /**
40
61
  * Global Configuration object available in pricing scripts.
41
62
  * This constant provides access to the configuration interface,
42
63
  * allowing scripts to retrieve configuration settings and parameters.
43
64
  *
44
65
  * @example
45
- * var scriptConfig = Configuration.ScriptConfig;
46
- * var customSetting = scriptConfig.customParameter;
66
+ * var scriptConfig = Configuration.ScriptConfig();
67
+ * console("Script configuration loaded: " + JSON.stringify(scriptConfig));
68
+ *
69
+ * var markupPercentage = scriptConfig.markupPercentage || 20;
70
+ * console("Using markup percentage: " + markupPercentage + "%");
71
+ *
72
+ * var parameters = Configuration.Parameters();
73
+ * console("Parameters available: " + JSON.stringify(parameters));
47
74
  */
48
- declare const Configuration: ConfigurationInterface;
75
+ declare const Configuration: Configuration;
49
76
 
50
77
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * This module provides access to attribute management functionality in pricing scripts.
2
+ * Attribute management functionality for pricing scripts.
3
3
  * Attributes represent configurable options for products that can affect pricing, weight, and dimensions.
4
4
  * The attribute system provides a flexible way to handle complex product configurations including:
5
5
  * - Product options and variants
@@ -7,8 +7,6 @@
7
7
  * - Weight and dimensional modifications
8
8
  * - Tier-based pricing adjustments
9
9
  * - Required vs optional attributes
10
- *
11
- * @module Item / Attribute
12
10
  */
13
11
 
14
12
  /**