henrikra Github contribution chart
henrikra Github Stats
henrikra Most Used Languages

Activity

28 Jul 2022

Issue Comment

Henrikra

Almost works

I have setup extension and web site where I do the authentication like this library is saying. After login with my website the extension returns user when calling cognitoUserPool.getCurrentUser() which is correct. But the the returned user object's session is null. This means I cannot call for example currentUser.getSession(). Calling that function works in the website but not on the extensions service worker.

Are you able to say if I am missing something or not?

Forked On 28 Jul 2022 at 08:10:58

Henrikra

I can try to make minimum reproduction repo for you 👍

Can you fix this more easier issue in the meanwhile? https://github.com/vocably/pontis/issues/2

Commented On 28 Jul 2022 at 08:10:58
Issue Comment

Henrikra

Almost works

I have setup extension and web site where I do the authentication like this library is saying. After login with my website the extension returns user when calling cognitoUserPool.getCurrentUser() which is correct. But the the returned user object's session is null. This means I cannot call for example currentUser.getSession(). Calling that function works in the website but not on the extensions service worker.

Are you able to say if I am missing something or not?

Forked On 26 Jul 2022 at 08:57:23

Henrikra

Thanks for the suggestion.

Now I tried the trick to call sync before I call getCurrentUser in my extension. Still it does not work. I made sure to call storage.sync() before calling getCurrentUser but still currentUser.getSession is not a function in the extension the same way I described in the issue. currentUser.getSession works fine on the web page side.

Are you able to make small example repo so I can see if I am doing it correctly with amazon-cognito-identity-js or not? This way we are on the same page 👍

Commented On 26 Jul 2022 at 08:57:23
Issue Comment

Henrikra

Almost works

I have setup extension and web site where I do the authentication like this library is saying. After login with my website the extension returns user when calling cognitoUserPool.getCurrentUser() which is correct. But the the returned user object's session is null. This means I cannot call for example currentUser.getSession(). Calling that function works in the website but not on the extensions service worker.

Are you able to say if I am missing something or not?

Forked On 26 Jul 2022 at 07:23:05

Henrikra

Yes I am but it is not working. Interesting 🤔

Would it be possible if you could create a new repo that has example web app and extension setup that works with Pontis? That would be beneficial to users of this library to see what kind of setup works 👍 You could link the example repo to the README of Pontis

Commented On 26 Jul 2022 at 07:23:05
Issue Comment

Henrikra

Almost works

I have setup extension and web site where I do the authentication like this library is saying. After login with my website the extension returns user when calling cognitoUserPool.getCurrentUser() which is correct. But the the returned user object's session is null. This means I cannot call for example currentUser.getSession(). Calling that function works in the website but not on the extensions service worker.

Are you able to say if I am missing something or not?

Forked On 25 Jul 2022 at 04:55:55

Henrikra

Thanks for the quick reply! And I am not mad :D

I am using amazon-cognito-identity-js which is AWS alternative for using Cognito in frontend.

It is used like this. Can you also try if it works for you or not?

import { CognitoUserPool } from "amazon-cognito-identity-js";

function main() {
  const cognitoUserPool = new CognitoUserPool({
    UserPoolId: "id_here",
    ClientId: "id_here",
  });
  
  const currentUser = cognitoUserPool.getCurrentUser()
  
  if (currentUser === null) {
    return
  }
  
  // With Pontis currentUser.getSession is undefined
  currentUser.getSession((error, session) => {
    console.log('session', session)
  });
}

main(); 

Commented On 25 Jul 2022 at 04:55:55
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 10 Jul 2022 at 11:36:32

Henrikra

Just tested the new release and works like a charm!

Commented On 10 Jul 2022 at 11:36:32
Issue Comment

Henrikra

Fix importing issue with Webpack

Description

I noticed in this issue that importing this library does not work with Webpack correctly https://github.com/Glench/ExtPay/issues/41

Solution

The solution is to remove browser field because it was pointing to version of global ExtPay which is meant to be used when you want to have global variable ExtPay. But since package.json is meant for npm modules this is not what we want to do.

Very big libraries which are meant for browser do no use browser field of package.json. Great example from Vue.js (https://github.com/vuejs/vue/blob/main/package.json#L6). They only specify main + other fields but nobody uses browser.

How to test?

Use ExtPay library in Webpack and Rollup or some other bundler and see if you can now just import ExtPay like this

import ExtPay from 'extpay';

const extPay = ExtPay("some-id"); 

and run the code to see if you get any errors. If you don't then everything is cool!

Fixes #41

Forked On 10 Jul 2022 at 07:45:42

Henrikra

It won't 👍

Commented On 10 Jul 2022 at 07:45:42
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 09 Jul 2022 at 06:12:31

Henrikra

What discrepancy do you mean?

Btw check the PR, I added also a comment there 👍

Commented On 09 Jul 2022 at 06:12:31
Issue Comment

Henrikra

Fix importing issue with Webpack

Description

I noticed in this issue that importing this library does not work with Webpack correctly https://github.com/Glench/ExtPay/issues/41

Solution

The solution is to remove browser field because it was pointing to version of global ExtPay which is meant to be used when you want to have global variable ExtPay. But since package.json is meant for npm modules this is not what we want to do.

Very big libraries which are meant for browser do no use browser field of package.json. Great example from Vue.js (https://github.com/vuejs/vue/blob/main/package.json#L6). They only specify main + other fields but nobody uses browser.

How to test?

Use ExtPay library in Webpack and Rollup or some other bundler and see if you can now just import ExtPay like this

import ExtPay from 'extpay';

const extPay = ExtPay("some-id"); 

and run the code to see if you get any errors. If you don't then everything is cool!

Fixes #41

Forked On 09 Jul 2022 at 06:06:10

Henrikra

@Glench There are basically two options to fix this issue:

  1. Remove the browser field like I did in this PR OR
  2. Keep browser field but change its value to ./dist/ExtPay.module.js

I am fine with either 👍

Commented On 09 Jul 2022 at 06:06:10
Issue Comment

Henrikra

Make payment popup open near middle of window if possible

Right now the popup can show up in kind of a weird place on bigger screens:

Screen Shot 2021-03-09 at 11 06 04 AM

Forked On 08 Jul 2022 at 01:23:29

Henrikra

This is possible with simple math. Check this link https://stackoverflow.com/questions/5345435/pop-up-window-center-screen

Would be very beneficial and easy to implement 👍

Commented On 08 Jul 2022 at 01:23:29
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 08 Jul 2022 at 07:48:48

Henrikra

@doriandrn and @Glench Can you test out the PR I did to fix this issue? https://github.com/Glench/ExtPay/pull/42

Commented On 08 Jul 2022 at 07:48:48
Pull Request

Henrikra

Fix importing issue with Webpack

Created On 08 Jul 2022 at 07:48:21

Henrikra

Fix importing issue with Webpack

Pushed On 08 Jul 2022 at 07:42:28

Henrikra

The JavaScript library for ExtensionPay.com — payments for your browser extensions, no server needed.

Forked On 08 Jul 2022 at 07:38:22
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 08 Jul 2022 at 07:07:52

Henrikra

Another big library called Vue (https://github.com/vuejs/vue) does not use browser field even though it is meant for browser:

So I would say it is very clear that the browser field should not be used

Commented On 08 Jul 2022 at 07:07:52
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 08 Jul 2022 at 07:04:12

Henrikra

If check any other libraries inside of node_modules you can see that they don't use browser field in their package.json for this exact reason. Here is example of famous data-fns library (https://github.com/date-fns/date-fns) inside of my project and it doesn't have browser field. It has only main which is the correct way 👍

Commented On 08 Jul 2022 at 07:04:12
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 07 Jul 2022 at 09:02:05

Henrikra

I think this is your problem. You should not distribute browser variant of ExtPay with npm package release. The browser field is pointing to the global version of ExtPay:

Commented On 07 Jul 2022 at 09:02:05
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 07 Jul 2022 at 09:00:02

Henrikra

I don't think the Webpack configuration is wrong. I have used Webpack around 6 years I had never a need to define resolve mainFields 🤔

This is the first library to counter this problem

Commented On 07 Jul 2022 at 09:00:02
Issue Comment

Henrikra

Importing ExtPay does not work with Webpack

Describe the bug A clear and concise description of what the bug is.

I have a working Chrome extension which uses TypeScript and it makes the build with Webpack. But unfortunately when I am following the instructions of ExtPay I cannot import the ExtPay function in any way. Below there are two things I have tried:

// in background script file

import ExtPay from 'extpay';
const extpay = ExtPay('sample-extension'); 

Error you will get in this case

Uncaught TypeError: extpay__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function 

According to the TypeScript types that this library provides this should be correct but still it doesn't work.

Then I tried another way shown in the README without any luck.

// in background script file

import 'ExtPay'
const extpay = ExtPay('sample-extension'); 

Error you will get

Uncaught ReferenceError: ExtPay is not defined 

So I guess ExtPay tries to expose global object without being succesful. What is the reason to use globals in the first place? :P Usually they make things more complicated.

To Reproduce Steps to reproduce the behavior: Have a Chrome extension project with Webpack build and see it failing

So am I missing something from the docs or does this thing work with Webpack builds?

Forked On 06 Jul 2022 at 10:31:23

Henrikra

@Glench Please try again. I accidentally put manifest.json to .gitignore. Pull the changes and try again 👍

Commented On 06 Jul 2022 at 10:31:23

Henrikra

Add missing manifest

Pushed On 06 Jul 2022 at 10:29:21
Issue Comment

Henrikra

Scoped style leads to error: TS7006: Parameter 'n' implicitly has an 'any' type

Version

16.8.3, 17.0.0, maybe older

Reproduction link

github.com

Steps to reproduce

npm install
npm run dev 

What is expected?

No errors

What is actually happening?

Error: TS7006: Parameter 'n' implicitly has an 'any' type


To get this error style must be scoped and template must access some component data

Forked On 05 Jul 2022 at 08:09:34

Henrikra

Removing strict is very bad for the codebase.

Have you guys heard any news on this?

Commented On 05 Jul 2022 at 08:09:34