@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
|
|
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": "
|
|
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": "^
|
|
20
|
-
"@ikas/storefront-models": "^
|
|
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": "^
|
|
37
|
-
"@ikas/storefront-models": "^
|
|
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
|
}
|