@plasmicapp/loader-react 1.0.157 → 1.0.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,6 +88,36 @@ function _setPrototypeOf(o, p) {
88
88
  return _setPrototypeOf(o, p);
89
89
  }
90
90
 
91
+ function _isNativeReflectConstruct() {
92
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
93
+ if (Reflect.construct.sham) return false;
94
+ if (typeof Proxy === "function") return true;
95
+
96
+ try {
97
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
98
+ return true;
99
+ } catch (e) {
100
+ return false;
101
+ }
102
+ }
103
+
104
+ function _construct(Parent, args, Class) {
105
+ if (_isNativeReflectConstruct()) {
106
+ _construct = Reflect.construct;
107
+ } else {
108
+ _construct = function _construct(Parent, args, Class) {
109
+ var a = [null];
110
+ a.push.apply(a, args);
111
+ var Constructor = Function.bind.apply(Parent, a);
112
+ var instance = new Constructor();
113
+ if (Class) _setPrototypeOf(instance, Class.prototype);
114
+ return instance;
115
+ };
116
+ }
117
+
118
+ return _construct.apply(null, arguments);
119
+ }
120
+
91
121
  function _unsupportedIterableToArray(o, minLen) {
92
122
  if (!o) return;
93
123
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -179,6 +209,10 @@ function prepComponentData(bundle) {
179
209
  return x.globalContextsProviderFileName;
180
210
  }).filter(function (x) {
181
211
  return !!x;
212
+ }), bundle.components.filter(function (c) {
213
+ return c.isGlobalContextProvider;
214
+ }).map(function (c) {
215
+ return c.entry;
182
216
  }), bundle.globalGroups.map(function (g) {
183
217
  return g.contextFile;
184
218
  })));
@@ -1149,6 +1183,9 @@ function getLookupSpecName(lookup) {
1149
1183
  return lookup.name;
1150
1184
  }
1151
1185
  }
1186
+ function uniq(elements) {
1187
+ return _construct(Array, new Set(elements));
1188
+ }
1152
1189
 
1153
1190
  function getFirstCompMeta(metas, lookup) {
1154
1191
  var filtered = getCompMetas(metas, lookup);
@@ -1371,7 +1408,8 @@ function PlasmicRootProvider(props) {
1371
1408
  renderCtx: {
1372
1409
  // We track the provider as a single entity
1373
1410
  rootComponentId: 'provider',
1374
- teamIds: loader.getTeamIds()
1411
+ teamIds: loader.getTeamIds(),
1412
+ projectIds: loader.getProjectIds()
1375
1413
  },
1376
1414
  variation: variation
1377
1415
  });
@@ -1960,11 +1998,17 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1960
1998
  }();
1961
1999
 
1962
2000
  _proto.getTeamIds = function getTeamIds() {
1963
- return this.bundle.projects.map(function (p) {
1964
- return p.teamId;
2001
+ return uniq(this.bundle.projects.map(function (p) {
2002
+ return p.teamId ? "" + p.teamId + (p.indirect ? '@indirect' : '') : null;
1965
2003
  }).filter(function (x) {
1966
2004
  return !!x;
1967
- });
2005
+ }));
2006
+ };
2007
+
2008
+ _proto.getProjectIds = function getProjectIds() {
2009
+ return uniq(this.bundle.projects.map(function (p) {
2010
+ return "" + p.id + (p.indirect ? '@indirect' : '');
2011
+ }));
1968
2012
  };
1969
2013
 
1970
2014
  _proto.trackRender = function trackRender(opts) {
@@ -2456,7 +2500,8 @@ function PlasmicComponent(props) {
2456
2500
  rootProjectId: meta.projectId,
2457
2501
  rootComponentId: meta.id,
2458
2502
  rootComponentName: component,
2459
- teamIds: loader.getTeamIds()
2503
+ teamIds: loader.getTeamIds(),
2504
+ projectIds: loader.getProjectIds()
2460
2505
  },
2461
2506
  variation: variation
2462
2507
  });