@pelcro/react-pelcro-js 3.26.0-beta.74 → 3.26.0-beta.76

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/dist/index.cjs.js CHANGED
@@ -9387,13 +9387,20 @@ class PelcroActions {
9387
9387
  console.error("invalid item SKU id");
9388
9388
  return false;
9389
9389
  }
9390
- const skusMatchingUserCurrency = window.Pelcro.ecommerce.products.getSkus();
9391
- const itemMatchesUserCurrency = skusMatchingUserCurrency.some(sku => sku.id === quickPurchaseItem.id);
9392
- if (!itemMatchesUserCurrency) {
9393
- const userCurrency = window.Pelcro.user.read().currency;
9394
- console.error(`SKU currency (${quickPurchaseItem.currency}) doesn't match user account's currency (${userCurrency}). users can only purchase SKUs that match their account's currency`);
9395
- return false;
9396
- }
9390
+ window.Pelcro.ecommerce.products.getSkus();
9391
+
9392
+ // const itemMatchesUserCurrency = skusMatchingUserCurrency.some(
9393
+ // (sku) => sku.id === quickPurchaseItem.id
9394
+ // );
9395
+
9396
+ // if (!itemMatchesUserCurrency) {
9397
+ // const userCurrency = window.Pelcro.user.read().currency;
9398
+ // console.error(
9399
+ // `SKU currency (${quickPurchaseItem.currency}) doesn't match user account's currency (${userCurrency}). users can only purchase SKUs that match their account's currency`
9400
+ // );
9401
+ // return false;
9402
+ // }
9403
+
9397
9404
  const quickPurchaseItemWithQuantity = {
9398
9405
  ...quickPurchaseItem,
9399
9406
  quantity: 1
@@ -20450,6 +20457,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20450
20457
  address_id: selectedAddressId
20451
20458
  }, handleCouponResponse);
20452
20459
  } else if (type === "orderCreate") {
20460
+ var _window$Pelcro$site$r9;
20453
20461
  const isQuickPurchase = !Array.isArray(order);
20454
20462
  const mappedOrderItems = isQuickPurchase ? [{
20455
20463
  sku_id: order.id,
@@ -20458,10 +20466,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20458
20466
  sku_id: item.id,
20459
20467
  quantity: item.quantity
20460
20468
  }));
20461
- window.Pelcro.ecommerce.order.createSummary({
20469
+ const orderSummaryParams = {
20462
20470
  items: mappedOrderItems,
20463
20471
  coupon_code: couponCode
20464
- }, handleCouponResponse);
20472
+ };
20473
+ if ((_window$Pelcro$site$r9 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r9 !== void 0 && _window$Pelcro$site$r9.taxes_enabled) {
20474
+ orderSummaryParams.address_id = selectedAddressId;
20475
+ }
20476
+ window.Pelcro.ecommerce.order.createSummary(orderSummaryParams, handleCouponResponse);
20465
20477
  }
20466
20478
  }
20467
20479
  };
@@ -21364,11 +21376,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
21364
21376
  * @return {Promise}
21365
21377
  */
21366
21378
  const resolveTaxCalculation = () => {
21367
- var _window$Pelcro$site$r9;
21379
+ var _window$Pelcro$site$r10;
21368
21380
  if (type === "invoicePayment") {
21369
21381
  return new Promise(resolve => resolve());
21370
21382
  }
21371
- const taxesEnabled = (_window$Pelcro$site$r9 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.taxes_enabled;
21383
+ const taxesEnabled = (_window$Pelcro$site$r10 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r10 === void 0 ? void 0 : _window$Pelcro$site$r10.taxes_enabled;
21372
21384
  return new Promise((resolve, reject) => {
21373
21385
  // resolve early if taxes isn't enabled
21374
21386
  if (!taxesEnabled) {
package/dist/index.esm.js CHANGED
@@ -9357,13 +9357,20 @@ class PelcroActions {
9357
9357
  console.error("invalid item SKU id");
9358
9358
  return false;
9359
9359
  }
9360
- const skusMatchingUserCurrency = window.Pelcro.ecommerce.products.getSkus();
9361
- const itemMatchesUserCurrency = skusMatchingUserCurrency.some(sku => sku.id === quickPurchaseItem.id);
9362
- if (!itemMatchesUserCurrency) {
9363
- const userCurrency = window.Pelcro.user.read().currency;
9364
- console.error(`SKU currency (${quickPurchaseItem.currency}) doesn't match user account's currency (${userCurrency}). users can only purchase SKUs that match their account's currency`);
9365
- return false;
9366
- }
9360
+ window.Pelcro.ecommerce.products.getSkus();
9361
+
9362
+ // const itemMatchesUserCurrency = skusMatchingUserCurrency.some(
9363
+ // (sku) => sku.id === quickPurchaseItem.id
9364
+ // );
9365
+
9366
+ // if (!itemMatchesUserCurrency) {
9367
+ // const userCurrency = window.Pelcro.user.read().currency;
9368
+ // console.error(
9369
+ // `SKU currency (${quickPurchaseItem.currency}) doesn't match user account's currency (${userCurrency}). users can only purchase SKUs that match their account's currency`
9370
+ // );
9371
+ // return false;
9372
+ // }
9373
+
9367
9374
  const quickPurchaseItemWithQuantity = {
9368
9375
  ...quickPurchaseItem,
9369
9376
  quantity: 1
@@ -20420,6 +20427,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20420
20427
  address_id: selectedAddressId
20421
20428
  }, handleCouponResponse);
20422
20429
  } else if (type === "orderCreate") {
20430
+ var _window$Pelcro$site$r9;
20423
20431
  const isQuickPurchase = !Array.isArray(order);
20424
20432
  const mappedOrderItems = isQuickPurchase ? [{
20425
20433
  sku_id: order.id,
@@ -20428,10 +20436,14 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20428
20436
  sku_id: item.id,
20429
20437
  quantity: item.quantity
20430
20438
  }));
20431
- window.Pelcro.ecommerce.order.createSummary({
20439
+ const orderSummaryParams = {
20432
20440
  items: mappedOrderItems,
20433
20441
  coupon_code: couponCode
20434
- }, handleCouponResponse);
20442
+ };
20443
+ if ((_window$Pelcro$site$r9 = window.Pelcro.site.read()) !== null && _window$Pelcro$site$r9 !== void 0 && _window$Pelcro$site$r9.taxes_enabled) {
20444
+ orderSummaryParams.address_id = selectedAddressId;
20445
+ }
20446
+ window.Pelcro.ecommerce.order.createSummary(orderSummaryParams, handleCouponResponse);
20435
20447
  }
20436
20448
  }
20437
20449
  };
@@ -21334,11 +21346,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
21334
21346
  * @return {Promise}
21335
21347
  */
21336
21348
  const resolveTaxCalculation = () => {
21337
- var _window$Pelcro$site$r9;
21349
+ var _window$Pelcro$site$r10;
21338
21350
  if (type === "invoicePayment") {
21339
21351
  return new Promise(resolve => resolve());
21340
21352
  }
21341
- const taxesEnabled = (_window$Pelcro$site$r9 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.taxes_enabled;
21353
+ const taxesEnabled = (_window$Pelcro$site$r10 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r10 === void 0 ? void 0 : _window$Pelcro$site$r10.taxes_enabled;
21342
21354
  return new Promise((resolve, reject) => {
21343
21355
  // resolve early if taxes isn't enabled
21344
21356
  if (!taxesEnabled) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.26.0-beta.74",
4
+ "version": "3.26.0-beta.76",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",