-
-
Password Reset Complete
+
+
+
Password Reset Complete
-
Your password has been set.
-
You may go ahead and log in now.
+
Your password has been set.
+
You may go ahead and log in now.
-
+
-
- Sign in
-
+
+ Sign in
+
-
-
+
>
);
}
diff --git a/src/pages/password/reset/index.tsx b/src/pages/password/reset/index.tsx
index ad5422410..61f65c0a2 100644
--- a/src/pages/password/reset/index.tsx
+++ b/src/pages/password/reset/index.tsx
@@ -1,9 +1,7 @@
-import { References } from "@purplship/rest";
import ButtonField from "@/components/generic/button-field";
import InputField from "@/components/generic/input-field";
import SectionLayout from "@/layouts/section-layout";
import LoadingProvider, { Loading } from "@/components/loader";
-import APIReferenceProvider from "@/context/references-provider";
import UserMutation from "@/context/user-mutation";
import { ConfirmPasswordResetInput, confirm_password_reset_confirm_password_reset_errors } from "@purplship/graphql";
import { useRouter } from "next/dist/client/router";
@@ -11,6 +9,7 @@ import Head from "next/head";
import Link from "next/link";
import React, { FormEvent, useContext, useEffect, useReducer, useState } from "react";
import logger from "@/lib/logger";
+import { Metadata } from "@/lib/types";
export { getServerSideProps } from '@/lib/static/references';
@@ -112,19 +111,17 @@ const Component: React.FC<{}> = UserMutation<{}>(({ confirmPasswordReset }) => {
)
});
-export default function Page({ references }: { references: References }) {
+export default function Page({ metadata }: { metadata: Metadata }) {
return (
<>
-
-
- Password Reset - {references?.app_name}
+
+ Password Reset - {metadata?.APP_NAME}
-
-
-
+
+
+
-
-
+
>
)
}
diff --git a/src/pages/password/reset/request.tsx b/src/pages/password/reset/request.tsx
index c127592c7..2dacb0d2c 100644
--- a/src/pages/password/reset/request.tsx
+++ b/src/pages/password/reset/request.tsx
@@ -1,4 +1,3 @@
-import { References } from "@purplship/rest";
import ButtonField from "@/components/generic/button-field";
import SectionLayout from "@/layouts/section-layout";
import LoadingProvider from "@/components/loader";
@@ -10,11 +9,12 @@ import Head from "next/head";
import Link from "next/link";
import React, { FormEvent, useRef } from "react";
import { p } from "@/lib/helper";
+import { Metadata } from "@/lib/types";
export { getServerSideProps } from '@/lib/static/references';
-export default function Page({ references }: { references: References }) {
+export default function Page({ metadata }: { metadata: Metadata }) {
const Component: React.FC<{}> = () => {
const router = useRouter();
@@ -71,16 +71,14 @@ export default function Page({ references }: { references: References }) {
return (
<>
-
-
- Password Reset - {references?.app_name}
+
+ Password Reset - {metadata?.APP_NAME}
-
-
-
+
+
+
-
-
+
>
)
}
diff --git a/src/pages/password/reset/sent.tsx b/src/pages/password/reset/sent.tsx
index 8c6146ae6..c8dda5007 100644
--- a/src/pages/password/reset/sent.tsx
+++ b/src/pages/password/reset/sent.tsx
@@ -1,36 +1,33 @@
-import { References } from "@purplship/rest";
import SectionLayout from "@/layouts/section-layout";
-import APIReferenceProvider from "@/context/references-provider";
import Head from "next/head";
import Link from "next/link";
import React from "react";
+import { Metadata } from "@/lib/types";
export { getServerSideProps } from '@/lib/static/references';
-export default function Page({ references }: { references: References }) {
+export default function Page({ metadata }: { metadata: Metadata }) {
return (
<>
-
-
- Password Reset Sent - {references?.app_name}
+
+ Password Reset Sent - {metadata?.APP_NAME}
-
-
-
Password Reset Sent
+
+
+
Password Reset Sent
-
We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.
-
If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.
+
We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.
+
If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.
-
+
-
- Sign in
-
+
+ Sign in
+
-
-
+
>
);
}
diff --git a/src/pages/signup/index.tsx b/src/pages/signup/index.tsx
index b76d43237..05cc723af 100644
--- a/src/pages/signup/index.tsx
+++ b/src/pages/signup/index.tsx
@@ -1,9 +1,7 @@
-import { References } from "@purplship/rest";
import ButtonField from "@/components/generic/button-field";
import InputField from "@/components/generic/input-field";
import SectionLayout from "@/layouts/section-layout";
import LoadingProvider, { Loading } from "@/components/loader";
-import APIReferenceProvider from "@/context/references-provider";
import UserMutation from "@/context/user-mutation";
import { RegisterUserInput, register_user_register_user_errors } from "@purplship/graphql";
import { NextPage } from "next";
@@ -12,6 +10,7 @@ import Head from "next/head";
import Link from "next/link";
import React, { FormEvent, useContext, useReducer, useState } from "react";
import logger from "@/lib/logger";
+import { Metadata } from "@/lib/types";
export { getServerSideProps } from '@/lib/static/references';
@@ -123,19 +122,17 @@ const Component: React.FC<{}> = UserMutation<{}>(({ registerUser }) => {
)
});
-const SignUp: NextPage
= ({ references }) => {
+const SignUp: NextPage = ({ metadata }) => {
return (
<>
-
-
- Sign Up - {references?.app_name}
+
+ Sign Up - {metadata?.APP_NAME}
-
-
-
+
+
+
-
-
+
>
)
};
diff --git a/src/pages/signup/success.tsx b/src/pages/signup/success.tsx
index 032384acf..5d9412982 100644
--- a/src/pages/signup/success.tsx
+++ b/src/pages/signup/success.tsx
@@ -1,37 +1,34 @@
-import { References } from "@purplship/rest";
import SectionLayout from "@/layouts/section-layout";
-import APIReferenceProvider from "@/context/references-provider";
import { NextPage } from "next";
import Head from "next/head";
import Link from "next/link";
import React from "react";
+import { Metadata } from "@/lib/types";
export { getServerSideProps } from '@/lib/static/references';
-const SignUpSuccess: NextPage = ({ references }) => {
+const SignUpSuccess: NextPage = ({ metadata }) => {
return (
<>
-
-
- Sign Up Success - {references?.app_name}
+
+ Sign Up Success - {metadata?.APP_NAME}
-
-
+
+
-
Your account has been created.
-
Check your registration email inbox to verify the address and activate your account.
+
Your account has been created.
+
Check your registration email inbox to verify the address and activate your account.
-
+
-
- Sign in
-
+
+ Sign in
+
-
-
+
>
)
};
diff --git a/src/pages/tracking/[id].tsx b/src/pages/tracking/[id].tsx
index 26d196963..67d9cc286 100644
--- a/src/pages/tracking/[id].tsx
+++ b/src/pages/tracking/[id].tsx
@@ -1,16 +1,16 @@
-import { References, TrackingEvent, TrackingStatus } from "@purplship/rest";
+import { TrackingEvent, TrackingStatus } from "@purplship/rest";
import { NextPage } from "next";
import Image from 'next/image';
import Head from "next/head";
import React from "react";
import { formatDayDate, isNone, p } from "@/lib/helper";
+import { Metadata } from "@/lib/types";
export { getServerSideProps } from '@/lib/static/tracker';
type DayEvents = { [k: string]: TrackingEvent[] };
-const Tracking: NextPage<{ id: string, references: References, tracker?: TrackingStatus, message?: string }> = ({ references, id, tracker, message }) => {
- const { app_name, app_website } = references || {};
+const Tracking: NextPage<{ id: string, metadata: Metadata, tracker?: TrackingStatus, message?: string }> = ({ metadata, id, tracker, message }) => {
const computeEvents = (tracker: TrackingStatus): DayEvents => {
return (tracker?.events || []).reduce((days, event: TrackingEvent) => {
@@ -21,14 +21,14 @@ const Tracking: NextPage<{ id: string, references: References, tracker?: Trackin
return (
<>
-
Tracking - {tracker?.tracking_number || id} - {app_name}
+
Tracking - {tracker?.tracking_number || id} - {metadata.APP_NAME}
-
+
{!isNone(tracker) && <>
@@ -94,13 +94,11 @@ const Tracking: NextPage<{ id: string, references: References, tracker?: Trackin
>}
- {
- !isNone(message) &&
-
+ {!isNone(message) &&
}
@@ -109,7 +107,7 @@ const Tracking: NextPage<{ id: string, references: References, tracker?: Trackin
diff --git a/src/views/account.tsx b/src/views/account.tsx
index 0e6f47eb7..50216d7dc 100644
--- a/src/views/account.tsx
+++ b/src/views/account.tsx
@@ -16,7 +16,7 @@ export default function AccountPage(pageProps: any) {
const tabs = ['Profile', 'Account'];
const Component: React.FC = () => {
- const { multi_organizations, app_name } = useContext(APIReference);
+ const { MULTI_ORGANIZATIONS, APP_NAME } = useContext(APIReference);
return (
<>
@@ -29,7 +29,7 @@ export default function AccountPage(pageProps: any) {
Profile
-
Your email address is your identity on {app_name} and is used to log in.
+
Your email address is your identity on {APP_NAME} and is used to log in.
@@ -51,7 +51,7 @@ export default function AccountPage(pageProps: any) {
- {multi_organizations && <>
+ {MULTI_ORGANIZATIONS && <>
@@ -81,7 +81,7 @@ export default function AccountPage(pageProps: any) {
return AuthenticatedPage((
- Account Settings - {(pageProps as any).references?.app_name}
+ Account Settings - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/addresses.tsx b/src/views/addresses.tsx
index a99bcb8b3..384321293 100644
--- a/src/views/addresses.tsx
+++ b/src/views/addresses.tsx
@@ -131,7 +131,7 @@ export default function AddressPage(pageProps: any) {
return AuthenticatedPage((
- Address Templates - {(pageProps as any).references?.app_name}
+ Address Templates - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/api.tsx b/src/views/api.tsx
index 35760b525..779180f4d 100644
--- a/src/views/api.tsx
+++ b/src/views/api.tsx
@@ -73,7 +73,7 @@ export default function ApiPage(pageProps: any) {
return AuthenticatedPage((
- API Keys - {(pageProps as any).references?.app_name}
+ API Keys - {(pageProps as any).metadata?.APP_NAME}
), pageProps)
diff --git a/src/views/buy_label.tsx b/src/views/buy_label.tsx
index 90ba3e035..b8fce634d 100644
--- a/src/views/buy_label.tsx
+++ b/src/views/buy_label.tsx
@@ -5,7 +5,7 @@ import AddressForm from '@/components/form-parts/address-form';
import ShipmentOptions from '@/components/form-parts/shipment-options';
import LiveRates from '@/components/live-rates';
import Tabs, { TabStateContext, TabStateProvider } from '@/components/generic/tabs';
-import ShipmentProvider, { LabelData, } from '@/context/shipment-provider';
+import LabelDataProvider, { LabelData, } from '@/context/label-data-provider';
import { DefaultTemplatesData } from '@/context/default-templates-provider';
import { Notify } from '@/components/notifier';
import { AppMode } from '@/context/app-mode-provider';
@@ -168,8 +168,8 @@ export default function LabelPage(pageProps: any) {
return AuthenticatedPage((
- Buy Label - {(pageProps as any).references?.app_name}
-
+ Buy Label - {(pageProps as any).metadata?.APP_NAME}
+
@@ -183,7 +183,7 @@ export default function LabelPage(pageProps: any) {
-
+
), pageProps);
}
diff --git a/src/views/connections.tsx b/src/views/connections.tsx
index be3446822..fcf134c68 100644
--- a/src/views/connections.tsx
+++ b/src/views/connections.tsx
@@ -18,7 +18,7 @@ export { getServerSideProps } from "@/lib/middleware";
export default function ConnectionsPage(pageProps: any) {
- const tabs = ['Your Accounts', `${(pageProps as any).references?.app_name || ''} Accounts`];
+ const tabs = ['Your Accounts', `${(pageProps as any).metadata?.APP_NAME || ''} Accounts`];
const Component: React.FC = () => {
const router = useRouter();
@@ -51,7 +51,7 @@ export default function ConnectionsPage(pageProps: any) {
Carriers
@@ -73,7 +73,7 @@ export default function ConnectionsPage(pageProps: any) {
return AuthenticatedPage((
- Carrier Connections - {(pageProps as any).references?.app_name}
+ Carrier Connections - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/customs-infos.tsx b/src/views/customs-infos.tsx
index eda2f527f..94196c08c 100644
--- a/src/views/customs-infos.tsx
+++ b/src/views/customs-infos.tsx
@@ -133,7 +133,7 @@ export default function CustomsInfoPage(pageProps: any) {
return AuthenticatedPage((
- Customs Templates - {(pageProps as any).references?.app_name}
+ Customs Templates - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/event.tsx b/src/views/event.tsx
index 72b09dfeb..c1a15d236 100644
--- a/src/views/event.tsx
+++ b/src/views/event.tsx
@@ -97,7 +97,7 @@ export const EventComponent: React.FC<{ eventId?: string }> = ({ eventId }) => {
export default function EventPage(pageProps: any) {
return AuthenticatedPage((
- Event - {(pageProps as any).references?.app_name}
+ Event - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/events.tsx b/src/views/events.tsx
index 547c0b7f7..f9f51de85 100644
--- a/src/views/events.tsx
+++ b/src/views/events.tsx
@@ -105,7 +105,7 @@ export default function EventsPage(pageProps: any) {
return AuthenticatedPage((
- Events - {(pageProps as any).references?.app_name}
+ Events - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/log.tsx b/src/views/log.tsx
index 7ac67e0ae..2b222ae79 100644
--- a/src/views/log.tsx
+++ b/src/views/log.tsx
@@ -140,7 +140,7 @@ export default function LogPage(pageProps: any) {
return AuthenticatedPage((
- Log - {(pageProps as any).references?.app_name}
+ Log - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/logs.tsx b/src/views/logs.tsx
index d49b96865..ce7f1e42f 100644
--- a/src/views/logs.tsx
+++ b/src/views/logs.tsx
@@ -121,7 +121,7 @@ export default function LogsPage(pageProps: any) {
return AuthenticatedPage((
- Logs - {(pageProps as any).references?.app_name}
+ Logs - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/order.tsx b/src/views/order.tsx
index 0df27f5e8..d563a11ab 100644
--- a/src/views/order.tsx
+++ b/src/views/order.tsx
@@ -281,7 +281,7 @@ export const OrderComponent: React.FC<{ orderId?: string }> = ({ orderId }) => {
export default function OrderPage(pageProps: any) {
return AuthenticatedPage((
- Order - {(pageProps as any).references?.app_name}
+ Order - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/orders.tsx b/src/views/orders.tsx
index b2ed2ece2..2b5a79e24 100644
--- a/src/views/orders.tsx
+++ b/src/views/orders.tsx
@@ -149,7 +149,7 @@ export default function OrdersPage(pageProps: any) {
return AuthenticatedPage((
- Orders - {(pageProps as any).references?.app_name}
+ Orders - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/parcels.tsx b/src/views/parcels.tsx
index caf68cd90..3acb1415f 100644
--- a/src/views/parcels.tsx
+++ b/src/views/parcels.tsx
@@ -133,7 +133,7 @@ export default function ParcelsPage(pageProps: any) {
return AuthenticatedPage((
- Parcel Templates - {(pageProps as any).references?.app_name}
+ Parcel Templates - {(pageProps as any).metadata?.APP_NAME}
diff --git a/src/views/shipment.tsx b/src/views/shipment.tsx
index 7710cd1a3..dd4312794 100644
--- a/src/views/shipment.tsx
+++ b/src/views/shipment.tsx
@@ -6,7 +6,7 @@ import LabelPrinter, { LabelPrinterContext } from "@/components/label/label-prin
import { Loading } from "@/components/loader";
import StatusBadge from "@/components/status-badge";
import { AppMode } from "@/context/app-mode-provider";
-import ShipmentProvider, { LabelData } from "@/context/shipment-provider";
+import ShipmentProvider, { ShipmentContext } from "@/context/shipment-provider";
import { formatAddressLocation, formatCustomsLabel, formatDate, formatDateTime, formatDateTimeLong, formatDimension, formatParcelLabel, formatRef, formatWeight, isNone, p, shipmentCarrier } from "@/lib/helper";
import { useRouter } from "next/dist/client/router";
import Head from "next/head";
@@ -21,6 +21,7 @@ import Spinner from "@/components/spinner";
import EventsProvider, { EventsContext } from "@/context/events-provider";
import LogsProvider, { LogsContext } from "@/context/logs-provider";
import StatusCode from "@/components/status-code-badge";
+import CarrierBadge from "@/components/carrier-badge";
export { getServerSideProps } from "@/lib/middleware";
@@ -33,17 +34,19 @@ export const ShipmentComponent: React.FC<{ shipmentId?: string }> = ({ shipmentI
const { setLoading } = useContext(Loading);
const { printLabel } = useContext(LabelPrinterContext);
const { printInvoice } = useContext(CustomInvoicePrinterContext);
- const { shipment, loading, called, loadShipment } = useContext(LabelData);
+ const { shipment, loading, called, loadShipment } = useContext(ShipmentContext);
const { id } = router.query;
const buyLabel = (_: React.MouseEvent) => {
- router.push(basePath + '/buy_label/' + shipment.id);
+ router.push(basePath + '/buy_label/' + shipment?.id);
};
useEffect(() => { setLoading(loading); });
useEffect(() => {
- (!loading && loadShipment) && loadShipment((id || shipmentId) as string);
- }, [id || shipmentId]);
+ if (!called && !loading && loadShipment) {
+ loadShipment((id || shipmentId) as string);
+ }
+ }, [called, loading, id || shipmentId]);
useEffect(() => {
if (called && !isNone(shipment)) {
(!logs.called && !logs.loading && logs.load) && logs.load({ first: 6, entity_id: shipment?.id });
@@ -54,9 +57,9 @@ export const ShipmentComponent: React.FC<{ shipmentId?: string }> = ({ shipmentI
return (
<>
- {loading && }
+ {!called && loading && }
- {!loading && !isNone(shipment.id) && <>
+ {(!loading && shipment) && <>
{/* Header Section */}
@@ -106,7 +109,16 @@ export const ShipmentComponent: React.FC<{ shipmentId?: string }> = ({ shipmentI
Courier
-
+ {(!isNone(shipment.carrier_name) && shipment.carrier_name !== 'generic') &&
+
+
}
+ {(!isNone(shipment.carrier_name) && shipment.carrier_name === 'generic') &&
+
}
@@ -312,7 +324,6 @@ export const ShipmentComponent: React.FC<{ shipmentId?: string }> = ({ shipmentI
id={shipment.id}
object_type={MetadataObjectType.shipment}
metadata={shipment.metadata}
- onChange={() => loadShipment(shipment.id)}
>
{({ isEditing, editMetadata }) => (<>
@@ -403,7 +414,7 @@ export const ShipmentComponent: React.FC<{ shipmentId?: string }> = ({ shipmentI
>}
- {called && !loading && isNone(shipment.id) &&
+ {called && !loading && !shipment &&
Uh Oh!
@@ -418,7 +429,7 @@ export const ShipmentComponent: React.FC<{ shipmentId?: string }> = ({ shipmentI
export default function ShipmentPage(pageProps: any) {
return AuthenticatedPage((
- Shipment - {(pageProps as any).references?.app_name}
+ Shipment - {(pageProps as any).metadata?.APP_NAME}