@tapcart/mobile-components 0.15.0 → 0.15.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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAKA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;AA0LD,eAAO,MAAM,qBAAqB,UACzB,OAAO,MAAM,EAAE,GAAG,CAAC;kBACT,OAAO,MAAM,EAAE,GAAG,CAAC;kBAAgB,OAAO,MAAM,EAAE,GAAG,CAAC;CA+NxE,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAY,GACb,EAAE,oBAAoB,GAAG,iBAAiB,CAiE1C"}
1
+ {"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAKA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;AA0LD,eAAO,MAAM,qBAAqB,UACzB,OAAO,MAAM,EAAE,GAAG,CAAC;kBACT,OAAO,MAAM,EAAE,GAAG,CAAC;kBAAgB,OAAO,MAAM,EAAE,GAAG,CAAC;CAmOxE,CAAA;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAY,GACb,EAAE,oBAAoB,GAAG,iBAAiB,CAiE1C"}
@@ -148,9 +148,12 @@ export const transformOrderDetails = (order) => {
148
148
  return parseFloat(amount) || 0;
149
149
  return 0;
150
150
  };
151
+ // Shopify Order Editing sets currentQuantity to 0 for removed/refunded
152
+ // line items — those must not be shown to the customer
153
+ const activeLineItems = (order.lineItems || []).filter((lineItem) => { var _a, _b; return ((_b = (_a = lineItem.currentQuantity) !== null && _a !== void 0 ? _a : lineItem.quantity) !== null && _b !== void 0 ? _b : 1) > 0; });
151
154
  // Transform line items to cart lines
152
- const cartLines = (order.lineItems || []).map((lineItem) => {
153
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
155
+ const cartLines = activeLineItems.map((lineItem) => {
156
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
154
157
  const variant = lineItem.variant || {};
155
158
  const product = variant.product || {};
156
159
  return {
@@ -185,14 +188,13 @@ export const transformOrderDetails = (order) => {
185
188
  productId: ((_k = variant.product) === null || _k === void 0 ? void 0 : _k.id) || lineItem.productId,
186
189
  merchandiseId: variant.id || lineItem.merchandiseId,
187
190
  title: lineItem.title || product.title || "Unknown Product",
188
- quantity: lineItem.quantity || 1,
191
+ quantity: (_m = (_l = lineItem.currentQuantity) !== null && _l !== void 0 ? _l : lineItem.quantity) !== null && _m !== void 0 ? _m : 1,
189
192
  uniqueId: crypto.randomUUID(),
190
193
  vendor: product.vendor || lineItem.vendor || "Unknown",
191
194
  compareAtPrice: {
192
- amount: parseAmount(((_l = lineItem.originalTotalPrice) === null || _l === void 0 ? void 0 : _l.amount) ||
193
- ((_m = lineItem.compareAtPrice) === null || _m === void 0 ? void 0 : _m.amount)),
194
- currencyCode: ((_o = lineItem.originalTotalPrice) === null || _o === void 0 ? void 0 : _o.currencyCode) ||
195
- ((_p = lineItem.compareAtPrice) === null || _p === void 0 ? void 0 : _p.currencyCode) ||
195
+ amount: parseAmount(((_o = lineItem.originalTotalPrice) === null || _o === void 0 ? void 0 : _o.amount) || ((_p = lineItem.compareAtPrice) === null || _p === void 0 ? void 0 : _p.amount)),
196
+ currencyCode: ((_q = lineItem.originalTotalPrice) === null || _q === void 0 ? void 0 : _q.currencyCode) ||
197
+ ((_r = lineItem.compareAtPrice) === null || _r === void 0 ? void 0 : _r.currencyCode) ||
196
198
  order.currency ||
197
199
  "USD",
198
200
  },
@@ -262,8 +264,8 @@ export const transformOrderDetails = (order) => {
262
264
  value: app.value || { percentage: 0 },
263
265
  })),
264
266
  subtotalPrice: wrapMoney(subtotal, currencyCode),
265
- lineItems: (order.lineItems || []).map((lineItem) => {
266
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
267
+ lineItems: activeLineItems.map((lineItem) => {
268
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
267
269
  const variant = lineItem.variant || {};
268
270
  const product = variant.product || {};
269
271
  const currencyCode = ((_a = lineItem.discountedTotalPrice) === null || _a === void 0 ? void 0 : _a.currencyCode) ||
@@ -313,9 +315,9 @@ export const transformOrderDetails = (order) => {
313
315
  discountApplication: allocation.discountApplication || {},
314
316
  });
315
317
  }),
316
- quantity: lineItem.quantity || 1,
318
+ quantity: (_t = (_s = lineItem.currentQuantity) !== null && _s !== void 0 ? _s : lineItem.quantity) !== null && _t !== void 0 ? _t : 1,
317
319
  title: lineItem.title || product.title,
318
- id: ((_s = variant.id) === null || _s === void 0 ? void 0 : _s.split("/").pop()) || ((_t = lineItem.variantId) === null || _t === void 0 ? void 0 : _t.split("/").pop()),
320
+ id: ((_u = variant.id) === null || _u === void 0 ? void 0 : _u.split("/").pop()) || ((_v = lineItem.variantId) === null || _v === void 0 ? void 0 : _v.split("/").pop()),
319
321
  };
320
322
  }),
321
323
  totalPrice: wrapMoney(total, currencyCode),
@@ -145,7 +145,7 @@ Carousel.displayName = "Carousel";
145
145
  const CarouselContent = React.forwardRef((_a, ref) => {
146
146
  var { className, showOverflow = false } = _a, props = __rest(_a, ["className", "showOverflow"]);
147
147
  const { carouselRef, orientation } = useCarousel();
148
- return (_jsx("div", Object.assign({ ref: carouselRef, className: `${showOverflow ? "overflow-visible" : "overflow-hidden"}` }, { children: _jsx("div", Object.assign({ ref: ref, className: cn("flex", orientation === "horizontal" ? "" : "-mt-4 flex-col", className) }, props)) })));
148
+ return (_jsx("div", Object.assign({ ref: carouselRef, className: `touch-pan-y ${showOverflow ? "overflow-visible" : "overflow-hidden"}` }, { children: _jsx("div", Object.assign({ ref: ref, className: cn("flex", orientation === "horizontal" ? "" : "-mt-4 flex-col", className) }, props)) })));
149
149
  });
150
150
  CarouselContent.displayName = "CarouselContent";
151
151
  const CarouselItem = React.forwardRef((_a, ref) => {
package/dist/styles.css CHANGED
@@ -1219,6 +1219,9 @@ video {
1219
1219
  .h-\[80vh\] {
1220
1220
  height: 80vh;
1221
1221
  }
1222
+ .h-\[90vh\] {
1223
+ height: 90vh;
1224
+ }
1222
1225
  .h-auto {
1223
1226
  height: auto;
1224
1227
  }
@@ -1829,6 +1832,9 @@ video {
1829
1832
  .gap-0 {
1830
1833
  gap: 0px;
1831
1834
  }
1835
+ .gap-0\.5 {
1836
+ gap: 0.125rem;
1837
+ }
1832
1838
  .gap-1 {
1833
1839
  gap: 0.25rem;
1834
1840
  }
@@ -2447,10 +2453,18 @@ video {
2447
2453
  padding-top: 1.25rem;
2448
2454
  padding-bottom: 1.25rem;
2449
2455
  }
2456
+ .py-6 {
2457
+ padding-top: 1.5rem;
2458
+ padding-bottom: 1.5rem;
2459
+ }
2450
2460
  .py-8 {
2451
2461
  padding-top: 2rem;
2452
2462
  padding-bottom: 2rem;
2453
2463
  }
2464
+ .py-\[10px\] {
2465
+ padding-top: 10px;
2466
+ padding-bottom: 10px;
2467
+ }
2454
2468
  .pb-0 {
2455
2469
  padding-bottom: 0px;
2456
2470
  }
@@ -2642,6 +2656,9 @@ video {
2642
2656
  .leading-4 {
2643
2657
  line-height: 1rem;
2644
2658
  }
2659
+ .leading-5 {
2660
+ line-height: 1.25rem;
2661
+ }
2645
2662
  .leading-6 {
2646
2663
  line-height: 1.5rem;
2647
2664
  }
@@ -2675,6 +2692,9 @@ video {
2675
2692
  .leading-\[28px\] {
2676
2693
  line-height: 28px;
2677
2694
  }
2695
+ .leading-\[31px\] {
2696
+ line-height: 31px;
2697
+ }
2678
2698
  .leading-none {
2679
2699
  line-height: 1;
2680
2700
  }
@@ -3253,301 +3273,320 @@ body::-webkit-scrollbar {
3253
3273
  );
3254
3274
  }
3255
3275
 
3276
+ /**
3277
+ * Frame-relative inset model — canonical --tc-* web API.
3278
+ *
3279
+ * The RN shell injects the frame-relative primitives (--tc-safe-*, --tc-bar-*,
3280
+ * --tc-cutout-*) onto document.documentElement; this block derives the
3281
+ * --tc-content-* clearance the app/blocks consume. Mirrors the reference
3282
+ * implementation in tapcart-react-native's inset-harness/harness-page.ts.
3283
+ *
3284
+ * Backward compatibility: the existing --rn-* variables are NOT removed. Each
3285
+ * source falls back to the legacy env()/--rn-* chain and is overridden only
3286
+ * when the shell actually injects the matching --tc-* value (an explicit 0px in
3287
+ * the inset regime counts as present and wins). Older app versions in the field
3288
+ * keep working unchanged.
3289
+ *
3290
+ * Composition rule: every inset is an absolute distance from one edge, so we
3291
+ * combine with max() (never +/-) and overlapping insets (a bar covering the
3292
+ * home indicator) dedupe instead of double-counting.
3293
+ */
3294
+
3295
+ /* SLIM SCOPE — bottom-overlay iOS adapter only. Top-edge, cutout, generalized
3296
+ --tc-content-* / drawer vars and their Tailwind utilities are deferred to
3297
+ Insets V2 (they had zero consumers). Everything here is inert unless the
3298
+ shell reports an overlay bottom bar (.tc-glass; see the gated block below). */
3299
+
3300
+ /* --tc-bar-bottom is @property-registered so the hide-on-scroll bar collapse
3301
+ animates smoothly (300ms native bar). */
3302
+ @property --tc-bar-bottom {
3303
+ syntax: "<length>";
3304
+ inherits: true;
3305
+ initial-value: 0px;
3306
+ }
3307
+
3308
+ :root {
3309
+ /* Prefers the shell's new --tc-safe-bottom (incl. explicit 0 in the inset
3310
+ regime) and falls back to the legacy env()/--rn-* chain when absent. */
3311
+ --tc-safe-bottom-eff: var(
3312
+ --tc-safe-bottom,
3313
+ max(env(safe-area-inset-bottom), var(--rn-safe-area-inset-bottom, 0px))
3314
+ );
3315
+
3316
+ /* Bar footprint. --tc-bar-bottom is @property-registered (for the
3317
+ hide-on-scroll transition), so it always carries a value (initial 0px) and
3318
+ a var() fallback would never fire; we fold the legacy
3319
+ --rn-tabbar-bottom-inset in with max(). They do NOT share a datum: the new
3320
+ --tc-bar-bottom is a frame-relative footprint (spans the region over the
3321
+ safe area), while the legacy --rn-tabbar-bottom-inset is the bar
3322
+ obstruction ABOVE the safe area. max() picks the larger; on older shells
3323
+ (no --tc-bar-bottom) the legacy value wins. */
3324
+ --tc-bar-bottom-eff: max(
3325
+ var(--tc-bar-bottom, 0px),
3326
+ var(--rn-tabbar-bottom-inset, 0px)
3327
+ );
3328
+
3329
+ /* Inert by default: only the gated iOS-glass block below turns these on. */
3330
+ --tc-frame-bottom: 0px;
3331
+ --tc-frame-bottom-gated: 0px;
3332
+ }
3333
+
3334
+ /* The bootstrap adds this class two frames AFTER the shell's first explicit bar
3335
+ geometry has painted. So the initial value lands settled (no slide-in on load)
3336
+ and only later hide-on-scroll show/hide updates animate the 300ms collapse. */
3337
+ :root.tc-inset-transitions-ready {
3338
+ transition: --tc-bar-bottom 300ms ease-out;
3339
+ }
3340
+
3341
+ /* iOS Liquid Glass / hide-on-scroll is the overlay regime this rollout
3342
+ supports. The root-layout bootstrap sets tc-platform-ios before #tc-vgsl is
3343
+ parsed, and adds .tc-glass ONLY when the shell reports glass geometry
3344
+ (--tc-bar-bottom-glass). Gating the derivation on .tc-glass keeps every
3345
+ non-glass shell — legacy pre-v21.3 AND 21.3+ with glass disabled — on the
3346
+ pre-PR path: --tc-frame-bottom stays 0, so the FixedBlock lift collapses,
3347
+ #tc-vgsl's gated leg stays 0, and the legacy bridge owns layout unchanged.
3348
+ The raw, fallback-less --tc-safe-bottom additionally keeps the gated property
3349
+ IACVT-invalid on pre-v21.3 iOS shells. */
3350
+ :root.tc-platform-ios.tc-glass {
3351
+ --tc-frame-bottom: max(var(--tc-bar-bottom-eff), var(--tc-safe-bottom-eff));
3352
+ --tc-frame-bottom-gated: max(
3353
+ var(--tc-safe-bottom),
3354
+ var(--tc-bar-bottom, 0px)
3355
+ );
3356
+ }
3256
3357
  .file\:border-0::file-selector-button {
3257
3358
  border-width: 0px;
3258
3359
  }
3259
-
3260
3360
  .file\:bg-transparent::file-selector-button {
3261
3361
  background-color: transparent;
3262
3362
  }
3263
-
3264
3363
  .file\:text-sm::file-selector-button {
3265
3364
  font-size: 0.875rem;
3266
3365
  line-height: 1.25rem;
3267
3366
  }
3268
-
3269
3367
  .file\:font-medium::file-selector-button {
3270
3368
  font-weight: 500;
3271
3369
  }
3272
-
3273
3370
  .placeholder\:text-stateColors-error::-moz-placeholder {
3274
3371
  color: var(--stateColors-error);
3275
3372
  }
3276
-
3277
3373
  .placeholder\:text-stateColors-error::placeholder {
3278
3374
  color: var(--stateColors-error);
3279
3375
  }
3280
-
3281
3376
  .placeholder\:text-textColors-secondaryColor::-moz-placeholder {
3282
3377
  color: var(--textColors-secondaryColor, #727272ff);
3283
3378
  }
3284
-
3285
3379
  .placeholder\:text-textColors-secondaryColor::placeholder {
3286
3380
  color: var(--textColors-secondaryColor, #727272ff);
3287
3381
  }
3288
-
3289
3382
  .first\:rounded-l-md:first-child {
3290
3383
  border-top-left-radius: calc(var(--radius) - 2px);
3291
3384
  border-bottom-left-radius: calc(var(--radius) - 2px);
3292
3385
  }
3293
-
3294
3386
  .first\:border-l:first-child {
3295
3387
  border-left-width: 1px;
3296
3388
  }
3297
-
3298
3389
  .last\:rounded-r-md:last-child {
3299
3390
  border-top-right-radius: calc(var(--radius) - 2px);
3300
3391
  border-bottom-right-radius: calc(var(--radius) - 2px);
3301
3392
  }
3302
-
3303
3393
  .last\:border-b-0:last-child {
3304
3394
  border-bottom-width: 0px;
3305
3395
  }
3306
-
3307
3396
  .placeholder-shown\:\!truncate:-moz-placeholder {
3308
3397
  overflow: hidden !important;
3309
3398
  text-overflow: ellipsis !important;
3310
3399
  white-space: nowrap !important;
3311
3400
  }
3312
-
3313
3401
  .placeholder-shown\:\!truncate:placeholder-shown {
3314
3402
  overflow: hidden !important;
3315
3403
  text-overflow: ellipsis !important;
3316
3404
  white-space: nowrap !important;
3317
3405
  }
3318
-
3319
3406
  .placeholder-shown\:p-4:-moz-placeholder {
3320
3407
  padding: 1rem;
3321
3408
  }
3322
-
3323
3409
  .placeholder-shown\:p-4:placeholder-shown {
3324
3410
  padding: 1rem;
3325
3411
  }
3326
-
3327
3412
  .placeholder-shown\:text-textColors-secondaryColor:-moz-placeholder {
3328
3413
  color: var(--textColors-secondaryColor, #727272ff);
3329
3414
  }
3330
-
3331
3415
  .placeholder-shown\:text-textColors-secondaryColor:placeholder-shown {
3332
3416
  color: var(--textColors-secondaryColor, #727272ff);
3333
3417
  }
3334
-
3335
3418
  .focus-within\:\!border-stateColors-error:focus-within {
3336
3419
  border-color: var(--stateColors-error) !important;
3337
3420
  }
3338
-
3339
3421
  .focus-within\:border-coreColors-brandColorPrimary:focus-within {
3340
3422
  border-color: var(--coreColors-brandColorPrimary);
3341
3423
  }
3342
-
3343
3424
  .focus\:border-coreColors-brandColorPrimary:focus {
3344
3425
  border-color: var(--coreColors-brandColorPrimary);
3345
3426
  }
3346
-
3347
3427
  .focus\:border-stateColors-error:focus {
3348
3428
  border-color: var(--stateColors-error);
3349
3429
  }
3350
-
3351
3430
  .focus\:bg-stateColors-skeleton:focus {
3352
3431
  background-color: var(--stateColors-skeleton);
3353
3432
  }
3354
-
3355
3433
  .focus\:opacity-100:focus {
3356
3434
  opacity: 1;
3357
3435
  }
3358
-
3359
3436
  .focus\:outline-none:focus {
3360
3437
  outline: 2px solid transparent;
3361
3438
  outline-offset: 2px;
3362
3439
  }
3363
-
3364
3440
  .focus\:ring-2:focus {
3365
3441
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
3366
3442
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
3367
3443
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
3368
3444
  }
3369
-
3445
+ .focus\:ring-current:focus {
3446
+ --tw-ring-color: currentColor;
3447
+ }
3370
3448
  .focus\:ring-ring:focus {
3371
3449
  --tw-ring-color: hsl(var(--ring));
3372
3450
  }
3373
-
3374
3451
  .focus\:ring-white:focus {
3375
3452
  --tw-ring-opacity: 1;
3376
3453
  --tw-ring-color: rgb(255 255 255 / var(--tw-ring-opacity, 1));
3377
3454
  }
3378
-
3455
+ .focus\:ring-offset-1:focus {
3456
+ --tw-ring-offset-width: 1px;
3457
+ }
3379
3458
  .focus\:ring-offset-2:focus {
3380
3459
  --tw-ring-offset-width: 2px;
3381
3460
  }
3382
-
3383
3461
  .focus-visible\:outline-none:focus-visible {
3384
3462
  outline: 2px solid transparent;
3385
3463
  outline-offset: 2px;
3386
3464
  }
3387
-
3388
3465
  .focus-visible\:ring-0:focus-visible {
3389
3466
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
3390
3467
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
3391
3468
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
3392
3469
  }
3393
-
3394
3470
  .focus-visible\:ring-2:focus-visible {
3395
3471
  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
3396
3472
  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
3397
3473
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
3398
3474
  }
3399
-
3400
3475
  .focus-visible\:ring-ring:focus-visible {
3401
3476
  --tw-ring-color: hsl(var(--ring));
3402
3477
  }
3403
-
3404
3478
  .focus-visible\:ring-offset-2:focus-visible {
3405
3479
  --tw-ring-offset-width: 2px;
3406
3480
  }
3407
-
3408
3481
  .focus-visible\:ring-offset-background:focus-visible {
3409
3482
  --tw-ring-offset-color: hsl(var(--background));
3410
3483
  }
3411
-
3412
3484
  .active\:bg-black\/10:active {
3413
3485
  background-color: rgb(0 0 0 / 0.1);
3414
3486
  }
3415
-
3416
3487
  .active\:text-coreColors-brandColorPrimary:active {
3417
3488
  color: var(--coreColors-brandColorPrimary);
3418
3489
  }
3419
-
3420
3490
  .active\:outline-coreColors-brandColorPrimary:active {
3421
3491
  outline-color: var(--coreColors-brandColorPrimary);
3422
3492
  }
3423
-
3424
3493
  .active\:outline-transparent:active {
3425
3494
  outline-color: transparent;
3426
3495
  }
3427
-
3428
3496
  .disabled\:pointer-events-none:disabled {
3429
3497
  pointer-events: none;
3430
3498
  }
3431
-
3432
3499
  .disabled\:cursor-not-allowed:disabled {
3433
3500
  cursor: not-allowed;
3434
3501
  }
3435
-
3436
3502
  .disabled\:border-stateColors-disabled:disabled {
3437
3503
  border-color: var(--stateColors-disabled);
3438
3504
  }
3439
-
3440
3505
  .disabled\:bg-buttonColors-secondaryFill:disabled {
3441
3506
  background-color: var(--buttonColors-secondaryFill);
3442
3507
  }
3443
-
3444
3508
  .disabled\:bg-stateColors-disabled:disabled {
3445
3509
  background-color: var(--stateColors-disabled);
3446
3510
  }
3447
-
3448
3511
  .disabled\:bg-transparent:disabled {
3449
3512
  background-color: transparent;
3450
3513
  }
3451
-
3452
3514
  .disabled\:text-stateColors-disabled:disabled {
3453
3515
  color: var(--stateColors-disabled);
3454
3516
  }
3455
-
3456
3517
  .disabled\:opacity-40:disabled {
3457
3518
  opacity: 0.4;
3458
3519
  }
3459
-
3460
3520
  .disabled\:opacity-50:disabled {
3461
3521
  opacity: 0.5;
3462
3522
  }
3463
-
3464
3523
  .disabled\:opacity-60:disabled {
3465
3524
  opacity: 0.6;
3466
3525
  }
3467
-
3468
3526
  .disabled\:opacity-70:disabled {
3469
3527
  opacity: 0.7;
3470
3528
  }
3471
-
3472
3529
  .group:active .group-active\:text-coreColors-brandColorPrimary {
3473
3530
  color: var(--coreColors-brandColorPrimary);
3474
3531
  }
3475
-
3476
3532
  .group:disabled .group-disabled\:text-stateColors-disabled {
3477
3533
  color: var(--stateColors-disabled);
3478
3534
  }
3479
-
3480
3535
  .group.destructive .group-\[\.destructive\]\:border-muted\/40 {
3481
3536
  border-color: hsl(var(--muted) / 0.4);
3482
3537
  }
3483
-
3484
3538
  .group.destructive .group-\[\.destructive\]\:text-red-300 {
3485
3539
  --tw-text-opacity: 1;
3486
3540
  color: rgb(252 165 165 / var(--tw-text-opacity, 1));
3487
3541
  }
3488
-
3489
3542
  .group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus {
3490
3543
  --tw-ring-color: hsl(var(--destructive));
3491
3544
  }
3492
-
3493
3545
  .group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus {
3494
3546
  --tw-ring-opacity: 1;
3495
3547
  --tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1));
3496
3548
  }
3497
-
3498
3549
  .group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus {
3499
3550
  --tw-ring-offset-color: #dc2626;
3500
3551
  }
3501
-
3502
3552
  .peer:-moz-placeholder ~ .peer-placeholder-shown\:opacity-0 {
3503
3553
  opacity: 0;
3504
3554
  }
3505
-
3506
3555
  .peer:placeholder-shown ~ .peer-placeholder-shown\:opacity-0 {
3507
3556
  opacity: 0;
3508
3557
  }
3509
-
3510
3558
  .peer:disabled ~ .peer-disabled\:cursor-not-allowed {
3511
3559
  cursor: not-allowed;
3512
3560
  }
3513
-
3514
3561
  .peer:disabled ~ .peer-disabled\:opacity-70 {
3515
3562
  opacity: 0.7;
3516
3563
  }
3517
-
3518
3564
  .has-\[\:disabled\]\:opacity-50:has(:disabled) {
3519
3565
  opacity: 0.5;
3520
3566
  }
3521
-
3522
3567
  .data-\[disabled\]\:pointer-events-none[data-disabled] {
3523
3568
  pointer-events: none;
3524
3569
  }
3525
-
3526
3570
  .data-\[state\=checked\]\:translate-x-6[data-state="checked"] {
3527
3571
  --tw-translate-x: 1.5rem;
3528
3572
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3529
3573
  }
3530
-
3531
3574
  .data-\[state\=unchecked\]\:translate-x-0[data-state="unchecked"] {
3532
3575
  --tw-translate-x: 0px;
3533
3576
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3534
3577
  }
3535
-
3536
3578
  .data-\[swipe\=cancel\]\:translate-x-0[data-swipe="cancel"] {
3537
3579
  --tw-translate-x: 0px;
3538
3580
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3539
3581
  }
3540
-
3541
3582
  .data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe="end"] {
3542
3583
  --tw-translate-x: var(--radix-toast-swipe-end-x);
3543
3584
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3544
3585
  }
3545
-
3546
3586
  .data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe="move"] {
3547
3587
  --tw-translate-x: var(--radix-toast-swipe-move-x);
3548
3588
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3549
3589
  }
3550
-
3551
3590
  @keyframes accordion-up {
3552
3591
 
3553
3592
  from {
@@ -3558,11 +3597,9 @@ body::-webkit-scrollbar {
3558
3597
  height: 0;
3559
3598
  }
3560
3599
  }
3561
-
3562
3600
  .data-\[state\=closed\]\:animate-accordion-up[data-state="closed"] {
3563
3601
  animation: accordion-up 0.2s ease-out;
3564
3602
  }
3565
-
3566
3603
  @keyframes accordion-down {
3567
3604
 
3568
3605
  from {
@@ -3573,43 +3610,33 @@ body::-webkit-scrollbar {
3573
3610
  height: var(--radix-accordion-content-height);
3574
3611
  }
3575
3612
  }
3576
-
3577
3613
  .data-\[state\=open\]\:animate-accordion-down[data-state="open"] {
3578
3614
  animation: accordion-down 0.2s ease-out;
3579
3615
  }
3580
-
3581
3616
  .data-\[state\=checked\]\:bg-stateColors-success[data-state="checked"] {
3582
3617
  background-color: var(--stateColors-success);
3583
3618
  }
3584
-
3585
3619
  .data-\[state\=on\]\:bg-accent[data-state="on"] {
3586
3620
  background-color: hsl(var(--accent));
3587
3621
  }
3588
-
3589
3622
  .data-\[state\=unchecked\]\:bg-stateColors-disabled[data-state="unchecked"] {
3590
3623
  background-color: var(--stateColors-disabled);
3591
3624
  }
3592
-
3593
3625
  .data-\[icon\=true\]\:pr-10[data-icon="true"] {
3594
3626
  padding-right: 2.5rem;
3595
3627
  }
3596
-
3597
3628
  .data-\[state\=on\]\:text-accent-foreground[data-state="on"] {
3598
3629
  color: hsl(var(--accent-foreground));
3599
3630
  }
3600
-
3601
3631
  .data-\[disabled\]\:opacity-50[data-disabled] {
3602
3632
  opacity: 0.5;
3603
3633
  }
3604
-
3605
3634
  .data-\[swipe\=move\]\:transition-none[data-swipe="move"] {
3606
3635
  transition-property: none;
3607
3636
  }
3608
-
3609
3637
  .data-\[state\=open\]\:duration-500[data-state="open"] {
3610
3638
  transition-duration: 500ms;
3611
3639
  }
3612
-
3613
3640
  .data-\[state\=open\]\:animate-in[data-state="open"] {
3614
3641
  animation-name: enter;
3615
3642
  animation-duration: 150ms;
@@ -3619,7 +3646,6 @@ body::-webkit-scrollbar {
3619
3646
  --tw-enter-translate-x: initial;
3620
3647
  --tw-enter-translate-y: initial;
3621
3648
  }
3622
-
3623
3649
  .data-\[state\=closed\]\:animate-out[data-state="closed"] {
3624
3650
  animation-name: exit;
3625
3651
  animation-duration: 150ms;
@@ -3629,7 +3655,6 @@ body::-webkit-scrollbar {
3629
3655
  --tw-exit-translate-x: initial;
3630
3656
  --tw-exit-translate-y: initial;
3631
3657
  }
3632
-
3633
3658
  .data-\[swipe\=end\]\:animate-out[data-swipe="end"] {
3634
3659
  animation-name: exit;
3635
3660
  animation-duration: 150ms;
@@ -3639,67 +3664,51 @@ body::-webkit-scrollbar {
3639
3664
  --tw-exit-translate-x: initial;
3640
3665
  --tw-exit-translate-y: initial;
3641
3666
  }
3642
-
3643
3667
  .data-\[state\=closed\]\:fade-out-0[data-state="closed"] {
3644
3668
  --tw-exit-opacity: 0;
3645
3669
  }
3646
-
3647
3670
  .data-\[state\=open\]\:fade-in-0[data-state="open"] {
3648
3671
  --tw-enter-opacity: 0;
3649
3672
  }
3650
-
3651
3673
  .data-\[state\=closed\]\:zoom-out-95[data-state="closed"] {
3652
3674
  --tw-exit-scale: .95;
3653
3675
  }
3654
-
3655
3676
  .data-\[state\=open\]\:zoom-in-95[data-state="open"] {
3656
3677
  --tw-enter-scale: .95;
3657
3678
  }
3658
-
3659
3679
  .data-\[side\=bottom\]\:slide-in-from-top-2[data-side="bottom"] {
3660
3680
  --tw-enter-translate-y: -0.5rem;
3661
3681
  }
3662
-
3663
3682
  .data-\[side\=left\]\:slide-in-from-right-2[data-side="left"] {
3664
3683
  --tw-enter-translate-x: 0.5rem;
3665
3684
  }
3666
-
3667
3685
  .data-\[side\=right\]\:slide-in-from-left-2[data-side="right"] {
3668
3686
  --tw-enter-translate-x: -0.5rem;
3669
3687
  }
3670
-
3671
3688
  .data-\[side\=top\]\:slide-in-from-bottom-2[data-side="top"] {
3672
3689
  --tw-enter-translate-y: 0.5rem;
3673
3690
  }
3674
-
3675
3691
  .data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state="closed"] {
3676
3692
  --tw-exit-translate-x: -50%;
3677
3693
  }
3678
-
3679
3694
  .data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state="closed"] {
3680
3695
  --tw-exit-translate-y: -48%;
3681
3696
  }
3682
-
3683
3697
  .data-\[state\=closed\]\:slide-out-to-top-full[data-state="closed"] {
3684
3698
  --tw-exit-translate-y: -100%;
3685
3699
  }
3686
-
3687
3700
  .data-\[state\=open\]\:slide-in-from-left-1\/2[data-state="open"] {
3688
3701
  --tw-enter-translate-x: -50%;
3689
3702
  }
3690
-
3691
3703
  .data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state="open"] {
3692
3704
  --tw-enter-translate-y: -48%;
3693
3705
  }
3694
-
3695
3706
  .data-\[state\=open\]\:slide-in-from-top-full[data-state="open"] {
3696
3707
  --tw-enter-translate-y: -100%;
3697
3708
  }
3698
-
3699
3709
  .data-\[state\=open\]\:duration-500[data-state="open"] {
3700
3710
  animation-duration: 500ms;
3701
3711
  }
3702
-
3703
3712
  @media (min-width: 640px) {
3704
3713
 
3705
3714
  .sm\:mt-0 {
@@ -3728,128 +3737,100 @@ body::-webkit-scrollbar {
3728
3737
  text-align: left;
3729
3738
  }
3730
3739
  }
3731
-
3732
3740
  .\[\&\+label\]\:text-stateColors-error+label {
3733
3741
  color: var(--stateColors-error);
3734
3742
  }
3735
-
3736
3743
  .\[\&\:\:-webkit-scrollbar\]\:hidden::-webkit-scrollbar {
3737
3744
  display: none;
3738
3745
  }
3739
-
3740
3746
  .\[\&\>b\]\:py-2>b {
3741
3747
  padding-top: 0.5rem;
3742
3748
  padding-bottom: 0.5rem;
3743
3749
  }
3744
-
3745
3750
  .\[\&\>div\>button\]\:border-coreColors-brandColorPrimary>div>button {
3746
3751
  border-color: var(--coreColors-brandColorPrimary);
3747
3752
  }
3748
-
3749
3753
  .\[\&\>div\]\:w-full>div {
3750
3754
  width: 100%;
3751
3755
  }
3752
-
3753
3756
  .\[\&\>ol\]\:list-decimal>ol {
3754
3757
  list-style-type: decimal;
3755
3758
  }
3756
-
3757
3759
  .\[\&\>p\]\:py-2>p {
3758
3760
  padding-top: 0.5rem;
3759
3761
  padding-bottom: 0.5rem;
3760
3762
  }
3761
-
3762
3763
  .\[\&\>p\]\:text-stateColors-disabled>p {
3763
3764
  color: var(--stateColors-disabled);
3764
3765
  }
3765
-
3766
3766
  .\[\&\>p\]\:text-textColors-primaryColor>p {
3767
3767
  color: var(--textColors-primaryColor, #121212ff);
3768
3768
  }
3769
-
3770
3769
  .\[\&\>p\]\:text-textColors-secondaryColor>p {
3771
3770
  color: var(--textColors-secondaryColor, #727272ff);
3772
3771
  }
3773
-
3774
3772
  .\[\&\>p\]\:\!line-through>p {
3775
3773
  text-decoration-line: line-through !important;
3776
3774
  }
3777
-
3778
3775
  .\[\&\>span\]\:line-clamp-1>span {
3779
3776
  overflow: hidden;
3780
3777
  display: -webkit-box;
3781
3778
  -webkit-box-orient: vertical;
3782
3779
  -webkit-line-clamp: 1;
3783
3780
  }
3784
-
3785
3781
  .\[\&\>ul\>li\]\:py-1>ul>li {
3786
3782
  padding-top: 0.25rem;
3787
3783
  padding-bottom: 0.25rem;
3788
3784
  }
3789
-
3790
3785
  .\[\&\>ul\]\:list-disc>ul {
3791
3786
  list-style-type: disc;
3792
3787
  }
3793
-
3794
3788
  .\[\&\>ul\]\:pl-5>ul {
3795
3789
  padding-left: 1.25rem;
3796
3790
  }
3797
-
3798
3791
  .\[\&\[data-state\=open\]\]\:outline-coreColors-brandColorPrimary[data-state=open] {
3799
3792
  outline-color: var(--coreColors-brandColorPrimary);
3800
3793
  }
3801
-
3802
3794
  .\[\&\[data-state\=open\]_\.chevron-icon\]\:rotate-180[data-state=open] .chevron-icon {
3803
3795
  --tw-rotate: 180deg;
3804
3796
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3805
3797
  }
3806
-
3807
3798
  .\[\&\[data-state\=open\]_\.label\]\:text-coreColors-brandColorPrimary[data-state=open] .label {
3808
3799
  color: var(--coreColors-brandColorPrimary);
3809
3800
  }
3810
-
3811
3801
  .\[\&\[data-state\=open\]_\.label\]\:text-textColors-secondaryColor[data-state=open] .label {
3812
3802
  color: var(--textColors-secondaryColor, #727272ff);
3813
3803
  }
3814
-
3815
3804
  .\[\&\[data-state\=open\]_\.rightIcon\]\:rotate-90[data-state=open] .rightIcon {
3816
3805
  --tw-rotate: 90deg;
3817
3806
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3818
3807
  }
3819
-
3820
3808
  .\[\&\[data-state\=open\]_svg\]\:rotate-180[data-state=open] svg {
3821
3809
  --tw-rotate: 180deg;
3822
3810
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
3823
3811
  }
3824
-
3825
3812
  .\[\&_\*\]\:text-coreColors-pageColor * {
3826
3813
  color: var(--coreColors-pageColor);
3827
3814
  }
3828
-
3829
3815
  .\[\&_\*\]\:text-stateColors-error * {
3830
3816
  color: var(--stateColors-error);
3831
3817
  }
3832
-
3833
3818
  .\[\&_\*\]\:text-textColors-primaryColor * {
3834
3819
  color: var(--textColors-primaryColor, #121212ff);
3835
3820
  }
3836
-
3837
3821
  .\[\&_\*\]\:placeholder\:text-stateColors-error *::-moz-placeholder {
3838
3822
  color: var(--stateColors-error);
3839
3823
  }
3840
-
3841
3824
  .\[\&_\*\]\:placeholder\:text-stateColors-error *::placeholder {
3842
3825
  color: var(--stateColors-error);
3843
3826
  }
3844
-
3845
3827
  .\[\&_label\]\:focus-within\:\!text-stateColors-error:focus-within label {
3846
3828
  color: var(--stateColors-error) !important;
3847
3829
  }
3848
-
3849
3830
  .\[\&_label\]\:focus-within\:text-coreColors-brandColorPrimary:focus-within label {
3850
3831
  color: var(--coreColors-brandColorPrimary);
3851
3832
  }
3852
-
3853
3833
  .\[\&_p\]\:text-stateColors-disabled p {
3854
3834
  color: var(--stateColors-disabled);
3855
3835
  }
3836
+
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=use-order-details.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-order-details.test.d.ts","sourceRoot":"","sources":["../../tests/use-order-details.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { transformOrderDetails } from "../components/hooks/use-order-details";
2
+ // jsdom does not implement crypto.randomUUID, which transformOrderDetails
3
+ // uses for line uniqueIds
4
+ beforeAll(() => {
5
+ if (typeof crypto.randomUUID !== "function") {
6
+ Object.defineProperty(crypto, "randomUUID", {
7
+ configurable: true,
8
+ value: () => `00000000-0000-4000-8000-${`${Math.random()}`
9
+ .slice(2, 14)
10
+ .padEnd(12, "0")}`,
11
+ });
12
+ }
13
+ });
14
+ const buildLineItem = (overrides = {}) => (Object.assign({ title: "Pink Palm Pajamas", quantity: 1, variant: {
15
+ id: "gid://shopify/ProductVariant/111",
16
+ title: "Blush Bay / XS",
17
+ price: { amount: "95.23", currencyCode: "USD" },
18
+ product: {
19
+ id: "gid://shopify/Product/11",
20
+ title: "Pink Palm Pajamas",
21
+ vendor: "Pink Palm Puff",
22
+ },
23
+ }, discountedTotalPrice: { amount: "95.23", currencyCode: "USD" }, originalTotalPrice: { amount: "95.23", currencyCode: "USD" } }, overrides));
24
+ const buildOrder = (lineItems) => ({
25
+ id: "gid://shopify/Order/92625831",
26
+ currency: "USD",
27
+ totalAmount: "95.23",
28
+ lineItems,
29
+ });
30
+ describe("transformOrderDetails — Shopify Order Editing (currentQuantity)", () => {
31
+ it("prefers currentQuantity over quantity for edited orders", () => {
32
+ const { orderDetails, checkoutData } = transformOrderDetails(buildOrder([buildLineItem({ quantity: 3, currentQuantity: 2 })]));
33
+ expect(orderDetails.cart.lines).toHaveLength(1);
34
+ expect(orderDetails.cart.lines[0].quantity).toBe(2);
35
+ expect(checkoutData.lineItems[0].quantity).toBe(2);
36
+ });
37
+ it("excludes line items removed via order editing (currentQuantity 0)", () => {
38
+ const { orderDetails, checkoutData } = transformOrderDetails(buildOrder([
39
+ buildLineItem({
40
+ title: "Pink Palm Pajamas",
41
+ quantity: 1,
42
+ currentQuantity: 1,
43
+ }),
44
+ buildLineItem({
45
+ title: "Live in the Moment Hoodie",
46
+ quantity: 1,
47
+ currentQuantity: 0,
48
+ }),
49
+ ]));
50
+ expect(orderDetails.cart.lines).toHaveLength(1);
51
+ expect(orderDetails.cart.lines[0].title).toBe("Pink Palm Pajamas");
52
+ expect(checkoutData.lineItems).toHaveLength(1);
53
+ expect(checkoutData.lineItems[0].title).toBe("Pink Palm Pajamas");
54
+ });
55
+ it("falls back to quantity when currentQuantity is absent (unedited orders)", () => {
56
+ const { orderDetails } = transformOrderDetails(buildOrder([buildLineItem({ quantity: 2 })]));
57
+ expect(orderDetails.cart.lines).toHaveLength(1);
58
+ expect(orderDetails.cart.lines[0].quantity).toBe(2);
59
+ });
60
+ it("defaults quantity to 1 when neither field is present", () => {
61
+ const { orderDetails } = transformOrderDetails(buildOrder([buildLineItem({ quantity: undefined })]));
62
+ expect(orderDetails.cart.lines).toHaveLength(1);
63
+ expect(orderDetails.cart.lines[0].quantity).toBe(1);
64
+ });
65
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",