@ikas/storefront-model-functions 4.5.0-beta.9 → 5.0.0-beta.10

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
- import{IkasOrderLineItemStatus as r,IkasOrderPackageFullfillStatus as e}from"@ikas/storefront-models";import{validateEmail as t,formatDate as n}from"../../utils/helper.js";function o(t){var n,o=i(t),u=null===(n=t.orderPackages)||void 0===n?void 0:n.filter((function(r){return!r.deleted&&![e.REFUNDED,e.REFUND_REQUESTED,e.REFUND_REQUEST_ACCEPTED,e.REFUND_REJECTED].includes(r.orderPackageFulfillStatus)})),a=t.orderLineItems.filter((function(e){return!e.deleted&&(e.status===r.CANCELLED||e.status===r.CANCEL_REJECTED||e.status===r.CANCEL_REQUESTED)})),c=d(t),s=[];return o.length&&s.push({id:t.id+"-u",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:o.map((function(r){return r.id})),orderPackageFulfillStatus:e.UNFULFILLED,orderPackageNumber:t.orderNumber?t.orderNumber+"-u":"u",stockLocationId:o[0].stockLocationId||"",trackingInfo:null}),u&&s.push.apply(s,u),a.length&&s.push({id:t.id+"-c",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:a.map((function(r){return r.id})),orderPackageFulfillStatus:e.CANCELLED,orderPackageNumber:t.orderNumber?t.orderNumber+"-c":"c",stockLocationId:a[0].stockLocationId||"",trackingInfo:null}),c.length&&s.push({id:t.id+"-r",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:c.map((function(r){return r.id})),orderPackageFulfillStatus:e.REFUNDED,orderPackageNumber:t.orderNumber?t.orderNumber+"-r":"r",stockLocationId:c[0].stockLocationId||"",trackingInfo:null}),s}function u(e,t){if(t&&!t.isActiveRefundSection)return[];var n=function(r){var e=r.orderedAt,t=Date.now();return Math.abs(t-e)/864e5}(e);return e.orderLineItems.filter((function(e){return[r.FULFILLED,r.UNFULFILLED,r.DELIVERED].includes(e.status)&&(!t.orderRefundDayLimit||t.orderRefundDayLimit>=n)}))}function i(e){return e.orderLineItems.filter((function(e){return e.status===r.UNFULFILLED}))}function d(e){return e.orderLineItems.filter((function(e){return e.status===r.REFUNDED||e.status===r.REFUND_REQUESTED||e.status===r.REFUND_REQUEST_ACCEPTED||e.status===r.REFUND_REJECTED}))}function a(r){var e;return(null===(e=r.taxLines)||void 0===e?void 0:e.reduce((function(r,e){return r+e.price}),0))||0}function c(r){var e;return(null===(e=r.shippingLines)||void 0===e?void 0:e.reduce((function(r,e){return r+e.price}),0))||0}function s(r){var e;return!!(null===(e=r.customer)||void 0===e?void 0:e.id)}function l(r){var e;return!!(null===(e=r.customer)||void 0===e?void 0:e.email)&&t(r.customer.email)}function E(r){var e,t;return"".concat((null===(e=r.customer)||void 0===e?void 0:e.firstName)||""," ").concat((null===(t=r.customer)||void 0===t?void 0:t.lastName)||"")}function f(r){var e=new Date;return e.setTime(r.updatedAt),n(e)}function m(r){var e;return null===(e=r.orderAdjustments)||void 0===e?void 0:e.find((function(r){return!!r.couponId}))}function D(r){var e;return null===(e=r.orderAdjustments)||void 0===e?void 0:e.filter((function(r){return!r.couponId}))}export{m as getCouponAdjustment,E as getCustomerFullName,o as getDisplayedPackages,f as getFormattedDate,D as getNonCouponAdjustments,u as getRefundableItems,d as getRefundedItems,c as getShippingTotal,a as getTotalTax,i as getUnfullfilledItems,s as hasCustomer,l as hasValidCustomerEmail};
1
+ import{IkasOrderLineItemStatus as e,IkasOrderPackageFullfillStatus as r}from"@ikas/storefront-models";import{validateEmail as t,formatDate as n}from"../../utils/helper.js";function u(t){var n,u=i(t),o=null===(n=t.orderPackages)||void 0===n?void 0:n.filter((function(e){return!e.deleted&&![r.REFUNDED,r.REFUND_REQUESTED,r.REFUND_REQUEST_ACCEPTED,r.REFUND_REJECTED].includes(e.orderPackageFulfillStatus)})),a=t.orderLineItems.filter((function(r){return!r.deleted&&(r.status===e.CANCELLED||r.status===e.CANCEL_REJECTED||r.status===e.CANCEL_REQUESTED)})),c=d(t),s=[];return u.length&&s.push({id:t.id+"-u",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:u.map((function(e){return e.id})),orderPackageFulfillStatus:r.UNFULFILLED,orderPackageNumber:t.orderNumber?t.orderNumber+"-u":"u",stockLocationId:u[0].stockLocationId||"",trackingInfo:null}),o&&s.push.apply(s,o),a.length&&s.push({id:t.id+"-c",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:a.map((function(e){return e.id})),orderPackageFulfillStatus:r.CANCELLED,orderPackageNumber:t.orderNumber?t.orderNumber+"-c":"c",stockLocationId:a[0].stockLocationId||"",trackingInfo:null}),c.length&&s.push({id:t.id+"-r",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:c.map((function(e){return e.id})),orderPackageFulfillStatus:r.REFUNDED,orderPackageNumber:t.orderNumber?t.orderNumber+"-r":"r",stockLocationId:c[0].stockLocationId||"",trackingInfo:null}),s}function o(r,t){if(t&&!t.isActiveRefundSection)return[];var n=function(e){var r=e.orderedAt,t=Date.now();return Math.abs(t-r)/864e5}(r);return r.orderLineItems.filter((function(r){return[e.FULFILLED,e.UNFULFILLED,e.DELIVERED].includes(r.status)&&(!t.orderRefundDayLimit||t.orderRefundDayLimit>=n)}))}function i(r){return r.orderLineItems.filter((function(r){return r.status===e.UNFULFILLED}))}function d(r){return r.orderLineItems.filter((function(r){return r.status===e.REFUNDED||r.status===e.REFUND_REQUESTED||r.status===e.REFUND_REQUEST_ACCEPTED||r.status===e.REFUND_REJECTED}))}function a(e){var r;return(null===(r=e.taxLines)||void 0===r?void 0:r.reduce((function(e,r){return e+r.price}),0))||0}function c(e){var r;return(null===(r=e.shippingLines)||void 0===r?void 0:r.reduce((function(e,r){return e+r.price}),0))||0}function s(e){var r;return!!(null===(r=e.customer)||void 0===r?void 0:r.id)&&!e.customer.isGuestCheckout}function l(e){var r;return!!(null===(r=e.customer)||void 0===r?void 0:r.email)&&t(e.customer.email)}function E(e){var r,t;return"".concat((null===(r=e.customer)||void 0===r?void 0:r.firstName)||""," ").concat((null===(t=e.customer)||void 0===t?void 0:t.lastName)||"")}function f(e){var r=new Date;return r.setTime(e.updatedAt),n(r)}function m(e){var r;return null===(r=e.orderAdjustments)||void 0===r?void 0:r.find((function(e){return!!e.couponId}))}function D(e){var r;return null===(r=e.orderAdjustments)||void 0===r?void 0:r.filter((function(e){return!e.couponId}))}export{m as getCouponAdjustment,E as getCustomerFullName,u as getDisplayedPackages,f as getFormattedDate,D as getNonCouponAdjustments,o as getRefundableItems,d as getRefundedItems,c as getShippingTotal,a as getTotalTax,i as getUnfullfilledItems,s as hasCustomer,l as hasValidCustomerEmail};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ikas/storefront-model-functions",
3
- "version": "4.5.0-beta.9",
3
+ "version": "5.0.0-beta.10",
4
4
  "description": "Functions for ikas storefront models.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
7
- "main": "build/index.js",
8
- "module": "build/index.js",
7
+ "main": "./build/index.js",
8
+ "module": "./build/index.js",
9
9
  "files": [
10
10
  "build"
11
11
  ],
@@ -16,8 +16,8 @@
16
16
  "build": "rm -rf build && rollup -c"
17
17
  },
18
18
  "devDependencies": {
19
- "@ikas/storefront-config": "^4.5.0-beta.9",
20
- "@ikas/storefront-models": "^4.5.0-beta.9",
19
+ "@ikas/storefront-config": "^5.0.0-beta.10",
20
+ "@ikas/storefront-models": "^5.0.0-beta.10",
21
21
  "@rollup/plugin-node-resolve": "^13.3.0",
22
22
  "@rollup/plugin-commonjs": "^22.0.0",
23
23
  "rollup-plugin-rename-node-modules": "^1.2.0",
@@ -33,8 +33,8 @@
33
33
  "lodash": "^4.17.21"
34
34
  },
35
35
  "peerDependencies": {
36
- "@ikas/storefront-config": "^4.5.0-beta.9",
37
- "@ikas/storefront-models": "^4.5.0-beta.9",
36
+ "@ikas/storefront-config": "^5.0.0-beta.10",
37
+ "@ikas/storefront-models": "^5.0.0-beta.10",
38
38
  "lodash": "^4.17.21"
39
39
  }
40
40
  }