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

feat: add discounts allocator function template (Rust, JS/TS, WASM) #431

Merged
merged 7 commits into from
Jan 26, 2024

Conversation

mathiusj
Copy link
Contributor

@mathiusj mathiusj commented Jan 23, 2024

What are we solving?

Part of https://github.com/Shopify/core-issues/issues/64459

What was done

  • added a discounts allocation function template for Rust, JS/TS and WASM to be used in new dev docs for upcoming feature

🎩 Instructions

  • spin up discount-functions-testing:legacy -c partners.branch=mathiusj/gh-64459-add-discounts-allocator-extension
    For each Programming Language (JS, TS, Rust, WASM)
  • open discount functions testing app from that spin instance
  • npm run shopify app generate extension -- --template discounts_allocator --name discounts-allocator-test --clone-url https://github.com/Shopify/function-examples\#mathiuss/add-discounts-allocator
  • cd into directory and run tests with either yarn && yarn test or cargo build && cargo test

@mathiusj mathiusj force-pushed the mathiuss/add-discounts-allocator branch 4 times, most recently from 7fec240 to 958902c Compare January 23, 2024 21:23
@mathiusj mathiusj force-pushed the mathiuss/add-discounts-allocator branch from 958902c to eba582e Compare January 23, 2024 21:24
Copy link
Contributor

@jharlap jharlap left a comment

Choose a reason for hiding this comment

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

tiny change requested

@@ -0,0 +1,7 @@
query RunInput {
shop {
metafield(namespace: "$app:{{handle | replace: " ", "-" | downcase}}", key: "allocator-function") {
Copy link
Contributor

Choose a reason for hiding this comment

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

for other functions we've been using the key function-configuration, which I think makes the intent clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@@ -0,0 +1,7 @@
query Input {
shop {
metafield(namespace: "$app:{{handle | replace: " ", "-" | downcase}}", key: "allocator-function") {
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment re: key

@mathiusj mathiusj requested a review from jharlap January 24, 2024 17:26
@mathiusj mathiusj changed the title feat: add discounts allocator function template (Rust, JS, WASM) feat: add discounts allocator function template (Rust, JS/TS, WASM) Jan 24, 2024
Copy link
Contributor

@samihibrahim samihibrahim left a comment

Choose a reason for hiding this comment

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

Why do we have different wasm contents compared to other discount functions? 🤔
Other functions only have locales dir, run.graphql.liquid, schema.graphql and shopify.extension.toml.liquid

@mathiusj
Copy link
Contributor Author

Why do we have different wasm contents compared to other discount functions? 🤔
Other functions only have locales dir, run.graphql.liquid, schema.graphql and shopify.extension.toml.liquid

Will check it out, I thought I trimmed it to match but could have missing something! :D

@mathiusj mathiusj requested a review from samihibrahim January 24, 2024 18:34
Copy link
Contributor

@samihibrahim samihibrahim left a comment

Choose a reason for hiding this comment

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

🎩 and got all sample functions 🎉

@mathiusj mathiusj merged commit 6539b18 into main Jan 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants