@multisystemsuite/timezone-engine-angular 2.0.0 → 3.0.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.
package/dist/index.cjs CHANGED
@@ -5,6 +5,9 @@ var timezoneEngineCore = require('@multisystemsuite/timezone-engine-core');
5
5
  var timezoneEngineWorldData = require('@multisystemsuite/timezone-engine-world-data');
6
6
  var rxjs = require('rxjs');
7
7
  var common = require('@angular/common');
8
+ var timezoneEngineBusinessHours = require('@multisystemsuite/timezone-engine-business-hours');
9
+ var timezoneEngineShiftEngine = require('@multisystemsuite/timezone-engine-shift-engine');
10
+ var timezoneEngineScheduler = require('@multisystemsuite/timezone-engine-scheduler');
8
11
 
9
12
  var __defProp = Object.defineProperty;
10
13
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -227,6 +230,88 @@ exports.SchedulerComponent = __decorateClass([
227
230
  `
228
231
  })
229
232
  ], exports.SchedulerComponent);
233
+ exports.BusinessHoursComponent = class BusinessHoursComponent {
234
+ timezone = "UTC";
235
+ status = "Closed";
236
+ ngOnInit() {
237
+ const engine = timezoneEngineBusinessHours.businessHoursEngine(this.timezone);
238
+ this.status = engine.isBusinessHour(/* @__PURE__ */ new Date(), this.timezone) ? "Open" : "Closed";
239
+ }
240
+ };
241
+ __decorateClass([
242
+ core.Input()
243
+ ], exports.BusinessHoursComponent.prototype, "timezone", 2);
244
+ exports.BusinessHoursComponent = __decorateClass([
245
+ core.Component({
246
+ selector: "te-business-hours",
247
+ standalone: true,
248
+ template: `<div class="te-business-hours">{{ timezone }} \u2014 {{ status }}</div>`
249
+ })
250
+ ], exports.BusinessHoursComponent);
251
+ exports.ShiftPlannerComponent = class ShiftPlannerComponent {
252
+ timezone = "UTC";
253
+ shifts = [];
254
+ ngOnInit() {
255
+ this.shifts = timezoneEngineShiftEngine.shiftPlanner(this.timezone).getActiveShifts(/* @__PURE__ */ new Date());
256
+ }
257
+ };
258
+ __decorateClass([
259
+ core.Input()
260
+ ], exports.ShiftPlannerComponent.prototype, "timezone", 2);
261
+ exports.ShiftPlannerComponent = __decorateClass([
262
+ core.Component({
263
+ selector: "te-shift-planner",
264
+ standalone: true,
265
+ imports: [common.CommonModule],
266
+ template: `
267
+ <div class="te-shift-planner">
268
+ <h3>Shifts \u2014 {{ timezone }}</h3>
269
+ <ul>
270
+ @for (shift of shifts; track shift.id) {
271
+ <li>{{ shift.name }}: {{ shift.startTime }}\u2013{{ shift.endTime }}</li>
272
+ }
273
+ </ul>
274
+ </div>
275
+ `
276
+ })
277
+ ], exports.ShiftPlannerComponent);
278
+ exports.GlobalMeetingPlannerComponent = class GlobalMeetingPlannerComponent {
279
+ participantTimezones = [];
280
+ durationMinutes = 60;
281
+ slot = null;
282
+ ngOnInit() {
283
+ const scheduler = timezoneEngineScheduler.createSchedulerEngine(timezoneEngineScheduler.defaultSchedulerConfig);
284
+ this.slot = scheduler.suggestMeetingTime(
285
+ this.participantTimezones,
286
+ /* @__PURE__ */ new Date(),
287
+ this.durationMinutes
288
+ );
289
+ }
290
+ };
291
+ __decorateClass([
292
+ core.Input()
293
+ ], exports.GlobalMeetingPlannerComponent.prototype, "participantTimezones", 2);
294
+ __decorateClass([
295
+ core.Input()
296
+ ], exports.GlobalMeetingPlannerComponent.prototype, "durationMinutes", 2);
297
+ exports.GlobalMeetingPlannerComponent = __decorateClass([
298
+ core.Component({
299
+ selector: "te-global-meeting-planner",
300
+ standalone: true,
301
+ imports: [common.CommonModule, exports.WorldClockComponent],
302
+ template: `
303
+ <div class="te-global-meeting-planner">
304
+ <h3>Global Meeting Planner</h3>
305
+ @if (slot) {
306
+ <p>Suggested: {{ slot.start.toISOString() }} \u2014 {{ slot.timezone }}</p>
307
+ } @else {
308
+ <p>No slot available</p>
309
+ }
310
+ <te-world-clock [timezones]="participantTimezones" />
311
+ </div>
312
+ `
313
+ })
314
+ ], exports.GlobalMeetingPlannerComponent);
230
315
 
231
316
  // src/index.ts
232
317
  var TIMEZONE_ENGINE_IMPORTS = [
@@ -235,12 +320,25 @@ var TIMEZONE_ENGINE_IMPORTS = [
235
320
  exports.TeTimezonePipe,
236
321
  exports.WorldClockComponent,
237
322
  exports.RealtimeClockComponent,
238
- exports.SchedulerComponent
323
+ exports.SchedulerComponent,
324
+ exports.BusinessHoursComponent,
325
+ exports.ShiftPlannerComponent,
326
+ exports.GlobalMeetingPlannerComponent
327
+ ];
328
+ var TIMEZONE_BUSINESS_HOURS_IMPORTS = [exports.BusinessHoursComponent, exports.TeFormatDatePipe];
329
+ var TIMEZONE_SHIFT_ENGINE_IMPORTS = [exports.ShiftPlannerComponent, exports.TeFormatDatePipe];
330
+ var TIMEZONE_SCHEDULER_IMPORTS = [
331
+ exports.SchedulerComponent,
332
+ exports.GlobalMeetingPlannerComponent,
333
+ exports.WorldClockComponent
239
334
  ];
240
335
 
241
336
  exports.DateFormatPipe = exports.TeFormatDatePipe;
242
337
  exports.LiveClockComponent = exports.RealtimeClockComponent;
338
+ exports.TIMEZONE_BUSINESS_HOURS_IMPORTS = TIMEZONE_BUSINESS_HOURS_IMPORTS;
243
339
  exports.TIMEZONE_ENGINE_CONFIG = TIMEZONE_ENGINE_CONFIG;
244
340
  exports.TIMEZONE_ENGINE_IMPORTS = TIMEZONE_ENGINE_IMPORTS;
341
+ exports.TIMEZONE_SCHEDULER_IMPORTS = TIMEZONE_SCHEDULER_IMPORTS;
342
+ exports.TIMEZONE_SHIFT_ENGINE_IMPORTS = TIMEZONE_SHIFT_ENGINE_IMPORTS;
245
343
  //# sourceMappingURL=index.cjs.map
246
344
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/timezone.service.ts","../src/pipes.ts","../src/components.ts","../src/index.ts"],"names":["InjectionToken","TimezoneService","inject","createTimezoneEngine","BehaviorSubject","detectBrowserTimezone","getUserTimezone","formatDate","convertTimezone","compareTimezones","getWorldClock","getCountryTimezones","getCityTimezone","Injectable","WorldClockService","Observable","createLiveClockUpdater","TeFormatDatePipe","Pipe","TeRelativeTimePipe","formatRelativeTime","TeTimezonePipe","WorldClockComponent","Input","Component","CommonModule","LiveClockComponent","SchedulerComponent"],"mappings":";;;;;;;;;;;;;;;;;;AAoBO,IAAM,yBAAyB,IAAIA,mBAAA;AAAA,EACxC;AACF;AAIaC,0BAAN,qBAAA,CAAsB;AAAA,EACnB,MAAA,GAASC,YAAO,sBAAA,EAAwB,EAAE,UAAU,IAAA,EAAM,KAAK,EAAC;AAAA,EAChE,MAAA,GAAyBC,uCAAA,CAAqB,IAAA,CAAK,MAAM,CAAA;AAAA,EACzD,kBAAkB,IAAIC,oBAAA;AAAA,IAC5B,IAAA,CAAK,MAAA,CAAO,eAAA,IAAmBC,wCAAA,EAAsB,CAAE;AAAA,GACzD;AAAA,EAES,SAAA,GAAgC,IAAA,CAAK,eAAA,CAAgB,YAAA,EAAa;AAAA,EAE3E,IAAI,QAAA,GAAmB;AACrB,IAAA,OAAO,KAAK,eAAA,CAAgB,KAAA;AAAA,EAC9B;AAAA,EAEA,YAAY,EAAA,EAAkB;AAC5B,IAAA,IAAA,CAAK,eAAA,CAAgB,KAAK,EAAE,CAAA;AAC5B,IAAA,IAAA,CAAK,OAAO,MAAA,CAAO,MAAA,CAAO,EAAE,eAAA,EAAiB,IAAI,CAAA;AAAA,EACnD;AAAA,EAEA,cAAA,GAAyB;AACvB,IAAA,OAAOA,0CAAsB,CAAE,QAAA;AAAA,EACjC;AAAA,EAEA,eAAA,GAA0B;AACxB,IAAA,OAAOC,kCAAA,EAAgB;AAAA,EACzB;AAAA,EAEA,UAAA,CAAW,IAAA,EAA8B,OAAA,GAA6B,EAAC,EAAW;AAChF,IAAA,OAAOC,6BAAA,CAAW,MAAM,EAAE,QAAA,EAAU,KAAK,QAAA,EAAU,GAAG,SAAS,CAAA;AAAA,EACjE;AAAA,EAEA,eAAA,CACE,cAAA,EACA,cAAA,EACA,IAAA,EACM;AACN,IAAA,OAAOC,kCAAA,CAAgB;AAAA,MACrB,c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IAAA;AAAA,IACZ,QAAA,EAAU,CAAA,gDAAA;AAAA,GACX;AAAA,CAAA,EACYE,8BAAA,CAAA;AA2CAC,6BAAN,wBAAA,CAAyB;AAAA,EACrB,eAAqD,EAAC;AAAA,EACtD,eAAA,GAAkB,EAAA;AAAA,EAE3B,IAAI,oBAAA,GAAiC;AACnC,IAAA,OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,IAAA,CAAK,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,QAAQ,CAAC,CAAC,CAAA;AAAA,EAC9D;AACF;AANW,eAAA,CAAA;AAAA,EAARJ,UAAA;AAAM,CAAA,EADII,0BAAA,CACF,SAAA,EAAA,cAAA,EAAA,CAAA,CAAA;AACA,eAAA,CAAA;AAAA,EAARJ,UAAA;AAAM,CAAA,EAFII,0BAAA,CAEF,SAAA,EAAA,iBAAA,EAAA,CAAA,CAAA;AAFEA,0BAAA,GAAN,eAAA,CAAA;AAAA,EAjBNH,cAAA,CAAU;AAAA,IACT,QAAA,EAAU,cAAA;AAAA,IACV,UAAA,EAAY,IAAA;AAAA,IACZ,OAAA,EAAS,CAACC,mBAAA,EAAcH,2BAAmB,CAAA;AAAA,IAC3C,QAAA,EAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAAA,GAYX;AAAA,CAAA,EACYK,0BAAA,CAAA;;;AC7EN,IAAM,uBAAA,GAA0B;AAAA,EACrCV,wBAAA;AAAA,EACAE,0BAAA;AAAA,EACAE,sBAAA;AAAA,EACAC,2BAAA;AAAA,EACAI,8BAAA;AAAA,EACAC;AACF","file":"index.cjs","sourcesContent":["import { Injectable, InjectionToken, inject } from \"@angular/core\";\nimport type {\n FormatDateOptions,\n TimezoneEngineConfig,\n WorldClockEntry,\n} from \"@multisystemsuite/timezone-engine-shared-types\";\nimport {\n createTimezoneEngine,\n detectBrowserTimezone,\n formatDate,\n convertTimezone,\n compareTimezones,\n getWorldClock,\n createLiveClockUpdater,\n getUserTimezone,\n type TimezoneEngine,\n} from \"@multisystemsuite/timezone-engine-core\";\nimport { getCountryTimezones, getCityTimezone } from \"@multisystemsuite/timezone-engine-world-data\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\n\nexport const TIMEZONE_ENGINE_CONFIG = new InjectionToken<TimezoneEngineConfig>(\n \"TIMEZONE_ENGINE_CONFIG\",\n);\n\n/** Injectable timezone engine service for Angular */\n@Injectable({ providedIn: \"root\" })\nexport class TimezoneService {\n private config = inject(TIMEZONE_ENGINE_CONFIG, { optional: true }) ?? {};\n private engine: TimezoneEngine = createTimezoneEngine(this.config);\n private timezoneSubject = new BehaviorSubject<string>(\n this.config.defaultTimezone ?? detectBrowserTimezone().timezone,\n );\n\n readonly timezone$: Observable<string> = this.timezoneSubject.asObservable();\n\n get timezone(): string {\n return this.timezoneSubject.value;\n }\n\n setTimezone(tz: string): void {\n this.timezoneSubject.next(tz);\n this.engine.config.update({ defaultTimezone: tz });\n }\n\n detectTimezone(): string {\n return detectBrowserTimezone().timezone;\n }\n\n getUserTimezone(): string {\n return getUserTimezone();\n }\n\n formatDate(date: Date | string | number, options: FormatDateOptions = {}): string {\n return formatDate(date, { timezone: this.timezone, ...options });\n }\n\n convertTimezone(\n sourceTimezone: string,\n targetTimezone: string,\n date?: Date | string | number,\n ): Date {\n return convertTimezone({\n sourceTimezone,\n targetTimezone,\n ...(date !== undefined ? { date } : {}),\n });\n }\n\n compareTimezones(source: string, target: string, date?: Date | string | number) {\n return compareTimezones(source, target, date);\n }\n\n getWorldClock(timezones: string[]): WorldClockEntry[] {\n return getWorldClock(timezones);\n }\n\n getCountryTimezones(countryCode: string) {\n return getCountryTimezones(countryCode);\n }\n\n getCityTimezone(city: string) {\n return getCityTimezone(city);\n }\n\n getEngine(): TimezoneEngine {\n return this.engine;\n }\n}\n\n/** World clock observable stream */\n@Injectable({ providedIn: \"root\" })\nexport class WorldClockService {\n private timezoneService = inject(TimezoneService);\n\n createLiveClock(timezones: string[], intervalMs = 1000): Observable<WorldClockEntry[]> {\n return new Observable((subscriber) => {\n const updater = createLiveClockUpdater(\n timezones,\n (clocks) => {\n subscriber.next(clocks);\n },\n intervalMs,\n );\n updater.start();\n return () => {\n updater.stop();\n };\n });\n }\n}\n","import { Pipe, inject, type PipeTransform } from \"@angular/core\";\nimport type { FormatDateOptions } from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { formatRelativeTime } from \"@multisystemsuite/timezone-engine-core\";\nimport { TimezoneService } from \"./timezone.service.js\";\n\n/** Angular pipe for locale-aware date formatting */\n@Pipe({ name: \"teFormatDate\", standalone: true, pure: false })\nexport class TeFormatDatePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n format: FormatDateOptions[\"format\"] = \"DATETIME\",\n timezone?: string,\n locale?: string,\n ): string {\n if (value == null) return \"\";\n const options: FormatDateOptions = { format };\n if (timezone !== undefined) options.timezone = timezone;\n if (locale !== undefined) options.locale = locale;\n return this.timezoneService.formatDate(value, options);\n }\n}\n\n/** Angular pipe for relative time formatting */\n@Pipe({ name: \"teRelativeTime\", standalone: true })\nexport class TeRelativeTimePipe implements PipeTransform {\n transform(value: Date | string | number | null | undefined): string {\n if (value == null) return \"\";\n return formatRelativeTime(value);\n }\n}\n\n/** Angular pipe for timezone conversion display */\n@Pipe({ name: \"teTimezone\", standalone: true })\nexport class TeTimezonePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n targetTimezone: string,\n sourceTimezone?: string,\n ): Date | null {\n if (value == null) return null;\n const source = sourceTimezone ?? this.timezoneService.timezone;\n return this.timezoneService.convertTimezone(source, targetTimezone, value);\n }\n}\n","import { Component, Input, inject, type OnInit, type OnDestroy } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport type { WorldClockEntry } from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { WorldClockService, TimezoneService } from \"./timezone.service.js\";\nimport type { Subscription } from \"rxjs\";\n\n/** Standalone world clock component for Angular */\n@Component({\n selector: \"te-world-clock\",\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"te-clock\" data-testid=\"world-clock\">\n @for (clock of clocks; track clock.timezone) {\n <div class=\"te-clock__entry\">\n <strong>{{ clock.label }}</strong>\n <span>{{ clock.formattedTime }}</span>\n <small>{{ clock.utcOffset }}</small>\n </div>\n }\n </div>\n `,\n})\nexport class WorldClockComponent implements OnInit, OnDestroy {\n @Input() timezones: string[] = [\"UTC\", \"America/New_York\", \"Europe/London\", \"Asia/Kolkata\"];\n @Input() intervalMs = 1000;\n\n clocks: WorldClockEntry[] = [];\n private worldClockService = inject(WorldClockService);\n private subscription?: Subscription;\n\n ngOnInit(): void {\n this.subscription = this.worldClockService\n .createLiveClock(this.timezones, this.intervalMs)\n .subscribe((clocks) => {\n this.clocks = clocks;\n });\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n}\n\n/** Standalone live clock component */\n@Component({\n selector: \"te-live-clock\",\n standalone: true,\n template: `<span class=\"te-live-clock\">{{ display }}</span>`,\n})\nexport class LiveClockComponent implements OnInit, OnDestroy {\n @Input() timezone?: string;\n @Input() intervalMs = 1000;\n\n display = \"\";\n private timezoneService = inject(TimezoneService);\n private timerId?: ReturnType<typeof setInterval>;\n\n ngOnInit(): void {\n const tz = this.timezone ?? this.timezoneService.timezone;\n const update = () => {\n this.display = this.timezoneService.formatDate(new Date(), {\n format: \"TIME_ONLY\",\n timezone: tz,\n });\n };\n update();\n this.timerId = setInterval(update, this.intervalMs);\n }\n\n ngOnDestroy(): void {\n if (this.timerId !== undefined) clearInterval(this.timerId);\n }\n}\n\n/** Scheduler display component */\n@Component({\n selector: \"te-scheduler\",\n standalone: true,\n imports: [CommonModule, WorldClockComponent],\n template: `\n <div class=\"te-scheduler\">\n <h3 class=\"te-scheduler__title\">Meeting Scheduler</h3>\n <p>Duration: {{ durationMinutes }} minutes</p>\n <ul>\n @for (p of participants; track p.name) {\n <li>{{ p.name }} — {{ p.timezone }}</li>\n }\n </ul>\n <te-world-clock [timezones]=\"participantTimezones\" />\n </div>\n `,\n})\nexport class SchedulerComponent {\n @Input() participants: { name: string; timezone: string }[] = [];\n @Input() durationMinutes = 60;\n\n get participantTimezones(): string[] {\n return [...new Set(this.participants.map((p) => p.timezone))];\n }\n}\n","export { TimezoneService, WorldClockService, TIMEZONE_ENGINE_CONFIG } from \"./timezone.service.js\";\n\nexport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\n\n/** Enterprise alias for TeFormatDatePipe */\nexport { TeFormatDatePipe as DateFormatPipe } from \"./pipes.js\";\n\nexport { WorldClockComponent, LiveClockComponent, SchedulerComponent } from \"./components.js\";\n\n/** Enterprise alias for LiveClockComponent */\nexport { LiveClockComponent as RealtimeClockComponent } from \"./components.js\";\n\nimport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\nimport { WorldClockComponent, LiveClockComponent, SchedulerComponent } from \"./components.js\";\n\n/** Standalone imports bundle for Angular 17+ */\nexport const TIMEZONE_ENGINE_IMPORTS = [\n TeFormatDatePipe,\n TeRelativeTimePipe,\n TeTimezonePipe,\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n] as const;\n"]}
1
+ {"version":3,"sources":["../src/timezone.service.ts","../src/pipes.ts","../src/components.ts","../src/index.ts"],"names":["InjectionToken","TimezoneService","inject","createTimezoneEngine","BehaviorSubject","detectBrowserTimezone","getUserTimezone","formatDate","convertTimezone","compareTimezones","getWorldClock","getCountryTimezones","getCityTimezone","Injectable","WorldClockService","Observable","createLiveClockUpdater","TeFormatDatePipe","Pipe","TeRelativeTimePipe","formatRelativeTime","TeTimezonePipe","WorldClockComponent","Input","Component","CommonModule","LiveClockComponent","SchedulerComponent","BusinessHoursComponent","businessHoursEngine","ShiftPlannerComponent","shiftPlanner","GlobalMeetingPlannerComponent","createSchedul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F,SAAA,EAAA,sBAAA,EAAA,CAAA,CAAA;AACA,eAAA,CAAA;AAAA,EAART,UAAA;AAAM,CAAA,EAFIS,qCAAA,CAEF,SAAA,EAAA,iBAAA,EAAA,CAAA,CAAA;AAFEA,qCAAA,GAAN,eAAA,CAAA;AAAA,EAhBNR,cAAA,CAAU;AAAA,IACT,QAAA,EAAU,2BAAA;AAAA,IACV,UAAA,EAAY,IAAA;AAAA,IACZ,OAAA,EAAS,CAACC,mBAAA,EAAcH,2BAAmB,CAAA;AAAA,IAC3C,QAAA,EAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAAA,GAWX;AAAA,CAAA,EACYU,qCAAA,CAAA;;;AC5IN,IAAM,uBAAA,GAA0B;AAAA,EACrCf,wBAAA;AAAA,EACAE,0BAAA;AAAA,EACAE,sBAAA;AAAA,EACAC,2BAAA;AAAA,EACAI,8BAAA;AAAA,EACAC,0BAAA;AAAA,EACAC,8BAAA;AAAA,EACAE,6BAAA;AAAA,EACAE;AACF;AAGO,IAAM,+BAAA,GAAkC,CAACJ,8BAAA,EAAwBX,wBAAgB;AAGjF,IAAM,6BAAA,GAAgC,CAACa,6BAAA,EAAuBb,wBAAgB;AAG9E,IAAM,0BAAA,GAA6B;AAAA,EACxCU,0BAAA;AAAA,EACAK,qCAAA;AAAA,EACAV;AACF","file":"index.cjs","sourcesContent":["import { Injectable, InjectionToken, inject } from \"@angular/core\";\nimport type {\n FormatDateOptions,\n TimezoneEngineConfig,\n WorldClockEntry,\n} from \"@multisystemsuite/timezone-engine-shared-types\";\nimport {\n createTimezoneEngine,\n detectBrowserTimezone,\n formatDate,\n convertTimezone,\n compareTimezones,\n getWorldClock,\n createLiveClockUpdater,\n getUserTimezone,\n type TimezoneEngine,\n} from \"@multisystemsuite/timezone-engine-core\";\nimport { getCountryTimezones, getCityTimezone } from \"@multisystemsuite/timezone-engine-world-data\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\n\nexport const TIMEZONE_ENGINE_CONFIG = new InjectionToken<TimezoneEngineConfig>(\n \"TIMEZONE_ENGINE_CONFIG\",\n);\n\n/** Injectable timezone engine service for Angular */\n@Injectable({ providedIn: \"root\" })\nexport class TimezoneService {\n private config = inject(TIMEZONE_ENGINE_CONFIG, { optional: true }) ?? {};\n private engine: TimezoneEngine = createTimezoneEngine(this.config);\n private timezoneSubject = new BehaviorSubject<string>(\n this.config.defaultTimezone ?? detectBrowserTimezone().timezone,\n );\n\n readonly timezone$: Observable<string> = this.timezoneSubject.asObservable();\n\n get timezone(): string {\n return this.timezoneSubject.value;\n }\n\n setTimezone(tz: string): void {\n this.timezoneSubject.next(tz);\n this.engine.config.update({ defaultTimezone: tz });\n }\n\n detectTimezone(): string {\n return detectBrowserTimezone().timezone;\n }\n\n getUserTimezone(): string {\n return getUserTimezone();\n }\n\n formatDate(date: Date | string | number, options: FormatDateOptions = {}): string {\n return formatDate(date, { timezone: this.timezone, ...options });\n }\n\n convertTimezone(\n sourceTimezone: string,\n targetTimezone: string,\n date?: Date | string | number,\n ): Date {\n return convertTimezone({\n sourceTimezone,\n targetTimezone,\n ...(date !== undefined ? { date } : {}),\n });\n }\n\n compareTimezones(source: string, target: string, date?: Date | string | number) {\n return compareTimezones(source, target, date);\n }\n\n getWorldClock(timezones: string[]): WorldClockEntry[] {\n return getWorldClock(timezones);\n }\n\n getCountryTimezones(countryCode: string) {\n return getCountryTimezones(countryCode);\n }\n\n getCityTimezone(city: string) {\n return getCityTimezone(city);\n }\n\n getEngine(): TimezoneEngine {\n return this.engine;\n }\n}\n\n/** World clock observable stream */\n@Injectable({ providedIn: \"root\" })\nexport class WorldClockService {\n private timezoneService = inject(TimezoneService);\n\n createLiveClock(timezones: string[], intervalMs = 1000): Observable<WorldClockEntry[]> {\n return new Observable((subscriber) => {\n const updater = createLiveClockUpdater(\n timezones,\n (clocks) => {\n subscriber.next(clocks);\n },\n intervalMs,\n );\n updater.start();\n return () => {\n updater.stop();\n };\n });\n }\n}\n","import { Pipe, inject, type PipeTransform } from \"@angular/core\";\nimport type { FormatDateOptions } from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { formatRelativeTime } from \"@multisystemsuite/timezone-engine-core\";\nimport { TimezoneService } from \"./timezone.service.js\";\n\n/** Angular pipe for locale-aware date formatting */\n@Pipe({ name: \"teFormatDate\", standalone: true, pure: false })\nexport class TeFormatDatePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n format: FormatDateOptions[\"format\"] = \"DATETIME\",\n timezone?: string,\n locale?: string,\n ): string {\n if (value == null) return \"\";\n const options: FormatDateOptions = { format };\n if (timezone !== undefined) options.timezone = timezone;\n if (locale !== undefined) options.locale = locale;\n return this.timezoneService.formatDate(value, options);\n }\n}\n\n/** Angular pipe for relative time formatting */\n@Pipe({ name: \"teRelativeTime\", standalone: true })\nexport class TeRelativeTimePipe implements PipeTransform {\n transform(value: Date | string | number | null | undefined): string {\n if (value == null) return \"\";\n return formatRelativeTime(value);\n }\n}\n\n/** Angular pipe for timezone conversion display */\n@Pipe({ name: \"teTimezone\", standalone: true })\nexport class TeTimezonePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n targetTimezone: string,\n sourceTimezone?: string,\n ): Date | null {\n if (value == null) return null;\n const source = sourceTimezone ?? this.timezoneService.timezone;\n return this.timezoneService.convertTimezone(source, targetTimezone, value);\n }\n}\n","import { Component, Input, inject, type OnInit, type OnDestroy } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport type {\n MeetingSlot,\n ShiftDefinition,\n WorldClockEntry,\n} from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { businessHoursEngine } from \"@multisystemsuite/timezone-engine-business-hours\";\nimport { shiftPlanner } from \"@multisystemsuite/timezone-engine-shift-engine\";\nimport {\n createSchedulerEngine,\n defaultSchedulerConfig,\n} from \"@multisystemsuite/timezone-engine-scheduler\";\nimport { WorldClockService, TimezoneService } from \"./timezone.service.js\";\nimport type { Subscription } from \"rxjs\";\n\n/** Standalone world clock component for Angular */\n@Component({\n selector: \"te-world-clock\",\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"te-clock\" data-testid=\"world-clock\">\n @for (clock of clocks; track clock.timezone) {\n <div class=\"te-clock__entry\">\n <strong>{{ clock.label }}</strong>\n <span>{{ clock.formattedTime }}</span>\n <small>{{ clock.utcOffset }}</small>\n </div>\n }\n </div>\n `,\n})\nexport class WorldClockComponent implements OnInit, OnDestroy {\n @Input() timezones: string[] = [\"UTC\", \"America/New_York\", \"Europe/London\", \"Asia/Kolkata\"];\n @Input() intervalMs = 1000;\n\n clocks: WorldClockEntry[] = [];\n private worldClockService = inject(WorldClockService);\n private subscription?: Subscription;\n\n ngOnInit(): void {\n this.subscription = this.worldClockService\n .createLiveClock(this.timezones, this.intervalMs)\n .subscribe((clocks) => {\n this.clocks = clocks;\n });\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n}\n\n/** Standalone live clock component */\n@Component({\n selector: \"te-live-clock\",\n standalone: true,\n template: `<span class=\"te-live-clock\">{{ display }}</span>`,\n})\nexport class LiveClockComponent implements OnInit, OnDestroy {\n @Input() timezone?: string;\n @Input() intervalMs = 1000;\n\n display = \"\";\n private timezoneService = inject(TimezoneService);\n private timerId?: ReturnType<typeof setInterval>;\n\n ngOnInit(): void {\n const tz = this.timezone ?? this.timezoneService.timezone;\n const update = () => {\n this.display = this.timezoneService.formatDate(new Date(), {\n format: \"TIME_ONLY\",\n timezone: tz,\n });\n };\n update();\n this.timerId = setInterval(update, this.intervalMs);\n }\n\n ngOnDestroy(): void {\n if (this.timerId !== undefined) clearInterval(this.timerId);\n }\n}\n\n/** Scheduler display component */\n@Component({\n selector: \"te-scheduler\",\n standalone: true,\n imports: [CommonModule, WorldClockComponent],\n template: `\n <div class=\"te-scheduler\">\n <h3 class=\"te-scheduler__title\">Meeting Scheduler</h3>\n <p>Duration: {{ durationMinutes }} minutes</p>\n <ul>\n @for (p of participants; track p.name) {\n <li>{{ p.name }} — {{ p.timezone }}</li>\n }\n </ul>\n <te-world-clock [timezones]=\"participantTimezones\" />\n </div>\n `,\n})\nexport class SchedulerComponent {\n @Input() participants: { name: string; timezone: string }[] = [];\n @Input() durationMinutes = 60;\n\n get participantTimezones(): string[] {\n return [...new Set(this.participants.map((p) => p.timezone))];\n }\n}\n\n/** Business hours status component */\n@Component({\n selector: \"te-business-hours\",\n standalone: true,\n template: `<div class=\"te-business-hours\">{{ timezone }} — {{ status }}</div>`,\n})\nexport class BusinessHoursComponent implements OnInit {\n @Input() timezone = \"UTC\";\n status = \"Closed\";\n\n ngOnInit(): void {\n const engine = businessHoursEngine(this.timezone);\n this.status = engine.isBusinessHour(new Date(), this.timezone) ? \"Open\" : \"Closed\";\n }\n}\n\n/** Shift planner component */\n@Component({\n selector: \"te-shift-planner\",\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"te-shift-planner\">\n <h3>Shifts — {{ timezone }}</h3>\n <ul>\n @for (shift of shifts; track shift.id) {\n <li>{{ shift.name }}: {{ shift.startTime }}–{{ shift.endTime }}</li>\n }\n </ul>\n </div>\n `,\n})\nexport class ShiftPlannerComponent implements OnInit {\n @Input() timezone = \"UTC\";\n shifts: ShiftDefinition[] = [];\n\n ngOnInit(): void {\n this.shifts = shiftPlanner(this.timezone).getActiveShifts(new Date());\n }\n}\n\n/** Global meeting planner component */\n@Component({\n selector: \"te-global-meeting-planner\",\n standalone: true,\n imports: [CommonModule, WorldClockComponent],\n template: `\n <div class=\"te-global-meeting-planner\">\n <h3>Global Meeting Planner</h3>\n @if (slot) {\n <p>Suggested: {{ slot.start.toISOString() }} — {{ slot.timezone }}</p>\n } @else {\n <p>No slot available</p>\n }\n <te-world-clock [timezones]=\"participantTimezones\" />\n </div>\n `,\n})\nexport class GlobalMeetingPlannerComponent implements OnInit {\n @Input() participantTimezones: string[] = [];\n @Input() durationMinutes = 60;\n slot: MeetingSlot | null = null;\n\n ngOnInit(): void {\n const scheduler = createSchedulerEngine(defaultSchedulerConfig);\n this.slot = scheduler.suggestMeetingTime(\n this.participantTimezones,\n new Date(),\n this.durationMinutes,\n );\n }\n}\n","export { TimezoneService, WorldClockService, TIMEZONE_ENGINE_CONFIG } from \"./timezone.service.js\";\n\nexport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\n\n/** Enterprise alias for TeFormatDatePipe */\nexport { TeFormatDatePipe as DateFormatPipe } from \"./pipes.js\";\n\nexport {\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n BusinessHoursComponent,\n ShiftPlannerComponent,\n GlobalMeetingPlannerComponent,\n} from \"./components.js\";\n\n/** Enterprise alias for LiveClockComponent */\nexport { LiveClockComponent as RealtimeClockComponent } from \"./components.js\";\n\nimport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\nimport {\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n BusinessHoursComponent,\n ShiftPlannerComponent,\n GlobalMeetingPlannerComponent,\n} from \"./components.js\";\n\n/** Standalone imports bundle for Angular 17+ */\nexport const TIMEZONE_ENGINE_IMPORTS = [\n TeFormatDatePipe,\n TeRelativeTimePipe,\n TeTimezonePipe,\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n BusinessHoursComponent,\n ShiftPlannerComponent,\n GlobalMeetingPlannerComponent,\n] as const;\n\n/** Business hours module bundle */\nexport const TIMEZONE_BUSINESS_HOURS_IMPORTS = [BusinessHoursComponent, TeFormatDatePipe] as const;\n\n/** Shift engine module bundle */\nexport const TIMEZONE_SHIFT_ENGINE_IMPORTS = [ShiftPlannerComponent, TeFormatDatePipe] as const;\n\n/** Scheduler module bundle */\nexport const TIMEZONE_SCHEDULER_IMPORTS = [\n SchedulerComponent,\n GlobalMeetingPlannerComponent,\n WorldClockComponent,\n] as const;\n"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _multisystemsuite_timezone_engine_shared_types from '@multisystemsuite/timezone-engine-shared-types';
2
- import { TimezoneEngineConfig, FormatDateOptions, WorldClockEntry } from '@multisystemsuite/timezone-engine-shared-types';
2
+ import { TimezoneEngineConfig, FormatDateOptions, WorldClockEntry, MeetingSlot, ShiftDefinition } from '@multisystemsuite/timezone-engine-shared-types';
3
3
  import { InjectionToken, PipeTransform, OnInit, OnDestroy } from '@angular/core';
4
4
  import { TimezoneEngine } from '@multisystemsuite/timezone-engine-core';
5
5
  import { Observable } from 'rxjs';
@@ -73,8 +73,33 @@ declare class SchedulerComponent {
73
73
  durationMinutes: number;
74
74
  get participantTimezones(): string[];
75
75
  }
76
+ /** Business hours status component */
77
+ declare class BusinessHoursComponent implements OnInit {
78
+ timezone: string;
79
+ status: string;
80
+ ngOnInit(): void;
81
+ }
82
+ /** Shift planner component */
83
+ declare class ShiftPlannerComponent implements OnInit {
84
+ timezone: string;
85
+ shifts: ShiftDefinition[];
86
+ ngOnInit(): void;
87
+ }
88
+ /** Global meeting planner component */
89
+ declare class GlobalMeetingPlannerComponent implements OnInit {
90
+ participantTimezones: string[];
91
+ durationMinutes: number;
92
+ slot: MeetingSlot | null;
93
+ ngOnInit(): void;
94
+ }
76
95
 
77
96
  /** Standalone imports bundle for Angular 17+ */
78
- declare const TIMEZONE_ENGINE_IMPORTS: readonly [typeof TeFormatDatePipe, typeof TeRelativeTimePipe, typeof TeTimezonePipe, typeof WorldClockComponent, typeof LiveClockComponent, typeof SchedulerComponent];
97
+ declare const TIMEZONE_ENGINE_IMPORTS: readonly [typeof TeFormatDatePipe, typeof TeRelativeTimePipe, typeof TeTimezonePipe, typeof WorldClockComponent, typeof LiveClockComponent, typeof SchedulerComponent, typeof BusinessHoursComponent, typeof ShiftPlannerComponent, typeof GlobalMeetingPlannerComponent];
98
+ /** Business hours module bundle */
99
+ declare const TIMEZONE_BUSINESS_HOURS_IMPORTS: readonly [typeof BusinessHoursComponent, typeof TeFormatDatePipe];
100
+ /** Shift engine module bundle */
101
+ declare const TIMEZONE_SHIFT_ENGINE_IMPORTS: readonly [typeof ShiftPlannerComponent, typeof TeFormatDatePipe];
102
+ /** Scheduler module bundle */
103
+ declare const TIMEZONE_SCHEDULER_IMPORTS: readonly [typeof SchedulerComponent, typeof GlobalMeetingPlannerComponent, typeof WorldClockComponent];
79
104
 
80
- export { TeFormatDatePipe as DateFormatPipe, LiveClockComponent, LiveClockComponent as RealtimeClockComponent, SchedulerComponent, TIMEZONE_ENGINE_CONFIG, TIMEZONE_ENGINE_IMPORTS, TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe, TimezoneService, WorldClockComponent, WorldClockService };
105
+ export { BusinessHoursComponent, TeFormatDatePipe as DateFormatPipe, GlobalMeetingPlannerComponent, LiveClockComponent, LiveClockComponent as RealtimeClockComponent, SchedulerComponent, ShiftPlannerComponent, TIMEZONE_BUSINESS_HOURS_IMPORTS, TIMEZONE_ENGINE_CONFIG, TIMEZONE_ENGINE_IMPORTS, TIMEZONE_SCHEDULER_IMPORTS, TIMEZONE_SHIFT_ENGINE_IMPORTS, TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe, TimezoneService, WorldClockComponent, WorldClockService };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _multisystemsuite_timezone_engine_shared_types from '@multisystemsuite/timezone-engine-shared-types';
2
- import { TimezoneEngineConfig, FormatDateOptions, WorldClockEntry } from '@multisystemsuite/timezone-engine-shared-types';
2
+ import { TimezoneEngineConfig, FormatDateOptions, WorldClockEntry, MeetingSlot, ShiftDefinition } from '@multisystemsuite/timezone-engine-shared-types';
3
3
  import { InjectionToken, PipeTransform, OnInit, OnDestroy } from '@angular/core';
4
4
  import { TimezoneEngine } from '@multisystemsuite/timezone-engine-core';
5
5
  import { Observable } from 'rxjs';
@@ -73,8 +73,33 @@ declare class SchedulerComponent {
73
73
  durationMinutes: number;
74
74
  get participantTimezones(): string[];
75
75
  }
76
+ /** Business hours status component */
77
+ declare class BusinessHoursComponent implements OnInit {
78
+ timezone: string;
79
+ status: string;
80
+ ngOnInit(): void;
81
+ }
82
+ /** Shift planner component */
83
+ declare class ShiftPlannerComponent implements OnInit {
84
+ timezone: string;
85
+ shifts: ShiftDefinition[];
86
+ ngOnInit(): void;
87
+ }
88
+ /** Global meeting planner component */
89
+ declare class GlobalMeetingPlannerComponent implements OnInit {
90
+ participantTimezones: string[];
91
+ durationMinutes: number;
92
+ slot: MeetingSlot | null;
93
+ ngOnInit(): void;
94
+ }
76
95
 
77
96
  /** Standalone imports bundle for Angular 17+ */
78
- declare const TIMEZONE_ENGINE_IMPORTS: readonly [typeof TeFormatDatePipe, typeof TeRelativeTimePipe, typeof TeTimezonePipe, typeof WorldClockComponent, typeof LiveClockComponent, typeof SchedulerComponent];
97
+ declare const TIMEZONE_ENGINE_IMPORTS: readonly [typeof TeFormatDatePipe, typeof TeRelativeTimePipe, typeof TeTimezonePipe, typeof WorldClockComponent, typeof LiveClockComponent, typeof SchedulerComponent, typeof BusinessHoursComponent, typeof ShiftPlannerComponent, typeof GlobalMeetingPlannerComponent];
98
+ /** Business hours module bundle */
99
+ declare const TIMEZONE_BUSINESS_HOURS_IMPORTS: readonly [typeof BusinessHoursComponent, typeof TeFormatDatePipe];
100
+ /** Shift engine module bundle */
101
+ declare const TIMEZONE_SHIFT_ENGINE_IMPORTS: readonly [typeof ShiftPlannerComponent, typeof TeFormatDatePipe];
102
+ /** Scheduler module bundle */
103
+ declare const TIMEZONE_SCHEDULER_IMPORTS: readonly [typeof SchedulerComponent, typeof GlobalMeetingPlannerComponent, typeof WorldClockComponent];
79
104
 
80
- export { TeFormatDatePipe as DateFormatPipe, LiveClockComponent, LiveClockComponent as RealtimeClockComponent, SchedulerComponent, TIMEZONE_ENGINE_CONFIG, TIMEZONE_ENGINE_IMPORTS, TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe, TimezoneService, WorldClockComponent, WorldClockService };
105
+ export { BusinessHoursComponent, TeFormatDatePipe as DateFormatPipe, GlobalMeetingPlannerComponent, LiveClockComponent, LiveClockComponent as RealtimeClockComponent, SchedulerComponent, ShiftPlannerComponent, TIMEZONE_BUSINESS_HOURS_IMPORTS, TIMEZONE_ENGINE_CONFIG, TIMEZONE_ENGINE_IMPORTS, TIMEZONE_SCHEDULER_IMPORTS, TIMEZONE_SHIFT_ENGINE_IMPORTS, TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe, TimezoneService, WorldClockComponent, WorldClockService };
package/dist/index.js CHANGED
@@ -3,6 +3,9 @@ import { createLiveClockUpdater, createTimezoneEngine, detectBrowserTimezone, ge
3
3
  import { getCountryTimezones, getCityTimezone } from '@multisystemsuite/timezone-engine-world-data';
4
4
  import { Observable, BehaviorSubject } from 'rxjs';
5
5
  import { CommonModule } from '@angular/common';
6
+ import { businessHoursEngine } from '@multisystemsuite/timezone-engine-business-hours';
7
+ import { shiftPlanner } from '@multisystemsuite/timezone-engine-shift-engine';
8
+ import { createSchedulerEngine, defaultSchedulerConfig } from '@multisystemsuite/timezone-engine-scheduler';
6
9
 
7
10
  var __defProp = Object.defineProperty;
8
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -225,6 +228,88 @@ SchedulerComponent = __decorateClass([
225
228
  `
226
229
  })
227
230
  ], SchedulerComponent);
231
+ var BusinessHoursComponent = class {
232
+ timezone = "UTC";
233
+ status = "Closed";
234
+ ngOnInit() {
235
+ const engine = businessHoursEngine(this.timezone);
236
+ this.status = engine.isBusinessHour(/* @__PURE__ */ new Date(), this.timezone) ? "Open" : "Closed";
237
+ }
238
+ };
239
+ __decorateClass([
240
+ Input()
241
+ ], BusinessHoursComponent.prototype, "timezone", 2);
242
+ BusinessHoursComponent = __decorateClass([
243
+ Component({
244
+ selector: "te-business-hours",
245
+ standalone: true,
246
+ template: `<div class="te-business-hours">{{ timezone }} \u2014 {{ status }}</div>`
247
+ })
248
+ ], BusinessHoursComponent);
249
+ var ShiftPlannerComponent = class {
250
+ timezone = "UTC";
251
+ shifts = [];
252
+ ngOnInit() {
253
+ this.shifts = shiftPlanner(this.timezone).getActiveShifts(/* @__PURE__ */ new Date());
254
+ }
255
+ };
256
+ __decorateClass([
257
+ Input()
258
+ ], ShiftPlannerComponent.prototype, "timezone", 2);
259
+ ShiftPlannerComponent = __decorateClass([
260
+ Component({
261
+ selector: "te-shift-planner",
262
+ standalone: true,
263
+ imports: [CommonModule],
264
+ template: `
265
+ <div class="te-shift-planner">
266
+ <h3>Shifts \u2014 {{ timezone }}</h3>
267
+ <ul>
268
+ @for (shift of shifts; track shift.id) {
269
+ <li>{{ shift.name }}: {{ shift.startTime }}\u2013{{ shift.endTime }}</li>
270
+ }
271
+ </ul>
272
+ </div>
273
+ `
274
+ })
275
+ ], ShiftPlannerComponent);
276
+ var GlobalMeetingPlannerComponent = class {
277
+ participantTimezones = [];
278
+ durationMinutes = 60;
279
+ slot = null;
280
+ ngOnInit() {
281
+ const scheduler = createSchedulerEngine(defaultSchedulerConfig);
282
+ this.slot = scheduler.suggestMeetingTime(
283
+ this.participantTimezones,
284
+ /* @__PURE__ */ new Date(),
285
+ this.durationMinutes
286
+ );
287
+ }
288
+ };
289
+ __decorateClass([
290
+ Input()
291
+ ], GlobalMeetingPlannerComponent.prototype, "participantTimezones", 2);
292
+ __decorateClass([
293
+ Input()
294
+ ], GlobalMeetingPlannerComponent.prototype, "durationMinutes", 2);
295
+ GlobalMeetingPlannerComponent = __decorateClass([
296
+ Component({
297
+ selector: "te-global-meeting-planner",
298
+ standalone: true,
299
+ imports: [CommonModule, WorldClockComponent],
300
+ template: `
301
+ <div class="te-global-meeting-planner">
302
+ <h3>Global Meeting Planner</h3>
303
+ @if (slot) {
304
+ <p>Suggested: {{ slot.start.toISOString() }} \u2014 {{ slot.timezone }}</p>
305
+ } @else {
306
+ <p>No slot available</p>
307
+ }
308
+ <te-world-clock [timezones]="participantTimezones" />
309
+ </div>
310
+ `
311
+ })
312
+ ], GlobalMeetingPlannerComponent);
228
313
 
229
314
  // src/index.ts
230
315
  var TIMEZONE_ENGINE_IMPORTS = [
@@ -233,9 +318,19 @@ var TIMEZONE_ENGINE_IMPORTS = [
233
318
  TeTimezonePipe,
234
319
  WorldClockComponent,
235
320
  LiveClockComponent,
236
- SchedulerComponent
321
+ SchedulerComponent,
322
+ BusinessHoursComponent,
323
+ ShiftPlannerComponent,
324
+ GlobalMeetingPlannerComponent
325
+ ];
326
+ var TIMEZONE_BUSINESS_HOURS_IMPORTS = [BusinessHoursComponent, TeFormatDatePipe];
327
+ var TIMEZONE_SHIFT_ENGINE_IMPORTS = [ShiftPlannerComponent, TeFormatDatePipe];
328
+ var TIMEZONE_SCHEDULER_IMPORTS = [
329
+ SchedulerComponent,
330
+ GlobalMeetingPlannerComponent,
331
+ WorldClockComponent
237
332
  ];
238
333
 
239
- export { TeFormatDatePipe as DateFormatPipe, LiveClockComponent, LiveClockComponent as RealtimeClockComponent, SchedulerComponent, TIMEZONE_ENGINE_CONFIG, TIMEZONE_ENGINE_IMPORTS, TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe, TimezoneService, WorldClockComponent, WorldClockService };
334
+ export { BusinessHoursComponent, TeFormatDatePipe as DateFormatPipe, GlobalMeetingPlannerComponent, LiveClockComponent, LiveClockComponent as RealtimeClockComponent, SchedulerComponent, ShiftPlannerComponent, TIMEZONE_BUSINESS_HOURS_IMPORTS, TIMEZONE_ENGINE_CONFIG, TIMEZONE_ENGINE_IMPORTS, TIMEZONE_SCHEDULER_IMPORTS, TIMEZONE_SHIFT_ENGINE_IMPORTS, TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe, TimezoneService, WorldClockComponent, WorldClockService };
240
335
  //# sourceMappingURL=index.js.map
241
336
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/timezone.service.ts","../src/pipes.ts","../src/components.ts","../src/index.ts"],"names":["inject"],"mappings":";;;;;;;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OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,IAAA,CAAK,YAAA,CAAa,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,QAAQ,CAAC,CAAC,CAAA;AAAA,EAC9D;AACF;AANW,eAAA,CAAA;AAAA,EAAR,KAAA;AAAM,CAAA,EADI,kBAAA,CACF,SAAA,EAAA,cAAA,EAAA,CAAA,CAAA;AACA,eAAA,CAAA;AAAA,EAAR,KAAA;AAAM,CAAA,EAFI,kBAAA,CAEF,SAAA,EAAA,iBAAA,EAAA,CAAA,CAAA;AAFE,kBAAA,GAAN,eAAA,CAAA;AAAA,EAjBN,SAAA,CAAU;AAAA,IACT,QAAA,EAAU,cAAA;AAAA,IACV,UAAA,EAAY,IAAA;AAAA,IACZ,OAAA,EAAS,CAAC,YAAA,EAAc,mBAAmB,CAAA;AAAA,IAC3C,QAAA,EAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAAA,GAYX;AAAA,CAAA,EACY,kBAAA,CAAA;;;AC7EN,IAAM,uBAAA,GAA0B;AAAA,EACrC,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,cAAA;AAAA,EACA,mBAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["import { Injectable, InjectionToken, inject } from \"@angular/core\";\nimport type {\n FormatDateOptions,\n TimezoneEngineConfig,\n WorldClockEntry,\n} from \"@multisystemsuite/timezone-engine-shared-types\";\nimport {\n createTimezoneEngine,\n detectBrowserTimezone,\n formatDate,\n convertTimezone,\n compareTimezones,\n getWorldClock,\n createLiveClockUpdater,\n getUserTimezone,\n type TimezoneEngine,\n} from \"@multisystemsuite/timezone-engine-core\";\nimport { getCountryTimezones, getCityTimezone } from \"@multisystemsuite/timezone-engine-world-data\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\n\nexport const TIMEZONE_ENGINE_CONFIG = new InjectionToken<TimezoneEngineConfig>(\n \"TIMEZONE_ENGINE_CONFIG\",\n);\n\n/** Injectable timezone engine service for Angular */\n@Injectable({ providedIn: \"root\" })\nexport class TimezoneService {\n private config = inject(TIMEZONE_ENGINE_CONFIG, { optional: true }) ?? {};\n private engine: TimezoneEngine = createTimezoneEngine(this.config);\n private timezoneSubject = new BehaviorSubject<string>(\n this.config.defaultTimezone ?? detectBrowserTimezone().timezone,\n );\n\n readonly timezone$: Observable<string> = this.timezoneSubject.asObservable();\n\n get timezone(): string {\n return this.timezoneSubject.value;\n }\n\n setTimezone(tz: string): void {\n this.timezoneSubject.next(tz);\n this.engine.config.update({ defaultTimezone: tz });\n }\n\n detectTimezone(): string {\n return detectBrowserTimezone().timezone;\n }\n\n getUserTimezone(): string {\n return getUserTimezone();\n }\n\n formatDate(date: Date | string | number, options: FormatDateOptions = {}): string {\n return formatDate(date, { timezone: this.timezone, ...options });\n }\n\n convertTimezone(\n sourceTimezone: string,\n targetTimezone: string,\n date?: Date | string | number,\n ): Date {\n return convertTimezone({\n sourceTimezone,\n targetTimezone,\n ...(date !== undefined ? { date } : {}),\n });\n }\n\n compareTimezones(source: string, target: string, date?: Date | string | number) {\n return compareTimezones(source, target, date);\n }\n\n getWorldClock(timezones: string[]): WorldClockEntry[] {\n return getWorldClock(timezones);\n }\n\n getCountryTimezones(countryCode: string) {\n return getCountryTimezones(countryCode);\n }\n\n getCityTimezone(city: string) {\n return getCityTimezone(city);\n }\n\n getEngine(): TimezoneEngine {\n return this.engine;\n }\n}\n\n/** World clock observable stream */\n@Injectable({ providedIn: \"root\" })\nexport class WorldClockService {\n private timezoneService = inject(TimezoneService);\n\n createLiveClock(timezones: string[], intervalMs = 1000): Observable<WorldClockEntry[]> {\n return new Observable((subscriber) => {\n const updater = createLiveClockUpdater(\n timezones,\n (clocks) => {\n subscriber.next(clocks);\n },\n intervalMs,\n );\n updater.start();\n return () => {\n updater.stop();\n };\n });\n }\n}\n","import { Pipe, inject, type PipeTransform } from \"@angular/core\";\nimport type { FormatDateOptions } from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { formatRelativeTime } from \"@multisystemsuite/timezone-engine-core\";\nimport { TimezoneService } from \"./timezone.service.js\";\n\n/** Angular pipe for locale-aware date formatting */\n@Pipe({ name: \"teFormatDate\", standalone: true, pure: false })\nexport class TeFormatDatePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n format: FormatDateOptions[\"format\"] = \"DATETIME\",\n timezone?: string,\n locale?: string,\n ): string {\n if (value == null) return \"\";\n const options: FormatDateOptions = { format };\n if (timezone !== undefined) options.timezone = timezone;\n if (locale !== undefined) options.locale = locale;\n return this.timezoneService.formatDate(value, options);\n }\n}\n\n/** Angular pipe for relative time formatting */\n@Pipe({ name: \"teRelativeTime\", standalone: true })\nexport class TeRelativeTimePipe implements PipeTransform {\n transform(value: Date | string | number | null | undefined): string {\n if (value == null) return \"\";\n return formatRelativeTime(value);\n }\n}\n\n/** Angular pipe for timezone conversion display */\n@Pipe({ name: \"teTimezone\", standalone: true })\nexport class TeTimezonePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n targetTimezone: string,\n sourceTimezone?: string,\n ): Date | null {\n if (value == null) return null;\n const source = sourceTimezone ?? this.timezoneService.timezone;\n return this.timezoneService.convertTimezone(source, targetTimezone, value);\n }\n}\n","import { Component, Input, inject, type OnInit, type OnDestroy } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport type { WorldClockEntry } from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { WorldClockService, TimezoneService } from \"./timezone.service.js\";\nimport type { Subscription } from \"rxjs\";\n\n/** Standalone world clock component for Angular */\n@Component({\n selector: \"te-world-clock\",\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"te-clock\" data-testid=\"world-clock\">\n @for (clock of clocks; track clock.timezone) {\n <div class=\"te-clock__entry\">\n <strong>{{ clock.label }}</strong>\n <span>{{ clock.formattedTime }}</span>\n <small>{{ clock.utcOffset }}</small>\n </div>\n }\n </div>\n `,\n})\nexport class WorldClockComponent implements OnInit, OnDestroy {\n @Input() timezones: string[] = [\"UTC\", \"America/New_York\", \"Europe/London\", \"Asia/Kolkata\"];\n @Input() intervalMs = 1000;\n\n clocks: WorldClockEntry[] = [];\n private worldClockService = inject(WorldClockService);\n private subscription?: Subscription;\n\n ngOnInit(): void {\n this.subscription = this.worldClockService\n .createLiveClock(this.timezones, this.intervalMs)\n .subscribe((clocks) => {\n this.clocks = clocks;\n });\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n}\n\n/** Standalone live clock component */\n@Component({\n selector: \"te-live-clock\",\n standalone: true,\n template: `<span class=\"te-live-clock\">{{ display }}</span>`,\n})\nexport class LiveClockComponent implements OnInit, OnDestroy {\n @Input() timezone?: string;\n @Input() intervalMs = 1000;\n\n display = \"\";\n private timezoneService = inject(TimezoneService);\n private timerId?: ReturnType<typeof setInterval>;\n\n ngOnInit(): void {\n const tz = this.timezone ?? this.timezoneService.timezone;\n const update = () => {\n this.display = this.timezoneService.formatDate(new Date(), {\n format: \"TIME_ONLY\",\n timezone: tz,\n });\n };\n update();\n this.timerId = setInterval(update, this.intervalMs);\n }\n\n ngOnDestroy(): void {\n if (this.timerId !== undefined) clearInterval(this.timerId);\n }\n}\n\n/** Scheduler display component */\n@Component({\n selector: \"te-scheduler\",\n standalone: true,\n imports: [CommonModule, WorldClockComponent],\n template: `\n <div class=\"te-scheduler\">\n <h3 class=\"te-scheduler__title\">Meeting Scheduler</h3>\n <p>Duration: {{ durationMinutes }} minutes</p>\n <ul>\n @for (p of participants; track p.name) {\n <li>{{ p.name }} — {{ p.timezone }}</li>\n }\n </ul>\n <te-world-clock [timezones]=\"participantTimezones\" />\n </div>\n `,\n})\nexport class SchedulerComponent {\n @Input() participants: { name: string; timezone: string }[] = [];\n @Input() durationMinutes = 60;\n\n get participantTimezones(): string[] {\n return [...new Set(this.participants.map((p) => p.timezone))];\n }\n}\n","export { TimezoneService, WorldClockService, TIMEZONE_ENGINE_CONFIG } from \"./timezone.service.js\";\n\nexport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\n\n/** Enterprise alias for TeFormatDatePipe */\nexport { TeFormatDatePipe as DateFormatPipe } from \"./pipes.js\";\n\nexport { WorldClockComponent, LiveClockComponent, SchedulerComponent } from \"./components.js\";\n\n/** Enterprise alias for LiveClockComponent */\nexport { LiveClockComponent as RealtimeClockComponent } from \"./components.js\";\n\nimport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\nimport { WorldClockComponent, LiveClockComponent, SchedulerComponent } from \"./components.js\";\n\n/** Standalone imports bundle for Angular 17+ */\nexport const TIMEZONE_ENGINE_IMPORTS = [\n TeFormatDatePipe,\n TeRelativeTimePipe,\n TeTimezonePipe,\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n] as const;\n"]}
1
+ {"version":3,"sources":["../src/timezone.service.ts","../src/pipes.ts","../src/components.ts","../src/index.ts"],"names":["inject"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBO,IAAM,yBAAyB,IAAI,cAAA;AAAA,EACxC;AACF;AAIO,IAAM,kBAAN,MAAsB;AAAA,EACnB,MAAA,GAAS,OAAO,sBAAA,EAAwB,EAAE,UAAU,IAAA,EAAM,KAAK,EAAC;AAAA,EAChE,MAAA,GAAyB,oBAAA,CAAqB,IAAA,CAAK,MAAM,CAAA;AAAA,EACzD,kBAAkB,IAAI,eAAA;AAAA,IAC5B,IAAA,CAAK,MAAA,CAAO,eAAA,IAAmB,qBAAA,EAAsB,CAAE;AAAA,GACzD;AAAA,EAES,SAAA,GAAgC,IAAA,CAAK,eAAA,CAAgB,YAAA,EAAa;AAAA,EAE3E,IAAI,QAAA,GAAmB;AACrB,IAAA,OAAO,KAAK,eAAA,CAAgB,KAAA;AAAA,EAC9B;AAAA,EAEA,YAAY,EAAA,EAAkB;AAC5B,IAAA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A,GAAgC,CAAC,qBAAA,EAAuB,gBAAgB;AAG9E,IAAM,0BAAA,GAA6B;AAAA,EACxC,kBAAA;AAAA,EACA,6BAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["import { Injectable, InjectionToken, inject } from \"@angular/core\";\nimport type {\n FormatDateOptions,\n TimezoneEngineConfig,\n WorldClockEntry,\n} from \"@multisystemsuite/timezone-engine-shared-types\";\nimport {\n createTimezoneEngine,\n detectBrowserTimezone,\n formatDate,\n convertTimezone,\n compareTimezones,\n getWorldClock,\n createLiveClockUpdater,\n getUserTimezone,\n type TimezoneEngine,\n} from \"@multisystemsuite/timezone-engine-core\";\nimport { getCountryTimezones, getCityTimezone } from \"@multisystemsuite/timezone-engine-world-data\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\n\nexport const TIMEZONE_ENGINE_CONFIG = new InjectionToken<TimezoneEngineConfig>(\n \"TIMEZONE_ENGINE_CONFIG\",\n);\n\n/** Injectable timezone engine service for Angular */\n@Injectable({ providedIn: \"root\" })\nexport class TimezoneService {\n private config = inject(TIMEZONE_ENGINE_CONFIG, { optional: true }) ?? {};\n private engine: TimezoneEngine = createTimezoneEngine(this.config);\n private timezoneSubject = new BehaviorSubject<string>(\n this.config.defaultTimezone ?? detectBrowserTimezone().timezone,\n );\n\n readonly timezone$: Observable<string> = this.timezoneSubject.asObservable();\n\n get timezone(): string {\n return this.timezoneSubject.value;\n }\n\n setTimezone(tz: string): void {\n this.timezoneSubject.next(tz);\n this.engine.config.update({ defaultTimezone: tz });\n }\n\n detectTimezone(): string {\n return detectBrowserTimezone().timezone;\n }\n\n getUserTimezone(): string {\n return getUserTimezone();\n }\n\n formatDate(date: Date | string | number, options: FormatDateOptions = {}): string {\n return formatDate(date, { timezone: this.timezone, ...options });\n }\n\n convertTimezone(\n sourceTimezone: string,\n targetTimezone: string,\n date?: Date | string | number,\n ): Date {\n return convertTimezone({\n sourceTimezone,\n targetTimezone,\n ...(date !== undefined ? { date } : {}),\n });\n }\n\n compareTimezones(source: string, target: string, date?: Date | string | number) {\n return compareTimezones(source, target, date);\n }\n\n getWorldClock(timezones: string[]): WorldClockEntry[] {\n return getWorldClock(timezones);\n }\n\n getCountryTimezones(countryCode: string) {\n return getCountryTimezones(countryCode);\n }\n\n getCityTimezone(city: string) {\n return getCityTimezone(city);\n }\n\n getEngine(): TimezoneEngine {\n return this.engine;\n }\n}\n\n/** World clock observable stream */\n@Injectable({ providedIn: \"root\" })\nexport class WorldClockService {\n private timezoneService = inject(TimezoneService);\n\n createLiveClock(timezones: string[], intervalMs = 1000): Observable<WorldClockEntry[]> {\n return new Observable((subscriber) => {\n const updater = createLiveClockUpdater(\n timezones,\n (clocks) => {\n subscriber.next(clocks);\n },\n intervalMs,\n );\n updater.start();\n return () => {\n updater.stop();\n };\n });\n }\n}\n","import { Pipe, inject, type PipeTransform } from \"@angular/core\";\nimport type { FormatDateOptions } from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { formatRelativeTime } from \"@multisystemsuite/timezone-engine-core\";\nimport { TimezoneService } from \"./timezone.service.js\";\n\n/** Angular pipe for locale-aware date formatting */\n@Pipe({ name: \"teFormatDate\", standalone: true, pure: false })\nexport class TeFormatDatePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n format: FormatDateOptions[\"format\"] = \"DATETIME\",\n timezone?: string,\n locale?: string,\n ): string {\n if (value == null) return \"\";\n const options: FormatDateOptions = { format };\n if (timezone !== undefined) options.timezone = timezone;\n if (locale !== undefined) options.locale = locale;\n return this.timezoneService.formatDate(value, options);\n }\n}\n\n/** Angular pipe for relative time formatting */\n@Pipe({ name: \"teRelativeTime\", standalone: true })\nexport class TeRelativeTimePipe implements PipeTransform {\n transform(value: Date | string | number | null | undefined): string {\n if (value == null) return \"\";\n return formatRelativeTime(value);\n }\n}\n\n/** Angular pipe for timezone conversion display */\n@Pipe({ name: \"teTimezone\", standalone: true })\nexport class TeTimezonePipe implements PipeTransform {\n private timezoneService = inject(TimezoneService);\n\n transform(\n value: Date | string | number | null | undefined,\n targetTimezone: string,\n sourceTimezone?: string,\n ): Date | null {\n if (value == null) return null;\n const source = sourceTimezone ?? this.timezoneService.timezone;\n return this.timezoneService.convertTimezone(source, targetTimezone, value);\n }\n}\n","import { Component, Input, inject, type OnInit, type OnDestroy } from \"@angular/core\";\nimport { CommonModule } from \"@angular/common\";\nimport type {\n MeetingSlot,\n ShiftDefinition,\n WorldClockEntry,\n} from \"@multisystemsuite/timezone-engine-shared-types\";\nimport { businessHoursEngine } from \"@multisystemsuite/timezone-engine-business-hours\";\nimport { shiftPlanner } from \"@multisystemsuite/timezone-engine-shift-engine\";\nimport {\n createSchedulerEngine,\n defaultSchedulerConfig,\n} from \"@multisystemsuite/timezone-engine-scheduler\";\nimport { WorldClockService, TimezoneService } from \"./timezone.service.js\";\nimport type { Subscription } from \"rxjs\";\n\n/** Standalone world clock component for Angular */\n@Component({\n selector: \"te-world-clock\",\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"te-clock\" data-testid=\"world-clock\">\n @for (clock of clocks; track clock.timezone) {\n <div class=\"te-clock__entry\">\n <strong>{{ clock.label }}</strong>\n <span>{{ clock.formattedTime }}</span>\n <small>{{ clock.utcOffset }}</small>\n </div>\n }\n </div>\n `,\n})\nexport class WorldClockComponent implements OnInit, OnDestroy {\n @Input() timezones: string[] = [\"UTC\", \"America/New_York\", \"Europe/London\", \"Asia/Kolkata\"];\n @Input() intervalMs = 1000;\n\n clocks: WorldClockEntry[] = [];\n private worldClockService = inject(WorldClockService);\n private subscription?: Subscription;\n\n ngOnInit(): void {\n this.subscription = this.worldClockService\n .createLiveClock(this.timezones, this.intervalMs)\n .subscribe((clocks) => {\n this.clocks = clocks;\n });\n }\n\n ngOnDestroy(): void {\n this.subscription?.unsubscribe();\n }\n}\n\n/** Standalone live clock component */\n@Component({\n selector: \"te-live-clock\",\n standalone: true,\n template: `<span class=\"te-live-clock\">{{ display }}</span>`,\n})\nexport class LiveClockComponent implements OnInit, OnDestroy {\n @Input() timezone?: string;\n @Input() intervalMs = 1000;\n\n display = \"\";\n private timezoneService = inject(TimezoneService);\n private timerId?: ReturnType<typeof setInterval>;\n\n ngOnInit(): void {\n const tz = this.timezone ?? this.timezoneService.timezone;\n const update = () => {\n this.display = this.timezoneService.formatDate(new Date(), {\n format: \"TIME_ONLY\",\n timezone: tz,\n });\n };\n update();\n this.timerId = setInterval(update, this.intervalMs);\n }\n\n ngOnDestroy(): void {\n if (this.timerId !== undefined) clearInterval(this.timerId);\n }\n}\n\n/** Scheduler display component */\n@Component({\n selector: \"te-scheduler\",\n standalone: true,\n imports: [CommonModule, WorldClockComponent],\n template: `\n <div class=\"te-scheduler\">\n <h3 class=\"te-scheduler__title\">Meeting Scheduler</h3>\n <p>Duration: {{ durationMinutes }} minutes</p>\n <ul>\n @for (p of participants; track p.name) {\n <li>{{ p.name }} — {{ p.timezone }}</li>\n }\n </ul>\n <te-world-clock [timezones]=\"participantTimezones\" />\n </div>\n `,\n})\nexport class SchedulerComponent {\n @Input() participants: { name: string; timezone: string }[] = [];\n @Input() durationMinutes = 60;\n\n get participantTimezones(): string[] {\n return [...new Set(this.participants.map((p) => p.timezone))];\n }\n}\n\n/** Business hours status component */\n@Component({\n selector: \"te-business-hours\",\n standalone: true,\n template: `<div class=\"te-business-hours\">{{ timezone }} — {{ status }}</div>`,\n})\nexport class BusinessHoursComponent implements OnInit {\n @Input() timezone = \"UTC\";\n status = \"Closed\";\n\n ngOnInit(): void {\n const engine = businessHoursEngine(this.timezone);\n this.status = engine.isBusinessHour(new Date(), this.timezone) ? \"Open\" : \"Closed\";\n }\n}\n\n/** Shift planner component */\n@Component({\n selector: \"te-shift-planner\",\n standalone: true,\n imports: [CommonModule],\n template: `\n <div class=\"te-shift-planner\">\n <h3>Shifts — {{ timezone }}</h3>\n <ul>\n @for (shift of shifts; track shift.id) {\n <li>{{ shift.name }}: {{ shift.startTime }}–{{ shift.endTime }}</li>\n }\n </ul>\n </div>\n `,\n})\nexport class ShiftPlannerComponent implements OnInit {\n @Input() timezone = \"UTC\";\n shifts: ShiftDefinition[] = [];\n\n ngOnInit(): void {\n this.shifts = shiftPlanner(this.timezone).getActiveShifts(new Date());\n }\n}\n\n/** Global meeting planner component */\n@Component({\n selector: \"te-global-meeting-planner\",\n standalone: true,\n imports: [CommonModule, WorldClockComponent],\n template: `\n <div class=\"te-global-meeting-planner\">\n <h3>Global Meeting Planner</h3>\n @if (slot) {\n <p>Suggested: {{ slot.start.toISOString() }} — {{ slot.timezone }}</p>\n } @else {\n <p>No slot available</p>\n }\n <te-world-clock [timezones]=\"participantTimezones\" />\n </div>\n `,\n})\nexport class GlobalMeetingPlannerComponent implements OnInit {\n @Input() participantTimezones: string[] = [];\n @Input() durationMinutes = 60;\n slot: MeetingSlot | null = null;\n\n ngOnInit(): void {\n const scheduler = createSchedulerEngine(defaultSchedulerConfig);\n this.slot = scheduler.suggestMeetingTime(\n this.participantTimezones,\n new Date(),\n this.durationMinutes,\n );\n }\n}\n","export { TimezoneService, WorldClockService, TIMEZONE_ENGINE_CONFIG } from \"./timezone.service.js\";\n\nexport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\n\n/** Enterprise alias for TeFormatDatePipe */\nexport { TeFormatDatePipe as DateFormatPipe } from \"./pipes.js\";\n\nexport {\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n BusinessHoursComponent,\n ShiftPlannerComponent,\n GlobalMeetingPlannerComponent,\n} from \"./components.js\";\n\n/** Enterprise alias for LiveClockComponent */\nexport { LiveClockComponent as RealtimeClockComponent } from \"./components.js\";\n\nimport { TeFormatDatePipe, TeRelativeTimePipe, TeTimezonePipe } from \"./pipes.js\";\nimport {\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n BusinessHoursComponent,\n ShiftPlannerComponent,\n GlobalMeetingPlannerComponent,\n} from \"./components.js\";\n\n/** Standalone imports bundle for Angular 17+ */\nexport const TIMEZONE_ENGINE_IMPORTS = [\n TeFormatDatePipe,\n TeRelativeTimePipe,\n TeTimezonePipe,\n WorldClockComponent,\n LiveClockComponent,\n SchedulerComponent,\n BusinessHoursComponent,\n ShiftPlannerComponent,\n GlobalMeetingPlannerComponent,\n] as const;\n\n/** Business hours module bundle */\nexport const TIMEZONE_BUSINESS_HOURS_IMPORTS = [BusinessHoursComponent, TeFormatDatePipe] as const;\n\n/** Shift engine module bundle */\nexport const TIMEZONE_SHIFT_ENGINE_IMPORTS = [ShiftPlannerComponent, TeFormatDatePipe] as const;\n\n/** Scheduler module bundle */\nexport const TIMEZONE_SCHEDULER_IMPORTS = [\n SchedulerComponent,\n GlobalMeetingPlannerComponent,\n WorldClockComponent,\n] as const;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multisystemsuite/timezone-engine-angular",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Angular services, pipes, and components for @multisystemsuite/timezone-engine",
5
5
  "license": "MIT",
6
6
  "author": "MultiSystemSuite",
@@ -34,10 +34,12 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "@multisystemsuite/timezone-engine-core": "2.0.0",
38
- "@multisystemsuite/timezone-engine-world-data": "2.0.0",
39
- "@multisystemsuite/timezone-engine-scheduler": "2.0.0",
40
- "@multisystemsuite/timezone-engine-shared-types": "2.0.0"
37
+ "@multisystemsuite/timezone-engine-business-hours": "3.0.0",
38
+ "@multisystemsuite/timezone-engine-shared-types": "3.0.0",
39
+ "@multisystemsuite/timezone-engine-scheduler": "3.0.0",
40
+ "@multisystemsuite/timezone-engine-core": "3.0.0",
41
+ "@multisystemsuite/timezone-engine-shift-engine": "3.0.0",
42
+ "@multisystemsuite/timezone-engine-world-data": "3.0.0"
41
43
  },
42
44
  "peerDependencies": {
43
45
  "@angular/common": ">=17.0.0",