arcy.js 0.1.4 → 0.1.6

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.
package/dist/index.d.ts CHANGED
@@ -11,16 +11,31 @@ type ArcyEvent = "ready" | "open" | "close";
11
11
  type ArcyEventHandler = () => void;
12
12
  /** The function `on()` hands back. Calling it removes that one handler. */
13
13
  type Unsubscribe = () => void;
14
+ /** A plain JSON object, which is what an Object attribute holds. */
15
+ type AttributeObject = {
16
+ [key: string]: AttributeJson;
17
+ };
18
+ type AttributeJson = string | number | boolean | null | AttributeJson[] | AttributeObject;
14
19
  /**
15
- * What an attribute value may be. Mirrors the five trait data types the backend
20
+ * What an attribute value may be. Mirrors the seven data types the backend
16
21
  * registry accepts (PRODUCT_SCOPE §9.1.5), plus `null`, which clears the key
17
22
  * and is the only value that does.
18
23
  *
19
- * Typing is enforced server-side against the declared trait, not here: the
20
- * widget cannot know what an app has declared, and validating twice with one
21
- * side guessing produces disagreements that are worse than no check at all.
24
+ * **Object and Object list were added by ADR 0198**, for two real customer
25
+ * shapes: an array of every listing a seller has created, and that seller's
26
+ * single notification-preferences object. Additive to a published type
27
+ * (ADR 0050), so no install breaks, and it is what stops the TypeScript
28
+ * install refusing a shape the customer already holds.
29
+ *
30
+ * Typing is enforced server-side against the declared attribute, not here:
31
+ * the widget cannot know what an app has declared, and validating twice with
32
+ * one side guessing produces disagreements that are worse than no check at
33
+ * all. That is also why the caps on an object value (10KB serialized, depth
34
+ * 5, 200 elements, 50 keys) are not expressed here: an over-cap value is
35
+ * refused per key on the server and named on the Attributes page, which is
36
+ * the surface built to explain it.
22
37
  */
23
- type AttributeValue = string | number | boolean | null | string[];
38
+ type AttributeValue = string | number | boolean | null | string[] | AttributeObject | AttributeObject[];
24
39
  type Attributes = Record<string, AttributeValue>;
25
40
  /**
26
41
  * What a caller may hand `identify()`, and it is deliberately wider than what
@@ -166,4 +181,4 @@ declare const VERSION = "0.1.1";
166
181
  */
167
182
  declare const arcy: Arcy;
168
183
 
169
- export { type Arcy, type ArcyEvent, type ArcyEventHandler, type ArcyOptions, type AttributeValue, type Attributes, type AttributesInput, type Unsubscribe, VERSION, arcy as default };
184
+ export { type Arcy, type ArcyEvent, type ArcyEventHandler, type ArcyOptions, type AttributeObject, type AttributeValue, type Attributes, type AttributesInput, type Unsubscribe, VERSION, arcy as default };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { FALLBACK_CHROME, resolveImageUrl, FONT_KEY_PROPERTY, isRenderableImageUrl, readViewport, POLICY_LINK_CLASS, BAR_TRAY_CLASS, ATTACHABLE_TYPES, TOOLTIP_CSS, surfaceWidth, clampOffsetX, dragTransform, carriesFiles, droppedFiles, MOBILE_MARGIN, CHAT_CONTRACT, CHAT_GLOBAL } from './chunk-DW3GUQ6J.js';
2
2
  import { createShellState, safeStore, browserSessionStorage, writeJson, browserLocalStorage, readJson, hasPendingPreview, createFlowRunState, FLOW_CONTRACT, FLOW_GLOBAL } from './chunk-FR6SJSDU.js';
3
3
  import { PICKER_CONTRACT, PICKER_GLOBAL } from './chunk-DKYMIAYF.js';
4
- import { DESIGN_MODE_PROTOCOL, DESIGN_MODE_EXIT, DESIGN_MODE_SCREENSHOT, DESIGN_MODE_PICK, DESIGN_MODE_READY } from './chunk-GDGE3HLE.js';
4
+ import { DESIGN_MODE_PROTOCOL, DESIGN_MODE_EXIT, DESIGN_MODE_SCREENSHOT, DESIGN_MODE_PICK, DESIGN_MODE_READY } from './chunk-7S5DA67F.js';
5
5
  import { warn, reportCspViolations, releaseHostFocus, Z_INDEX, createShell, injectStyles } from './chunk-LGWYJSYX.js';
6
- import { captureEventFingerprint, containsPii } from './chunk-NY3NXM2V.js';
6
+ import { captureEventFingerprint, containsPii } from './chunk-AW7DHYSA.js';
7
7
 
8
8
  /* arcy.js — https://arcyai.com */
9
9
 
@@ -4334,15 +4334,19 @@ function createArcyInternals(internalOptions = {}) {
4334
4334
  token,
4335
4335
  sessionToken,
4336
4336
  sessionId: telemetry?.sessionId(),
4337
- // Slice 18.1's trigger conditions read traits set via identify();
4338
- // `Attributes` also allows null and string[], neither of which
4339
- // `ConditionContext.getTrait` accepts, so both degrade to
4340
- // "unresolvable" rather than being coerced into something wrong.
4337
+ // Slice 18.1's trigger conditions read attributes set via identify().
4338
+ // Every present, non-null value is reported as it is and judged here
4339
+ // not at all (ADR 0205). Filtering lists out used to report a written
4340
+ // key as absent, which made `has_any_value` false for a list the
4341
+ // customer had sent; what a value *means* is `condition.ts`'s call and
4342
+ // is made in one place there.
4343
+ //
4344
+ // Nothing becomes comparable by arriving: `condition.ts` refuses every
4345
+ // comparison on an object or an array (ADR 0198's opaque rule), so no
4346
+ // value here can become `is "[object Object]"`.
4341
4347
  getTrait: (codeName) => {
4342
4348
  const value = identity.attributes[codeName];
4343
- if (value === void 0 || value === null || Array.isArray(value)) {
4344
- return void 0;
4345
- }
4349
+ if (value === void 0 || value === null) return void 0;
4346
4350
  return value;
4347
4351
  },
4348
4352
  // D1299: absent entirely (rather than answering false) when storage
@@ -4722,7 +4726,7 @@ var bundledChunks = {
4722
4726
  cdnBase: null,
4723
4727
  loadChat: (win, timeoutMs, setTimeoutImpl) => importChunk(
4724
4728
  win,
4725
- () => import('./chat-VOYR3S25.js'),
4729
+ () => import('./chat-NCTVDXR5.js'),
4726
4730
  CHAT_GLOBAL,
4727
4731
  CHAT_CONTRACT,
4728
4732
  "chat panel",
@@ -4731,7 +4735,7 @@ var bundledChunks = {
4731
4735
  ),
4732
4736
  loadFlow: (win, timeoutMs, setTimeoutImpl) => importChunk(
4733
4737
  win,
4734
- () => import('./flow-M7W3H3C5.js'),
4738
+ () => import('./flow-FGTIZOXU.js'),
4735
4739
  FLOW_GLOBAL,
4736
4740
  FLOW_CONTRACT,
4737
4741
  "flow engine",
@@ -4740,7 +4744,7 @@ var bundledChunks = {
4740
4744
  ),
4741
4745
  loadPicker: (win, timeoutMs, setTimeoutImpl) => importChunk(
4742
4746
  win,
4743
- () => import('./picker-GPZ2GHB4.js'),
4747
+ () => import('./picker-6REZLJW3.js'),
4744
4748
  PICKER_GLOBAL,
4745
4749
  PICKER_CONTRACT,
4746
4750
  "design-mode picker",