@drawbridge/components 0.1.23 → 0.1.24

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 (79) hide show
  1. package/dist/bridge/form-subdomain-embed.js +1 -0
  2. package/dist/bridge/form-subdomain-embed.mjs +1 -0
  3. package/dist/bridge/form-subdomain.js +5 -2
  4. package/dist/bridge/form-subdomain.mjs +5 -2
  5. package/dist/bridge/template-modal.js +2 -2
  6. package/dist/bridge/template-modal.mjs +2 -2
  7. package/dist/dashboard/buttons-subscription.js +27 -66
  8. package/dist/dashboard/buttons-subscription.mjs +27 -65
  9. package/dist/dashboard/card-payment-method.js +1 -1
  10. package/dist/dashboard/card-payment-method.mjs +1 -1
  11. package/dist/dashboard/card-section.js +2 -2
  12. package/dist/dashboard/card-section.mjs +2 -2
  13. package/dist/dashboard/card-setting.js +3 -4
  14. package/dist/dashboard/card-setting.mjs +3 -4
  15. package/dist/dashboard/card-task.js +4 -22
  16. package/dist/dashboard/card-task.mjs +4 -22
  17. package/dist/dashboard/card-tile.js +6 -6
  18. package/dist/dashboard/card-tile.mjs +6 -6
  19. package/dist/dashboard/drawer.js +2 -7
  20. package/dist/dashboard/drawer.mjs +3 -8
  21. package/dist/dashboard/form-organization-campaign.js +1 -1
  22. package/dist/dashboard/form-organization-campaign.mjs +1 -1
  23. package/dist/dashboard/form-organization-identity.js +3 -3
  24. package/dist/dashboard/form-organization-identity.mjs +3 -3
  25. package/dist/dashboard/form-organization-workflow.js +9 -7
  26. package/dist/dashboard/form-organization-workflow.mjs +9 -7
  27. package/dist/dashboard/form-organization.js +40 -3
  28. package/dist/dashboard/form-organization.mjs +40 -3
  29. package/dist/dashboard/guide.js +238 -0
  30. package/dist/dashboard/guide.mjs +209 -0
  31. package/dist/dashboard/input-combobox.js +2 -7
  32. package/dist/dashboard/input-combobox.mjs +2 -7
  33. package/dist/dashboard/list.js +1 -1
  34. package/dist/dashboard/list.mjs +1 -1
  35. package/dist/dashboard/menu.js +96 -188
  36. package/dist/dashboard/menu.mjs +97 -189
  37. package/dist/dashboard/modal.js +3 -9
  38. package/dist/dashboard/modal.mjs +4 -10
  39. package/dist/dashboard/notice.js +3 -5
  40. package/dist/dashboard/notice.mjs +3 -5
  41. package/dist/dashboard/table-cell-title.js +0 -2
  42. package/dist/dashboard/table-cell-title.mjs +0 -2
  43. package/dist/dashboard/table.js +20 -61
  44. package/dist/dashboard/table.mjs +20 -61
  45. package/dist/dashboard/template-dashboard.js +133 -35
  46. package/dist/dashboard/template-dashboard.mjs +134 -36
  47. package/dist/dashboard/template-socket.js +3 -19
  48. package/dist/dashboard/template-socket.mjs +3 -19
  49. package/dist/dashboard/template-ui.js +186 -150
  50. package/dist/dashboard/template-ui.mjs +187 -151
  51. package/dist/shared/lib/helpers.js +2 -9
  52. package/dist/shared/lib/helpers.mjs +2 -9
  53. package/dist/shared/overlay.js +3 -5
  54. package/dist/shared/overlay.mjs +3 -5
  55. package/package.json +13 -28
  56. package/types/dashboard/card-task.d.ts +1 -5
  57. package/types/dashboard/guide.d.ts +23 -0
  58. package/types/dashboard/table.d.ts +1 -3
  59. package/types/dashboard/template-dashboard.d.ts +1 -4
  60. package/types/dashboard/template-ui.d.ts +2 -2
  61. package/dist/dashboard/lib/escape.js +0 -48
  62. package/dist/dashboard/lib/escape.mjs +0 -25
  63. package/dist/dashboard/lib/rail.js +0 -75
  64. package/dist/dashboard/lib/rail.mjs +0 -46
  65. package/dist/dashboard/lib/throttle.js +0 -57
  66. package/dist/dashboard/lib/throttle.mjs +0 -34
  67. package/dist/dashboard/template-rail.js +0 -674
  68. package/dist/dashboard/template-rail.mjs +0 -640
  69. package/dist/icons/book-open.js +0 -46
  70. package/dist/icons/book-open.mjs +0 -27
  71. package/dist/icons/task.js +0 -46
  72. package/dist/icons/task.mjs +0 -27
  73. package/dist/shared/lib/motion.js +0 -27
  74. package/dist/shared/lib/motion.mjs +0 -4
  75. package/types/dashboard/lib/rail.d.ts +0 -32
  76. package/types/dashboard/lib/throttle.d.ts +0 -5
  77. package/types/dashboard/template-rail.d.ts +0 -36
  78. package/types/icons/book-open.d.ts +0 -5
  79. package/types/icons/task.d.ts +0 -5
@@ -37,7 +37,7 @@ var import_navigation = require("next/navigation");
37
37
  var import_react_query = require("@tanstack/react-query");
38
38
  var import_hooks = require("./lib/hooks");
39
39
  var import_wrapper_gradient = __toESM(require("../wrapper-gradient"));
40
- var import_template_rail = __toESM(require("./template-rail"));
40
+ var import_guide = __toESM(require("./guide"));
41
41
  var import_menu = require("./menu");
42
42
  var import_menu2 = __toESM(require("../icons/menu"));
43
43
  var import_switch = __toESM(require("../icons/switch"));
@@ -52,6 +52,7 @@ const offsets = {
52
52
  paddingTop: "pt-16 md:pt-0"
53
53
  };
54
54
  const isAccountPath = (path) => path === "/account" || path.startsWith("/account/");
55
+ let timeout;
55
56
  const TemplateUIHeaderBack = ({
56
57
  href,
57
58
  icon: Icon = import_arrow_left.default,
@@ -123,7 +124,6 @@ const TemplateUiHeader = ({
123
124
  active,
124
125
  campaign = {},
125
126
  className,
126
- guide,
127
127
  organization = {},
128
128
  params,
129
129
  path
@@ -187,14 +187,6 @@ const TemplateUiHeader = ({
187
187
  }
188
188
  }
189
189
  ),
190
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
191
- import_template_rail.TemplateRailBook,
192
- {
193
- ...{
194
- guide
195
- }
196
- }
197
- ),
198
190
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
199
191
  "div",
200
192
  {
@@ -295,11 +287,21 @@ const TemplateUi = ({
295
287
  queryKey: ["campaign", params.campaign]
296
288
  });
297
289
  const guide = (_b = (_a = account == null ? void 0 : account.data) == null ? void 0 : _a.guide) == null ? void 0 : _b[guideId];
290
+ const [run, setRun] = (0, import_react.useState)(false);
298
291
  const modal = (0, import_hooks.useModal)({
299
292
  queryClient
300
293
  });
301
294
  const actions = (0, import_react.useMemo)(
302
295
  () => {
296
+ const reset = () => {
297
+ modal.close();
298
+ queryClient.setQueryData(
299
+ ["menu"],
300
+ {
301
+ active: false
302
+ }
303
+ );
304
+ };
303
305
  const menu2 = () => {
304
306
  queryClient.setQueryData(
305
307
  ["menu"],
@@ -309,6 +311,10 @@ const TemplateUi = ({
309
311
  );
310
312
  };
311
313
  return {
314
+ guide: () => {
315
+ reset();
316
+ setRun(true);
317
+ },
312
318
  signout: () => {
313
319
  modal.open({
314
320
  message: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -345,158 +351,188 @@ const TemplateUi = ({
345
351
  },
346
352
  [queryClient, modal]
347
353
  );
348
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
349
- "div",
350
- {
351
- ...{
352
- className: "flex flex-col h-dvh overflow-hidden md:flex-row " + offsets.paddingTop
353
- },
354
- children: [
355
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
356
- TemplateUiHeader,
357
- {
358
- ...{
359
- actions,
360
- active: (_c = menu == null ? void 0 : menu.data) == null ? void 0 : _c.active,
361
- campaign: campaign == null ? void 0 : campaign.data,
362
- className: "z-30 fixed top-0 left-0 md:hidden",
363
- guide,
364
- organization: organization == null ? void 0 : organization.data,
365
- params,
366
- path
354
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [
355
+ guide && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
356
+ import_guide.default,
357
+ {
358
+ ...{
359
+ ...guide,
360
+ callback: async ({ action, step, type }) => {
361
+ var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j;
362
+ const key = action + "." + type;
363
+ if ((_a2 = step == null ? void 0 : step.data) == null ? void 0 : _a2[key]) {
364
+ clearTimeout(timeout);
365
+ setRun(false);
366
+ if (Array.isArray((_c2 = (_b2 = step == null ? void 0 : step.data) == null ? void 0 : _b2[key]) == null ? void 0 : _c2.state) && ((_f = (_e2 = (_d2 = step == null ? void 0 : step.data) == null ? void 0 : _d2[key]) == null ? void 0 : _e2.state) == null ? void 0 : _f.length) > 0) {
367
+ const promises = [];
368
+ (_h = (_g = step == null ? void 0 : step.data) == null ? void 0 : _g[key]) == null ? void 0 : _h.state.map((args) => promises.push(queryClient.setQueryData(...args)));
369
+ await Promise.all(promises);
370
+ }
371
+ if ((_j = (_i = step == null ? void 0 : step.data) == null ? void 0 : _i[key]) == null ? void 0 : _j.timeout) {
372
+ timeout = setTimeout(
373
+ () => {
374
+ setRun(true);
375
+ },
376
+ step.data[key].timeout
377
+ );
378
+ }
367
379
  }
368
- }
369
- ),
370
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
371
- "div",
372
- {
373
- ...{
374
- className: "z-[25] fixed top-0 left-0 w-full flex flex-col justify-between bg-black h-full transition duration-200 ease-out motion-reduce:transition-none md:z-0 md:relative md:w-1/3 lg:w-1/4 xl:w-1/5 " + (((_d = menu == null ? void 0 : menu.data) == null ? void 0 : _d.active) ? "translate-y-0 " + offsets.paddingTop : "-translate-y-full md:translate-y-0")
375
- },
376
- children: [
377
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
378
- TemplateUiHeader,
379
- {
380
- ...{
381
- actions,
382
- active: (_e = menu == null ? void 0 : menu.data) == null ? void 0 : _e.active,
383
- campaign: campaign == null ? void 0 : campaign.data,
384
- className: "hidden md:flex border-b border-gray-dark relative z-[3]",
385
- organization: organization == null ? void 0 : organization.data,
386
- params,
387
- path
380
+ if (type === "tour:end") {
381
+ setRun(false);
382
+ }
383
+ },
384
+ run
385
+ }
386
+ }
387
+ ),
388
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
389
+ "div",
390
+ {
391
+ ...{
392
+ className: "flex flex-col h-dvh overflow-hidden md:flex-row " + offsets.paddingTop
393
+ },
394
+ children: [
395
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
396
+ TemplateUiHeader,
397
+ {
398
+ ...{
399
+ actions,
400
+ active: (_c = menu == null ? void 0 : menu.data) == null ? void 0 : _c.active,
401
+ campaign: campaign == null ? void 0 : campaign.data,
402
+ className: "z-30 fixed top-0 left-0 md:hidden",
403
+ organization: organization == null ? void 0 : organization.data,
404
+ params,
405
+ path
406
+ }
407
+ }
408
+ ),
409
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
410
+ "div",
411
+ {
412
+ ...{
413
+ className: "z-[25] fixed top-0 left-0 w-full flex flex-col justify-between bg-black h-full transition duration-200 ease-in md:z-0 md:relative md:w-1/3 lg:w-1/4 xl:w-1/5 " + (((_d = menu == null ? void 0 : menu.data) == null ? void 0 : _d.active) ? "translate-y-0 " + offsets.paddingTop : "-translate-y-full md:translate-y-0")
414
+ },
415
+ children: [
416
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
417
+ TemplateUiHeader,
418
+ {
419
+ ...{
420
+ actions,
421
+ active: (_e = menu == null ? void 0 : menu.data) == null ? void 0 : _e.active,
422
+ campaign: campaign == null ? void 0 : campaign.data,
423
+ className: "hidden md:flex border-b border-gray-dark relative z-[3]",
424
+ organization: organization == null ? void 0 : organization.data,
425
+ params,
426
+ path
427
+ }
388
428
  }
389
- }
390
- ),
391
- (params == null ? void 0 : params.organization) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
392
- TemplateUiBand,
393
- {
394
- ...{
395
- record: params.campaign ? campaign == null ? void 0 : campaign.data : organization == null ? void 0 : organization.data
429
+ ),
430
+ (params == null ? void 0 : params.organization) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
431
+ TemplateUiBand,
432
+ {
433
+ ...{
434
+ record: params.campaign ? campaign == null ? void 0 : campaign.data : organization == null ? void 0 : organization.data
435
+ }
396
436
  }
397
- }
398
- ),
399
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
400
- import_wrapper_gradient.default,
401
- {
402
- ...{
403
- className: "flex-1 min-h-0",
404
- classNameGradient: "from-black to-transparent h-10",
405
- classNameScroll: "h-full"
406
- },
407
- children: [
408
- (params == null ? void 0 : params.organization) && !(organization == null ? void 0 : organization.isLoading) && (organization == null ? void 0 : organization.data) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: params.organization && params.campaign ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
409
- import_menu.MenuCampaign,
410
- {
411
- ...{
412
- campaign: params.campaign,
413
- onClick: actions.menu,
414
- organization: params.organization,
415
- path
416
- }
417
- },
418
- params.organization + "-" + params.campaign
419
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
420
- import_menu.MenuOrganization,
421
- {
422
- ...{
423
- onClick: actions.menu,
424
- organization: params.organization,
425
- path
437
+ ),
438
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
439
+ import_wrapper_gradient.default,
440
+ {
441
+ ...{
442
+ className: "flex-1 min-h-0",
443
+ classNameGradient: "from-black to-transparent h-10",
444
+ classNameScroll: "h-full"
445
+ },
446
+ children: [
447
+ (params == null ? void 0 : params.organization) && !(organization == null ? void 0 : organization.isLoading) && (organization == null ? void 0 : organization.data) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: params.organization && params.campaign ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
448
+ import_menu.MenuCampaign,
449
+ {
450
+ ...{
451
+ campaign: params.campaign,
452
+ onClick: actions.menu,
453
+ organization: params.organization,
454
+ path
455
+ }
456
+ },
457
+ params.organization + "-" + params.campaign
458
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
459
+ import_menu.MenuOrganization,
460
+ {
461
+ ...{
462
+ onClick: actions.menu,
463
+ organization: params.organization,
464
+ path
465
+ }
466
+ },
467
+ params.organization
468
+ ) }),
469
+ !(params == null ? void 0 : params.organization) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
470
+ import_menu.MenuApp,
471
+ {
472
+ ...{
473
+ onClick: actions.menu,
474
+ path
475
+ }
426
476
  }
427
- },
428
- params.organization
429
- ) }),
430
- !(params == null ? void 0 : params.organization) && !isAccountPath(path) && !path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
431
- import_menu.MenuApp,
432
- {
433
- ...{
434
- onClick: actions.menu,
435
- path
477
+ ),
478
+ path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
479
+ import_menu.MenuAdmin,
480
+ {
481
+ ...{
482
+ onClick: actions.menu,
483
+ path
484
+ }
436
485
  }
437
- }
438
- ),
439
- path.includes("/admin") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
440
- import_menu.MenuAdmin,
441
- {
442
- ...{
443
- onClick: actions.menu,
444
- path
486
+ ),
487
+ isAccountPath(path) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
488
+ import_menu.MenuAccount,
489
+ {
490
+ ...{
491
+ onClick: actions.menu,
492
+ path
493
+ }
445
494
  }
446
- }
447
- ),
448
- isAccountPath(path) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
449
- import_menu.MenuAccount,
495
+ )
496
+ ]
497
+ }
498
+ ),
499
+ !isAccountPath(path) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
500
+ "div",
501
+ {
502
+ ...{
503
+ className: "relative z-[3]"
504
+ },
505
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
506
+ import_menu.MenuAccountDropdown,
450
507
  {
451
508
  ...{
509
+ actions,
510
+ account,
511
+ balance,
512
+ guide,
513
+ modal,
452
514
  onClick: actions.menu,
453
515
  path
454
516
  }
455
517
  }
456
518
  )
457
- ]
458
- }
459
- ),
460
- !isAccountPath(path) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
461
- "div",
462
- {
463
- ...{
464
- className: "relative z-[3]"
465
- },
466
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
467
- import_menu.MenuAccountDropdown,
468
- {
469
- ...{
470
- actions,
471
- account,
472
- balance,
473
- modal,
474
- onClick: actions.menu,
475
- path
476
- }
477
- }
478
- )
479
- }
480
- )
481
- ]
482
- }
483
- ),
484
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
485
- import_template_rail.default,
486
- {
487
- ...{
488
- account: account == null ? void 0 : account.data,
489
- campaign: campaign == null ? void 0 : campaign.data,
490
- guide,
491
- organization: organization == null ? void 0 : organization.data,
492
- params,
493
- path
494
- },
495
- children
496
- }
497
- )
498
- ]
499
- }
500
- );
519
+ }
520
+ )
521
+ ]
522
+ }
523
+ ),
524
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
525
+ "div",
526
+ {
527
+ ...{
528
+ className: "flex flex-col h-full w-full md:w-3/4 lg:w-4/5"
529
+ },
530
+ children
531
+ }
532
+ )
533
+ ]
534
+ }
535
+ )
536
+ ] });
501
537
  };
502
538
  var template_ui_default = TemplateUi;