Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

300 unlock 6 shopify customer #301

Merged
merged 20 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2b06b0f
✨ (Multiple files): Enhance header components with dynamic text and c…
sebpalluel Apr 24, 2024
44b7097
✨ (globals.css): Add default height fallback for .off-btn-skeleton
sebpalluel Apr 24, 2024
576472b
✨ (i18n): add jest testing setup and configuration for i18n library
sebpalluel Apr 25, 2024
0e5dd5e
✨ (globals.css, ProfileAvatar.tsx, Avatar.tsx, Text.tsx): Enhance UI …
sebpalluel Apr 25, 2024
e5c62c4
✨ (OffKeyAuth.stories.tsx): Add new story states for Shopify customer…
sebpalluel Apr 25, 2024
ff34d0f
✨ (globals.css, OffKeyAuthSignIn.tsx, OffKeyProfile.tsx, examples.tsx…
sebpalluel Apr 25, 2024
84a00ac
♻️ Refactor auth feature by removing unused components and stories
sebpalluel Apr 25, 2024
d682321
✨ (OffKeyAuth/examples.tsx, OffKeyHeaderConnected/examples.tsx, OffKe…
sebpalluel Apr 25, 2024
144ec43
✨ (OffKeyGate.stories.tsx, OffKeyGate.tsx): Integrate Shopify custome…
sebpalluel Apr 25, 2024
43b1832
✨ (globals.css, OffKeyInfo.tsx): Add `.off-key-info` class for consis…
sebpalluel Apr 25, 2024
5886201
✨ (shopify feature): standardize export syntax and introduce new comp…
sebpalluel Apr 26, 2024
beef849
✨ (Hasura metadata): add remote relationship for shopifyCampaignParam…
sebpalluel Apr 26, 2024
2bf0f25
✨ Use dynamic imports and async functions for Shopify auth, header, a…
sebpalluel Apr 26, 2024
4ec3a8f
✨ Add loading skeleton components for Shopify auth, header, and gate …
sebpalluel Apr 26, 2024
f630df8
✨ (route.ts): add new Shopify customer route handlers for POST and GE…
sebpalluel Apr 26, 2024
2fef9d6
✨ (EventPassList.stories.tsx): streamline story by focusing on releva…
sebpalluel Apr 26, 2024
37af584
✨ (EventPassList.stories.tsx): update storybook stories for EventPass…
sebpalluel Apr 26, 2024
bb12642
♻️ (file-upload/admin): remove errorFilter function from executeJobWi…
sebpalluel Apr 26, 2024
3bb2bb9
♻️ (shopify/index.ts): refactor parameter name from id to customerId …
sebpalluel Apr 26, 2024
80fa18c
♻️ (package.json): refactor build scripts to use `nx run` for clarity…
sebpalluel Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions apps/unlock/app/[locale]/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OffKeyAuthSkelton } from '@features/unlock/shopify';

export default function Loading() {
return <OffKeyAuthSkelton />;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// import { ShopifyAuth } from '@features/unlock/shopify';

import { OffKeyAuth } from '@features/unlock/shopify';
import { messages, type Locale } from '@next/i18n';
import { deepPick } from '@utils';
import { NextIntlClientProvider } from 'next-intl';
import { getShopifyCampaignParametersForNotConnected } from '@features/unlock/shopify-api';
import { Locale } from '@gql/shared/types';
import dynamic from 'next/dynamic';
import { notFound } from 'next/navigation';

interface AuthProps {
params: {
Expand All @@ -12,11 +10,33 @@ interface AuthProps {
};
}

export default function Auth({ params: { locale } }: AuthProps) {
const localeMessages = deepPick(messages[locale], ['Shopify.OffKeyAuth']);
return (
<NextIntlClientProvider locale={locale} messages={localeMessages}>
<OffKeyAuth />
</NextIntlClientProvider>
);
const OffKeyAuth = dynamic(
() => import('@features/unlock/shopify').then((mod) => mod.OffKeyAuth),
{ ssr: false },
);

export default async function Auth({ params: { locale, gateId } }: AuthProps) {
const campaign = await getShopifyCampaignParametersForNotConnected({
gateId,
locale,
});
if (!campaign) {
notFound();
}
const authTexts = campaign.shopifyCampaignTemplate.authTexts;
const props = {
organizerId: campaign.organizerId,
textAuth: {
createNewAccount: authTexts.createNewAccount,
useExistingAccount: authTexts.useExistingAccount,
useAnotherAccount: authTexts.useAnotherAccount,
noMatchingAccount: {
useExistingAccount: authTexts.noMatchingAccountUseExistingAccount,
recoverMyAccount: authTexts.noMatchingAccountRecoverMyAccount,
},
signIn: authTexts.signIn,
},
locale,
};
return <OffKeyAuth {...props} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OffKeyHeaderNotConnectedSkeleton } from '@features/unlock/shopify';

export default function Loading() {
return <OffKeyHeaderNotConnectedSkeleton />;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { OffKeyHeader } from '@features/unlock/shopify';
import { type Locale } from '@next/i18n';
import { getShopifyCampaignParametersForNotConnected } from '@features/unlock/shopify-api';
import { Locale } from '@gql/shared/types';
import dynamic from 'next/dynamic';
import { notFound } from 'next/navigation';

interface HeaderProps {
params: {
Expand All @@ -8,6 +10,34 @@ interface HeaderProps {
};
}

export default function Header({ params }: HeaderProps) {
return <OffKeyHeader title="title" />;
const OffKeyHeaderNotConnected = dynamic(
() =>
import('@features/unlock/shopify').then(
(mod) => mod.OffKeyHeaderNotConnected,
),
{ ssr: false },
);

export default async function Header({
params: { locale, gateId },
}: HeaderProps) {
const campaign = await getShopifyCampaignParametersForNotConnected({
gateId,
locale,
});
if (!campaign) {
notFound();
}
const headerNotConnectedTexts =
campaign.shopifyCampaignTemplate.headerNotConnectedTexts;

const props = {
organizerId: campaign.organizerId,
textHeaderNotConnected: {
customerNotConnected: headerNotConnectedTexts.titleCustomerNotConnected,
customerConnected: headerNotConnectedTexts.titleCustomerConnected,
},
locale,
};
return <OffKeyHeaderNotConnected {...props} />;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// import { ShopifyCard, ShopifyCardHeader } from '@features/unlock/shopify';
import { OffKeyLayout } from '@features/unlock/shopify';
import { messages, type Locale } from '@next/i18n';
import { deepPick } from '@utils';
import { type Locale } from '@next/i18n';

interface LayoutProps {
children: React.ReactNode;
Expand All @@ -19,21 +17,10 @@ export default function Layout({
header,
params: { locale },
}: LayoutProps) {
const localeMessages = deepPick(messages[locale], ['Shopify.Auth']);
return (
<OffKeyLayout header={header}>
{children}
{auth}
</OffKeyLayout>
// <ShopifyCard
// footer={
// <NextIntlClientProvider locale={locale} messages={localeMessages}>
// {auth}
// </NextIntlClientProvider>
// }
// header={<ShopifyCardHeader />}
// >
// {children}
// </ShopifyCard>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OffKeyGateNotConnectedSkeleton } from '@features/unlock/shopify';

export default function Loading() {
return <OffKeyGateNotConnectedSkeleton />;
}
61 changes: 56 additions & 5 deletions apps/unlock/app/[locale]/shopify/[gateId]/(notConnected)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,65 @@
import { OffKeyGateSignIn } from '@features/unlock/shopify';
import { ShopifyCustomerStatus } from '@features/unlock/shopify';
import { getShopifyCampaignParametersForNotConnected } from '@features/unlock/shopify-api';
import { Locale } from '@gql/shared/types';
interface GateSignInProps {
import dynamic from 'next/dynamic';
import { notFound } from 'next/navigation';

const OffKeyGateNotConnected = dynamic(
() =>
import('@features/unlock/shopify').then(
(mod) => mod.OffKeyGateNotConnected,
),
{ ssr: false },
);

interface GateNotConnectedProps {
params: {
locale: Locale;
gateId: string;
};
}

export default function GateSignIn({
export default async function GateSignIn({
params: { locale, gateId },
}: GateSignInProps) {
return <OffKeyGateSignIn gateId={gateId} />;
}: GateNotConnectedProps) {
const campaign = await getShopifyCampaignParametersForNotConnected({
gateId,
locale,
});
if (!campaign) {
notFound();
}
const gateNotConnectedTexts =
campaign.shopifyCampaignTemplate.gateNotConnectedTexts;
const props = {
organizerId: campaign.organizerId,
textGateNotConnected: {
subtitle: {
[ShopifyCustomerStatus.NotConnected]:
gateNotConnectedTexts.subtitleCustomerNotConnected,
[ShopifyCustomerStatus.ExistingAccountNewCustomer]:
gateNotConnectedTexts.subtitleExistingAccountNewCustomer,
[ShopifyCustomerStatus.NewAccount]:
gateNotConnectedTexts.subtitleNewAccount,
[ShopifyCustomerStatus.MatchingAccount]:
gateNotConnectedTexts.subtitleMatchingAccount,
[ShopifyCustomerStatus.NoMatchingAccount]:
gateNotConnectedTexts.subtitleNoMatchingAccount,
},
mainText: {
[ShopifyCustomerStatus.NotConnected]:
gateNotConnectedTexts.paragraphCustomerNotConnected,
[ShopifyCustomerStatus.ExistingAccountNewCustomer]:
gateNotConnectedTexts.paragraphExistingAccountNewCustomer,
[ShopifyCustomerStatus.NewAccount]:
gateNotConnectedTexts.paragraphNewAccount,
[ShopifyCustomerStatus.MatchingAccount]:
gateNotConnectedTexts.paragraphMatchingAccount,
[ShopifyCustomerStatus.NoMatchingAccount]:
gateNotConnectedTexts.paragraphNoMatchingAccount,
},
},
locale,
};
return <OffKeyGateNotConnected className="flex-1 py-2" {...props} />;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import {
OffKeyHeaderConnected,
OffKeyViewHeaderConnected,
} from '@features/unlock/shopify';
import { messages, type Locale } from '@next/i18n';
import { deepPick } from '@utils';
import { NextIntlClientProvider } from 'next-intl';
import { OffKeyViewHeaderConnected } from '@features/unlock/shopify';
import { getShopifyCampaignParametersForConnected } from '@features/unlock/shopify-api';
import { Locale } from '@gql/shared/types';
import dynamic from 'next/dynamic';
import { notFound } from 'next/navigation';

interface HeaderProps {
params: {
Expand All @@ -19,19 +16,46 @@ const OffKeyProfile = dynamic(
() => import('@features/unlock/shopify').then((mod) => mod.OffKeyProfile),
{ ssr: false },
);
const OffKeyHeaderConnected = dynamic(
() =>
import('@features/unlock/shopify').then((mod) => mod.OffKeyHeaderConnected),
{ ssr: false },
);

export default function Header({
export default async function Header({
params: { locale, gateId, address },
}: HeaderProps) {
const localeMessages = deepPick(messages[locale], ['Shopify.OffKeyProfile']);
const campaign = await getShopifyCampaignParametersForConnected({
gateId,
locale,
});
if (!campaign) {
notFound();
}
const headerConnectedTexts =
campaign.shopifyCampaignTemplate.headerConnectedTexts;
const headerProps = {
organizerId: campaign.organizerId,
textHeaderConnected: {
default: headerConnectedTexts.titleDefault,
howToGet: headerConnectedTexts.titleHowToGet,
},
locale,
};
const profileTexts = campaign.shopifyCampaignTemplate.profileTexts;
const profileProps = {
organizerId: campaign.organizerId,
textProfile: {
myAccount: profileTexts.menuSectionMyAccount,
signOut: profileTexts.menuActionSignOut,
},
locale,
};
return (
<OffKeyHeaderConnected
{...headerProps}
viewType={OffKeyViewHeaderConnected.Default}
profile={
<NextIntlClientProvider locale={locale} messages={localeMessages}>
<OffKeyProfile user={{ id: '', address }} />
</NextIntlClientProvider>
}
profile={<OffKeyProfile {...profileProps} user={{ id: '', address }} />}
/>
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { ShopifyCard, ShopifyCardHeader } from '@features/unlock/shopify';
import { OffKeyLayout } from '@features/unlock/shopify';
import { type Locale } from '@next/i18n';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { OffKeyGateSkeleton } from '@features/unlock/shopify';

export default function Loading() {
return <OffKeyGateSkeleton />;
}
55 changes: 42 additions & 13 deletions apps/unlock/app/[locale]/shopify/[gateId]/[address]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { messages, type Locale } from '@next/i18n';
import { deepPick } from '@utils';
import { NextIntlClientProvider } from 'next-intl';
import { getShopifyCampaignParametersForConnected } from '@features/unlock/shopify-api';
import { Locale } from '@gql/shared/types';
import { OffKeyState } from '@next/iframe';
import dynamic from 'next/dynamic';
import { notFound } from 'next/navigation';

interface GateProps {
params: {
Expand All @@ -16,16 +17,44 @@ const OffKeyGate = dynamic(
{ ssr: false },
);

export default function Gate({
export default async function Gate({
params: { locale, gateId, address },
}: GateProps) {
const localeMessages = deepPick(messages[locale], [
'Shopify.OffKeyGate',
'Shopify.OffKeyInfo',
]);
return (
<NextIntlClientProvider locale={locale} messages={localeMessages}>
<OffKeyGate className="flex-1 pt-2" gateId={gateId} address={address} />
</NextIntlClientProvider>
);
const campaign = await getShopifyCampaignParametersForConnected({
gateId,
locale,
});
if (!campaign) {
notFound();
}
const gateConnectedTexts =
campaign.shopifyCampaignTemplate.gateConnectedTexts;
const props = {
organizerId: campaign.organizerId,
textGate: {
subtitle: {
[OffKeyState.Unlocked]: gateConnectedTexts.subtitleUnlocked,
[OffKeyState.Unlocking]: gateConnectedTexts.subtitleUnlocking,
[OffKeyState.Used]: gateConnectedTexts.subtitleUsed,
[OffKeyState.Locked]: gateConnectedTexts.subtitleLocked,
},
mainText: {
[OffKeyState.Unlocked]: gateConnectedTexts.paragraphUnlocked,
[OffKeyState.Unlocking]: gateConnectedTexts.paragraphUnlocking,
[OffKeyState.Used]: gateConnectedTexts.paragraphUsed,
[OffKeyState.Locked]: gateConnectedTexts.paragraphLocked,
},
key: {
statusText: {
[OffKeyState.Unlocked]: gateConnectedTexts.gateStatus.unlocked,
[OffKeyState.Unlocking]: gateConnectedTexts.gateStatus.unlocking,
[OffKeyState.Used]: gateConnectedTexts.gateStatus.used,
[OffKeyState.Locked]: gateConnectedTexts.gateStatus.locked,
},
name: gateConnectedTexts.gateStatus.name,
},
},
locale,
};
return <OffKeyGate className="flex-1 pt-2" {...props} />;
}
Loading
Loading