@tapcart/mobile-components 0.9.0 → 0.9.1

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":"variablesCart.util.d.ts","sourceRoot":"","sources":["../../lib/variablesCart.util.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,6BAA6B,EAO9B,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,2BAA2B;;cAM5B,MAAM;;0BAEI;YAChB,gBAAgB,CAAC,EAAE,MAAM,CAAA;YACzB,KAAK,EAAE,MAAM,CAAA;YACb,cAAc,CAAC,EAAE,MAAM,CAAA;SACxB,EAAE;;;;;;CAyBN,CAAA;AA4FD,eAAO,MAAM,6BAA6B,SAClC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAED,eAAO,MAAM,2BAA2B,SAChC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAoLD,MAAM,MAAM,uBAAuB,GAAG;IACpC,yBAAyB,EAAE,sBAAsB,EAAE,CAAA;IACnD,gBAAgB,EAAE,6BAA6B,EAAE,CAAA;IACjD,cAAc,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iCAAiC,EAAE,uBAU/C,CAAA;AAED,eAAO,MAAM,8BAA8B,SACnC,SAAS,GAAG,IAAI,KACrB,uBAmCF,CAAA"}
1
+ {"version":3,"file":"variablesCart.util.d.ts","sourceRoot":"","sources":["../../lib/variablesCart.util.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,6BAA6B,EAO9B,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,2BAA2B;;cAM5B,MAAM;;0BAEI;YAChB,gBAAgB,CAAC,EAAE,MAAM,CAAA;YACzB,KAAK,EAAE,MAAM,CAAA;YACb,cAAc,CAAC,EAAE,MAAM,CAAA;SACxB,EAAE;;;;;;CAyBN,CAAA;AA4FD,eAAO,MAAM,6BAA6B,SAClC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAED,eAAO,MAAM,2BAA2B,SAChC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAqLD,MAAM,MAAM,uBAAuB,GAAG;IACpC,yBAAyB,EAAE,sBAAsB,EAAE,CAAA;IACnD,gBAAgB,EAAE,6BAA6B,EAAE,CAAA;IACjD,cAAc,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iCAAiC,EAAE,uBAU/C,CAAA;AAED,eAAO,MAAM,8BAA8B,SACnC,SAAS,GAAG,IAAI,KACrB,uBAmCF,CAAA"}
@@ -5,9 +5,9 @@ export const getSubscriptionPriceDetails = ({ totalAmount, quantity, sellingPlan
5
5
  const isSubscription = ((_a = sellingPlanAllocation === null || sellingPlanAllocation === void 0 ? void 0 : sellingPlanAllocation.priceAdjustments) === null || _a === void 0 ? void 0 : _a.length) > 0;
6
6
  if (isSubscription) {
7
7
  const { perDeliveryPrice, price, compareAtPrice } = sellingPlanAllocation.priceAdjustments[0];
8
- const effectivePrice = perDeliveryPrice || price;
9
- const subscriptionUnitPrice = perDeliveryPrice || 0;
10
- const effectiveCompareAtPrice = compareAtPrice * quantity || totalAmount || 0;
8
+ const effectivePrice = (perDeliveryPrice === null || perDeliveryPrice === void 0 ? void 0 : perDeliveryPrice.amount) || price.amount;
9
+ const subscriptionUnitPrice = (perDeliveryPrice === null || perDeliveryPrice === void 0 ? void 0 : perDeliveryPrice.amount) || 0;
10
+ const effectiveCompareAtPrice = (compareAtPrice === null || compareAtPrice === void 0 ? void 0 : compareAtPrice.amount) * quantity || totalAmount || 0;
11
11
  return {
12
12
  price: totalAmount,
13
13
  compareAtPrice: effectiveCompareAtPrice,
@@ -133,7 +133,7 @@ const getCompareAtPriceDifference = (cart) => {
133
133
  if (!cart)
134
134
  return 0;
135
135
  return (_a = cart === null || cart === void 0 ? void 0 : cart.items) === null || _a === void 0 ? void 0 : _a.reduce((acc, item) => {
136
- var _a, _b, _c, _d, _e, _f;
136
+ var _a, _b, _c, _d, _e, _f, _g, _h;
137
137
  /**
138
138
  * Regular price details
139
139
  */
@@ -144,8 +144,8 @@ const getCompareAtPriceDifference = (cart) => {
144
144
  */
145
145
  if (((_b = (_a = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _a === void 0 ? void 0 : _a.priceAdjustments) === null || _b === void 0 ? void 0 : _b.length) > 0) {
146
146
  itemPrice =
147
- ((_d = (_c = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _c === void 0 ? void 0 : _c.priceAdjustments[0]) === null || _d === void 0 ? void 0 : _d.perDeliveryPrice) ||
148
- ((_f = (_e = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _e === void 0 ? void 0 : _e.priceAdjustments[0]) === null || _f === void 0 ? void 0 : _f.price) ||
147
+ ((_e = (_d = (_c = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _c === void 0 ? void 0 : _c.priceAdjustments[0]) === null || _d === void 0 ? void 0 : _d.perDeliveryPrice) === null || _e === void 0 ? void 0 : _e.amount) ||
148
+ ((_h = (_g = (_f = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _f === void 0 ? void 0 : _f.priceAdjustments[0]) === null || _g === void 0 ? void 0 : _g.price) === null || _h === void 0 ? void 0 : _h.amount) ||
149
149
  0;
150
150
  const { compareAtPrice } = getSubscriptionPriceDetails({
151
151
  quantity: (item === null || item === void 0 ? void 0 : item.quantity) || 1,
@@ -574,9 +574,18 @@ describe("cart-provider.util", () => {
574
574
  name: "Ski wax subscription, billed and delivered weekly",
575
575
  priceAdjustments: [
576
576
  {
577
- compareAtPrice: 10,
578
- perDeliveryPrice: 8.5,
579
- price: 8.5,
577
+ compareAtPrice: {
578
+ amount: 10,
579
+ currencyCode: "USD",
580
+ },
581
+ perDeliveryPrice: {
582
+ amount: 8.5,
583
+ currencyCode: "USD",
584
+ },
585
+ price: {
586
+ amount: 8.5,
587
+ currencyCode: "USD",
588
+ },
580
589
  },
581
590
  ],
582
591
  },
package/dist/styles.css CHANGED
@@ -1429,6 +1429,9 @@ video {
1429
1429
  .grid-cols-\[auto_1fr_auto\] {
1430
1430
  grid-template-columns: auto 1fr auto;
1431
1431
  }
1432
+ .grid-rows-2 {
1433
+ grid-template-rows: repeat(2, minmax(0, 1fr));
1434
+ }
1432
1435
  .flex-row {
1433
1436
  flex-direction: row;
1434
1437
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",