@ikas/storefront-model-functions 4.13.10 → 4.13.12

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 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.finalPrice}),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};
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.10",
3
+ "version": "4.13.12",
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.10",
20
- "@ikas/storefront-models": "^4.13.10",
19
+ "@ikas/storefront-config": "^4.13.12",
20
+ "@ikas/storefront-models": "^4.13.12",
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.10",
37
- "@ikas/storefront-models": "^4.13.10",
36
+ "@ikas/storefront-config": "^4.13.12",
37
+ "@ikas/storefront-models": "^4.13.12",
38
38
  "lodash": "^4.17.21"
39
39
  }
40
40
  }