Skip to content

Commit

Permalink
Merge pull request #1499 from ThatConference/next/feature
Browse files Browse the repository at this point in the history
Promote Next/feature to production
  • Loading branch information
brettski authored Nov 8, 2023
2 parents b471a34 + 81ce058 commit 96e0ecf
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 130 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "that-us",
"version": "3.16.1",
"version": "3.16.2",
"description": "THAT.us website",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -97,7 +97,7 @@
"uuid": "^9.0.1",
"vite": "^4.3.9",
"vite-plugin-sentry": "^1.3.0",
"xstate": "^4.38.2",
"xstate": "^4.38.3",
"yup": "^0.32.11",
"zod": "^3.21.4"
},
Expand Down
1 change: 1 addition & 0 deletions src/_dataSources/api.that.tech/events/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const productBaseFieldsFragment = `
price
isEnabled
uiReference
eventActivities
shortDescription
onSaleFrom
onSaleUntil
Expand Down
27 changes: 24 additions & 3 deletions src/_utils/claimTicket/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function createConfig(metaContext) {
eventId: undefined,
productId: undefined,
pendingClaim: false,
claimResults: undefined
claimResults: undefined,
ticketType: undefined
},
states: {
verification: {
Expand Down Expand Up @@ -71,7 +72,7 @@ function createConfig(metaContext) {
onDone: [
{
cond: 'wasTicketClaimed',
actions: ['claimTicketSuccess', 'clearCart', 'clearLocalStorage'],
actions: ['claimTicketSuccess'],
target: 'ticketClaimed'
},
{
Expand All @@ -83,7 +84,27 @@ function createConfig(metaContext) {
},

ticketClaimed: {
entry: 'redirectToSuccess'
entry: ['clearCart', 'clearLocalStorage'],
initial: 'initial',
states: {
initial: {
always: [
{
cond: 'isExpoHallTicket',
target: 'expoHall'
},
{
target: 'defaultRedirect'
}
]
},
expoHall: {
entry: 'expoHallRedirect'
},
defaultRedirect: {
entry: 'defaultRedirect'
}
}
},

ticketClaimIssue: {},
Expand Down
48 changes: 39 additions & 9 deletions src/_utils/claimTicket/machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ const claimCartVersion = '1.0.0';

function createServices() {
const { claimTicket } = orderMutationApi();
const TICKET_TYPE = {
EXPO_HALL: 'expoHall',
OTHER: 'other'
};

return {
guards: {
isPendingClaim: (context) => context.pendingClaim,
wasTicketClaimed: (_, { data }) => data.result
wasTicketClaimed: (_, { data }) => data.result,
isExpoHallTicket: (context) => context?.ticketType === TICKET_TYPE.EXPO_HALL
},

services: {
Expand All @@ -39,23 +44,30 @@ function createServices() {
const localCart = browser ? window.localStorage.getItem(claimCartKeyName) : null;
const results = JSON.parse(localCart) || {};

const { eventId = undefined, productId = undefined, eventDetails = undefined } = results;
const {
eventId = undefined,
productId = undefined,
eventDetails = undefined,
productDetails = undefined
} = results;
return {
eventId,
eventDetails,
productId,
productDetails,
pendingClaim: eventId && productId ? true : false
};
}),

setLocalStorage: (context) => {
const { eventId, productId, eventDetails } = context;
const { eventId, productId, eventDetails, productDetails } = context;

const localCart = {
version: claimCartVersion,
eventId,
eventDetails,
productId
productId,
productDetails
};

window.localStorage.setItem(claimCartKeyName, JSON.stringify(localCart));
Expand All @@ -65,7 +77,8 @@ function createServices() {
pendingClaim: () => false,
eventId: () => undefined,
eventDetails: () => undefined,
productId: () => undefined
productId: () => undefined,
productDetails: () => undefined
}),

clearLocalStorage: () => window.localStorage.removeItem(claimCartKeyName),
Expand All @@ -77,18 +90,35 @@ function createServices() {
? {
logo: event.eventDetails.logo,
name: event.eventDetails.name,
slug: event.eventDetails.slug
slug: event.eventDetails.slug,
type: event.eventDetails.type
}
: context.eventDetails,
eventId: (context, event) => context.eventId || event.eventId,
productId: (context, event) => context.productId || event.productId
productId: (context, event) => context.productId || event.productId,
productDetails: (context, event) =>
event.productDetails
? {
name: event.productDetails.name,
eventActivities: event.productDetails.eventActivities,
uiReference: event.productDetails.uiReference
}
: context.productDetails
}),

claimTicketSuccess: assign({
claimResults: (_, { data }) => data.results
claimResults: (_, { data }) => data.results,
ticketType: ({ productDetails }) => {
let ticketType = TICKET_TYPE.OTHER;
if (productDetails?.eventActivities?.includes('EXPO_HALL')) {
ticketType = TICKET_TYPE.EXPO_HALL;
}
return ticketType;
}
}),

redirectToSuccess: () => goto('/orders/success/claim-ticket/')
defaultRedirect: () => goto('/orders/success/claim-ticket/'),
expoHallRedirect: () => goto('/orders/success/expo-hall-ticket')
}
};
}
Expand Down
3 changes: 2 additions & 1 deletion src/routes/events/(online)/[event]/[date]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
const ticket = {
eventId: event.id,
eventDetails: event,
productId: product.id
productId: product.id,
productDetails: product
};
claimTicket.send('ADD_ITEM', ticket);
Expand Down
120 changes: 60 additions & 60 deletions src/routes/events/(online)/_components/EventTicket.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@
dayjs.extend(advancedFormat);
const tickets = event.products
.filter((f) => f.isEnabled)
.filter((e) => e.productType === 'TICKET');
.filter((f) => f.isEnabled === true && f.productType === 'TICKET')
// if claimable_ticket don't filter in if eventActivities includes expo hall
.filter((e) =>
e.uiReference === 'CLAIMABLE_TICKET' ? !e.eventActivities?.includes('EXPO_HALL') : true
);
const eventTickets = keyBy(
tickets.filter((t) => t.uiReference),
(i) => i.uiReference
);
const claimableTicket = eventTickets['CLAIMABLE_TICKET'] ?? {};
const dispatch = createEventDispatcher();
</script>
Expand All @@ -52,68 +57,63 @@
<div
class="relative mt-12 flex flex-col space-y-10 lg:mt-24 lg:flex-row lg:space-x-10 lg:space-y-0">
<div class="flex flex-col rounded-xl shadow-lg">
<div class="bg-white px-6 py-8 sm:p-10 sm:pb-6">
<div class="inline-flex items-center">
<div>
<span
class="rounded-full bg-thatOrange-400 px-4 py-1 text-sm font-semibold uppercase leading-5 tracking-wide text-white">
THAT Online - Event Ticket
</span>
{#if claimableTicket.id}
<div class="flex flex-col rounded-xl shadow-lg">
<div class="bg-white px-6 py-8 sm:p-10 sm:pb-6">
<div class="inline-flex items-center">
<div>
<span
class="rounded-full bg-thatOrange-400 px-4 py-1 text-sm font-semibold uppercase leading-5 tracking-wide text-white">
THAT Online - Event Ticket
</span>
</div>
</div>
<div class="mt-4 flex items-baseline text-6xl font-extrabold">Free</div>
<p class="mt-5 text-lg text-gray-500">
{event.name}
</p>
<p class="text-lg text-gray-500">
{dayjs(event.startDate).format('dddd, MMMM D, YYYY - h:mm A z')}
</p>
<p class="mt-6 text-lg text-gray-500">
{claimableTicket.description}
</p>
</div>
<div class="mt-4 flex items-baseline text-6xl font-extrabold">
{#if eventTickets['CLAIMABLE_TICKET']?.price === 0}
Free
{:else}
${eventTickets['CLAIMABLE_TICKET']?.price ?? 15}
<span class="ml-1 text-2xl font-medium text-gray-500"> USD </span>
{/if}
</div>
<p class="mt-5 text-lg text-gray-500">
{event.name}
</p>
<p class="text-lg text-gray-500">
{dayjs(event.startDate).format('dddd, MMMM D, YYYY - h:mm A z')}
</p>
<p class="mt-6 text-lg text-gray-500">
{eventTickets['VIRTUAL_CAMPER'].description}
</p>
</div>
<div
class="flex flex-1 flex-col justify-between space-y-6 bg-gray-50 px-6 pb-8 pt-6 sm:p-10 sm:pt-6">
<ul class="space-y-4">
<li class="flex items-start">
<div class="flex-shrink-0">
<span class="text-green-500"><Check /></span>
</div>
<p class="ml-3 text-base text-gray-700">Full Access All Day</p>
</li>
<div
class="flex flex-1 flex-col justify-between space-y-6 bg-gray-50 px-6 pb-8 pt-6 sm:p-10 sm:pt-6">
<ul class="space-y-4">
<li class="flex items-start">
<div class="flex-shrink-0">
<span class="text-green-500"><Check /></span>
</div>
<p class="ml-3 text-base text-gray-700">Full Access All Day</p>
</li>
<li class="flex items-start">
<div class="flex-shrink-0">
<span class="text-green-500"><Check /></span>
</div>
<p class="ml-3 text-base text-gray-700">Create and Facilitate Activities</p>
</li>
<li class="flex items-start">
<div class="flex-shrink-0">
<span class="text-green-500"><Check /></span>
</div>
<p class="ml-3 text-base text-gray-700">Create and Facilitate Activities</p>
</li>
<li class="flex items-start">
<div class="flex-shrink-0">
<span class="text-green-500"><Check /></span>
</div>
<p class="ml-3 text-base text-gray-700">Join Any Activity</p>
</li>
</ul>
<li class="flex items-start">
<div class="flex-shrink-0">
<span class="text-green-500"><Check /></span>
</div>
<p class="ml-3 text-base text-gray-700">Join Any Activity</p>
</li>
</ul>
<StandardButton
on:click={() =>
dispatch('claim-ticket', {
product: { id: eventTickets['CLAIMABLE_TICKET']?.id ?? '' }
})}>
Claim Your Ticket
</StandardButton>
<StandardButton
on:click={() =>
dispatch('claim-ticket', {
product: { ...claimableTicket }
})}>
Claim Your Ticket
</StandardButton>
</div>
</div>
</div>
{/if}
<div class="flex flex-col rounded-xl shadow-lg">
<div class="bg-white px-6 py-8 sm:p-10 sm:pb-6">
Expand All @@ -135,7 +135,7 @@
<p class="text-lg text-gray-500">
{dayjs(event.startDate).format('dddd, MMMM D, YYYY - h:mm A z')}
</p>
<p class="mt-6 text-lg text-gray-500">
<p class="mt-6 text-lg text-gray-500">
{eventTickets['VIRTUAL_CAMPER'].description}
</p>
</div>
Expand Down Expand Up @@ -177,7 +177,7 @@
</div>
</div>
<div class="relative mt-12 lg:mt-24">
<div class="relative mt-12 lg:mt-24">
<div class="flex flex-col">
<h3 class="text-2xl font-extrabold tracking-tight text-thatBlue-800 sm:text-3xl">
Built to support the practitioners
Expand Down
Loading

1 comment on commit 96e0ecf

@vercel
Copy link

@vercel vercel bot commented on 96e0ecf Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.