@skrillex1224/playwright-toolkit 2.1.76 → 2.1.80

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.js CHANGED
@@ -2610,6 +2610,65 @@ var Mutation = {
2610
2610
  }
2611
2611
  };
2612
2612
 
2613
+ // src/display.js
2614
+ var Display = {
2615
+ parseTokenDisplayName(value) {
2616
+ if (!value) {
2617
+ return { owner: "", accountType: "", note: "" };
2618
+ }
2619
+ const parts = String(value).split(":");
2620
+ const owner = (parts[0] || "").trim();
2621
+ const accountType = (parts[1] || "").trim();
2622
+ const note = parts.length > 2 ? parts.slice(2).join(":").trim() : "";
2623
+ return { owner, accountType, note };
2624
+ },
2625
+ parseAccountDisplayName(value) {
2626
+ if (!value) {
2627
+ return { account: "", owner: "", accountType: "", note: "" };
2628
+ }
2629
+ const parts = String(value).split(":");
2630
+ const account = (parts[0] || "").trim();
2631
+ const owner = (parts[1] || "").trim();
2632
+ const accountType = (parts[2] || "").trim();
2633
+ const note = parts.length > 3 ? parts.slice(3).join(":").trim() : "";
2634
+ return { account, owner, accountType, note };
2635
+ },
2636
+ buildTokenDisplayName({ owner, accountType, note } = {}) {
2637
+ const trimmedOwner = owner?.trim() || "";
2638
+ const trimmedType = accountType?.trim() || "";
2639
+ const trimmedNote = note?.trim() || "";
2640
+ const parts = [trimmedOwner, trimmedType];
2641
+ if (trimmedNote) {
2642
+ parts.push(trimmedNote);
2643
+ }
2644
+ return parts.filter(Boolean).join(":");
2645
+ },
2646
+ shortId(value, max = 8) {
2647
+ const clean = String(value || "").trim();
2648
+ if (!clean) return "";
2649
+ if (clean.length <= max) return clean;
2650
+ return clean.slice(0, max);
2651
+ },
2652
+ resolveTokenIdentity(displayName, tokenId) {
2653
+ const cleanName = String(displayName || "").trim();
2654
+ const cleanId = String(tokenId || "").trim();
2655
+ const short = this.shortId(cleanId, 8);
2656
+ const hasName = cleanName !== "" && cleanName !== cleanId;
2657
+ const primary = hasName ? cleanName : short || "-";
2658
+ const secondary = hasName && short ? short : "";
2659
+ return { primary, secondary, fullId: cleanId, shortId: short };
2660
+ },
2661
+ resolveAccountIdentity(displayName, accountId) {
2662
+ const parts = this.parseAccountDisplayName(displayName);
2663
+ const cleanId = String(accountId || "").trim();
2664
+ const short = this.shortId(cleanId, 8);
2665
+ const hasName = parts.account !== "" && parts.account !== cleanId;
2666
+ const primary = hasName ? parts.account : short || "-";
2667
+ const secondary = hasName && short ? short : "";
2668
+ return { primary, secondary, parts, fullId: cleanId, shortId: short };
2669
+ }
2670
+ };
2671
+
2613
2672
  // entrys/node.js
2614
2673
  Logger.setLogger(crawleeLog);
2615
2674
  var usePlaywrightToolKit = () => {
@@ -2626,11 +2685,13 @@ var usePlaywrightToolKit = () => {
2626
2685
  Errors: errors_exports,
2627
2686
  Interception,
2628
2687
  Mutation,
2688
+ Display,
2629
2689
  Logger,
2630
2690
  $Internals: { LOG_TEMPLATES, stripAnsi }
2631
2691
  };
2632
2692
  };
2633
2693
  export {
2694
+ Display,
2634
2695
  usePlaywrightToolKit
2635
2696
  };
2636
2697
  //# sourceMappingURL=index.js.map