@shipengine/elements 2.2.0 → 2.3.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.
- package/README.md +5 -1
- package/actions-menu.js +3 -3
- package/components.js +1 -1
- package/elements.js +1 -1
- package/index.js +1 -1
- package/package.json +5 -7
- package/src/components/add-funds-form/add-funds-form.styles.d.ts +2 -1
- package/src/components/address-preference-context/address-preference-context.d.ts +1 -0
- package/src/components/field/rate-card/rate-card.d.ts +1 -1
- package/src/components/modal/modal.styles.d.ts +6 -8
- package/src/components/templates/address-form/address-form.d.ts +1 -1
- package/src/components/templates/address-form/address-form.styles.d.ts +24 -0
- package/src/components/templates/available-carriers-list/available-carriers-list.styles.d.ts +10 -3
- package/src/elements/purchase-label/hooks/index.d.ts +1 -0
- package/src/elements/purchase-label/hooks/use-get-or-create-shipment.d.ts +13 -0
- package/src/elements/purchase-label/purchase-label-by-shipment.d.ts +2 -1
- package/src/elements/purchase-label/purchase-label.d.ts +39 -2
- package/src/elements/shipment-summary/shipment-summary.d.ts +2 -8
- package/src/elements/void-label/void-label.d.ts +32 -2
- package/src/utilities/index.d.ts +1 -0
- package/src/utilities/vat.d.ts +6 -0
- package/src/workflows/account-settings/account-settings.d.ts +7 -4
- package/src/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.styles.d.ts +1 -0
- package/src/workflows/onboarding/onboarding.d.ts +1 -1
- package/suspend-text.js +1 -1
- package/transaction-history-element.js +1 -1
- package/use-unit-settings.js +1 -1
- package/utilities.js +1 -1
- package/{validation.js → vat.js} +1 -1
- package/wallet-form.js +1 -1
- package/workflows.js +1 -1
- package/src/hooks/use-get-or-create-shipment.d.ts +0 -7
- package/src/mocks/account-settings/handlers.d.ts +0 -8
- package/src/mocks/account-settings/index.d.ts +0 -1
- package/src/mocks/browser.d.ts +0 -1
- package/src/mocks/carriers/handlers.d.ts +0 -15
- package/src/mocks/carriers/index.d.ts +0 -1
- package/src/mocks/index.d.ts +0 -4
- package/src/mocks/rate-details.d.ts +0 -2
- package/src/mocks/server.d.ts +0 -3
- package/src/mocks/warehouses/handlers.d.ts +0 -14
- package/src/mocks/warehouses/index.d.ts +0 -1
- package/src/testing/extensions/index.d.ts +0 -2
- package/src/testing/extensions/matchers/extend-matchers.d.ts +0 -8
- package/src/testing/extensions/matchers/index.d.ts +0 -1
- package/src/testing/extensions/matchers/matchers.d.ts +0 -1
- package/src/testing/extensions/matchers/to-have-loading-spinner.d.ts +0 -2
- package/src/testing/extensions/queries/by-icon-name.d.ts +0 -4
- package/src/testing/extensions/queries/index.d.ts +0 -57
- package/src/testing/extensions/queries/queries.d.ts +0 -1
- package/src/testing/index.d.ts +0 -1
- package/src/testing/test-utils.d.ts +0 -298
- package/vite.config.d.ts +0 -2
package/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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"./carrier.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"humps";import"@shipengine/react-api";import"./address.js";import"@emotion/react/jsx-runtime";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./
|
|
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"./carrier.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"humps";import"@shipengine/react-api";import"./address.js";import"@emotion/react/jsx-runtime";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./vat.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/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.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"./carrier.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"humps";import"@shipengine/react-api";import"./address.js";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./
|
|
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"./carrier.js";import"date-fns/format";import"date-fns/locale";import"date-fns/parse";import"humps";import"@shipengine/react-api";import"./address.js";import"date-fns/isToday";import"@shipengine/giger";import"react";import"react-hook-form";import"react-i18next";import"./vat.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"./shipment.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/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 useHelpers,b 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{i as isOnboarded}from"./checks.js";export{b as convertDimensions,c as createDictionary,f as formatDimensions,h as getCancelledShipment,d as getIsCustomsRequiredForShipment,g as getIsInternationalShipment,e as getPendingShipment,j as getShipmentByStatus,a as isCollectionService,i as isPudoEligibleRate,m as moveCustomsItemsToProducts}from"./shipment.js";import{_ as Z}from"./carrier.js";export{L as addEmailToValidation,t as addSpaceBetweenWords,w as calculateTotal,k as capitalizeFirstLetter,l as capitalizeFirstLetterOfEachWord,u as currencySymbol,e as daysAfter,S as filterFundingSourceCarriers,a as findDateLocale,b as formatByDateAndLocale,x as formatCreditCardNumber,f as formatDate,c as formatDateDDMMYY,d as formatDateDDMMYYYY,y as formatExpiration,v as formatMoney,O as getCarrierIdByCarrierCode,z as getCurrencyFromString,A as getCurrencySymbolFromString,h as getExpirationYears,P as getLogoOrIconByCarrierCode,B as getRateRequiresAcknowledgement,j as getRelativeDates,C as getTotalRateAmount,g as getlocaleDateStringFormat,E as isDomesticAddress,K as isEmptyAddress,Q as isGlobalPostEligible,F as isMilitaryAddress,i as isNowOrInTheFuture,I as isPoBox,J as isPoBoxAddress,R as isSendleEligible,G as isUnitedStatesTerritory,H as isUnsupportedByUps,N as isUpsCarrier,M as isUspsCarrier,m as mostRecent,n as nextDayCutoff,o as omitTime,D as overrideCarrierCodes,p as parseLocaleDate,q as pascalize,r as replaceSpacesWithDashes,s as sortByCreationDate}from"./carrier.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 aggregateRateDetailItems,e as calculateRateDetailBreakdown,h as createStyles,d as deepMergeFeatures,j 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};
|
|
1
|
+
import{E as X,a as _}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 Y}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 useHelpers,b 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{i as isOnboarded}from"./checks.js";export{b as convertDimensions,c as createDictionary,f as formatDimensions,h as getCancelledShipment,d as getIsCustomsRequiredForShipment,g as getIsInternationalShipment,e as getPendingShipment,j as getShipmentByStatus,a as isCollectionService,i as isPudoEligibleRate,m as moveCustomsItemsToProducts}from"./shipment.js";import{_ as Z}from"./carrier.js";export{L as addEmailToValidation,t as addSpaceBetweenWords,w as calculateTotal,k as capitalizeFirstLetter,l as capitalizeFirstLetterOfEachWord,u as currencySymbol,e as daysAfter,S as filterFundingSourceCarriers,a as findDateLocale,b as formatByDateAndLocale,x as formatCreditCardNumber,f as formatDate,c as formatDateDDMMYY,d as formatDateDDMMYYYY,y as formatExpiration,v as formatMoney,O as getCarrierIdByCarrierCode,z as getCurrencyFromString,A as getCurrencySymbolFromString,h as getExpirationYears,P as getLogoOrIconByCarrierCode,B as getRateRequiresAcknowledgement,j as getRelativeDates,C as getTotalRateAmount,g as getlocaleDateStringFormat,E as isDomesticAddress,K as isEmptyAddress,Q as isGlobalPostEligible,F as isMilitaryAddress,i as isNowOrInTheFuture,I as isPoBox,J as isPoBoxAddress,R as isSendleEligible,G as isUnitedStatesTerritory,H as isUnsupportedByUps,N as isUpsCarrier,M as isUspsCarrier,m as mostRecent,n as nextDayCutoff,o as omitTime,D as overrideCarrierCodes,p as parseLocaleDate,q as pascalize,r as replaceSpacesWithDashes,s as sortByCreationDate}from"./carrier.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"./vat.js";export{N as NO_VAT_COUNTRIES,c as aggregateRateDetailItems,e as calculateRateDetailBreakdown,h as createStyles,d as deepMergeFeatures,j as errorMap,f as featureFlagComponentNameLookup,a as formLogger,g as getDefaultFeatures,k as getIsVatRequired,i as isObject,b as isString,t as trackingStatusFormatter,v as validationResolver}from"./vat.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(Y,{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(_.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.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@emotion/react": "11.x",
|
|
6
6
|
"react-i18next": "11.x",
|
|
@@ -30,16 +30,15 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@emotion/cache": "11.10.5",
|
|
32
32
|
"@emotion/serialize": "1.1.1",
|
|
33
|
-
"@faker-js/faker": "7.6.0",
|
|
34
33
|
"@hookform/resolvers": "2.9.11",
|
|
35
34
|
"@jest/globals": "28.1.3",
|
|
36
35
|
"@rjsf/core": "5.16.1",
|
|
37
36
|
"@rjsf/utils": "5.16.1",
|
|
38
37
|
"@rjsf/validator-ajv8": "5.16.1",
|
|
39
|
-
"@shipengine/giger": "1.
|
|
40
|
-
"@shipengine/giger-theme": "1.
|
|
41
|
-
"@shipengine/js-api": "1.
|
|
42
|
-
"@shipengine/react-api": "2.
|
|
38
|
+
"@shipengine/giger": "1.15.0",
|
|
39
|
+
"@shipengine/giger-theme": "1.6.0",
|
|
40
|
+
"@shipengine/js-api": "1.30.2",
|
|
41
|
+
"@shipengine/react-api": "2.15.3",
|
|
43
42
|
"@storybook/addons": "6.5.16",
|
|
44
43
|
"@storybook/components": "7.0.0-rc.1",
|
|
45
44
|
"@storybook/core-events": "7.0.0-rc.1",
|
|
@@ -47,7 +46,6 @@
|
|
|
47
46
|
"@storybook/theming": "7.0.0-rc.1",
|
|
48
47
|
"@tanstack/react-query": "4.36.1",
|
|
49
48
|
"@testing-library/dom": "8.19.0",
|
|
50
|
-
"@vitejs/plugin-react": "1.3.2",
|
|
51
49
|
"axios": "1.7.2",
|
|
52
50
|
"card-validator": "8.1.1",
|
|
53
51
|
"classnames": "2.5.1",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const styles: {
|
|
2
|
-
|
|
2
|
+
chips: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
3
|
+
display: "flex";
|
|
3
4
|
gap: number;
|
|
4
5
|
};
|
|
5
6
|
fundsInput: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
@@ -6,6 +6,7 @@ import { AddressValidationPreference } from "../templates/address-preference-sel
|
|
|
6
6
|
type WarehouseData = Pick<WarehousePayload, "name" | "isDefault">;
|
|
7
7
|
type WalletData = {
|
|
8
8
|
creditCard: WalletPayload["creditCard"];
|
|
9
|
+
iovationBlackbox: WalletPayload["iovationBlackbox"];
|
|
9
10
|
};
|
|
10
11
|
type RegisterFundingSourceCarrierData = {
|
|
11
12
|
agreeToTerms: RegisterFundingSourceCarrierPayload["agreeToTerms"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WithCommonProps } from "@shipengine/giger";
|
|
2
|
-
import
|
|
2
|
+
import { SE } from "@shipengine/react-api";
|
|
3
3
|
import { RateOption } from "../../../hooks";
|
|
4
4
|
export type RateCardProps = Partial<RateOption> & WithCommonProps<{
|
|
5
5
|
isAcknowledged?: boolean;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
export declare const styles: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
top: string;
|
|
7
|
-
transform: "translate(0, -50%)";
|
|
2
|
+
header: () => {
|
|
3
|
+
alignContent: "center";
|
|
4
|
+
alignItems: "left";
|
|
5
|
+
display: "flex";
|
|
8
6
|
};
|
|
9
7
|
headerTitle: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
8
|
+
alignItems: "center";
|
|
10
9
|
color: string;
|
|
10
|
+
display: "flex";
|
|
11
11
|
fontWeight: number;
|
|
12
|
-
lineHeight: number;
|
|
13
12
|
margin: number;
|
|
14
13
|
paddingLeft: number;
|
|
15
|
-
textAlign: "left";
|
|
16
14
|
};
|
|
17
15
|
};
|
|
@@ -7,7 +7,7 @@ export type AddressFormProps<T = undefined> = {
|
|
|
7
7
|
isShipToForm?: boolean;
|
|
8
8
|
onCancel?: () => void;
|
|
9
9
|
onCancelParse?: () => void;
|
|
10
|
-
onSubmit: (payload: SE.Address) => void
|
|
10
|
+
onSubmit: (payload: SE.Address) => Promise<void>;
|
|
11
11
|
onSubmitParse?: (payload: AddressParserPayload) => Promise<SE.AddressExtraction | undefined>;
|
|
12
12
|
parseAddressErrors?: SE.CodedError[];
|
|
13
13
|
resetParseAddress?: () => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
formWrapper: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
3
|
+
backgroundColor: string;
|
|
4
|
+
marginBottom: number;
|
|
5
|
+
padding: number;
|
|
6
|
+
};
|
|
7
|
+
getHeaderTypography: (isAddressParserOpen: boolean) => (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
8
|
+
marginBottom?: number | undefined;
|
|
9
|
+
width: string;
|
|
10
|
+
};
|
|
11
|
+
getHeaderWrapper: (isAddressParserOpen: boolean) => (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
12
|
+
display: "flex";
|
|
13
|
+
flexDirection: "column" | "row";
|
|
14
|
+
paddingBottom: number;
|
|
15
|
+
width: string;
|
|
16
|
+
};
|
|
17
|
+
pasteList: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
18
|
+
flexShrink: number;
|
|
19
|
+
fontWeight: number;
|
|
20
|
+
};
|
|
21
|
+
pasteWrapper: () => {
|
|
22
|
+
flexShrink: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
package/src/components/templates/available-carriers-list/available-carriers-list.styles.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export declare const styles: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
grid: (theme: import("@shipengine/giger-theme/dist/lib/Theme").Theme) => {
|
|
3
|
+
"@container (width < 400px)": {
|
|
4
|
+
gridTemplateColumns: string;
|
|
5
|
+
};
|
|
6
|
+
display: "grid";
|
|
7
|
+
gap: number;
|
|
8
|
+
gridTemplateColumns: string;
|
|
9
|
+
};
|
|
10
|
+
gridContainer: () => {
|
|
11
|
+
containerType: string;
|
|
5
12
|
};
|
|
6
13
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SE } from "@shipengine/js-api";
|
|
2
|
+
import { ConfigureShipmentProps } from "../configure-shipment";
|
|
3
|
+
export type UseGetOrCreateShipmentProps = {
|
|
4
|
+
externalShipmentId?: string;
|
|
5
|
+
onShipmentUpdated: ConfigureShipmentProps["onShipmentUpdated"];
|
|
6
|
+
shipmentId?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const useGetOrCreateShipment: ({ externalShipmentId, shipmentId, onShipmentUpdated, }: UseGetOrCreateShipmentProps) => {
|
|
9
|
+
errors: SE.CodedError[] | undefined;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
refetchShipment: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<SE.SalesOrderShipment, SE.CodedError[]>>;
|
|
12
|
+
shipment: SE.SalesOrderShipment;
|
|
13
|
+
};
|
|
@@ -2,6 +2,7 @@ import { SE } from "@shipengine/react-api";
|
|
|
2
2
|
import { PurchaseLabelCommonProps } from "./purchase-label";
|
|
3
3
|
export type PurchaseLabelByShipmentProps = PurchaseLabelCommonProps & {
|
|
4
4
|
currency?: SE.Currency;
|
|
5
|
+
externalShipmentId?: string;
|
|
5
6
|
shipmentId?: string;
|
|
6
7
|
};
|
|
7
|
-
export declare const PurchaseLabelByShipment: ({ onLoad, onShipmentUpdated, shipmentId, currency, ...props }: PurchaseLabelByShipmentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const PurchaseLabelByShipment: ({ onLoad, onShipmentUpdated, shipmentId, externalShipmentId, currency, ...props }: PurchaseLabelByShipmentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -141,7 +141,7 @@ export type ElementProps = PurchaseLabelByShipmentProps | PurchaseLabelSalesOrde
|
|
|
141
141
|
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
142
142
|
* ```tsx
|
|
143
143
|
* export const Element = createElement(Component, ErrorFallback, {
|
|
144
|
-
*
|
|
144
|
+
*
|
|
145
145
|
* resources: { en },
|
|
146
146
|
* });
|
|
147
147
|
* ```
|
|
@@ -1013,7 +1013,44 @@ export declare const Element: ({ resources, ...props }: ElementProps & {
|
|
|
1013
1013
|
};
|
|
1014
1014
|
packageCategories: {
|
|
1015
1015
|
customPackages: string;
|
|
1016
|
-
};
|
|
1016
|
+
}; /**
|
|
1017
|
+
* # Registered Purchase Label Element
|
|
1018
|
+
*
|
|
1019
|
+
* @param ElementProps The props necessary to render the `<PurchaseLabel.Element />` for shipment
|
|
1020
|
+
* based or sales order based label purchasing.
|
|
1021
|
+
*
|
|
1022
|
+
* @example
|
|
1023
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `PurchaseLabel`
|
|
1024
|
+
* Element directly.
|
|
1025
|
+
* ```tsx
|
|
1026
|
+
* <PurchaseLabel.Element
|
|
1027
|
+
* key={currentSalesOrderId}
|
|
1028
|
+
* printLabelLayout='4x6'
|
|
1029
|
+
* shippingPresets={presets}
|
|
1030
|
+
* onShipmentUpdated={(shipment) => console.log('Shipment Updated', shipment)}
|
|
1031
|
+
* onRateSaved={(
|
|
1032
|
+
* shipment: SE.SalesOrderShipment,
|
|
1033
|
+
* rate?: SE.Rate,
|
|
1034
|
+
* rateOptions?: SE.Rate[]
|
|
1035
|
+
* ) => console.log('Rate Saved', shipment, rate, rateOptions)}
|
|
1036
|
+
* onRatesCalculated={() => console.log('Rates Calculated')}
|
|
1037
|
+
* onBeforeLabelCreate={onBeforeLabelPurchase}
|
|
1038
|
+
* onLabelCreateSuccess={onLabelPurchaseSuccess}
|
|
1039
|
+
* onLabelCreateFailure={(rate) => console.log('Label Purchase Failed', rate)}
|
|
1040
|
+
* warehouseId={defaultWarehouseId}
|
|
1041
|
+
* />
|
|
1042
|
+
* ```
|
|
1043
|
+
*
|
|
1044
|
+
* <br />
|
|
1045
|
+
*
|
|
1046
|
+
* - Once a label has been purchased using this Element, you can take the `shipmentId` for the
|
|
1047
|
+
* associated shipment and pass it into the `<ShipmentSummary.Element />` Element in order to view
|
|
1048
|
+
* the shipment details.
|
|
1049
|
+
*
|
|
1050
|
+
* @see {@link PurchaseLabel.PurchaseLabelCommonProps | The **Common props** used in `<PurchaseLabel.Element />`}
|
|
1051
|
+
*
|
|
1052
|
+
* @see {@link ShipmentSummary.Element | The next step in the label purchase workflow `<ShipmentSummary.Element />`}
|
|
1053
|
+
*/
|
|
1017
1054
|
packageCodes: {
|
|
1018
1055
|
package: string;
|
|
1019
1056
|
};
|
|
@@ -49,7 +49,7 @@ export type ComponentProps = {
|
|
|
49
49
|
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
50
50
|
* ```tsx
|
|
51
51
|
* export const Element = createElement(Component, ErrorFallback, {
|
|
52
|
-
*
|
|
52
|
+
*
|
|
53
53
|
* resources: { en },
|
|
54
54
|
* });
|
|
55
55
|
* ```
|
|
@@ -416,13 +416,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
416
416
|
today: string;
|
|
417
417
|
viewMap: string;
|
|
418
418
|
otherLocations: string;
|
|
419
|
-
noServicePointsForService: string;
|
|
420
|
-
* # Shipment Summary Element Props
|
|
421
|
-
*
|
|
422
|
-
* - These are the base props that will be passed into the `<ShipmentSummary />` element.
|
|
423
|
-
*
|
|
424
|
-
* @see {@link ShipmentSummary.Element | See the full type that `typeof Element` will return}
|
|
425
|
-
*/
|
|
419
|
+
noServicePointsForService: string;
|
|
426
420
|
error: string;
|
|
427
421
|
paperless: string;
|
|
428
422
|
localTimeDisclaimer: string;
|
|
@@ -46,7 +46,7 @@ export type ComponentProps = {
|
|
|
46
46
|
* You can see how the `<Component />` is used in the `createElement` function call below.
|
|
47
47
|
* ```tsx
|
|
48
48
|
* export const Element = createElement(Component, ErrorFallback, {
|
|
49
|
-
*
|
|
49
|
+
*
|
|
50
50
|
* resources: { en },
|
|
51
51
|
* });
|
|
52
52
|
* ```
|
|
@@ -394,7 +394,37 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
394
394
|
noWarehouse: string;
|
|
395
395
|
noCarrier: string;
|
|
396
396
|
noWarehouseOrCarrier: string;
|
|
397
|
-
};
|
|
397
|
+
}; /**
|
|
398
|
+
* # Registered Void Label Element
|
|
399
|
+
*
|
|
400
|
+
* - This is the registered `<VoidLabel />` element that will be used to render the
|
|
401
|
+
* `<VoidLabel.Element />` component.
|
|
402
|
+
*
|
|
403
|
+
* @param ElementProps The props, callbacks, and resources necessary to render
|
|
404
|
+
* the `<VoidLabel.Element />` component.
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* The `<Component />` is the source JSX that is rendered when you make use of the `VoidLabel`
|
|
408
|
+
* Element directly. Here is a brief example of how you would use it within your application.
|
|
409
|
+
* ```tsx
|
|
410
|
+
* <VoidLabel.Element
|
|
411
|
+
* labelId="se-1234567"
|
|
412
|
+
* onComplete={() => console.log('onComplete')}
|
|
413
|
+
* onSuccess={(_, { salesOrderIds: [salesOrderId] }) =>
|
|
414
|
+
* console.log('sales order ID', salesOrderId)
|
|
415
|
+
* }
|
|
416
|
+
* onViewShipment={({ shipmentId }) => {
|
|
417
|
+
* console.log('onViewShipment', shipmentId);
|
|
418
|
+
* }}
|
|
419
|
+
* />
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* <br />
|
|
423
|
+
*
|
|
424
|
+
* @see {@link VoidLabel.ComponentProps | The **props** that can be passed into the `<VoidLabel.Element />` component}
|
|
425
|
+
*
|
|
426
|
+
* @see {@link PurchaseLabel.Element | Go back to the frst step in the label purchase workflow `<PurchaseLabel.Element />`}
|
|
427
|
+
*/
|
|
398
428
|
servicePoints: {
|
|
399
429
|
searchLabel: string;
|
|
400
430
|
noRatesForType: string;
|
package/src/utilities/index.d.ts
CHANGED
|
@@ -123,7 +123,9 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
123
123
|
verifiedVat: string;
|
|
124
124
|
vatFormErrors: {
|
|
125
125
|
invalidFieldValue: string;
|
|
126
|
-
verificationFailure: string;
|
|
126
|
+
verificationFailure: string; /**
|
|
127
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
128
|
+
*/
|
|
127
129
|
forbidden: string;
|
|
128
130
|
connectionNotSupported: string;
|
|
129
131
|
genericTitle: string;
|
|
@@ -263,9 +265,7 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
263
265
|
addPackageDetails: string;
|
|
264
266
|
};
|
|
265
267
|
errorMessages: {
|
|
266
|
-
customsItemsRequired: string;
|
|
267
|
-
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
268
|
-
*/
|
|
268
|
+
customsItemsRequired: string;
|
|
269
269
|
invalidAddress: string;
|
|
270
270
|
noRates: string;
|
|
271
271
|
salesOrderNotLoaded: string;
|
|
@@ -931,6 +931,9 @@ export declare const Element: ({ resources, ...props }: ComponentProps & {
|
|
|
931
931
|
externalCarriers: string;
|
|
932
932
|
labelLayout: string;
|
|
933
933
|
unitSettings: string;
|
|
934
|
+
/**
|
|
935
|
+
* `features` is a set of feature flags you would like to enable or disable in this component.
|
|
936
|
+
*/
|
|
934
937
|
vatSettings: string;
|
|
935
938
|
};
|
|
936
939
|
};
|
package/suspend-text.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as n}from"@emotion/react/jsx-runtime";import{useRef as t,useLayoutEffect as r,useState as i,useMemo as o,useCallback as a}from"react";import{Icon as s,Table as c,TableFooter as l,TableHeader as d,TableHeaderRow as g,TableHeaderCell as h,Checkbox as p,TableBody as m,TableRow as u,TableBodyCell as f,Button as b,ButtonVariant as w,IconSize as C,DropdownOptionList as v,Option as O,Pagination as y,Skeleton as S,SkeletonAnimation as j,SkeletonVariant as x}from"@shipengine/giger";import{IconNames as k}from"@shipengine/giger-theme";import{h as E}from"./
|
|
1
|
+
import{jsxs as e,jsx as n}from"@emotion/react/jsx-runtime";import{useRef as t,useLayoutEffect as r,useState as i,useMemo as o,useCallback as a}from"react";import{Icon as s,Table as c,TableFooter as l,TableHeader as d,TableHeaderRow as g,TableHeaderCell as h,Checkbox as p,TableBody as m,TableRow as u,TableBodyCell as f,Button as b,ButtonVariant as w,IconSize as C,DropdownOptionList as v,Option as O,Pagination as y,Skeleton as S,SkeletonAnimation as j,SkeletonVariant as x}from"@shipengine/giger";import{IconNames as k}from"@shipengine/giger-theme";import{h as E}from"./vat.js";import{G as P}from"./actions-menu.js";import{c as D,f as I}from"./carrier.js";import{useTranslation as T,Trans as z}from"react-i18next";const A=E({container:{backgroundColor:"#11003A"},getChildrenStyles:e=>n=>({height:e?"90%":"0",overflow:"scroll"}),getDrawerStyles:e=>n=>({backgroundColor:"#11003A",bottom:0,height:e?"50%":`${n.spacing(6)}px`,minWidth:"375px",position:"fixed",transformOrigin:"bottom",transition:"height 0.5s;"}),header:e=>({alignItems:"center",color:"#fff",display:"flex",height:e.spacing(6),justifyContent:"space-between",padding:e.spacing(1)})}),R=({children:i,headerContent:o,isOpen:a,toggleDrawer:c})=>{const l=t(null);return r((()=>{const e=()=>{const e=l.current;e&&e.parentElement&&(e.style.width=`${e.parentElement.clientWidth}px`)};return e(),window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),e("div",Object.assign({"aria-label":"Drawer",css:A.getDrawerStyles(a),ref:l},{children:[e("header",Object.assign({"aria-expanded":a,css:A.header},{children:[n("div",Object.assign({onClick:c,onKeyDown:e=>{"Enter"===e.key&&c()},role:"button",tabIndex:0},{children:n(s,{css:{transform:`rotate(${a?"-90":"90"}deg)`},name:k.PAGINATION_LEFT})})),o]})),n("div",Object.assign({"aria-labelledby":"drawer",css:A.getChildrenStyles(a),role:"region"},{children:i}))]}))},W=({date:e,short:t})=>{const{locale:r}=P();return n("div",{children:n("div",{children:t?D(e,r):I(e,r)})})},M=E({checkboxHeader:e=>({width:e.spacing(6)}),table:{"*":{overflow:"hidden",textOverflow:"clip !important"}}}),_=({columns:t,data:r,footerContent:s,onRowClick:b,useCheckboxes:w=!1})=>{var C,v,O;const[y,S]=i(null!==(C=null==r?void 0:r.map((()=>!1)))&&void 0!==C?C:[]),j=o((()=>y.length>0&&y.every((e=>e))),[y]),x=o((()=>y.some((e=>e))),[y]),k=a((e=>{S((n=>{const t=[...n];return t[e]=!t[e],t}))}),[]),E=a((e=>{S((n=>{const t=[...n];for(const n of t.entries())t[n[0]]=e;return t}))}),[]);return n(c,Object.assign({css:M.table,"data-testid":"grid",footer:s&&n(l,{children:s}),header:n(d,{children:e(g,{children:[w?n(h,Object.assign({css:M.checkboxHeader},{children:n(p,{checked:null!==(v=j||x)&&void 0!==v&&v,indeterminate:null!==(O=!j&&x)&&void 0!==O&&O,onChange:e=>E(e.target.checked)})})):null,t.map((e=>e.headerContent)).map(((e,t)=>n(h,{children:e},t)))]})})},{children:n(m,{children:r.map(((r,i)=>{var o;return e(u,Object.assign({onClick:b?()=>b(r):void 0},{children:[w?n(f,{children:n(p,{checked:null!==(o=y[i])&&void 0!==o&&o,onChange:()=>k(i)})}):null,t.map(((e,t)=>e.renderCellContent?n(f,{children:e.renderCellContent(r)},t):null))]}),i)}))})}))},H=E({footer:{"> *":{borderTop:"0 !important"},alignItems:"center",display:"flex",justifyContent:"space-between",width:"100%"},leftFooter:e=>({display:"flex",margin:e.spacing(2),span:{fontWeight:e.typography.fontWeight.bold}}),rowCount:e=>({alignItems:"center",display:"flex",marginRight:e.spacing(4),whiteSpace:"pre"}),rowCountDropDown:{"> * > *":{justifyContent:"center !important"}},rowsActions:e=>({"#selected-row":{":hover":{backgroundColor:"transparent"},borderRadius:e.borderRadius.XS,color:e.palette.black,padding:e.spacing(1),paddingRight:e.spacing(.5)},alignItems:"baseline",display:"flex",span:{alignSelf:"center"}})}),N=[5,10,25,50],F=({currentPageSize:r,pagingData:o,rowCountSelection:c=N,onPageSelect:l,onPageSizeSelect:d})=>{const[g,h]=i(!1),p=t(null),{t:m}=T(),u=a((()=>h((e=>!e))),[]);return e("div",Object.assign({css:H.footer},{children:[e("div",Object.assign({css:H.leftFooter},{children:[n("div",Object.assign({css:H.rowCount},{children:n(z,{components:[n("b",{style:{fontWeight:"bold"}},"1")],count:o.total,i18nKey:"common:grid.row-count",values:{firstIndex:0!==o.total?1+(o.page-1)*r:0,lastIndex:Math.min(o.total,o.page*r)}})})),e("div",Object.assign({css:H.rowsActions},{children:[m("common:grid.rows"),n(b,Object.assign({id:"selected-row",onClick:()=>u(),ref:p,variant:w.TEXT},{children:r})),n(s,g?{name:k.CHEVRON_TOP,onClick:()=>u(),size:C.SIZE_MEDIUM}:{name:k.CHEVRON_BOTTOM,onClick:()=>u(),size:C.SIZE_MEDIUM}),n(v,Object.assign({css:H.rowCountDropDown,dropdownWidth:"max-content",isOpen:g,onChange:()=>u(),onClickAway:e=>{var n;(null===(n=p.current)||void 0===n?void 0:n.contains(e.target))||u()},placement:"bottom",reference:p.current},{children:c.map((e=>n(O,Object.assign({onClick:()=>d(e),value:String(e)},{children:e}),e)))}))]}))]})),n("div",{children:n(y,{boundaryPagesToShow:5,currentPage:o.page,onPageChange:l,totalPages:o.pages})})]}))},G=(e=10)=>{const[n,t]=i(1),[r,o]=i(e);return{page:n,pagerProps:{currentPage:n,currentPageSize:r,onPageSelect:e=>{t(e)},onPageSizeSelect:e=>{o(e)}},pageSize:r}},L=({children:e,loading:t})=>t?n(S,{animation:j.WAVE,variant:x.TEXT}):n("span",{children:e});export{W as C,R as D,_ as G,F as P,L as S,G as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"@emotion/react/jsx-runtime";import{S as r,c as i,e as a,u as s,M as o,d as l,E as c,f as d,U as p,g,h,i as u,P as m,T as b}from"./use-unit-settings.js";import{T as f,h as C,m as v,r as O,a8 as j,e as x}from"./actions-menu.js";import{k as w,t as y,q as _,T}from"./carrier.js";import{useTranslation as S}from"react-i18next";import{Icon as k,IconSize as D,Select as E,Option as W,Input as z,Popover as R,Typography as $,ButtonIcon as I,Tag as P,TagColor as F}from"@shipengine/giger";import{IconNames as L}from"@shipengine/giger-theme";import{useListCarriers as A,useListLabels as B,useListSalesOrderShipments as M,useListShipments as N}from"@shipengine/react-api";import{D as U,u as K,C as G,S as H,G as q,P as V}from"./suspend-text.js";import{useState as Z,useCallback as J,useRef as Q,useContext as X,createContext as Y}from"react";import{h as ee}from"./validation.js";import{d as te}from"./use-toggle.js";const ne=ee({category:{alignItems:"center",cursor:"pointer",display:"flex",flexDirection:"row",justifyContent:"space-between"},colorPicker:e=>({"&::-webkit-color-swatch":{border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",padding:0},"&::-webkit-color-swatch-wrapper":{padding:0},alignSelf:"center",appearance:"none",background:"none",border:0,cursor:"pointer",height:e.spacing(4.25),outline:"none",width:e.spacing(4.25)}),container:e=>({marginBottom:e.spacing(2)}),input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",padding:e.spacing(1)}),inputContainer:e=>({alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:`${e.spacing(2)}px 0`}),wrapper:e=>({display:"flex",gap:e.spacing(1)})}),re=({paletteConfig:n,onUpdatePaletteConfig:r,formatKey:i})=>{const[a,s]=Z(new Set),o=e=>{s((t=>{const n=new Set(t);return n.has(e)?new Set([...n].filter((t=>t!==e))):new Set([...n,e])}))},l=J(((e,t,i)=>{const a=(e=>{if(e)return e.match(/^#[0-9A-Fa-f]{0,6}$/)?e:e.match(/^[0-9A-Fa-f]{6}$/)?`#${e}`:void 0})(i),s=Object.assign(Object.assign({},n||{}),{[e]:Object.assign(Object.assign({},(null==n?void 0:n[e])||{}),{[t]:a})});r(s)}),[r,n]);return e("div",Object.assign({"data-test-id":"color-palette-editor"},{children:n&&Object.keys(n).map((r=>t("div",Object.assign({css:ne.container,id:r},{children:[t("div",Object.assign({"aria-expanded":a.has(r),css:ne.category,onClick:e=>{e.preventDefault(),o(r)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),o(r))},role:"button",tabIndex:0},{children:[e("p",{children:w(r)}),e(k,{name:a.has(r)?L.CHEVRON_TOP:L.CHEVRON_BOTTOM,size:D.SIZE_REGULAR})]})),a.has(r)&&Object.keys(n[r]).map((a=>t("div",Object.assign({css:ne.inputContainer,id:"input-container"},{children:[e("label",Object.assign({css:{fontWeight:"bold"},htmlFor:`${r}.${a}`},{children:i(a)})),t("form",Object.assign({css:ne.wrapper},{children:[e("input",{css:ne.input,onChange:e=>{e.preventDefault(),l(r,a,e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},type:"text",value:n[r][a]}),e("input",{css:ne.colorPicker,onChange:e=>l(r,a,e.target.value),type:"color",value:n[r][a]})]}))]}),a)))]}),r)))}))},ie=ee({input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",maxWidth:e.spacing(16),padding:0}),keys:{fontSize:"16px",fontWeight:"bold",marginTop:"8px"},section:e=>({"& > div:first-child":{flexGrow:3},"& > div:last-child":{flexShrink:1},display:"flex",gap:e.spacing(1),justifyContent:"space-between"}),sectionContainer:e=>({marginBottom:e.spacing(4)}),select:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px"})}),ae=({onUpdateTypographyConfig:r,typographyConfig:i,formatKey:a})=>{const s=J(((e,t,n)=>{const a=Object.assign(Object.assign({},i||{}),{[e]:Object.assign(Object.assign({},(null==i?void 0:i[e])||{}),{[t]:n})});r(a)}),[r,i]),o=J(((e,t)=>{if(e)return e[t]}),[]),l=(t,n)=>{var r;const a=[{label:"Normal",value:"400"},{label:"Semi Bold",value:"600"},{label:"Bold",value:"700"}],l=null===(r=o(i,t))||void 0===r?void 0:r.fontWeight.toString(),c=void 0!==l?a.find((e=>e.value===l)):void 0;return e(E,Object.assign({css:ie.select,label:"Font Weight",name:"font-weight",onChange:(e,r)=>s(t,n,null==r?void 0:r.value),value:c},{children:a.map((t=>e(W,Object.assign({value:t.value},{children:t.label}),t.value)))}))},c=(t,n)=>{var r;const a=null===(r=o(i,t))||void 0===r?void 0:r.fontSize.replace("px","");return e(z,{"aria-labelledby":`${t}.${n}`,css:ie.input,label:"Font Size(px)",onChange:e=>{e.target.value.match(/^\d{0,2}$/)&&s(t,n,`${e.target.value}px`)},value:a})},d=(t,r)=>{switch(r){case"fontWeight":return e(n,{children:l(t,r)});case"fontSize":return e(n,{children:c(t,r)});default:return null}};return e("div",{children:i&&Object.keys(i).map((n=>t("div",Object.assign({css:ie.sectionContainer},{children:[e("p",Object.assign({css:ie.keys,id:n},{children:a(n)})),e("section",Object.assign({css:ie.section},{children:Object.keys(i[n]).map((t=>e("div",Object.assign({id:`${n}.${t}`},{children:d(n,t)}),t)))}))]}),n)))})},se=ee({container:e=>({color:e.palette.gray.dark,display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",position:"relative"}),content:e=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:e.spacing(3)}),copy:e=>({backgroundColor:e.palette.white,borderRadius:"4px",padding:e.spacing(.5)}),drawerHeader:e=>({alignItems:"center",display:"flex",gap:e.spacing(2),justifyContent:"end",width:"50%"}),drawerWrapper:{display:"flex",justifyContent:"space-between",position:"relative"},header:{alignItems:"center",display:"flex",justifyContent:"space-between"},popoverWrapper:e=>({display:"flex",flexDirection:"column",gap:e.spacing(1)}),pre:e=>({backgroundColor:"#FFFFFF66",borderRadius:"8px",fontSize:"14px",padding:e.spacing(.3)}),presetOption:e=>({"&:hover":{backgroundColor:"theme.palette.gray.ultraLight"},backgroundColor:"transparent",borderRadius:"4px",fontSize:"14px",padding:e.spacing(1)}),presetsButton:e=>({"&:hover":{backgroundColor:"#d1d4d7"},backgroundColor:"#E4E5E7",borderRadius:"4px",cursor:"pointer",display:"flex",fontSize:"14px",gap:e.spacing(.5),padding:`${e.spacing(.5)}px ${e.spacing(1)}px`})}),oe=({themeConfig:n,onUpdateThemeConfig:r,presets:i,showDrawer:a})=>{const s=Q(n),[o,l]=Z(!1),c=Object.keys(n).flatMap((e=>{if("components"===e&&n[e]&&"object"==typeof n[e]){return Object.keys(n[e])}return[e]})).map((e=>"palette"===e?{label:"Color Palette",value:"Color Palette"}:{label:w(e),value:w(e)})),[d,p]=Z(c.sort()[0].value),g=e=>y(_(e)),h=Q(null),[u,m]=te(!1),b=e=>{r(e)};return t("div",Object.assign({"aria-label":"Theme Creator",css:se.container,"data-testid":"theme-creator",role:"region"},{children:[t("div",Object.assign({css:se.content},{children:[t("div",Object.assign({css:se.header},{children:[e(f,{onSelectTab:e=>{p(e)},selectedTab:d,tabs:c}),i?t("div",{children:[t("button",Object.assign({"aria-controls":"presets-popover","aria-expanded":u,css:se.presetsButton,onClick:e=>{e.preventDefault(),m()},ref:h},{children:["Presets",e(k,{name:L.CARET_BOTTOM,size:D.SIZE_SMALL})]})),e(R,Object.assign({container:document.querySelector("#theme-creator"),isOpen:u,onClickAway:()=>m(),placement:"bottom-end",reference:h.current},{children:t("div",Object.assign({css:se.popoverWrapper},{children:[e("button",Object.assign({"aria-label":"Set Default Theme",css:se.presetOption,onClick:e=>{e.preventDefault(),m(),b(s.current)},role:"menuitem"},{children:"Default"})),i.map((t=>e("button",Object.assign({"aria-label":`Set ${t.presetName} Theme`,css:se.presetOption,onClick:e=>{e.preventDefault(),m(),b(t.themeConfig)},role:"menuitem"},{children:t.presetName}),t.presetName)))]}))}))]}):e("button",Object.assign({"aria-label":"Set Default Theme",css:se.presetsButton,onClick:()=>{b(s.current)},role:"menuitem"},{children:"Reset to Default"}))]})),e($,Object.assign({role:"heading",variant:"heading4"},{children:`${d} Editor`})),((t,n)=>{var i;switch(n){case"Color Palette":return e(re,{formatKey:g,onUpdatePaletteConfig:e=>{r(Object.assign(Object.assign({},t),{palette:e}))},paletteConfig:t.palette});case"Typography":return e(ae,{formatKey:g,onUpdateTypographyConfig:e=>{r(Object.assign(Object.assign({},t),{components:Object.assign(Object.assign({},t.components),{Typography:e})}))},typographyConfig:null===(i=t.components)||void 0===i?void 0:i.Typography});default:return null}})(n,d)]})),a&&e(U,Object.assign({"aria-label":"Show themeConfig.js Code Drawer",headerContent:t("div",Object.assign({css:se.drawerHeader},{children:[e("pre",Object.assign({css:se.pre},{children:"themeConfig.js"})),a.copyToClipboardText&&e("div",Object.assign({css:se.copy},{children:e(C,{content:a.copyToClipboardText})}))]})),isOpen:o,toggleDrawer:()=>l(!o)},{children:a.content}))]}))},le=({onRedirectToOnboarding:t})=>e(r,{onRedirectToOnboarding:t}),ce=i(le,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var de=Object.freeze({__proto__:null,Component:le,Element:ce});const pe=()=>{const t=T(s(),[]);return e(o,Object.assign({},t))},ge=i(pe,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var he=Object.freeze({__proto__:null,Component:pe,Element:ge});const ue=({isModalFullScreen:t})=>{const n=T(l(),[]);return e(c,Object.assign({isModalFullScreen:t},n))},me=i(ue,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var be=Object.freeze({__proto__:null,Component:ue,Element:me});const fe=i((({onRowClick:n})=>{const{t:r}=S(["common","list-labels"]),{page:i,pageSize:a,pagerProps:s}=K(),{data:o,isLoading:l}=A(),{data:c,isLoading:d,isError:p,error:g}=B({page:i,pageSize:a}),h=(null==c?void 0:c.labels)?c.labels.filter((e=>e.shipmentId)).map((e=>e.shipmentId)):[],{data:u,isLoading:m}=M({shipmentIds:h});if(d)return e(O,{message:r("loading.labels")});if(p)throw new Error(g.map((e=>e.message)).join(", "));if(!c)throw new Error(r("errorMessages.unableToLoad.labels"));const b=[{headerContent:r("list-labels:headers.labelId"),renderCellContent:t=>e("div",{children:t.labelId})},{headerContent:r("list-labels:headers.created"),renderCellContent:t=>(null==t?void 0:t.shipDate)&&e(G,{date:t.shipDate})},{headerContent:r("list-labels:headers.shipTo"),renderCellContent:t=>{const n=null==u?void 0:u.find((e=>e.shipmentId===t.shipmentId)),r=n&&n.shipTo.addressLine1?e(j,{address:n.shipTo}):"--";return e(H,Object.assign({loading:m},{children:r}))}},{headerContent:r("list-labels:headers.service"),renderCellContent:n=>{if(!l&&o){const r=o.find((e=>e.carrierCode===n.carrierCode));if(r){const i=r.services.find((e=>e.serviceCode===n.serviceCode));if(i)return t("div",{children:[e(x,{carrierCode:n.carrierCode},n.carrierCode)," ",i.name]})}}return t(H,Object.assign({loading:l},{children:["`$",n.carrierCode," - $",n.serviceCode,"`"]}))}},{headerContent:e("div",{"aria-label":r("list-labels:headers.download")}),renderCellContent:t=>"completed"===t.status?e("div",Object.assign({css:{textAlign:"right"}},{children:e(I,{ariaDescribedby:"",children:r("list-labels:actions.download.pdf"),icon:L.DOWNLOAD,onClick:e=>{e.stopPropagation(),window.open(t.labelDownload.pdf)}})})):e("div",Object.assign({css:{textAlign:"right"}},{children:e(P,Object.assign({color:F.INFO},{children:t.status.toLocaleUpperCase()}))}))}];return e(q,{columns:b,data:c.labels,footerContent:e(V,Object.assign({},s,{pagingData:c})),onRowClick:n})}),v,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:a}});var Ce=Object.freeze({__proto__:null,Element:fe});const ve=i((({onRowClick:t,shipmentStatus:n="pending"})=>{const{t:r}=S(["common","list-shipments"]),{page:i,pageSize:a,pagerProps:s}=K(),{data:o,isLoading:l,isError:c,error:d}=N({page:i,pageSize:a,shipmentStatus:n});if(l)return e(O,{message:r("loading.shipments")});if(c)throw new Error(d.map((e=>e.message)).join(", "));if(!o)throw new Error(r("errorMessages.unableToLoad.shipments"));const p=[{headerContent:r("list-shipments:headers.shipmentId"),renderCellContent:t=>e("div",{children:t.shipmentId})},{headerContent:r("list-shipments:headers.shipTo"),renderCellContent:t=>t.shipTo.addressLine1?e(j,{address:t.shipTo}):"--"},{headerContent:r("list-shipments:headers.shipDate"),renderCellContent:t=>t.shipDate?e(G,{date:t.shipDate}):"--"}];return e(q,{columns:p,data:o.shipments,footerContent:e(V,Object.assign({},s,{pagingData:o})),onRowClick:t})}),v,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:a}});var Oe=Object.freeze({__proto__:null,Element:ve});const je=Y(void 0),xe=({children:t,editableTheme:n})=>{const[r,i]=Z(n);return e(je.Provider,Object.assign({value:{setThemeConfig:i,themeConfig:r}},{children:t}))},we=()=>{const e=X(je);if(!e)throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");return e},ye=t=>{var n=T(t,[]);return e(oe,Object.assign({},n))},_e=i(ye,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var Te=Object.freeze({__proto__:null,Component:ye,Element:_e});const Se=()=>{const t=T(d(),[]);return e(p,Object.assign({},t))},ke=i(Se,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var De=Object.freeze({__proto__:null,Component:Se,Element:ke});const Ee=({onRedirectToOnboarding:t})=>e(g,{onRedirectToOnboarding:t}),We=i(Ee,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var ze=Object.freeze({__proto__:null,Component:Ee,Element:We});const Re=()=>{const t=T(h(),[]);return e(u,Object.assign({},t))},$e=i(Re,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var Ie=Object.freeze({__proto__:null,Component:Re,Element:$e});const Pe=({onRedirectToOnboarding:t})=>e(m,{onRedirectToOnboarding:t}),Fe=i(Pe,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var Le=Object.freeze({__proto__:null,Component:Pe,Element:Fe});const Ae=()=>e(b,{}),Be=i(Ae,v,{css:{height:"100%",maxWidth:"800px",minWidth:"440px",width:"100%"},resources:{en:a}});var Me=Object.freeze({__proto__:null,Component:Ae,Element:Be});export{xe as T,he as a,be as b,De as c,ze as d,Ie as e,Me as f,Ce as l,de as m,Le as p,Oe as s,Te as t,we as u};
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"@emotion/react/jsx-runtime";import{S as r,c as a,e as s,u as o,M as i,d as l,E as c,f as d,U as p,g,h,i as u,P as b,T as m}from"./use-unit-settings.js";import{T as f,h as C,m as v,r as O,a8 as j,e as y}from"./actions-menu.js";import{k as w,t as x,q as _,T}from"./carrier.js";import{useTranslation as S}from"react-i18next";import{Icon as k,IconSize as D,Select as E,Option as z,Input as R,Popover as $,Typography as I,ButtonIcon as P,Tag as F,TagColor as L}from"@shipengine/giger";import{IconNames as W}from"@shipengine/giger-theme";import{useListCarriers as A,useListLabels as B,useListSalesOrderShipments as M,useListShipments as N}from"@shipengine/react-api";import{D as U,u as K,C as G,S as H,G as q,P as V}from"./suspend-text.js";import{useState as Z,useCallback as J,useRef as Q,useContext as X,createContext as Y}from"react";import{h as ee}from"./vat.js";import{d as te}from"./use-toggle.js";const ne=ee({category:{alignItems:"center",cursor:"pointer",display:"flex",flexDirection:"row",justifyContent:"space-between"},colorPicker:e=>({"&::-webkit-color-swatch":{border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",padding:0},"&::-webkit-color-swatch-wrapper":{padding:0},alignSelf:"center",appearance:"none",background:"none",border:0,cursor:"pointer",height:e.spacing(4.25),outline:"none",width:e.spacing(4.25)}),container:e=>({marginBottom:e.spacing(2)}),input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",padding:e.spacing(1)}),inputContainer:e=>({alignItems:"center",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:`${e.spacing(2)}px 0`}),wrapper:e=>({display:"flex",gap:e.spacing(1)})}),re=({paletteConfig:n,onUpdatePaletteConfig:r,formatKey:a})=>{const[s,o]=Z(new Set),i=e=>{o((t=>{const n=new Set(t);return n.has(e)?new Set([...n].filter((t=>t!==e))):new Set([...n,e])}))},l=J(((e,t,a)=>{const s=(e=>{if(e)return e.match(/^#[0-9A-Fa-f]{0,6}$/)?e:e.match(/^[0-9A-Fa-f]{6}$/)?`#${e}`:void 0})(a),o=Object.assign(Object.assign({},n||{}),{[e]:Object.assign(Object.assign({},(null==n?void 0:n[e])||{}),{[t]:s})});r(o)}),[r,n]);return e("div",Object.assign({"data-test-id":"color-palette-editor"},{children:n&&Object.keys(n).map((r=>t("div",Object.assign({css:ne.container,id:r},{children:[t("div",Object.assign({"aria-expanded":s.has(r),css:ne.category,onClick:e=>{e.preventDefault(),i(r)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),i(r))},role:"button",tabIndex:0},{children:[e("p",{children:w(r)}),e(k,{name:s.has(r)?W.CHEVRON_TOP:W.CHEVRON_BOTTOM,size:D.SIZE_REGULAR})]})),s.has(r)&&Object.keys(n[r]).map((s=>t("div",Object.assign({css:ne.inputContainer,id:"input-container"},{children:[e("label",Object.assign({css:{fontWeight:"bold"},htmlFor:`${r}.${s}`},{children:a(s)})),t("form",Object.assign({css:ne.wrapper},{children:[e("input",{css:ne.input,onChange:e=>{e.preventDefault(),l(r,s,e.target.value)},onKeyDown:e=>{"Enter"===e.key&&e.preventDefault()},type:"text",value:n[r][s]}),e("input",{css:ne.colorPicker,onChange:e=>l(r,s,e.target.value),type:"color",value:n[r][s]})]}))]}),s)))]}),r)))}))},ae=ee({input:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px",maxWidth:e.spacing(16),padding:0}),keys:{fontSize:"16px",fontWeight:"bold",marginTop:"8px"},section:e=>({"& > div:first-child":{flexGrow:3},"& > div:last-child":{flexShrink:1},display:"flex",gap:e.spacing(1),justifyContent:"space-between"}),sectionContainer:e=>({marginBottom:e.spacing(4)}),select:e=>({border:`1px solid ${e.palette.gray.light}`,borderRadius:"4px",color:e.palette.gray.main,fontSize:"14px"})}),se=({onUpdateTypographyConfig:r,typographyConfig:a,formatKey:s})=>{const o=J(((e,t,n)=>{const s=Object.assign(Object.assign({},a||{}),{[e]:Object.assign(Object.assign({},(null==a?void 0:a[e])||{}),{[t]:n})});r(s)}),[r,a]),i=J(((e,t)=>{if(e)return e[t]}),[]),l=(t,n)=>{var r;const s=[{label:"Normal",value:"400"},{label:"Semi Bold",value:"600"},{label:"Bold",value:"700"}],l=null===(r=i(a,t))||void 0===r?void 0:r.fontWeight.toString(),c=void 0!==l?s.find((e=>e.value===l)):void 0;return e(E,Object.assign({css:ae.select,label:"Font Weight",name:"font-weight",onChange:(e,r)=>o(t,n,null==r?void 0:r.value),value:c},{children:s.map((t=>e(z,Object.assign({value:t.value},{children:t.label}),t.value)))}))},c=(t,n)=>{var r;const s=null===(r=i(a,t))||void 0===r?void 0:r.fontSize.replace("px","");return e(R,{"aria-labelledby":`${t}.${n}`,css:ae.input,label:"Font Size(px)",onChange:e=>{e.target.value.match(/^\d{0,2}$/)&&o(t,n,`${e.target.value}px`)},value:s})},d=(t,r)=>{switch(r){case"fontWeight":return e(n,{children:l(t,r)});case"fontSize":return e(n,{children:c(t,r)});default:return null}};return e("div",{children:a&&Object.keys(a).map((n=>t("div",Object.assign({css:ae.sectionContainer},{children:[e("p",Object.assign({css:ae.keys,id:n},{children:s(n)})),e("section",Object.assign({css:ae.section},{children:Object.keys(a[n]).map((t=>e("div",Object.assign({id:`${n}.${t}`},{children:d(n,t)}),t)))}))]}),n)))})},oe=ee({container:e=>({color:e.palette.gray.dark,display:"flex",flexDirection:"column",flexGrow:1,overflow:"hidden",position:"relative"}),content:e=>({display:"flex",flexDirection:"column",gap:e.spacing(3),padding:e.spacing(3)}),copy:e=>({backgroundColor:e.palette.white,borderRadius:"4px",padding:e.spacing(.5)}),drawerHeader:e=>({alignItems:"center",display:"flex",gap:e.spacing(2),justifyContent:"end",width:"50%"}),drawerWrapper:{display:"flex",justifyContent:"space-between",position:"relative"},header:{alignItems:"center",display:"flex",justifyContent:"space-between"},popoverWrapper:e=>({display:"flex",flexDirection:"column",gap:e.spacing(1)}),pre:e=>({backgroundColor:"#FFFFFF66",borderRadius:"8px",fontSize:"14px",padding:e.spacing(.3)}),presetOption:e=>({"&:hover":{backgroundColor:"theme.palette.gray.ultraLight"},backgroundColor:"transparent",borderRadius:"4px",fontSize:"14px",padding:e.spacing(1)}),presetsButton:e=>({"&:hover":{backgroundColor:"#d1d4d7"},backgroundColor:"#E4E5E7",borderRadius:"4px",cursor:"pointer",display:"flex",fontSize:"14px",gap:e.spacing(.5),padding:`${e.spacing(.5)}px ${e.spacing(1)}px`})}),ie=({themeConfig:n,onUpdateThemeConfig:r,presets:a,showDrawer:s})=>{const o=Q(n),[i,l]=Z(!1),c=Object.keys(n).flatMap((e=>{if("components"===e&&n[e]&&"object"==typeof n[e]){return Object.keys(n[e])}return[e]})).map((e=>"palette"===e?{label:"Color Palette",value:"Color Palette"}:{label:w(e),value:w(e)})),[d,p]=Z(c.sort()[0].value),g=e=>x(_(e)),h=Q(null),[u,b]=te(!1),m=e=>{r(e)};return t("div",Object.assign({"aria-label":"Theme Creator",css:oe.container,"data-testid":"theme-creator",role:"region"},{children:[t("div",Object.assign({css:oe.content},{children:[t("div",Object.assign({css:oe.header},{children:[e(f,{onSelectTab:e=>{p(e)},selectedTab:d,tabs:c}),a?t("div",{children:[t("button",Object.assign({"aria-controls":"presets-popover","aria-expanded":u,css:oe.presetsButton,onClick:e=>{e.preventDefault(),b()},ref:h},{children:["Presets",e(k,{name:W.CARET_BOTTOM,size:D.SIZE_SMALL})]})),e($,Object.assign({container:document.querySelector("#theme-creator"),isOpen:u,onClickAway:()=>b(),placement:"bottom-end",reference:h.current},{children:t("div",Object.assign({css:oe.popoverWrapper},{children:[e("button",Object.assign({"aria-label":"Set Default Theme",css:oe.presetOption,onClick:e=>{e.preventDefault(),b(),m(o.current)},role:"menuitem"},{children:"Default"})),a.map((t=>e("button",Object.assign({"aria-label":`Set ${t.presetName} Theme`,css:oe.presetOption,onClick:e=>{e.preventDefault(),b(),m(t.themeConfig)},role:"menuitem"},{children:t.presetName}),t.presetName)))]}))}))]}):e("button",Object.assign({"aria-label":"Set Default Theme",css:oe.presetsButton,onClick:()=>{m(o.current)},role:"menuitem"},{children:"Reset to Default"}))]})),e(I,Object.assign({role:"heading",variant:"heading4"},{children:`${d} Editor`})),((t,n)=>{var a;switch(n){case"Color Palette":return e(re,{formatKey:g,onUpdatePaletteConfig:e=>{r(Object.assign(Object.assign({},t),{palette:e}))},paletteConfig:t.palette});case"Typography":return e(se,{formatKey:g,onUpdateTypographyConfig:e=>{r(Object.assign(Object.assign({},t),{components:Object.assign(Object.assign({},t.components),{Typography:e})}))},typographyConfig:null===(a=t.components)||void 0===a?void 0:a.Typography});default:return null}})(n,d)]})),s&&e(U,Object.assign({"aria-label":"Show themeConfig.js Code Drawer",headerContent:t("div",Object.assign({css:oe.drawerHeader},{children:[e("pre",Object.assign({css:oe.pre},{children:"themeConfig.js"})),s.copyToClipboardText&&e("div",Object.assign({css:oe.copy},{children:e(C,{content:s.copyToClipboardText})}))]})),isOpen:i,toggleDrawer:()=>l(!i)},{children:s.content}))]}))},le=({onRedirectToOnboarding:t})=>e(r,{onRedirectToOnboarding:t}),ce=a(le,v,{resources:{en:s}});var de=Object.freeze({__proto__:null,Component:le,Element:ce});const pe=()=>{const t=T(o(),[]);return e(i,Object.assign({},t))},ge=a(pe,v,{resources:{en:s}});var he=Object.freeze({__proto__:null,Component:pe,Element:ge});const ue=({isModalFullScreen:t})=>{const n=T(l(),[]);return e(c,Object.assign({isModalFullScreen:t},n))},be=a(ue,v,{resources:{en:s}});var me=Object.freeze({__proto__:null,Component:ue,Element:be});const fe=a((({onRowClick:n})=>{const{t:r}=S(["common","list-labels"]),{page:a,pageSize:s,pagerProps:o}=K(),{data:i,isLoading:l}=A(),{data:c,isLoading:d,isError:p,error:g}=B({page:a,pageSize:s}),h=(null==c?void 0:c.labels)?c.labels.filter((e=>e.shipmentId)).map((e=>e.shipmentId)):[],{data:u,isLoading:b}=M({shipmentIds:h});if(d)return e(O,{message:r("loading.labels")});if(p)throw new Error(g.map((e=>e.message)).join(", "));if(!c)throw new Error(r("errorMessages.unableToLoad.labels"));const m=[{headerContent:r("list-labels:headers.labelId"),renderCellContent:t=>e("div",{children:t.labelId})},{headerContent:r("list-labels:headers.created"),renderCellContent:t=>(null==t?void 0:t.shipDate)&&e(G,{date:t.shipDate})},{headerContent:r("list-labels:headers.shipTo"),renderCellContent:t=>{const n=null==u?void 0:u.find((e=>e.shipmentId===t.shipmentId)),r=n&&n.shipTo.addressLine1?e(j,{address:n.shipTo}):"--";return e(H,Object.assign({loading:b},{children:r}))}},{headerContent:r("list-labels:headers.service"),renderCellContent:n=>{if(!l&&i){const r=i.find((e=>e.carrierCode===n.carrierCode));if(r){const a=r.services.find((e=>e.serviceCode===n.serviceCode));if(a)return t("div",{children:[e(y,{carrierCode:n.carrierCode},n.carrierCode)," ",a.name]})}}return t(H,Object.assign({loading:l},{children:["`$",n.carrierCode," - $",n.serviceCode,"`"]}))}},{headerContent:e("div",{"aria-label":r("list-labels:headers.download")}),renderCellContent:t=>"completed"===t.status?e("div",Object.assign({css:{textAlign:"right"}},{children:e(P,{ariaDescribedby:"",children:r("list-labels:actions.download.pdf"),icon:W.DOWNLOAD,onClick:e=>{e.stopPropagation(),window.open(t.labelDownload.pdf)}})})):e("div",Object.assign({css:{textAlign:"right"}},{children:e(F,Object.assign({color:L.INFO},{children:t.status.toLocaleUpperCase()}))}))}];return e(q,{columns:m,data:c.labels,footerContent:e(V,Object.assign({},o,{pagingData:c})),onRowClick:n})}),v,{css:{height:"100%",minWidth:"440px",width:"100%"},resources:{en:s}});var Ce=Object.freeze({__proto__:null,Element:fe});const ve=a((({onRowClick:t,shipmentStatus:n="pending"})=>{const{t:r}=S(["common","list-shipments"]),{page:a,pageSize:s,pagerProps:o}=K(),{data:i,isLoading:l,isError:c,error:d}=N({page:a,pageSize:s,shipmentStatus:n});if(l)return e(O,{message:r("loading.shipments")});if(c)throw new Error(d.map((e=>e.message)).join(", "));if(!i)throw new Error(r("errorMessages.unableToLoad.shipments"));const p=[{headerContent:r("list-shipments:headers.shipmentId"),renderCellContent:t=>e("div",{children:t.shipmentId})},{headerContent:r("list-shipments:headers.shipTo"),renderCellContent:t=>t.shipTo.addressLine1?e(j,{address:t.shipTo}):"--"},{headerContent:r("list-shipments:headers.shipDate"),renderCellContent:t=>t.shipDate?e(G,{date:t.shipDate}):"--"}];return e(q,{columns:p,data:i.shipments,footerContent:e(V,Object.assign({},o,{pagingData:i})),onRowClick:t})}),v,{css:{height:"100%",minWidth:"375px",width:"100%"},resources:{en:s}});var Oe=Object.freeze({__proto__:null,Element:ve});const je=Y(void 0),ye=({children:t,editableTheme:n})=>{const[r,a]=Z(n);return e(je.Provider,Object.assign({value:{setThemeConfig:a,themeConfig:r}},{children:t}))},we=()=>{const e=X(je);if(!e)throw new Error("useThemeConfigurator must be used within a ThemeConfiguratorProvider");return e},xe=t=>{var n=T(t,[]);return e(ie,Object.assign({},n))},_e=a(xe,v,{resources:{en:s}});var Te=Object.freeze({__proto__:null,Component:xe,Element:_e});const Se=()=>{const t=T(d(),[]);return e(p,Object.assign({},t))},ke=a(Se,v,{resources:{en:s}});var De=Object.freeze({__proto__:null,Component:Se,Element:ke});const Ee=({onRedirectToOnboarding:t})=>e(g,{onRedirectToOnboarding:t}),ze=a(Ee,v,{resources:{en:s}});var Re=Object.freeze({__proto__:null,Component:Ee,Element:ze});const $e=()=>{const t=T(h(),[]);return e(u,Object.assign({},t))},Ie=a($e,v,{resources:{en:s}});var Pe=Object.freeze({__proto__:null,Component:$e,Element:Ie});const Fe=({onRedirectToOnboarding:t})=>e(b,{onRedirectToOnboarding:t}),Le=a(Fe,v,{resources:{en:s}});var We=Object.freeze({__proto__:null,Component:Fe,Element:Le});const Ae=()=>e(m,{}),Be=a(Ae,v,{resources:{en:s}});var Me=Object.freeze({__proto__:null,Component:Ae,Element:Be});export{ye as T,he as a,me as b,De as c,Re as d,Pe as e,Me as f,Ce as l,de as m,We as p,Oe as s,Te as t,we as u};
|