@vectoriox/iox-builder 11.18.2 → 11.19.0

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.
@@ -19,7 +19,7 @@ import { DialogModule } from 'primeng/dialog';
19
19
  import * as i2$1 from '@vectoriox/iox-ui';
20
20
  import { nodeCssId, needsGroupName, resolveBoundValue, STRUCTURAL_STATES as STRUCTURAL_STATES$1, VALIDATION_STATES as VALIDATION_STATES$1, VALIDATION_STATE_CLASS as VALIDATION_STATE_CLASS$1, DEFAULT_WIDTH_BY_TYPE, TEXT_DIRECTION_KEY, TEXT_ALIGN_KEY, TextAlign, COLOR_SCHEME_TRAIT, COLOR_SCHEMES, ColorScheme, LinkType, MAX_LINES_KEY, A11yTrait, BREAKPOINTS, Breakpoint, withSchemeInk, stripSuppressedProps, DeclarationContext, planPartRule, gateHoverRule, planResponsiveRules, resolveStyleProps, planStateRule, splitOuterProps, OUTER_STYLE_PROPS, compileTokenCssBlocks, catalogFontId, fontsForTokens, GOOGLE_FONTS_FILE_ORIGIN, googleFontHref, compileDeclarations, isLastEmittedStateKey, wrapInBreakpointQuery, BreakpointQueryKind, NEW_NODE_STYLE_DEFAULTS, defaultElementStyleFor, applyElementStyle, planDataSource, dataSourcePlanToRequest, normalizeCollectionResult, resolveRepeaterItems, getByPath, computeRelative, PROGRESS_ATTRIBUTE, interactionMarkerAttributes, cascadeChain, attachScrollProgress, ContextStore, ENTRANCE_ACTION_TYPES, EXIT_ACTION_TYPES, ComponentInstanceRegistryService, syncInteractionMarkers, entranceStartsHidden, isActionEnabled, restoreCountUp, SCROLL_PROGRESS_TRIGGER, armInteractionCounts, splitPressFeedback, isHoverPointer, isContextAction, contextActionEffect, resolveContextValue, effectiveActionType, INTERACTION_HIDDEN_ATTRIBUTE, COUNT_UP_ACTION, motionAllowed, settleInteraction, settleModeFor, playInteraction, resolveInteractionEasing, entranceDelay, repeatedRowIndex, entrancePreStateStyle, buildInteractionKeyframes, showToast, declaredInputNames, emptyImagePlaceholder, syncNodeDesignClasses, nodeTraitValue, syncNodeA11yAttributes, nodeA11yAttributes, safeSetInput, colorSchemeOf, withStateTransitions, composeVirtualTraits, stateNamesIn, partClassName, switchElementStyle, releaseElementStyle, countOverrides, setOverride, breakpointDef, breakpointForWidth, FormRenderState, collectContextSlotKeys, withContextSlots, needsAccessibleName, resolveInputs, setInputOverride, barReserveClass, compilePageStyle, nodeUsesContext, attachTooltips, showToastDesign, TOOLTIP_ATTRIBUTE, hidingHeadersIn, HeaderRuntime, isScrolled, SCROLLED_ATTRIBUTE, syncSubmitButtons, IS_PREVIEW, buttonBlockHref, layerFrame, rectInLayer, placeFloating, FloatingAlign, popoverSide, bootSlider, IoxPageModule, PALETTE_PRESETS, elementStyleById, PART_CLASS_NAMES } from '@vectoriox/iox-ui';
21
21
  export { ComponentInstanceRegistryService, VIRTUAL_TRAIT_KEYS, composeVirtualTraits } from '@vectoriox/iox-ui';
22
- import { StructureEdit, isAccordionPart, isDisclosurePart, isSliderPart, isTabsPart, isSegmentedPart, structureRefusal, StructureRefusal, SegmentedRole, SEGMENTED_MAX_OPTIONS, AccordionRole, SEGMENTED_MIN_OPTIONS, isExclusiveItemPart, TabsRole, ITEM_OPEN_STATE, readStyle, isSegmentedRoot, segmentedDefaultOn, segmentedOptions, isTabsRoot, isTabsFromContent, tabsTriggers, isAccordionRoot, isAccordionFromContent, accordionItems, initialAccordionOpen, accordionBehaviour, exclusiveItemLabel, exclusiveRootOf, tabTriggerOf, tabLabel, removeTabPair, tabPanelOf, tabsListOf, tabsPanelsOf, nextTabKey, CompositeBehaviourTrait, ACCORDION_DEFAULT_ONS, TabsBehaviourTrait, TABS_ACTIVATE_ONS, TABS_ORIENTATIONS, MarqueeTrait, MarqueeSpeed, MarqueeDirection, DisclosureRole, isExclusiveTrigger, onCompositeItemState, isCompositeItemOn, ShopActionType, runShopAction, runCompositeItemAction, shouldScrollToItem, rowIndexOf as rowIndexOf$1, slideIndexForRow, isMarqueeRoot, compositeScopeId, compositeRowKeys, isExclusiveRoot, ExclusiveRuntime, exclusiveDefaultOf, exclusiveLabelOf, exclusiveBehaviourOf, exclusiveKindOf, compositeKindOfRole, AccordionRuntime, isToggleKind, MarqueeRuntime, closestAccordionItem, isAnyCompositeRoot, SceneRole, isExclusiveList, buildCardRecipe, buildBadge, buildChip, buildAccordionRecipe, buildDisclosureRecipe, buildTabsRecipe, buildSegmentedRecipe, buildLightboxRecipe, buildMarqueeRecipe, buildCounterRecipe, buildReadingBarRecipe, SHOP_RECIPES, ShopRecipe, NO_ELEMENT_STYLE, CompositeKind, SliderRole, accordionItemLabel, segmentedOptionLabel, isExclusivePanels, isLockedPart, attachShop, ShopRole, accordionRootOf, accordionItemOf, addAccordionItem, addTabPair, segmentedAddRefusal, addSegmentedOption, isCompositeItem, accordionHeadingLevel, isCompositePanel, isCompositeTrigger, splitSliderChildren, hasSliderParts, SLIDE_CAPTION_TRAIT, SLIDER_SCROLL_PLAYS_TRAIT, SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderFlag } from '@vectoriox/iox-ui/composite-core';
22
+ import { StructureEdit, isAccordionPart, isDisclosurePart, isSliderPart, isTabsPart, isSegmentedPart, structureRefusal, StructureRefusal, SegmentedRole, SEGMENTED_MAX_OPTIONS, AccordionRole, SEGMENTED_MIN_OPTIONS, isExclusiveItemPart, TabsRole, ITEM_OPEN_STATE, readStyle, isSegmentedRoot, segmentedDefaultOn, segmentedOptions, isTabsRoot, isTabsFromContent, tabsTriggers, isAccordionRoot, isAccordionFromContent, accordionItems, initialAccordionOpen, accordionBehaviour, exclusiveItemLabel, exclusiveRootOf, tabTriggerOf, tabLabel, removeTabPair, tabPanelOf, tabsListOf, tabsPanelsOf, nextTabKey, CompositeBehaviourTrait, ACCORDION_DEFAULT_ONS, TabsBehaviourTrait, TABS_ACTIVATE_ONS, TABS_ORIENTATIONS, MarqueeTrait, MarqueeSpeed, MarqueeDirection, DisclosureRole, isExclusiveTrigger, onCompositeItemState, isCompositeItemOn, runAccountAction, ShopActionType, runShopAction, runCompositeItemAction, shouldScrollToItem, rowIndexOf as rowIndexOf$1, slideIndexForRow, isMarqueeRoot, compositeScopeId, compositeRowKeys, isExclusiveRoot, ExclusiveRuntime, exclusiveDefaultOf, exclusiveLabelOf, exclusiveBehaviourOf, exclusiveKindOf, compositeKindOfRole, AccordionRuntime, isToggleKind, MarqueeRuntime, closestAccordionItem, isAnyCompositeRoot, SceneRole, isExclusiveList, buildCardRecipe, buildBadge, buildChip, buildAccordionRecipe, buildDisclosureRecipe, buildTabsRecipe, buildSegmentedRecipe, buildLightboxRecipe, buildMarqueeRecipe, buildCounterRecipe, buildReadingBarRecipe, SHOP_RECIPES, ShopRecipe, ACCOUNT_RECIPES, AccountRecipe, NO_ELEMENT_STYLE, CompositeKind, SliderRole, accordionItemLabel, segmentedOptionLabel, isExclusivePanels, isLockedPart, attachShop, ShopRole, attachAccount, AccountRole, accordionRootOf, accordionItemOf, addAccordionItem, addTabPair, segmentedAddRefusal, addSegmentedOption, isCompositeItem, accordionHeadingLevel, isCompositePanel, isCompositeTrigger, splitSliderChildren, hasSliderParts, SLIDE_CAPTION_TRAIT, SLIDER_SCROLL_PLAYS_TRAIT, SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderFlag } from '@vectoriox/iox-ui/composite-core';
23
23
  import { formContentInHost, isInteractiveHost, findFormContentInHosts, FORM_CHANNEL_ROLE, channelHref, channelOpensNewTab, FORM_ACTIONS_ROLE, SUBMIT_BUTTON_NODE_TYPE, FORM_AFTER_SEND_TRAIT, FormAfterSend } from '@vectoriox/iox-ui/forms-core';
24
24
  import { Subject, BehaviorSubject, of, forkJoin } from 'rxjs';
25
25
  import interact from 'interactjs';
@@ -27,10 +27,11 @@ import { HeaderTrait, HeaderBehaviour, HeaderEdge, pageOpeningScheme } from '@ve
27
27
  import { map, catchError } from 'rxjs/operators';
28
28
  import * as i1 from '@angular/common/http';
29
29
  import { SAMPLE_PRODUCT, productInScope, simulatedCartTransport, storefrontCatalog, SAMPLE_STUDIO, SAMPLE_CART_LINE, SAMPLE_SWATCHES } from '@vectoriox/iox-ui/commerce-core';
30
- import { POPOVER_ACTION_TYPE_SET, TOAST_ACTION_TYPES, itemActionOf, BEHAVIOUR_ACTION_TYPES, SHOP_ACTION_TYPES, SERVER_ELEMENT_ACTION_TYPES, CONSENT_ACTION_TYPES, opensAtClickedItem, openedDialogId, DIALOG_CLOSING_ATTRIBUTE, cancelExit, runExitMotion, popoverOpenersSelector, popoverDomId } from '@vectoriox/iox-ui/actions-core';
30
+ import { POPOVER_ACTION_TYPE_SET, TOAST_ACTION_TYPES, itemActionOf, BEHAVIOUR_ACTION_TYPES, SHOP_ACTION_TYPES, ACCOUNT_ACTION_TYPES, SERVER_ELEMENT_ACTION_TYPES, CONSENT_ACTION_TYPES, opensAtClickedItem, openedDialogId, DIALOG_CLOSING_ATTRIBUTE, cancelExit, runExitMotion, popoverOpenersSelector, popoverDomId } from '@vectoriox/iox-ui/actions-core';
31
31
  import { NavRole, navShapeBreakpoint, entranceInteraction, entranceAction, sectionEntrances, EntrancePart } from '@vectoriox/iox-ui/generation-core';
32
32
  import { ScrollDriver, syncSceneAttributes, buildSceneRecipe } from '@vectoriox/iox-ui/scene-core';
33
33
  import Lenis from 'lenis';
34
+ import { simulatedSiteAuthTransport } from '@vectoriox/iox-ui/identity-core';
34
35
  import Moveable from 'moveable';
35
36
  import Selecto from 'selecto';
36
37
  import * as i18 from 'primeng/api';
@@ -5078,6 +5079,16 @@ class InteractionEngineService {
5078
5079
  this.executeShopAction(action, selfEl);
5079
5080
  continue;
5080
5081
  }
5082
+ // Account actions (commerce E3a). Both SIMULATE: the canvas's account runtime runs over a sample transport —
5083
+ // Sign in opens the page's sign-in dialog (or, signed in, the menu), Sign out returns the parts to signed out;
5084
+ // no session is made or ended. The toast says what the live site does.
5085
+ if (ACCOUNT_ACTION_TYPES.has(action.type)) {
5086
+ if (selfEl)
5087
+ void runAccountAction(selfEl, action.type);
5088
+ const detail = { type: action.type, params: action.params ?? {}, target: action.target };
5089
+ window.dispatchEvent(new CustomEvent('iox-action-simulated', { detail }));
5090
+ continue;
5091
+ }
5081
5092
  // Tier-B server actions (A2). ALWAYS a simulation here: the canvas is the ADMIN's
5082
5093
  // browser and a server action is a public-site write (an email, a webhook, a content
5083
5094
  // row) — the toast says what the LIVE site would do.
@@ -6742,6 +6753,8 @@ var CompositePresetId;
6742
6753
  CompositePresetId["BuyNow"] = "shop-buy-now";
6743
6754
  CompositePresetId["CartButton"] = "shop-cart-button";
6744
6755
  CompositePresetId["CartDrawer"] = "shop-cart-drawer";
6756
+ CompositePresetId["AccountEntry"] = "account-entry";
6757
+ CompositePresetId["SignInDialog"] = "account-sign-in";
6745
6758
  })(CompositePresetId || (CompositePresetId = {}));
6746
6759
  /** Where a composite sits in the Components panel (composite plan §6d): content blocks, or the interactive
6747
6760
  * composites (the Accordion — CC2, the Disclosure — CC2.1, Tabs — CC4a, the Segmented control — CC4b; the floating
@@ -6851,6 +6864,17 @@ const COMPOSITE_PRESETS = Object.freeze([
6851
6864
  description: 'The bag: its lines, the subtotal with VAT included, Check out and Keep shopping. Slides in from the edge; a sheet on a phone.',
6852
6865
  build: create => SHOP_RECIPES[ShopRecipe.CartDrawer](create),
6853
6866
  },
6867
+ // Commerce E3a — the buyer's account (commerce board 12). Optional everywhere: buying never needs an account (C-D4).
6868
+ {
6869
+ id: CompositePresetId.AccountEntry, group: CompositePaletteGroup.Shop, name: 'Account', icon: 'ph-thin ph-user-circle',
6870
+ description: '"Sign in" for a visitor, their initial once signed in — with a menu: their orders and Sign out. Opens the sign-in dialog.',
6871
+ build: create => ACCOUNT_RECIPES[AccountRecipe.Entry](create),
6872
+ },
6873
+ {
6874
+ id: CompositePresetId.SignInDialog, group: CompositePaletteGroup.Shop, name: 'Sign-in dialog', icon: 'ph-thin ph-sign-in',
6875
+ description: 'Sign in with Google or a 6-digit code sent by email — never a password. Place it once; every Account button opens it.',
6876
+ build: create => ACCOUNT_RECIPES[AccountRecipe.SignInDialog](create),
6877
+ },
6854
6878
  ]);
6855
6879
  /**
6856
6880
  * The builder's node factory for composite-core recipes: a NEW node as the palette creates one
@@ -10000,6 +10024,9 @@ class BuilderComponent {
10000
10024
  /** Commerce E1c: the shop parts run on the canvas — the live site's runtime over an in-memory SAMPLE bag that starts
10001
10025
  * with one line (so the drawer has a line to design) and is never written anywhere. */
10002
10026
  this.canvasShop = null;
10027
+ /** Commerce E3a: the account parts run on the canvas — the live site's runtime over a SIMULATED sign-in (any email
10028
+ * takes a code; 123456 signs in as the sample buyer). Nothing is sent and no session exists. */
10029
+ this.canvasAccount = null;
10003
10030
  this.instanceRegistry = inject(ComponentInstanceRegistryService);
10004
10031
  this.layout = [];
10005
10032
  this.dataSources = [];
@@ -10198,6 +10225,7 @@ class BuilderComponent {
10198
10225
  this.overlayService.setContainer(this.previewCanvas?.nativeElement || null);
10199
10226
  this.attachCanvasFloating();
10200
10227
  this.attachCanvasShop();
10228
+ this.attachCanvasAccount();
10201
10229
  // Builder dispatches synthetic 'scroll' events on .preview-lenis-content from
10202
10230
  // the Lenis callback — point the overlay scroll listener at that element.
10203
10231
  // (Not previewScrollRef which is the Lenis eventsTarget — dispatching there
@@ -10350,6 +10378,45 @@ class BuilderComponent {
10350
10378
  },
10351
10379
  });
10352
10380
  }
10381
+ attachCanvasAccount() {
10382
+ const root = this.previewCanvas?.nativeElement;
10383
+ if (!root || this.canvasAccount)
10384
+ return;
10385
+ const simulated = (type) => window.dispatchEvent(new CustomEvent('iox-action-simulated', { detail: { type, params: {}, target: '' } }));
10386
+ this.canvasAccount = attachAccount(root, {
10387
+ transport: simulatedSiteAuthTransport(),
10388
+ observe: true,
10389
+ publish: (slot, value) => this.contextStore.set(slot, value),
10390
+ openDialog: () => {
10391
+ const dialog = this.findByRole([...(this.layout ?? []), ...(this.globalElements ?? [])], AccountRole.SignIn);
10392
+ if (dialog?.id)
10393
+ this.instanceRegistry.get(dialog.id)?.open?.();
10394
+ },
10395
+ closeDialog: () => {
10396
+ const dialog = this.findByRole([...(this.layout ?? []), ...(this.globalElements ?? [])], AccountRole.SignIn);
10397
+ if (dialog?.id)
10398
+ this.instanceRegistry.get(dialog.id)?.close?.();
10399
+ },
10400
+ openMenu: (menu, opener) => {
10401
+ const id = this.nodeIdOf(menu) ?? this.findByRole([...(this.layout ?? []), ...(this.globalElements ?? [])], AccountRole.Menu)?.id;
10402
+ if (id)
10403
+ this.instanceRegistry.get(id)?.open?.(opener);
10404
+ },
10405
+ closeMenu: menu => {
10406
+ const id = this.nodeIdOf(menu);
10407
+ if (id)
10408
+ this.instanceRegistry.get(id)?.close?.();
10409
+ },
10410
+ navigate: () => simulated('signIn'),
10411
+ returnPath: () => '/',
10412
+ });
10413
+ }
10414
+ /** The node id an element of the canvas renders (`iox-node-<id>` on it or its host). */
10415
+ nodeIdOf(el) {
10416
+ const host = el.closest('[class*="iox-node-"]');
10417
+ const cls = host ? Array.from(host.classList).find(c => c.startsWith('iox-node-')) : undefined;
10418
+ return cls ? cls.slice('iox-node-'.length) : null;
10419
+ }
10353
10420
  findByRole(nodes, role) {
10354
10421
  for (const node of nodes ?? []) {
10355
10422
  if (node.role === role)
@@ -10408,6 +10475,8 @@ class BuilderComponent {
10408
10475
  clearTimeout(this.contextRenderTimer);
10409
10476
  this.canvasShop?.destroy();
10410
10477
  this.canvasShop = null;
10478
+ this.canvasAccount?.destroy();
10479
+ this.canvasAccount = null;
10411
10480
  this.floatingSub?.unsubscribe();
10412
10481
  this.canvasTooltips?.destroy();
10413
10482
  this.canvasTooltips = null;