Git Product home page Git Product logo

blocksdk's People

Stargazers

 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  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  avatar  avatar  avatar  avatar  avatar  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

blocksdk's Issues

I can't get data properly when i initialize my SDK component

Hello, we are developing custom blocks in react for content builder and use your SDK to communicate between SFMC and our components.

I rewrote entirely the SDK in typescript as i needed the types to be able to use it correctly (it's the same class except i typed everything).

I'm having troubles when the SDK is initialized.

First we create the message event listener to get the messages from SFMC, then we send a handshake message from window.parent to ensure that the method is working properly and that the sender is effectively SFMC for security purpose.

Those methods are line 28 and 30 in https://github.com/salesforce-marketingcloud/blocksdk/blob/master/blocksdk.js

When i build my SDK class the first time, the handshake is sent, but not received by the _receiveMessage function (so _readyToPost is always false and pendingMessages are not sent, then i don't get my data from SFMC on init).

But if i hit the done editing button and come back on the custom block the handshake method is received and then i can get my data message from SFMC.

Have you got any leads about this ?

Thank you.

Using BlockSDK in Marketing cloud.

Is it possible for now to use BlockSDK and custom block in MarketingCloud?

I have implemented my own application:
This app works in blocktester
But
Does not in MarketingCloud.

In addition, I deployed the sampleblock to Heroku but I see the same issue:
It does not work in MarketingCloud.

After debugging and modifying the source code of SDK I found the issue. Parent window in MarketingCloud doesn't answer on handShake.

In my local project, I have changed the code of SDK. And after that my custom block starts working in MarketingCloud.

  this._postToEditor = function (payload, callback, ttl) {
    var self = this;
-    // we only message up if we have
-    // validated the origin
-    if (!this._parentOrigin) {
-      if (ttl === undefined || ttl > 0) {
-        window.setTimeout(function () {
-          self._postToEditor(payload, callback, (ttl || 5) - 1);
-        }, 20);
-      }
-      return;
-    }
    this._messages[this._messageId] = callback;
    payload.id = this._messageId;
    this._messageId += 1;
    // the actual postMessage always uses
    // the validated origin
-    window.parent.postMessage(payload, this._parentOrigin);
+    window.parent.postMessage(payload, '*');
  };

Block input validation

Hi, is there any way to catch the 'Done Editing' button to be able to run some validation on the inputs the user has filled. Thanks for your help.

Craig

Sample Project [Request]

Would it be possible to include a folder with a super simple sample project? This would help devs to see the API in action.

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.