adaptyteam / AdaptySDK-React-Native

React Native SDK for growing in-app subscriptions
https://docs.adapty.io/docs/quickstart
MIT License
122 stars 12 forks source link

activation error 2.7.0-canary.1 #97

Closed pioner92 closed 10 months ago

pioner92 commented 10 months ago

Description

An error occurs during activation File adapts-handler.js

      const activate = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
                tslib_1.__classPrivateFieldSet(this, _Adapty_activating, tslib_1.__classPrivateFieldGet(this, _Adapty_instances, "m", _Adapty_handle).call(this, 'activate', body, ctx, log), "f");
                yield tslib_1.__classPrivateFieldGet(this, _Adapty_activating, "f");
            });

_Adapty_resolveHeldActivation = new WeakMap(), _Adapty_activating = new WeakMap(), _Adapty_instances = new WeakSet(), _Adapty_handle = function _Adapty_handle(method, params, ctx, log) {

_Adapty_instances is WeakSet tslib_1.__classPrivateFieldGet uses method "GET" from object, but WeakSet doesn't have this method

export function __classPrivateFieldGet(receiver, privateMap) {
    if (!privateMap.has(receiver)) {
        throw new TypeError("attempted to get private field on non-instance");
    }

       ---------------here------------
    return privateMap.get(receiver);
}

Version

2.7.0-canary.1

What platforms are you seeing the problem on?

iOS

System info

TypeError: privateMap.get is not a function (it is undefined)
divanc commented 10 months ago

Wow! That's something with a compiled polyfill. We haven't experienced it, although ours and yours JS code is certainly the same...

Can you share your tsconfig (if applicable) and setup?

pioner92 commented 10 months ago

"@tsconfig/react-native": "^3.0.0", "react-native": "0.72.6",

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      // "@/root/*":["./src/*"],
      "@/core/*": ["./src/core/*"],
      "@/api/*": ["./src/lib/api/*"],
      "@/assets/*": ["./src/lib/assets/*"],
      "@/components/*": ["./src/lib/components/*"],
      "@/components": ["./src/lib/components"],
      "@/utils/*": ["./src/lib/utils/*"],
      "@/utils": ["./src/lib/utils"],
      "@/store/*": ["./src/store/*"],
      "@/screens/*": ["./src/screens/*"],
      "@/navigation/*": ["./src/navigation/*"],
      "@/navigation": ["./src/navigation"],
      "@/types/*": ["./src/types/*"],
      "@/model/*": ["./src/model/*"],
      "@/model": ["./src/model"],
      "@/hooks/*": ["./src/lib/utils/hooks/*"],
      "@/hooks": ["./src/lib/utils/hooks"],
      "@/analytics": ["./src/core/analytics.ts"],
      "@/theme": ["./src/lib/theme.ts"],
      "@/fonts/*": ["./assets/fonts/*"],
      "@/package.json":["./package.json"],
    },
    "sourceMap": true,
    "inlineSources": true,
    "sourceRoot": "/",
    "experimentalDecorators": true,
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "allowUnreachableCode": true,
    "checkJs": true,
    "esModuleInterop": true,
    "isolatedModules": true,
    "jsx": "react",
    "lib": [
      "ESNext"
    ],
    "moduleResolution": "node",
    "noEmit": true,
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "preserveSymlinks": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "strict": true,
    "target": "esnext"
  },
  "exclude": [
    "node_modules",
    "babel.config.js",
    "metro.config.js",
    "jest.config.js",
    "react-native-view-more-text"
  ],
  "extends": "@tsconfig/react-native/tsconfig.json",
}
pioner92 commented 10 months ago
❯ yarn list --pattern tslib
yarn list v1.22.19
├─ @pkgr/utils@2.3.1
│  └─ tslib@2.5.0
├─ @shopify/flash-list@1.6.1
│  └─ tslib@2.4.0
├─ ast-types@0.15.2
│  └─ tslib@2.3.1
├─ degenerator@3.0.2
│  └─ tslib@2.3.1
├─ inquirer@8.2.2
│  └─ tslib@2.3.1
├─ recast@0.21.5
│  └─ tslib@2.3.1
├─ rxjs@7.8.1
│  └─ tslib@2.3.1
├─ synckit@0.8.5
│  └─ tslib@2.5.0
└─ tslib@1.14.1
pioner92 commented 10 months ago

Here is diff versions 2.1.0 and 2.2.0 https://github.com/microsoft/tslib/compare/54a056a..f7eea49

Снимок экрана 2023-10-24 в 12 51 09
divanc commented 10 months ago

This is possibly due to tslib trying to access JS true-private properties in order to polyfill modern JS logic. I don't really see where your tsconfig utilizes tslib, but I believe this is the issue.

It also matches the fact that in this release I have changed pseudo-private properties to true-private.

Here are some of my sources:

divanc commented 10 months ago

I'm currently testing v2.7.0 without true-privates

divanc commented 10 months ago

Released v2.7.0 that should fix this issue @pioner92

divanc commented 10 months ago

Also v2.0.0 in ui library, same problem should have been present there

divanc commented 10 months ago

I will hope, that everything works! Closing for now

pioner92 commented 9 months ago

Yes, it works well now.