Coder Social home page Coder Social logo

ynnoj / gatsby-source-printful Goto Github PK

View Code? Open in Web Editor NEW
20.0 5.0 4.0 728 KB

Printful store data for your Gatsby projects

Home Page: https://gatsbysourceprintful.gtsb.io

License: MIT License

JavaScript 100.00%
gatsby gatsby-plugin gatsby-source-plugin printful

gatsby-source-printful's Introduction

gatsby-source-printful

Printful store data for your Gatsby projects

Getting Started

yarn add gatsby-source-printful

Configuration

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-source-printful`,
    options: {
      apiKey: '...',
      paginationLimit: 100 // Default value is 20
    },
  },
],

gatsby-source-printful's People

Contributors

notrab avatar renovate[bot] avatar ynnoj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gatsby-source-printful's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Maybe the plugin should not transform the data coming from Prinful API

Hi @ynnoj, and thanks increasing the page limit.

I've met 2 new issues when using this plugin:
1/ the prices are multiple by 100. I know Stripe uses cents, but not Paypal. I think the plugin should not change the pricing values and let the dev handle them.
2/ variant ID is overridden by external ID. This one is a bit more annoying, because we need the variant Id to create the order (or retrieve the variant using the API).

What do you think ?

Cannot read property 'preview_url' of undefined

I'm able to see the nodes in graphql, I'm hitting this error in the terminal when building

gatsby-source-printful: TypeError: Cannot read property 'preview_url' of undefined
@ gatsby-node.js line:77 

it looks it has to do with the preview image, what would you suggest to look at?

I see few of the these product: null in the query before the actual products that returns the expected object:

"allPrintfulVariant": {
      "nodes": [
        {
          "product": null
        },

Retail prices are being rounded down

I contacted Printful Dev Support directly about this and they have indicated the bug is with the middleware - setting a price to be $39.99 in the Printful admin panel results in the price being returned as 3900?

Screenshot 2020-05-28 at 23 42 27

Screenshot 2020-05-28 at 23 42 14

UNHANDLED REJECTION Encountered an error trying to infer a GraphQL type for: `variants___NODE`.

Hitting this error when Gatsby builds the schema and with only one product in the store.

UNHANDLED REJECTION Encountered an error trying to infer a GraphQL type for: variants___NODE. There is no corresponding node with the id field matching: "5ebd6716225212,5ebd6716225278,5ebd67162252d2,5ebd6716225329,5ebd6716225379,5ebd67162253c8,5ebd6716225412,5ebd6716225465,5ebd67162254b1".

add limit to 100

Hello,
by default, the limit is 20 for all lists. Please, could you add a limit to 100 ?

example: /sync/products?limit=100

Thanks

Get store information

It would be useful to bring down Store information using the Store Information API.

The only thing I would do by default is delete the payment_card key/object.

I'm happy to PR this if it's worth adding.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm gatsby-image Unavailable

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yml
  • actions/checkout v2
  • actions/setup-node v2
  • ubuntu 18.04
npm
demo/package.json
  • gatsby 2.32.13
  • gatsby-image 2.11.0
  • gatsby-plugin-sharp 2.14.4
  • gatsby-transformer-sharp 2.12.1
  • react 17.0.2
  • react-dom 17.0.2
gatsby-source-printful/package.json
  • gatsby-source-filesystem 2.11.1
  • isomorphic-unfetch 3.1.0
package.json

  • Check this box to trigger a request for Renovate to run again on this repository

Add support to pull product info?

Unless I'm missing something, it's not currently possible to expose product info via this plugin?

e.g.

https://api.printful.com/products/151 will return product info for a hoodie including this description, which I need;

A sporty hoodie with a soft inside. The iconic zip hoodie you see Silicon Valley big shots wearing - the understated yet classic look, giving off a youthful vibe.

• Flex Fleece (50% Polyester / 50% Cotton Fleece) construction
• Metal zipper
• Hooded with White finished Polyester drawcord
• Kangaroo pocket
• Unisex size – women may prefer to order one size smaller

Important: fabric of the product is prone to shrinking during wash.

I've toggled every possible option in the GraphiQL explorer but cannot return this info?

"gatsby-source-printful" threw an error while running the sourceNodes lifecycle

I'm currently getting this error and no related nodes in graphql.

gatsby-source-printful" threw an error while running the sourceNodes lifecycle:

warning The gatsby-source-printful plugin has generated no Gatsby nodes. Do you need it?

I tried to go back to basics @ynnoj and instead of running my product site, I went with the gatsby-default-starter to avoid any possible issue with my product's set up. I did install gatsby-source-printful, added it to the gatsby-config with a valid Printful API key and got this error , and no nodes were generated.

These are some of the dependencies that the default starter is using today:

"gatsby": "^2.26.1",
"gatsby-source-filesystem": "^2.5.0",
"react": "^16.12.0",

I tried using both node version 12.13.0 and 14.15.0 with same results.

I see that the actual error before the warning is not really printed , it's just left blank I think.

why prices are multiple by 100 ?

Hi @ynnoj,

All prices are multiple by 100 with this plugin. I know Stripe uses cents, but not Paypal. And thus when we create orders using the official Printful API, we have to divide prices by 100.

I think the plugin should not change the pricing values and let the dev handle them.

What do you think ?

products map is not a function

I am receiving the following error when adding Printful API key to my config:

"gatsby-source-printful" threw an error while running the sourceNodes lifecycle:

products.map(...).flat is not a function

  63 |       variants.map(({ variant_id }) => variant_id)
  64 |     )
> 65 |     .flat()
     |      ^
  66 | 
  67 |   const uniqueCatalogVariantIds = catalogVariantIds.reduce(
  68 |     (unique, item) => (unique.includes(item) ? unique : [...unique, item]),

File: node_modules/gatsby-source-printful/gatsby-node.js:65:6

Here is what I have done. I am not doing any queries yet, just the basic set up:

  • Registered account on Printful, copied API key & add it in config
  • Run gatsby develop & receive error above

I can't find any documentation online how this should be configured. Any help would be appreciated.

Populating a size dropdown box

What is the recommended way to populate a dropdown box using this source method?

If I have a product in my store e.g. 123456 - when I query the /store/products/{id} endpoint, I am returned a list of variants, which in this case are all the different sizes of my Printful product.

However, no-where in each variant object is the size attribute available?

Currently I have to query the name e.g. Hoodie - S and split the string on the dash to pull out S etc to populate my dropdown box.

This is obviously very brittle.. is there a way to pull this size info from the API directly?

Many thanks and thank you for the version bump with fixes earlier this week 🙌🏻

'id' undefined in gatsby-node.js

Hello,

This is my first time submitting an issue on github so I apologize if I do not provide enough information.

After adding gatsby-source-printful to my project and adding the plugin object in gatsby-config.js, I am receiving the following error message in my terminal:

`
ERROR #11330 PLUGIN
"gatsby-source-printful" threw an error while running the sourceNodes lifecycle:

id is not defined

244 | const processStoreInformation = async ({ payment_card, ...store }) => ({
245 | ...store,

246 | id: store-${id.toString},
| ^
247 | internal: {
248 | type: PrintfulStore,
249 | contentDigest: createContentDigest(store)

Make sure that you don't have a typo somewhere and use valid arguments in sourceNodes lifecycle.
Learn more about sourceNodes here: https://www.gatsbyjs.org/docs/node-apis/#sourceNodes
`

I can confirm that I have successfully connected to my Printful store, as I can receive data from it on GraphiQL. I went into the file in node_modules and I am unable to figure out what variable 'id' is intended to reference in the above function. Please let me know if this is an issue that needs to be fixed, or if I have simply installed the plugin incorrectly.

Thank you for your work on this plugin and I look forward to using it.

best wishes,
nicholas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.