@shipengine/elements 2.6.0 → 2.7.0

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.
Files changed (32) hide show
  1. package/actions-menu.js +2 -2
  2. package/package.json +5 -5
  3. package/src/components/history/history-card/history-card.styles.d.ts +0 -3
  4. package/src/components/service-point-display/operating-hours.styles.d.ts +0 -1
  5. package/src/components/tabs/tabs.styles.d.ts +0 -1
  6. package/src/components/templates/shipment-form/shipment-schema.d.ts +67 -49
  7. package/src/elements/label-layout/label-layout-element.d.ts +7 -0
  8. package/src/elements/labels-grid/hooks/use-labels-grid.d.ts +1 -1
  9. package/src/elements/labels-grid/labels-grid.d.ts +28 -18
  10. package/src/elements/manage-carriers/manage-carriers.d.ts +7 -0
  11. package/src/elements/manage-external-carriers/manage-external-carriers.d.ts +7 -0
  12. package/src/elements/manage-funding/manage-funding-element.d.ts +7 -0
  13. package/src/elements/manage-warehouses/manage-warehouses.d.ts +7 -0
  14. package/src/elements/payment-method-settings/payment-method-settings-element.d.ts +7 -0
  15. package/src/elements/purchase-label/purchase-label.d.ts +7 -0
  16. package/src/elements/shipment-summary/shipment-summary.d.ts +7 -0
  17. package/src/elements/shipments-grid/shipments-grid.d.ts +20 -17
  18. package/src/elements/theme-creator/theme-creator.d.ts +7 -0
  19. package/src/elements/theme-creator/themeData/themeData.d.ts +1 -1
  20. package/src/elements/transaction-history/transaction-history-element.d.ts +7 -0
  21. package/src/elements/unit-settings/unit-settings-element.d.ts +7 -0
  22. package/src/elements/vat-settings/vat-settings-element.d.ts +7 -0
  23. package/src/elements/void-label/void-label.d.ts +7 -0
  24. package/src/locales/en/index.d.ts +7 -0
  25. package/src/workflows/account-settings/account-settings.d.ts +7 -0
  26. package/src/workflows/carrier-services/carrier-services.d.ts +7 -0
  27. package/src/workflows/connect-external-carrier/connect-external-carrier.d.ts +7 -0
  28. package/src/workflows/onboarding/onboarding.d.ts +7 -0
  29. package/transaction-history-element.js +1 -1
  30. package/use-unit-settings.js +1 -1
  31. package/vat.js +1 -1
  32. package/wallet-form.js +1 -1
package/vat.js CHANGED
@@ -1 +1 @@
1
- import e from"lodash/get";import{_ as t,T as r}from"./carrier.js";import{zodResolver as a}from"@hookform/resolvers/zod";import{z as s}from"zod";import{logger as i}from"@shipengine/react-api";const n={accountSettingsFeatures:{showCarrierServices:!0,showExternalCarriers:!0,showLabelLayout:!0,showManageWarehouses:!0,showUnitSettings:!0,showVatSettings:!0},globalFeatures:{poweredByShipEngine:!0,showVatSettings:!1},purchaseLabelFeatures:{compatibleCountryCodes:["AU","CA","FR","DE","GB","IL","IT","NO","ES","SE","US"],enableErrorWhenShipmentCancelled:!1,partnerMessages:{incompleteLabelPurchaseRequirements:void 0},rateForm:{enableFunding:!0,enableGlobalPostFiltering:!1,enablePudoUI:!1,labelLayout:!1,nicknameRate:!0,requireDhlTermsAcknowledgement:!1,saveRate:!0},shipmentForm:{addOns:!0,browseRates:!0,includeShipsuranceInsurance:!0,includeThirdPartyInsurance:!0,selectService:!0,shippingPresets:!1}},shipmentSummaryFeatures:{schedulePickup:!0}},o=e=>{var t;return null!==(t={PurchaseLabel:"ConfigureSalesOrderShipment"}[e])&&void 0!==t?t:""},u=t=>t.map((t=>e(n,t))).reduce(((e,t)=>Object.assign(e,t))),l=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);function c(e,t){const r=Object.assign({},e);return l(e)&&l(t)&&Object.keys(t).forEach((e=>{l(t[e])?(r[e]||Object.assign(r,{[e]:{}}),r[e]=c(r[e],t[e])):Object.assign(r,{[e]:t[e]})})),r}const d={capture(e){return t=>{null==t||t.stopPropagation(),this.isSubmitting=!0,e(t),this.isSubmitting=!1}},isSubmitting:!1,log:(e,r)=>t(void 0,void 0,void 0,(function*(){i.info({obj:e},"Validating registered form fields:");const t=yield r();return Object.keys(t.errors).length?i.error({obj:t.errors},"Validation failed. Errors object:"):i.info({obj:t.values},"Validation passed. Final payload after defaults & transforms:"),t}))},m=e=>"string"==typeof e,h=e=>e.reduce(((e,t)=>{const r=e.findIndex((e=>{var r,a,s,i;return e.rateDetailType===t.rateDetailType&&(null===(r=e.rateDetailAttributes)||void 0===r?void 0:r.taxPercentage)===(null===(a=t.rateDetailAttributes)||void 0===a?void 0:a.taxPercentage)&&(null===(s=e.rateDetailAttributes)||void 0===s?void 0:s.taxType)===(null===(i=t.rateDetailAttributes)||void 0===i?void 0:i.taxType)}));return r<0?e.push({amount:t.amount.amount,currency:t.amount.currency,rateDetailAttributes:t.rateDetailAttributes,rateDetailType:t.rateDetailType}):e[r].amount+=t.amount.amount,e}),[]),p=e=>e.reduce(((e,t)=>(e.total+=t.amount,e.subtotal+=t.amount,"tax"===t.rateDetailType?(e.hasTax=!0,e.subtotal-=t.amount,e.tax.push(t)):e.items.push(t),e)),{hasTax:!1,items:[],subtotal:0,tax:[],total:0}),b=e=>e,g=e=>{switch(e){case"in_transit":return"In Transit";case"error":return"Exception";case"delivered":return"Delivered";case"unknown":return"Unknown";default:return}},v=(e,t)=>{const a=r(t,["code","message","path"]);return JSON.stringify(Object.assign({message:e},a))},f=(e,t)=>{let r;switch(e.code){case s.ZodIssueCode.invalid_type:switch(e.received){case"null":case"undefined":r=t.defaultError.includes("schemaErrors")?t.defaultError:"schemaErrors.required"}break;case s.ZodIssueCode.invalid_string:r="schemaErrors.invalidString";break;case s.ZodIssueCode.too_small:switch(e.type){case"number":0===e.minimum&&(r=e.inclusive?"schemaErrors.nonnegative":"schemaErrors.positive");break;case"string":r=v("schemaErrors.tooFewCharacters",e)}break;case s.ZodIssueCode.too_big:if("string"===e.type)r=v("schemaErrors.tooManyCharacters",e)}return{message:null!=r?r:t.defaultError}},y=e=>(r,s,i)=>t(void 0,void 0,void 0,(function*(){const t=()=>a(e,{errorMap:f})(r,void 0,i);return yield d.isSubmitting?d.log(r,t):t()})),S=["US","CA","AU"],E=e=>{const t=null!=e?e:"";return!S.includes(t)};export{S as N,d as a,m as b,h as c,c as d,p as e,o as f,u as g,b as h,l as i,f as j,E as k,g as t,y as v};
1
+ import e from"lodash/get";import{_ as t,T as r}from"./carrier.js";import{zodResolver as a}from"@hookform/resolvers/zod";import{z as s}from"zod";import{logger as i}from"@shipengine/react-api";const n={accountSettingsFeatures:{showCarrierServices:!0,showExternalCarriers:!1,showLabelLayout:!0,showManageWarehouses:!0,showUnitSettings:!0,showVatSettings:!0},globalFeatures:{poweredByShipEngine:!0,showVatSettings:!1},purchaseLabelFeatures:{compatibleCountryCodes:["AU","CA","FR","DE","GB","IL","IT","NO","ES","SE","US"],enableErrorWhenShipmentCancelled:!1,partnerMessages:{incompleteLabelPurchaseRequirements:void 0},rateForm:{enableFunding:!0,enableGlobalPostFiltering:!1,enablePudoUI:!1,labelLayout:!1,nicknameRate:!0,requireDhlTermsAcknowledgement:!1,saveRate:!0},shipmentForm:{addOns:!0,browseRates:!0,includeShipsuranceInsurance:!0,includeThirdPartyInsurance:!0,selectService:!0,shippingPresets:!1}},shipmentSummaryFeatures:{schedulePickup:!0}},o=e=>{var t;return null!==(t={PurchaseLabel:"ConfigureSalesOrderShipment"}[e])&&void 0!==t?t:""},u=t=>t.map((t=>e(n,t))).reduce(((e,t)=>Object.assign(e,t))),l=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);function c(e,t){const r=Object.assign({},e);return l(e)&&l(t)&&Object.keys(t).forEach((e=>{l(t[e])?(r[e]||Object.assign(r,{[e]:{}}),r[e]=c(r[e],t[e])):Object.assign(r,{[e]:t[e]})})),r}const d={capture(e){return t=>{null==t||t.stopPropagation(),this.isSubmitting=!0,e(t),this.isSubmitting=!1}},isSubmitting:!1,log:(e,r)=>t(void 0,void 0,void 0,(function*(){i.info({obj:e},"Validating registered form fields:");const t=yield r();return Object.keys(t.errors).length?i.error({obj:t.errors},"Validation failed. Errors object:"):i.info({obj:t.values},"Validation passed. Final payload after defaults & transforms:"),t}))},m=e=>"string"==typeof e,h=e=>e.reduce(((e,t)=>{const r=e.findIndex((e=>{var r,a,s,i;return e.rateDetailType===t.rateDetailType&&(null===(r=e.rateDetailAttributes)||void 0===r?void 0:r.taxPercentage)===(null===(a=t.rateDetailAttributes)||void 0===a?void 0:a.taxPercentage)&&(null===(s=e.rateDetailAttributes)||void 0===s?void 0:s.taxType)===(null===(i=t.rateDetailAttributes)||void 0===i?void 0:i.taxType)}));return r<0?e.push({amount:t.amount.amount,currency:t.amount.currency,rateDetailAttributes:t.rateDetailAttributes,rateDetailType:t.rateDetailType}):e[r].amount+=t.amount.amount,e}),[]),p=e=>e.reduce(((e,t)=>(e.total+=t.amount,e.subtotal+=t.amount,"tax"===t.rateDetailType?(e.hasTax=!0,e.subtotal-=t.amount,e.tax.push(t)):e.items.push(t),e)),{hasTax:!1,items:[],subtotal:0,tax:[],total:0}),b=e=>e,g=e=>{switch(e){case"in_transit":return"In Transit";case"error":return"Exception";case"delivered":return"Delivered";case"unknown":return"Unknown";default:return}},v=(e,t)=>{const a=r(t,["code","message","path"]);return JSON.stringify(Object.assign({message:e},a))},f=(e,t)=>{let r;switch(e.code){case s.ZodIssueCode.invalid_type:switch(e.received){case"null":case"undefined":r=t.defaultError.includes("schemaErrors")?t.defaultError:"schemaErrors.required"}break;case s.ZodIssueCode.invalid_string:r="schemaErrors.invalidString";break;case s.ZodIssueCode.too_small:switch(e.type){case"number":0===e.minimum&&(r=e.inclusive?"schemaErrors.nonnegative":"schemaErrors.positive");break;case"string":r=v("schemaErrors.tooFewCharacters",e)}break;case s.ZodIssueCode.too_big:if("string"===e.type)r=v("schemaErrors.tooManyCharacters",e)}return{message:null!=r?r:t.defaultError}},y=e=>(r,s,i)=>t(void 0,void 0,void 0,(function*(){const t=()=>a(e,{errorMap:f})(r,void 0,i);return yield d.isSubmitting?d.log(r,t):t()})),S=["US","CA","AU"],E=e=>{const t=null!=e?e:"";return!S.includes(t)};export{S as N,d as a,m as b,h as c,c as d,p as e,o as f,u as g,b as h,l as i,f as j,E as k,g as t,y as v};