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

[Affiliate] TypeError: e.set is not a function #37

Open
elvismdev opened this issue Feb 13, 2023 · 2 comments
Open

[Affiliate] TypeError: e.set is not a function #37

elvismdev opened this issue Feb 13, 2023 · 2 comments
Assignees
Labels

Comments

@elvismdev
Copy link

Hi @russellsteadman,

I'm implementing now Affiliate and AffiliatePluginAmazon with the intention to use the new aff.convert() method, added in v5 after our last thread here: #31 (comment)

However, as I'm putting it all together in my React app, I noticed it is throwing me out an error in the console when the aff.convert() method is called.

2023-02-12_17-09

I'm adding below parts of the relevant Affiliate and AffiliatePluginAmazon code for a greater context of what I have running over here that produce this error.

// ...

import Affiliate from "affiliate";
import AffiliatePluginAmazon from "affiliate-plugin-amazon";

// ...

const amazonAff = AffiliatePluginAmazon(Affiliate, {
    tags: {
      us: "amzapplink-20", // for USA, required
      gb: "", // for UK
      de: "", // for Germany
      fr: "", // for France
      jp: "", // for Japan
      ca: "", // for Canada
      cn: "", // for China
      it: "", // for Italy
      es: "", // for Spain
      in: "", // for India
      br: "", // for Brazil
      mx: "", // for Mexico
    },
    debug: false, // verbose logging into the console, default off
    locale: null, // manually set the country code of the browser, default automatic
    modifyDomain: true, // modify domains like amazon.com to amazon.co.uk based on locale, default on
  });
  
// ...

// Testing convert function.
console.log(amazonAff.convert("https://www.amazon.com"));
@russellsteadman
Copy link
Owner

Hi @elvismdev

npm should throw a peer dependency mismatch when installing these packages together. I haven't gotten around to updating affiliate-plugin-amazon since version 3.x.x. Do you have use for the multi-locality features in affiliate-plugin-amazon? I wasn't too sure how much use this plugin would get. This library uses the language data for each individual to roughly match them to an Amazon link for their locality.

The example you are showing would be easier with just affiliate. Let me know if you are intending to use the additional functionality.

@elvismdev
Copy link
Author

Hey @russellsteadman! Yes, that is correct. I am also planning to utilize the multi-locality feature in my solution. It will prove to be very helpful. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants