@ikas/storefront-model-functions 4.3.2 → 4.3.3
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,7 +1,8 @@
|
|
|
1
|
-
import { IkasOrder,
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
1
|
+
import { IkasOrder, IkasOrderPackage, IkasOrderRefundSettings } from "@ikas/storefront-models";
|
|
2
|
+
export declare function getDisplayedPackages(order: IkasOrder): IkasOrderPackage[];
|
|
3
|
+
export declare function getRefundableItems(order: IkasOrder, refundSettings: IkasOrderRefundSettings): import("@ikas/storefront-models").IkasOrderLineItem[];
|
|
4
|
+
export declare function getUnfullfilledItems(order: IkasOrder): import("@ikas/storefront-models").IkasOrderLineItem[];
|
|
5
|
+
export declare function getRefundedItems(order: IkasOrder): import("@ikas/storefront-models").IkasOrderLineItem[];
|
|
5
6
|
export declare function getTotalTax(order: IkasOrder): number;
|
|
6
7
|
export declare function getShippingTotal(order: IkasOrder): number;
|
|
7
8
|
export declare function hasCustomer(order: IkasOrder): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{IkasOrderLineItemStatus as r}from"@ikas/storefront-models";import{validateEmail as
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-model-functions",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
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.3.
|
|
20
|
-
"@ikas/storefront-models": "^4.3.
|
|
19
|
+
"@ikas/storefront-config": "^4.3.3",
|
|
20
|
+
"@ikas/storefront-models": "^4.3.3",
|
|
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.3.
|
|
37
|
-
"@ikas/storefront-models": "^4.3.
|
|
36
|
+
"@ikas/storefront-config": "^4.3.3",
|
|
37
|
+
"@ikas/storefront-models": "^4.3.3",
|
|
38
38
|
"lodash": "^4.17.21"
|
|
39
39
|
}
|
|
40
40
|
}
|