@builder.io/sdk-solid 4.0.0 → 4.0.2

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.
@@ -5330,7 +5330,7 @@ function getPreviewContent(_searchParams) {
5330
5330
  }
5331
5331
 
5332
5332
  // src/constants/sdk-version.ts
5333
- var SDK_VERSION = "4.0.0";
5333
+ var SDK_VERSION = "4.0.2";
5334
5334
 
5335
5335
  // src/helpers/sdk-headers.ts
5336
5336
  var getSdkHeaders = () => ({
@@ -6048,6 +6048,15 @@ var createEditorListener = ({
6048
6048
  callbacks.animation(data.data);
6049
6049
  break;
6050
6050
  }
6051
+ case "builder.resetState": {
6052
+ const messageContent = data.data;
6053
+ const modelName = messageContent.model;
6054
+ const newState = messageContent?.state;
6055
+ if (modelName === model && newState) {
6056
+ callbacks.stateUpdate(newState);
6057
+ }
6058
+ break;
6059
+ }
6051
6060
  case "builder.contentUpdate": {
6052
6061
  const messageContent = data.data;
6053
6062
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -6082,6 +6091,8 @@ var subscribeToEditor = ({
6082
6091
  animation: () => {
6083
6092
  },
6084
6093
  configureSdk: () => {
6094
+ },
6095
+ stateUpdate: () => {
6085
6096
  }
6086
6097
  },
6087
6098
  model,
@@ -6180,6 +6191,7 @@ var getWrapperClassName = (variationId) => {
6180
6191
 
6181
6192
  // src/components/content/components/enable-editor.tsx
6182
6193
  function EnableEditor(props) {
6194
+ createSignal(false);
6183
6195
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6184
6196
  const [httpReqsData, setHttpReqsData] = createSignal({});
6185
6197
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6249,6 +6261,9 @@ function EnableEditor(props) {
6249
6261
  },
6250
6262
  contentUpdate: (newContent) => {
6251
6263
  mergeNewContent(newContent);
6264
+ },
6265
+ stateUpdate: (newState) => {
6266
+ mergeNewRootState(newState);
6252
6267
  }
6253
6268
  }
6254
6269
  })(event);
@@ -6344,8 +6359,12 @@ function EnableEditor(props) {
6344
6359
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
6345
6360
  }
6346
6361
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
6347
- if (shouldTrackImpression) {
6348
- const variationId = props.builderContextSignal.content?.testVariationId;
6362
+ const winningVariantId = getCookieSync({
6363
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
6364
+ canTrack: true
6365
+ });
6366
+ const variationId = props.builderContextSignal.content?.testVariationId;
6367
+ if (shouldTrackImpression && variationId === winningVariantId) {
6349
6368
  const contentId = props.builderContextSignal.content?.id;
6350
6369
  const apiKeyProp = props.apiKey;
6351
6370
  _track({
@@ -6354,7 +6373,7 @@ function EnableEditor(props) {
6354
6373
  canTrack: true,
6355
6374
  contentId,
6356
6375
  apiKey: apiKeyProp,
6357
- variationId: variationId !== contentId ? variationId : void 0
6376
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
6358
6377
  });
6359
6378
  }
6360
6379
  if (isPreviewing() && !isEditing()) {
@@ -4837,7 +4837,7 @@ function getPreviewContent(_searchParams) {
4837
4837
  }
4838
4838
 
4839
4839
  // src/constants/sdk-version.ts
4840
- var SDK_VERSION = "4.0.0";
4840
+ var SDK_VERSION = "4.0.2";
4841
4841
 
4842
4842
  // src/helpers/sdk-headers.ts
4843
4843
  var getSdkHeaders = () => ({
@@ -5555,6 +5555,15 @@ var createEditorListener = ({
5555
5555
  callbacks.animation(data.data);
5556
5556
  break;
5557
5557
  }
5558
+ case "builder.resetState": {
5559
+ const messageContent = data.data;
5560
+ const modelName = messageContent.model;
5561
+ const newState = messageContent?.state;
5562
+ if (modelName === model && newState) {
5563
+ callbacks.stateUpdate(newState);
5564
+ }
5565
+ break;
5566
+ }
5558
5567
  case "builder.contentUpdate": {
5559
5568
  const messageContent = data.data;
5560
5569
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -5589,6 +5598,8 @@ var subscribeToEditor = ({
5589
5598
  animation: () => {
5590
5599
  },
5591
5600
  configureSdk: () => {
5601
+ },
5602
+ stateUpdate: () => {
5592
5603
  }
5593
5604
  },
5594
5605
  model,
@@ -5687,6 +5698,7 @@ var getWrapperClassName = (variationId) => {
5687
5698
 
5688
5699
  // src/components/content/components/enable-editor.tsx
5689
5700
  function EnableEditor(props) {
5701
+ const [hasExecuted, setHasExecuted] = createSignal16(false);
5690
5702
  const [ContentWrapper, setContentWrapper] = createSignal16(
5691
5703
  props.contentWrapper || "div"
5692
5704
  );
@@ -5755,6 +5767,9 @@ function EnableEditor(props) {
5755
5767
  },
5756
5768
  contentUpdate: (newContent) => {
5757
5769
  mergeNewContent(newContent);
5770
+ },
5771
+ stateUpdate: (newState) => {
5772
+ mergeNewRootState(newState);
5758
5773
  }
5759
5774
  }
5760
5775
  })(event);
@@ -5865,8 +5880,12 @@ function EnableEditor(props) {
5865
5880
  );
5866
5881
  }
5867
5882
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
5868
- if (shouldTrackImpression) {
5869
- const variationId = props.builderContextSignal.content?.testVariationId;
5883
+ const winningVariantId = getCookieSync({
5884
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
5885
+ canTrack: true
5886
+ });
5887
+ const variationId = props.builderContextSignal.content?.testVariationId;
5888
+ if (shouldTrackImpression && variationId === winningVariantId) {
5870
5889
  const contentId = props.builderContextSignal.content?.id;
5871
5890
  const apiKeyProp = props.apiKey;
5872
5891
  _track({
@@ -5875,7 +5894,7 @@ function EnableEditor(props) {
5875
5894
  canTrack: true,
5876
5895
  contentId,
5877
5896
  apiKey: apiKeyProp,
5878
- variationId: variationId !== contentId ? variationId : void 0
5897
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
5879
5898
  });
5880
5899
  }
5881
5900
  if (isPreviewing() && !isEditing()) {
@@ -5316,7 +5316,7 @@ function getPreviewContent(_searchParams) {
5316
5316
  }
5317
5317
 
5318
5318
  // src/constants/sdk-version.ts
5319
- var SDK_VERSION = "4.0.0";
5319
+ var SDK_VERSION = "4.0.2";
5320
5320
 
5321
5321
  // src/helpers/sdk-headers.ts
5322
5322
  var getSdkHeaders = () => ({
@@ -6028,6 +6028,15 @@ var createEditorListener = ({
6028
6028
  callbacks.animation(data.data);
6029
6029
  break;
6030
6030
  }
6031
+ case "builder.resetState": {
6032
+ const messageContent = data.data;
6033
+ const modelName = messageContent.model;
6034
+ const newState = messageContent?.state;
6035
+ if (modelName === model && newState) {
6036
+ callbacks.stateUpdate(newState);
6037
+ }
6038
+ break;
6039
+ }
6031
6040
  case "builder.contentUpdate": {
6032
6041
  const messageContent = data.data;
6033
6042
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -6062,6 +6071,8 @@ var subscribeToEditor = ({
6062
6071
  animation: () => {
6063
6072
  },
6064
6073
  configureSdk: () => {
6074
+ },
6075
+ stateUpdate: () => {
6065
6076
  }
6066
6077
  },
6067
6078
  model,
@@ -6160,6 +6171,7 @@ var getWrapperClassName = (variationId) => {
6160
6171
 
6161
6172
  // src/components/content/components/enable-editor.tsx
6162
6173
  function EnableEditor(props) {
6174
+ createSignal(false);
6163
6175
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6164
6176
  const [httpReqsData, setHttpReqsData] = createSignal({});
6165
6177
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6229,6 +6241,9 @@ function EnableEditor(props) {
6229
6241
  },
6230
6242
  contentUpdate: (newContent) => {
6231
6243
  mergeNewContent(newContent);
6244
+ },
6245
+ stateUpdate: (newState) => {
6246
+ mergeNewRootState(newState);
6232
6247
  }
6233
6248
  }
6234
6249
  })(event);
@@ -6323,8 +6338,12 @@ function EnableEditor(props) {
6323
6338
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
6324
6339
  }
6325
6340
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
6326
- if (shouldTrackImpression) {
6327
- const variationId = props.builderContextSignal.content?.testVariationId;
6341
+ const winningVariantId = getCookieSync({
6342
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
6343
+ canTrack: true
6344
+ });
6345
+ const variationId = props.builderContextSignal.content?.testVariationId;
6346
+ if (shouldTrackImpression && variationId === winningVariantId) {
6328
6347
  const contentId = props.builderContextSignal.content?.id;
6329
6348
  const apiKeyProp = props.apiKey;
6330
6349
  _track({
@@ -6333,7 +6352,7 @@ function EnableEditor(props) {
6333
6352
  canTrack: true,
6334
6353
  contentId,
6335
6354
  apiKey: apiKeyProp,
6336
- variationId: variationId !== contentId ? variationId : void 0
6355
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
6337
6356
  });
6338
6357
  }
6339
6358
  if (isPreviewing() && !isEditing()) {
@@ -4825,7 +4825,7 @@ function getPreviewContent(_searchParams) {
4825
4825
  }
4826
4826
 
4827
4827
  // src/constants/sdk-version.ts
4828
- var SDK_VERSION = "4.0.0";
4828
+ var SDK_VERSION = "4.0.2";
4829
4829
 
4830
4830
  // src/helpers/sdk-headers.ts
4831
4831
  var getSdkHeaders = () => ({
@@ -5537,6 +5537,15 @@ var createEditorListener = ({
5537
5537
  callbacks.animation(data.data);
5538
5538
  break;
5539
5539
  }
5540
+ case "builder.resetState": {
5541
+ const messageContent = data.data;
5542
+ const modelName = messageContent.model;
5543
+ const newState = messageContent?.state;
5544
+ if (modelName === model && newState) {
5545
+ callbacks.stateUpdate(newState);
5546
+ }
5547
+ break;
5548
+ }
5540
5549
  case "builder.contentUpdate": {
5541
5550
  const messageContent = data.data;
5542
5551
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -5571,6 +5580,8 @@ var subscribeToEditor = ({
5571
5580
  animation: () => {
5572
5581
  },
5573
5582
  configureSdk: () => {
5583
+ },
5584
+ stateUpdate: () => {
5574
5585
  }
5575
5586
  },
5576
5587
  model,
@@ -5669,6 +5680,7 @@ var getWrapperClassName = (variationId) => {
5669
5680
 
5670
5681
  // src/components/content/components/enable-editor.tsx
5671
5682
  function EnableEditor(props) {
5683
+ const [hasExecuted, setHasExecuted] = createSignal16(false);
5672
5684
  const [ContentWrapper, setContentWrapper] = createSignal16(
5673
5685
  props.contentWrapper || "div"
5674
5686
  );
@@ -5737,6 +5749,9 @@ function EnableEditor(props) {
5737
5749
  },
5738
5750
  contentUpdate: (newContent) => {
5739
5751
  mergeNewContent(newContent);
5752
+ },
5753
+ stateUpdate: (newState) => {
5754
+ mergeNewRootState(newState);
5740
5755
  }
5741
5756
  }
5742
5757
  })(event);
@@ -5846,8 +5861,12 @@ function EnableEditor(props) {
5846
5861
  );
5847
5862
  }
5848
5863
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
5849
- if (shouldTrackImpression) {
5850
- const variationId = props.builderContextSignal.content?.testVariationId;
5864
+ const winningVariantId = getCookieSync({
5865
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
5866
+ canTrack: true
5867
+ });
5868
+ const variationId = props.builderContextSignal.content?.testVariationId;
5869
+ if (shouldTrackImpression && variationId === winningVariantId) {
5851
5870
  const contentId = props.builderContextSignal.content?.id;
5852
5871
  const apiKeyProp = props.apiKey;
5853
5872
  _track({
@@ -5856,7 +5875,7 @@ function EnableEditor(props) {
5856
5875
  canTrack: true,
5857
5876
  contentId,
5858
5877
  apiKey: apiKeyProp,
5859
- variationId: variationId !== contentId ? variationId : void 0
5878
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
5860
5879
  });
5861
5880
  }
5862
5881
  if (isPreviewing() && !isEditing()) {
package/lib/edge/dev.js CHANGED
@@ -8511,7 +8511,7 @@ function getPreviewContent(_searchParams) {
8511
8511
  }
8512
8512
 
8513
8513
  // src/constants/sdk-version.ts
8514
- var SDK_VERSION = "4.0.0";
8514
+ var SDK_VERSION = "4.0.2";
8515
8515
 
8516
8516
  // src/helpers/sdk-headers.ts
8517
8517
  var getSdkHeaders = () => ({
@@ -9229,6 +9229,15 @@ var createEditorListener = ({
9229
9229
  callbacks.animation(data.data);
9230
9230
  break;
9231
9231
  }
9232
+ case "builder.resetState": {
9233
+ const messageContent = data.data;
9234
+ const modelName = messageContent.model;
9235
+ const newState = messageContent?.state;
9236
+ if (modelName === model && newState) {
9237
+ callbacks.stateUpdate(newState);
9238
+ }
9239
+ break;
9240
+ }
9232
9241
  case "builder.contentUpdate": {
9233
9242
  const messageContent = data.data;
9234
9243
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -9263,6 +9272,8 @@ var subscribeToEditor = ({
9263
9272
  animation: () => {
9264
9273
  },
9265
9274
  configureSdk: () => {
9275
+ },
9276
+ stateUpdate: () => {
9266
9277
  }
9267
9278
  },
9268
9279
  model,
@@ -9361,6 +9372,7 @@ var getWrapperClassName = (variationId) => {
9361
9372
 
9362
9373
  // src/components/content/components/enable-editor.tsx
9363
9374
  function EnableEditor(props) {
9375
+ createSignal(false);
9364
9376
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
9365
9377
  const [httpReqsData, setHttpReqsData] = createSignal({});
9366
9378
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -9430,6 +9442,9 @@ function EnableEditor(props) {
9430
9442
  },
9431
9443
  contentUpdate: (newContent) => {
9432
9444
  mergeNewContent(newContent);
9445
+ },
9446
+ stateUpdate: (newState) => {
9447
+ mergeNewRootState(newState);
9433
9448
  }
9434
9449
  }
9435
9450
  })(event);
@@ -9525,8 +9540,12 @@ function EnableEditor(props) {
9525
9540
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
9526
9541
  }
9527
9542
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
9528
- if (shouldTrackImpression) {
9529
- const variationId = props.builderContextSignal.content?.testVariationId;
9543
+ const winningVariantId = getCookieSync({
9544
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
9545
+ canTrack: true
9546
+ });
9547
+ const variationId = props.builderContextSignal.content?.testVariationId;
9548
+ if (shouldTrackImpression && variationId === winningVariantId) {
9530
9549
  const contentId = props.builderContextSignal.content?.id;
9531
9550
  const apiKeyProp = props.apiKey;
9532
9551
  _track({
@@ -9535,7 +9554,7 @@ function EnableEditor(props) {
9535
9554
  canTrack: true,
9536
9555
  contentId,
9537
9556
  apiKey: apiKeyProp,
9538
- variationId: variationId !== contentId ? variationId : void 0
9557
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
9539
9558
  });
9540
9559
  }
9541
9560
  if (isPreviewing() && !isEditing()) {
package/lib/edge/dev.jsx CHANGED
@@ -8020,7 +8020,7 @@ function getPreviewContent(_searchParams) {
8020
8020
  }
8021
8021
 
8022
8022
  // src/constants/sdk-version.ts
8023
- var SDK_VERSION = "4.0.0";
8023
+ var SDK_VERSION = "4.0.2";
8024
8024
 
8025
8025
  // src/helpers/sdk-headers.ts
8026
8026
  var getSdkHeaders = () => ({
@@ -8738,6 +8738,15 @@ var createEditorListener = ({
8738
8738
  callbacks.animation(data.data);
8739
8739
  break;
8740
8740
  }
8741
+ case "builder.resetState": {
8742
+ const messageContent = data.data;
8743
+ const modelName = messageContent.model;
8744
+ const newState = messageContent?.state;
8745
+ if (modelName === model && newState) {
8746
+ callbacks.stateUpdate(newState);
8747
+ }
8748
+ break;
8749
+ }
8741
8750
  case "builder.contentUpdate": {
8742
8751
  const messageContent = data.data;
8743
8752
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -8772,6 +8781,8 @@ var subscribeToEditor = ({
8772
8781
  animation: () => {
8773
8782
  },
8774
8783
  configureSdk: () => {
8784
+ },
8785
+ stateUpdate: () => {
8775
8786
  }
8776
8787
  },
8777
8788
  model,
@@ -8870,6 +8881,7 @@ var getWrapperClassName = (variationId) => {
8870
8881
 
8871
8882
  // src/components/content/components/enable-editor.tsx
8872
8883
  function EnableEditor(props) {
8884
+ const [hasExecuted, setHasExecuted] = createSignal16(false);
8873
8885
  const [ContentWrapper, setContentWrapper] = createSignal16(
8874
8886
  props.contentWrapper || "div"
8875
8887
  );
@@ -8938,6 +8950,9 @@ function EnableEditor(props) {
8938
8950
  },
8939
8951
  contentUpdate: (newContent) => {
8940
8952
  mergeNewContent(newContent);
8953
+ },
8954
+ stateUpdate: (newState) => {
8955
+ mergeNewRootState(newState);
8941
8956
  }
8942
8957
  }
8943
8958
  })(event);
@@ -9048,8 +9063,12 @@ function EnableEditor(props) {
9048
9063
  );
9049
9064
  }
9050
9065
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
9051
- if (shouldTrackImpression) {
9052
- const variationId = props.builderContextSignal.content?.testVariationId;
9066
+ const winningVariantId = getCookieSync({
9067
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
9068
+ canTrack: true
9069
+ });
9070
+ const variationId = props.builderContextSignal.content?.testVariationId;
9071
+ if (shouldTrackImpression && variationId === winningVariantId) {
9053
9072
  const contentId = props.builderContextSignal.content?.id;
9054
9073
  const apiKeyProp = props.apiKey;
9055
9074
  _track({
@@ -9058,7 +9077,7 @@ function EnableEditor(props) {
9058
9077
  canTrack: true,
9059
9078
  contentId,
9060
9079
  apiKey: apiKeyProp,
9061
- variationId: variationId !== contentId ? variationId : void 0
9080
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
9062
9081
  });
9063
9082
  }
9064
9083
  if (isPreviewing() && !isEditing()) {
package/lib/edge/index.js CHANGED
@@ -8497,7 +8497,7 @@ function getPreviewContent(_searchParams) {
8497
8497
  }
8498
8498
 
8499
8499
  // src/constants/sdk-version.ts
8500
- var SDK_VERSION = "4.0.0";
8500
+ var SDK_VERSION = "4.0.2";
8501
8501
 
8502
8502
  // src/helpers/sdk-headers.ts
8503
8503
  var getSdkHeaders = () => ({
@@ -9209,6 +9209,15 @@ var createEditorListener = ({
9209
9209
  callbacks.animation(data.data);
9210
9210
  break;
9211
9211
  }
9212
+ case "builder.resetState": {
9213
+ const messageContent = data.data;
9214
+ const modelName = messageContent.model;
9215
+ const newState = messageContent?.state;
9216
+ if (modelName === model && newState) {
9217
+ callbacks.stateUpdate(newState);
9218
+ }
9219
+ break;
9220
+ }
9212
9221
  case "builder.contentUpdate": {
9213
9222
  const messageContent = data.data;
9214
9223
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -9243,6 +9252,8 @@ var subscribeToEditor = ({
9243
9252
  animation: () => {
9244
9253
  },
9245
9254
  configureSdk: () => {
9255
+ },
9256
+ stateUpdate: () => {
9246
9257
  }
9247
9258
  },
9248
9259
  model,
@@ -9341,6 +9352,7 @@ var getWrapperClassName = (variationId) => {
9341
9352
 
9342
9353
  // src/components/content/components/enable-editor.tsx
9343
9354
  function EnableEditor(props) {
9355
+ createSignal(false);
9344
9356
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
9345
9357
  const [httpReqsData, setHttpReqsData] = createSignal({});
9346
9358
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -9410,6 +9422,9 @@ function EnableEditor(props) {
9410
9422
  },
9411
9423
  contentUpdate: (newContent) => {
9412
9424
  mergeNewContent(newContent);
9425
+ },
9426
+ stateUpdate: (newState) => {
9427
+ mergeNewRootState(newState);
9413
9428
  }
9414
9429
  }
9415
9430
  })(event);
@@ -9504,8 +9519,12 @@ function EnableEditor(props) {
9504
9519
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
9505
9520
  }
9506
9521
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
9507
- if (shouldTrackImpression) {
9508
- const variationId = props.builderContextSignal.content?.testVariationId;
9522
+ const winningVariantId = getCookieSync({
9523
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
9524
+ canTrack: true
9525
+ });
9526
+ const variationId = props.builderContextSignal.content?.testVariationId;
9527
+ if (shouldTrackImpression && variationId === winningVariantId) {
9509
9528
  const contentId = props.builderContextSignal.content?.id;
9510
9529
  const apiKeyProp = props.apiKey;
9511
9530
  _track({
@@ -9514,7 +9533,7 @@ function EnableEditor(props) {
9514
9533
  canTrack: true,
9515
9534
  contentId,
9516
9535
  apiKey: apiKeyProp,
9517
- variationId: variationId !== contentId ? variationId : void 0
9536
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
9518
9537
  });
9519
9538
  }
9520
9539
  if (isPreviewing() && !isEditing()) {
@@ -8008,7 +8008,7 @@ function getPreviewContent(_searchParams) {
8008
8008
  }
8009
8009
 
8010
8010
  // src/constants/sdk-version.ts
8011
- var SDK_VERSION = "4.0.0";
8011
+ var SDK_VERSION = "4.0.2";
8012
8012
 
8013
8013
  // src/helpers/sdk-headers.ts
8014
8014
  var getSdkHeaders = () => ({
@@ -8720,6 +8720,15 @@ var createEditorListener = ({
8720
8720
  callbacks.animation(data.data);
8721
8721
  break;
8722
8722
  }
8723
+ case "builder.resetState": {
8724
+ const messageContent = data.data;
8725
+ const modelName = messageContent.model;
8726
+ const newState = messageContent?.state;
8727
+ if (modelName === model && newState) {
8728
+ callbacks.stateUpdate(newState);
8729
+ }
8730
+ break;
8731
+ }
8723
8732
  case "builder.contentUpdate": {
8724
8733
  const messageContent = data.data;
8725
8734
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -8754,6 +8763,8 @@ var subscribeToEditor = ({
8754
8763
  animation: () => {
8755
8764
  },
8756
8765
  configureSdk: () => {
8766
+ },
8767
+ stateUpdate: () => {
8757
8768
  }
8758
8769
  },
8759
8770
  model,
@@ -8852,6 +8863,7 @@ var getWrapperClassName = (variationId) => {
8852
8863
 
8853
8864
  // src/components/content/components/enable-editor.tsx
8854
8865
  function EnableEditor(props) {
8866
+ const [hasExecuted, setHasExecuted] = createSignal16(false);
8855
8867
  const [ContentWrapper, setContentWrapper] = createSignal16(
8856
8868
  props.contentWrapper || "div"
8857
8869
  );
@@ -8920,6 +8932,9 @@ function EnableEditor(props) {
8920
8932
  },
8921
8933
  contentUpdate: (newContent) => {
8922
8934
  mergeNewContent(newContent);
8935
+ },
8936
+ stateUpdate: (newState) => {
8937
+ mergeNewRootState(newState);
8923
8938
  }
8924
8939
  }
8925
8940
  })(event);
@@ -9029,8 +9044,12 @@ function EnableEditor(props) {
9029
9044
  );
9030
9045
  }
9031
9046
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
9032
- if (shouldTrackImpression) {
9033
- const variationId = props.builderContextSignal.content?.testVariationId;
9047
+ const winningVariantId = getCookieSync({
9048
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
9049
+ canTrack: true
9050
+ });
9051
+ const variationId = props.builderContextSignal.content?.testVariationId;
9052
+ if (shouldTrackImpression && variationId === winningVariantId) {
9034
9053
  const contentId = props.builderContextSignal.content?.id;
9035
9054
  const apiKeyProp = props.apiKey;
9036
9055
  _track({
@@ -9039,7 +9058,7 @@ function EnableEditor(props) {
9039
9058
  canTrack: true,
9040
9059
  contentId,
9041
9060
  apiKey: apiKeyProp,
9042
- variationId: variationId !== contentId ? variationId : void 0
9061
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
9043
9062
  });
9044
9063
  }
9045
9064
  if (isPreviewing() && !isEditing()) {
package/lib/node/dev.js CHANGED
@@ -5499,7 +5499,7 @@ function getPreviewContent(_searchParams) {
5499
5499
  }
5500
5500
 
5501
5501
  // src/constants/sdk-version.ts
5502
- var SDK_VERSION = "4.0.0";
5502
+ var SDK_VERSION = "4.0.2";
5503
5503
 
5504
5504
  // src/helpers/sdk-headers.ts
5505
5505
  var getSdkHeaders = () => ({
@@ -6217,6 +6217,15 @@ var createEditorListener = ({
6217
6217
  callbacks.animation(data.data);
6218
6218
  break;
6219
6219
  }
6220
+ case "builder.resetState": {
6221
+ const messageContent = data.data;
6222
+ const modelName = messageContent.model;
6223
+ const newState = messageContent?.state;
6224
+ if (modelName === model && newState) {
6225
+ callbacks.stateUpdate(newState);
6226
+ }
6227
+ break;
6228
+ }
6220
6229
  case "builder.contentUpdate": {
6221
6230
  const messageContent = data.data;
6222
6231
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -6251,6 +6260,8 @@ var subscribeToEditor = ({
6251
6260
  animation: () => {
6252
6261
  },
6253
6262
  configureSdk: () => {
6263
+ },
6264
+ stateUpdate: () => {
6254
6265
  }
6255
6266
  },
6256
6267
  model,
@@ -6349,6 +6360,7 @@ var getWrapperClassName = (variationId) => {
6349
6360
 
6350
6361
  // src/components/content/components/enable-editor.tsx
6351
6362
  function EnableEditor(props) {
6363
+ createSignal(false);
6352
6364
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6353
6365
  const [httpReqsData, setHttpReqsData] = createSignal({});
6354
6366
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6418,6 +6430,9 @@ function EnableEditor(props) {
6418
6430
  },
6419
6431
  contentUpdate: (newContent) => {
6420
6432
  mergeNewContent(newContent);
6433
+ },
6434
+ stateUpdate: (newState) => {
6435
+ mergeNewRootState(newState);
6421
6436
  }
6422
6437
  }
6423
6438
  })(event);
@@ -6513,8 +6528,12 @@ function EnableEditor(props) {
6513
6528
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
6514
6529
  }
6515
6530
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
6516
- if (shouldTrackImpression) {
6517
- const variationId = props.builderContextSignal.content?.testVariationId;
6531
+ const winningVariantId = getCookieSync({
6532
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
6533
+ canTrack: true
6534
+ });
6535
+ const variationId = props.builderContextSignal.content?.testVariationId;
6536
+ if (shouldTrackImpression && variationId === winningVariantId) {
6518
6537
  const contentId = props.builderContextSignal.content?.id;
6519
6538
  const apiKeyProp = props.apiKey;
6520
6539
  _track({
@@ -6523,7 +6542,7 @@ function EnableEditor(props) {
6523
6542
  canTrack: true,
6524
6543
  contentId,
6525
6544
  apiKey: apiKeyProp,
6526
- variationId: variationId !== contentId ? variationId : void 0
6545
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
6527
6546
  });
6528
6547
  }
6529
6548
  if (isPreviewing() && !isEditing()) {
package/lib/node/dev.jsx CHANGED
@@ -5008,7 +5008,7 @@ function getPreviewContent(_searchParams) {
5008
5008
  }
5009
5009
 
5010
5010
  // src/constants/sdk-version.ts
5011
- var SDK_VERSION = "4.0.0";
5011
+ var SDK_VERSION = "4.0.2";
5012
5012
 
5013
5013
  // src/helpers/sdk-headers.ts
5014
5014
  var getSdkHeaders = () => ({
@@ -5726,6 +5726,15 @@ var createEditorListener = ({
5726
5726
  callbacks.animation(data.data);
5727
5727
  break;
5728
5728
  }
5729
+ case "builder.resetState": {
5730
+ const messageContent = data.data;
5731
+ const modelName = messageContent.model;
5732
+ const newState = messageContent?.state;
5733
+ if (modelName === model && newState) {
5734
+ callbacks.stateUpdate(newState);
5735
+ }
5736
+ break;
5737
+ }
5729
5738
  case "builder.contentUpdate": {
5730
5739
  const messageContent = data.data;
5731
5740
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -5760,6 +5769,8 @@ var subscribeToEditor = ({
5760
5769
  animation: () => {
5761
5770
  },
5762
5771
  configureSdk: () => {
5772
+ },
5773
+ stateUpdate: () => {
5763
5774
  }
5764
5775
  },
5765
5776
  model,
@@ -5858,6 +5869,7 @@ var getWrapperClassName = (variationId) => {
5858
5869
 
5859
5870
  // src/components/content/components/enable-editor.tsx
5860
5871
  function EnableEditor(props) {
5872
+ const [hasExecuted, setHasExecuted] = createSignal16(false);
5861
5873
  const [ContentWrapper, setContentWrapper] = createSignal16(
5862
5874
  props.contentWrapper || "div"
5863
5875
  );
@@ -5926,6 +5938,9 @@ function EnableEditor(props) {
5926
5938
  },
5927
5939
  contentUpdate: (newContent) => {
5928
5940
  mergeNewContent(newContent);
5941
+ },
5942
+ stateUpdate: (newState) => {
5943
+ mergeNewRootState(newState);
5929
5944
  }
5930
5945
  }
5931
5946
  })(event);
@@ -6036,8 +6051,12 @@ function EnableEditor(props) {
6036
6051
  );
6037
6052
  }
6038
6053
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
6039
- if (shouldTrackImpression) {
6040
- const variationId = props.builderContextSignal.content?.testVariationId;
6054
+ const winningVariantId = getCookieSync({
6055
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
6056
+ canTrack: true
6057
+ });
6058
+ const variationId = props.builderContextSignal.content?.testVariationId;
6059
+ if (shouldTrackImpression && variationId === winningVariantId) {
6041
6060
  const contentId = props.builderContextSignal.content?.id;
6042
6061
  const apiKeyProp = props.apiKey;
6043
6062
  _track({
@@ -6046,7 +6065,7 @@ function EnableEditor(props) {
6046
6065
  canTrack: true,
6047
6066
  contentId,
6048
6067
  apiKey: apiKeyProp,
6049
- variationId: variationId !== contentId ? variationId : void 0
6068
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
6050
6069
  });
6051
6070
  }
6052
6071
  if (isPreviewing() && !isEditing()) {
package/lib/node/index.js CHANGED
@@ -5485,7 +5485,7 @@ function getPreviewContent(_searchParams) {
5485
5485
  }
5486
5486
 
5487
5487
  // src/constants/sdk-version.ts
5488
- var SDK_VERSION = "4.0.0";
5488
+ var SDK_VERSION = "4.0.2";
5489
5489
 
5490
5490
  // src/helpers/sdk-headers.ts
5491
5491
  var getSdkHeaders = () => ({
@@ -6197,6 +6197,15 @@ var createEditorListener = ({
6197
6197
  callbacks.animation(data.data);
6198
6198
  break;
6199
6199
  }
6200
+ case "builder.resetState": {
6201
+ const messageContent = data.data;
6202
+ const modelName = messageContent.model;
6203
+ const newState = messageContent?.state;
6204
+ if (modelName === model && newState) {
6205
+ callbacks.stateUpdate(newState);
6206
+ }
6207
+ break;
6208
+ }
6200
6209
  case "builder.contentUpdate": {
6201
6210
  const messageContent = data.data;
6202
6211
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -6231,6 +6240,8 @@ var subscribeToEditor = ({
6231
6240
  animation: () => {
6232
6241
  },
6233
6242
  configureSdk: () => {
6243
+ },
6244
+ stateUpdate: () => {
6234
6245
  }
6235
6246
  },
6236
6247
  model,
@@ -6329,6 +6340,7 @@ var getWrapperClassName = (variationId) => {
6329
6340
 
6330
6341
  // src/components/content/components/enable-editor.tsx
6331
6342
  function EnableEditor(props) {
6343
+ createSignal(false);
6332
6344
  const [ContentWrapper, setContentWrapper] = createSignal(props.contentWrapper || "div");
6333
6345
  const [httpReqsData, setHttpReqsData] = createSignal({});
6334
6346
  const [httpReqsPending, setHttpReqsPending] = createSignal({});
@@ -6398,6 +6410,9 @@ function EnableEditor(props) {
6398
6410
  },
6399
6411
  contentUpdate: (newContent) => {
6400
6412
  mergeNewContent(newContent);
6413
+ },
6414
+ stateUpdate: (newState) => {
6415
+ mergeNewRootState(newState);
6401
6416
  }
6402
6417
  }
6403
6418
  })(event);
@@ -6492,8 +6507,12 @@ function EnableEditor(props) {
6492
6507
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
6493
6508
  }
6494
6509
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
6495
- if (shouldTrackImpression) {
6496
- const variationId = props.builderContextSignal.content?.testVariationId;
6510
+ const winningVariantId = getCookieSync({
6511
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
6512
+ canTrack: true
6513
+ });
6514
+ const variationId = props.builderContextSignal.content?.testVariationId;
6515
+ if (shouldTrackImpression && variationId === winningVariantId) {
6497
6516
  const contentId = props.builderContextSignal.content?.id;
6498
6517
  const apiKeyProp = props.apiKey;
6499
6518
  _track({
@@ -6502,7 +6521,7 @@ function EnableEditor(props) {
6502
6521
  canTrack: true,
6503
6522
  contentId,
6504
6523
  apiKey: apiKeyProp,
6505
- variationId: variationId !== contentId ? variationId : void 0
6524
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
6506
6525
  });
6507
6526
  }
6508
6527
  if (isPreviewing() && !isEditing()) {
@@ -4996,7 +4996,7 @@ function getPreviewContent(_searchParams) {
4996
4996
  }
4997
4997
 
4998
4998
  // src/constants/sdk-version.ts
4999
- var SDK_VERSION = "4.0.0";
4999
+ var SDK_VERSION = "4.0.2";
5000
5000
 
5001
5001
  // src/helpers/sdk-headers.ts
5002
5002
  var getSdkHeaders = () => ({
@@ -5708,6 +5708,15 @@ var createEditorListener = ({
5708
5708
  callbacks.animation(data.data);
5709
5709
  break;
5710
5710
  }
5711
+ case "builder.resetState": {
5712
+ const messageContent = data.data;
5713
+ const modelName = messageContent.model;
5714
+ const newState = messageContent?.state;
5715
+ if (modelName === model && newState) {
5716
+ callbacks.stateUpdate(newState);
5717
+ }
5718
+ break;
5719
+ }
5711
5720
  case "builder.contentUpdate": {
5712
5721
  const messageContent = data.data;
5713
5722
  const key = messageContent.key || messageContent.alias || messageContent.entry || messageContent.modelName;
@@ -5742,6 +5751,8 @@ var subscribeToEditor = ({
5742
5751
  animation: () => {
5743
5752
  },
5744
5753
  configureSdk: () => {
5754
+ },
5755
+ stateUpdate: () => {
5745
5756
  }
5746
5757
  },
5747
5758
  model,
@@ -5840,6 +5851,7 @@ var getWrapperClassName = (variationId) => {
5840
5851
 
5841
5852
  // src/components/content/components/enable-editor.tsx
5842
5853
  function EnableEditor(props) {
5854
+ const [hasExecuted, setHasExecuted] = createSignal16(false);
5843
5855
  const [ContentWrapper, setContentWrapper] = createSignal16(
5844
5856
  props.contentWrapper || "div"
5845
5857
  );
@@ -5908,6 +5920,9 @@ function EnableEditor(props) {
5908
5920
  },
5909
5921
  contentUpdate: (newContent) => {
5910
5922
  mergeNewContent(newContent);
5923
+ },
5924
+ stateUpdate: (newState) => {
5925
+ mergeNewRootState(newState);
5911
5926
  }
5912
5927
  }
5913
5928
  })(event);
@@ -6017,8 +6032,12 @@ function EnableEditor(props) {
6017
6032
  );
6018
6033
  }
6019
6034
  const shouldTrackImpression = props.builderContextSignal.content && getDefaultCanTrack(props.canTrack);
6020
- if (shouldTrackImpression) {
6021
- const variationId = props.builderContextSignal.content?.testVariationId;
6035
+ const winningVariantId = getCookieSync({
6036
+ name: `builder.tests.${props.builderContextSignal.content?.id}`,
6037
+ canTrack: true
6038
+ });
6039
+ const variationId = props.builderContextSignal.content?.testVariationId;
6040
+ if (shouldTrackImpression && variationId === winningVariantId) {
6022
6041
  const contentId = props.builderContextSignal.content?.id;
6023
6042
  const apiKeyProp = props.apiKey;
6024
6043
  _track({
@@ -6027,7 +6046,7 @@ function EnableEditor(props) {
6027
6046
  canTrack: true,
6028
6047
  contentId,
6029
6048
  apiKey: apiKeyProp,
6030
- variationId: variationId !== contentId ? variationId : void 0
6049
+ variationId: winningVariantId !== contentId ? winningVariantId : void 0
6031
6050
  });
6032
6051
  }
6033
6052
  if (isPreviewing() && !isEditing()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",