Skip to content

Instantly share code, notes, and snippets.

@jay-babu
Created September 23, 2025 20:43
Show Gist options
  • Select an option

  • Save jay-babu/ed00437fa0c0cc166f9ffd7806586d58 to your computer and use it in GitHub Desktop.

Select an option

Save jay-babu/ed00437fa0c0cc166f9ffd7806586d58 to your computer and use it in GitHub Desktop.
diff --git a/.prettierrc.json b/.prettierrc.json
index 55c1943a..fc362149 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -1,3 +1,3 @@
{
- "plugins": ["prettier-plugin-organize-imports"]
+ "plugins": ["@prettier/plugin-oxc", "prettier-plugin-organize-imports"]
}
diff --git a/POSServiceModel b/POSServiceModel
index 7223445f..d732267c 160000
--- a/POSServiceModel
+++ b/POSServiceModel
@@ -1 +1 @@
-Subproject commit 7223445f5c6d24db99297e02cc31d592c5a1b8ac
+Subproject commit d732267c11242488a61ec7697e50151c7a2aa438
diff --git a/index.ts b/index.ts
index 1f8eab0f..6d6bc6c5 100644
--- a/index.ts
+++ b/index.ts
@@ -248,6 +248,7 @@ frontend:
SENTRY_AUTH_TOKEN:
"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",
VITE_APP_API_URL: "https://beta.production.api.transformity.tech",
+ VITE_APP_PHOENIX_URL: "https://d1la6gp2rlyhl5.cloudfront.net",
VITE_APP_SALE_API_URL: "https://beta.sale.api.transformity.tech",
VITE_APP_WEBSOCKET_URL:
"wss://7c0kxkslb9.execute-api.us-east-1.amazonaws.com/$default/",
@@ -278,23 +279,23 @@ frontend:
"pos-frontend-amplify-prod",
{
buildSpec: `version: 1
- frontend:
- phases:
- preBuild:
- commands:
- - export NODE_OPTIONS=--max-old-space-size=8192
- - npm ci --cache .npm --prefer-offline
- build:
- commands:
- - npm run build
- artifacts:
- baseDirectory: build
- files:
- - '**/*'
- paths:
- - .npm/**/*
- - node_modules/**/*
- - node_modules/.vite/**/* # Vite
+frontend:
+ phases:
+ preBuild:
+ commands:
+ - export NODE_OPTIONS=--max-old-space-size=8192
+ - npm ci --cache .npm --prefer-offline
+ build:
+ commands:
+ - npm run build
+ artifacts:
+ baseDirectory: build
+ files:
+ - '**/*'
+ paths:
+ - .npm/**/*
+ - node_modules/**/*
+ - node_modules/.vite/**/* # Vite
`,
cacheConfig: {
type: "AMPLIFY_MANAGED",
@@ -334,6 +335,7 @@ frontend:
VITE_APP_SALE_API_URL: "https://api.transformity.tech",
VITE_APP_WEBSOCKET_URL:
"wss://7c0kxkslb9.execute-api.us-east-1.amazonaws.com/$default/",
+ VITE_APP_PHOENIX_URL: "https://d1la6gp2rlyhl5.cloudfront.net",
VITE_APP_ZEUS_URL: "https://zeus.usemargin.com",
_LIVE_UPDATES: JSON.stringify([
{
@@ -361,6 +363,15 @@ frontend:
}
};
+const getCookieStackName = (stack: string) => {
+ switch (stack) {
+ case "beta":
+ return "prod";
+ default:
+ return stack;
+ }
+};
+
const amplify = getAmplify(stack);
const branches = getBranches(stack, amplify.id);
@@ -765,7 +776,7 @@ const distribution = new aws.cloudfront.Distribution(
customHeaders: [
{
name: "X-Stack-Name",
- value: stack,
+ value: getCookieStackName(stack),
},
{
name: "X-Amplify-Branch-Mappings",
diff --git a/package.json b/package.json
index d5db9a47..0e944991 100644
--- a/package.json
+++ b/package.json
@@ -151,7 +151,7 @@
"test-storybook": "test-storybook"
},
"lint-staged": {
- "**/*": "prettier --write --ignore-unknown"
+ "**/*": "prettier --write --experimental-cli --ignore-unknown"
},
"browserslist": {
"production": [
@@ -182,6 +182,7 @@
"@kubb/swagger-tanstack-query": "^2.28.4",
"@kubb/swagger-ts": "^2.28.4",
"@mixer/parallel-prettier": "^2.0.3",
+ "@prettier/plugin-oxc": "^0.0.4",
"@pulumi/aws": "^7.0.0",
"@pulumi/awsx": "^3.0.0",
"@pulumi/pulumi": "^3.113.0",
@@ -220,12 +221,12 @@
"http-server": "^14.1.1",
"husky": "^8.0.3",
"jsdom": "^24.1.0",
- "lint-staged": "^13.2.3",
+ "lint-staged": "^15.5.2",
"msw": "2.8.4",
"msw-storybook-addon": "2.0.3",
"postcss": "^8.4.35",
"prettier": "^3.6.0",
- "prettier-plugin-organize-imports": "^3.2.4",
+ "prettier-plugin-organize-imports": "^4.3.0",
"prop-types": "^15.8.1",
"storybook": "^8.1.0",
"tailwindcss": "^3.4.1",
@@ -233,7 +234,7 @@
"tsx": "^4.20.5",
"vite-plugin-checker": "^0.6.4",
"vite-plugin-eslint": "^1.8.1",
- "vite-plugin-pwa": "^0.20.5",
+ "vite-plugin-pwa": "^1.0.3",
"vitest": "^3.1.4",
"wait-on": "^7.2.0",
"webpack": "^5.89.0",
diff --git a/src/codegen/kubb/templates/templates.tsx b/src/codegen/kubb/templates/templates.tsx
index 9abc74eb..41d4333a 100644
--- a/src/codegen/kubb/templates/templates.tsx
+++ b/src/codegen/kubb/templates/templates.tsx
@@ -35,6 +35,7 @@ export const templates = {
const clientOptions = [
`method: "${client.method}"`,
`url: ${client.path.template}`,
+ `signal: signal`,
client.withQueryParams && !infinite ? "params" : undefined,
client.withData && !isFormData ? "data" : undefined,
client.withData && isFormData ? "data: formData" : undefined,
@@ -106,7 +107,7 @@ export const templates = {
return infiniteQueryOptions({
queryKey,
- queryFn: async ({ pageParam }) => {
+ queryFn: async ({ pageParam, signal }) => {
${hook.children || ""}
${formData || ""}
const res = await client<${client.generics}>({
@@ -137,7 +138,7 @@ export const templates = {
return {
queryKey,
- queryFn: async ({ pageParam }) => {
+ queryFn: async ({ pageParam, signal }) => {
${hook.children || ""}
${formData || ""}
const res = await client<${client.generics}>({
@@ -162,7 +163,7 @@ export const templates = {
return queryOptions({
queryKey,
- queryFn: async () => {
+ queryFn: async ({signal}) => {
${hook.children || ""}
${formData || ""}
const res = await client<${client.generics}>({
@@ -193,7 +194,7 @@ export const templates = {
return {
queryKey,
- queryFn: async () => {
+ queryFn: async ({signal}) => {
${hook.children || ""}
${formData || ""}
const res = await client<${client.generics}>({
diff --git a/src/components/NewItem.tsx b/src/components/NewItem.tsx
index ce5559b1..3ba5b414 100644
--- a/src/components/NewItem.tsx
+++ b/src/components/NewItem.tsx
@@ -49,7 +49,9 @@ const NewItem = ({ onSubmit, giftCardDisclosure }: NewItemProps) => {
setPrice(1);
setBottleFeeMulti(0);
setEnvFeeMulti(0);
- setSelectedDepartment(departments.get("Misc"));
+ setSelectedDepartment(
+ departments.get("Misc") || departments.values().next().value,
+ );
},
});
diff --git a/src/pages/Settings/AboutStore/AboutStorePanel.tsx b/src/pages/Settings/AboutStore/AboutStorePanel.tsx
index 9f2d2129..8a5449a3 100644
--- a/src/pages/Settings/AboutStore/AboutStorePanel.tsx
+++ b/src/pages/Settings/AboutStore/AboutStorePanel.tsx
@@ -28,6 +28,7 @@ import { useEntitySelected } from "context/EntityProvider";
import { usePermissions } from "context/PermissionsContext";
import { useDocumentTitle } from "hooks/useDocumentTitle";
import { CreditCard, Receipt } from "lucide-react";
+import { useMemo } from "react";
import { ControllerRenderProps, FieldPath, useForm } from "react-hook-form";
import { usePatchEntity } from "src/spring-generated";
import { useGenerateEntitySubscriptionPaymentLink } from "src/spring-generated/hooks/useGenerateEntitySubscriptionPaymentLink";
@@ -62,10 +63,21 @@ export const AboutStorePanel = () => {
const [entity, refreshEntity] = useEntitySelected();
const { toast } = useToast();
const { hasPermission } = usePermissions();
- const hasSubscriptionReadStatusPermission =
- hasPermission("esub/*:read_status");
- const hasSubscriptionReadPaymentLinkPermission = hasPermission(
- "esub/*:read_payment_link",
+ const hasSubscriptionReadStatusPermission = useMemo(
+ () =>
+ hasPermission("esub/*:read_status") &&
+ entity.subscriptionId !== undefined &&
+ entity.subscriptionId !== null &&
+ entity.subscriptionId !== "",
+ [hasPermission, entity?.subscriptionId],
+ );
+ const hasSubscriptionReadPaymentLinkPermission = useMemo(
+ () =>
+ hasPermission("esub/*:read_payment_link") &&
+ entity.customerId !== undefined &&
+ entity.customerId !== null &&
+ entity.customerId !== "",
+ [hasPermission, entity?.customerId],
);
const { mutateAsync: patchEntity, isPending } = usePatchEntity({
@@ -480,6 +492,19 @@ const BillingSection = ({
mutation: {
onSuccess: (paymentUrl) => {
// Open payment link in new tab
+ if (
+ paymentUrl === "" ||
+ paymentUrl === null ||
+ paymentUrl === undefined
+ ) {
+ toast({
+ title: "Error generating payment link",
+ description:
+ "Please contact DrinksPOS Support. Your customer id may not be set in our system yet.",
+ variant: "destructive",
+ });
+ return;
+ }
window.open(paymentUrl, "_blank");
},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment