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

bug : store.validator is not defined #1612

Open
gxolin opened this issue Oct 16, 2024 · 7 comments
Open

bug : store.validator is not defined #1612

gxolin opened this issue Oct 16, 2024 · 7 comments

Comments

@gxolin
Copy link

gxolin commented Oct 16, 2024

Observed behavior

The CdvPurchase.store.validator exposes a store.validator property, but this property is not defined in the store final build
(same for validator_privacy_policy)

Trying to call it will throw errors : store.validator = (r,c) => {}
tried calling InAppPurchase3.validator, but the InAppPurchase3 plugin is not installed. (error catching by awesome-cordova-plugins when something is not defined)

Expected behavior

No inaccessible properties defined in store.ts src but not accessible in store.js build

System Info

package.json :

    "@awesome-cordova-plugins/core": "^6.10.0",
    "@awesome-cordova-plugins/in-app-purchase-3": "^6.10.0",
    "cordova-plugin-purchase": "^13.11.1",

Output of cordova info.
cordova: command not found

@gxolin gxolin changed the title bug : CdvPurchase.store.validator is not defined bug : store.validator is not defined Oct 16, 2024
@Dexus
Copy link
Collaborator

Dexus commented Oct 30, 2024

Then just use it properly! https://github.com/j3k0/cordova-plugin-purchase/blob/master/www/store.js#L100-L110

maybe you need to install cordova?

@gxolin
Copy link
Author

gxolin commented Oct 30, 2024

Thanks for the advice, but my setup is based on a workaround due to #1610, and I don't use Iaptic as a backend, I have my own. I should have put the context in my issue, sorry:

  • Cordova is not installed because it's a angular+capacitor project.
  • I can use any other functions from the store.ts without any issue.
  • @awesome-cordova-plugins/in-app-purchase-3 is currently not available on npm but it's a wrapper I made around cordova-plugin-purchase to work around [Angular + Capacitor (without Ionic)] "Cannot destructure property 'routes' of '(intermediate value)` as it is undefined" #1610.
  • the error printed is a global catch from the @awesome-cordova-plugins when a method is not defined in the library. store.ts has this validator function, but it's undefined in the real store.js. It's probably set up later by the library, but only when installed directly, not when wrapped by my @awesome-cordova-plugins

@Dexus
Copy link
Collaborator

Dexus commented Oct 30, 2024

did you setup the capacitor config? and sync?

@gxolin
Copy link
Author

gxolin commented Oct 30, 2024

yes, using the cordova-plugin-purchase through the @awesome-cordova-plugins/in-app-purchase-3 is working fine beside the validator function, I've tested the whole subscription purchase with both Android and iOS stores, and live subscription until payment, so I think everything is well configured

@Dexus
Copy link
Collaborator

Dexus commented Nov 1, 2024

I use it also in a CapacitorJS Projekt, but don't have the problems. So I think its something wrong with your setup. Did you import the cordova.js in your html file?

@gxolin
Copy link
Author

gxolin commented Nov 4, 2024

I don't think it's required to install cordova, but I'm new to capacitor so I'm maybe wrong.
Here is the result of npx cap ls :

> npx cap ls
[info] Found 1 Cordova plugin for android:
       [email protected]
[info] Found 1 Cordova plugin for ios:
       [email protected]
[info] Listing plugins for web is not possible.

but again, I don't think it's an issue here since my plugin is discovered and usable on both Android and iOs, only the store.validator function is not working properly

@Dexus
Copy link
Collaborator

Dexus commented Nov 5, 2024

I have test it without the awesome cordova plugins, and I cant see any error. So it looks like its a problem of your setup.

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

No branches or pull requests

2 participants