@softpak/components 21.2.0-capwesome.3 → 21.2.0-capwesome.4
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/fesm2022/softpak-components-spx-app-expiry.mjs +5 -5
- package/fesm2022/softpak-components-spx-app-expiry.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-channel-selection.mjs +40 -24
- package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-confirm.mjs +17 -25
- package/fesm2022/softpak-components-spx-confirm.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-helpers.mjs +9 -1
- package/fesm2022/softpak-components-spx-helpers.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-navigation.mjs +14 -21
- package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-spinner.mjs +12 -18
- package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-tabs.mjs +8 -11
- package/fesm2022/softpak-components-spx-tabs.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-toaster.mjs +22 -39
- package/fesm2022/softpak-components-spx-toaster.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-translate.mjs +5 -2
- package/fesm2022/softpak-components-spx-translate.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-update.mjs +50 -50
- package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-welcome.mjs +2 -2
- package/fesm2022/softpak-components-spx-welcome.mjs.map +1 -1
- package/package.json +1 -1
- package/types/softpak-components-spx-channel-selection.d.ts +14 -7
- package/types/softpak-components-spx-confirm.d.ts +21 -33
- package/types/softpak-components-spx-helpers.d.ts +3 -1
- package/types/softpak-components-spx-navigation.d.ts +20 -36
- package/types/softpak-components-spx-spinner.d.ts +14 -27
- package/types/softpak-components-spx-tabs.d.ts +8 -17
- package/types/softpak-components-spx-toaster.d.ts +55 -91
- package/types/softpak-components-spx-translate.d.ts +3 -1
- package/types/softpak-components-spx-update.d.ts +15 -13
|
@@ -2,10 +2,6 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { input, signal, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
3
|
import { DateTime } from 'luxon';
|
|
4
4
|
|
|
5
|
-
const spxCheckExpiryWarning = (appStoreVersion, spxAppExpiry) => {
|
|
6
|
-
return spxAppExpiry !== undefined && appStoreVersion.substring(0, 3) !== spxAppExpiry.requiredVersion.substring(0, 3) && DateTime.now() > spxAppExpiry.warning;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
5
|
const spxCheckExpiryFinalWarning = (appStoreVersion, spxAppExpiry) => {
|
|
10
6
|
return spxAppExpiry !== undefined && appStoreVersion.substring(0, 3) !== spxAppExpiry.requiredVersion.substring(0, 3) && DateTime.now() > spxAppExpiry.finalWarning;
|
|
11
7
|
};
|
|
@@ -14,6 +10,10 @@ const spxCheckExpiryHappened = (appStoreVersion, spxAppExpiry) => {
|
|
|
14
10
|
return spxAppExpiry !== undefined && appStoreVersion.substring(0, 3) !== spxAppExpiry.requiredVersion.substring(0, 3) && DateTime.now() > spxAppExpiry.expiry;
|
|
15
11
|
};
|
|
16
12
|
|
|
13
|
+
const spxCheckExpiryWarning = (appStoreVersion, spxAppExpiry) => {
|
|
14
|
+
return spxAppExpiry !== undefined && appStoreVersion.substring(0, 3) !== spxAppExpiry.requiredVersion.substring(0, 3) && DateTime.now() > spxAppExpiry.warning;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
17
|
class SpxAppExpiryComponent {
|
|
18
18
|
constructor() {
|
|
19
19
|
this.txtContactHelpdeskOrSoftpak = input.required(...(ngDevMode ? [{ debugName: "txtContactHelpdeskOrSoftpak" }] : []));
|
|
@@ -36,7 +36,7 @@ class SpxAppExpiryComponent {
|
|
|
36
36
|
if (spxExpiry && spxVersion) {
|
|
37
37
|
this.expired.set(spxCheckExpiryHappened(spxVersion, spxExpiry));
|
|
38
38
|
this.finalWarning.set(spxCheckExpiryFinalWarning(spxVersion, spxExpiry) && !this.expired());
|
|
39
|
-
this.warning.set(spxCheckExpiryWarning(spxVersion, spxExpiry) && !this.finalWarning && !this.expired());
|
|
39
|
+
this.warning.set(spxCheckExpiryWarning(spxVersion, spxExpiry) && !this.finalWarning() && !this.expired());
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SpxAppExpiryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"softpak-components-spx-app-expiry.mjs","sources":["../../../../projects/softpak/components/spx-app-expiry/spx-check-expiry-warning.interface.ts","../../../../projects/softpak/components/spx-app-expiry/spx-check-expiry-
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-app-expiry.mjs","sources":["../../../../projects/softpak/components/spx-app-expiry/spx-check-expiry-final-warning.interface.ts","../../../../projects/softpak/components/spx-app-expiry/spx-check-expiry-happened.interface.ts","../../../../projects/softpak/components/spx-app-expiry/spx-check-expiry-warning.interface.ts","../../../../projects/softpak/components/spx-app-expiry/spx-app-expiry.component.ts","../../../../projects/softpak/components/spx-app-expiry/spx-app-expiry.component.html","../../../../projects/softpak/components/spx-app-expiry/softpak-components-spx-app-expiry.ts"],"sourcesContent":["import { DateTime } from \"luxon\";\nimport { SpxAppExpiryI } from \"./spx-app-expiry.interface\";\n\nexport const spxCheckExpiryFinalWarning = (appStoreVersion: string, spxAppExpiry?: SpxAppExpiryI) => {\n return spxAppExpiry !== undefined && appStoreVersion.substring(0,3) !== spxAppExpiry.requiredVersion.substring(0,3) && DateTime.now() > spxAppExpiry.finalWarning;\n}","import { DateTime } from \"luxon\";\nimport { SpxAppExpiryI } from \"./spx-app-expiry.interface\";\n\nexport const spxCheckExpiryHappened = (appStoreVersion: string, spxAppExpiry: SpxAppExpiryI): boolean => {\n return spxAppExpiry !== undefined && appStoreVersion.substring(0,3) !== spxAppExpiry.requiredVersion.substring(0,3) && DateTime.now() > spxAppExpiry.expiry;\n}","import { DateTime } from \"luxon\";\nimport { SpxAppExpiryI } from \"./spx-app-expiry.interface\";\n\nexport const spxCheckExpiryWarning = (appStoreVersion: string, spxAppExpiry?: SpxAppExpiryI): boolean => {\n return spxAppExpiry !== undefined && appStoreVersion.substring(0,3) !== spxAppExpiry.requiredVersion.substring(0,3) && DateTime.now() > spxAppExpiry.warning;\n}","import { ChangeDetectionStrategy, Component, OnChanges, input, signal } from '@angular/core';\n\nimport { SpxAppExpiryI } from './spx-app-expiry.interface';\nimport { spxCheckExpiryFinalWarning } from './spx-check-expiry-final-warning.interface';\nimport { spxCheckExpiryHappened } from './spx-check-expiry-happened.interface';\nimport { spxCheckExpiryWarning } from './spx-check-expiry-warning.interface';\n\n@Component({\n selector: 'spx-app-expiry',\n imports: [],\n templateUrl: './spx-app-expiry.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush, \n standalone: true,\n})\nexport class SpxAppExpiryComponent implements OnChanges {\n readonly txtContactHelpdeskOrSoftpak = input.required<string>();\n readonly txtExpired = input.required<string>();\n readonly txtLastReminder = input.required<string>();\n readonly txtPleaseOpenTheAppStore = input.required<string>();\n readonly txtPleaseUpdate = input.required<string>();\n readonly txtThisVersionWillExpireSoon = input.required<string>();\n readonly txtUpdateAvailable = input.required<string>();\n readonly txtUpdateTheAppToTheLatestVersion = input.required<string>();\n readonly spxExpiry = input.required<SpxAppExpiryI>();\n readonly spxVersion = input.required<string>();\n warning = signal<boolean>(false);\n finalWarning = signal<boolean>(false);\n expired = signal<boolean>(false);\n ngOnChanges(): void {\n const spxExpiry = this.spxExpiry();\n const spxVersion = this.spxVersion();\n if (spxExpiry && spxVersion) {\n this.expired.set(spxCheckExpiryHappened(spxVersion, spxExpiry));\n this.finalWarning.set(spxCheckExpiryFinalWarning(spxVersion, spxExpiry) && !this.expired());\n this.warning.set(spxCheckExpiryWarning(spxVersion, spxExpiry) && !this.finalWarning() && !this.expired());\n }\n }\n}\n","@if (warning() || finalWarning() || expired()) {\n <div class=\"m-3\">\n <div\n class=\"p-3 font-bold text-white rounded-t text-xl\"\n [class.bg-lime-600]=\"warning()\"\n [class.bg-red-600]=\"expired()\"\n [class.bg-amber-600]=\"finalWarning()\">\n @if (warning()) {\n {{ txtUpdateAvailable() }}\n }\n @if (finalWarning()) {\n {{ txtLastReminder() }}\n }\n @if (expired()) {\n {{ txtExpired() }}\n }\n </div>\n <div\n class=\"bg-amber-50 p-3 text-black rounded-b mb-3\">\n <div>{{ txtPleaseOpenTheAppStore() }}.</div>\n <div>{{ txtUpdateTheAppToTheLatestVersion() }}.</div>\n <div>{{ txtContactHelpdeskOrSoftpak() }}.</div>\n @if (finalWarning()) {\n <div>{{ txtThisVersionWillExpireSoon() }}.</div>\n }\n </div>\n </div>\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAGa,0BAA0B,GAAG,CAAC,eAAuB,EAAE,YAA4B,KAAI;AAClG,IAAA,OAAO,YAAY,KAAK,SAAS,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC,EAAC,CAAC,CAAC,KAAK,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,EAAC,CAAC,CAAC,IAAK,QAAQ,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC,YAAY;AACpK;;MCFa,sBAAsB,GAAG,CAAC,eAAuB,EAAE,YAA2B,KAAa;AACtG,IAAA,OAAO,YAAY,KAAK,SAAS,IAAI,eAAe,CAAC,SAAS,CAAC,CAAC,EAAC,CAAC,CAAC,KAAK,YAAY,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,EAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC,MAAM;AAC7J;;MCFa,qBAAqB,GAAG,CAAC,eAAuB,EAAE,YAA4B,KAAa;AACtG,IAAA,OAA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AI,SAAS,IAAI,UAAU,EAAE;AAC3B,YAAA,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC/D,YAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,0BAA0B,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC3F,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3G;IACF;8GAtBW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAArB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,qBAAqB,krDCdlC,g1BA2BC,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FDbY,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAPjC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gBAAgB,WACjB,EAAE,EAAA,eAAA,EAEM,uBAAuB,CAAC,MAAM,cACnC,IAAI,EAAA,QAAA,EAAA,g1BAAA,EAAA;;;AEZpB;;AAEG;;;;"}
|
|
@@ -6,21 +6,22 @@ import { Capacitor } from '@capacitor/core';
|
|
|
6
6
|
import { NavController } from '@ionic/angular/standalone';
|
|
7
7
|
import { SpxButtonComponent } from '@softpak/components/spx-button';
|
|
8
8
|
import { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';
|
|
9
|
-
import { createActionGroup, props, createFeature, createReducer, on, Store } from '@ngrx/store';
|
|
10
|
-
import { TranslatePipe } from '@ngx-translate/core';
|
|
11
|
-
import { map } from 'rxjs';
|
|
9
|
+
import { createActionGroup, props, createFeature, createReducer, on, createSelector, Store } from '@ngrx/store';
|
|
10
|
+
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
|
11
|
+
import { map, of, from } from 'rxjs';
|
|
12
12
|
import { SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';
|
|
13
|
-
import { spxTextChange } from '@softpak/components/spx-translate';
|
|
13
|
+
import { spxTextChange, spxTextLiveUpdateChannelSetFailed } from '@softpak/components/spx-translate';
|
|
14
14
|
import { toSignal } from '@angular/core/rxjs-interop';
|
|
15
15
|
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
|
16
16
|
import { spxToasterActions, SpxToasterAutoCloseSpeedEnum } from '@softpak/components/spx-toaster';
|
|
17
17
|
import { App } from '@capacitor/app';
|
|
18
18
|
import { LiveUpdate } from '@capawesome/capacitor-live-update';
|
|
19
19
|
import { captureMessage } from '@sentry/angular';
|
|
20
|
+
import { getBinaryVersionGroup } from '@softpak/components/spx-helpers';
|
|
20
21
|
import { spxUpdateUrl } from '@softpak/components/spx-update';
|
|
21
|
-
import { switchMap } from 'rxjs/operators';
|
|
22
|
+
import { switchMap, map as map$1, catchError, tap } from 'rxjs/operators';
|
|
22
23
|
|
|
23
|
-
const
|
|
24
|
+
const spxChannelActions = createActionGroup({
|
|
24
25
|
source: 'SpxChannel',
|
|
25
26
|
events: {
|
|
26
27
|
Choose: props(),
|
|
@@ -61,7 +62,10 @@ const determineActiveChannel = (channels) => {
|
|
|
61
62
|
};
|
|
62
63
|
var spxChannelReducer$1 = createFeature({
|
|
63
64
|
name: 'spxChannel',
|
|
64
|
-
|
|
65
|
+
extraSelectors: ({ selectChannel }) => ({
|
|
66
|
+
selectCompanyName: createSelector(selectChannel, (channel) => channel?.brand),
|
|
67
|
+
}),
|
|
68
|
+
reducer: createReducer(initialState, on(spxChannelActions.choose, (state, { channel, channelType }) => {
|
|
65
69
|
SpxStorage.setSetting(SpxStorageKeyEnum.brand, channel?.brand);
|
|
66
70
|
SpxStorage.setSetting(SpxStorageKeyEnum.channelType, channelType);
|
|
67
71
|
return {
|
|
@@ -69,7 +73,7 @@ var spxChannelReducer$1 = createFeature({
|
|
|
69
73
|
previousChannel: state.channel,
|
|
70
74
|
channel,
|
|
71
75
|
};
|
|
72
|
-
}), on(
|
|
76
|
+
}), on(spxChannelActions.initialize, (state, { channels }) => {
|
|
73
77
|
let channelType = null;
|
|
74
78
|
if (SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {
|
|
75
79
|
channelType = { name: SpxStorage.getSetting(SpxStorageKeyEnum.channelType) };
|
|
@@ -145,7 +149,8 @@ class Effects {
|
|
|
145
149
|
constructor() {
|
|
146
150
|
this.actions$ = inject(Actions);
|
|
147
151
|
this.router = inject(Router);
|
|
148
|
-
this.
|
|
152
|
+
this.translateService = inject(TranslateService);
|
|
153
|
+
this.onChoose$ = createEffect(() => this.actions$.pipe(ofType(spxChannelActions.choose), switchMap((action) => {
|
|
149
154
|
if (Capacitor.getPlatform() === 'web') {
|
|
150
155
|
const channelType = action.channel.channelTypes.find(channelType => channelType.name === action.channelType);
|
|
151
156
|
if (channelType.webUrl && !window.location.href.includes('http://localhost') && window.location.href.replace(channelType.webUrl, '').replace(channelType.oldWebUrl, '').split('/').at(0) !== '') {
|
|
@@ -154,23 +159,34 @@ class Effects {
|
|
|
154
159
|
else {
|
|
155
160
|
this.router.navigate(['tabs/hme']);
|
|
156
161
|
}
|
|
162
|
+
return of(spxToasterActions.createSuccess({
|
|
163
|
+
autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,
|
|
164
|
+
messageText: action.channel?.brand,
|
|
165
|
+
}));
|
|
157
166
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
this.router.navigate([spxUpdateUrl]);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return [spxToasterActions.createSuccess({
|
|
167
|
+
return from(App.getInfo()).pipe(switchMap((binaryInfo) => from(LiveUpdate.setChannel({
|
|
168
|
+
channel: `${action.channelType}-${getBinaryVersionGroup(binaryInfo.version)}.x`
|
|
169
|
+
})).pipe(map$1(() => true), catchError((err) => {
|
|
170
|
+
captureMessage(`SPX Channel setChannel Error: ${JSON.stringify(err)}`);
|
|
171
|
+
return of(false);
|
|
172
|
+
}))), tap(() => {
|
|
173
|
+
this.router.navigate([spxUpdateUrl]);
|
|
174
|
+
}), map$1((setChannelSucceeded) => setChannelSucceeded
|
|
175
|
+
? spxToasterActions.createSuccess({
|
|
171
176
|
autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,
|
|
172
177
|
messageText: action.channel?.brand,
|
|
173
|
-
})
|
|
178
|
+
})
|
|
179
|
+
: spxToasterActions.createWarning({
|
|
180
|
+
autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,
|
|
181
|
+
messageText: this.translateService.instant(spxTextLiveUpdateChannelSetFailed),
|
|
182
|
+
})), catchError((err) => {
|
|
183
|
+
captureMessage(`SPX Channel Error: ${JSON.stringify(err)}`);
|
|
184
|
+
this.router.navigate([spxUpdateUrl]);
|
|
185
|
+
return of(spxToasterActions.createWarning({
|
|
186
|
+
autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,
|
|
187
|
+
messageText: this.translateService.instant(spxTextLiveUpdateChannelSetFailed),
|
|
188
|
+
}));
|
|
189
|
+
}));
|
|
174
190
|
})), { dispatch: true });
|
|
175
191
|
}
|
|
176
192
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: Effects, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
@@ -189,5 +205,5 @@ var spxChannel_effects = /*#__PURE__*/Object.freeze({
|
|
|
189
205
|
* Generated bundle index. Do not edit.
|
|
190
206
|
*/
|
|
191
207
|
|
|
192
|
-
export {
|
|
208
|
+
export { SpxChannelGuard, SpxChannelIndicatorComponent, spxChannelActions, spxChannel_effects as spxChannelEffects, spxChannel_reducer as spxChannelReducer, spxChannelSelectionUrl };
|
|
193
209
|
//# sourceMappingURL=softpak-components-spx-channel-selection.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"softpak-components-spx-channel-selection.mjs","sources":["../../../../projects/softpak/components/spx-channel-selection/store/spx-channel.actions.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel.reducer.ts","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-indicator/spx-channel-indicator.component.ts","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-indicator/spx-channel-indicator.component.html","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-guard.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel.effects.ts","../../../../projects/softpak/components/spx-channel-selection/softpak-components-spx-channel-selection.ts"],"sourcesContent":["import { SpxAppChannelI, SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';\nimport { createActionGroup, props } from '@ngrx/store';\n\nexport const SpxChannelActions = createActionGroup({\n source: 'SpxChannel',\n events: {\n Choose: props<{\n channel: SpxAppChannelI;\n channelType: SpxAppChannelTypeEnum;\n }>(),\n Initialize: props<{\n channels: SpxAppChannelI[];\n }>(),\n },\n});\n","import { SpxAppChannelI, SpxAppChannelTypeEnum, SpxChannelTypeI } from '@softpak/components/spx-app-configuration';\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\nimport { createFeature, createReducer, on } from '@ngrx/store';\n\nimport { Capacitor } from '@capacitor/core';\nimport { SpxChannelActions } from './spx-channel.actions';\n\nexport const initialState: StateI = {\n previousChannel: null,\n channel: null,\n channelType: null,\n channels: [],\n};\n\nexport interface StateI {\n previousChannel: SpxAppChannelI | null;\n channel: SpxAppChannelI | null;\n channels: SpxAppChannelI[];\n channelType: SpxChannelTypeI | null;\n}\n\nconst determineActiveChannel = (channels: SpxAppChannelI[]): SpxAppChannelI | null => {\n if (SpxStorage.getSetting(SpxStorageKeyEnum.brand) && SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {\n const channelResult = channels.find(channel => channel.brand === SpxStorage.getSetting(SpxStorageKeyEnum.brand) && channel.channelTypes.some((e: SpxChannelTypeI) => e.name === SpxStorage.getSetting(SpxStorageKeyEnum.channelType) as SpxAppChannelTypeEnum));\n if (channelResult) {\n return channelResult;\n } else {\n const defaultBrandResult = channels.find(channel => channel.default);\n if (defaultBrandResult) {\n return defaultBrandResult;\n } else {\n SpxStorage.clearSetting(SpxStorageKeyEnum.brand);\n return null;\n }\n }\n } else {\n const defaultBrandResult = channels.find(channel => channel.default);\n if (defaultBrandResult) {\n return defaultBrandResult;\n }\n return null;\n }\n}\n\nexport default createFeature({\n name: 'spxChannel',\n reducer: createReducer(\n initialState,\n on(SpxChannelActions.choose, (state, { channel, channelType }): StateI => {\n SpxStorage.setSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.brand, channel?.brand);\n SpxStorage.setSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.channelType, channelType);\n return {\n ...state,\n previousChannel: state.channel,\n channel,\n };\n }),\n on(SpxChannelActions.initialize, (state, { channels }): StateI => {\n\n let channelType: SpxChannelTypeI | null = null;\n\n if (SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {\n channelType = { name: SpxStorage.getSetting(SpxStorageKeyEnum.channelType) as SpxAppChannelTypeEnum };\n }\n else {\n channelType = { name: Capacitor.getPlatform() === 'web' ? SpxAppChannelTypeEnum.webLive : SpxAppChannelTypeEnum.production }; // Default to production if no type is set\n }\n\n return {\n ...state,\n channel: determineActiveChannel(channels),\n channels: channels.slice().sort((a, b) => a.brand.localeCompare(b.brand)),\n channelType: channelType,\n }\n }),\n ),\n});\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\n\nimport { Capacitor } from '@capacitor/core';\nimport { NavController } from '@ionic/angular/standalone';\nimport { SpxButtonComponent } from '@softpak/components/spx-button';\nimport { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';\nimport { Store } from '@ngrx/store';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { map } from 'rxjs';\nimport spxChannelReducer from '../../store/spx-channel.reducer';\nimport { spxTextChange } from '@softpak/components/spx-translate';\nimport { toSignal } from '@angular/core/rxjs-interop';\n\nexport const spxChannelSelectionUrl = 'wlc';\n\n@Component({\n selector: 'spx-channel-indicator',\n templateUrl: './spx-channel-indicator.component.html',\n imports: [\n SpxButtonComponent,\n SpxCapitalizePipe,\n TranslatePipe,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class SpxChannelIndicatorComponent {\n private readonly navController = inject(NavController);\n private readonly store = inject(Store);\n protected readonly channel = this.store.selectSignal(spxChannelReducer.selectChannel);\n protected readonly channelType = toSignal(this.store.select(spxChannelReducer.selectChannelType).pipe(\n map(channelType => channelType?.name)\n ));\n protected readonly spxTextChange = spxTextChange;\n\n protected onChange() {\n this.navController.navigateRoot([spxChannelSelectionUrl]);\n }\n\n protected canShowChannelType() {\n return Capacitor.getPlatform() !== 'web';\n }\n}\n","<div class=\"bg-white p-3 rounded flex gap-3 items-center text-black\">\n <div class=\"grow\">\n <div class=\"text-lg font-bold\">{{ channel()?.brand }}</div>\n @if (canShowChannelType() && channelType() !== 'Production') {\n <div class=\"text-base text-gray-600\">{{ channelType() }}</div>\n }\n </div>\n <spx-button (click)=\"onChange()\" [spxType]=\"'button'\">{{ spxTextChange | translate | capitalize }}</spx-button>\n</div>","import { Router } from '@angular/router';\nimport { inject, Injectable } from '@angular/core';\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\nimport { spxChannelSelectionUrl } from './spx-channel-indicator/spx-channel-indicator.component';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SpxChannelGuard {\n\n private readonly router = inject(Router);\n\n canActivate(): boolean {\n if (\n !SpxStorage.getSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.brand) ||\n !SpxStorage.getSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.channelType)\n ) {\n this.router.navigate([spxChannelSelectionUrl]);\n return false;\n }\n return true;\n }\n}\n","import { Actions, createEffect, ofType } from '@ngrx/effects';\nimport { Injectable, inject } from '@angular/core';\nimport { SpxToasterAutoCloseSpeedEnum, spxToasterActions } from '@softpak/components/spx-toaster';\n\nimport { App } from '@capacitor/app';\nimport { Capacitor } from '@capacitor/core';\nimport { LiveUpdate } from \"@capawesome/capacitor-live-update\";\nimport { Router } from '@angular/router';\nimport { SpxChannelActions } from './spx-channel.actions';\nimport { captureMessage } from '@sentry/angular';\nimport { spxUpdateUrl } from '@softpak/components/spx-update';\nimport { switchMap } from 'rxjs/operators';\n\n@Injectable()\nexport class Effects {\n private readonly actions$ = inject(Actions);\n private readonly router = inject(Router);\n\n onChoose$ =\n createEffect(() =>\n this.actions$.pipe(\n ofType(SpxChannelActions.choose),\n switchMap((action) => {\n if (Capacitor.getPlatform() === 'web') {\n const channelType = action.channel.channelTypes.find(channelType => channelType.name === action.channelType)!;\n if (channelType.webUrl && !window.location.href.includes('http://localhost') && window.location.href.replace(channelType.webUrl!, '').replace(channelType.oldWebUrl!, '').split('/').at(0) !== '') {\n window.location.href = channelType.webUrl!;\n } else {\n this.router.navigate(['tabs/hme']);\n }\n } else {\n App.getInfo().then((binaryInfo) => {\n const binaryVersionGroup = binaryInfo.version.substring(0, 3);\n LiveUpdate.setChannel({\n channel: `${action.channelType}-${binaryVersionGroup}.x`\n });\n this.router.navigate([spxUpdateUrl]);\n }).catch((err) => {\n captureMessage(`SPX Channel Error: ${JSON.stringify(err)}`);\n this.router.navigate([spxUpdateUrl]);\n });\n }\n return [spxToasterActions.createSuccess({\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\n messageText: action.channel?.brand,\n })];\n }),\n ), { dispatch: true });\n}\n\n","/**\n * Generated bundle index. Do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C;gBACtC;YACJ;iBAAO;gBACH,GAAG,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,KAAI;AAC9B,oBAAA,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC7D,UAAU,CAAC,UAAU,CAAC;AAClB,wBAAA,OAAO,EAAE,CAAA,EAAG,MAAM,CAAC,WAAW,CAAA,CAAA,EAAI,kBAAkB,CAAA,EAAA;AACvD,qBAAA,CAAC;oBACF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;AACxC,gBAAA,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,KAAI;oBACb,cAAc,CAAC,CAAA,mBAAA,EAAsB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA,CAAE,CAAC;oBAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;AACxC,gBAAA,CAAC,CAAC;YACN;AACA,YAAA,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC;oBACpC,SAAS,EAAE,4BAA4B,CAAC,OAAO;AAC/C,oBAAA,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK;AACrC,iBAAA,CAAC,CAAC;QACP,CAAC,CAAC,CACL,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACjC,IAAA;8GAlCY,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAP,OAAO,EAAA,CAAA,CAAA;;2FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBADnB;;;;;;;;ACbD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-channel-selection.mjs","sources":["../../../../projects/softpak/components/spx-channel-selection/store/spx-channel.actions.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel.reducer.ts","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-indicator/spx-channel-indicator.component.ts","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-indicator/spx-channel-indicator.component.html","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-guard.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel.effects.ts","../../../../projects/softpak/components/spx-channel-selection/softpak-components-spx-channel-selection.ts"],"sourcesContent":["import { SpxAppChannelI, SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';\nimport { createActionGroup, props } from '@ngrx/store';\n\nexport const spxChannelActions = createActionGroup({\n source: 'SpxChannel',\n events: {\n Choose: props<{ channel: SpxAppChannelI; channelType: SpxAppChannelTypeEnum; }>(),\n Initialize: props<{ channels: SpxAppChannelI[]; }>(),\n },\n});\n","import { SpxAppChannelI, SpxAppChannelTypeEnum, SpxChannelTypeI } from '@softpak/components/spx-app-configuration';\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\nimport { createFeature, createReducer, createSelector, on } from '@ngrx/store';\n\nimport { Capacitor } from '@capacitor/core';\nimport { spxChannelActions } from './spx-channel.actions';\n\nexport const initialState: StateI = {\n previousChannel: null,\n channel: null,\n channelType: null,\n channels: [],\n};\n\nexport interface StateI {\n previousChannel: SpxAppChannelI | null;\n channel: SpxAppChannelI | null;\n channels: SpxAppChannelI[];\n channelType: SpxChannelTypeI | null;\n}\n\nconst determineActiveChannel = (channels: SpxAppChannelI[]): SpxAppChannelI | null => {\n if (SpxStorage.getSetting(SpxStorageKeyEnum.brand) && SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {\n const channelResult = channels.find(channel => channel.brand === SpxStorage.getSetting(SpxStorageKeyEnum.brand) && channel.channelTypes.some((e: SpxChannelTypeI) => e.name === SpxStorage.getSetting(SpxStorageKeyEnum.channelType) as SpxAppChannelTypeEnum));\n if (channelResult) {\n return channelResult;\n } else {\n const defaultBrandResult = channels.find(channel => channel.default);\n if (defaultBrandResult) {\n return defaultBrandResult;\n } else {\n SpxStorage.clearSetting(SpxStorageKeyEnum.brand);\n return null;\n }\n }\n } else {\n const defaultBrandResult = channels.find(channel => channel.default);\n if (defaultBrandResult) {\n return defaultBrandResult;\n }\n return null;\n }\n}\n\nexport default createFeature({\n name: 'spxChannel',\n extraSelectors: ({ selectChannel }) => ({\n selectCompanyName: createSelector(selectChannel, (channel) => channel?.brand),\n }),\n reducer: createReducer(\n initialState,\n on(spxChannelActions.choose, (state, { channel, channelType }): StateI => {\n SpxStorage.setSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.brand, channel?.brand);\n SpxStorage.setSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.channelType, channelType);\n return {\n ...state,\n previousChannel: state.channel,\n channel,\n };\n }),\n on(spxChannelActions.initialize, (state, { channels }): StateI => {\n\n let channelType: SpxChannelTypeI | null = null;\n\n if (SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {\n channelType = { name: SpxStorage.getSetting(SpxStorageKeyEnum.channelType) as SpxAppChannelTypeEnum };\n }\n else {\n channelType = { name: Capacitor.getPlatform() === 'web' ? SpxAppChannelTypeEnum.webLive : SpxAppChannelTypeEnum.production }; // Default to production if no type is set\n }\n\n return {\n ...state,\n channel: determineActiveChannel(channels),\n channels: channels.slice().sort((a, b) => a.brand.localeCompare(b.brand)),\n channelType: channelType,\n }\n }),\n ),\n});\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\n\nimport { Capacitor } from '@capacitor/core';\nimport { NavController } from '@ionic/angular/standalone';\nimport { SpxButtonComponent } from '@softpak/components/spx-button';\nimport { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';\nimport { Store } from '@ngrx/store';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { map } from 'rxjs';\nimport spxChannelReducer from '../../store/spx-channel.reducer';\nimport { spxTextChange } from '@softpak/components/spx-translate';\nimport { toSignal } from '@angular/core/rxjs-interop';\n\nexport const spxChannelSelectionUrl = 'wlc';\n\n@Component({\n selector: 'spx-channel-indicator',\n templateUrl: './spx-channel-indicator.component.html',\n imports: [\n SpxButtonComponent,\n SpxCapitalizePipe,\n TranslatePipe,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n})\nexport class SpxChannelIndicatorComponent {\n private readonly navController = inject(NavController);\n private readonly store = inject(Store);\n protected readonly channel = this.store.selectSignal(spxChannelReducer.selectChannel);\n protected readonly channelType = toSignal(this.store.select(spxChannelReducer.selectChannelType).pipe(\n map(channelType => channelType?.name)\n ));\n protected readonly spxTextChange = spxTextChange;\n\n protected onChange() {\n this.navController.navigateRoot([spxChannelSelectionUrl]);\n }\n\n protected canShowChannelType() {\n return Capacitor.getPlatform() !== 'web';\n }\n}\n","<div class=\"bg-white p-3 rounded flex gap-3 items-center text-black\">\n <div class=\"grow\">\n <div class=\"text-lg font-bold\">{{ channel()?.brand }}</div>\n @if (canShowChannelType() && channelType() !== 'Production') {\n <div class=\"text-base text-gray-600\">{{ channelType() }}</div>\n }\n </div>\n <spx-button (click)=\"onChange()\" [spxType]=\"'button'\">{{ spxTextChange | translate | capitalize }}</spx-button>\n</div>","import { Router } from '@angular/router';\nimport { inject, Injectable } from '@angular/core';\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\nimport { spxChannelSelectionUrl } from './spx-channel-indicator/spx-channel-indicator.component';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SpxChannelGuard {\n\n private readonly router = inject(Router);\n\n canActivate(): boolean {\n if (\n !SpxStorage.getSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.brand) ||\n !SpxStorage.getSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.channelType)\n ) {\n this.router.navigate([spxChannelSelectionUrl]);\n return false;\n }\n return true;\n }\n}\n","import { Actions, createEffect, ofType } from '@ngrx/effects';\nimport { Injectable, inject } from '@angular/core';\nimport { SpxToasterAutoCloseSpeedEnum, spxToasterActions } from '@softpak/components/spx-toaster';\n\nimport { App } from '@capacitor/app';\nimport { Capacitor } from '@capacitor/core';\nimport { LiveUpdate } from \"@capawesome/capacitor-live-update\";\nimport { Router } from '@angular/router';\nimport { captureMessage } from '@sentry/angular';\nimport { getBinaryVersionGroup } from '@softpak/components/spx-helpers';\nimport { spxChannelActions } from './spx-channel.actions';\nimport { spxUpdateUrl } from '@softpak/components/spx-update';\nimport { TranslateService } from '@ngx-translate/core';\nimport { spxTextLiveUpdateChannelSetFailed } from '@softpak/components/spx-translate';\nimport { from, of } from 'rxjs';\nimport { catchError, map, switchMap, tap } from 'rxjs/operators';\n\n@Injectable()\nexport class Effects {\n private readonly actions$ = inject(Actions);\n private readonly router = inject(Router);\n private readonly translateService = inject(TranslateService);\n\n onChoose$ =\n createEffect(() =>\n this.actions$.pipe(\n ofType(spxChannelActions.choose),\n switchMap((action) => {\n if (Capacitor.getPlatform() === 'web') {\n const channelType = action.channel.channelTypes.find(channelType => channelType.name === action.channelType)!;\n if (channelType.webUrl && !window.location.href.includes('http://localhost') && window.location.href.replace(channelType.webUrl!, '').replace(channelType.oldWebUrl!, '').split('/').at(0) !== '') {\n window.location.href = channelType.webUrl!;\n } else {\n this.router.navigate(['tabs/hme']);\n }\n return of(spxToasterActions.createSuccess({\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\n messageText: action.channel?.brand,\n }));\n }\n return from(App.getInfo()).pipe(\n switchMap((binaryInfo) => from(LiveUpdate.setChannel({\n channel: `${action.channelType}-${getBinaryVersionGroup(binaryInfo.version)}.x`\n })).pipe(\n map(() => true),\n catchError((err) => {\n captureMessage(`SPX Channel setChannel Error: ${JSON.stringify(err)}`);\n return of(false);\n }),\n )),\n tap(() => {\n this.router.navigate([spxUpdateUrl]);\n }),\n map((setChannelSucceeded) => setChannelSucceeded\n ? spxToasterActions.createSuccess({\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\n messageText: action.channel?.brand,\n })\n : spxToasterActions.createWarning({\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\n messageText: this.translateService.instant(spxTextLiveUpdateChannelSetFailed),\n })),\n catchError((err) => {\n captureMessage(`SPX Channel Error: ${JSON.stringify(err)}`);\n this.router.navigate([spxUpdateUrl]);\n return of(spxToasterActions.createWarning({\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\n messageText: this.translateService.instant(spxTextLiveUpdateChannelSetFailed),\n }));\n }),\n );\n }),\n ), { dispatch: true });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["spxChannelReducer","map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AACjD,IAAA,MAAM,EAAE,YAAY;AACpB,IAAA,MAAM,EAAE;QACN,MAAM,EAAE,KAAK,EAAoE;QACjF,UAAU,EAAE,KAAK,EAAmC;AACrD,KAAA;AACF,CAAA;;ACFM,MAAM,YAAY,GAAW;AAClC,IAAA,eAAe,EAAE,IAAI;AACrB,IAAA,OAAO,EAAE,IAAI;AACb,IAAA,WAAW,EAAE,IAAI;AACjB,IAAA,QAAQ,EAAE,EAAE;CACb;AASD,MAAM,sBAAsB,GAAG,CAAC,QAA0B,KAA2B;AACnF,IAAA,IAAI,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE;QAC1G,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAkB,KAAK,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,UAAU,CAAC,iBAAiB,CAAC,WAAW,CAA0B,CAAC,CAAC;QAC/P,IAAI,aAAa,EAAE;AACjB,YAAA,OAAO,aAAa;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Times } from '@fortawesome/free-solid-svg-icons';
|
|
|
5
5
|
import { SpxButtonComponent } from '@softpak/components/spx-button';
|
|
6
6
|
import { SpxSeverityEnum } from '@softpak/components/spx-helpers';
|
|
7
7
|
import * as i1 from '@ngrx/store';
|
|
8
|
-
import {
|
|
8
|
+
import { createActionGroup, props, emptyProps, createFeature, createReducer, on } from '@ngrx/store';
|
|
9
9
|
import * as i1$1 from '@ngrx/effects';
|
|
10
10
|
import { createEffect, ofType } from '@ngrx/effects';
|
|
11
11
|
import { withLatestFrom, mergeMap } from 'rxjs/operators';
|
|
@@ -55,13 +55,13 @@ class SpxConfirmDisplayerComponent {
|
|
|
55
55
|
this.subscriptions?.confirmState?.unsubscribe();
|
|
56
56
|
}
|
|
57
57
|
onCancel(id) {
|
|
58
|
-
this.appStore.dispatch(answer({
|
|
58
|
+
this.appStore.dispatch(spxConfirmActions.answer({
|
|
59
59
|
cancel: true,
|
|
60
60
|
id
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
63
|
onConfirm(id) {
|
|
64
|
-
this.appStore.dispatch(answer({
|
|
64
|
+
this.appStore.dispatch(spxConfirmActions.answer({
|
|
65
65
|
confirm: true,
|
|
66
66
|
id
|
|
67
67
|
}));
|
|
@@ -74,22 +74,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
74
74
|
args: [{ selector: 'spx-confirm-displayer', imports: [SpxConfirmComponent], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "@if (confirms().length > 0) {\n <div class=\"bg-black/75 block relative h-full\" style=\"z-index: 1000\">\n @for (confirm of confirms(); track confirm.id) {\n <spx-confirm [id]=\"confirm.id\" (spxCancel)=\"onCancel($event)\"\n (spxConfirm)=\"onConfirm($event)\">\n <ng-container confirm__title>{{ confirm.title }}</ng-container>\n <ng-container confirm__content>{{ confirm.content }}</ng-container>\n <ng-container confirm__btn_cancel>{{confirm.noYesButton ? 'NO' : 'Cancel'}}</ng-container>\n <ng-container confirm__btn_confirm>{{confirm.noYesButton ? 'YES' : 'OK'}}</ng-container>\n </spx-confirm>\n }\n </div>\n}" }]
|
|
75
75
|
}], ctorParameters: () => [{ type: i1.Store }] });
|
|
76
76
|
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
var spxConfirm_actions = /*#__PURE__*/Object.freeze({
|
|
88
|
-
__proto__: null,
|
|
89
|
-
answer: answer,
|
|
90
|
-
answerConfirm: answerConfirm,
|
|
91
|
-
reset: reset,
|
|
92
|
-
show: show
|
|
77
|
+
const spxConfirmActions = createActionGroup({
|
|
78
|
+
source: 'SpxConfirm',
|
|
79
|
+
events: {
|
|
80
|
+
Answer: props(),
|
|
81
|
+
AnswerConfirm: props(),
|
|
82
|
+
Reset: emptyProps(),
|
|
83
|
+
Show: props(),
|
|
84
|
+
},
|
|
93
85
|
});
|
|
94
86
|
|
|
95
87
|
const initialState = {
|
|
@@ -97,9 +89,9 @@ const initialState = {
|
|
|
97
89
|
};
|
|
98
90
|
var spxConfirmReducer$1 = createFeature({
|
|
99
91
|
name: 'spxConfirm',
|
|
100
|
-
reducer: createReducer(initialState, on(reset, (state, {}) => ({
|
|
92
|
+
reducer: createReducer(initialState, on(spxConfirmActions.reset, (state, {}) => ({
|
|
101
93
|
...state,
|
|
102
|
-
})), on(show, (state, { content, id, title, noYesButton, onCancel, onOK }) => {
|
|
94
|
+
})), on(spxConfirmActions.show, (state, { content, id, title, noYesButton, onCancel, onOK }) => {
|
|
103
95
|
const confirms = state.confirms.filter((c) => c.id).length > 0
|
|
104
96
|
? state.confirms
|
|
105
97
|
: [
|
|
@@ -117,7 +109,7 @@ var spxConfirmReducer$1 = createFeature({
|
|
|
117
109
|
...state,
|
|
118
110
|
confirms,
|
|
119
111
|
};
|
|
120
|
-
}), on(answerConfirm, (state, { id }) => ({
|
|
112
|
+
}), on(spxConfirmActions.answerConfirm, (state, { id }) => ({
|
|
121
113
|
...state,
|
|
122
114
|
confirms: [
|
|
123
115
|
...state.confirms.filter((c) => c.id !== id),
|
|
@@ -134,7 +126,7 @@ class SpxConfirmEffects {
|
|
|
134
126
|
constructor(actions$, appStore) {
|
|
135
127
|
this.actions$ = actions$;
|
|
136
128
|
this.appStore = appStore;
|
|
137
|
-
this.onAnswer$ = createEffect(() => this.actions$.pipe(ofType(answer), withLatestFrom(this.appStore.select(spxConfirmReducer$1.selectConfirms)), mergeMap(([action, confirms]) => {
|
|
129
|
+
this.onAnswer$ = createEffect(() => this.actions$.pipe(ofType(spxConfirmActions.answer), withLatestFrom(this.appStore.select(spxConfirmReducer$1.selectConfirms)), mergeMap(([action, confirms]) => {
|
|
138
130
|
if (action.confirm) {
|
|
139
131
|
confirms.find((c) => c.id === action.id)?.onOK?.();
|
|
140
132
|
}
|
|
@@ -142,7 +134,7 @@ class SpxConfirmEffects {
|
|
|
142
134
|
confirms.find((c) => c.id === action.id)?.onCancel?.();
|
|
143
135
|
}
|
|
144
136
|
return [
|
|
145
|
-
answerConfirm({ id: action.id }),
|
|
137
|
+
spxConfirmActions.answerConfirm({ id: action.id }),
|
|
146
138
|
spxSpinnerActions.hide({
|
|
147
139
|
action: action.id,
|
|
148
140
|
})
|
|
@@ -165,5 +157,5 @@ var spxConfirm_effects = /*#__PURE__*/Object.freeze({
|
|
|
165
157
|
* Generated bundle index. Do not edit.
|
|
166
158
|
*/
|
|
167
159
|
|
|
168
|
-
export { SpxConfirmComponent, SpxConfirmDisplayerComponent,
|
|
160
|
+
export { SpxConfirmComponent, SpxConfirmDisplayerComponent, spxConfirmActions, spxConfirm_effects as spxConfirmEffects, spxConfirm_reducer as spxConfirmReducer };
|
|
169
161
|
//# sourceMappingURL=softpak-components-spx-confirm.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"softpak-components-spx-confirm.mjs","sources":["../../../../projects/softpak/components/spx-confirm/spx-confirm.component.ts","../../../../projects/softpak/components/spx-confirm/spx-confirm.component.html","../../../../projects/softpak/components/spx-confirm/spx-confirm-displayer/spx-confirm-displayer.component.ts","../../../../projects/softpak/components/spx-confirm/spx-confirm-displayer/spx-confirm-displayer.component.html","../../../../projects/softpak/components/spx-confirm/store/spx-confirm.actions.ts","../../../../projects/softpak/components/spx-confirm/store/spx-confirm.reducer.ts","../../../../projects/softpak/components/spx-confirm/store/spx-confirm.effects.ts","../../../../projects/softpak/components/spx-confirm/softpak-components-spx-confirm.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';\nimport { FaIconComponent } from '@fortawesome/angular-fontawesome';\nimport { faTimes } from '@fortawesome/free-solid-svg-icons';\nimport { SpxButtonComponent } from '@softpak/components/spx-button';\nimport { SpxSeverityEnum } from '@softpak/components/spx-helpers';\n\n@Component({\n selector: 'spx-confirm',\n templateUrl: './spx-confirm.component.html',\n styleUrls: ['./spx-confirm.component.scss'],\n imports: [SpxButtonComponent, FaIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true\n})\nexport class SpxConfirmComponent {\n id = input.required<string>();\n spxCancel = output<string>();\n spxConfirm = output<string>();\n faTimes = faTimes;\n severityError = SpxSeverityEnum.error;\n severityInfo = SpxSeverityEnum.info;\n severitySuccess = SpxSeverityEnum.success;\n\n constructor() { }\n\n onCancel() {\n this.spxCancel.emit(this.id());\n }\n\n onConfirm() {\n if(this.id()) {}\n this.spxConfirm.emit(this.id());\n }\n\n}\n","<div class=\"block spx-confirm h-full mt-12\">\n <div class=\"bg-amber-400 flex gap-3 items-center px-3 py-1 rounded-t text-black\">\n <div class=\"grow font-bold\">\n <ng-content select=\"[confirm__title]\"></ng-content>\n </div>\n <spx-button (spxClick)=\"onCancel()\" [spxType]=\"'button'\" [spxSeverity]=\"severityInfo\"><fa-icon\n [icon]=\"faTimes\"></fa-icon>\n </spx-button>\n </div>\n <div class=\"flex flex-col gap-3 dark:bg-gray-700 bg-white p-3\">\n <ng-content select=\"[confirm__content]\"></ng-content>\n <div class=\"grid grid-cols-1 grid-rows-2 sm:grid-rows-1 sm:grid-cols-2 gap-3 grid-flow-row\">\n <spx-button (spxClick)=\"onCancel()\" [spxFullWidth]=\"true\" [spxType]=\"'button'\"\n [spxSeverity]=\"severityError\">\n <ng-content select=\"[confirm__btn_cancel]\"></ng-content>\n </spx-button>\n <spx-button #confirm (spxClick)=\"onConfirm()\" [spxFullWidth]=\"true\" [spxType]=\"'submit'\"\n [spxSeverity]=\"severitySuccess\">\n <ng-content select=\"[confirm__btn_confirm]\"></ng-content>\n </spx-button>\n </div>\n </div>\n</div>","import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, signal } from '@angular/core';\nimport { Store } from '@ngrx/store';\nimport { Subscription } from 'rxjs';\nimport { SpxConfirmComponent } from '../spx-confirm.component';\nimport { spxConfirmActions, spxConfirmReducer } from '../public-api';\n\n@Component({\n selector: 'spx-confirm-displayer',\n templateUrl: './spx-confirm-displayer.component.html',\n styleUrls: ['./spx-confirm-displayer.component.scss'],\n imports: [SpxConfirmComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true\n})\nexport class SpxConfirmDisplayerComponent implements OnInit, OnDestroy {\n confirms = signal<{\n content: string;\n id: string;\n title: string;\n cancelled?: boolean;\n confirmed?: boolean;\n noYesButton?: boolean;\n }[]>([]);\n\n private subscriptions: {\n confirmState?: Subscription;\n } = {};\n\n constructor(\n private readonly appStore: Store,\n ) { }\n\n ngOnInit() {\n this.subscriptions.confirmState = this.appStore.select(spxConfirmReducer.default.selectConfirms).subscribe(confirms => {\n if (confirms?.length === 0) {\n this.confirms.set([]);\n return;\n }\n\n this.confirms.set(confirms);\n });\n }\n\n ngOnDestroy() {\n this.subscriptions?.confirmState?.unsubscribe();\n }\n\n onCancel(id: string) {\n this.appStore.dispatch(spxConfirmActions.answer({\n cancel: true,\n id\n }));\n }\n\n onConfirm(id: string) {\n this.appStore.dispatch(spxConfirmActions.answer({\n confirm: true,\n id\n }));\n }\n\n}\n","@if (confirms().length > 0) {\n <div class=\"bg-black/75 block relative h-full\" style=\"z-index: 1000\">\n @for (confirm of confirms(); track confirm.id) {\n <spx-confirm [id]=\"confirm.id\" (spxCancel)=\"onCancel($event)\"\n (spxConfirm)=\"onConfirm($event)\">\n <ng-container confirm__title>{{ confirm.title }}</ng-container>\n <ng-container confirm__content>{{ confirm.content }}</ng-container>\n <ng-container confirm__btn_cancel>{{confirm.noYesButton ? 'NO' : 'Cancel'}}</ng-container>\n <ng-container confirm__btn_confirm>{{confirm.noYesButton ? 'YES' : 'OK'}}</ng-container>\n </spx-confirm>\n }\n </div>\n}","import { createAction, props, union } from '@ngrx/store';\nimport { SpxConfirmI } from './spx-confirm.reducer';\n\nexport const answer = createAction('[Confirm] Answer', props<{\n cancel?: boolean;\n confirm?: boolean;\n id: string;\n}>());\nexport const reset = createAction('[Confirm] Reset', props<Record<string, unknown>>());\nexport const show = createAction('[Confirm] Show', props<SpxConfirmI>());\n\nexport const answerConfirm = createAction('[Confirm] Answer Confirm', props<{\n id: string;\n}>());\n\nconst all = union({\n reset,\n show,\n answerConfirm,\n});\nexport type Actions = typeof all;\n","import * as actions from './spx-confirm.actions';\nimport { createFeature, createReducer, on } from '@ngrx/store';\n\nexport interface SpxConfirmI {\n content: string;\n id: string;\n title: string;\n noYesButton?: boolean;\n onOK?: () => void;\n onCancel?: () => void;\n}\n\nexport interface State {\n confirms: SpxConfirmI[];\n}\n\nconst initialState: State = {\n confirms: [],\n};\n\nexport default createFeature({\n name: 'spxConfirm',\n reducer: createReducer(\n initialState,\n on(\n actions.reset,\n (state: State, {}): State => ({\n ...state,\n })\n ),\n on(\n actions.show,\n (state: State, { content, id, title, noYesButton, onCancel, onOK }): State => {\n const confirms =\n state.confirms.filter((c) => c.id).length > 0\n ? state.confirms\n : [\n ...state.confirms,\n {\n content,\n id,\n title,\n noYesButton,\n onCancel,\n onOK,\n },\n ];\n return {\n ...state,\n confirms,\n };\n }\n ),\n on(\n actions.answerConfirm,\n (state: State, { id }): State => ({\n ...state,\n confirms: [\n ...state.confirms.filter((c) => c.id !== id),\n ],\n })\n )\n ),\n});\n","import * as actions from './spx-confirm.actions';\n\nimport { Actions, createEffect, ofType } from '@ngrx/effects';\nimport { mergeMap, withLatestFrom } from 'rxjs/operators';\n\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { Store } from '@ngrx/store';\nimport spxConfirmReducer from './spx-confirm.reducer';\nimport { spxSpinnerActions } from '@softpak/components/spx-spinner';\n\n@Injectable()\nexport class SpxConfirmEffects {\n onAnswer$: Observable<any> = createEffect(() =>\n this.actions$.pipe(\n ofType(actions.answer),\n withLatestFrom(this.appStore.select(spxConfirmReducer.selectConfirms)),\n mergeMap(([action, confirms]) => {\n\n if (action.confirm) {\n confirms.find((c) => c.id === action.id)?.onOK?.();\n }\n if (action.cancel) {\n confirms.find((c) => c.id === action.id)?.onCancel?.();\n }\n return [\n actions.answerConfirm({id: action.id}),\n spxSpinnerActions.hide({\n action: action.id,\n })\n ];\n })\n )\n );\n\n constructor(\n private readonly actions$: Actions,\n private readonly appStore: Store,\n ) {}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["spxConfirmReducer.default","spxConfirmActions.answer","actions.reset","actions.show","actions.answerConfirm","actions.answer","spxConfirmReducer","i1","i2"],"mappings":";;;;;;;;;;;;;MAca,mBAAmB,CAAA;AAS9B,IAAA,WAAA,GAAA;AARA,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAC,QAAQ,6CAAU;QAC7B,IAAA,CAAA,SAAS,GAAG,MAAM,EAAU;QAC5B,IAAA,CAAA,UAAU,GAAG,MAAM,EAAU;QAC7B,IAAA,CAAA,OAAO,GAAG,OAAO;AACjB,QAAA,IAAA,CAAA,aAAa,GAAG,eAAe,CAAC,KAAK;AACrC,QAAA,IAAA,CAAA,YAAY,GAAG,eAAe,CAAC,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AA,EAAA,CAAA;kBAD7B;;;;;;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-confirm.mjs","sources":["../../../../projects/softpak/components/spx-confirm/spx-confirm.component.ts","../../../../projects/softpak/components/spx-confirm/spx-confirm.component.html","../../../../projects/softpak/components/spx-confirm/spx-confirm-displayer/spx-confirm-displayer.component.ts","../../../../projects/softpak/components/spx-confirm/spx-confirm-displayer/spx-confirm-displayer.component.html","../../../../projects/softpak/components/spx-confirm/store/spx-confirm.actions.ts","../../../../projects/softpak/components/spx-confirm/store/spx-confirm.reducer.ts","../../../../projects/softpak/components/spx-confirm/store/spx-confirm.effects.ts","../../../../projects/softpak/components/spx-confirm/softpak-components-spx-confirm.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';\nimport { FaIconComponent } from '@fortawesome/angular-fontawesome';\nimport { faTimes } from '@fortawesome/free-solid-svg-icons';\nimport { SpxButtonComponent } from '@softpak/components/spx-button';\nimport { SpxSeverityEnum } from '@softpak/components/spx-helpers';\n\n@Component({\n selector: 'spx-confirm',\n templateUrl: './spx-confirm.component.html',\n styleUrls: ['./spx-confirm.component.scss'],\n imports: [SpxButtonComponent, FaIconComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true\n})\nexport class SpxConfirmComponent {\n id = input.required<string>();\n spxCancel = output<string>();\n spxConfirm = output<string>();\n faTimes = faTimes;\n severityError = SpxSeverityEnum.error;\n severityInfo = SpxSeverityEnum.info;\n severitySuccess = SpxSeverityEnum.success;\n\n constructor() { }\n\n onCancel() {\n this.spxCancel.emit(this.id());\n }\n\n onConfirm() {\n if(this.id()) {}\n this.spxConfirm.emit(this.id());\n }\n\n}\n","<div class=\"block spx-confirm h-full mt-12\">\n <div class=\"bg-amber-400 flex gap-3 items-center px-3 py-1 rounded-t text-black\">\n <div class=\"grow font-bold\">\n <ng-content select=\"[confirm__title]\"></ng-content>\n </div>\n <spx-button (spxClick)=\"onCancel()\" [spxType]=\"'button'\" [spxSeverity]=\"severityInfo\"><fa-icon\n [icon]=\"faTimes\"></fa-icon>\n </spx-button>\n </div>\n <div class=\"flex flex-col gap-3 dark:bg-gray-700 bg-white p-3\">\n <ng-content select=\"[confirm__content]\"></ng-content>\n <div class=\"grid grid-cols-1 grid-rows-2 sm:grid-rows-1 sm:grid-cols-2 gap-3 grid-flow-row\">\n <spx-button (spxClick)=\"onCancel()\" [spxFullWidth]=\"true\" [spxType]=\"'button'\"\n [spxSeverity]=\"severityError\">\n <ng-content select=\"[confirm__btn_cancel]\"></ng-content>\n </spx-button>\n <spx-button #confirm (spxClick)=\"onConfirm()\" [spxFullWidth]=\"true\" [spxType]=\"'submit'\"\n [spxSeverity]=\"severitySuccess\">\n <ng-content select=\"[confirm__btn_confirm]\"></ng-content>\n </spx-button>\n </div>\n </div>\n</div>","import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, signal } from '@angular/core';\nimport { Store } from '@ngrx/store';\nimport { Subscription } from 'rxjs';\nimport { SpxConfirmComponent } from '../spx-confirm.component';\nimport { spxConfirmActions, spxConfirmReducer } from '../public-api';\n\n@Component({\n selector: 'spx-confirm-displayer',\n templateUrl: './spx-confirm-displayer.component.html',\n styleUrls: ['./spx-confirm-displayer.component.scss'],\n imports: [SpxConfirmComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true\n})\nexport class SpxConfirmDisplayerComponent implements OnInit, OnDestroy {\n confirms = signal<{\n content: string;\n id: string;\n title: string;\n cancelled?: boolean;\n confirmed?: boolean;\n noYesButton?: boolean;\n }[]>([]);\n\n private subscriptions: {\n confirmState?: Subscription;\n } = {};\n\n constructor(\n private readonly appStore: Store,\n ) { }\n\n ngOnInit() {\n this.subscriptions.confirmState = this.appStore.select(spxConfirmReducer.default.selectConfirms).subscribe(confirms => {\n if (confirms?.length === 0) {\n this.confirms.set([]);\n return;\n }\n\n this.confirms.set(confirms);\n });\n }\n\n ngOnDestroy() {\n this.subscriptions?.confirmState?.unsubscribe();\n }\n\n onCancel(id: string) {\n this.appStore.dispatch(spxConfirmActions.answer({\n cancel: true,\n id\n }));\n }\n\n onConfirm(id: string) {\n this.appStore.dispatch(spxConfirmActions.answer({\n confirm: true,\n id\n }));\n }\n\n}\n","@if (confirms().length > 0) {\n <div class=\"bg-black/75 block relative h-full\" style=\"z-index: 1000\">\n @for (confirm of confirms(); track confirm.id) {\n <spx-confirm [id]=\"confirm.id\" (spxCancel)=\"onCancel($event)\"\n (spxConfirm)=\"onConfirm($event)\">\n <ng-container confirm__title>{{ confirm.title }}</ng-container>\n <ng-container confirm__content>{{ confirm.content }}</ng-container>\n <ng-container confirm__btn_cancel>{{confirm.noYesButton ? 'NO' : 'Cancel'}}</ng-container>\n <ng-container confirm__btn_confirm>{{confirm.noYesButton ? 'YES' : 'OK'}}</ng-container>\n </spx-confirm>\n }\n </div>\n}","import { createActionGroup, emptyProps, props } from '@ngrx/store';\n\nimport { SpxConfirmI } from './spx-confirm.reducer';\n\nexport const spxConfirmActions = createActionGroup({\n source: 'SpxConfirm',\n events: {\n Answer: props<{ cancel?: boolean; confirm?: boolean; id: string; }>(),\n AnswerConfirm: props<{ id: string; }>(),\n Reset: emptyProps(),\n Show: props<SpxConfirmI>(),\n },\n});\n","import { createFeature, createReducer, on } from '@ngrx/store';\n\nimport { spxConfirmActions } from './spx-confirm.actions';\n\nexport interface SpxConfirmI {\n content: string;\n id: string;\n title: string;\n noYesButton?: boolean;\n onOK?: () => void;\n onCancel?: () => void;\n}\n\nexport interface State {\n confirms: SpxConfirmI[];\n}\n\nconst initialState: State = {\n confirms: [],\n};\n\nexport default createFeature({\n name: 'spxConfirm',\n reducer: createReducer(\n initialState,\n on(\n spxConfirmActions.reset,\n (state: State, {}): State => ({\n ...state,\n })\n ),\n on(\n spxConfirmActions.show,\n (state: State, { content, id, title, noYesButton, onCancel, onOK }): State => {\n const confirms =\n state.confirms.filter((c) => c.id).length > 0\n ? state.confirms\n : [\n ...state.confirms,\n {\n content,\n id,\n title,\n noYesButton,\n onCancel,\n onOK,\n },\n ];\n return {\n ...state,\n confirms,\n };\n }\n ),\n on(\n spxConfirmActions.answerConfirm,\n (state: State, { id }): State => ({\n ...state,\n confirms: [\n ...state.confirms.filter((c) => c.id !== id),\n ],\n })\n )\n ),\n});\n","import { Actions, createEffect, ofType } from '@ngrx/effects';\nimport { mergeMap, withLatestFrom } from 'rxjs/operators';\n\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { Store } from '@ngrx/store';\nimport { spxConfirmActions } from './spx-confirm.actions';\nimport spxConfirmReducer from './spx-confirm.reducer';\nimport { spxSpinnerActions } from '@softpak/components/spx-spinner';\n\n@Injectable()\nexport class SpxConfirmEffects {\n onAnswer$: Observable<any> = createEffect(() =>\n this.actions$.pipe(\n ofType(spxConfirmActions.answer),\n withLatestFrom(this.appStore.select(spxConfirmReducer.selectConfirms)),\n mergeMap(([action, confirms]) => {\n\n if (action.confirm) {\n confirms.find((c) => c.id === action.id)?.onOK?.();\n }\n if (action.cancel) {\n confirms.find((c) => c.id === action.id)?.onCancel?.();\n }\n return [\n spxConfirmActions.answerConfirm({id: action.id}),\n spxSpinnerActions.hide({\n action: action.id,\n })\n ];\n })\n )\n );\n\n constructor(\n private readonly actions$: Actions,\n private readonly appStore: Store,\n ) {}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["spxConfirmReducer.default","spxConfirmReducer","i1","i2"],"mappings":";;;;;;;;;;;;;MAca,mBAAmB,CAAA;AAS9B,IAAA,WAAA,GAAA;AARA,QAAA,IAAA,CAAA,EAAE,GAAG,KAAK,CAAC,QAAQ,6CAAU;QAC7B,IAAA,CAAA,SAAS,GAAG,MAAM,EAAU;QAC5B,IAAA,CAAA,UAAU,GAAG,MAAM,EAAU;QAC7B,IAAA,CAAA,OAAO,GAAG,OAAO;AACjB,QAAA,IAAA,CAAA,aAAa,GAAG,eAAe,CAAC,KAAK;AACrC,QAAA,IAAA,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AA;kBAD7B;;;;;;;;ACVD;;AAEG;;;;"}
|
|
@@ -19,6 +19,14 @@ const calcCheckDigit = (container) => {
|
|
|
19
19
|
return outcome.toString();
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
function getBinaryVersionGroup(version) {
|
|
23
|
+
const match = /^(\d+)\.(\d+)\.\d+/.exec(version);
|
|
24
|
+
if (!match) {
|
|
25
|
+
throw new Error(`[UPD] Invalid app version format: ${version}`);
|
|
26
|
+
}
|
|
27
|
+
return `${match[1]}.${match[2]}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
var SpxSeverityEnum;
|
|
23
31
|
(function (SpxSeverityEnum) {
|
|
24
32
|
SpxSeverityEnum["error"] = "error";
|
|
@@ -48,5 +56,5 @@ const valuePairToValue = (pair) => {
|
|
|
48
56
|
* Generated bundle index. Do not edit.
|
|
49
57
|
*/
|
|
50
58
|
|
|
51
|
-
export { SpxSeverityEnum, calcCheckDigit, unsubscribeSubscriptions, valuePairToValue };
|
|
59
|
+
export { SpxSeverityEnum, calcCheckDigit, getBinaryVersionGroup, unsubscribeSubscriptions, valuePairToValue };
|
|
52
60
|
//# sourceMappingURL=softpak-components-spx-helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"softpak-components-spx-helpers.mjs","sources":["../../../../projects/softpak/components/spx-helpers/calc-check-digit.function.ts","../../../../projects/softpak/components/spx-helpers/spx-severity.enum.ts","../../../../projects/softpak/components/spx-helpers/unsubscribe-subscriptions.function.ts","../../../../projects/softpak/components/spx-helpers/value-pair-to-value.function.ts","../../../../projects/softpak/components/spx-helpers/softpak-components-spx-helpers.ts"],"sourcesContent":["export const calcCheckDigit = (container: string): string => {\n container = container.toUpperCase();\n\n const mapping = {\n 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,\n A: 10, B: 12, C: 13, D: 14, E: 15, F: 16, G: 17, H: 18, I: 19, J: 20, K: 21, L: 23, M: 24,\n N: 25, O: 26, P: 27, Q: 28, R: 29, S: 30, T: 31, U: 32, V: 34, W: 35, X: 36, Y: 37, Z: 38\n };\n\n let total = 0;\n\n for (let i = 0; i < container.length; i++) {\n const cChar = container.substr(i, 1);\n const value = (mapping as any)[cChar];\n const multiplier = Math.pow(2, i);\n total = total + (value * multiplier);\n }\n\n let outcome = total % 11;\n if (outcome === 10) {\n outcome = 0;\n }\n\n return outcome.toString();\n}\n","export enum SpxSeverityEnum {\n error = 'error',\n info = 'info',\n success = 'success',\n unknown = 'unknown',\n warning = 'warning',\n primary = 'primary',\n}\n","import { Subscription } from \"rxjs\";\n\nexport function unsubscribeSubscriptions(subscriptionObject: object): void {\n for (const key in subscriptionObject) {\n if ((subscriptionObject as any)[key]) {\n ((subscriptionObject as any)[key] as Subscription).unsubscribe();\n }\n }\n}","export const valuePairToValue = (pair: any) => {\n if (pair === null || (typeof pair === 'object' && pair.value === undefined)) {\n return null;\n }\n return pair?.value || pair?.value === false || pair?.value === null || pair?.value === '' || pair?.value === 0 ? pair?.value : pair;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,GAAG,CAAC,SAAiB,KAAY;AAC1D,IAAA,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE;AAEnC,IAAA,MAAM,OAAO,GAAG;AACd,QAAA,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC1D,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QACzF,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE;KACxF;IAED,IAAI,KAAK,GAAG,CAAC;AAEb,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACzC,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;AACpC,QAAA,MAAM,KAAK,GAAI,OAAe,CAAC,KAAK,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;QACjC,KAAK,GAAG,KAAK,IAAI,KAAK,GAAG,UAAU,CAAC;IACtC;AAEA,IAAA,IAAI,OAAO,GAAG,KAAK,GAAG,EAAE;AACxB,IAAA,IAAI,OAAO,KAAK,EAAE,EAAE;QAClB,OAAO,GAAG,CAAC;IACb;AAEA,IAAA,OAAO,OAAO,CAAC,QAAQ,EAAE;AAC3B;;
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-helpers.mjs","sources":["../../../../projects/softpak/components/spx-helpers/calc-check-digit.function.ts","../../../../projects/softpak/components/spx-helpers/get-binary-version-group.function.ts","../../../../projects/softpak/components/spx-helpers/spx-severity.enum.ts","../../../../projects/softpak/components/spx-helpers/unsubscribe-subscriptions.function.ts","../../../../projects/softpak/components/spx-helpers/value-pair-to-value.function.ts","../../../../projects/softpak/components/spx-helpers/softpak-components-spx-helpers.ts"],"sourcesContent":["export const calcCheckDigit = (container: string): string => {\n container = container.toUpperCase();\n\n const mapping = {\n 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9,\n A: 10, B: 12, C: 13, D: 14, E: 15, F: 16, G: 17, H: 18, I: 19, J: 20, K: 21, L: 23, M: 24,\n N: 25, O: 26, P: 27, Q: 28, R: 29, S: 30, T: 31, U: 32, V: 34, W: 35, X: 36, Y: 37, Z: 38\n };\n\n let total = 0;\n\n for (let i = 0; i < container.length; i++) {\n const cChar = container.substr(i, 1);\n const value = (mapping as any)[cChar];\n const multiplier = Math.pow(2, i);\n total = total + (value * multiplier);\n }\n\n let outcome = total % 11;\n if (outcome === 10) {\n outcome = 0;\n }\n\n return outcome.toString();\n}\n","export function getBinaryVersionGroup(version: string): string {\n const match = /^(\\d+)\\.(\\d+)\\.\\d+/.exec(version);\n if (!match) {\n throw new Error(`[UPD] Invalid app version format: ${version}`);\n }\n return `${match[1]}.${match[2]}`;\n}\n","export enum SpxSeverityEnum {\n error = 'error',\n info = 'info',\n success = 'success',\n unknown = 'unknown',\n warning = 'warning',\n primary = 'primary',\n}\n","import { Subscription } from \"rxjs\";\n\nexport function unsubscribeSubscriptions(subscriptionObject: object): void {\n for (const key in subscriptionObject) {\n if ((subscriptionObject as any)[key]) {\n ((subscriptionObject as any)[key] as Subscription).unsubscribe();\n }\n }\n}","export const valuePairToValue = (pair: any) => {\n if (pair === null || (typeof pair === 'object' && pair.value === undefined)) {\n return null;\n }\n return pair?.value || pair?.value === false || pair?.value === null || pair?.value === '' || pair?.value === 0 ? pair?.value : pair;\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAO,MAAM,cAAc,GAAG,CAAC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gBAAgB,GAAG,CAAC,IAAS,KAAI;AAC1C,IAAA,IAAI,IAAI,KAAK,IAAI,KAAK,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;AACzE,QAAA,OAAO,IAAI;IACf;AACA,IAAA,OAAO,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,KAAK,KAAK,IAAI,IAAI,EAAE,KAAK,KAAK,IAAI,IAAI,IAAI,EAAE,KAAK,KAAK,EAAE,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,IAAI,EAAE,KAAK,GAAG,IAAI;AACvI;;ACLA;;AAEG;;;;"}
|
|
@@ -7,7 +7,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
|
7
7
|
import { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';
|
|
8
8
|
import { NgClass } from '@angular/common';
|
|
9
9
|
import * as i1 from '@ngrx/store';
|
|
10
|
-
import {
|
|
10
|
+
import { createActionGroup, props, createFeature, createReducer, on } from '@ngrx/store';
|
|
11
11
|
|
|
12
12
|
class SpxHomeTilesComponent {
|
|
13
13
|
constructor() {
|
|
@@ -42,22 +42,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
42
42
|
], standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button #button\n class=\"border border-transparent flex flex-col w-full px-4 py-2 relative rounded text-center focus:outline-none focus:ring-2 focus:ring-offset-2\"\n type=\"button\"\n part=\"button\"\n [attr.autofocus]=\"this.spxAutofocus() ? this.spxAutofocus() : undefined\"\n [class.bg-blue-600]=\"!this.spxClass()\"\n [class.focus:ring-blue-500]=\"!this.spxClass()\"\n [class.hover:bg-blue-800]=\"!this.spxClass()\"\n [class.text-white]=\"!this.spxClass()\"\n [ngClass]=\"this.spxClass() ? this.spxClass() : undefined\">\n <div class=\"flex gap-5 items-center\">\n <div class=\"fal my-2 self-center text-xl w-5\"><ng-content></ng-content></div>\n <div class=\"grow flex flex-col text-left\">\n <div class=\"text-lg font-bold text-ellipsis overflow-hidden\">{{ this.spxTitle() }}</div>\n @if (this.spxSubtitle()) {\n <div class=\"text-sm opacity-70 text-ellipsis overflow-hidden\">{{ this.spxSubtitle() }}</div>\n }\n </div>\n </div>\n </button>" }]
|
|
43
43
|
}], propDecorators: { spxAutofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "spxAutofocus", required: false }] }], spxClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "spxClass", required: false }] }], spxSubtitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "spxSubtitle", required: false }] }], spxTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "spxTitle", required: false }] }], buttonRef: [{ type: i0.ViewChild, args: ['button', { isSignal: true }] }] } });
|
|
44
44
|
|
|
45
|
-
const addPages = createAction('[SPX / Navigation] Add items', props());
|
|
46
|
-
const initialize = createAction('[SPX / Navigation] Initialize', props());
|
|
47
|
-
const update = createAction('[SPX / Navigation] Update', props());
|
|
48
|
-
const all = union({
|
|
49
|
-
addPages,
|
|
50
|
-
initialize,
|
|
51
|
-
update
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
var spxNavigation_actions = /*#__PURE__*/Object.freeze({
|
|
55
|
-
__proto__: null,
|
|
56
|
-
addPages: addPages,
|
|
57
|
-
initialize: initialize,
|
|
58
|
-
update: update
|
|
59
|
-
});
|
|
60
|
-
|
|
61
45
|
const initialState = {
|
|
62
46
|
accessList: [],
|
|
63
47
|
navigationItems: [],
|
|
@@ -71,20 +55,29 @@ var spxNavigation_initial = /*#__PURE__*/Object.freeze({
|
|
|
71
55
|
initialState: initialState
|
|
72
56
|
});
|
|
73
57
|
|
|
58
|
+
const spxNavigationActions = createActionGroup({
|
|
59
|
+
source: 'SpxNavigation',
|
|
60
|
+
events: {
|
|
61
|
+
AddPages: props(),
|
|
62
|
+
Initialize: props(),
|
|
63
|
+
Update: props(),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
74
67
|
var spxNavigationReducer$1 = createFeature({
|
|
75
68
|
name: 'spxNavigation',
|
|
76
|
-
reducer: createReducer(initialState, on(initialize, (state, { navigationItems }) => ({
|
|
69
|
+
reducer: createReducer(initialState, on(spxNavigationActions.initialize, (state, { navigationItems }) => ({
|
|
77
70
|
...state,
|
|
78
71
|
navigationItems: navigationItems,
|
|
79
72
|
menuItems: navigationItems.slice().filter(navigationItem => !navigationItem.signInRequired && (navigationItem.hasTile === undefined || navigationItem.hasTile)),
|
|
80
73
|
tabs: navigationItems.slice().filter(navigationItem => !navigationItem.signInRequired && navigationItem.hasTab),
|
|
81
|
-
})), on(update, (state, { accessList, signedIn }) => ({
|
|
74
|
+
})), on(spxNavigationActions.update, (state, { accessList, signedIn }) => ({
|
|
82
75
|
...state,
|
|
83
76
|
accessList,
|
|
84
77
|
menuItems: state.navigationItems.slice().filter(navigationItem => (!navigationItem.signInRequired || signedIn) && navigationItem?.hasTile !== false).filter(item => item.accessKey === undefined || accessList.includes(item.accessKey)),
|
|
85
78
|
signedIn,
|
|
86
79
|
tabs: state.navigationItems.slice().filter(navigationItem => (!navigationItem.signInRequired || signedIn) && navigationItem.hasTab).filter(item => item.accessKey === undefined || accessList.includes(item.accessKey)),
|
|
87
|
-
})), on(addPages, (state, { navigationItems }) => ({
|
|
80
|
+
})), on(spxNavigationActions.addPages, (state, { navigationItems }) => ({
|
|
88
81
|
...state,
|
|
89
82
|
navigationItems: [...state.navigationItems.slice(), ...navigationItems],
|
|
90
83
|
menuItems: [...state.menuItems.slice(), ...navigationItems.slice().filter(navigationItem => (!navigationItem.signInRequired || state.signedIn) && navigationItem?.hasTile !== false).filter(item => item.accessKey === undefined || state.accessList.includes(item.accessKey))],
|
|
@@ -142,5 +135,5 @@ var spxNavigation_state = /*#__PURE__*/Object.freeze({
|
|
|
142
135
|
* Generated bundle index. Do not edit.
|
|
143
136
|
*/
|
|
144
137
|
|
|
145
|
-
export { SpxHomeTileComponent, SpxHomeTilesComponent, SpxNavigationComponent,
|
|
138
|
+
export { SpxHomeTileComponent, SpxHomeTilesComponent, SpxNavigationComponent, spxNavigationActions, spxNavigation_initial as spxNavigationInitial, spxNavigation_reducer as spxNavigationReducer, spxNavigation_state as spxNavigationState };
|
|
146
139
|
//# sourceMappingURL=softpak-components-spx-navigation.mjs.map
|