GithubHelp home page GithubHelp logo

leanplum / leanplum-javascript-sdk Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 14.0 10.99 MB

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.

Home Page: https://www.leanplum.com

License: Apache License 2.0

JavaScript 0.25% HTML 4.18% Shell 0.21% TypeScript 87.78% Smarty 7.58%
abtesting analytics automation messaging personalization

leanplum-javascript-sdk's People

Contributors

alberto911 avatar alexisoyama avatar benmarten avatar dependabot[bot] avatar e7mac avatar gyoshev avatar iignatov avatar maitreyabuddha avatar milos1290 avatar nzagorchev avatar shivanshukumar avatar wil93 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

leanplum-javascript-sdk's Issues

The automated release is failing 🚨

🚨 The automated release from the develop branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the develop branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two Factor Authentication for your account, set its level to "Authorization only" in your account settings. semantic-release cannot publish with the default "
Authorization and writes" level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

New issue.

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

Specifications

  • Version:
  • Platform:
  • Subsystem:

Creating an in-app messaging template with the JavaScript SDK

Expected Behavior

Want to be able to send in-app messages using the JS SDK, or define custom in-app messages using the JS SDK

Actual Behavior

Triggering in-app messages doesn't propagate to JS SDK dev clients, nor can I find a method to register in-app messaging templates in the JS SDK

Specifications

  • Version: 1.4.0
  • Platform: macOS, but using the latest JS SDK

Codes.

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

Specifications

  • Version:
  • Platform:
  • Subsystem:

SDK doesn't handle adblockers - retries failed requests forever

Some Adblockers such as uBlock Origin unfortunately block requests to https://api.leanplum.com/api . The JS SDK doesn't handle this very well however, as it seems to retry the request every ~400ms forever. In addition to spamming the console it also seems to significantly slow down the web app.

Expected Behavior

There are a number of possible solutions for this that can be applied, either one or many in tandem:

  1. Implement exponential backoff for retries
  2. Stop automatically retrying after a configurable time period
  3. Stop retrying if the response object has status = 0

Actual Behavior

The SDK retries the request every ~400ms forever.

Steps to Reproduce the Problem

  1. Install a browser Adblock extension such as uBlock Origin
  2. Navigate to any website using the leanplum SDK
  3. Trigger a leanplum API request via leanplum.forceContentUpdate() or similar

Specifications

  • Version: [email protected]
  • Platform: Chrome 113.0.5672.126 (Official Build) (arm64)
  • Subsystem: ?

Error: SyntaxError: Failed to execute 'open' on 'XMLHttpRequest': '[object Arguments]'

Expected Behavior

No errors

Actual Behavior

SyntaxError: Failed to execute 'open' on 'XMLHttpRequest': '[object Arguments]' is not a vali

Steps to Reproduce the Problem

Upgrade to 1.5 and open our website, for a user that has many variables that are not initialized in the javascript.

Might be somehow similar to #22

Root cause and a possible fix

This line now it reads:

this.ajax.call(this, args)

But it used to be

      apply.call(Network.ajax, null, args)

I guess the current version should become

this.ajax.apply(this, args)

Specifications

  • Version: 1.5
  • Platform: all

Variables not pulled from Leanplum API

Expected Behavior

Leanplum.getVariables() should output the variable values from the Leanplum Dashboard.

Actual Behavior

Leanplum.getVariables() only outputs whatever was set with Leamplum.setVariables.

Steps to Reproduce the Problem

`. Use the following code to initialize Leanplum:

if (config.leanPlum.appId) {
  if (config.leanPlum.devMode) {
    Leanplum.setAppIdForDevelopmentMode(config.leanPlum.appId, config.leanPlum.devKey);
  } else {
    Leanplum.setAppIdForProductionMode(config.leanPlum.appId, config.leanPlum.prodKey);
  }
  Leanplum.setVariables({
    registerWithSocial: false,
  });
  Leanplum.start(success => {
    console.log('Leanplum started', success, Leanplum.getVariables());
  });
}
  1. Observe the output:

Screen Shot 2023-05-09 at 2 09 59 PM

Specifications

  • Version: 1.11.0
  • Platform: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36' (same results in Safari)
  • Subsystem: ???

Types are missing in the node module

Expected Behavior

Expecting dist/leanplum.d.ts to exist, as it is referenced in package.json as location for type defs, and it is also in the git repo dist folder.

Actual Behavior

dist/leanplum.d.ts doesn't exist in the installed npm module.

Steps to Reproduce the Problem

  1. Install [email protected]
  2. View installed module and see there are no types in dist folder
  3. Importing module into project lacks type defs.

Specifications

  • Version: 1.11.0
  • Platform: node.js
  • Subsystem: os x

Security concerns - sending messages, modifying data

Given how the SDK is set up, what's to stop an attacker from grabbing the development key, production key, and app id and modifying data in the system?

From looking at the HTTP API endpoints and what a person can look up in developer tools, an attacker could take advantage of these endpoints:

registerDevice
getVars
setVars

If the attacker has a list of device ID's that they are targeting, they can attempt to attack all of the user data endpoints, including deleteUser and sendMessage.

Bundled size increased from 68kb (v1.10.5) to 194kb (v1.11.0)

Upgrading leanplum-sdk from v1.10.5 to v.1.11.0 results in a huge increase in bundle size.

Expected Behavior

Bundle size should barely change - or preferably decrease.

Actual Behavior

Bundle size of the package greatly increased, from 68kb (v1.10.5) to 194kb (v1.11.0).

Steps to Reproduce the Problem

  1. Clone/create a new project using webpack to bundle assets
  2. Import leanplum-sdk into a JS chunk
  3. Configure https://www.npmjs.com/package/webpack-bundle-analyzer to run when bundling
  4. npm install [email protected]
  5. Run webpack and note the size of the leanplum-sdk chunk
  6. npm install [email protected]
  7. Run webpack and note the size of the leanplum-sdk chunk

Specifications

  • Version: v1.11.0
  • Platform: Mac
  • Subsystem: N/A

No way to set userAttributeValuesToIncrement

Expected Behavior

I expected that it would be possible to use Leanplum.setUserAttributes to set userAttributeValuesToIncrement, or else that the SDK would have a separate method for incrementing attribute values.

Actual Behavior

As far as I can tell, Leanplum.setUserAttributes only accepts a parameter for the actual user attribute property-value map, and not higher level options like userAttributeValuesToIncrement

Steps to Reproduce the Problem

  1. Read the SDK documentation, notice the lack of any mention of userAttributeValuesToIncrement

Specifications

  • Version: N/A
  • Platform: N/A
  • Subsystem: N/A

Uncaught TypeError: Cannot read properties of null (reading 'response')

Expected Behavior

No Errors

Actual Behavior

I got
Uncaught TypeError: Cannot read properties of null (reading 'response')
image

Uncaught TypeError: Cannot read properties of null (reading 'response')
    at response (leanplum.min.js?98de:formatted:1737)
    at eval (leanplum.min.js?98de:formatted:216)
  Function @ location
  response @ leanplum.min.js?98de:formatted:1737
  eval @ leanplum.min.js?98de:formatted:216
  setTimeout (async)    
  c.onreadystatechange @ leanplum.min.js?98de:formatted:216
  XMLHttpRequest.send (async)    
  s.ajax @ leanplum.min.js?98de:formatted:234
  f @ leanplum.min.js?98de:formatted:1957
  a.request @ leanplum.min.js?98de:formatted:1965
  y.createRequest @ leanplum.min.js?98de:formatted:1499
  a.downloadMessages @ leanplum.min.js?98de:formatted:1730
  fetchNotifications @ leanplum.js?2c61:143
  eval @ leanplum.js?2c61:136
  setInterval (async)    
  leanplumInboxSubscribe @ leanplum.js?2c61:135
  _callee2$ @ useLeanplum.js?ee6e:64

Steps to Reproduce the Problem

Looks like happen when a request to leamplum API is not successful or
when unmount the component that consume leanplum.

Specifications

  • Version: "leanplum-sdk": "^1.3.0",
  • Platform: web
  • Subsystem: n/a

Updating to 1.3.0 - Problem declaring default variables

Expected Behavior

No errors should be shown and/or there shouldn't be need to define all the existing variables

Actual Behavior

Leanplum throws the following error

Uncaught TypeError: Cannot read property 'Daily Activity Goal' of undefined

For every single group not defined when doing Leanplum.setVariables({...}). It seems that every single group needs to be defined otherwise this will fail. On previous versions this wasn't an issue.

Steps to Reproduce the Problem

  1. n/a

Specifications

  • Version: n/a
  • Platform: n/a
  • Subsystem: n/a

ReferenceError: navigator is not defined

Hi,

We're starting to use leanplum on our project and we're having this error. We're using SSR.

web/node_modules/leanplum-sdk/dist/leanplum.min.js:1:8526)

We have tried to initialize on client but with no luck.

Thanks

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.