@jay-framework/wix-cart 0.24.0 → 0.24.2

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,329 @@
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
+ meta: {mediaType: wix-image}
78
+
79
+ - tag: altText
80
+ type: data
81
+ dataType: string
82
+ description: Image alt text
83
+
84
+ # Quantity
85
+ - tag: quantity
86
+ type: [data, interactive]
87
+ dataType: number
88
+ elementType: HTMLInputElement
89
+ description: Item quantity
90
+
91
+ - tag: decrementButton
92
+ type: interactive
93
+ elementType: HTMLButtonElement
94
+ description: Decrease quantity button
95
+
96
+ - tag: incrementButton
97
+ type: interactive
98
+ elementType: HTMLButtonElement
99
+ description: Increase quantity button
100
+
101
+ - tag: isUpdatingQuantity
102
+ type: variant
103
+ dataType: boolean
104
+ description: Whether quantity is being updated
105
+
106
+ # Price per item
107
+ - tag: unitPrice
108
+ type: sub-contract
109
+ description: Price per unit
110
+ tags:
111
+ - tag: amount
112
+ type: data
113
+ dataType: string
114
+ description: Unit price amount
115
+
116
+ - tag: formattedAmount
117
+ type: data
118
+ dataType: string
119
+ description: Formatted unit price
120
+
121
+ # Line total (quantity * unit price)
122
+ - tag: lineTotal
123
+ type: sub-contract
124
+ description: Total for this line item
125
+ tags:
126
+ - tag: amount
127
+ type: data
128
+ dataType: string
129
+ description: Line total amount
130
+
131
+ - tag: formattedAmount
132
+ type: data
133
+ dataType: string
134
+ description: Formatted line total
135
+
136
+ # Discount on line item
137
+ - tag: lineDiscount
138
+ type: sub-contract
139
+ description: Discount applied to this line
140
+ tags:
141
+ - tag: amount
142
+ type: data
143
+ dataType: string
144
+ description: Discount amount
145
+
146
+ - tag: formattedAmount
147
+ type: data
148
+ dataType: string
149
+ description: Formatted discount
150
+
151
+ - tag: hasDiscount
152
+ type: variant
153
+ dataType: boolean
154
+ description: Whether line has a discount
155
+
156
+ # Remove item
157
+ - tag: removeButton
158
+ type: interactive
159
+ elementType: HTMLButtonElement
160
+ description: Remove item from cart button
161
+
162
+ - tag: isRemoving
163
+ type: variant
164
+ dataType: boolean
165
+ description: Whether item is being removed
166
+
167
+ # Cart summary
168
+ - tag: summary
169
+ type: sub-contract
170
+ phase: fast+interactive
171
+ description: Cart totals and summary
172
+ tags:
173
+ - tag: itemCount
174
+ type: data
175
+ dataType: number
176
+ description: Total number of items
177
+
178
+ - tag: subtotal
179
+ type: sub-contract
180
+ description: Cart subtotal before discounts/shipping
181
+ tags:
182
+ - tag: amount
183
+ type: data
184
+ dataType: string
185
+ description: Subtotal amount
186
+
187
+ - tag: formattedAmount
188
+ type: data
189
+ dataType: string
190
+ description: Formatted subtotal
191
+
192
+ - tag: discount
193
+ type: sub-contract
194
+ description: Total discounts applied
195
+ tags:
196
+ - tag: amount
197
+ type: data
198
+ dataType: string
199
+ description: Discount amount
200
+
201
+ - tag: formattedAmount
202
+ type: data
203
+ dataType: string
204
+ description: Formatted discount
205
+
206
+ - tag: hasDiscount
207
+ type: variant
208
+ dataType: boolean
209
+ description: Whether cart has any discounts
210
+
211
+ - tag: estimatedTax
212
+ type: sub-contract
213
+ description: Estimated tax (if calculable)
214
+ tags:
215
+ - tag: amount
216
+ type: data
217
+ dataType: string
218
+ description: Tax amount
219
+
220
+ - tag: formattedAmount
221
+ type: data
222
+ dataType: string
223
+ description: Formatted tax
224
+
225
+ - tag: showTax
226
+ type: variant
227
+ dataType: boolean
228
+ description: Whether to show tax estimate
229
+
230
+ - tag: estimatedTotal
231
+ type: sub-contract
232
+ description: Estimated order total
233
+ tags:
234
+ - tag: amount
235
+ type: data
236
+ dataType: string
237
+ description: Total amount
238
+
239
+ - tag: formattedAmount
240
+ type: data
241
+ dataType: string
242
+ description: Formatted total
243
+
244
+ - tag: currency
245
+ type: data
246
+ dataType: string
247
+ description: Currency code (e.g., "USD")
248
+
249
+ # Coupon/promo code
250
+ - tag: coupon
251
+ type: sub-contract
252
+ phase: fast+interactive
253
+ description: Coupon code input and application
254
+ tags:
255
+ - tag: code
256
+ type: [data, interactive]
257
+ dataType: string
258
+ elementType: HTMLInputElement
259
+ description: Coupon code input
260
+
261
+ - tag: applyButton
262
+ type: interactive
263
+ elementType: HTMLButtonElement
264
+ description: Apply coupon button
265
+
266
+ - tag: isApplying
267
+ type: variant
268
+ dataType: boolean
269
+ description: Whether coupon is being applied
270
+
271
+ - tag: appliedCode
272
+ type: data
273
+ dataType: string
274
+ description: Currently applied coupon code (empty if none)
275
+
276
+ - tag: hasAppliedCoupon
277
+ type: variant
278
+ dataType: boolean
279
+ description: Whether a coupon is applied
280
+
281
+ - tag: removeButton
282
+ type: interactive
283
+ elementType: HTMLButtonElement
284
+ description: Remove applied coupon button
285
+
286
+ - tag: errorMessage
287
+ type: data
288
+ dataType: string
289
+ description: Error message if coupon invalid
290
+
291
+ - tag: hasError
292
+ type: variant
293
+ dataType: boolean
294
+ description: Whether there's a coupon error
295
+
296
+ # Cart actions
297
+ - tag: checkoutButton
298
+ type: interactive
299
+ elementType: HTMLButtonElement
300
+ description: Proceed to checkout button
301
+
302
+ - tag: continueShoppingLink
303
+ type: interactive
304
+ elementType: HTMLAnchorElement
305
+ description: Continue shopping link
306
+
307
+ - tag: clearCartButton
308
+ type: interactive
309
+ elementType: HTMLButtonElement
310
+ description: Clear all items from cart
311
+
312
+ - tag: isCheckingOut
313
+ type: variant
314
+ dataType: boolean
315
+ phase: fast+interactive
316
+ description: Whether checkout is in progress
317
+
318
+ # Empty cart state
319
+ - tag: emptyCartMessage
320
+ type: data
321
+ dataType: string
322
+ description: Message to show when cart is empty
323
+
324
+ - tag: emptyCartLink
325
+ type: interactive
326
+ elementType: HTMLAnchorElement
327
+ description: Link to start shopping (when cart empty)
328
+
329
+
@@ -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>
@@ -0,0 +1,19 @@
1
+ name: mini-cart
2
+ description: Drawer that auto-opens when a product is added to cart. Place cart content inside.
3
+
4
+ tags:
5
+ - tag: isOpen
6
+ type: variant
7
+ dataType: boolean
8
+ phase: fast+interactive
9
+ description: Whether the mini-cart drawer is currently open
10
+
11
+ - tag: openButton
12
+ type: interactive
13
+ elementType: HTMLButtonElement
14
+ description: Button to manually open the mini-cart drawer
15
+
16
+ - tag: closeButton
17
+ type: interactive
18
+ elementType: HTMLButtonElement
19
+ description: Button to close the mini-cart drawer
@@ -0,0 +1,26 @@
1
+ import {HTMLElementCollectionProxy, HTMLElementProxy, JayContract} from "@jay-framework/runtime";
2
+
3
+
4
+ export interface MiniCartViewState {
5
+ isOpen: boolean
6
+ }
7
+
8
+ export type MiniCartSlowViewState = {};
9
+
10
+ export type MiniCartFastViewState = Pick<MiniCartViewState, 'isOpen'>;
11
+
12
+ export type MiniCartInteractiveViewState = Pick<MiniCartViewState, 'isOpen'>;
13
+
14
+
15
+ export interface MiniCartRefs {
16
+ openButton: HTMLElementProxy<MiniCartViewState, HTMLButtonElement>,
17
+ closeButton: HTMLElementProxy<MiniCartViewState, HTMLButtonElement>
18
+ }
19
+
20
+
21
+ export interface MiniCartRepeatedRefs {
22
+ openButton: HTMLElementCollectionProxy<MiniCartViewState, HTMLButtonElement>,
23
+ closeButton: HTMLElementCollectionProxy<MiniCartViewState, HTMLButtonElement>
24
+ }
25
+
26
+ export type MiniCartContract = JayContract<MiniCartViewState, MiniCartRefs, MiniCartSlowViewState, MiniCartFastViewState, MiniCartInteractiveViewState>