@jay-framework/wix-cart 0.15.0

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.
@@ -0,0 +1,43 @@
1
+ name: cart-indicator
2
+ description: Cart indicator component showing item count, typically used in site header/navigation
3
+
4
+ tags:
5
+ # Cart count
6
+ - tag: itemCount
7
+ type: data
8
+ dataType: number
9
+ phase: fast+interactive
10
+ description: Total number of items in cart
11
+
12
+ - tag: hasItems
13
+ type: variant
14
+ dataType: boolean
15
+ phase: fast+interactive
16
+ description: Whether cart has any items
17
+
18
+ # Interactive elements
19
+ - tag: cartButton
20
+ type: interactive
21
+ elementType: HTMLButtonElement
22
+ description: Button to open cart (mini-cart or navigate to cart page)
23
+
24
+ - tag: cartLink
25
+ type: interactive
26
+ elementType: HTMLAnchorElement
27
+ description: Link to cart page
28
+
29
+ # Loading state
30
+ - tag: isLoading
31
+ type: variant
32
+ dataType: boolean
33
+ phase: fast+interactive
34
+ description: Whether cart data is loading
35
+
36
+ # Animation trigger for when item is added
37
+ - tag: justAdded
38
+ type: variant
39
+ dataType: boolean
40
+ phase: fast+interactive
41
+ description: Briefly true after an item is added (for animation)
42
+
43
+
@@ -0,0 +1,29 @@
1
+ import {HTMLElementCollectionProxy, HTMLElementProxy, JayContract} from "@jay-framework/runtime";
2
+
3
+
4
+ export interface CartIndicatorViewState {
5
+ itemCount: number,
6
+ hasItems: boolean,
7
+ isLoading: boolean,
8
+ justAdded: boolean
9
+ }
10
+
11
+ export type CartIndicatorSlowViewState = {};
12
+
13
+ export type CartIndicatorFastViewState = Pick<CartIndicatorViewState, 'itemCount' | 'hasItems' | 'isLoading' | 'justAdded'>;
14
+
15
+ export type CartIndicatorInteractiveViewState = Pick<CartIndicatorViewState, 'itemCount' | 'hasItems' | 'isLoading' | 'justAdded'>;
16
+
17
+
18
+ export interface CartIndicatorRefs {
19
+ cartButton: HTMLElementProxy<CartIndicatorViewState, HTMLButtonElement>,
20
+ cartLink: HTMLElementProxy<CartIndicatorViewState, HTMLAnchorElement>
21
+ }
22
+
23
+
24
+ export interface CartIndicatorRepeatedRefs {
25
+ cartButton: HTMLElementCollectionProxy<CartIndicatorViewState, HTMLButtonElement>,
26
+ cartLink: HTMLElementCollectionProxy<CartIndicatorViewState, HTMLAnchorElement>
27
+ }
28
+
29
+ export type CartIndicatorContract = JayContract<CartIndicatorViewState, CartIndicatorRefs, CartIndicatorSlowViewState, CartIndicatorFastViewState, CartIndicatorInteractiveViewState>
@@ -0,0 +1,328 @@
1
+ name: cart-page
2
+ description: Full cart page showing all items, quantities, totals, and checkout actions
3
+
4
+ tags:
5
+ # Cart identity
6
+ - tag: cartId
7
+ type: data
8
+ dataType: string
9
+ description: Cart GUID
10
+
11
+ # Cart state
12
+ - tag: isEmpty
13
+ type: variant
14
+ dataType: boolean
15
+ phase: fast+interactive
16
+ description: Whether cart is empty
17
+
18
+ - tag: isLoading
19
+ type: variant
20
+ dataType: boolean
21
+ phase: fast+interactive
22
+ description: Whether cart is loading/updating
23
+
24
+ # Line items
25
+ - tag: lineItems
26
+ type: sub-contract
27
+ repeated: true
28
+ trackBy: lineItemId
29
+ phase: fast+interactive
30
+ description: Items in the cart
31
+ tags:
32
+ - tag: lineItemId
33
+ type: data
34
+ dataType: string
35
+ description: Line item GUID
36
+
37
+ - tag: productId
38
+ type: data
39
+ dataType: string
40
+ description: Product GUID
41
+
42
+ - tag: productName
43
+ type: data
44
+ dataType: string
45
+ description: Product name
46
+
47
+ - tag: productUrl
48
+ type: data
49
+ dataType: string
50
+ description: URL to product page
51
+
52
+ - tag: productLink
53
+ type: interactive
54
+ elementType: HTMLAnchorElement
55
+ description: Link to product page
56
+
57
+ # Variant/options info
58
+ - tag: variantName
59
+ type: data
60
+ dataType: string
61
+ description: Selected variant description (e.g., "Blue / Large")
62
+
63
+ - tag: sku
64
+ type: data
65
+ dataType: string
66
+ description: Product/variant SKU
67
+
68
+ # Media
69
+ - tag: image
70
+ type: sub-contract
71
+ description: Product thumbnail
72
+ tags:
73
+ - tag: url
74
+ type: data
75
+ dataType: string
76
+ description: Image URL
77
+
78
+ - tag: altText
79
+ type: data
80
+ dataType: string
81
+ description: Image alt text
82
+
83
+ # Quantity
84
+ - tag: quantity
85
+ type: [data, interactive]
86
+ dataType: number
87
+ elementType: HTMLInputElement
88
+ description: Item quantity
89
+
90
+ - tag: decrementButton
91
+ type: interactive
92
+ elementType: HTMLButtonElement
93
+ description: Decrease quantity button
94
+
95
+ - tag: incrementButton
96
+ type: interactive
97
+ elementType: HTMLButtonElement
98
+ description: Increase quantity button
99
+
100
+ - tag: isUpdatingQuantity
101
+ type: variant
102
+ dataType: boolean
103
+ description: Whether quantity is being updated
104
+
105
+ # Price per item
106
+ - tag: unitPrice
107
+ type: sub-contract
108
+ description: Price per unit
109
+ tags:
110
+ - tag: amount
111
+ type: data
112
+ dataType: string
113
+ description: Unit price amount
114
+
115
+ - tag: formattedAmount
116
+ type: data
117
+ dataType: string
118
+ description: Formatted unit price
119
+
120
+ # Line total (quantity * unit price)
121
+ - tag: lineTotal
122
+ type: sub-contract
123
+ description: Total for this line item
124
+ tags:
125
+ - tag: amount
126
+ type: data
127
+ dataType: string
128
+ description: Line total amount
129
+
130
+ - tag: formattedAmount
131
+ type: data
132
+ dataType: string
133
+ description: Formatted line total
134
+
135
+ # Discount on line item
136
+ - tag: lineDiscount
137
+ type: sub-contract
138
+ description: Discount applied to this line
139
+ tags:
140
+ - tag: amount
141
+ type: data
142
+ dataType: string
143
+ description: Discount amount
144
+
145
+ - tag: formattedAmount
146
+ type: data
147
+ dataType: string
148
+ description: Formatted discount
149
+
150
+ - tag: hasDiscount
151
+ type: variant
152
+ dataType: boolean
153
+ description: Whether line has a discount
154
+
155
+ # Remove item
156
+ - tag: removeButton
157
+ type: interactive
158
+ elementType: HTMLButtonElement
159
+ description: Remove item from cart button
160
+
161
+ - tag: isRemoving
162
+ type: variant
163
+ dataType: boolean
164
+ description: Whether item is being removed
165
+
166
+ # Cart summary
167
+ - tag: summary
168
+ type: sub-contract
169
+ phase: fast+interactive
170
+ description: Cart totals and summary
171
+ tags:
172
+ - tag: itemCount
173
+ type: data
174
+ dataType: number
175
+ description: Total number of items
176
+
177
+ - tag: subtotal
178
+ type: sub-contract
179
+ description: Cart subtotal before discounts/shipping
180
+ tags:
181
+ - tag: amount
182
+ type: data
183
+ dataType: string
184
+ description: Subtotal amount
185
+
186
+ - tag: formattedAmount
187
+ type: data
188
+ dataType: string
189
+ description: Formatted subtotal
190
+
191
+ - tag: discount
192
+ type: sub-contract
193
+ description: Total discounts applied
194
+ tags:
195
+ - tag: amount
196
+ type: data
197
+ dataType: string
198
+ description: Discount amount
199
+
200
+ - tag: formattedAmount
201
+ type: data
202
+ dataType: string
203
+ description: Formatted discount
204
+
205
+ - tag: hasDiscount
206
+ type: variant
207
+ dataType: boolean
208
+ description: Whether cart has any discounts
209
+
210
+ - tag: estimatedTax
211
+ type: sub-contract
212
+ description: Estimated tax (if calculable)
213
+ tags:
214
+ - tag: amount
215
+ type: data
216
+ dataType: string
217
+ description: Tax amount
218
+
219
+ - tag: formattedAmount
220
+ type: data
221
+ dataType: string
222
+ description: Formatted tax
223
+
224
+ - tag: showTax
225
+ type: variant
226
+ dataType: boolean
227
+ description: Whether to show tax estimate
228
+
229
+ - tag: estimatedTotal
230
+ type: sub-contract
231
+ description: Estimated order total
232
+ tags:
233
+ - tag: amount
234
+ type: data
235
+ dataType: string
236
+ description: Total amount
237
+
238
+ - tag: formattedAmount
239
+ type: data
240
+ dataType: string
241
+ description: Formatted total
242
+
243
+ - tag: currency
244
+ type: data
245
+ dataType: string
246
+ description: Currency code (e.g., "USD")
247
+
248
+ # Coupon/promo code
249
+ - tag: coupon
250
+ type: sub-contract
251
+ phase: fast+interactive
252
+ description: Coupon code input and application
253
+ tags:
254
+ - tag: code
255
+ type: [data, interactive]
256
+ dataType: string
257
+ elementType: HTMLInputElement
258
+ description: Coupon code input
259
+
260
+ - tag: applyButton
261
+ type: interactive
262
+ elementType: HTMLButtonElement
263
+ description: Apply coupon button
264
+
265
+ - tag: isApplying
266
+ type: variant
267
+ dataType: boolean
268
+ description: Whether coupon is being applied
269
+
270
+ - tag: appliedCode
271
+ type: data
272
+ dataType: string
273
+ description: Currently applied coupon code (empty if none)
274
+
275
+ - tag: hasAppliedCoupon
276
+ type: variant
277
+ dataType: boolean
278
+ description: Whether a coupon is applied
279
+
280
+ - tag: removeButton
281
+ type: interactive
282
+ elementType: HTMLButtonElement
283
+ description: Remove applied coupon button
284
+
285
+ - tag: errorMessage
286
+ type: data
287
+ dataType: string
288
+ description: Error message if coupon invalid
289
+
290
+ - tag: hasError
291
+ type: variant
292
+ dataType: boolean
293
+ description: Whether there's a coupon error
294
+
295
+ # Cart actions
296
+ - tag: checkoutButton
297
+ type: interactive
298
+ elementType: HTMLButtonElement
299
+ description: Proceed to checkout button
300
+
301
+ - tag: continueShoppingLink
302
+ type: interactive
303
+ elementType: HTMLAnchorElement
304
+ description: Continue shopping link
305
+
306
+ - tag: clearCartButton
307
+ type: interactive
308
+ elementType: HTMLButtonElement
309
+ description: Clear all items from cart
310
+
311
+ - tag: isCheckingOut
312
+ type: variant
313
+ dataType: boolean
314
+ phase: fast+interactive
315
+ description: Whether checkout is in progress
316
+
317
+ # Empty cart state
318
+ - tag: emptyCartMessage
319
+ type: data
320
+ dataType: string
321
+ description: Message to show when cart is empty
322
+
323
+ - tag: emptyCartLink
324
+ type: interactive
325
+ elementType: HTMLAnchorElement
326
+ description: Link to start shopping (when cart empty)
327
+
328
+
@@ -0,0 +1,146 @@
1
+ import {HTMLElementCollectionProxy, HTMLElementProxy, JayContract} from "@jay-framework/runtime";
2
+
3
+
4
+ export interface ImageOfLineItemOfCartPageViewState {
5
+ url: string,
6
+ altText: string
7
+ }
8
+
9
+ export interface UnitPriceOfLineItemOfCartPageViewState {
10
+ amount: string,
11
+ formattedAmount: string
12
+ }
13
+
14
+ export interface LineTotalOfLineItemOfCartPageViewState {
15
+ amount: string,
16
+ formattedAmount: string
17
+ }
18
+
19
+ export interface LineDiscountOfLineItemOfCartPageViewState {
20
+ amount: string,
21
+ formattedAmount: string
22
+ }
23
+
24
+ export interface LineItemOfCartPageViewState {
25
+ lineItemId: string,
26
+ productId: string,
27
+ productName: string,
28
+ productUrl: string,
29
+ variantName: string,
30
+ sku: string,
31
+ image: ImageOfLineItemOfCartPageViewState,
32
+ quantity: number,
33
+ isUpdatingQuantity: boolean,
34
+ unitPrice: UnitPriceOfLineItemOfCartPageViewState,
35
+ lineTotal: LineTotalOfLineItemOfCartPageViewState,
36
+ lineDiscount: LineDiscountOfLineItemOfCartPageViewState,
37
+ hasDiscount: boolean,
38
+ isRemoving: boolean
39
+ }
40
+
41
+ export interface SubtotalOfSummaryOfCartPageViewState {
42
+ amount: string,
43
+ formattedAmount: string
44
+ }
45
+
46
+ export interface DiscountOfSummaryOfCartPageViewState {
47
+ amount: string,
48
+ formattedAmount: string
49
+ }
50
+
51
+ export interface EstimatedTaxOfSummaryOfCartPageViewState {
52
+ amount: string,
53
+ formattedAmount: string
54
+ }
55
+
56
+ export interface EstimatedTotalOfSummaryOfCartPageViewState {
57
+ amount: string,
58
+ formattedAmount: string
59
+ }
60
+
61
+ export interface SummaryOfCartPageViewState {
62
+ itemCount: number,
63
+ subtotal: SubtotalOfSummaryOfCartPageViewState,
64
+ discount: DiscountOfSummaryOfCartPageViewState,
65
+ hasDiscount: boolean,
66
+ estimatedTax: EstimatedTaxOfSummaryOfCartPageViewState,
67
+ showTax: boolean,
68
+ estimatedTotal: EstimatedTotalOfSummaryOfCartPageViewState,
69
+ currency: string
70
+ }
71
+
72
+ export interface CouponOfCartPageViewState {
73
+ code: string,
74
+ isApplying: boolean,
75
+ appliedCode: string,
76
+ hasAppliedCoupon: boolean,
77
+ errorMessage: string,
78
+ hasError: boolean
79
+ }
80
+
81
+ export interface CartPageViewState {
82
+ cartId: string,
83
+ isEmpty: boolean,
84
+ isLoading: boolean,
85
+ lineItems: Array<LineItemOfCartPageViewState>,
86
+ summary: SummaryOfCartPageViewState,
87
+ coupon: CouponOfCartPageViewState,
88
+ isCheckingOut: boolean,
89
+ emptyCartMessage: string
90
+ }
91
+
92
+ export type CartPageSlowViewState = Pick<CartPageViewState, 'cartId' | 'emptyCartMessage'>;
93
+
94
+ export type CartPageFastViewState = Pick<CartPageViewState, 'isEmpty' | 'isLoading' | 'isCheckingOut'> & {
95
+ lineItems: Array<CartPageViewState['lineItems'][number]>;
96
+ summary: CartPageViewState['summary'];
97
+ coupon: CartPageViewState['coupon'];
98
+ };
99
+
100
+ export type CartPageInteractiveViewState = Pick<CartPageViewState, 'isEmpty' | 'isLoading' | 'isCheckingOut'> & {
101
+ lineItems: Array<CartPageViewState['lineItems'][number]>;
102
+ summary: CartPageViewState['summary'];
103
+ coupon: CartPageViewState['coupon'];
104
+ };
105
+
106
+
107
+ export interface CartPageRefs {
108
+ checkoutButton: HTMLElementProxy<CartPageViewState, HTMLButtonElement>,
109
+ continueShoppingLink: HTMLElementProxy<CartPageViewState, HTMLAnchorElement>,
110
+ clearCartButton: HTMLElementProxy<CartPageViewState, HTMLButtonElement>,
111
+ emptyCartLink: HTMLElementProxy<CartPageViewState, HTMLAnchorElement>,
112
+ lineItems: {
113
+ productLink: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLAnchorElement>,
114
+ quantity: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLInputElement>,
115
+ decrementButton: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLButtonElement>,
116
+ incrementButton: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLButtonElement>,
117
+ removeButton: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLButtonElement>
118
+ },
119
+ coupon: {
120
+ code: HTMLElementProxy<CouponOfCartPageViewState, HTMLInputElement>,
121
+ applyButton: HTMLElementProxy<CouponOfCartPageViewState, HTMLButtonElement>,
122
+ removeButton: HTMLElementProxy<CouponOfCartPageViewState, HTMLButtonElement>
123
+ }
124
+ }
125
+
126
+
127
+ export interface CartPageRepeatedRefs {
128
+ checkoutButton: HTMLElementCollectionProxy<CartPageViewState, HTMLButtonElement>,
129
+ continueShoppingLink: HTMLElementCollectionProxy<CartPageViewState, HTMLAnchorElement>,
130
+ clearCartButton: HTMLElementCollectionProxy<CartPageViewState, HTMLButtonElement>,
131
+ emptyCartLink: HTMLElementCollectionProxy<CartPageViewState, HTMLAnchorElement>,
132
+ lineItems: {
133
+ productLink: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLAnchorElement>,
134
+ quantity: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLInputElement>,
135
+ decrementButton: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLButtonElement>,
136
+ incrementButton: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLButtonElement>,
137
+ removeButton: HTMLElementCollectionProxy<LineItemOfCartPageViewState, HTMLButtonElement>
138
+ },
139
+ coupon: {
140
+ code: HTMLElementCollectionProxy<CouponOfCartPageViewState, HTMLInputElement>,
141
+ applyButton: HTMLElementCollectionProxy<CouponOfCartPageViewState, HTMLButtonElement>,
142
+ removeButton: HTMLElementCollectionProxy<CouponOfCartPageViewState, HTMLButtonElement>
143
+ }
144
+ }
145
+
146
+ export type CartPageContract = JayContract<CartPageViewState, CartPageRefs, CartPageSlowViewState, CartPageFastViewState, CartPageInteractiveViewState>