@builder.io/sdk-qwik 0.18.11 → 0.18.13

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.
Files changed (67) hide show
  1. package/lib/browser/blocks/personalization-container/component-info.qwik.cjs +48 -0
  2. package/lib/browser/blocks/personalization-container/component-info.qwik.mjs +48 -0
  3. package/lib/browser/blocks/personalization-container/helpers/inlined-fns.qwik.cjs +82 -0
  4. package/lib/browser/blocks/personalization-container/helpers/inlined-fns.qwik.mjs +82 -0
  5. package/lib/browser/blocks/personalization-container/helpers.qwik.cjs +86 -0
  6. package/lib/browser/blocks/personalization-container/helpers.qwik.mjs +87 -0
  7. package/lib/browser/blocks/personalization-container/personalization-container.qwik.cjs +382 -0
  8. package/lib/browser/blocks/personalization-container/personalization-container.qwik.mjs +382 -0
  9. package/lib/browser/blocks/symbol/symbol.qwik.cjs +15 -10
  10. package/lib/browser/blocks/symbol/symbol.qwik.mjs +15 -10
  11. package/lib/browser/components/block/components/interactive-element.qwik.cjs +20 -12
  12. package/lib/browser/components/block/components/interactive-element.qwik.mjs +21 -13
  13. package/lib/browser/components/blocks/blocks.qwik.cjs +37 -34
  14. package/lib/browser/components/blocks/blocks.qwik.mjs +38 -35
  15. package/lib/browser/components/content-variants/content-variants.qwik.cjs +42 -21
  16. package/lib/browser/components/content-variants/content-variants.qwik.mjs +42 -21
  17. package/lib/browser/constants/builder-registered-components.qwik.cjs +14 -10
  18. package/lib/browser/constants/builder-registered-components.qwik.mjs +14 -10
  19. package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
  20. package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
  21. package/lib/edge/blocks/personalization-container/component-info.qwik.cjs +48 -0
  22. package/lib/edge/blocks/personalization-container/component-info.qwik.mjs +48 -0
  23. package/lib/edge/blocks/personalization-container/helpers/inlined-fns.qwik.cjs +82 -0
  24. package/lib/edge/blocks/personalization-container/helpers/inlined-fns.qwik.mjs +82 -0
  25. package/lib/edge/blocks/personalization-container/helpers.qwik.cjs +86 -0
  26. package/lib/edge/blocks/personalization-container/helpers.qwik.mjs +87 -0
  27. package/lib/edge/blocks/personalization-container/personalization-container.qwik.cjs +382 -0
  28. package/lib/edge/blocks/personalization-container/personalization-container.qwik.mjs +382 -0
  29. package/lib/edge/blocks/symbol/symbol.qwik.cjs +15 -10
  30. package/lib/edge/blocks/symbol/symbol.qwik.mjs +15 -10
  31. package/lib/edge/components/block/components/interactive-element.qwik.cjs +20 -12
  32. package/lib/edge/components/block/components/interactive-element.qwik.mjs +21 -13
  33. package/lib/edge/components/blocks/blocks.qwik.cjs +37 -34
  34. package/lib/edge/components/blocks/blocks.qwik.mjs +38 -35
  35. package/lib/edge/components/content-variants/content-variants.qwik.cjs +42 -21
  36. package/lib/edge/components/content-variants/content-variants.qwik.mjs +42 -21
  37. package/lib/edge/constants/builder-registered-components.qwik.cjs +14 -11
  38. package/lib/edge/constants/builder-registered-components.qwik.mjs +14 -11
  39. package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
  40. package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
  41. package/lib/node/blocks/personalization-container/component-info.qwik.cjs +48 -0
  42. package/lib/node/blocks/personalization-container/component-info.qwik.mjs +48 -0
  43. package/lib/node/blocks/personalization-container/helpers/inlined-fns.qwik.cjs +82 -0
  44. package/lib/node/blocks/personalization-container/helpers/inlined-fns.qwik.mjs +82 -0
  45. package/lib/node/blocks/personalization-container/helpers.qwik.cjs +86 -0
  46. package/lib/node/blocks/personalization-container/helpers.qwik.mjs +87 -0
  47. package/lib/node/blocks/personalization-container/personalization-container.qwik.cjs +382 -0
  48. package/lib/node/blocks/personalization-container/personalization-container.qwik.mjs +382 -0
  49. package/lib/node/blocks/symbol/symbol.qwik.cjs +15 -10
  50. package/lib/node/blocks/symbol/symbol.qwik.mjs +15 -10
  51. package/lib/node/components/block/components/interactive-element.qwik.cjs +20 -12
  52. package/lib/node/components/block/components/interactive-element.qwik.mjs +21 -13
  53. package/lib/node/components/blocks/blocks.qwik.cjs +37 -34
  54. package/lib/node/components/blocks/blocks.qwik.mjs +38 -35
  55. package/lib/node/components/content-variants/content-variants.qwik.cjs +42 -21
  56. package/lib/node/components/content-variants/content-variants.qwik.mjs +42 -21
  57. package/lib/node/constants/builder-registered-components.qwik.cjs +14 -11
  58. package/lib/node/constants/builder-registered-components.qwik.mjs +14 -11
  59. package/lib/node/constants/sdk-version.qwik.cjs +1 -1
  60. package/lib/node/constants/sdk-version.qwik.mjs +1 -1
  61. package/package.json +2 -2
  62. package/types/src/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
  63. package/types/src/blocks/personalization-container/helpers.d.ts +24 -4
  64. package/types/src/blocks/personalization-container/personalization-container.types.d.ts +2 -2
  65. package/types/src/components/blocks/blocks-wrapper.d.ts +13 -1
  66. package/types/src/components/blocks/blocks.types.d.ts +1 -1
  67. package/types/src/constants/sdk-version.d.ts +1 -1
@@ -1,5 +1,7 @@
1
1
  import type { BuilderBlock } from '../../types/builder-block';
2
+ import type { Target } from '../../types/targets';
2
3
  import type { PersonalizationContainerProps } from './personalization-container.types';
4
+ export declare const DEFAULT_INDEX = "default";
3
5
  export type UserAttributes = {
4
6
  date?: string | Date;
5
7
  urlPath?: string;
@@ -12,6 +14,25 @@ export type Query = {
12
14
  operator: QueryOperator;
13
15
  value: QueryValue;
14
16
  };
17
+ type BlocksToRenderReturnType = {
18
+ blocks: BuilderBlock[];
19
+ path: string;
20
+ index: number | typeof DEFAULT_INDEX;
21
+ };
22
+ /**
23
+ * SDKs that support Variant Containers
24
+ */
25
+ export declare const SDKS_SUPPORTING_PERSONALIZATION: Target[];
26
+ /**
27
+ * After hydration, we reset the tree
28
+ * These SDKs handle Personalization Container in a special way:
29
+ * - first, the inlined script will help us add `display: none`, `aria-hidden: true` and `hidden: true` to the non-winning variants
30
+ * - then, on mount / when the component is hydrated - we reset the tree with only the winning variant and deleting the entire tree
31
+ *
32
+ * This helps us to avoid flicker and show the correct / winning variant initially and then once we've hydrated we show the winning variant
33
+ * and keep a track of the cookies to update to the correct variant dynamically when the cookie updates.
34
+ */
35
+ export declare const SDKS_REQUIRING_RESET_APPROACH: Target[];
15
36
  export declare function checkShouldRenderVariants(variants: PersonalizationContainerProps['variants'], canTrack: boolean): boolean;
16
37
  export declare function getBlocksToRender({ variants, previewingIndex, isHydrated, filteredVariants, fallbackBlocks }: {
17
38
  variants: PersonalizationContainerProps['variants'];
@@ -19,9 +40,8 @@ export declare function getBlocksToRender({ variants, previewingIndex, isHydrate
19
40
  isHydrated: boolean;
20
41
  filteredVariants: PersonalizationContainerProps['variants'];
21
42
  fallbackBlocks?: BuilderBlock[];
22
- }): {
23
- blocks: BuilderBlock[];
24
- path: string | undefined;
25
- };
43
+ }): BlocksToRenderReturnType;
44
+ export declare const getInitPersonalizationVariantsFnsScriptString: () => string;
26
45
  export declare const getPersonalizationScript: (variants: PersonalizationContainerProps["variants"], blockId: string, locale?: string) => string;
46
+ export declare const getUpdateVisibilityStylesScript: (variants: PersonalizationContainerProps["variants"], blockId: string, locale?: string) => string;
27
47
  export { filterWithCustomTargeting } from './helpers/inlined-fns';
@@ -1,5 +1,5 @@
1
1
  import type { BuilderBlock } from '../../types/builder-block';
2
- import type { BuilderDataProps } from '../../types/builder-props';
2
+ import type { BuilderComponentsProp, BuilderDataProps } from '../../types/builder-props';
3
3
  import type { Query } from './helpers';
4
4
  export type PersonalizationContainerProps = {
5
5
  children?: any;
@@ -11,4 +11,4 @@ export type PersonalizationContainerProps = {
11
11
  startDate?: string;
12
12
  endDate?: string;
13
13
  }>;
14
- } & BuilderDataProps;
14
+ } & BuilderDataProps & BuilderComponentsProp;
@@ -9,7 +9,19 @@ export type BlocksWrapperProps = {
9
9
  */
10
10
  BlocksWrapper: any;
11
11
  /**
12
- * Additonal props to pass to `blocksWrapper`. Defaults to `{}`.
12
+ * Props to be applied to the wrapping element of blocks. Can be set in two ways:
13
+ * 1. Globally via `<Content blocksWrapperProps={{...}}/>` - applies to all blocks wrappers in the Content
14
+ * 2. Locally via `<Blocks BlocksWrapperProps={{...}}/>` - applies only to this specific blocks instance and overrides global props
15
+ *
16
+ * For merging both global and local props, spread the context props before adding your own:
17
+ * ```
18
+ * <Blocks
19
+ * BlocksWrapperProps={{
20
+ * ...builderContext.BlocksWrapperProps,
21
+ * 'data-test-id': 'my-test-id'
22
+ * }}
23
+ * />
24
+ * ```
13
25
  */
14
26
  BlocksWrapperProps: any;
15
27
  children?: any;
@@ -1,6 +1,6 @@
1
1
  import type { BuilderContextInterface, RegisteredComponents } from '../../context/types';
2
2
  import type { BlocksWrapperProps } from './blocks-wrapper.jsx';
3
- export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'BlocksWrapperProps' | 'classNameProp'>> & {
3
+ export type BlocksProps = Partial<Omit<BlocksWrapperProps, 'BlocksWrapper' | 'classNameProp'>> & {
4
4
  context?: BuilderContextInterface;
5
5
  registeredComponents?: RegisteredComponents;
6
6
  linkComponent?: any;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.18.11";
1
+ export declare const SDK_VERSION = "0.18.13";