@shipengine/elements 2.0.0 → 2.1.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 (118) hide show
  1. package/actions-menu.js +34 -0
  2. package/carrier-logo.js +1 -0
  3. package/components.js +1 -1
  4. package/constants.js +1 -1
  5. package/elements.js +1 -1
  6. package/extensions.js +1 -1
  7. package/formatString.js +1 -0
  8. package/hooks.js +1 -1
  9. package/index.js +1 -1
  10. package/package.json +15 -45
  11. package/pudo.js +1 -0
  12. package/schemas.js +1 -1
  13. package/src/components/actions-menu/actions-menu.d.ts +19 -0
  14. package/src/components/actions-menu/index.d.ts +1 -0
  15. package/src/components/collapsible-panel/collapsible-panel.styles.d.ts +10 -13
  16. package/src/components/field/checkbox-input/checkbox-input.d.ts +1 -0
  17. package/src/components/field/rate-card/rate-card.styles.d.ts +0 -1
  18. package/src/components/field/select/index.d.ts +1 -0
  19. package/src/components/field/select/select-with-categories.d.ts +20 -0
  20. package/src/components/field/select/select.d.ts +5 -10
  21. package/src/components/index.d.ts +1 -0
  22. package/src/components/templates/connected-carrier-list/connected-carrier-list.d.ts +4 -1
  23. package/src/components/templates/connected-carrier-list/connected-carrier-list.styles.d.ts +0 -10
  24. package/src/components/templates/connected-carrier-list/connected-carrier-row/connected-carrier-row.d.ts +4 -1
  25. package/src/components/templates/connected-carrier-list/connected-carrier-row/connected-carrier-row.styles.d.ts +19 -12
  26. package/src/components/templates/products-display/products-display.styles.d.ts +12 -4
  27. package/src/components/templates/shipment-form/sections/customs-forms/components/index.d.ts +2 -0
  28. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/form/index.d.ts +3 -0
  29. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/form/schema.d.ts +38 -0
  30. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/form/values.d.ts +12 -0
  31. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/index.d.ts +2 -0
  32. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/tax-id-form.d.ts +17 -0
  33. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/tax-id-list.d.ts +12 -0
  34. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/tax-ids.d.ts +8 -0
  35. package/src/components/templates/shipment-form/sections/customs-forms/components/tax-ids/tax-ids.styles.d.ts +70 -0
  36. package/src/components/templates/shipment-form/sections/customs-forms/customs-forms.d.ts +10 -0
  37. package/src/components/templates/shipment-form/sections/customs-forms/index.d.ts +1 -0
  38. package/src/components/templates/shipment-form/sections/index.d.ts +1 -0
  39. package/src/components/templates/shipment-form/shipment-form.d.ts +2 -1
  40. package/src/components/templates/shipment-form/shipment-form.styles.d.ts +9 -0
  41. package/src/components/warehouse-form/warehouse-form.d.ts +10 -3
  42. package/src/components/zero-state/zero-state.d.ts +6 -0
  43. package/src/components/zero-state/zero-state.styles.d.ts +14 -0
  44. package/src/elements/label-layout/label-layout-element.d.ts +43 -1
  45. package/src/elements/labels-grid/labels-grid.d.ts +43 -1
  46. package/src/elements/manage-carriers/manage-carriers.d.ts +93 -52
  47. package/src/elements/manage-external-carriers/manage-external-carriers.d.ts +65 -1
  48. package/src/elements/manage-funding/manage-funding-element.d.ts +46 -3
  49. package/src/elements/manage-warehouses/manage-warehouses.d.ts +43 -1
  50. package/src/elements/payment-method-settings/payment-method-settings-element.d.ts +46 -3
  51. package/src/elements/purchase-label/hooks/use-customs.d.ts +1 -0
  52. package/src/elements/purchase-label/hooks/use-shipment-form.d.ts +1 -0
  53. package/src/elements/purchase-label/purchase-label.d.ts +68 -4
  54. package/src/elements/shipment-summary/shipment-summary.d.ts +47 -1
  55. package/src/elements/shipments-grid/shipments-grid.d.ts +43 -1
  56. package/src/elements/theme-creator/theme-creator.d.ts +43 -1
  57. package/src/elements/transaction-history/transaction-history-element.d.ts +43 -1
  58. package/src/elements/unit-settings/unit-settings-element.d.ts +43 -1
  59. package/src/elements/vat-settings/vat-settings-element.d.ts +43 -1
  60. package/src/elements/void-label/void-label.d.ts +57 -10
  61. package/src/elements-provider/elements-context-provider.d.ts +44 -0
  62. package/src/elements-provider/elements-provider.d.ts +6 -40
  63. package/src/elements-provider/index.d.ts +2 -0
  64. package/src/features/manage-carriers/hooks/use-list-funding-source-carriers.d.ts +1 -1
  65. package/src/features/manage-carriers/manage-carriers.d.ts +2 -1
  66. package/src/features/manage-external-carriers/index.d.ts +1 -0
  67. package/src/features/manage-external-carriers/manage-external-carriers.d.ts +11 -1
  68. package/src/features/manage-external-carriers/use-manage-external-carriers.d.ts +12 -0
  69. package/src/features/manage-funding/manage-funding.d.ts +4 -1
  70. package/src/features/payment-method-settings/payment-method-settings.d.ts +4 -1
  71. package/src/hooks/options/use-package-options.d.ts +1 -1
  72. package/src/hooks/options/use-warehouse-options.d.ts +3 -1
  73. package/src/index.d.ts +1 -0
  74. package/src/locales/en/index.d.ts +43 -1
  75. package/src/testing/test-utils.d.ts +0 -1
  76. package/src/utilities/formatString.d.ts +2 -0
  77. package/src/utilities/index.d.ts +1 -0
  78. package/src/utilities/pudo.d.ts +3 -0
  79. package/src/utilities/rates.d.ts +1 -3
  80. package/src/utilities/shipengine/carrier.d.ts +4 -1
  81. package/src/workflows/account-settings/account-settings.d.ts +45 -2
  82. package/src/workflows/account-settings/use-get-panel-props.d.ts +3 -3
  83. package/src/workflows/carrier-services/carrier-services.d.ts +51 -29
  84. package/src/workflows/connect-external-carrier/connect-external-carrier.d.ts +43 -1
  85. package/src/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.d.ts +2 -1
  86. package/src/workflows/onboarding/onboarding.d.ts +43 -1
  87. package/story-notes.js +1 -0
  88. package/suspend-text.js +1 -0
  89. package/transaction-history-element.js +1 -0
  90. package/use-page-layout.js +1 -0
  91. package/use-scrub-errors.js +1 -0
  92. package/use-toggle.js +1 -0
  93. package/use-unit-settings.js +1 -0
  94. package/utilities.js +1 -1
  95. package/validation.js +1 -0
  96. package/wallet-form.js +1 -0
  97. package/warehouses.js +1 -0
  98. package/workflows.js +1 -1
  99. package/carrier-c2a5ed53.js +0 -1
  100. package/carrier-logo-330e926f.js +0 -1
  101. package/formatString-413ec7c7.js +0 -1
  102. package/shipment-150160e0.js +0 -1
  103. package/story-notes-c714d2ed.js +0 -1
  104. package/suspend-text-cad3a977.js +0 -1
  105. package/transaction-history-element-cbfe487c.js +0 -1
  106. package/use-page-layout-8cb5075f.js +0 -1
  107. package/use-scrub-errors-9870a6f3.js +0 -1
  108. package/use-toggle-866d7938.js +0 -1
  109. package/use-unit-settings-a5bae16e.js +0 -1
  110. package/validation-528e7834.js +0 -1
  111. package/wallet-form-9e4bfaea.js +0 -1
  112. package/warehouse-form-da6a7ac5.js +0 -34
  113. package/warehouses-a83188ab.js +0 -1
  114. /package/{address-8f8119f4.js → address.js} +0 -0
  115. /package/{assertions-dfa95b4d.js → assertions.js} +0 -0
  116. /package/{money-d4f3d7c3.js → money.js} +0 -0
  117. /package/{phone-87dd7bd8.js → phone.js} +0 -0
  118. /package/{zod-60def96c.js → zod.js} +0 -0
@@ -0,0 +1 @@
1
+ import{jsx as r}from"@emotion/react/jsx-runtime";import{K as t}from"./formatString.js";const o={md:40,lg:68,xl:105},e=({carrierCode:e,carrierName:i,size:m="md"})=>{const a=t(e,"logo");return a?r("img",{alt:i,height:o[m],src:a,width:o[m]},i):null};export{e as C};
package/components.js CHANGED
@@ -1 +1 @@
1
- export{A as AddFundsForm,a as AutoFundingForm,B as ButtonGroup,C as CarrierBalance,c as CarrierConnectionCard,d as CarrierIcon,e as CollapsiblePanel,f as CopyButton,h as Cube,D as DateRangeCombo,i as DateRangeSelect,j as DisplayTerm,E as EditBillingForm,k as ErrorFallback,F as FieldLabel,l as FormPortal,m as FundAndPurchase,H as HistoryCard,n as HistoryCardExtension,I as InlineLabel,o as ItemsBreakdown,L as LinkAction,p as Loader,P as PoweredByShipEngine,R as RateDetails,S as Section,q as SettingsCard,r as SkeletonCarrierRow,t as Spacer,u as Spread,T as Tabs,V as VatForm,W as WalletCard,v as WarehouseForm,b as autoFundingSchema,g as getAddFundsSchema,s as styles}from"./warehouse-form-da6a7ac5.js";export{C as CarrierLogo}from"./carrier-logo-330e926f.js";export{C as CellFormattedDate,D as Drawer,G as GridController,P as Pager,S as SuspendText,u as usePager}from"./suspend-text-cad3a977.js";export{f as Field,S as StoryNotes}from"./story-notes-c714d2ed.js";export{P as Portal}from"./use-toggle-866d7938.js";import"./carrier-c2a5ed53.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"@shipengine/react-api";import"./address-8f8119f4.js";import"@emotion/react/jsx-runtime";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./validation-528e7834.js";import"lodash/get";import"@hookform/resolvers/zod";import"zod";import"@emotion/react";import"@shipengine/giger-theme";import"lodash/isEqual";import"./money-d4f3d7c3.js";import"copy-to-clipboard";import"js-base64";import"card-validator";import"libphonenumber-js/min";import"axios";import"./zod-60def96c.js";import"lodash/omit";import"react-dom";
1
+ export{z as Actions,y as ActionsMenu,A as AddFundsForm,b as AutoFundingForm,B as ButtonGroup,C as CarrierBalance,d as CarrierConnectionCard,e as CarrierIcon,f as CollapsiblePanel,h as CopyButton,i as Cube,D as DateRangeCombo,j as DateRangeSelect,k as DisplayTerm,l as EditBillingForm,m as ErrorFallback,F as FieldLabel,n as FormPortal,o as FundAndPurchase,H as HistoryCard,p as HistoryCardExtension,I as InlineLabel,q as ItemsBreakdown,L as LinkAction,r as Loader,P as PoweredByShipEngine,R as RateDetails,S as Section,t as SettingsCard,u as SkeletonCarrierRow,v as Spacer,w as Spread,T as Tabs,V as VatForm,W as WalletCard,x as WarehouseForm,c as autoFundingSchema,g as getAddFundsSchema,s as styles}from"./actions-menu.js";export{C as CarrierLogo}from"./carrier-logo.js";export{C as CellFormattedDate,D as Drawer,G as GridController,P as Pager,S as SuspendText,u as usePager}from"./suspend-text.js";export{f as Field,S as StoryNotes}from"./story-notes.js";export{P as Portal}from"./use-toggle.js";import"./formatString.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"@shipengine/react-api";import"./address.js";import"humps";import"@emotion/react/jsx-runtime";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./validation.js";import"lodash/get";import"@hookform/resolvers/zod";import"zod";import"@emotion/react";import"@shipengine/giger-theme";import"lodash/isEqual";import"./money.js";import"copy-to-clipboard";import"js-base64";import"libphonenumber-js/min";import"lodash/omit";import"card-validator";import"./zod.js";import"react-dom";
package/constants.js CHANGED
@@ -1 +1 @@
1
- export{C as Country,U as UsState,d as UsaCity,c as countries,a as countryCodes,e as euCountryCodes,p as postalCodeRegex,f as usCities,b as usStateCodes,u as usStates}from"./address-8f8119f4.js";
1
+ export{C as Country,U as UsState,d as UsaCity,c as countries,a as countryCodes,e as euCountryCodes,p as postalCodeRegex,f as usCities,b as usStateCodes,u as usStates}from"./address.js";
package/elements.js CHANGED
@@ -1 +1 @@
1
- export{e as LabelLayout,l as LabelsGrid,m as ManageCarriers,b as ManageExternalCarriers,d as ManageFunding,a as ManageWarehouses,p as PaymentMethodSettings,s as ShipmentsGrid,t as ThemeCreator,T as ThemeCreatorProvider,f as TransactionHistory,c as UnitSettings,u as useThemeCreator}from"./transaction-history-element-cbfe487c.js";export{c as CarrierServices,p as PurchaseLabel,s as ShipmentSummary,v as VoidLabel}from"./use-unit-settings-a5bae16e.js";import"@emotion/react/jsx-runtime";import"./warehouse-form-da6a7ac5.js";import"./carrier-c2a5ed53.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"@shipengine/react-api";import"./address-8f8119f4.js";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./validation-528e7834.js";import"lodash/get";import"@hookform/resolvers/zod";import"zod";import"@emotion/react";import"@shipengine/giger-theme";import"./use-toggle-866d7938.js";import"lodash/isEqual";import"lodash/omit";import"react-dom";import"./money-d4f3d7c3.js";import"copy-to-clipboard";import"js-base64";import"card-validator";import"libphonenumber-js/min";import"axios";import"./zod-60def96c.js";import"./suspend-text-cad3a977.js";import"./formatString-413ec7c7.js";import"humps";import"@tanstack/react-query";import"./use-scrub-errors-9870a6f3.js";import"./shipment-150160e0.js";import"lodash/orderBy";import"lodash/merge";import"lodash/mergeWith";import"./warehouses-a83188ab.js";import"@shipengine/js-api";import"@rjsf/core";import"@rjsf/validator-ajv8";import"lodash/camelCase";import"use-debounce";import"classnames";import"i18next";import"i18next-browser-languagedetector";import"@emotion/cache";import"stylis";
1
+ export{e as LabelLayout,l as LabelsGrid,m as ManageCarriers,b as ManageExternalCarriers,d as ManageFunding,a as ManageWarehouses,p as PaymentMethodSettings,s as ShipmentsGrid,t as ThemeCreator,T as ThemeCreatorProvider,f as TransactionHistory,c as UnitSettings,u as useThemeCreator}from"./transaction-history-element.js";export{a as CarrierServices,p as PurchaseLabel,s as ShipmentSummary,v as VoidLabel}from"./use-unit-settings.js";import"@emotion/react/jsx-runtime";import"./actions-menu.js";import"./formatString.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"@shipengine/react-api";import"./address.js";import"humps";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./validation.js";import"lodash/get";import"@hookform/resolvers/zod";import"zod";import"@emotion/react";import"@shipengine/giger-theme";import"./use-toggle.js";import"lodash/isEqual";import"lodash/omit";import"react-dom";import"./money.js";import"copy-to-clipboard";import"js-base64";import"libphonenumber-js/min";import"card-validator";import"./zod.js";import"./suspend-text.js";import"@tanstack/react-query";import"./use-scrub-errors.js";import"./pudo.js";import"lodash/orderBy";import"lodash/merge";import"lodash/mergeWith";import"./warehouses.js";import"axios";import"@shipengine/js-api";import"@rjsf/core";import"@rjsf/validator-ajv8";import"lodash/camelCase";import"use-debounce";import"classnames";import"i18next";import"i18next-browser-languagedetector";import"@emotion/cache";import"stylis";
package/extensions.js CHANGED
@@ -1 +1 @@
1
- export{e as extendZod}from"./zod-60def96c.js";import"zod";
1
+ export{e as extendZod}from"./zod.js";import"zod";
@@ -0,0 +1 @@
1
+ import{format as e}from"date-fns/format";import{enGB as t,enUS as r}from"date-fns/locale";import{parse as a}from"date-fns/parse";import{SE as n}from"@shipengine/react-api";import{c as s,u as o,f as i}from"./address.js";import c from"humps";function u(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]])}return r}function l(e,t,r,a){return new(r||(r=Promise))((function(n,s){function o(e){try{c(a.next(e))}catch(e){s(e)}}function i(e){try{c(a.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,i)}c((a=a.apply(e,t||[])).next())}))}const d=(e,t="en-US")=>new Date(e).toLocaleDateString(t,{day:"numeric",month:"long",year:"numeric"}),g=(e="en-US")=>{const a=e.replaceAll("-",""),n=e.split("-")[0],s={enGB:t,enUS:r};return s[a in s?a:n]},p=(t,r="en-US",a)=>{const n=g(r),s=D(r);return e(t,null!=a?a:s,{locale:n})},m=(e,t="en-US",r="P")=>{const n=g(t);return a(e,r,new Date,{locale:n})},y=(e,t="en-US")=>new Date(e).toLocaleDateString(t,{day:"2-digit",month:"2-digit",year:"2-digit"}),f=(e,t="en-US")=>new Date(e).toLocaleDateString(t,{day:"2-digit",month:"2-digit",year:"numeric"}),D=(e="en-US")=>{var t;return null===(t=(g(e)||g("en-US")).formatLong)||void 0===t?void 0:t.date({width:"short"})},w=(e,t=new Date)=>((t=new Date(t)).setDate(t.getDate()+e),t),v=(e,t=new Date)=>t.getHours()>=e?w(1,new Date(t)):new Date(t),h=(...e)=>new Date(Math.max(...e.map(Number))),b=e=>{const t=e?new Date(e):new Date;return new Date(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())},C=e=>{const t=(new Date).getFullYear(),r=[];for(let a=0;a<e;a++)r.push(`${t+a}`);return r},U=(e,t,r="desc")=>{const[a,n]="asc"===r?[e,t]:[t,e];return new Date(a.createdAt).getTime()-new Date(n.createdAt).getTime()},S=e=>!!e&&new Date(e)>=new Date,O=e=>{const t=null!=e?e:new Date;return{firstDayOfMonth:new Date(t.getFullYear(),t.getMonth(),1),lastDayOfTheMonth:new Date(t.getFullYear(),t.getMonth()+1,0),origin:t,previousMonthFirstDay:new Date(t.getFullYear(),t.getMonth()-1,1),previousMonthLastDay:new Date(t.getFullYear(),t.getMonth()-1+1,0),thirtyDaysAgo:new Date((new Date).setDate(t.getDate()-30))}},j={aud:"$",cad:"$",eur:"€",gbp:"£",nzd:"$",usd:"$"},A=(e,t="en-US")=>Intl.NumberFormat(t,{currency:e.currency,style:"currency"}).format(e.amount),_=(...e)=>e.reduce(((e,t)=>{var r;return t?e+(null!==(r=t.amount)&&void 0!==r?r:0):e}),0),L=e=>[e.substring(0,4),e.substring(4,8),e.substring(8,12),e.substring(12)].join(" ").trim(),M=e=>{const t=e.replace(/\//g,"");return t.length>2?[t.substring(0,2),t.substring(2,6)].join("/").trim():t},$=e=>{switch(null==e?void 0:e.toLowerCase()){case"usd":default:return n.Currency.USD;case"cad":return n.Currency.CAD;case"aud":return n.Currency.AUD;case"gbp":return n.Currency.GBP;case"eur":return n.Currency.EUR;case"nzd":return n.Currency.NZD}},P=e=>{let t;switch(e){case n.Currency.USD:case n.Currency.CAD:case n.Currency.AUD:case n.Currency.NZD:t="$";break;case n.Currency.GBP:t="£‎";break;case n.Currency.EUR:t="€"}return t},T=(e,t,r)=>{switch(e){case"usps_media_mail":return!0;case"usps_first_class_mail":return"large_envelope_or_flat"===t;case"dhl_express_worldwide":return r;default:return!1}},x=(e={})=>_(...Object.values(e)),F=(e,t)=>t[e]||e,z=e=>{var t;return"US"===e.countryCode||(null===(t=s.find((t=>t.code===e.countryCode)))||void 0===t?void 0:t.isUnitedStatesTerritory)},B=e=>{var t,r;return!(!(null===(t=o.find((t=>t.code===e.stateProvince)))||void 0===t?void 0:t.isMilitary)&&!(null===(r=i.find((t=>t.code===e.cityLocality)))||void 0===r?void 0:r.isMilitary))},Y=e=>{var t,r;return!(!(null===(t=s.find((t=>t.code===e.countryCode)))||void 0===t?void 0:t.isUnitedStatesTerritory)&&!(null===(r=o.find((t=>t.code===e.stateProvince)))||void 0===r?void 0:r.isUnitedStatesTerritory))},G=e=>{var t;return!!(null===(t=s.find((t=>t.code===e.countryCode)))||void 0===t?void 0:t.isUnsupportedByUps)},N=/^(((p[\s\.\'\,]?[o\s][\.\'\,]?)\s?)|(post\s?office\s?))((box|bin|bo|b\.?)?\s?(num|number|#)?\s?\d+)/i,k=e=>N.test(e),E=e=>!!(k(e.addressLine1)||e.addressLine2&&k(e.addressLine2)),I=e=>!e||Object.entries(e).every((([e,t])=>"countryCode"===e||[null,"","unknown"].includes(t))),Z=(e,t)=>Object.assign(Object.assign(Object.assign({},e),e.matchedAddress&&{matchedAddress:Object.assign(Object.assign({},e.matchedAddress),{email:t})}),{originalAddress:Object.assign(Object.assign({},e.originalAddress),{email:t})}),R=["usps","stamps_com"],H=e=>R.includes(e),q=e=>"ups"===e,J=(e=[],t)=>{const r=e.find((e=>e.carrierCode===t));return null==r?void 0:r.carrierId},K=(e,t)=>{var r;return`https://logos.shipstation.com/ipaas/carriers/${null!==(r={stamps_com:"stamps_com_wl"}[e])&&void 0!==r?r:e}/${t}.svg`},Q=e=>!!e&&["GB","CA"].includes(e),V=e=>"AU"===e,W=(e,t)=>null==e?void 0:e.filter((e=>"globalpost"===e.carrierCode?Q(t):"sendle_walleted"!==e.carrierCode||V(t))),X=e=>e.slice(0,1).toUpperCase()+e.slice(1),ee=e=>e.split(" ").map((e=>X(e.toLowerCase()))).join(" "),te=e=>c.pascalize(e),re=e=>null==e?void 0:e.replace(/\s+/g,"-").toLowerCase(),ae=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/(?<=[a-zA-Z])(\d)/g," $1").trim();export{B as A,Y as B,G as C,k as D,E,I as F,Z as G,H,q as I,J,K,Q as L,V as M,W as N,X as O,ee as P,te as Q,re as R,ae as S,u as T,l as _,g as a,p as b,y as c,f as d,w as e,d as f,D as g,C as h,S as i,O as j,j as k,A as l,h as m,v as n,b as o,m as p,_ as q,L as r,U as s,M as t,$ as u,P as v,T as w,x,F as y,z};
package/hooks.js CHANGED
@@ -1 +1 @@
1
- export{R as RootPortalProvider,b as useAddressValidation,u as useCountryCodeOptions,c as useRootPortal,a as useStateCodeOptions,d as useToggle}from"./use-toggle-866d7938.js";export{P as PudoType,l as useBlackboxDetection,u as useConfirmationOptions,a as useCustomsContentsOptions,b as useCustomsNonDeliveryOptions,c as useDateRangeOptions,d as useInsuranceProviderOptions,m as useNestedForm,e as usePackageOptions,f as useRateOptions,n as useRunOnceOnTrue,o as useScrubErrors,g as useServiceCodeOptions,k as useServicePoints,h as useShipmentMetadata,i as useShippingPresetsOptions,j as useWarehouseOptions}from"./use-scrub-errors-9870a6f3.js";export{P as PageLayoutProvider,u as useExpirationMonthOptions,a as usePageLayout}from"./use-page-layout-8cb5075f.js";import"react";import"./address-8f8119f4.js";import"./carrier-c2a5ed53.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"@shipengine/react-api";import"lodash/isEqual";import"lodash/omit";import"react-dom";import"@emotion/react/jsx-runtime";import"humps";import"react-i18next";import"./shipment-150160e0.js";import"lodash/orderBy";import"@shipengine/giger";import"@emotion/react";import"js-base64";
1
+ export{R as RootPortalProvider,b as useAddressValidation,u as useCountryCodeOptions,c as useRootPortal,a as useStateCodeOptions,d as useToggle}from"./use-toggle.js";export{P as PudoType,l as useBlackboxDetection,u as useConfirmationOptions,a as useCustomsContentsOptions,b as useCustomsNonDeliveryOptions,c as useDateRangeOptions,d as useInsuranceProviderOptions,m as useNestedForm,e as usePackageOptions,f as useRateOptions,n as useRunOnceOnTrue,o as useScrubErrors,g as useServiceCodeOptions,k as useServicePoints,h as useShipmentMetadata,i as useShippingPresetsOptions,j as useWarehouseOptions}from"./use-scrub-errors.js";export{P as PageLayoutProvider,u as useExpirationMonthOptions,a as usePageLayout}from"./use-page-layout.js";import"react";import"./address.js";import"./formatString.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"@shipengine/react-api";import"humps";import"lodash/isEqual";import"lodash/omit";import"react-dom";import"@emotion/react/jsx-runtime";import"react-i18next";import"./pudo.js";import"lodash/orderBy";import"@shipengine/giger";import"@emotion/react";import"js-base64";
package/index.js CHANGED
@@ -1 +1 @@
1
- export{A as AddFundsForm,a as AutoFundingForm,B as ButtonGroup,C as CarrierBalance,c as CarrierConnectionCard,d as CarrierIcon,e as CollapsiblePanel,f as CopyButton,h as Cube,D as DateRangeCombo,i as DateRangeSelect,j as DisplayTerm,E as EditBillingForm,w as ElementsContext,x as ElementsProvider,k as ErrorFallback,F as FieldLabel,l as FormPortal,m as FundAndPurchase,H as HistoryCard,n as HistoryCardExtension,I as InlineLabel,o as ItemsBreakdown,L as LinkAction,p as Loader,P as PoweredByShipEngine,R as RateDetails,S as Section,q as SettingsCard,r as SkeletonCarrierRow,t as Spacer,u as Spread,T as Tabs,V as VatForm,W as WalletCard,v as WarehouseForm,b as autoFundingSchema,g as getAddFundsSchema,s as styles,y as useElements}from"./warehouse-form-da6a7ac5.js";export{C as CarrierLogo}from"./carrier-logo-330e926f.js";export{C as CellFormattedDate,D as Drawer,G as GridController,P as Pager,S as SuspendText,u as usePager}from"./suspend-text-cad3a977.js";export{f as Field,S as StoryNotes}from"./story-notes-c714d2ed.js";export{P as Portal,R as RootPortalProvider,b as useAddressValidation,u as useCountryCodeOptions,c as useRootPortal,a as useStateCodeOptions,d as useToggle}from"./use-toggle-866d7938.js";export{C as Country,U as UsState,d as UsaCity,c as countries,a as countryCodes,e as euCountryCodes,p as postalCodeRegex,f as usCities,b as usStateCodes,u as usStates}from"./address-8f8119f4.js";export{e as LabelLayout,l as LabelsGrid,m as ManageCarriers,b as ManageExternalCarriers,d as ManageFunding,a as ManageWarehouses,p as PaymentMethodSettings,s as ShipmentsGrid,t as ThemeCreator,T as ThemeCreatorProvider,f as TransactionHistory,c as UnitSettings,u as useThemeCreator}from"./transaction-history-element-cbfe487c.js";export{c as CarrierServices,a as ConnectExternalCarrier,p as PurchaseLabel,s as ShipmentSummary,v as VoidLabel}from"./use-unit-settings-a5bae16e.js";export{e as extendZod}from"./zod-60def96c.js";export{P as PudoType,l as useBlackboxDetection,u as useConfirmationOptions,a as useCustomsContentsOptions,b as useCustomsNonDeliveryOptions,c as useDateRangeOptions,d as useInsuranceProviderOptions,m as useNestedForm,e as usePackageOptions,f as useRateOptions,n as useRunOnceOnTrue,o as useScrubErrors,g as useServiceCodeOptions,k as useServicePoints,h as useShipmentMetadata,i as useShippingPresetsOptions,j as useWarehouseOptions}from"./use-scrub-errors-9870a6f3.js";export{P as PageLayoutProvider,u as useExpirationMonthOptions,a as usePageLayout}from"./use-page-layout-8cb5075f.js";export{m as moneySchema}from"./money-d4f3d7c3.js";export{p as phoneSchema,a as phoneSchemaUnvalidated}from"./phone-87dd7bd8.js";export{a as assert,r as raise}from"./assertions-dfa95b4d.js";export{a as convertDimensions,c as createDictionary,f as formatDimensions,e as getCancelledShipment,b as getIsCustomsRequiredForShipment,g as getIsInternationalShipment,d as getPendingShipment,h as getShipmentByStatus,m as moveCustomsItemsToProducts}from"./shipment-150160e0.js";export{I as addEmailToValidation,q as calculateTotal,k as currencySymbol,e as daysAfter,a as findDateLocale,b as formatByDateAndLocale,r as formatCreditCardNumber,f as formatDate,c as formatDateDDMMYY,d as formatDateDDMMYYYY,t as formatExpiration,l as formatMoney,L as getCarrierIdByCarrierCode,u as getCurrencyFromString,v as getCurrencySymbolFromString,h as getExpirationYears,M as getLogoOrIconByCarrierCode,w as getRateRequiresAcknowledgement,j as getRelativeDates,x as getTotalRateAmount,g as getlocaleDateStringFormat,A as isCollectionService,B as isDomesticAddress,H as isEmptyAddress,C as isMilitaryAddress,i as isNowOrInTheFuture,F as isPoBox,G as isPoBoxAddress,z as isPudoEligibleRate,D as isUnitedStatesTerritory,E as isUnsupportedByUps,K as isUpsCarrier,J as isUspsCarrier,m as mostRecent,n as nextDayCutoff,o as omitTime,y as overrideCarrierCodes,p as parseLocaleDate,s as sortByCreationDate}from"./carrier-c2a5ed53.js";export{k as convertDecimalWeightToFractionalWeight,j as convertFractionalWeightToDecimalWeight,h as convertPoundsAndOuncesToOunces,l as convertWeight,c as createCodedErrors,m as formatFractionalWeight,g as getCustomsFromSalesOrder,o as getDefaultWarehouse,b as getIsCustomsRequiredForSalesOrder,d as getRequestedServices,e as getSalesOrderItemsFromSalesOrderOrShipment,f as isDecimalWeight,n as isFlatRatePackageCode,i as isMetricWeightUnit,a as throwAny,t as throwJoinedMessages}from"./warehouses-a83188ab.js";export{c as createStyles,d as deepMergeFeatures,e as errorMap,f as featureFlagComponentNameLookup,a as formLogger,g as getDefaultFeatures,i as isObject,b as isString,t as trackingStatusFormatter,v as validationResolver}from"./validation-528e7834.js";export{a as addSpaceBetweenWords,c as capitalizeFirstLetter,p as pascalize}from"./formatString-413ec7c7.js";export{a as AccountSettings,l as LabelWorkflow,o as Onboarding}from"./wallet-form-9e4bfaea.js";import"@emotion/react/jsx-runtime";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"@emotion/react";import"@shipengine/giger-theme";import"@shipengine/react-api";import"lodash/isEqual";import"zod";import"copy-to-clipboard";import"js-base64";import"card-validator";import"libphonenumber-js/min";import"axios";import"lodash/omit";import"react-dom";import"@tanstack/react-query";import"lodash/merge";import"lodash/mergeWith";import"humps";import"@shipengine/js-api";import"@rjsf/core";import"@rjsf/validator-ajv8";import"lodash/camelCase";import"use-debounce";import"classnames";import"i18next";import"i18next-browser-languagedetector";import"@emotion/cache";import"stylis";import"lodash/orderBy";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"lodash/get";import"@hookform/resolvers/zod";
1
+ import{E as X,a as Y}from"./actions-menu.js";export{z as Actions,y as ActionsMenu,A as AddFundsForm,b as AutoFundingForm,B as ButtonGroup,C as CarrierBalance,d as CarrierConnectionCard,e as CarrierIcon,f as CollapsiblePanel,h as CopyButton,i as Cube,D as DateRangeCombo,j as DateRangeSelect,k as DisplayTerm,l as EditBillingForm,a as ElementsContext,E as ElementsContextProvider,m as ErrorFallback,F as FieldLabel,n as FormPortal,o as FundAndPurchase,H as HistoryCard,p as HistoryCardExtension,I as InlineLabel,q as ItemsBreakdown,L as LinkAction,r as Loader,P as PoweredByShipEngine,R as RateDetails,S as Section,t as SettingsCard,u as SkeletonCarrierRow,v as Spacer,w as Spread,T as Tabs,V as VatForm,W as WalletCard,x as WarehouseForm,c as autoFundingSchema,g as getAddFundsSchema,s as styles,G as useElements}from"./actions-menu.js";export{C as CarrierLogo}from"./carrier-logo.js";export{C as CellFormattedDate,D as Drawer,G as GridController,P as Pager,S as SuspendText,u as usePager}from"./suspend-text.js";export{f as Field,S as StoryNotes}from"./story-notes.js";import{R as _}from"./use-toggle.js";export{P as Portal,R as RootPortalProvider,b as useAddressValidation,u as useCountryCodeOptions,c as useRootPortal,a as useStateCodeOptions,d as useToggle}from"./use-toggle.js";export{C as Country,U as UsState,d as UsaCity,c as countries,a as countryCodes,e as euCountryCodes,p as postalCodeRegex,f as usCities,b as usStateCodes,u as usStates}from"./address.js";export{a as CarrierServices,b as ConnectExternalCarrier,p as PurchaseLabel,s as ShipmentSummary,v as VoidLabel,c as createElement}from"./use-unit-settings.js";export{e as LabelLayout,l as LabelsGrid,m as ManageCarriers,b as ManageExternalCarriers,d as ManageFunding,a as ManageWarehouses,p as PaymentMethodSettings,s as ShipmentsGrid,t as ThemeCreator,T as ThemeCreatorProvider,f as TransactionHistory,c as UnitSettings,u as useThemeCreator}from"./transaction-history-element.js";export{e as extendZod}from"./zod.js";export{P as PudoType,l as useBlackboxDetection,u as useConfirmationOptions,a as useCustomsContentsOptions,b as useCustomsNonDeliveryOptions,c as useDateRangeOptions,d as useInsuranceProviderOptions,m as useNestedForm,e as usePackageOptions,f as useRateOptions,n as useRunOnceOnTrue,o as useScrubErrors,g as useServiceCodeOptions,k as useServicePoints,h as useShipmentMetadata,i as useShippingPresetsOptions,j as useWarehouseOptions}from"./use-scrub-errors.js";export{P as PageLayoutProvider,u as useExpirationMonthOptions,a as usePageLayout}from"./use-page-layout.js";export{m as moneySchema}from"./money.js";export{p as phoneSchema,a as phoneSchemaUnvalidated}from"./phone.js";export{a as assert,r as raise}from"./assertions.js";export{a as convertDimensions,c as createDictionary,f as formatDimensions,e as getCancelledShipment,b as getIsCustomsRequiredForShipment,g as getIsInternationalShipment,d as getPendingShipment,h as getShipmentByStatus,j as isCollectionService,i as isPudoEligibleRate,m as moveCustomsItemsToProducts}from"./pudo.js";import{_ as Z}from"./formatString.js";export{G as addEmailToValidation,S as addSpaceBetweenWords,q as calculateTotal,O as capitalizeFirstLetter,P as capitalizeFirstLetterOfEachWord,k as currencySymbol,e as daysAfter,N as filterFundingSourceCarriers,a as findDateLocale,b as formatByDateAndLocale,r as formatCreditCardNumber,f as formatDate,c as formatDateDDMMYY,d as formatDateDDMMYYYY,t as formatExpiration,l as formatMoney,J as getCarrierIdByCarrierCode,u as getCurrencyFromString,v as getCurrencySymbolFromString,h as getExpirationYears,K as getLogoOrIconByCarrierCode,w as getRateRequiresAcknowledgement,j as getRelativeDates,x as getTotalRateAmount,g as getlocaleDateStringFormat,z as isDomesticAddress,F as isEmptyAddress,L as isGlobalPostEligible,A as isMilitaryAddress,i as isNowOrInTheFuture,D as isPoBox,E as isPoBoxAddress,M as isSendleEligible,B as isUnitedStatesTerritory,C as isUnsupportedByUps,I as isUpsCarrier,H as isUspsCarrier,m as mostRecent,n as nextDayCutoff,o as omitTime,y as overrideCarrierCodes,p as parseLocaleDate,Q as pascalize,R as replaceSpacesWithDashes,s as sortByCreationDate}from"./formatString.js";export{k as convertDecimalWeightToFractionalWeight,j as convertFractionalWeightToDecimalWeight,h as convertPoundsAndOuncesToOunces,l as convertWeight,c as createCodedErrors,m as formatFractionalWeight,g as getCustomsFromSalesOrder,o as getDefaultWarehouse,b as getIsCustomsRequiredForSalesOrder,d as getRequestedServices,e as getSalesOrderItemsFromSalesOrderOrShipment,f as isDecimalWeight,n as isFlatRatePackageCode,i as isMetricWeightUnit,a as throwAny,t as throwJoinedMessages}from"./warehouses.js";import{g as $,d as ee}from"./validation.js";export{c as createStyles,d as deepMergeFeatures,e as errorMap,f as featureFlagComponentNameLookup,a as formLogger,g as getDefaultFeatures,i as isObject,b as isString,t as trackingStatusFormatter,v as validationResolver}from"./validation.js";export{a as AccountSettings,l as LabelWorkflow,o as Onboarding}from"./wallet-form.js";import{jsx as ae}from"@emotion/react/jsx-runtime";import{GigerProvider as te,GigerTestProvider as re}from"@shipengine/giger";import{Theme as oe}from"@shipengine/giger-theme";import{ShipEngine as se}from"@shipengine/react-api";import ie from"axios";import{useCallback as ne,useMemo as le}from"react";import"date-fns/isToday";import"react-hook-form";import"react-i18next";import"@emotion/react";import"lodash/isEqual";import"zod";import"copy-to-clipboard";import"js-base64";import"libphonenumber-js/min";import"lodash/omit";import"card-validator";import"react-dom";import"@tanstack/react-query";import"lodash/merge";import"lodash/mergeWith";import"humps";import"@shipengine/js-api";import"@rjsf/core";import"@rjsf/validator-ajv8";import"lodash/camelCase";import"use-debounce";import"classnames";import"i18next";import"i18next-browser-languagedetector";import"@emotion/cache";import"stylis";import"lodash/orderBy";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"lodash/get";import"@hookform/resolvers/zod";var pe={fallback:{borderRadius:{L:"16px",M:"8px",S:"4px",XL:"32px",XS:"2px"},breakPoints:{desktop:1280,mobileLarge:480,tablet:768,tabletLarge:960},card:{borderRadius:{desktop:"8px",mobile:"4px",tablet:"8px"}},components:{Button:{borderRadius:"4px"},Checkbox:{borderRadius:"2px",square:!1},Chip:{backgroundColor:"#f4f4f4",border:"none",borderRadius:"16px",color:"#706f6f",fontWeight:600,isSelected:{backgroundColor:"#EDEDED",border:"none",color:"#7A7A7A"},padding:"4px 16px"},Dialog:{action:{justifyContent:"center"},content:{padding:24,textAlign:"center"},dialog:{backgroundColor:"rgba(0, 0, 0, 0.26)",borderRadius:"4px"},header:{borderBottom:"2px solid #d3d3d3",padding:24,titleColor:"#616161"}},Field:{color:"#373737",fontWeight:700,placeholder:{fontWeight:700}},FieldContainer:{borderRadius:"4px"},Link:{activeColor:"#787878",defaultColor:"#616161",hoverColor:"#303030",isDark:{activeColor:"#787878",defaultColor:"#fff",hoverColor:"#fff",visitedColor:"#fff"},visitedColor:"#303030"},Table:{border:"none",borderRadius:"4px",boxShadow:"0 0 12px rgba(0, 0, 0, 0.1)"},Typography:{body1:{fontSize:"16px",fontWeight:400,letterSpacing:0,lineHeight:"24px"},body2:{fontSize:"14px",fontWeight:400,letterSpacing:3,lineHeight:"20px"},heading1:{fontSize:"48px",fontWeight:700,letterSpacing:0,lineHeight:"72px"},heading2:{fontSize:"32px",fontWeight:700,letterSpacing:1,lineHeight:"48px"},heading3:{fontSize:"24px",fontWeight:700,letterSpacing:3,lineHeight:"48px"},heading4:{fontSize:"20px",fontWeight:700,letterSpacing:3,lineHeight:"32px"},heading5:{fontSize:"18px",fontWeight:700,letterSpacing:3,lineHeight:"28px"},heading6:{fontSize:"16px",fontWeight:700,letterSpacing:3,lineHeight:"24px"},small:{fontSize:"12px",fontWeight:400,letterSpacing:5,lineHeight:"20px"},subtitle1:{fontSize:"16px",fontWeight:600,letterSpacing:3,lineHeight:"24px"},subtitle2:{fontSize:"14px",fontWeight:600,letterSpacing:5,lineHeight:"20px"}}},defaultFontFamily:"Arial",elevations:{above:{boxShadow:"0 0 12px rgba(0, 0, 0, 0.1)",zIndex:1e3},backdrop:{boxShadow:"none",zIndex:1007},flat1:{boxShadow:"0 2px 2px rgba(0, 0, 0, 0.1)",zIndex:1},flat2:{boxShadow:"0 2px 2px rgba(0, 0, 0, 0.1)",zIndex:1e3},overlay1:{boxShadow:"0 0 24px rgba(0, 0, 0, 0.1)",zIndex:1006},overlay2:{boxShadow:"0 0 24px rgba(0, 0, 0, 0.1)",zIndex:1008},popout1:{boxShadow:"0 4px 16px rgba(0, 0, 0, 0.1)",zIndex:1004},popout2:{boxShadow:"0 4px 16px rgba(0, 0, 0, 0.1)",zIndex:1005},raised:{boxShadow:"0 8px 8px rgba(0, 0, 0, 0.1)",zIndex:1002},raisedInverted1:{boxShadow:"0 -8px 8px rgba(0, 0, 0, 0.1)",zIndex:1002},raisedInverted2:{boxShadow:"0 -8px 8px rgba(0, 0, 0, 0.1)",zIndex:1003},sticky:{boxShadow:"none",zIndex:1001}},fontFaces:[],grid:{desktop:{columns:12,gutter:24,horizontalSpace:16,verticalSpace:24},desktopLarge:{columns:12,gutter:24,horizontalSpace:16,verticalSpace:24},mobile:{columns:4,gutter:16,horizontalSpace:16,verticalSpace:16},mobileLarge:{columns:4,gutter:16,horizontalSpace:16,verticalSpace:16},tablet:{columns:12,gutter:24,horizontalSpace:16,verticalSpace:24},tabletLarge:{columns:12,gutter:24,horizontalSpace:16,verticalSpace:24}},iconSize:{extra_large:"48px",large:"32px",medium:"20px",regular:"24px",small:"16px"},palette:{alert:{light:"#ffe7ca",main:"#725200"},black:"#000",dataVisualization:{highContrast:{blue:"#3970C1",blueDark:"#002039",coral:"#F95D6A",cyan:"#45CEE0",green:"#B3D849",orange:"#FFA600",orangeDark:"#FF7C43",pink:"#D12771",purple:"#A05195",purpleDark:"#665191"},lowContrast:{blue:"#96B3DE",blueDark:"#5283AB",coral:"#FCA6AD",cyan:"#BAE6FF",green:"#DEF895",orange:"#FDDFA5",orangeDark:"#FCC2A9",pink:"#E995BA",purple:"#D4BBFF",purpleDark:"#B1A2D0"}},error:{light:"#fee5e4",main:"#a72514"},gray:{dark:"#373737",light:"#d3d3d3",main:"#706f6f",megaLight:"#f4f4f4",ultraLight:"#f4f4f4"},info:{light:"#dbedfd",main:"#195f7f"},primary:{dark:"#626262",light:"#D6D6D6",main:"#7A7A7A",ultraLight:"#EDEDED"},secondary:{dark:"#303030",light:"#787878",main:"#616161",ultraLight:"#F4F4F4"},success:{light:"#dcfddb",main:"#286327"},white:"#fff"},spacingBase:8,typography:{fontSize:{L:"18px",M:"16px",S:"14px",XL:"20px",XS:"12px",XXL:"24px",XXS:"10px",XXXL:"32px",XXXXL:"48px"},fontWeight:{bold:700,light:200,normal:400,semibold:600},letterSpacing:{L:3,M:1,S:0,XL:5,XXL:8,XXXL:12},lineHeight:{L:"28px",M:"24px",S:"20px",XL:"32px",XXL:"48px",XXXL:"72px"}}}};const de=({baseURL:e="https://elements.shipengine.com",cdnURL:a="https://cdn.packlink.com",children:t,container:r,features:o,getToken:s,headers:i,locale:n,onApiError:l,onError:p=(()=>{}),scope:d="lmnt",themeConfig:c,defaultQueryClientOptions:g})=>{const m=(({cdnURL:e})=>ne((a=>Z(void 0,void 0,void 0,(function*(){return(yield ie.get(`/brand/fallback/icons/${a.toLowerCase()}.svg`,{baseURL:e,responseType:"json"})).data}))),[e]))({cdnURL:a}),u=new oe(null!=c?c:pe.fallback),h={baseURL:e,cdnURL:a,container:r,features:o,getToken:s,locale:n,onError:p,scope:d,theme:u};return ae(X,Object.assign({},h,{children:ae(te,Object.assign({cdnUrl:a,reference:d||void 0,resolveIcon:m,theme:u},{children:ae(se,Object.assign({baseURL:e,defaultQueryClientOptions:g,getToken:s,headers:i,onApiError:l},{children:ae(_,{children:t})}))}))}))},ce=({baseURL:e,children:a,features:t})=>{const r=le((()=>new oe),[]),o=$(["globalFeatures"]),s=ne((()=>"none"),[]),i={baseURL:e,cdnURL:"mockCdnUrl",getFeatures:e=>{var a;return ee(null!==(a=$([e]))&&void 0!==a?a:{},null==t?void 0:t[e])},getToken:s,globalFeatures:Object.assign(Object.assign({enabledExternalCarriers:["apc","asendia","better_trucks","canpar","chronopost","couriers_please","courierpost","dpd","hermes_germany","intelliquick_delivery","lso","ontrac","seko","ups","yodel"]},o),t.globalFeatures),onError:()=>{},scope:"lmnt",theme:r};return ae(Y.Provider,Object.assign({value:i},{children:ae(re,Object.assign({theme:r},{children:ae(se,Object.assign({baseURL:e,getToken:s},{children:a}))}))}))};export{de as ElementsProvider,ce as ElementsTestProvider};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "peerDependencies": {
5
5
  "@emotion/react": "11.x",
6
6
  "react-i18next": "11.x",
@@ -11,65 +11,35 @@
11
11
  "msw": {
12
12
  "workerDirectory": "public"
13
13
  },
14
- "main": "./index.cjs",
15
14
  "exports": {
16
- ".": {
17
- "import": "./index.js",
18
- "require": "./index.js"
19
- },
20
- "./components": {
21
- "import": "./components.js",
22
- "require": "./components.js"
23
- },
24
- "./constants": {
25
- "import": "./constants.js",
26
- "require": "./constants.js"
27
- },
28
- "./elements": {
29
- "import": "./elements.js",
30
- "require": "./elements.js"
31
- },
32
- "./extensions": {
33
- "import": "./extensions.js",
34
- "require": "./extensions.js"
35
- },
36
- "./hooks": {
37
- "import": "./hooks.js",
38
- "require": "./hooks.js"
39
- },
40
- "./schemas": {
41
- "import": "./schemas.js",
42
- "require": "./schemas.js"
43
- },
44
- "./types": {
45
- "import": "./types.js",
46
- "require": "./types.js"
47
- },
48
- "./utilities": {
49
- "import": "./utilities.js",
50
- "require": "./utilities.js"
51
- },
52
- "./workflows": {
53
- "import": "./workflows.js",
54
- "require": "./workflows.js"
55
- }
15
+ ".": "./index.js",
16
+ "./components": "./components.js",
17
+ "./constants": "./constants.js",
18
+ "./elements": "./elements.js",
19
+ "./extensions": "./extensions.js",
20
+ "./hooks": "./hooks.js",
21
+ "./schemas": "./schemas.js",
22
+ "./types": "./types.js",
23
+ "./utilities": "./utilities.js",
24
+ "./workflows": "./workflows.js"
56
25
  },
57
26
  "module": "./index.js",
27
+ "main": "./index.js",
58
28
  "type": "module",
59
29
  "types": "./src/index.d.ts",
60
30
  "dependencies": {
61
31
  "@emotion/cache": "11.10.5",
62
32
  "@emotion/serialize": "1.1.1",
63
33
  "@faker-js/faker": "7.6.0",
64
- "@hookform/resolvers": "2.9.1",
34
+ "@hookform/resolvers": "2.9.11",
65
35
  "@jest/globals": "28.1.3",
66
36
  "@rjsf/core": "5.16.1",
67
37
  "@rjsf/utils": "5.16.1",
68
38
  "@rjsf/validator-ajv8": "5.16.1",
69
39
  "@shipengine/giger": "1.11.2",
70
40
  "@shipengine/giger-theme": "1.5.1",
71
- "@shipengine/js-api": "1.21.0",
72
- "@shipengine/react-api": "2.11.8",
41
+ "@shipengine/js-api": "1.27.0",
42
+ "@shipengine/react-api": "2.13.5",
73
43
  "@storybook/addons": "6.5.16",
74
44
  "@storybook/components": "7.0.0-rc.1",
75
45
  "@storybook/core-events": "7.0.0-rc.1",
package/pudo.js ADDED
@@ -0,0 +1 @@
1
+ import{A as e,B as s,s as t,T as o}from"./formatString.js";const i=(e,s)=>{var t;return null!==(t=null==e?void 0:e.reduce(((e,t)=>Object.assign(Object.assign({},e),s(t,e))),{}))&&void 0!==t?t:{}},r=e=>`${e.length} x ${e.width} x ${e.height} `;function c(e,{allowAllZeroes:s}={}){const{length:t,width:o,height:i,unit:r}=e;if(![t,o,i].every((e=>0===e))||s)return Object.assign(Object.assign({},e),{unit:null!=r?r:"inch"})}const n=({shipFrom:e,shipTo:s})=>(null==e?void 0:e.countryCode)!==(null==s?void 0:s.countryCode),a=({shipFrom:t,shipTo:o})=>t&&e(t)||o&&(e(o)||s(o))||(null==t?void 0:t.countryCode)!==(null==o?void 0:o.countryCode),l=e=>null==e?void 0:e.filter((e=>"pending"===e.shipmentStatus)).sort(t)[0],u=e=>null==e?void 0:e.filter((e=>"cancelled"===e.shipmentStatus)).sort(t)[0],d=(e,s)=>null==s?void 0:s.filter((({shipmentStatus:s})=>s===e)).sort(t)[0],v=e=>{var s,t;if(!(null===(t=null===(s=e.customs)||void 0===s?void 0:s.customsItems)||void 0===t?void 0:t.length))return e;const i=e.customs.customsItems.map((e=>Object.assign(Object.assign({},e),{value:e.value instanceof Object?e.value:{amount:e.value,currency:e.valueCurrency||"USD"}}))),r=e.customs,c=o(r,["customsItems"]);return Object.assign(Object.assign({},e),{customs:c,packages:e.packages.map(((e,s)=>0===s?Object.assign(Object.assign({},e),{products:i}):e))})},m=[{carrier:"yodel_walleted"},{carrier:"hermes",serviceCodes:[{serviceCode:"domestic_courier_collections",type:"pick_up"},{serviceCode:"postable_courier_collections",type:"pick_up"}]},{carrier:"dpdwallet"}],p=e=>m.some((s=>e.carrierCode===s.carrier)),g=(e,s)=>m.some((t=>{var o;return t.carrier===e&&(e=>e.toLowerCase().includes("collection"))(s)||(null===(o=t.serviceCodes)||void 0===o?void 0:o.some((e=>e.serviceCode===s&&"pick_up"===e.type)))}));export{c as a,a as b,i as c,l as d,u as e,r as f,n as g,d as h,p as i,g as j,v as m};
package/schemas.js CHANGED
@@ -1 +1 @@
1
- export{m as moneySchema}from"./money-d4f3d7c3.js";export{p as phoneSchema,a as phoneSchemaUnvalidated}from"./phone-87dd7bd8.js";import"zod";import"@shipengine/react-api";import"libphonenumber-js/min";
1
+ export{m as moneySchema}from"./money.js";export{p as phoneSchema,a as phoneSchemaUnvalidated}from"./phone.js";import"zod";import"@shipengine/react-api";import"libphonenumber-js/min";
@@ -0,0 +1,19 @@
1
+ export declare enum Actions {
2
+ PRINT_LABEL = 0,
3
+ VOID_LABEL = 1,
4
+ PRINT_FORMS = 2,
5
+ EDIT = 3,
6
+ REMOVE = 4
7
+ }
8
+ type ActionsMenuProps = {
9
+ /** An array of allowed Actions to be rendered */
10
+ allowedActions?: Actions[];
11
+ /** Flag to set the button as disabled */
12
+ disabled?: boolean;
13
+ /** Flag to set the button loading */
14
+ isLoading?: boolean;
15
+ /** Callback when the user clicks one of the actions */
16
+ onActionClick: (action: Actions) => void;
17
+ };
18
+ export declare const ActionsMenu: ({ disabled, allowedActions, isLoading, onActionClick, }: ActionsMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1 @@
1
+ export { ActionsMenu, Actions } from "./actions-menu";
@@ -1,4 +1,14 @@
1
1
  export declare const styles: {
2
+ button: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
3
+ alignItems: "center";
4
+ backgroundColor: "transparent";
5
+ color: string;
6
+ display: "flex";
7
+ fontWeight: number;
8
+ justifyContent: "space-between";
9
+ padding: number;
10
+ width: string;
11
+ };
2
12
  getContentStyles: (nested?: boolean) => (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
3
13
  padding: number;
4
14
  };
@@ -10,17 +20,4 @@ export declare const styles: {
10
20
  icon: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
11
21
  color: string;
12
22
  };
13
- link: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
14
- ":hover": {
15
- color: string;
16
- textDecoration: string;
17
- };
18
- alignItems: "center";
19
- color: string;
20
- display: "flex";
21
- fontWeight: number;
22
- justifyContent: "space-between";
23
- textDecoration: string;
24
- width: string;
25
- };
26
23
  };
@@ -2,5 +2,6 @@ import { ReactNode } from "react";
2
2
  import { ICheckboxProps as NativeCheckboxProps } from "@shipengine/giger";
3
3
  import { ControlledField } from "../create-field-controller";
4
4
  export declare const CheckboxInput: ControlledField<NativeCheckboxProps & {
5
+ ariaLabel: string;
5
6
  checkboxLabel: ReactNode;
6
7
  }>;
@@ -18,6 +18,5 @@ export declare const getFooterListStyles: () => SerializedStyles;
18
18
  export declare const getFooterListWithMultipleMessagesStyles: (theme: Theme) => SerializedStyles;
19
19
  export declare const getFooterListItemStyles: (theme: Theme) => SerializedStyles;
20
20
  export declare const getAcknowledgmentStyles: (theme: Theme) => SerializedStyles;
21
- export declare const getCheckboxWrapperStyles: () => SerializedStyles;
22
21
  export declare const getTypographyVoidedStyles: () => SerializedStyles;
23
22
  export declare const getServicePointSkeletonStyles: (theme: Theme) => SerializedStyles;
@@ -1 +1,2 @@
1
1
  export * from "./select";
2
+ export * from "./select-with-categories";
@@ -0,0 +1,20 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ import { ControlledField } from "../create-field-controller";
3
+ type NativeSelectProps = ComponentPropsWithoutRef<"select">;
4
+ export type CategoryOption = {
5
+ label: string;
6
+ rightContent?: JSX.Element;
7
+ subLabel?: string;
8
+ value: string | Record<string, unknown>;
9
+ };
10
+ export type SelectCategory = {
11
+ label: string;
12
+ options: CategoryOption[];
13
+ value?: string;
14
+ };
15
+ type SelectProps = {
16
+ onCategoryChange?: (value?: string) => void;
17
+ options?: SelectCategory[];
18
+ };
19
+ export declare const SelectWithCategories: ControlledField<NativeSelectProps, SelectProps>;
20
+ export {};
@@ -3,18 +3,13 @@ import { ControlledField } from "../create-field-controller";
3
3
  type NativeSelectProps = ComponentPropsWithoutRef<"select">;
4
4
  export type SelectOption = {
5
5
  label: string;
6
- value: string | object;
6
+ rightContent?: JSX.Element;
7
+ subLabel?: string;
8
+ value: string;
7
9
  };
8
- export type SelectCategory = {
9
- label: string;
10
- options: SelectOption[];
11
- value?: string;
12
- };
13
- export type SelectOptionOrCategory = SelectOption | SelectCategory;
14
10
  type SelectProps = {
15
- onCategoryChange?: (value?: string) => void;
16
- onChange?: (value?: string | object) => void;
17
- options?: SelectOptionOrCategory[];
11
+ onChange?: (value?: string) => void;
12
+ options?: SelectOption[];
18
13
  };
19
14
  export declare const Select: ControlledField<NativeSelectProps, SelectProps>;
20
15
  export {};
@@ -39,3 +39,4 @@ export * from "./tabs";
39
39
  export * from "./vat-form";
40
40
  export * from "./wallet-card";
41
41
  export * from "./warehouse-form";
42
+ export * from "./actions-menu";
@@ -1,8 +1,11 @@
1
+ import { CodedError } from "@shipengine/js-api";
1
2
  import { ConnectedCarrier } from "./connected-carrier-row";
2
3
  export type ConnectedCarrierListProps = {
3
4
  carriers?: ConnectedCarrier[];
5
+ deleteCarrierErrors: CodedError[] | null;
4
6
  isAddingCarrier?: boolean;
5
7
  isLoading?: boolean;
6
8
  onAddCarrier?: () => void;
9
+ onDeleteCarrier: (carrierId: string) => Promise<void>;
7
10
  };
8
- export declare const ConnectedCarrierList: ({ carriers, isAddingCarrier, isLoading, onAddCarrier, }: ConnectedCarrierListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
+ export declare const ConnectedCarrierList: ({ carriers, isAddingCarrier, isLoading, onAddCarrier, onDeleteCarrier, deleteCarrierErrors, }: ConnectedCarrierListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -17,16 +17,6 @@ export declare const styles: {
17
17
  connectButton: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
18
18
  paddingBottom: number;
19
19
  };
20
- noCarriersContainer: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
21
- alignItems: "center";
22
- borderColor: string;
23
- borderRadius: number;
24
- borderStyle: "dashed";
25
- borderWidth: string;
26
- display: "flex";
27
- flexDirection: "column";
28
- padding: string;
29
- };
30
20
  noCarriersDescription: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
31
21
  color: string;
32
22
  marginBottom: number;
@@ -5,4 +5,7 @@ export type ConnectedCarrier = {
5
5
  iconUrl: string;
6
6
  nickname: string;
7
7
  };
8
- export declare const ConnectedCarrierRow: ({ carrierCode, carrierId, friendlyName, iconUrl, nickname, }: ConnectedCarrier) => import("@emotion/react/jsx-runtime").JSX.Element;
8
+ export type ConnectedCarrierRowProps = ConnectedCarrier & {
9
+ onDeleteCarrier: (carrierId: string) => Promise<void>;
10
+ };
11
+ export declare const ConnectedCarrierRow: ({ carrierId, friendlyName, iconUrl, nickname, onDeleteCarrier, }: ConnectedCarrierRowProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -12,19 +12,21 @@ export declare const styles: {
12
12
  disconnectCarrierOption: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
13
13
  color: string;
14
14
  };
15
- dropdownOptionList: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
16
- minWidth: number;
17
- };
18
- iconButton: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
19
- "&:hover": {
20
- backgroundColor: "transparent !important";
21
- color: `${string} !important`;
22
- };
23
- backgroundColor: "transparent";
24
- border: number;
15
+ disconnectTitle: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
16
+ alignItems: "center";
25
17
  color: string;
26
- cursor: "pointer";
27
- padding: number;
18
+ display: "flex";
19
+ gap: number;
20
+ };
21
+ dropdownContainer: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
22
+ display: "flex";
23
+ flexDirection: "column";
24
+ gap: number;
25
+ padding: string;
26
+ };
27
+ iconButton: {
28
+ padding: string;
29
+ verticalAlign: string;
28
30
  };
29
31
  logoContainer: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
30
32
  alignItems: "center";
@@ -37,6 +39,11 @@ export declare const styles: {
37
39
  display: "flex";
38
40
  flexDirection: "column";
39
41
  };
42
+ rightContentContainer: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
43
+ alignItems: "center";
44
+ display: "flex";
45
+ gap: number;
46
+ };
40
47
  rowContainer: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
41
48
  alignItems: "center";
42
49
  display: "flex";
@@ -1,10 +1,10 @@
1
1
  export declare const styles: {
2
- actions: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
2
+ actions: () => {
3
3
  background: string;
4
4
  display: "flex";
5
5
  flexDirection: "column";
6
6
  };
7
- actionsButton: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
7
+ actionsButton: () => {
8
8
  padding: string;
9
9
  verticalAlign: string;
10
10
  };
@@ -21,7 +21,10 @@ export declare const styles: {
21
21
  fontWeight: number;
22
22
  paddingLeft: string;
23
23
  };
24
- header: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
24
+ form: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
25
+ marginBottom: number;
26
+ };
27
+ header: () => {
25
28
  "& > tr > th": {
26
29
  "&:after": {
27
30
  borderBottom: string;
@@ -82,12 +85,17 @@ export declare const styles: {
82
85
  textAlign: "right";
83
86
  width: number;
84
87
  };
88
+ section: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
89
+ marginBottom: number;
90
+ width: string;
91
+ };
85
92
  subtitle: () => {
86
93
  letterSpacing: string;
87
94
  };
88
- table: () => {
95
+ table: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
89
96
  border: string;
90
97
  borderRadius: string;
91
98
  boxShadow: "none";
99
+ marginBottom: number;
92
100
  };
93
101
  };
@@ -0,0 +1,2 @@
1
+ export { TaxIds } from "./tax-ids";
2
+ export type { TaxIdFormSchema } from "./tax-ids";
@@ -0,0 +1,3 @@
1
+ export { getTaxIdSchema } from "./schema";
2
+ export { entityTypeOptions, taxIdTypesOptions } from "./values";
3
+ export type { TaxIdFormSchema } from "./schema";
@@ -0,0 +1,38 @@
1
+ import { z } from "zod";
2
+ import { SE } from "@shipengine/react-api";
3
+ export type TaxIdFormSchema = {
4
+ entityType: SE.TaxableEntityType;
5
+ issuingAuthority: string;
6
+ tax: {
7
+ type: SE.TaxableIdentifierType;
8
+ value: string;
9
+ };
10
+ };
11
+ export declare const getTaxIdSchema: () => z.ZodObject<{
12
+ entityType: z.ZodString;
13
+ issuingAuthority: z.ZodString;
14
+ tax: z.ZodObject<{
15
+ type: z.ZodString;
16
+ value: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ value: string;
19
+ type: string;
20
+ }, {
21
+ value: string;
22
+ type: string;
23
+ }>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ entityType: string;
26
+ issuingAuthority: string;
27
+ tax: {
28
+ value: string;
29
+ type: string;
30
+ };
31
+ }, {
32
+ entityType: string;
33
+ issuingAuthority: string;
34
+ tax: {
35
+ value: string;
36
+ type: string;
37
+ };
38
+ }>;
@@ -0,0 +1,12 @@
1
+ import { SE } from "@shipengine/react-api";
2
+ type TaxIdTypeOption = {
3
+ label: string;
4
+ value: SE.TaxableIdentifierType;
5
+ };
6
+ type EntityTypeOption = {
7
+ label: string;
8
+ value: SE.TaxableEntityType;
9
+ };
10
+ export declare const taxIdTypesOptions: TaxIdTypeOption[];
11
+ export declare const entityTypeOptions: EntityTypeOption[];
12
+ export {};
@@ -0,0 +1,2 @@
1
+ export { TaxIds } from "./tax-ids";
2
+ export type { TaxIdFormSchema } from "./form";
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { SE } from "@shipengine/react-api";
3
+ import { TaxIdFormSchema } from "./form";
4
+ export declare const FormID = "tax-id-form";
5
+ type TaxIdFormProps = {
6
+ onCancel?: () => void;
7
+ onSubmit: (values: TaxIdFormSchema) => void;
8
+ taxIdToEdit?: SE.TaxIdentifier;
9
+ } & ({
10
+ formId: string;
11
+ portalRef: React.RefObject<HTMLElement>;
12
+ } | {
13
+ formId?: string;
14
+ portalRef?: never;
15
+ });
16
+ export declare const TaxIdForm: ({ portalRef, taxIdToEdit, onSubmit, onCancel }: TaxIdFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,12 @@
1
+ import { SE } from "@shipengine/react-api";
2
+ import { Actions } from "../../../../../../../components";
3
+ type TaxIdListProps = {
4
+ /** Callback when the user selects one option from the Actions Menu */
5
+ handleActionsClick: (selectedIndex: number) => (action: Actions) => Promise<void>;
6
+ /** Flag to set the ActionsMenu as loading of the desired index */
7
+ itemIndexLoading?: number;
8
+ /** List of SE.TaxIdentifier to render */
9
+ taxIdItems: SE.TaxIdentifier[];
10
+ };
11
+ export declare const TaxIdList: ({ taxIdItems, itemIndexLoading, handleActionsClick }: TaxIdListProps) => import("@emotion/react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,8 @@
1
+ import { SE } from "@shipengine/react-api";
2
+ type TaxIdsProps = {
3
+ onDirty: () => void;
4
+ onUpdateTaxableIds?: (taxIds: SE.TaxIdentifier[], onError: (errors: SE.CodedError[]) => void) => Promise<SE.SalesOrderShipment>;
5
+ shipment: SE.SalesOrderShipment;
6
+ };
7
+ export declare const TaxIds: ({ shipment, onUpdateTaxableIds, onDirty }: TaxIdsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
8
+ export {};