Skip to content

Commit 69dd1a0

Browse files
densumeshcdxker
authored andcommitted
cleanup: move pricing page url to env
1 parent 5374a61 commit 69dd1a0

8 files changed

Lines changed: 19 additions & 12 deletions

File tree

.env.server

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ AWS_REGION_CSVJSONL=us-west-1
6969
BATCH_ETL_URL="http://localhost:8082"
7070
HIGHLIGHT_TIMEOUT_MS=500
7171
PREMIUM_ORGANIZATION_UUIDS=""
72+
SHOPIFY_SECRET_KEY=
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
SHOPIFY_API_KEY=35eede841ebb457fb68f6eada8e1d780
3+
SHOPIFY_TRIEVE_PDP_QUESTIONS_ID=51815e62-ddad-408b-afb9-6f804648f89f
4+
SHOPIFY_GLOBAL_COMPONENT_ID=6c762bf0-fbc4-47bd-9370-514048760d5c

clients/trieve-shopify-extension/.env.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ SHOPIFY_API_KEY=
33
REMIX_SERVER_URL=http://localhost:49345
44
TRIEVE_BASE_URL=http://localhost:8090
55
SHOPIFY_THEME_APP_EXTENSION_UUID=f76c64354373934b7e5b794c7070f51a
6+
SHOPIFY_PRICING_URL="shopify://admin/charges/densumes-trieve-extension/pricing_plans?test=true"
7+
SHOPIFY_SECRET_KEY=

clients/trieve-shopify-extension/app/context/trieveContext.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ export const TrieveContext = createContext<{
1717
dataset: Dataset;
1818
trieveKey: StrongTrieveKey;
1919
organization: OrganizationWithSubAndPlan;
20+
refetch: () => void;
2021
}>({
2122
trieve: null as any,
2223
dataset: null as any,
2324
trieveKey: null as any,
2425
organization: null as any,
26+
refetch: null as any,
2527
});
2628

2729
export const TrieveProvider = ({
@@ -67,7 +69,7 @@ export const TrieveProvider = ({
6769

6870
return (
6971
<TrieveContext.Provider
70-
value={{ trieve, dataset, trieveKey, organization }}
72+
value={{ trieve, dataset, trieveKey, organization, refetch: queryClient.refetchQueries }}
7173
>
7274
{children}
7375
</TrieveContext.Provider>

clients/trieve-shopify-extension/app/routes/app._dashboard._index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const action = async ({ request }: ActionFunctionArgs) => {
5454
const action = formData.get("action");
5555
if (action === "modify") {
5656
return redirect(
57-
`shopify://admin/charges/densumes-trieve-extension/pricing_plans?test=true`,
57+
process.env.SHOPIFY_PRICING_URL || "",
5858
{
5959
target: "_top",
6060
},
@@ -72,7 +72,7 @@ export const action = async ({ request }: ActionFunctionArgs) => {
7272
};
7373

7474
export default function Dashboard() {
75-
const { organization, trieve } = useTrieve();
75+
const { organization, trieve, refetch: refetchTrieve } = useTrieve();
7676
const [filters, setFilters] = useState(defaultSearchAnalyticsFilter);
7777
const [granularity, setGranularity] = useState<Granularity>("day");
7878
const [showCancelModal, setShowCancelModal] = useState(false);
@@ -157,6 +157,9 @@ export default function Dashboard() {
157157
method: "post",
158158
});
159159
setShowCancelModal(false);
160+
setTimeout(() => {
161+
refetchTrieve();
162+
}, 5000);
160163
}}>Cancel Subscription</Button>
161164
</div>
162165
</Modal>

server/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,10 @@ pub fn main() -> std::io::Result<()> {
964964
web::resource("user_event")
965965
.route(web::post().to(handlers::shopify_handler::send_shopify_user_event))
966966
)
967+
.service(
968+
web::resource("plan_change")
969+
.route(web::post().to(handlers::payment_handler::handle_shopify_plan_change))
970+
)
967971
)
968972
.service(
969973
web::scope("/dataset")
@@ -1378,13 +1382,6 @@ pub fn main() -> std::io::Result<()> {
13781382
.route(web::get().to(handlers::invitation_handler::get_invitations)),
13791383
),
13801384
)
1381-
.service(
1382-
web::scope("/shopify")
1383-
.service(
1384-
web::resource("/plan_change")
1385-
.route(web::post().to(handlers::payment_handler::handle_shopify_plan_change)),
1386-
),
1387-
)
13881385
.service(
13891386
web::scope("/stripe")
13901387
.service(

server/src/operators/dataset_operator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ pub async fn get_dataset_and_organization_from_dataset_id_query(
337337

338338
if let Some(sub) = &subscription {
339339
let end_date = sub.current_period_end();
340-
log::info!("Subscription end date: {}", end_date.unwrap_or_default());
341340
if end_date.is_some()
342341
&& chrono::Utc::now().naive_utc() > end_date.expect("End date should be set")
343342
{

server/src/operators/organization_operator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ pub async fn get_org_from_id_query(
377377

378378
if let Some(sub) = &subscription {
379379
let end_date = sub.current_period_end();
380-
log::info!("Subscription end date: {}", end_date.unwrap_or_default());
381380
if end_date.is_some()
382381
&& chrono::Utc::now().naive_utc() > end_date.expect("End date should be set")
383382
{

0 commit comments

Comments
 (0)