@softpak/components 20.1.0 → 20.2.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/README.md +24 -24
- package/fesm2022/softpak-components-spx-404-page.mjs +4 -4
- package/fesm2022/softpak-components-spx-404-page.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-alert.mjs +4 -4
- package/fesm2022/softpak-components-spx-alert.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-app-configuration.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-app-expiry.mjs +4 -4
- package/fesm2022/softpak-components-spx-app-expiry.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-button.mjs +4 -4
- package/fesm2022/softpak-components-spx-button.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-capitalize.mjs +3 -3
- package/fesm2022/softpak-components-spx-capitalize.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-card.mjs +16 -16
- package/fesm2022/softpak-components-spx-card.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-change-details.mjs +4 -4
- package/fesm2022/softpak-components-spx-change-details.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-channel-selection.mjs +64 -238
- package/fesm2022/softpak-components-spx-channel-selection.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-check-digit.mjs +4 -4
- package/fesm2022/softpak-components-spx-check-digit.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-confirm.mjs +11 -11
- package/fesm2022/softpak-components-spx-confirm.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-form-section.mjs +4 -4
- package/fesm2022/softpak-components-spx-form-section.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-form-view.mjs +8 -8
- package/fesm2022/softpak-components-spx-form-view.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-helpers.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-inputs.mjs +44 -44
- package/fesm2022/softpak-components-spx-inputs.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-navigation.mjs +12 -12
- package/fesm2022/softpak-components-spx-navigation.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-number-check.mjs +4 -4
- package/fesm2022/softpak-components-spx-number-check.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-pagination.mjs +4 -4
- package/fesm2022/softpak-components-spx-pagination.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-patch.mjs +4 -4
- package/fesm2022/softpak-components-spx-patch.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-pipes.mjs +3 -3
- package/fesm2022/softpak-components-spx-pipes.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-progress-bar.mjs +4 -4
- package/fesm2022/softpak-components-spx-progress-bar.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-spinner.mjs +4 -4
- package/fesm2022/softpak-components-spx-spinner.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-stock-info.mjs +4 -4
- package/fesm2022/softpak-components-spx-stock-info.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-storage.mjs +1 -0
- package/fesm2022/softpak-components-spx-storage.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-suggestion.mjs +4 -4
- package/fesm2022/softpak-components-spx-suggestion.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-tabs.mjs +4 -4
- package/fesm2022/softpak-components-spx-tabs.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-toaster.mjs +4 -4
- package/fesm2022/softpak-components-spx-toaster.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-toggle.mjs +4 -4
- package/fesm2022/softpak-components-spx-toggle.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-translate.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-update.mjs +14 -14
- package/fesm2022/softpak-components-spx-update.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-validation-messages.mjs +4 -4
- package/fesm2022/softpak-components-spx-validation-messages.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-validation.mjs +4 -4
- package/fesm2022/softpak-components-spx-validation.mjs.map +1 -1
- package/fesm2022/softpak-components-spx-welcome.mjs +135 -0
- package/fesm2022/softpak-components-spx-welcome.mjs.map +1 -0
- package/package.json +39 -35
- package/spx-app-configuration/index.d.ts +7 -2
- package/spx-channel-selection/index.d.ts +22 -81
- package/spx-storage/index.d.ts +1 -0
- package/spx-welcome/index.d.ts +37 -0
|
@@ -1,56 +1,49 @@
|
|
|
1
|
+
import * as i2 from '@angular/router';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
1
3
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
4
|
+
import { inject, Injectable, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
5
|
import { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';
|
|
4
|
-
import
|
|
6
|
+
import { createAction, props, union, createFeature, createReducer, on, Store } from '@ngrx/store';
|
|
5
7
|
import { SpxButtonComponent } from '@softpak/components/spx-button';
|
|
6
|
-
import * as i2 from '@ngrx/store';
|
|
7
|
-
import { createAction, props, union, createFeature, createReducer, on } from '@ngrx/store';
|
|
8
8
|
import { SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';
|
|
9
|
-
import { AsyncPipe } from '@angular/common';
|
|
10
9
|
import { TranslatePipe } from '@ngx-translate/core';
|
|
11
10
|
import { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';
|
|
12
|
-
import { spxTextChange
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import { valuePairToValue, SpxSeverityEnum, unsubscribeSubscriptions } from '@softpak/components/spx-helpers';
|
|
18
|
-
import { SpxInputTypeEnum } from '@softpak/components/spx-inputs';
|
|
19
|
-
import { spxValidatorRequired } from '@softpak/components/spx-validation';
|
|
20
|
-
import { IonHeader, IonToolbar, IonTitle, IonButtons, IonContent } from '@ionic/angular/standalone';
|
|
21
|
-
import { spxToasterActions, SpxToasterAutoCloseSpeedEnum } from '@softpak/components/spx-toaster';
|
|
22
|
-
import * as i1$2 from '@ngrx/effects';
|
|
11
|
+
import { spxTextChange } from '@softpak/components/spx-translate';
|
|
12
|
+
import { NavController } from '@ionic/angular';
|
|
13
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
14
|
+
import { map } from 'rxjs';
|
|
15
|
+
import * as i1 from '@ngrx/effects';
|
|
23
16
|
import { createEffect, ofType } from '@ngrx/effects';
|
|
24
17
|
import { switchMap } from 'rxjs/operators';
|
|
25
18
|
import { setConfig } from '@capacitor/live-updates';
|
|
26
19
|
import { Capacitor } from '@capacitor/core';
|
|
27
20
|
import { spxUpdateUrl } from '@softpak/components/spx-update';
|
|
21
|
+
import { spxToasterActions, SpxToasterAutoCloseSpeedEnum } from '@softpak/components/spx-toaster';
|
|
28
22
|
import { captureMessage } from '@sentry/angular';
|
|
29
23
|
import { App } from '@capacitor/app';
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
// import { spxChannelSelectionUrl } from '../../src/app.const';
|
|
33
26
|
class SpxChannelGuard {
|
|
34
|
-
constructor(
|
|
35
|
-
this.router =
|
|
27
|
+
constructor() {
|
|
28
|
+
this.router = inject(Router);
|
|
36
29
|
}
|
|
37
30
|
canActivate() {
|
|
38
31
|
if (!SpxStorage.getSetting(SpxStorageKeyEnum.brand) ||
|
|
39
32
|
!SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {
|
|
40
|
-
this.router.navigate([
|
|
33
|
+
this.router.navigate(['wlc']);
|
|
41
34
|
return false;
|
|
42
35
|
}
|
|
43
36
|
return true;
|
|
44
37
|
}
|
|
45
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.
|
|
46
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SpxChannelGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
39
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SpxChannelGuard, providedIn: 'root' }); }
|
|
47
40
|
}
|
|
48
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SpxChannelGuard, decorators: [{
|
|
49
42
|
type: Injectable,
|
|
50
43
|
args: [{
|
|
51
44
|
providedIn: 'root'
|
|
52
45
|
}]
|
|
53
|
-
}]
|
|
46
|
+
}] });
|
|
54
47
|
|
|
55
48
|
const choose = createAction('[SPX / Channel] Select', props());
|
|
56
49
|
const initialize = createAction('[SPX / Channel] Initialize', props());
|
|
@@ -71,15 +64,9 @@ const initialState = {
|
|
|
71
64
|
channelType: null,
|
|
72
65
|
channels: [],
|
|
73
66
|
};
|
|
74
|
-
|
|
75
|
-
var spxChannel_initial = /*#__PURE__*/Object.freeze({
|
|
76
|
-
__proto__: null,
|
|
77
|
-
initialState: initialState
|
|
78
|
-
});
|
|
79
|
-
|
|
80
67
|
const determineActiveChannel = (channels) => {
|
|
81
68
|
if (SpxStorage.getSetting(SpxStorageKeyEnum.brand) && SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {
|
|
82
|
-
const channelResult = channels.find(channel => channel.brand === SpxStorage.getSetting(SpxStorageKeyEnum.brand) && channel.channelTypes.
|
|
69
|
+
const channelResult = channels.find(channel => channel.brand === SpxStorage.getSetting(SpxStorageKeyEnum.brand) && channel.channelTypes.some((e) => e.name === SpxStorage.getSetting(SpxStorageKeyEnum.channelType)));
|
|
83
70
|
if (channelResult) {
|
|
84
71
|
return channelResult;
|
|
85
72
|
}
|
|
@@ -106,225 +93,63 @@ var spxChannelReducer$1 = createFeature({
|
|
|
106
93
|
name: 'spxChannel',
|
|
107
94
|
reducer: createReducer(initialState, on(choose, (state, { channel, channelType }) => {
|
|
108
95
|
SpxStorage.setSetting(SpxStorageKeyEnum.brand, channel?.brand);
|
|
109
|
-
SpxStorage.setSetting(SpxStorageKeyEnum.channelType, channelType);
|
|
96
|
+
SpxStorage.setSetting(SpxStorageKeyEnum.channelType, channelType.name);
|
|
97
|
+
SpxStorage.setSetting(SpxStorageKeyEnum.channelTypeWithWebUrl, JSON.stringify(channelType));
|
|
110
98
|
return {
|
|
111
99
|
...state,
|
|
112
100
|
previousChannel: state.channel,
|
|
113
101
|
channel,
|
|
114
102
|
channelType,
|
|
115
103
|
};
|
|
116
|
-
}), on(initialize, (state, { channels }) =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
104
|
+
}), on(initialize, (state, { channels }) => {
|
|
105
|
+
let channelType = null;
|
|
106
|
+
if (SpxStorage.getSetting(SpxStorageKeyEnum.channelTypeWithWebUrl)) {
|
|
107
|
+
channelType = JSON.parse(SpxStorage.getSetting(SpxStorageKeyEnum.channelTypeWithWebUrl));
|
|
108
|
+
}
|
|
109
|
+
else if (SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {
|
|
110
|
+
channelType = { name: SpxStorage.getSetting(SpxStorageKeyEnum.channelType) };
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
channelType = { name: SpxAppChannelTypeEnum.production }; // Default to production if no type is set
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
...state,
|
|
117
|
+
channel: determineActiveChannel(channels),
|
|
118
|
+
channels: channels.slice().sort((a, b) => a.brand.localeCompare(b.brand)),
|
|
119
|
+
channelType: channelType,
|
|
120
|
+
};
|
|
121
|
+
})),
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
var spxChannel_reducer = /*#__PURE__*/Object.freeze({
|
|
125
125
|
__proto__: null,
|
|
126
|
-
default: spxChannelReducer$1
|
|
126
|
+
default: spxChannelReducer$1,
|
|
127
|
+
initialState: initialState
|
|
127
128
|
});
|
|
128
129
|
|
|
130
|
+
const spxChannelSelectionUrl = 'wlc';
|
|
129
131
|
class SpxChannelIndicatorComponent {
|
|
130
|
-
constructor(
|
|
131
|
-
this.navController =
|
|
132
|
-
this.store =
|
|
133
|
-
this.channel = this.store.select(spxChannelReducer$1.selectChannel);
|
|
134
|
-
this.channelType = this.store.select(spxChannelReducer$1.selectChannelType);
|
|
132
|
+
constructor() {
|
|
133
|
+
this.navController = inject(NavController);
|
|
134
|
+
this.store = inject(Store);
|
|
135
|
+
this.channel = toSignal(this.store.select(spxChannelReducer$1.selectChannel));
|
|
136
|
+
this.channelType = toSignal(this.store.select(spxChannelReducer$1.selectChannelType).pipe(map(channelType => channelType?.name)));
|
|
135
137
|
this.spxTextChange = spxTextChange;
|
|
136
138
|
}
|
|
137
139
|
onChange() {
|
|
138
140
|
this.navController.navigateRoot([spxChannelSelectionUrl]);
|
|
139
141
|
}
|
|
140
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.
|
|
141
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.
|
|
142
|
-
<div class="grow">
|
|
143
|
-
<div class="text-lg font-bold">{{ (channel | async)?.brand }}</div>
|
|
144
|
-
@if ((channelType | async) !== 'Production') {
|
|
145
|
-
<div class="text-base text-gray-600">{{ channelType | async }}</div>
|
|
146
|
-
}
|
|
147
|
-
</div>
|
|
148
|
-
<spx-button (click)="onChange()" [spxType]="'button'">{{ spxTextChange | translate | capitalize }}</spx-button>
|
|
149
|
-
</div>`, isInline: true, dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }, { kind: "pipe", type: SpxCapitalizePipe, name: "capitalize" }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
142
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SpxChannelIndicatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
143
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: SpxChannelIndicatorComponent, isStandalone: true, selector: "spx-channel-indicator", ngImport: i0, template: "<div class=\"bg-white p-3 rounded flex gap-3 items-center text-black\">\r\n <div class=\"grow\">\r\n <div class=\"text-lg font-bold\">{{ channel()?.brand }}</div>\r\n @if (channelType() !== 'Production') {\r\n <div class=\"text-base text-gray-600\">{{ channelType() }}</div>\r\n }\r\n </div>\r\n <spx-button (click)=\"onChange()\" [spxType]=\"'button'\">{{ spxTextChange | translate | capitalize }}</spx-button>\r\n</div>", dependencies: [{ kind: "component", type: SpxButtonComponent, selector: "spx-button", inputs: ["spxDisabled", "spxClass", "spxClassObject", "spxForm", "spxFullHeight", "spxFullWidth", "spxSeverity", "spxSize", "spxTabIndex", "spxType"], outputs: ["spxClick"] }, { kind: "pipe", type: SpxCapitalizePipe, name: "capitalize" }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
150
144
|
}
|
|
151
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.
|
|
145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SpxChannelIndicatorComponent, decorators: [{
|
|
152
146
|
type: Component,
|
|
153
|
-
args: [{
|
|
154
|
-
selector: 'spx-channel-indicator',
|
|
155
|
-
template: `<div class="bg-white p-3 rounded flex gap-3 items-center text-black">
|
|
156
|
-
<div class="grow">
|
|
157
|
-
<div class="text-lg font-bold">{{ (channel | async)?.brand }}</div>
|
|
158
|
-
@if ((channelType | async) !== 'Production') {
|
|
159
|
-
<div class="text-base text-gray-600">{{ channelType | async }}</div>
|
|
160
|
-
}
|
|
161
|
-
</div>
|
|
162
|
-
<spx-button (click)="onChange()" [spxType]="'button'">{{ spxTextChange | translate | capitalize }}</spx-button>
|
|
163
|
-
</div>`,
|
|
164
|
-
imports: [
|
|
165
|
-
AsyncPipe,
|
|
147
|
+
args: [{ selector: 'spx-channel-indicator', imports: [
|
|
166
148
|
SpxButtonComponent,
|
|
167
149
|
SpxCapitalizePipe,
|
|
168
150
|
TranslatePipe,
|
|
169
|
-
]
|
|
170
|
-
|
|
171
|
-
}], ctorParameters: () => [{ type: i1$1.NavController }, { type: i2.Store }] });
|
|
172
|
-
|
|
173
|
-
const spxCectionWelcome = 'welcome';
|
|
174
|
-
const spxCtrlChannel = 'channel';
|
|
175
|
-
const spxCtrlChannelType = 'channelType';
|
|
176
|
-
class SpxWelcomeComponent {
|
|
177
|
-
get formSection() { return this.formGroup.get(spxCectionWelcome); }
|
|
178
|
-
get ctrlChannel() { return this.formSection.get(spxCtrlChannel); }
|
|
179
|
-
get ctrlChannelType() { return this.formSection.get(spxCtrlChannelType); }
|
|
180
|
-
constructor(appStore, formBuilder) {
|
|
181
|
-
this.appStore = appStore;
|
|
182
|
-
this.formBuilder = formBuilder;
|
|
183
|
-
this.channels = signal([]);
|
|
184
|
-
this.filteredCompanies = computed(() => this.channels().filter(channel => channel.channelTypes.includes(SpxAppChannelTypeEnum.production)).map(c => ({ description: c.brand, value: c.brand })));
|
|
185
|
-
this.channelTypes = [
|
|
186
|
-
SpxAppChannelTypeEnum.production,
|
|
187
|
-
SpxAppChannelTypeEnum.beta,
|
|
188
|
-
SpxAppChannelTypeEnum.alpha,
|
|
189
|
-
SpxAppChannelTypeEnum.development,
|
|
190
|
-
];
|
|
191
|
-
this.textChannel = spxTextChannel;
|
|
192
|
-
this.textCompany = spxTextCompany;
|
|
193
|
-
this.textSelect = spxTextSelect;
|
|
194
|
-
this.textSelectYourCompany = spxTextSelectYourCompany;
|
|
195
|
-
this.suggestions = {
|
|
196
|
-
[spxCtrlChannelType]: [],
|
|
197
|
-
[spxCtrlChannel]: [],
|
|
198
|
-
};
|
|
199
|
-
this.subscriptions = {};
|
|
200
|
-
this.form = {
|
|
201
|
-
buttons: [
|
|
202
|
-
{
|
|
203
|
-
severity: SpxSeverityEnum.success,
|
|
204
|
-
type: SpxFormButtonTypeEnum.submit,
|
|
205
|
-
label: () => this.textSelect,
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
sections: [
|
|
209
|
-
{
|
|
210
|
-
key: spxCectionWelcome,
|
|
211
|
-
showTitle: () => false,
|
|
212
|
-
fields: [
|
|
213
|
-
{
|
|
214
|
-
key: spxCtrlChannel,
|
|
215
|
-
type: () => SpxInputTypeEnum.radio,
|
|
216
|
-
label: () => this.textCompany,
|
|
217
|
-
validators: () => [spxValidatorRequired()],
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
key: spxCtrlChannelType,
|
|
221
|
-
type: () => SpxInputTypeEnum.radio,
|
|
222
|
-
label: () => this.textChannel,
|
|
223
|
-
capitalize: () => true,
|
|
224
|
-
show: () => valuePairToValue(this.ctrlChannel.value),
|
|
225
|
-
validators: () => [spxValidatorRequired()],
|
|
226
|
-
},
|
|
227
|
-
]
|
|
228
|
-
}
|
|
229
|
-
]
|
|
230
|
-
};
|
|
231
|
-
this.formGroup = this.formBuilder.group({
|
|
232
|
-
[spxCectionWelcome]: SpxFormViewComponent.createForm(this.formBuilder, this.form.sections)
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
ngOnDestroy() {
|
|
236
|
-
unsubscribeSubscriptions(this.subscriptions);
|
|
237
|
-
}
|
|
238
|
-
ngOnInit() {
|
|
239
|
-
this.subscriptions.channels = this.appStore.select(spxChannelReducer$1.selectChannels).subscribe(channels => {
|
|
240
|
-
this.channels.set(channels);
|
|
241
|
-
this.suggestions[spxCtrlChannel] = this.channels().filter(channel => channel.channelTypes.includes(SpxAppChannelTypeEnum.production)).map(c => ({ description: c.brand, value: c.brand }));
|
|
242
|
-
});
|
|
243
|
-
this.subscriptions.channel = this.ctrlChannel.valueChanges.subscribe(valuePair => {
|
|
244
|
-
const brandFound = this.channels().find(c => c.brand === valuePairToValue(valuePair));
|
|
245
|
-
this.suggestions[spxCtrlChannelType] = !brandFound ? [] : brandFound?.channelTypes?.map(channelType => ({
|
|
246
|
-
description: channelType,
|
|
247
|
-
value: channelType
|
|
248
|
-
}));
|
|
249
|
-
this.ctrlChannelType.setValue({
|
|
250
|
-
value: SpxAppChannelTypeEnum.production,
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
onSubmit() {
|
|
255
|
-
const channel = this.channels().find(c => c.brand === valuePairToValue(this.ctrlChannel.value));
|
|
256
|
-
const channelType = valuePairToValue(this.ctrlChannelType.value);
|
|
257
|
-
if (!channel) {
|
|
258
|
-
this.appStore.dispatch(spxToasterActions.createWarning({
|
|
259
|
-
autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,
|
|
260
|
-
messageText: 'Please select a company',
|
|
261
|
-
}));
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
this.appStore.dispatch(choose({
|
|
265
|
-
channel,
|
|
266
|
-
channelType,
|
|
267
|
-
}));
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SpxWelcomeComponent, deps: [{ token: i2.Store }, { token: i2$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
271
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.1", type: SpxWelcomeComponent, isStandalone: true, selector: "spx-welcome", ngImport: i0, template: `
|
|
272
|
-
<ion-header>
|
|
273
|
-
<ion-toolbar>
|
|
274
|
-
<ion-title>
|
|
275
|
-
{{ textSelectYourCompany | translate | capitalize }}
|
|
276
|
-
</ion-title>
|
|
277
|
-
<ion-buttons slot="end">
|
|
278
|
-
</ion-buttons>
|
|
279
|
-
</ion-toolbar>
|
|
280
|
-
</ion-header>
|
|
281
|
-
<ion-content class="ion-padding">
|
|
282
|
-
<form [formGroup]="formGroup" class="max-w-lg mx-auto flex flex-col gap-3" (ngSubmit)="onSubmit()">
|
|
283
|
-
<spx-form-view
|
|
284
|
-
[spxForm]="form"
|
|
285
|
-
[spxFormGroup]="formSection"
|
|
286
|
-
[spxSuggestions]="suggestions">
|
|
287
|
-
</spx-form-view>
|
|
288
|
-
</form>
|
|
289
|
-
</ion-content>`, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "pipe", type: SpxCapitalizePipe, name: "capitalize" }, { kind: "component", type: SpxFormViewComponent, selector: "spx-form-view", inputs: ["spxFormGroup", "spxForm", "spxSuggestions"], outputs: ["spxBlur", "spxClick", "spxSearch"] }, { kind: "component", type: IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
290
|
-
}
|
|
291
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.1", ngImport: i0, type: SpxWelcomeComponent, decorators: [{
|
|
292
|
-
type: Component,
|
|
293
|
-
args: [{
|
|
294
|
-
selector: 'spx-welcome',
|
|
295
|
-
template: `
|
|
296
|
-
<ion-header>
|
|
297
|
-
<ion-toolbar>
|
|
298
|
-
<ion-title>
|
|
299
|
-
{{ textSelectYourCompany | translate | capitalize }}
|
|
300
|
-
</ion-title>
|
|
301
|
-
<ion-buttons slot="end">
|
|
302
|
-
</ion-buttons>
|
|
303
|
-
</ion-toolbar>
|
|
304
|
-
</ion-header>
|
|
305
|
-
<ion-content class="ion-padding">
|
|
306
|
-
<form [formGroup]="formGroup" class="max-w-lg mx-auto flex flex-col gap-3" (ngSubmit)="onSubmit()">
|
|
307
|
-
<spx-form-view
|
|
308
|
-
[spxForm]="form"
|
|
309
|
-
[spxFormGroup]="formSection"
|
|
310
|
-
[spxSuggestions]="suggestions">
|
|
311
|
-
</spx-form-view>
|
|
312
|
-
</form>
|
|
313
|
-
</ion-content>`,
|
|
314
|
-
imports: [
|
|
315
|
-
FormsModule,
|
|
316
|
-
ReactiveFormsModule,
|
|
317
|
-
SpxCapitalizePipe,
|
|
318
|
-
SpxFormViewComponent,
|
|
319
|
-
IonHeader,
|
|
320
|
-
IonToolbar,
|
|
321
|
-
IonTitle,
|
|
322
|
-
IonButtons,
|
|
323
|
-
IonContent,
|
|
324
|
-
TranslatePipe,
|
|
325
|
-
]
|
|
326
|
-
}]
|
|
327
|
-
}], ctorParameters: () => [{ type: i2.Store }, { type: i2$1.FormBuilder }] });
|
|
151
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<div class=\"bg-white p-3 rounded flex gap-3 items-center text-black\">\r\n <div class=\"grow\">\r\n <div class=\"text-lg font-bold\">{{ channel()?.brand }}</div>\r\n @if (channelType() !== 'Production') {\r\n <div class=\"text-base text-gray-600\">{{ channelType() }}</div>\r\n }\r\n </div>\r\n <spx-button (click)=\"onChange()\" [spxType]=\"'button'\">{{ spxTextChange | translate | capitalize }}</spx-button>\r\n</div>" }]
|
|
152
|
+
}] });
|
|
328
153
|
|
|
329
154
|
class Effects {
|
|
330
155
|
constructor(actions$, router) {
|
|
@@ -332,7 +157,12 @@ class Effects {
|
|
|
332
157
|
this.router = router;
|
|
333
158
|
this.onChoose$ = createEffect(() => this.actions$.pipe(ofType(choose), switchMap((action) => {
|
|
334
159
|
if (Capacitor.getPlatform() === 'web') {
|
|
335
|
-
|
|
160
|
+
if (action.channelType.webUrl) {
|
|
161
|
+
window.location.href = action.channelType.webUrl;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.router.navigate(['tabs/hme']);
|
|
165
|
+
}
|
|
336
166
|
}
|
|
337
167
|
else {
|
|
338
168
|
App.getInfo().then((binaryInfo) => {
|
|
@@ -352,25 +182,21 @@ class Effects {
|
|
|
352
182
|
})];
|
|
353
183
|
})), { dispatch: true });
|
|
354
184
|
}
|
|
355
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.
|
|
356
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.
|
|
185
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: Effects, deps: [{ token: i1.Actions }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
186
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: Effects }); }
|
|
357
187
|
}
|
|
358
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.
|
|
188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: Effects, decorators: [{
|
|
359
189
|
type: Injectable
|
|
360
|
-
}], ctorParameters: () => [{ type: i1
|
|
190
|
+
}], ctorParameters: () => [{ type: i1.Actions }, { type: i2.Router }] });
|
|
361
191
|
|
|
362
192
|
var spxChannel_effects = /*#__PURE__*/Object.freeze({
|
|
363
193
|
__proto__: null,
|
|
364
194
|
Effects: Effects
|
|
365
195
|
});
|
|
366
196
|
|
|
367
|
-
var spxChannel_state = /*#__PURE__*/Object.freeze({
|
|
368
|
-
__proto__: null
|
|
369
|
-
});
|
|
370
|
-
|
|
371
197
|
/**
|
|
372
198
|
* Generated bundle index. Do not edit.
|
|
373
199
|
*/
|
|
374
200
|
|
|
375
|
-
export { SpxChannelGuard, SpxChannelIndicatorComponent,
|
|
201
|
+
export { SpxChannelGuard, SpxChannelIndicatorComponent, spxChannel_actions as spxChannelActions, spxChannel_effects as spxChannelEffects, spxChannel_reducer as spxChannelReducer, spxChannelSelectionUrl };
|
|
376
202
|
//# 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/src/spx-channel-selection-url.ts","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-guard.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel/spx-channel.actions.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel/spx-channel.initial.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel/spx-channel.reducer.ts","../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-indicator.component.ts","../../../../projects/softpak/components/spx-channel-selection/src/spx-welcome.component.ts","../../../../projects/softpak/components/spx-channel-selection/store/spx-channel/spx-channel.effects.ts","../../../../projects/softpak/components/spx-channel-selection/softpak-components-spx-channel-selection.ts"],"sourcesContent":["export const spxChannelSelectionUrl = 'wlc';","import { Router } from '@angular/router';\nimport { Injectable } from '@angular/core';\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\nimport { spxChannelSelectionUrl } from './spx-channel-selection-url';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class SpxChannelGuard {\n\n constructor(\n public router: Router,\n ) {}\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 { createAction, props, union } from '@ngrx/store';\nimport { SpxAppChannelI, SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';\n\nexport const choose = createAction('[SPX / Channel] Select', props<{\n channel: SpxAppChannelI;\n channelType: SpxAppChannelTypeEnum;\n}>());\nexport const initialize = createAction('[SPX / Channel] Initialize', props<{\n channels: SpxAppChannelI[];\n}>());\n\nconst all = union({\n choose,\n initialize,\n});\n\nexport type Actions = typeof all;\n","import { StateI } from \"./spx-channel.state\";\n\nexport const initialState: StateI = {\n previousChannel: null,\n channel: null,\n channelType: null,\n channels: [],\n};\n","\nimport * as actions from './spx-channel.actions';\nimport { createFeature, createReducer, on } from '@ngrx/store';\nimport { StateI } from './spx-channel.state';\nimport { initialState } from './spx-channel.initial';\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\nimport { SpxAppChannelI, SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';\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.includes(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(actions.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 channelType,\n };\n }),\n on(actions.initialize, (state, { channels }): StateI => ({\n ...state,\n channel: determineActiveChannel(channels),\n channels: channels.slice().sort((a, b) => a.brand.localeCompare(b.brand)),\n channelType: SpxStorage.getSetting(SpxStorageKeyEnum.channelType) ? SpxStorage.getSetting(SpxStorageKeyEnum.channelType) as SpxAppChannelTypeEnum : SpxAppChannelTypeEnum.production,\n })),\n ),\n});\n","import { Component } from '@angular/core';\nimport { Store } from '@ngrx/store';\nimport { SpxButtonComponent } from '@softpak/components/spx-button';\nimport spxChannelReducer from '../store/spx-channel/spx-channel.reducer';\nimport { AsyncPipe } from '@angular/common';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';\nimport { spxTextChange } from '@softpak/components/spx-translate';\nimport { spxChannelSelectionUrl } from './spx-channel-selection-url';\nimport { NavController } from '@ionic/angular';\n\n@Component({\n selector: 'spx-channel-indicator',\n template: `<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 | async)?.brand }}</div>\n @if ((channelType | async) !== 'Production') {\n <div class=\"text-base text-gray-600\">{{ channelType | async }}</div>\n }\n </div>\n <spx-button (click)=\"onChange()\" [spxType]=\"'button'\">{{ spxTextChange | translate | capitalize }}</spx-button>\n </div>`,\n imports: [\n AsyncPipe,\n SpxButtonComponent,\n SpxCapitalizePipe,\n TranslatePipe,\n ]\n})\nexport class SpxChannelIndicatorComponent {\n channel = this.store.select(spxChannelReducer.selectChannel);\n channelType = this.store.select(spxChannelReducer.selectChannelType);\n spxTextChange = spxTextChange;\n\n constructor(\n private navController: NavController,\n private store: Store,\n ) { }\n\n onChange() {\n this.navController.navigateRoot([spxChannelSelectionUrl]);\n }\n}\n","import { Component, OnInit, OnDestroy, signal, computed } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { Store } from '@ngrx/store';\nimport { SpxAppChannelI, SpxAppChannelTypeEnum } from '@softpak/components/spx-app-configuration';\nimport { SpxFormButtonTypeEnum, SpxFormI, SpxFormViewComponent } from '@softpak/components/spx-form-view';\nimport { SpxSeverityEnum, unsubscribeSubscriptions, valuePairToValue } from '@softpak/components/spx-helpers';\nimport { SpxInputTypeEnum, SpxValuePair } from '@softpak/components/spx-inputs';\nimport { spxValidatorRequired } from '@softpak/components/spx-validation';\nimport { Subscription } from 'rxjs';\nimport spxChannelReducer from '../store/spx-channel/spx-channel.reducer';\nimport { spxTextChannel, spxTextCompany, spxTextSelect, spxTextSelectYourCompany } from '@softpak/components/spx-translate';\nimport { IonHeader, IonToolbar, IonTitle, IonButtons, IonContent } from '@ionic/angular/standalone';\nimport { choose } from '../store/spx-channel/spx-channel.actions';\nimport { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';\nimport { TranslatePipe } from '@ngx-translate/core';\nimport { spxToasterActions, SpxToasterAutoCloseSpeedEnum } from '@softpak/components/spx-toaster';\n\nexport const spxCectionWelcome = 'welcome';\nexport const spxCtrlChannel = 'channel';\nexport const spxCtrlChannelType = 'channelType';\nexport interface SpxWelcomeValueI {\n [spxCtrlChannel]?: SpxAppChannelI;\n [spxCtrlChannelType]: SpxAppChannelTypeEnum;\n}\n\n@Component({\n selector: 'spx-welcome',\n template: `\n <ion-header>\n <ion-toolbar>\n <ion-title>\n {{ textSelectYourCompany | translate | capitalize }}\n </ion-title>\n <ion-buttons slot=\"end\">\n </ion-buttons>\n </ion-toolbar>\n</ion-header>\n<ion-content class=\"ion-padding\">\n <form [formGroup]=\"formGroup\" class=\"max-w-lg mx-auto flex flex-col gap-3\" (ngSubmit)=\"onSubmit()\">\n <spx-form-view\n [spxForm]=\"form\"\n [spxFormGroup]=\"formSection\"\n [spxSuggestions]=\"suggestions\">\n </spx-form-view>\n </form>\n</ion-content>`,\n imports: [\n FormsModule,\n ReactiveFormsModule,\n SpxCapitalizePipe,\n SpxFormViewComponent,\n IonHeader,\n IonToolbar,\n IonTitle,\n IonButtons,\n IonContent,\n TranslatePipe,\n ]\n})\nexport class SpxWelcomeComponent implements OnInit, OnDestroy {\n channels = signal<SpxAppChannelI[]>([]);\n filteredCompanies = computed(() => this.channels().filter(channel => channel.channelTypes.includes(SpxAppChannelTypeEnum.production)).map(c => ({ description: c.brand, value: c.brand })));\n channelTypes = [\n SpxAppChannelTypeEnum.production,\n SpxAppChannelTypeEnum.beta,\n SpxAppChannelTypeEnum.alpha,\n SpxAppChannelTypeEnum.development,\n ];\n formGroup!: FormGroup;\n textChannel = spxTextChannel;\n textCompany = spxTextCompany;\n textSelect = spxTextSelect;\n textSelectYourCompany = spxTextSelectYourCompany;\n suggestions: {\n [spxCtrlChannelType]?: SpxValuePair<string>[];\n [spxCtrlChannel]?: SpxValuePair<string>[];\n } = {\n [spxCtrlChannelType]: [],\n [spxCtrlChannel]: [],\n };\n\n get formSection(): FormGroup { return this.formGroup.get(spxCectionWelcome) as FormGroup; }\n get ctrlChannel(): FormControl { return this.formSection.get(spxCtrlChannel) as FormControl; }\n get ctrlChannelType(): FormControl { return this.formSection.get(spxCtrlChannelType) as FormControl; }\n private subscriptions: {\n channel?: Subscription;\n channels?: Subscription;\n } = {};\n\n form: SpxFormI = {\n buttons: [\n {\n severity: SpxSeverityEnum.success,\n type: SpxFormButtonTypeEnum.submit,\n label: () => this.textSelect,\n }\n ],\n sections: [\n {\n key: spxCectionWelcome,\n showTitle: () => false,\n fields: [\n {\n key: spxCtrlChannel,\n type: () => SpxInputTypeEnum.radio,\n label: () => this.textCompany,\n validators: () => [spxValidatorRequired()],\n },\n {\n key: spxCtrlChannelType,\n type: () => SpxInputTypeEnum.radio,\n label: () => this.textChannel,\n capitalize: () => true,\n show: () => valuePairToValue(this.ctrlChannel.value),\n validators: () => [spxValidatorRequired()],\n },\n ]\n }\n ]\n };\n\n constructor(\n private readonly appStore: Store,\n readonly formBuilder: FormBuilder\n ) {\n this.formGroup = this.formBuilder.group({\n [spxCectionWelcome]: SpxFormViewComponent.createForm(this.formBuilder, this.form.sections)\n });\n }\n\n ngOnDestroy(): void {\n unsubscribeSubscriptions(this.subscriptions);\n }\n\n ngOnInit(): void {\n this.subscriptions.channels = this.appStore.select(spxChannelReducer.selectChannels).subscribe(channels => {\n this.channels.set(channels);\n this.suggestions[spxCtrlChannel] = this.channels().filter(channel => channel.channelTypes.includes(SpxAppChannelTypeEnum.production)).map(c => ({ description: c.brand, value: c.brand }));\n });\n\n this.subscriptions.channel = this.ctrlChannel.valueChanges.subscribe(valuePair => {\n const brandFound = this.channels().find(c => c.brand === valuePairToValue(valuePair));\n this.suggestions[spxCtrlChannelType] = !brandFound ? [] : brandFound?.channelTypes?.map(channelType => ({\n description: channelType,\n value: channelType\n }));\n this.ctrlChannelType.setValue({\n value: SpxAppChannelTypeEnum.production,\n });\n });\n }\n\n onSubmit(): void {\n const channel = this.channels().find(c => c.brand === valuePairToValue(this.ctrlChannel.value))!;\n const channelType = valuePairToValue(this.ctrlChannelType.value);\n\n if (!channel) {\n this.appStore.dispatch(spxToasterActions.createWarning({\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\n messageText: 'Please select a company',\n }))\n } else {\n this.appStore.dispatch(choose({\n channel,\n channelType,\n }));\n }\n }\n}\n","import { Actions, createEffect, ofType } from '@ngrx/effects';\nimport { switchMap } from 'rxjs/operators';\nimport { Injectable } from '@angular/core';\nimport * as actions from './spx-channel.actions';\nimport { setConfig } from '@capacitor/live-updates';\nimport { Capacitor } from '@capacitor/core';\nimport { Router } from '@angular/router';\nimport { spxUpdateUrl } from '@softpak/components/spx-update';\nimport { spxToasterActions, SpxToasterAutoCloseSpeedEnum } from '@softpak/components/spx-toaster';\nimport { captureMessage } from '@sentry/angular';\nimport { App } from '@capacitor/app';\n\n@Injectable()\nexport class Effects {\n onChoose$ =\n createEffect(() =>\n this.actions$.pipe(\n ofType(actions.choose),\n switchMap((action) => {\n if (Capacitor.getPlatform() === 'web') {\n this.router.navigate(['tabs/hme']);\n } else {\n App.getInfo().then((binaryInfo) => {\n const binaryVersionGroup = binaryInfo.version.substring(0, 3);\n setConfig({\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\n return [spxToasterActions.createSuccess({\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\n messageText: action.channel?.brand,\n })];\n }),\n ), { dispatch: true });\n\n constructor(\n private readonly actions$: Actions,\n private readonly router: Router,\n ) { }\n}\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["actions.choose","actions.initialize","spxChannelReducer","i1","i2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,sBAAsB,GAAG,KAAK;;MCQ9B,eAAe,CAAA;AAE1B,IAAA,WAAA,CACS,MAAc,EAAA;QAAd,IAAM,CAAA,MAAA,GAAN,MAAM;;IAGf,WAAW,GAAA;QACT,IACE,CAAC,UAAU,CAAC,UAAU,CAAoB,iBAAiB,CAAC,KAAK,CAAC;YAClE,CAAC,UAAU,CAAC,UAAU,CAAoB,iBAAiB,CAAC,WAAW,CAAC,EACxE;YACA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,CAAC;AAC9C,YAAA,OAAO,KAAK;;AAEd,QAAA,OAAO,IAAI;;8GAdF,eAAe,EAAA,IAAA,EAAA,CAAA,EAA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AC,UAAU,KAAI;AAC9B,oBAAA,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;AAC7D,oBAAA,SAAS,CAAC;AACN,wBAAA,OAAO,EAAE,CAAG,EAAA,MAAM,CAAC,WAAW,CAAA,CAAA,EAAI,kBAAkB,CAAI,EAAA;AAC3D,qBAAA,CAAC;oBACF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;AACxC,iBAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,KAAI;oBACb,cAAc,CAAC,CAAsB,mBAAA,EAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC;oBAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;AACxC,iBAAC,CAAC;;AAGN,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;SACN,CAAC,CACL,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8GA1BrB,OAAO,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAG,IAAA,CAAA,OAAA,EAAA,EAAA,EAAA,KAAA,EAAAC,EAAA,CAAA,MAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAP,OAAO,EAAA,CAAA,CAAA;;2FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBADnB;;;;;;;;;;;;ACZD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-channel-selection.mjs","sources":["../../../../projects/softpak/components/spx-channel-selection/src/spx-channel-guard.ts","../../../../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/store/spx-channel.effects.ts","../../../../projects/softpak/components/spx-channel-selection/softpak-components-spx-channel-selection.ts"],"sourcesContent":["import { Router } from '@angular/router';\r\nimport { inject, Injectable } from '@angular/core';\r\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\r\n// import { spxChannelSelectionUrl } from '../../src/app.const';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SpxChannelGuard {\r\n\r\n private readonly router = inject(Router);\r\n\r\n canActivate(): boolean {\r\n if (\r\n !SpxStorage.getSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.brand) ||\r\n !SpxStorage.getSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.channelType)\r\n ) {\r\n this.router.navigate(['wlc']);\r\n return false;\r\n }\r\n return true;\r\n }\r\n}\r\n","import { createAction, props, union } from '@ngrx/store';\r\nimport { SpxAppChannelI, SpxChannelTypeI } from '@softpak/components/spx-app-configuration';\r\n\r\nexport const choose = createAction('[SPX / Channel] Select', props<{\r\n channel: SpxAppChannelI;\r\n channelType: SpxChannelTypeI;\r\n}>());\r\nexport const initialize = createAction('[SPX / Channel] Initialize', props<{\r\n channels: SpxAppChannelI[];\r\n}>());\r\n\r\nconst all = union({\r\n choose,\r\n initialize,\r\n});\r\n\r\nexport type Actions = typeof all;\r\n","\r\nimport * as actions from './spx-channel.actions';\r\nimport { createFeature, createReducer, on } from '@ngrx/store';\r\nimport { SpxStorage, SpxStorageKeyEnum } from '@softpak/components/spx-storage';\r\nimport { SpxAppChannelI, SpxAppChannelTypeEnum, SpxChannelTypeI } from '@softpak/components/spx-app-configuration';\r\n\r\nexport const initialState: StateI = {\r\n previousChannel: null,\r\n channel: null,\r\n channelType: null,\r\n channels: [],\r\n};\r\n\r\nexport interface StateI {\r\n previousChannel: SpxAppChannelI | null;\r\n channel: SpxAppChannelI | null;\r\n channels: SpxAppChannelI[];\r\n channelType: SpxChannelTypeI | null;\r\n}\r\n\r\nconst determineActiveChannel = (channels: SpxAppChannelI[]): SpxAppChannelI | null => {\r\n if (SpxStorage.getSetting(SpxStorageKeyEnum.brand) && SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {\r\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));\r\n if (channelResult) {\r\n return channelResult;\r\n } else {\r\n const defaultBrandResult = channels.find(channel => channel.default);\r\n if (defaultBrandResult) {\r\n return defaultBrandResult;\r\n } else {\r\n SpxStorage.clearSetting(SpxStorageKeyEnum.brand);\r\n return null;\r\n }\r\n }\r\n } else {\r\n const defaultBrandResult = channels.find(channel => channel.default);\r\n if (defaultBrandResult) {\r\n return defaultBrandResult;\r\n }\r\n return null;\r\n }\r\n}\r\n\r\nexport default createFeature({\r\n name: 'spxChannel',\r\n reducer: createReducer(\r\n initialState,\r\n on(actions.choose, (state, { channel, channelType }): StateI => {\r\n SpxStorage.setSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.brand, channel?.brand);\r\n SpxStorage.setSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.channelType, channelType.name);\r\n SpxStorage.setSetting<SpxStorageKeyEnum>(SpxStorageKeyEnum.channelTypeWithWebUrl, JSON.stringify(channelType));\r\n return {\r\n ...state,\r\n previousChannel: state.channel,\r\n channel,\r\n channelType,\r\n };\r\n }),\r\n on(actions.initialize, (state, { channels }): StateI => {\r\n \r\n let channelType: SpxChannelTypeI | null = null;\r\n \r\n if(SpxStorage.getSetting(SpxStorageKeyEnum.channelTypeWithWebUrl)) {\r\n channelType = JSON.parse(SpxStorage.getSetting(SpxStorageKeyEnum.channelTypeWithWebUrl) as string);\r\n }\r\n else if (SpxStorage.getSetting(SpxStorageKeyEnum.channelType)) {\r\n channelType = { name: SpxStorage.getSetting(SpxStorageKeyEnum.channelType) as SpxAppChannelTypeEnum };\r\n }\r\n else {\r\n channelType = { name: SpxAppChannelTypeEnum.production }; // Default to production if no type is set\r\n }\r\n\r\n return {\r\n ...state,\r\n channel: determineActiveChannel(channels),\r\n channels: channels.slice().sort((a, b) => a.brand.localeCompare(b.brand)),\r\n channelType: channelType,\r\n }\r\n }),\r\n ),\r\n});\r\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\r\nimport { Store } from '@ngrx/store';\r\nimport { SpxButtonComponent } from '@softpak/components/spx-button';\r\nimport spxChannelReducer from '../../store/spx-channel.reducer';\r\nimport { TranslatePipe } from '@ngx-translate/core';\r\nimport { SpxCapitalizePipe } from '@softpak/components/spx-capitalize';\r\nimport { spxTextChange } from '@softpak/components/spx-translate';\r\nimport { NavController } from '@ionic/angular';\r\nimport { toSignal } from '@angular/core/rxjs-interop';\r\nimport { map } from 'rxjs';\r\nexport const spxChannelSelectionUrl = 'wlc';\r\n\r\n@Component({\r\n selector: 'spx-channel-indicator',\r\n templateUrl: './spx-channel-indicator.component.html',\r\n imports: [\r\n SpxButtonComponent,\r\n SpxCapitalizePipe,\r\n TranslatePipe,\r\n ],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n standalone: true,\r\n})\r\nexport class SpxChannelIndicatorComponent {\r\n private readonly navController = inject(NavController);\r\n private readonly store = inject(Store);\r\n protected readonly channel = toSignal(this.store.select(spxChannelReducer.selectChannel));\r\n protected readonly channelType = toSignal(this.store.select(spxChannelReducer.selectChannelType).pipe(\r\n map(channelType => channelType?.name)\r\n ));\r\n protected readonly spxTextChange = spxTextChange;\r\n\r\n protected onChange() {\r\n this.navController.navigateRoot([spxChannelSelectionUrl]);\r\n }\r\n}\r\n","<div class=\"bg-white p-3 rounded flex gap-3 items-center text-black\">\r\n <div class=\"grow\">\r\n <div class=\"text-lg font-bold\">{{ channel()?.brand }}</div>\r\n @if (channelType() !== 'Production') {\r\n <div class=\"text-base text-gray-600\">{{ channelType() }}</div>\r\n }\r\n </div>\r\n <spx-button (click)=\"onChange()\" [spxType]=\"'button'\">{{ spxTextChange | translate | capitalize }}</spx-button>\r\n</div>","import { Actions, createEffect, ofType } from '@ngrx/effects';\r\nimport { switchMap } from 'rxjs/operators';\r\nimport { Injectable } from '@angular/core';\r\nimport * as actions from './spx-channel.actions';\r\nimport { setConfig } from '@capacitor/live-updates';\r\nimport { Capacitor } from '@capacitor/core';\r\nimport { Router } from '@angular/router';\r\nimport { spxUpdateUrl } from '@softpak/components/spx-update';\r\nimport { spxToasterActions, SpxToasterAutoCloseSpeedEnum } from '@softpak/components/spx-toaster';\r\nimport { captureMessage } from '@sentry/angular';\r\nimport { App } from '@capacitor/app';\r\n\r\n@Injectable()\r\nexport class Effects {\r\n onChoose$ =\r\n createEffect(() =>\r\n this.actions$.pipe(\r\n ofType(actions.choose),\r\n switchMap((action) => {\r\n if (Capacitor.getPlatform() === 'web') {\r\n if(action.channelType.webUrl) {\r\n window.location.href = action.channelType.webUrl;\r\n }\r\n else {\r\n this.router.navigate(['tabs/hme']);\r\n }\r\n } else {\r\n App.getInfo().then((binaryInfo) => {\r\n const binaryVersionGroup = binaryInfo.version.substring(0, 3);\r\n setConfig({\r\n channel: `${action.channelType}-${binaryVersionGroup}.x`\r\n });\r\n this.router.navigate([spxUpdateUrl]);\r\n }).catch((err) => {\r\n captureMessage(`SPX Channel Error: ${JSON.stringify(err)}`);\r\n this.router.navigate([spxUpdateUrl]);\r\n });\r\n }\r\n\r\n return [spxToasterActions.createSuccess({\r\n autoClose: SpxToasterAutoCloseSpeedEnum.DEFAULT,\r\n messageText: action.channel?.brand,\r\n })];\r\n }),\r\n ), { dispatch: true });\r\n\r\n constructor(\r\n private readonly actions$: Actions,\r\n private readonly router: Router,\r\n ) { }\r\n}\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["actions.choose","actions.initialize","spxChannelReducer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAGA;MAKa,eAAe,CAAA;AAH5B,IAAA,WAAA,GAAA;AAKmB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAYzC;IAVC,WAAW,GAAA;QACT,IACE,CAAC,UAAU,CAAC,UAAU,CAAoB,iBAAiB,CAAC,KAAK,CAAC;YAClE,CAAC,UAAU,CAAC,UAAU,CAAoB,iBAAiB,CAAC,WAAW,CAAC,EACxE;YACA,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC;AAC7B,YAAA,OAAO,KAAK;;AAEd,QAAA,OAAO,IAAI;;8GAZF,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAf,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,cAFd,MAAM,EAAA,CAAA,CAAA;;2FAEP,eAAe,EAAA,UAAA,EAAA,CAAA;kBAH3B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACJM,MAAM,MAAM,GAAG,YAAY,CAAC,wBAAwB,EAAE,KAAK,EAG9D,CAAC;AACE,MAAM,UAAU,GAAG,YAAY,CAAC,4BAA4B,EAAE,KAAK,EAEtE,CAAC;AAEL,MAAM,GAAG,GAAG,KAAK,CAAC;IACd,MAAM;IACN,UAAU;AACb,CAAA,CAAC;;;;;;;;ACRK,MAAM,YAAY,GAAW;AAClC,IAAA,eAAe,EAAE,IAAI;AACrB,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,EAAI,kBAAkB,CAAI,EAAA;AAC3D,qBAAA,CAAC;oBACF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;AACxC,iBAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,KAAI;oBACb,cAAc,CAAC,CAAsB,mBAAA,EAAA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAE,CAAA,CAAC;oBAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC;AACxC,iBAAC,CAAC;;AAGN,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;SACN,CAAC,CACL,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8GA/BrB,OAAO,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,OAAA,EAAA,EAAA,EAAA,KAAA,EAAA,EAAA,CAAA,MAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAP,OAAO,EAAA,CAAA,CAAA;;2FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBADnB;;;;;;;;ACZD;;AAEG;;;;"}
|
|
@@ -73,17 +73,17 @@ class SpxCheckDigitComponent {
|
|
|
73
73
|
getRawValidators(formControl) {
|
|
74
74
|
return formControl._rawValidators;
|
|
75
75
|
}
|
|
76
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.
|
|
77
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SpxCheckDigitComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
77
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.0", type: SpxCheckDigitComponent, isStandalone: true, selector: "spx-check-digit", inputs: { txtCheckDigit: { classPropertyName: "txtCheckDigit", publicName: "txtCheckDigit", isSignal: true, isRequired: true, transformFunction: null }, txtContainer: { classPropertyName: "txtContainer", publicName: "txtContainer", isSignal: true, isRequired: true, transformFunction: null }, txtPrefix: { classPropertyName: "txtPrefix", publicName: "txtPrefix", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "ctrlContainerNumberRef", first: true, predicate: SpxInputComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<form [formGroup]=\"formGroup()!\" class=\"max-w-lg mx-auto flex flex-col gap-3\">\r\n <spx-input\r\n #ctrlContainerNumberRef\r\n [formControl]=\"ctrlContainerNumber()\"\r\n [spxAutofocus]=\"true\"\r\n [spxCapitalize]=\"true\"\r\n [spxLabel]=\"txtContainer()\"\r\n [spxPattern]=\"'[0-9]*'\"\r\n [spxRequired]=\"true\"\r\n [spxShowValidationMessages]=\"ctrlContainerNumber() && ctrlContainerNumber().errors && ctrlContainerNumber().touched\"\r\n [spxType]=\"inputTypeOverlayNumber\"\r\n [spxValidators]=\"getRawValidators(ctrlContainerNumber())\">\r\n <spx-validate-control [errors]=\"ctrlContainerNumber().errors\" [touched]=\"ctrlContainerNumber().touched\" [control]=\"ctrlContainerNumber()\" [label]=\"txtContainer()\"></spx-validate-control>\r\n </spx-input>\r\n <spx-input\r\n [formControl]=\"ctrlContainerPrefix()\"\r\n [spxCapitalize]=\"true\"\r\n [spxLabel]=\"txtPrefix()\"\r\n [spxRequired]=\"true\"\r\n [spxShowValidationMessages]=\"ctrlContainerPrefix() && ctrlContainerPrefix().errors && ctrlContainerPrefix().touched\"\r\n [spxType]=\"inputTypeText\"\r\n [spxValidators]=\"getRawValidators(ctrlContainerPrefix())\">\r\n <spx-validate-control [errors]=\"ctrlContainerPrefix().errors\" [touched]=\"ctrlContainerPrefix().touched\" [control]=\"ctrlContainerPrefix()\" [label]=\"txtPrefix()\"></spx-validate-control>\r\n </spx-input>\r\n @if (ctrlCheckDigit().value) {\r\n <spx-input\r\n [formControl]=\"ctrlCheckDigit()\"\r\n [spxLabel]=\"txtCheckDigit()\"\r\n [spxReadonly]=\"true\"\r\n [spxType]=\"inputTypeText\">\r\n </spx-input>\r\n }\r\n</form>", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: SpxInputComponent, selector: "spx-input", inputs: ["spxLabel", "spxMax", "spxMin", "spxName", "spxReadonly", "spxAutocomplete", "spxAutofocus", "spxInputMode", "spxPattern", "spxRequired", "spxSelectMonth", "spxSelectDay", "spxShowEdit", "spxShowHelp", "spxShowLabel", "spxCompact", "spxShowClear", "spxShowSearch", "spxAlert", "spxShowValidationMessages", "spxStep", "spxSuggestions", "spxType", "spxValidators", "spxCapitalize"], outputs: ["spxClear", "spxEdit", "spxHelp", "spxSearch", "spxBlur"] }, { kind: "component", type: SpxValidateControlComponent, selector: "spx-validate-control", inputs: ["control", "label", "submitTried", "errors", "touched"] }] }); }
|
|
78
78
|
}
|
|
79
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: SpxCheckDigitComponent, decorators: [{
|
|
80
80
|
type: Component,
|
|
81
81
|
args: [{ selector: 'spx-check-digit', imports: [
|
|
82
82
|
FormsModule,
|
|
83
83
|
ReactiveFormsModule,
|
|
84
84
|
SpxInputComponent,
|
|
85
85
|
SpxValidateControlComponent,
|
|
86
|
-
], template: "<form [formGroup]=\"formGroup()!\" class=\"max-w-lg mx-auto flex flex-col gap-3\">\n <spx-input\n #ctrlContainerNumberRef\n [formControl]=\"ctrlContainerNumber()\"\n [spxAutofocus]=\"true\"\n [spxCapitalize]=\"true\"\n [spxLabel]=\"txtContainer()\"\n [spxPattern]=\"'[0-9]*'\"\n [spxRequired]=\"true\"\n [spxShowValidationMessages]=\"ctrlContainerNumber() && ctrlContainerNumber().errors && ctrlContainerNumber().touched\"\n [spxType]=\"inputTypeOverlayNumber\"\n [spxValidators]=\"getRawValidators(ctrlContainerNumber())\">\n <spx-validate-control [errors]=\"ctrlContainerNumber().errors\" [touched]=\"ctrlContainerNumber().touched\" [control]=\"ctrlContainerNumber()\" [label]=\"txtContainer()\"></spx-validate-control>\n </spx-input>\n <spx-input\n [formControl]=\"ctrlContainerPrefix()\"\n [spxCapitalize]=\"true\"\n [spxLabel]=\"txtPrefix()\"\n [spxRequired]=\"true\"\n [spxShowValidationMessages]=\"ctrlContainerPrefix() && ctrlContainerPrefix().errors && ctrlContainerPrefix().touched\"\n [spxType]=\"inputTypeText\"\n [spxValidators]=\"getRawValidators(ctrlContainerPrefix())\">\n <spx-validate-control [errors]=\"ctrlContainerPrefix().errors\" [touched]=\"ctrlContainerPrefix().touched\" [control]=\"ctrlContainerPrefix()\" [label]=\"txtPrefix()\"></spx-validate-control>\n </spx-input>\n @if (ctrlCheckDigit().value) {\n <spx-input\n [formControl]=\"ctrlCheckDigit()\"\n [spxLabel]=\"txtCheckDigit()\"\n [spxReadonly]=\"true\"\n [spxType]=\"inputTypeText\">\n </spx-input>\n }\n</form>" }]
|
|
86
|
+
], template: "<form [formGroup]=\"formGroup()!\" class=\"max-w-lg mx-auto flex flex-col gap-3\">\r\n <spx-input\r\n #ctrlContainerNumberRef\r\n [formControl]=\"ctrlContainerNumber()\"\r\n [spxAutofocus]=\"true\"\r\n [spxCapitalize]=\"true\"\r\n [spxLabel]=\"txtContainer()\"\r\n [spxPattern]=\"'[0-9]*'\"\r\n [spxRequired]=\"true\"\r\n [spxShowValidationMessages]=\"ctrlContainerNumber() && ctrlContainerNumber().errors && ctrlContainerNumber().touched\"\r\n [spxType]=\"inputTypeOverlayNumber\"\r\n [spxValidators]=\"getRawValidators(ctrlContainerNumber())\">\r\n <spx-validate-control [errors]=\"ctrlContainerNumber().errors\" [touched]=\"ctrlContainerNumber().touched\" [control]=\"ctrlContainerNumber()\" [label]=\"txtContainer()\"></spx-validate-control>\r\n </spx-input>\r\n <spx-input\r\n [formControl]=\"ctrlContainerPrefix()\"\r\n [spxCapitalize]=\"true\"\r\n [spxLabel]=\"txtPrefix()\"\r\n [spxRequired]=\"true\"\r\n [spxShowValidationMessages]=\"ctrlContainerPrefix() && ctrlContainerPrefix().errors && ctrlContainerPrefix().touched\"\r\n [spxType]=\"inputTypeText\"\r\n [spxValidators]=\"getRawValidators(ctrlContainerPrefix())\">\r\n <spx-validate-control [errors]=\"ctrlContainerPrefix().errors\" [touched]=\"ctrlContainerPrefix().touched\" [control]=\"ctrlContainerPrefix()\" [label]=\"txtPrefix()\"></spx-validate-control>\r\n </spx-input>\r\n @if (ctrlCheckDigit().value) {\r\n <spx-input\r\n [formControl]=\"ctrlCheckDigit()\"\r\n [spxLabel]=\"txtCheckDigit()\"\r\n [spxReadonly]=\"true\"\r\n [spxType]=\"inputTypeText\">\r\n </spx-input>\r\n }\r\n</form>" }]
|
|
87
87
|
}], ctorParameters: () => [{ type: i1.FormBuilder }] });
|
|
88
88
|
|
|
89
89
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"softpak-components-spx-check-digit.mjs","sources":["../../../../projects/softpak/components/spx-check-digit/spx-check-digit.component.ts","../../../../projects/softpak/components/spx-check-digit/spx-check-digit.component.html","../../../../projects/softpak/components/spx-check-digit/softpak-components-spx-check-digit.ts"],"sourcesContent":["import { Component, computed, input, signal, viewChild } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { Subscription, combineLatest, map, startWith } from 'rxjs';\nimport { valuePairToValue, calcCheckDigit } from '@softpak/components/spx-helpers';\nimport { SpxInputComponent, SpxInputTypeEnum } from '@softpak/components/spx-inputs';\nimport { spxValidatorRequired, spxValidatorMaxLength, spxValidatorMinLength, spxValidatorPattern, SpxValidateControlComponent } from '@softpak/components/spx-validation';\n\nconst ctrlCheckDigit = 'checkDigit';\nconst ctrlContainerNumber = 'containerNumber';\nconst ctrlPrefix = 'prefix';\n\n@Component({\n selector: 'spx-check-digit',\n templateUrl: './spx-check-digit.component.html',\n imports: [\n FormsModule,\n ReactiveFormsModule,\n SpxInputComponent,\n SpxValidateControlComponent,\n ]\n})\nexport class SpxCheckDigitComponent {\n readonly txtCheckDigit = input.required<string>();\n readonly txtContainer = input.required<string>();\n readonly txtPrefix = input.required<string>();\n ctrlContainerNumberRef = viewChild(SpxInputComponent);\n inputTypeOverlayNumber = SpxInputTypeEnum.overlayNumber;\n inputTypeText = SpxInputTypeEnum.text;\n formGroup = signal<FormGroup | null>(null);\n ctrlCheckDigit = computed(() => this.formGroup()?.get(ctrlCheckDigit) as FormControl);\n ctrlContainerNumber = computed(() => this.formGroup()?.get(ctrlContainerNumber) as FormControl);\n ctrlContainerPrefix = computed(() => this.formGroup()?.get(ctrlPrefix) as FormControl);\n\n private inputChanges?: Subscription;\n\n constructor(\n private readonly formBuilder: FormBuilder,\n ) {\n this.formGroup.set(this.formBuilder.group({\n [ctrlCheckDigit]: [null, []],\n [ctrlContainerNumber]: [null, [\n spxValidatorRequired(),\n spxValidatorMaxLength(6),\n spxValidatorMinLength(6),\n spxValidatorPattern(/[0-9]{6}/),\n ]],\n [ctrlPrefix]: [null, [\n spxValidatorRequired(),\n spxValidatorMaxLength(4),\n spxValidatorMinLength(4),\n spxValidatorPattern(/[a-zA-Z]{4}/),\n ]],\n }));\n }\n\n ngOnInit(): void {\n this.inputChanges = combineLatest([\n this.ctrlContainerNumber().valueChanges.pipe(startWith(this.ctrlContainerNumber().value)),\n this.ctrlContainerPrefix().valueChanges.pipe(startWith(this.ctrlContainerPrefix().value)),\n ])\n .pipe(map(([containerNumber$, prefix$]) => ({\n containerNumber: containerNumber$,\n prefix: prefix$\n })))\n .subscribe((v) => {\n if (this.ctrlContainerNumber().invalid || this.ctrlContainerPrefix().invalid) {\n this.ctrlCheckDigit().setValue(null, { emitEvent: false });\n } else {\n const prefix = valuePairToValue(this.ctrlContainerPrefix().value);\n const containerNumber = valuePairToValue(this.ctrlContainerNumber().value);\n const checkDigit = calcCheckDigit(`${prefix}${containerNumber}`);\n this.ctrlCheckDigit().setValue({ value: checkDigit }, { emitEvent: false });\n }\n });\n }\n\n ngAfterViewInit(): void {\n setTimeout(() => {\n this.ctrlContainerNumberRef()?.setFocusIn(); \n }, 250);\n }\n\n ngOnDestroy(): void {\n if (this.inputChanges) {\n this.inputChanges.unsubscribe();\n }\n }\n\n getRawValidators(formControl: FormControl) {\n return (formControl as any)._rawValidators;\n }\n}\n","<form [formGroup]=\"formGroup()!\" class=\"max-w-lg mx-auto flex flex-col gap-3\">\n <spx-input\n #ctrlContainerNumberRef\n [formControl]=\"ctrlContainerNumber()\"\n [spxAutofocus]=\"true\"\n [spxCapitalize]=\"true\"\n [spxLabel]=\"txtContainer()\"\n [spxPattern]=\"'[0-9]*'\"\n [spxRequired]=\"true\"\n [spxShowValidationMessages]=\"ctrlContainerNumber() && ctrlContainerNumber().errors && ctrlContainerNumber().touched\"\n [spxType]=\"inputTypeOverlayNumber\"\n [spxValidators]=\"getRawValidators(ctrlContainerNumber())\">\n <spx-validate-control [errors]=\"ctrlContainerNumber().errors\" [touched]=\"ctrlContainerNumber().touched\" [control]=\"ctrlContainerNumber()\" [label]=\"txtContainer()\"></spx-validate-control>\n </spx-input>\n <spx-input\n [formControl]=\"ctrlContainerPrefix()\"\n [spxCapitalize]=\"true\"\n [spxLabel]=\"txtPrefix()\"\n [spxRequired]=\"true\"\n [spxShowValidationMessages]=\"ctrlContainerPrefix() && ctrlContainerPrefix().errors && ctrlContainerPrefix().touched\"\n [spxType]=\"inputTypeText\"\n [spxValidators]=\"getRawValidators(ctrlContainerPrefix())\">\n <spx-validate-control [errors]=\"ctrlContainerPrefix().errors\" [touched]=\"ctrlContainerPrefix().touched\" [control]=\"ctrlContainerPrefix()\" [label]=\"txtPrefix()\"></spx-validate-control>\n </spx-input>\n @if (ctrlCheckDigit().value) {\n <spx-input\n [formControl]=\"ctrlCheckDigit()\"\n [spxLabel]=\"txtCheckDigit()\"\n [spxReadonly]=\"true\"\n [spxType]=\"inputTypeText\">\n </spx-input>\n }\n</form>","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAOA,MAAM,cAAc,GAAG,YAAY;AACnC,MAAM,mBAAmB,GAAG,iBAAiB;AAC7C,MAAM,UAAU,GAAG,QAAQ;MAYd,sBAAsB,CAAA;AAcjC,IAAA,WAAA,CACmB,WAAwB,EAAA;QAAxB,IAAW,CAAA,WAAA,GAAX,WAAW;AAdrB,QAAA,IAAA,CAAA,aAAa,GAAG,KAAK,CAAC,QAAQ,EAAU;AACxC,QAAA,IAAA,CAAA,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAU;AACvC,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAU;AAC7C,QAAA,IAAA,CAAA,sBAAsB,GAAG,SAAS,CAAC,iBAAiB,CAAC;AACrD,QAAA,IAAA,CAAA,sBAAs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aAAA,EAAA,QAAA,EAAA,SAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;2FAGtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAVlC,SAAS;AACI,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,iBAAiB,EAElB,OAAA,EAAA;wBACL,WAAW;wBACX,mBAAmB;wBACnB,iBAAiB;wBACjB,2BAA2B;AAC9B,qBAAA,EAAA,QAAA,EAAA,kjDAAA,EAAA;;;AEnBL;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"softpak-components-spx-check-digit.mjs","sources":["../../../../projects/softpak/components/spx-check-digit/spx-check-digit.component.ts","../../../../projects/softpak/components/spx-check-digit/spx-check-digit.component.html","../../../../projects/softpak/components/spx-check-digit/softpak-components-spx-check-digit.ts"],"sourcesContent":["import { Component, computed, input, signal, viewChild } from '@angular/core';\r\nimport { FormBuilder, FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { Subscription, combineLatest, map, startWith } from 'rxjs';\r\nimport { valuePairToValue, calcCheckDigit } from '@softpak/components/spx-helpers';\r\nimport { SpxInputComponent, SpxInputTypeEnum } from '@softpak/components/spx-inputs';\r\nimport { spxValidatorRequired, spxValidatorMaxLength, spxValidatorMinLength, spxValidatorPattern, SpxValidateControlComponent } from '@softpak/components/spx-validation';\r\n\r\nconst ctrlCheckDigit = 'checkDigit';\r\nconst ctrlContainerNumber = 'containerNumber';\r\nconst ctrlPrefix = 'prefix';\r\n\r\n@Component({\r\n selector: 'spx-check-digit',\r\n templateUrl: './spx-check-digit.component.html',\r\n imports: [\r\n FormsModule,\r\n ReactiveFormsModule,\r\n SpxInputComponent,\r\n SpxValidateControlComponent,\r\n ]\r\n})\r\nexport class SpxCheckDigitComponent {\r\n readonly txtCheckDigit = input.required<string>();\r\n readonly txtContainer = input.required<string>();\r\n readonly txtPrefix = input.required<string>();\r\n ctrlContainerNumberRef = viewChild(SpxInputComponent);\r\n inputTypeOverlayNumber = SpxInputTypeEnum.overlayNumber;\r\n inputTypeText = SpxInputTypeEnum.text;\r\n formGroup = signal<FormGroup | null>(null);\r\n ctrlCheckDigit = computed(() => this.formGroup()?.get(ctrlCheckDigit) as FormControl);\r\n ctrlContainerNumber = computed(() => this.formGroup()?.get(ctrlContainerNumber) as FormControl);\r\n ctrlContainerPrefix = computed(() => this.formGroup()?.get(ctrlPrefix) as FormControl);\r\n\r\n private inputChanges?: Subscription;\r\n\r\n constructor(\r\n private readonly formBuilder: FormBuilder,\r\n ) {\r\n this.formGroup.set(this.formBuilder.group({\r\n [ctrlCheckDigit]: [null, []],\r\n [ctrlContainerNumber]: [null, [\r\n spxValidatorRequired(),\r\n spxValidatorMaxLength(6),\r\n spxValidatorMinLength(6),\r\n spxValidatorPattern(/[0-9]{6}/),\r\n ]],\r\n [ctrlPrefix]: [null, [\r\n spxValidatorRequired(),\r\n spxValidatorMaxLength(4),\r\n spxValidatorMinLength(4),\r\n spxValidatorPattern(/[a-zA-Z]{4}/),\r\n ]],\r\n }));\r\n }\r\n\r\n ngOnInit(): void {\r\n this.inputChanges = combineLatest([\r\n this.ctrlContainerNumber().valueChanges.pipe(startWith(this.ctrlContainerNumber().value)),\r\n this.ctrlContainerPrefix().valueChanges.pipe(startWith(this.ctrlContainerPrefix().value)),\r\n ])\r\n .pipe(map(([containerNumber$, prefix$]) => ({\r\n containerNumber: containerNumber$,\r\n prefix: prefix$\r\n })))\r\n .subscribe((v) => {\r\n if (this.ctrlContainerNumber().invalid || this.ctrlContainerPrefix().invalid) {\r\n this.ctrlCheckDigit().setValue(null, { emitEvent: false });\r\n } else {\r\n const prefix = valuePairToValue(this.ctrlContainerPrefix().value);\r\n const containerNumber = valuePairToValue(this.ctrlContainerNumber().value);\r\n const checkDigit = calcCheckDigit(`${prefix}${containerNumber}`);\r\n this.ctrlCheckDigit().setValue({ value: checkDigit }, { emitEvent: false });\r\n }\r\n });\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n setTimeout(() => {\r\n this.ctrlContainerNumberRef()?.setFocusIn(); \r\n }, 250);\r\n }\r\n\r\n ngOnDestroy(): void {\r\n if (this.inputChanges) {\r\n this.inputChanges.unsubscribe();\r\n }\r\n }\r\n\r\n getRawValidators(formControl: FormControl) {\r\n return (formControl as any)._rawValidators;\r\n }\r\n}\r\n","<form [formGroup]=\"formGroup()!\" class=\"max-w-lg mx-auto flex flex-col gap-3\">\r\n <spx-input\r\n #ctrlContainerNumberRef\r\n [formControl]=\"ctrlContainerNumber()\"\r\n [spxAutofocus]=\"true\"\r\n [spxCapitalize]=\"true\"\r\n [spxLabel]=\"txtContainer()\"\r\n [spxPattern]=\"'[0-9]*'\"\r\n [spxRequired]=\"true\"\r\n [spxShowValidationMessages]=\"ctrlContainerNumber() && ctrlContainerNumber().errors && ctrlContainerNumber().touched\"\r\n [spxType]=\"inputTypeOverlayNumber\"\r\n [spxValidators]=\"getRawValidators(ctrlContainerNumber())\">\r\n <spx-validate-control [errors]=\"ctrlContainerNumber().errors\" [touched]=\"ctrlContainerNumber().touched\" [control]=\"ctrlContainerNumber()\" [label]=\"txtContainer()\"></spx-validate-control>\r\n </spx-input>\r\n <spx-input\r\n [formControl]=\"ctrlContainerPrefix()\"\r\n [spxCapitalize]=\"true\"\r\n [spxLabel]=\"txtPrefix()\"\r\n [spxRequired]=\"true\"\r\n [spxShowValidationMessages]=\"ctrlContainerPrefix() && ctrlContainerPrefix().errors && ctrlContainerPrefix().touched\"\r\n [spxType]=\"inputTypeText\"\r\n [spxValidators]=\"getRawValidators(ctrlContainerPrefix())\">\r\n <spx-validate-control [errors]=\"ctrlContainerPrefix().errors\" [touched]=\"ctrlContainerPrefix().touched\" [control]=\"ctrlContainerPrefix()\" [label]=\"txtPrefix()\"></spx-validate-control>\r\n </spx-input>\r\n @if (ctrlCheckDigit().value) {\r\n <spx-input\r\n [formControl]=\"ctrlCheckDigit()\"\r\n [spxLabel]=\"txtCheckDigit()\"\r\n [spxReadonly]=\"true\"\r\n [spx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