@ikas/storefront-model-functions 4.13.11 → 4.13.13
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.
|
@@ -11,3 +11,4 @@ export declare function getCustomerFullName(order: IkasOrder): string;
|
|
|
11
11
|
export declare function getFormattedDate(order: IkasOrder): string;
|
|
12
12
|
export declare function getCouponAdjustment(order: IkasOrder): import("@ikas/storefront-models").IkasOrderAdjustment | undefined;
|
|
13
13
|
export declare function getNonCouponAdjustments(order: IkasOrder): import("@ikas/storefront-models").IkasOrderAdjustment[] | undefined;
|
|
14
|
+
export declare function getOrderProductFiles(order: IkasOrder): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasOrderLineItemStatus as
|
|
1
|
+
import{IkasOrderLineItemStatus as r,IkasOrderPackageFullfillStatus as t}from"@ikas/storefront-models";import{validateEmail as e,formatDate as n}from"../../utils/helper.js";function u(e){var n,u=i(e),o=null===(n=e.orderPackages)||void 0===n?void 0:n.filter((function(r){return!r.deleted&&![t.REFUNDED,t.REFUND_REQUESTED,t.REFUND_REQUEST_ACCEPTED,t.REFUND_REJECTED].includes(r.orderPackageFulfillStatus)})),a=e.orderLineItems.filter((function(t){return!t.deleted&&(t.status===r.CANCELLED||t.status===r.CANCEL_REJECTED||t.status===r.CANCEL_REQUESTED)})),c=d(e),s=[];return u.length&&s.push({id:e.id+"-u",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:u.map((function(r){return r.id})),orderPackageFulfillStatus:t.UNFULFILLED,orderPackageNumber:e.orderNumber?e.orderNumber+"-u":"u",stockLocationId:u[0].stockLocationId||"",trackingInfo:null}),o&&s.push.apply(s,o),a.length&&s.push({id:e.id+"-c",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:a.map((function(r){return r.id})),orderPackageFulfillStatus:t.CANCELLED,orderPackageNumber:e.orderNumber?e.orderNumber+"-c":"c",stockLocationId:a[0].stockLocationId||"",trackingInfo:null}),c.length&&s.push({id:e.id+"-r",createdAt:Date.now(),updatedAt:Date.now(),errorMessage:null,note:null,orderLineItemIds:c.map((function(r){return r.id})),orderPackageFulfillStatus:t.REFUNDED,orderPackageNumber:e.orderNumber?e.orderNumber+"-r":"r",stockLocationId:c[0].stockLocationId||"",trackingInfo:null}),s}function o(t,e){if(e&&!e.isActiveRefundSection)return[];var n=function(r){var t=r.orderedAt,e=Date.now();return Math.abs(e-t)/864e5}(t);return t.orderLineItems.filter((function(t){return[r.FULFILLED,r.UNFULFILLED,r.DELIVERED].includes(t.status)&&(!e.orderRefundDayLimit||e.orderRefundDayLimit>=n)}))}function i(t){return t.orderLineItems.filter((function(t){return t.status===r.UNFULFILLED}))}function d(t){return t.orderLineItems.filter((function(t){return t.status===r.REFUNDED||t.status===r.REFUND_REQUESTED||t.status===r.REFUND_REQUEST_ACCEPTED||t.status===r.REFUND_REJECTED}))}function a(r){var t;return(null===(t=r.taxLines)||void 0===t?void 0:t.reduce((function(r,t){return r+t.price}),0))||0}function c(r){var t;return(null===(t=r.shippingLines)||void 0===t?void 0:t.reduce((function(r,t){return r+t.finalPrice}),0))||0}function s(r){var t;return!!(null===(t=r.customer)||void 0===t?void 0:t.id)&&!r.customer.isGuestCheckout}function l(r){var t;return!!(null===(t=r.customer)||void 0===t?void 0:t.email)&&e(r.customer.email)}function f(r){var t,e;return"".concat((null===(t=r.customer)||void 0===t?void 0:t.firstName)||""," ").concat((null===(e=r.customer)||void 0===e?void 0:e.lastName)||"")}function E(r){var t=new Date;return t.setTime(r.updatedAt),n(t)}function m(r){var t;return null===(t=r.orderAdjustments)||void 0===t?void 0:t.find((function(r){return!!r.couponId}))}function D(r){var t;return null===(t=r.orderAdjustments)||void 0===t?void 0:t.filter((function(r){return!r.couponId}))}function L(t){return t.orderLineItems.filter((function(t){return!!t.variant.fileId&&t.status!==r.REFUNDED})).map((function(r){return r.variant.fileId}))}export{m as getCouponAdjustment,f as getCustomerFullName,u as getDisplayedPackages,E as getFormattedDate,D as getNonCouponAdjustments,L as getOrderProductFiles,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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-model-functions",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.13",
|
|
4
4
|
"description": "Functions for ikas storefront models.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"build": "rm -rf build && rollup -c"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ikas/storefront-config": "^4.13.
|
|
20
|
-
"@ikas/storefront-models": "^4.13.
|
|
19
|
+
"@ikas/storefront-config": "^4.13.13",
|
|
20
|
+
"@ikas/storefront-models": "^4.13.13",
|
|
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.13.
|
|
37
|
-
"@ikas/storefront-models": "^4.13.
|
|
36
|
+
"@ikas/storefront-config": "^4.13.13",
|
|
37
|
+
"@ikas/storefront-models": "^4.13.13",
|
|
38
38
|
"lodash": "^4.17.21"
|
|
39
39
|
}
|
|
40
40
|
}
|