@taiga-ui/addon-commerce 2.59.1 → 3.0.0-rc.1
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/bundles/taiga-ui-addon-commerce-components-card.umd.js +420 -306
- package/bundles/taiga-ui-addon-commerce-components-card.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.js +610 -463
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.js +458 -332
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.js +436 -310
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.js +427 -304
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components-money.umd.js +509 -377
- package/bundles/taiga-ui-addon-commerce-components-money.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-components.umd.js +15 -27
- package/bundles/taiga-ui-addon-commerce-components.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-constants.umd.js +8 -6
- package/bundles/taiga-ui-addon-commerce-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-enums.umd.js +100 -41
- package/bundles/taiga-ui-addon-commerce-enums.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.js +2 -2
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-pipes.umd.js +60 -271
- package/bundles/taiga-ui-addon-commerce-pipes.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-tokens.umd.js +9 -5
- package/bundles/taiga-ui-addon-commerce-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-types.umd.js +2 -2
- package/bundles/taiga-ui-addon-commerce-types.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-utils.umd.js +46 -95
- package/bundles/taiga-ui-addon-commerce-utils.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce-validators.umd.js +15 -9
- package/bundles/taiga-ui-addon-commerce-validators.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-commerce.umd.js +31 -33
- package/bundles/taiga-ui-addon-commerce.umd.js.map +1 -1
- package/components/card/card.component.d.ts +5 -4
- package/components/card/card.module.d.ts +7 -0
- package/components/card/package.json +2 -5
- package/components/card/taiga-ui-addon-commerce-components-card.d.ts +1 -0
- package/components/input-card/input-card.component.d.ts +4 -4
- package/components/input-card/input-card.module.d.ts +8 -0
- package/components/input-card/package.json +2 -5
- package/components/input-card/taiga-ui-addon-commerce-components-input-card.d.ts +1 -0
- package/components/input-card-grouped/input-card-grouped.component.d.ts +5 -3
- package/components/input-card-grouped/input-card-grouped.module.d.ts +12 -0
- package/components/input-card-grouped/input-card-grouped.providers.d.ts +0 -2
- package/components/input-card-grouped/package.json +2 -5
- package/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.d.ts +1 -0
- package/components/input-cvc/input-cvc.component.d.ts +3 -1
- package/components/input-cvc/input-cvc.module.d.ts +8 -0
- package/components/input-cvc/package.json +2 -5
- package/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.d.ts +1 -0
- package/components/input-expire/input-expire.component.d.ts +3 -1
- package/components/input-expire/input-expire.module.d.ts +8 -0
- package/components/input-expire/package.json +2 -5
- package/components/input-expire/taiga-ui-addon-commerce-components-input-expire.d.ts +1 -0
- package/components/money/money-options.d.ts +4 -4
- package/components/money/money.component.d.ts +7 -4
- package/components/money/money.module.d.ts +10 -0
- package/components/money/package.json +2 -5
- package/components/money/pipes/fraction-part.pipe.d.ts +5 -2
- package/components/money/pipes/integer-part.pipe.d.ts +3 -0
- package/components/money/pipes/sign-symbol.pipe.d.ts +5 -2
- package/components/money/taiga-ui-addon-commerce-components-money.d.ts +1 -0
- package/components/money/utils/format-fraction-part.d.ts +2 -2
- package/components/money/utils/format-sign-symbol.d.ts +2 -2
- package/components/package.json +2 -5
- package/components/taiga-ui-addon-commerce-components.d.ts +1 -0
- package/constants/package.json +2 -5
- package/constants/taiga-ui-addon-commerce-constants.d.ts +1 -0
- package/enums/currency-code.d.ts +48 -6
- package/enums/currency.d.ts +48 -6
- package/enums/index.d.ts +0 -2
- package/enums/package.json +2 -5
- package/enums/taiga-ui-addon-commerce-enums.d.ts +1 -0
- package/esm2015/components/card/card.component.js +39 -30
- package/esm2015/components/card/card.module.js +15 -12
- package/esm2015/components/card/index.js +1 -1
- package/esm2015/components/card/taiga-ui-addon-commerce-components-card.js +1 -1
- package/esm2015/components/index.js +1 -1
- package/esm2015/components/input-card/index.js +1 -1
- package/esm2015/components/input-card/input-card.component.js +73 -60
- package/esm2015/components/input-card/input-card.module.js +24 -13
- package/esm2015/components/input-card/taiga-ui-addon-commerce-components-input-card.js +1 -1
- package/esm2015/components/input-card-grouped/index.js +1 -1
- package/esm2015/components/input-card-grouped/input-card-grouped.component.js +125 -109
- package/esm2015/components/input-card-grouped/input-card-grouped.module.js +45 -15
- package/esm2015/components/input-card-grouped/input-card-grouped.providers.js +20 -17
- package/esm2015/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.js +1 -1
- package/esm2015/components/input-cvc/index.js +1 -1
- package/esm2015/components/input-cvc/input-cvc.component.js +50 -41
- package/esm2015/components/input-cvc/input-cvc.module.js +26 -13
- package/esm2015/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.js +1 -1
- package/esm2015/components/input-expire/index.js +1 -1
- package/esm2015/components/input-expire/input-expire.component.js +46 -38
- package/esm2015/components/input-expire/input-expire.module.js +24 -13
- package/esm2015/components/input-expire/taiga-ui-addon-commerce-components-input-expire.js +1 -1
- package/esm2015/components/money/index.js +1 -1
- package/esm2015/components/money/money-options.js +1 -1
- package/esm2015/components/money/money.component.js +46 -33
- package/esm2015/components/money/money.module.js +23 -17
- package/esm2015/components/money/pipes/fraction-part.pipe.js +13 -12
- package/esm2015/components/money/pipes/integer-part.pipe.js +15 -14
- package/esm2015/components/money/pipes/sign-symbol.pipe.js +10 -8
- package/esm2015/components/money/taiga-ui-addon-commerce-components-money.js +1 -1
- package/esm2015/components/money/utils/format-fraction-part.js +1 -1
- package/esm2015/components/money/utils/format-sign-symbol.js +1 -1
- package/esm2015/components/taiga-ui-addon-commerce-components.js +1 -1
- package/esm2015/constants/card-holder-mask.js +1 -1
- package/esm2015/constants/card-mask.js +1 -1
- package/esm2015/constants/default-card-validator.js +3 -3
- package/esm2015/constants/index.js +1 -1
- package/esm2015/constants/taiga-ui-addon-commerce-constants.js +1 -1
- package/esm2015/enums/currency-code.js +48 -7
- package/esm2015/enums/currency.js +48 -7
- package/esm2015/enums/index.js +1 -3
- package/esm2015/enums/taiga-ui-addon-commerce-enums.js +1 -1
- package/esm2015/index.js +3 -1
- package/esm2015/interfaces/card.js +2 -1
- package/esm2015/interfaces/index.js +2 -1
- package/esm2015/interfaces/taiga-ui-addon-commerce-interfaces.js +2 -1
- package/esm2015/pipes/currency/currency.module.js +14 -11
- package/esm2015/pipes/currency/currency.pipe.js +14 -12
- package/esm2015/pipes/format-card/format-card.module.js +14 -11
- package/esm2015/pipes/format-card/format-card.pipe.js +10 -8
- package/esm2015/pipes/index.js +1 -1
- package/esm2015/pipes/taiga-ui-addon-commerce-pipes.js +1 -1
- package/esm2015/taiga-ui-addon-commerce.js +1 -1
- package/esm2015/tokens/i18n.js +4 -4
- package/esm2015/tokens/index.js +1 -1
- package/esm2015/tokens/taiga-ui-addon-commerce-tokens.js +1 -1
- package/esm2015/types/code-length.js +2 -1
- package/esm2015/types/currency-variants.js +2 -1
- package/esm2015/types/index.js +5 -1
- package/esm2015/types/money-sign.js +2 -1
- package/esm2015/types/payment-system.js +2 -0
- package/esm2015/types/taiga-ui-addon-commerce-types.js +2 -1
- package/esm2015/utils/create-auto-corrected-expire-pipe.js +1 -1
- package/esm2015/utils/format-currency.js +7 -12
- package/esm2015/utils/get-currency-symbol.js +11 -7
- package/esm2015/utils/get-payment-system.js +17 -47
- package/esm2015/utils/index.js +1 -1
- package/esm2015/utils/is-card-length-valid.js +9 -12
- package/esm2015/utils/is-card-number-valid.js +2 -5
- package/esm2015/utils/is-expire-valid.js +2 -7
- package/esm2015/utils/taiga-ui-addon-commerce-utils.js +1 -1
- package/esm2015/validators/card-expire.validator.js +3 -3
- package/esm2015/validators/card-number.validator.js +3 -3
- package/esm2015/validators/index.js +1 -1
- package/esm2015/validators/luhn.validator.js +5 -3
- package/esm2015/validators/taiga-ui-addon-commerce-validators.js +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-card.js +54 -40
- package/fesm2015/taiga-ui-addon-commerce-components-card.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-card-grouped.js +188 -136
- package/fesm2015/taiga-ui-addon-commerce-components-input-card-grouped.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-card.js +96 -70
- package/fesm2015/taiga-ui-addon-commerce-components-input-card.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-cvc.js +73 -49
- package/fesm2015/taiga-ui-addon-commerce-components-input-cvc.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-input-expire.js +67 -46
- package/fesm2015/taiga-ui-addon-commerce-components-input-expire.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components-money.js +125 -100
- package/fesm2015/taiga-ui-addon-commerce-components-money.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-components.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-constants.js +2 -2
- package/fesm2015/taiga-ui-addon-commerce-constants.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-enums.js +95 -40
- package/fesm2015/taiga-ui-addon-commerce-enums.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-interfaces.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-pipes.js +45 -31
- package/fesm2015/taiga-ui-addon-commerce-pipes.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-tokens.js +3 -3
- package/fesm2015/taiga-ui-addon-commerce-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-types.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-utils.js +41 -83
- package/fesm2015/taiga-ui-addon-commerce-utils.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce-validators.js +6 -4
- package/fesm2015/taiga-ui-addon-commerce-validators.js.map +1 -1
- package/fesm2015/taiga-ui-addon-commerce.js +2 -0
- package/fesm2015/taiga-ui-addon-commerce.js.map +1 -1
- package/interfaces/package.json +2 -5
- package/interfaces/taiga-ui-addon-commerce-interfaces.d.ts +1 -0
- package/package.json +12 -15
- package/pipes/currency/currency.module.d.ts +5 -0
- package/pipes/currency/currency.pipe.d.ts +3 -0
- package/pipes/format-card/format-card.module.d.ts +5 -0
- package/pipes/format-card/format-card.pipe.d.ts +3 -0
- package/pipes/package.json +2 -5
- package/pipes/taiga-ui-addon-commerce-pipes.d.ts +1 -0
- package/taiga-ui-addon-commerce.d.ts +1 -0
- package/tokens/package.json +2 -5
- package/tokens/taiga-ui-addon-commerce-tokens.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/money-sign.d.ts +1 -1
- package/types/package.json +2 -5
- package/types/payment-system.d.ts +1 -0
- package/types/taiga-ui-addon-commerce-types.d.ts +1 -0
- package/utils/format-currency.d.ts +1 -5
- package/utils/get-currency-symbol.d.ts +1 -5
- package/utils/get-payment-system.d.ts +7 -31
- package/utils/is-card-length-valid.d.ts +1 -3
- package/utils/is-card-number-valid.d.ts +1 -3
- package/utils/is-expire-valid.d.ts +1 -5
- package/utils/package.json +2 -5
- package/utils/taiga-ui-addon-commerce-utils.d.ts +1 -0
- package/validators/package.json +2 -5
- package/validators/taiga-ui-addon-commerce-validators.d.ts +1 -0
- package/bundles/taiga-ui-addon-commerce-components-card.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-card.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-card-grouped.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-card.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-cvc.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-input-expire.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components-money.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components-money.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-components.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-components.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-constants.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-constants.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-enums.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-enums.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-interfaces.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-pipes.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-pipes.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-tokens.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-tokens.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-types.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-types.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-utils.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-utils.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce-validators.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce-validators.umd.min.js.map +0 -1
- package/bundles/taiga-ui-addon-commerce.umd.min.js +0 -2
- package/bundles/taiga-ui-addon-commerce.umd.min.js.map +0 -1
- package/components/card/taiga-ui-addon-commerce-components-card.metadata.json +0 -1
- package/components/input-card/taiga-ui-addon-commerce-components-input-card.metadata.json +0 -1
- package/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.metadata.json +0 -1
- package/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.metadata.json +0 -1
- package/components/input-expire/taiga-ui-addon-commerce-components-input-expire.metadata.json +0 -1
- package/components/money/taiga-ui-addon-commerce-components-money.metadata.json +0 -1
- package/components/taiga-ui-addon-commerce-components.metadata.json +0 -1
- package/constants/taiga-ui-addon-commerce-constants.metadata.json +0 -1
- package/enums/money-sign.d.ts +0 -16
- package/enums/payment-system.d.ts +0 -8
- package/enums/taiga-ui-addon-commerce-enums.metadata.json +0 -1
- package/esm2015/enums/money-sign.js +0 -18
- package/esm2015/enums/payment-system.js +0 -9
- package/esm5/components/card/card.component.js +0 -73
- package/esm5/components/card/card.module.js +0 -19
- package/esm5/components/card/index.js +0 -3
- package/esm5/components/card/taiga-ui-addon-commerce-components-card.js +0 -5
- package/esm5/components/index.js +0 -7
- package/esm5/components/input-card/index.js +0 -3
- package/esm5/components/input-card/input-card.component.js +0 -167
- package/esm5/components/input-card/input-card.module.js +0 -25
- package/esm5/components/input-card/taiga-ui-addon-commerce-components-input-card.js +0 -5
- package/esm5/components/input-card-grouped/index.js +0 -4
- package/esm5/components/input-card-grouped/input-card-grouped.component.js +0 -511
- package/esm5/components/input-card-grouped/input-card-grouped.module.js +0 -40
- package/esm5/components/input-card-grouped/input-card-grouped.providers.js +0 -34
- package/esm5/components/input-card-grouped/taiga-ui-addon-commerce-components-input-card-grouped.js +0 -5
- package/esm5/components/input-cvc/index.js +0 -3
- package/esm5/components/input-cvc/input-cvc.component.js +0 -113
- package/esm5/components/input-cvc/input-cvc.module.js +0 -26
- package/esm5/components/input-cvc/taiga-ui-addon-commerce-components-input-cvc.js +0 -5
- package/esm5/components/input-expire/index.js +0 -3
- package/esm5/components/input-expire/input-expire.component.js +0 -108
- package/esm5/components/input-expire/input-expire.module.js +0 -25
- package/esm5/components/input-expire/taiga-ui-addon-commerce-components-input-expire.js +0 -5
- package/esm5/components/money/index.js +0 -9
- package/esm5/components/money/money-options.js +0 -18
- package/esm5/components/money/money.component.js +0 -101
- package/esm5/components/money/money.module.js +0 -27
- package/esm5/components/money/pipes/fraction-part.pipe.js +0 -27
- package/esm5/components/money/pipes/integer-part.pipe.js +0 -21
- package/esm5/components/money/pipes/sign-symbol.pipe.js +0 -16
- package/esm5/components/money/taiga-ui-addon-commerce-components-money.js +0 -5
- package/esm5/components/money/utils/format-fraction-part.js +0 -7
- package/esm5/components/money/utils/format-sign-symbol.js +0 -11
- package/esm5/components/taiga-ui-addon-commerce-components.js +0 -5
- package/esm5/constants/card-holder-mask.js +0 -37
- package/esm5/constants/card-mask.js +0 -30
- package/esm5/constants/default-card-validator.js +0 -5
- package/esm5/constants/index.js +0 -4
- package/esm5/constants/taiga-ui-addon-commerce-constants.js +0 -5
- package/esm5/enums/currency-code.js +0 -178
- package/esm5/enums/currency.js +0 -178
- package/esm5/enums/index.js +0 -5
- package/esm5/enums/money-sign.js +0 -18
- package/esm5/enums/payment-system.js +0 -9
- package/esm5/enums/taiga-ui-addon-commerce-enums.js +0 -5
- package/esm5/index.js +0 -8
- package/esm5/interfaces/card.js +0 -1
- package/esm5/interfaces/index.js +0 -1
- package/esm5/interfaces/taiga-ui-addon-commerce-interfaces.js +0 -4
- package/esm5/pipes/currency/currency.module.js +0 -16
- package/esm5/pipes/currency/currency.pipe.js +0 -18
- package/esm5/pipes/format-card/format-card.module.js +0 -16
- package/esm5/pipes/format-card/format-card.pipe.js +0 -22
- package/esm5/pipes/index.js +0 -5
- package/esm5/pipes/taiga-ui-addon-commerce-pipes.js +0 -5
- package/esm5/taiga-ui-addon-commerce.js +0 -5
- package/esm5/tokens/i18n.js +0 -13
- package/esm5/tokens/index.js +0 -2
- package/esm5/tokens/taiga-ui-addon-commerce-tokens.js +0 -5
- package/esm5/types/code-length.js +0 -1
- package/esm5/types/currency-variants.js +0 -1
- package/esm5/types/index.js +0 -1
- package/esm5/types/money-sign.js +0 -1
- package/esm5/types/taiga-ui-addon-commerce-types.js +0 -4
- package/esm5/utils/create-auto-corrected-expire-pipe.js +0 -43
- package/esm5/utils/format-currency.js +0 -17
- package/esm5/utils/get-currency-symbol.js +0 -71
- package/esm5/utils/get-payment-system.js +0 -103
- package/esm5/utils/index.js +0 -8
- package/esm5/utils/is-card-length-valid.js +0 -25
- package/esm5/utils/is-card-number-valid.js +0 -21
- package/esm5/utils/is-expire-valid.js +0 -14
- package/esm5/utils/taiga-ui-addon-commerce-utils.js +0 -5
- package/esm5/validators/card-expire.validator.js +0 -10
- package/esm5/validators/card-number.validator.js +0 -9
- package/esm5/validators/index.js +0 -4
- package/esm5/validators/luhn.validator.js +0 -9
- package/esm5/validators/taiga-ui-addon-commerce-validators.js +0 -5
- package/fesm5/taiga-ui-addon-commerce-components-card.js +0 -94
- package/fesm5/taiga-ui-addon-commerce-components-card.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-card-grouped.js +0 -579
- package/fesm5/taiga-ui-addon-commerce-components-input-card-grouped.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-card.js +0 -193
- package/fesm5/taiga-ui-addon-commerce-components-input-card.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-cvc.js +0 -140
- package/fesm5/taiga-ui-addon-commerce-components-input-cvc.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-input-expire.js +0 -134
- package/fesm5/taiga-ui-addon-commerce-components-input-expire.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components-money.js +0 -210
- package/fesm5/taiga-ui-addon-commerce-components-money.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-components.js +0 -11
- package/fesm5/taiga-ui-addon-commerce-components.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-constants.js +0 -78
- package/fesm5/taiga-ui-addon-commerce-constants.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-enums.js +0 -389
- package/fesm5/taiga-ui-addon-commerce-enums.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-interfaces.js +0 -4
- package/fesm5/taiga-ui-addon-commerce-interfaces.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-pipes.js +0 -67
- package/fesm5/taiga-ui-addon-commerce-pipes.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-tokens.js +0 -20
- package/fesm5/taiga-ui-addon-commerce-tokens.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-types.js +0 -4
- package/fesm5/taiga-ui-addon-commerce-types.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-utils.js +0 -298
- package/fesm5/taiga-ui-addon-commerce-utils.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce-validators.js +0 -31
- package/fesm5/taiga-ui-addon-commerce-validators.js.map +0 -1
- package/fesm5/taiga-ui-addon-commerce.js +0 -12
- package/fesm5/taiga-ui-addon-commerce.js.map +0 -1
- package/interfaces/taiga-ui-addon-commerce-interfaces.metadata.json +0 -1
- package/pipes/taiga-ui-addon-commerce-pipes.metadata.json +0 -1
- package/taiga-ui-addon-commerce.metadata.json +0 -1
- package/tokens/taiga-ui-addon-commerce-tokens.metadata.json +0 -1
- package/types/taiga-ui-addon-commerce-types.metadata.json +0 -1
- package/utils/taiga-ui-addon-commerce-utils.metadata.json +0 -1
- package/validators/taiga-ui-addon-commerce-validators.metadata.json +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taiga-ui/core'), require('@taiga-ui/cdk')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@taiga-ui/addon-commerce/utils', ['exports', '@taiga-ui/core', '@taiga-ui/cdk'], factory) :
|
|
4
|
-
(global = global || self, factory((global[
|
|
5
|
-
}(this, (function (exports, core, cdk) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["taiga-ui"] = global["taiga-ui"] || {}, global["taiga-ui"]["addon-commerce"] = global["taiga-ui"]["addon-commerce"] || {}, global["taiga-ui"]["addon-commerce"].utils = {}), global.core, global.cdk));
|
|
5
|
+
})(this, (function (exports, core, cdk) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var TUI_EXP_YEAR_MONTH = /^\d{2}[/|.]\d{4}$/;
|
|
8
8
|
var TUI_EXP_SAFARI = /^\d{1,4}.\d{1,2}.\d{1,4}$/;
|
|
@@ -46,11 +46,7 @@
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
* @deprecated: use {@link tuiGetCurrencySymbol} instead
|
|
51
|
-
*/
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
53
|
-
function getCurrencySymbol(currency) {
|
|
49
|
+
function tuiGetCurrencySymbol(currency) {
|
|
54
50
|
switch (currency) {
|
|
55
51
|
case "RUB" /* Ruble */:
|
|
56
52
|
case "643" /* Ruble */:
|
|
@@ -111,32 +107,31 @@
|
|
|
111
107
|
case "UAH" /* Hryvnia */:
|
|
112
108
|
case "980" /* Hryvnia */:
|
|
113
109
|
return "\u20B4";
|
|
110
|
+
case "UZS" /* UzbekSum */:
|
|
111
|
+
case "860" /* UzbekSum */:
|
|
112
|
+
return "So'm";
|
|
113
|
+
case "KGS" /* KyrgyzstanSom */:
|
|
114
|
+
case "417" /* KyrgyzstanSom */:
|
|
115
|
+
return "c";
|
|
116
|
+
case "AED" /* Dirham */:
|
|
117
|
+
case "784" /* Dirham */:
|
|
118
|
+
return "Dh";
|
|
114
119
|
default:
|
|
115
120
|
return null;
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
|
-
var tuiGetCurrencySymbol = getCurrencySymbol;
|
|
119
123
|
|
|
120
|
-
|
|
121
|
-
* @deprecated: use {@link tuiFormatCurrency} instead
|
|
122
|
-
*/
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
124
|
-
function formatCurrency(currency) {
|
|
124
|
+
function tuiFormatCurrency(currency) {
|
|
125
125
|
var stringifiedCurrency = stringifyCurrency(currency);
|
|
126
|
-
return
|
|
126
|
+
return tuiGetCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;
|
|
127
127
|
}
|
|
128
|
-
var tuiFormatCurrency = formatCurrency;
|
|
129
128
|
function stringifyCurrency(currency) {
|
|
130
|
-
return currency === null ||
|
|
129
|
+
return currency === null || cdk.tuiIsString(currency)
|
|
131
130
|
? currency || ""
|
|
132
|
-
:
|
|
131
|
+
: String(currency).padStart(3, "0");
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
* @deprecated: use {@link tuiGetPaymentSystem} instead
|
|
137
|
-
*/
|
|
138
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
139
|
-
function getPaymentSystem(cardNumber) {
|
|
134
|
+
function tuiGetPaymentSystem(cardNumber) {
|
|
140
135
|
if (cardNumber === "") {
|
|
141
136
|
return null;
|
|
142
137
|
}
|
|
@@ -144,29 +139,24 @@
|
|
|
144
139
|
var two = Number.parseInt(cardNumber.slice(0, 2), 10);
|
|
145
140
|
var three = Number.parseInt(cardNumber.slice(0, 3), 10);
|
|
146
141
|
var four = Number.parseInt(cardNumber.slice(0, 4), 10);
|
|
147
|
-
if (
|
|
148
|
-
return "maestro"
|
|
142
|
+
if (tuiIsMaestro(three, two, one)) {
|
|
143
|
+
return "maestro";
|
|
149
144
|
}
|
|
150
|
-
if (
|
|
151
|
-
return "mastercard"
|
|
145
|
+
if (tuiIsMastercard(four, two, one)) {
|
|
146
|
+
return "mastercard";
|
|
152
147
|
}
|
|
153
|
-
if (
|
|
154
|
-
return "mir"
|
|
148
|
+
if (tuiIsMir(four)) {
|
|
149
|
+
return "mir";
|
|
155
150
|
}
|
|
156
|
-
if (
|
|
157
|
-
return "electron"
|
|
151
|
+
if (tuiIsElectron(four)) {
|
|
152
|
+
return "electron";
|
|
158
153
|
}
|
|
159
|
-
if (
|
|
160
|
-
return "visa"
|
|
154
|
+
if (tuiIsVisa(one)) {
|
|
155
|
+
return "visa";
|
|
161
156
|
}
|
|
162
157
|
return null;
|
|
163
158
|
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @deprecated: use {@link tuiIsMaestro} instead
|
|
167
|
-
*/
|
|
168
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
169
|
-
function isMaestro(three, two, one) {
|
|
159
|
+
function tuiIsMaestro(three, two, one) {
|
|
170
160
|
if (one === 6) {
|
|
171
161
|
return true;
|
|
172
162
|
}
|
|
@@ -178,12 +168,7 @@
|
|
|
178
168
|
}
|
|
179
169
|
return three < 510;
|
|
180
170
|
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* @deprecated: use {@link tuiIsMastercard} instead
|
|
184
|
-
*/
|
|
185
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
186
|
-
function isMastercard(four, two, one) {
|
|
171
|
+
function tuiIsMastercard(four, two, one) {
|
|
187
172
|
if (one === 5) {
|
|
188
173
|
return true;
|
|
189
174
|
}
|
|
@@ -198,20 +183,10 @@
|
|
|
198
183
|
}
|
|
199
184
|
return four > 2220 && four < 2721;
|
|
200
185
|
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* @deprecated: use {@link tuiIsMir} instead
|
|
204
|
-
*/
|
|
205
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
206
|
-
function isMir(four) {
|
|
186
|
+
function tuiIsMir(four) {
|
|
207
187
|
return four > 2199 && four < 2205;
|
|
208
188
|
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @deprecated: use {@link tuiIsElectron} instead
|
|
212
|
-
*/
|
|
213
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
214
|
-
function isElectron(four) {
|
|
189
|
+
function tuiIsElectron(four) {
|
|
215
190
|
switch (four) {
|
|
216
191
|
case 4026:
|
|
217
192
|
case 4175:
|
|
@@ -225,46 +200,35 @@
|
|
|
225
200
|
return false;
|
|
226
201
|
}
|
|
227
202
|
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* @deprecated: use {@link tuiIsVisa} instead
|
|
231
|
-
*/
|
|
232
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
233
|
-
function isVisa(one) {
|
|
203
|
+
function tuiIsVisa(one) {
|
|
234
204
|
return one === 4;
|
|
235
205
|
}
|
|
236
|
-
var tuiIsVisa = isVisa;
|
|
237
206
|
|
|
238
207
|
/**
|
|
239
|
-
* @deprecated: use {@link tuiIsCardLengthValid} instead
|
|
240
208
|
* Validates card number length using payment system dictionary
|
|
241
209
|
*/
|
|
242
|
-
|
|
243
|
-
function isCardLengthValid(cardNumber) {
|
|
210
|
+
function tuiIsCardLengthValid(cardNumber) {
|
|
244
211
|
var length = cardNumber.length;
|
|
245
|
-
var paymentSystem =
|
|
212
|
+
var paymentSystem = tuiGetPaymentSystem(cardNumber);
|
|
246
213
|
switch (paymentSystem) {
|
|
247
|
-
case "electron"
|
|
214
|
+
case "electron":
|
|
248
215
|
return length === 16;
|
|
249
|
-
case "maestro"
|
|
216
|
+
case "maestro":
|
|
250
217
|
return length > 11 && length < 20;
|
|
251
|
-
case "mastercard"
|
|
252
|
-
case "mir"
|
|
218
|
+
case "mastercard":
|
|
219
|
+
case "mir":
|
|
253
220
|
return length > 15 && length < 20;
|
|
254
|
-
case "visa"
|
|
221
|
+
case "visa":
|
|
255
222
|
return length > 12 && length < 20;
|
|
256
223
|
default:
|
|
257
224
|
return length > 8 && length < 20;
|
|
258
225
|
}
|
|
259
226
|
}
|
|
260
|
-
var tuiIsCardLengthValid = isCardLengthValid;
|
|
261
227
|
|
|
262
228
|
/**
|
|
263
|
-
* @deprecated: use {@link tuiIsCardNumberValid} instead
|
|
264
229
|
* Validates card number using Luhn algorithm
|
|
265
230
|
*/
|
|
266
|
-
|
|
267
|
-
function isCardNumberValid(value) {
|
|
231
|
+
function tuiIsCardNumberValid(value) {
|
|
268
232
|
var cardNumber = String(value).replace(core.TUI_NON_DIGITS_REGEXP, "");
|
|
269
233
|
var length = cardNumber.length;
|
|
270
234
|
var arr = cardNumber.split("").map(function (char, index) {
|
|
@@ -277,13 +241,8 @@
|
|
|
277
241
|
});
|
|
278
242
|
return !(arr.reduce(function (a, b) { return a + b; }, 0) % 10);
|
|
279
243
|
}
|
|
280
|
-
var tuiIsCardNumberValid = isCardNumberValid;
|
|
281
244
|
|
|
282
|
-
|
|
283
|
-
* @deprecated: use {@link tuiIsExpireValid} instead
|
|
284
|
-
*/
|
|
285
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
286
|
-
function isExpireValid(expire) {
|
|
245
|
+
function tuiIsExpireValid(expire) {
|
|
287
246
|
var today = new Date();
|
|
288
247
|
var currentMonth = today.getMonth();
|
|
289
248
|
var currentYear = today.getFullYear() - 2000;
|
|
@@ -291,19 +250,11 @@
|
|
|
291
250
|
var year = parseInt(expire.slice(-2), 0);
|
|
292
251
|
return year > currentYear || (year === currentYear && month >= currentMonth);
|
|
293
252
|
}
|
|
294
|
-
var tuiIsExpireValid = isExpireValid;
|
|
295
253
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
exports.isCardNumberValid = isCardNumberValid;
|
|
301
|
-
exports.isElectron = isElectron;
|
|
302
|
-
exports.isExpireValid = isExpireValid;
|
|
303
|
-
exports.isMaestro = isMaestro;
|
|
304
|
-
exports.isMastercard = isMastercard;
|
|
305
|
-
exports.isMir = isMir;
|
|
306
|
-
exports.isVisa = isVisa;
|
|
254
|
+
/**
|
|
255
|
+
* Generated bundle index. Do not edit.
|
|
256
|
+
*/
|
|
257
|
+
|
|
307
258
|
exports.tuiCreateAutoCorrectedExpirePipe = tuiCreateAutoCorrectedExpirePipe;
|
|
308
259
|
exports.tuiFormatCurrency = tuiFormatCurrency;
|
|
309
260
|
exports.tuiGetCurrencySymbol = tuiGetCurrencySymbol;
|
|
@@ -319,5 +270,5 @@
|
|
|
319
270
|
|
|
320
271
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
321
272
|
|
|
322
|
-
}))
|
|
273
|
+
}));
|
|
323
274
|
//# sourceMappingURL=taiga-ui-addon-commerce-utils.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-utils.umd.js","sources":["ng://@taiga-ui/addon-commerce/utils/create-auto-corrected-expire-pipe.ts","ng://@taiga-ui/addon-commerce/utils/get-currency-symbol.ts","ng://@taiga-ui/addon-commerce/utils/format-currency.ts","ng://@taiga-ui/addon-commerce/utils/get-payment-system.ts","ng://@taiga-ui/addon-commerce/utils/is-card-length-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-card-number-valid.ts","ng://@taiga-ui/addon-commerce/utils/is-expire-valid.ts"],"sourcesContent":["import {TUI_NON_DIGIT_REGEXP, TuiTextMaskPipeHandler} from '@taiga-ui/core';\n\nconst TUI_EXP_YEAR_MONTH = /^\\d{2}[/|.]\\d{4}$/;\nconst TUI_EXP_SAFARI = /^\\d{1,4}.\\d{1,2}.\\d{1,4}$/;\n\n/**\n * Correct expiration date text allowing only valid months\n * @internal\n *\n * @returns MM/YY\n */\nexport function tuiCreateAutoCorrectedExpirePipe(): TuiTextMaskPipeHandler {\n return (conformedValue, {rawValue}) => {\n // Autofilled with MM/YYYY format\n if (TUI_EXP_YEAR_MONTH.test(rawValue)) {\n conformedValue = `${rawValue.slice(0, 2)}/${rawValue.slice(5)}`;\n }\n\n // Autofilled with Safari crazy format\n if (\n rawValue.length > 7 &&\n rawValue.length < 11 &&\n TUI_EXP_SAFARI.test(rawValue)\n ) {\n const array = rawValue.split(TUI_NON_DIGIT_REGEXP);\n const month = array[1];\n const year = array.find(({length}) => length === 4);\n\n conformedValue = `${`0`.repeat(2 - month.length)}${month}/${\n year ? year.slice(2) : ``\n }`;\n }\n\n const indexesOfPipedChars: number[] = [];\n const conformedValueArr = conformedValue.split(``);\n\n if (parseInt(conformedValueArr[0], 10) > 1) {\n conformedValueArr[2] = `/`;\n conformedValueArr[1] = conformedValueArr[0];\n conformedValueArr[0] = `0`;\n indexesOfPipedChars.push(0);\n }\n\n return {\n value: conformedValueArr.join(``),\n indexesOfPipedChars,\n };\n };\n}\n","import {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce/enums';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\n\n/**\n * @deprecated: use {@link tuiGetCurrencySymbol} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function getCurrencySymbol(currency: TuiCurrencyVariants): string | null {\n switch (currency) {\n case TuiCurrency.Ruble:\n case TuiCurrencyCode.Ruble:\n return `₽`;\n case TuiCurrency.Dollar:\n case TuiCurrencyCode.Dollar:\n case TuiCurrency.MexicanPeso:\n case TuiCurrencyCode.MexicanPeso:\n return `$`;\n case TuiCurrency.SingaporeDollar:\n case TuiCurrencyCode.SingaporeDollar:\n return `S$`;\n case TuiCurrency.AustralianDollar:\n case TuiCurrencyCode.AustralianDollar:\n return `A$`;\n case TuiCurrency.HongKongDollar:\n case TuiCurrencyCode.HongKongDollar:\n return `HK$`;\n case TuiCurrency.CanadianDollar:\n case TuiCurrencyCode.CanadianDollar:\n return `C$`;\n case TuiCurrency.Euro:\n case TuiCurrencyCode.Euro:\n return `€`;\n case TuiCurrency.Pound:\n case TuiCurrencyCode.Pound:\n return `£`;\n case TuiCurrency.Baht:\n case TuiCurrencyCode.Baht:\n return `฿`;\n case TuiCurrency.TurkishLira:\n case TuiCurrencyCode.TurkishLira:\n return `₺`;\n case TuiCurrency.YuanRenminbi:\n case TuiCurrencyCode.YuanRenminbi:\n return `CN¥`;\n case TuiCurrency.Yen:\n case TuiCurrencyCode.Yen:\n return `¥`;\n case TuiCurrency.IsraeliShekel:\n case TuiCurrencyCode.IsraeliShekel:\n return `₪`;\n case TuiCurrency.IndianRupee:\n case TuiCurrencyCode.IndianRupee:\n return `₹`;\n case TuiCurrency.SwissFranc:\n case TuiCurrencyCode.SwissFranc:\n return `₣`;\n case TuiCurrency.ArmenianDram:\n case TuiCurrencyCode.ArmenianDram:\n return `֏`;\n case TuiCurrency.Won:\n case TuiCurrencyCode.Won:\n return `₩`;\n case TuiCurrency.Tenge:\n case TuiCurrencyCode.Tenge:\n return `₸`;\n case TuiCurrency.Hryvnia:\n case TuiCurrencyCode.Hryvnia:\n return `₴`;\n default:\n return null;\n }\n}\n\nexport const tuiGetCurrencySymbol = getCurrencySymbol;\n","import {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {padStart} from '@taiga-ui/cdk';\n\nimport {getCurrencySymbol} from './get-currency-symbol';\n\n/**\n * @deprecated: use {@link tuiFormatCurrency} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function formatCurrency(currency: TuiCurrencyVariants): string {\n const stringifiedCurrency = stringifyCurrency(currency);\n\n return getCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;\n}\n\nexport const tuiFormatCurrency = formatCurrency;\n\nfunction stringifyCurrency(currency: TuiCurrencyVariants): string {\n return currency === null || typeof currency === `string`\n ? currency || ``\n : padStart(String(currency), 3, `0`);\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\n/**\n * @deprecated: use {@link tuiGetPaymentSystem} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function getPaymentSystem(cardNumber: string): TuiPaymentSystem | null {\n if (cardNumber === ``) {\n return null;\n }\n\n const one = Number.parseInt(cardNumber[0], 10);\n const two = Number.parseInt(cardNumber.slice(0, 2), 10);\n const three = Number.parseInt(cardNumber.slice(0, 3), 10);\n const four = Number.parseInt(cardNumber.slice(0, 4), 10);\n\n if (isMaestro(three, two, one)) {\n return TuiPaymentSystem.Maestro;\n }\n\n if (isMastercard(four, two, one)) {\n return TuiPaymentSystem.Mastercard;\n }\n\n if (isMir(four)) {\n return TuiPaymentSystem.Mir;\n }\n\n if (isElectron(four)) {\n return TuiPaymentSystem.Electron;\n }\n\n if (isVisa(one)) {\n return TuiPaymentSystem.Visa;\n }\n\n return null;\n}\n\nexport const tuiGetPaymentSystem = getPaymentSystem;\n\n/**\n * @deprecated: use {@link tuiIsMaestro} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isMaestro(three: number, two: number, one: number): boolean {\n if (one === 6) {\n return true;\n }\n\n if (two === 50 || (two > 55 && two < 59)) {\n return true;\n }\n\n if (three < 500) {\n return false;\n }\n\n return three < 510;\n}\n\nexport const tuiIsMaestro = isMaestro;\n\n/**\n * @deprecated: use {@link tuiIsMastercard} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isMastercard(four: number, two: number, one: number): boolean {\n if (one === 5) {\n return true;\n }\n\n if (two < 10) {\n return false;\n }\n\n if (two > 50 && two < 56) {\n return true;\n }\n\n if (four < 1000) {\n return false;\n }\n\n return four > 2220 && four < 2721;\n}\n\nexport const tuiIsMastercard = isMastercard;\n\n/**\n * @deprecated: use {@link tuiIsMir} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isMir(four: number): boolean {\n return four > 2199 && four < 2205;\n}\n\nexport const tuiIsMir = isMir;\n\n/**\n * @deprecated: use {@link tuiIsElectron} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isElectron(four: number): boolean {\n switch (four) {\n case 4026:\n case 4175:\n case 4405:\n case 4508:\n case 4844:\n case 4913:\n case 4917:\n return true;\n default:\n return false;\n }\n}\n\nexport const tuiIsElectron = isElectron;\n\n/**\n * @deprecated: use {@link tuiIsVisa} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isVisa(one: number): boolean {\n return one === 4;\n}\n\nexport const tuiIsVisa = isVisa;\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/enums';\n\nimport {getPaymentSystem} from './get-payment-system';\n\n/**\n * @deprecated: use {@link tuiIsCardLengthValid} instead\n * Validates card number length using payment system dictionary\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isCardLengthValid(cardNumber: string): boolean {\n const {length} = cardNumber;\n const paymentSystem = getPaymentSystem(cardNumber);\n\n switch (paymentSystem) {\n case TuiPaymentSystem.Electron:\n return length === 16;\n case TuiPaymentSystem.Maestro:\n return length > 11 && length < 20;\n case TuiPaymentSystem.Mastercard:\n case TuiPaymentSystem.Mir:\n return length > 15 && length < 20;\n case TuiPaymentSystem.Visa:\n return length > 12 && length < 20;\n default:\n return length > 8 && length < 20;\n }\n}\n\nexport const tuiIsCardLengthValid = isCardLengthValid;\n","import {TUI_NON_DIGITS_REGEXP} from '@taiga-ui/core';\n\n/**\n * @deprecated: use {@link tuiIsCardNumberValid} instead\n * Validates card number using Luhn algorithm\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isCardNumberValid(value: string | number): boolean {\n const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP, ``);\n\n const {length} = cardNumber;\n const arr = cardNumber.split(``).map((char, index) => {\n const digit = parseInt(char, 10);\n\n if ((index + length) % 2 === 0) {\n const digitX2 = digit * 2;\n\n return digitX2 > 9 ? digitX2 - 9 : digitX2;\n }\n\n return digit;\n });\n\n return !(arr.reduce((a, b) => a + b, 0) % 10);\n}\n\nexport const tuiIsCardNumberValid = isCardNumberValid;\n","/**\n * @deprecated: use {@link tuiIsExpireValid} instead\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function isExpireValid(expire: string): boolean {\n const today = new Date();\n const currentMonth = today.getMonth();\n const currentYear = today.getFullYear() - 2000;\n const month = parseInt(expire.slice(0, 2), 0);\n const year = parseInt(expire.slice(-2), 0);\n\n return year > currentYear || (year === currentYear && month >= currentMonth);\n}\n\nexport const tuiIsExpireValid = isExpireValid;\n"],"names":["TUI_NON_DIGIT_REGEXP","padStart","TUI_NON_DIGITS_REGEXP"],"mappings":";;;;;;IAEA,IAAM,kBAAkB,GAAG,mBAAmB,CAAC;IAC/C,IAAM,cAAc,GAAG,2BAA2B,CAAC;IAEnD;;;;;;aAMgB,gCAAgC;QAC5C,OAAO,UAAC,cAAc,EAAE,EAAU;gBAAT,sBAAQ;;YAE7B,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;gBACnC,cAAc,GAAM,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,SAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAG,CAAC;aACnE;;YAGD,IACI,QAAQ,CAAC,MAAM,GAAG,CAAC;gBACnB,QAAQ,CAAC,MAAM,GAAG,EAAE;gBACpB,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC/B;gBACE,IAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAACA,yBAAoB,CAAC,CAAC;gBACnD,IAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACvB,IAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,UAAC,EAAQ;wBAAP,kBAAM;oBAAM,OAAA,MAAM,KAAK,CAAC;iBAAA,CAAC,CAAC;gBAEpD,cAAc,GAAG,KAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,UACpD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAC3B,CAAC;aACN;YAED,IAAM,mBAAmB,GAAa,EAAE,CAAC;YACzC,IAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,EA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","sources":["../../../projects/addon-commerce/utils/create-auto-corrected-expire-pipe.ts","../../../projects/addon-commerce/utils/get-currency-symbol.ts","../../../projects/addon-commerce/utils/format-currency.ts","../../../projects/addon-commerce/utils/get-payment-system.ts","../../../projects/addon-commerce/utils/is-card-length-valid.ts","../../../projects/addon-commerce/utils/is-card-number-valid.ts","../../../projects/addon-commerce/utils/is-expire-valid.ts","../../../projects/addon-commerce/utils/taiga-ui-addon-commerce-utils.ts"],"sourcesContent":["import {TUI_NON_DIGIT_REGEXP, TuiTextMaskPipeHandler} from '@taiga-ui/core';\n\nconst TUI_EXP_YEAR_MONTH = /^\\d{2}[/|.]\\d{4}$/;\nconst TUI_EXP_SAFARI = /^\\d{1,4}.\\d{1,2}.\\d{1,4}$/;\n\n/**\n * Correct expiration date text allowing only valid months\n * @internal\n *\n * @returns MM/YY\n */\nexport function tuiCreateAutoCorrectedExpirePipe(): TuiTextMaskPipeHandler {\n return (conformedValue, {rawValue}) => {\n // Autofilled with MM/YYYY format\n if (TUI_EXP_YEAR_MONTH.test(rawValue)) {\n conformedValue = `${rawValue.slice(0, 2)}/${rawValue.slice(5)}`;\n }\n\n // Autofilled with Safari crazy format\n if (\n rawValue.length > 7 &&\n rawValue.length < 11 &&\n TUI_EXP_SAFARI.test(rawValue)\n ) {\n const array = rawValue.split(TUI_NON_DIGIT_REGEXP);\n const month = array[1];\n const year = array.find(({length}) => length === 4);\n\n conformedValue = `${`0`.repeat(2 - month.length)}${month}/${\n year ? year.slice(2) : ``\n }`;\n }\n\n const indexesOfPipedChars: number[] = [];\n const conformedValueArr = conformedValue.split(``);\n\n if (parseInt(conformedValueArr[0], 10) > 1) {\n conformedValueArr[2] = `/`;\n conformedValueArr[1] = conformedValueArr[0];\n conformedValueArr[0] = `0`;\n indexesOfPipedChars.push(0);\n }\n\n return {\n value: conformedValueArr.join(``),\n indexesOfPipedChars,\n };\n };\n}\n","import {TuiCurrency, TuiCurrencyCode} from '@taiga-ui/addon-commerce/enums';\nimport {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\n\nexport function tuiGetCurrencySymbol(currency: TuiCurrencyVariants): string | null {\n switch (currency) {\n case TuiCurrency.Ruble:\n case TuiCurrencyCode.Ruble:\n return `₽`;\n case TuiCurrency.Dollar:\n case TuiCurrencyCode.Dollar:\n case TuiCurrency.MexicanPeso:\n case TuiCurrencyCode.MexicanPeso:\n return `$`;\n case TuiCurrency.SingaporeDollar:\n case TuiCurrencyCode.SingaporeDollar:\n return `S$`;\n case TuiCurrency.AustralianDollar:\n case TuiCurrencyCode.AustralianDollar:\n return `A$`;\n case TuiCurrency.HongKongDollar:\n case TuiCurrencyCode.HongKongDollar:\n return `HK$`;\n case TuiCurrency.CanadianDollar:\n case TuiCurrencyCode.CanadianDollar:\n return `C$`;\n case TuiCurrency.Euro:\n case TuiCurrencyCode.Euro:\n return `€`;\n case TuiCurrency.Pound:\n case TuiCurrencyCode.Pound:\n return `£`;\n case TuiCurrency.Baht:\n case TuiCurrencyCode.Baht:\n return `฿`;\n case TuiCurrency.TurkishLira:\n case TuiCurrencyCode.TurkishLira:\n return `₺`;\n case TuiCurrency.YuanRenminbi:\n case TuiCurrencyCode.YuanRenminbi:\n return `CN¥`;\n case TuiCurrency.Yen:\n case TuiCurrencyCode.Yen:\n return `¥`;\n case TuiCurrency.IsraeliShekel:\n case TuiCurrencyCode.IsraeliShekel:\n return `₪`;\n case TuiCurrency.IndianRupee:\n case TuiCurrencyCode.IndianRupee:\n return `₹`;\n case TuiCurrency.SwissFranc:\n case TuiCurrencyCode.SwissFranc:\n return `₣`;\n case TuiCurrency.ArmenianDram:\n case TuiCurrencyCode.ArmenianDram:\n return `֏`;\n case TuiCurrency.Won:\n case TuiCurrencyCode.Won:\n return `₩`;\n case TuiCurrency.Tenge:\n case TuiCurrencyCode.Tenge:\n return `₸`;\n case TuiCurrency.Hryvnia:\n case TuiCurrencyCode.Hryvnia:\n return `₴`;\n case TuiCurrency.UzbekSum:\n case TuiCurrencyCode.UzbekSum:\n return `So'm`;\n case TuiCurrency.KyrgyzstanSom:\n case TuiCurrencyCode.KyrgyzstanSom:\n return `c`;\n case TuiCurrency.Dirham:\n case TuiCurrencyCode.Dirham:\n return `Dh`;\n default:\n return null;\n }\n}\n","import {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types';\nimport {tuiIsString} from '@taiga-ui/cdk';\n\nimport {tuiGetCurrencySymbol} from './get-currency-symbol';\n\nexport function tuiFormatCurrency(currency: TuiCurrencyVariants): string {\n const stringifiedCurrency = stringifyCurrency(currency);\n\n return tuiGetCurrencySymbol(stringifiedCurrency) || stringifiedCurrency;\n}\n\nfunction stringifyCurrency(currency: TuiCurrencyVariants): string {\n return currency === null || tuiIsString(currency)\n ? currency || ``\n : String(currency).padStart(3, `0`);\n}\n","import {TuiPaymentSystem} from '@taiga-ui/addon-commerce/types';\n\nexport function tuiGetPaymentSystem(cardNumber: string): TuiPaymentSystem | null {\n if (cardNumber === ``) {\n return null;\n }\n\n const one = Number.parseInt(cardNumber[0], 10);\n const two = Number.parseInt(cardNumber.slice(0, 2), 10);\n const three = Number.parseInt(cardNumber.slice(0, 3), 10);\n const four = Number.parseInt(cardNumber.slice(0, 4), 10);\n\n if (tuiIsMaestro(three, two, one)) {\n return `maestro`;\n }\n\n if (tuiIsMastercard(four, two, one)) {\n return `mastercard`;\n }\n\n if (tuiIsMir(four)) {\n return `mir`;\n }\n\n if (tuiIsElectron(four)) {\n return `electron`;\n }\n\n if (tuiIsVisa(one)) {\n return `visa`;\n }\n\n return null;\n}\n\nexport function tuiIsMaestro(three: number, two: number, one: number): boolean {\n if (one === 6) {\n return true;\n }\n\n if (two === 50 || (two > 55 && two < 59)) {\n return true;\n }\n\n if (three < 500) {\n return false;\n }\n\n return three < 510;\n}\n\nexport function tuiIsMastercard(four: number, two: number, one: number): boolean {\n if (one === 5) {\n return true;\n }\n\n if (two < 10) {\n return false;\n }\n\n if (two > 50 && two < 56) {\n return true;\n }\n\n if (four < 1000) {\n return false;\n }\n\n return four > 2220 && four < 2721;\n}\n\nexport function tuiIsMir(four: number): boolean {\n return four > 2199 && four < 2205;\n}\n\nexport function tuiIsElectron(four: number): boolean {\n switch (four) {\n case 4026:\n case 4175:\n case 4405:\n case 4508:\n case 4844:\n case 4913:\n case 4917:\n return true;\n default:\n return false;\n }\n}\n\nexport function tuiIsVisa(one: number): boolean {\n return one === 4;\n}\n","import {tuiGetPaymentSystem} from './get-payment-system';\n\n/**\n * Validates card number length using payment system dictionary\n */\nexport function tuiIsCardLengthValid(cardNumber: string): boolean {\n const {length} = cardNumber;\n const paymentSystem = tuiGetPaymentSystem(cardNumber);\n\n switch (paymentSystem) {\n case `electron`:\n return length === 16;\n case `maestro`:\n return length > 11 && length < 20;\n case `mastercard`:\n case `mir`:\n return length > 15 && length < 20;\n case `visa`:\n return length > 12 && length < 20;\n default:\n return length > 8 && length < 20;\n }\n}\n","import {TUI_NON_DIGITS_REGEXP} from '@taiga-ui/core';\n\n/**\n * Validates card number using Luhn algorithm\n */\nexport function tuiIsCardNumberValid(value: string | number): boolean {\n const cardNumber = String(value).replace(TUI_NON_DIGITS_REGEXP, ``);\n\n const {length} = cardNumber;\n const arr = cardNumber.split(``).map((char, index) => {\n const digit = parseInt(char, 10);\n\n if ((index + length) % 2 === 0) {\n const digitX2 = digit * 2;\n\n return digitX2 > 9 ? digitX2 - 9 : digitX2;\n }\n\n return digit;\n });\n\n return !(arr.reduce((a, b) => a + b, 0) % 10);\n}\n","export function tuiIsExpireValid(expire: string): boolean {\n const today = new Date();\n const currentMonth = today.getMonth();\n const currentYear = today.getFullYear() - 2000;\n const month = parseInt(expire.slice(0, 2), 0);\n const year = parseInt(expire.slice(-2), 0);\n\n return year > currentYear || (year === currentYear && month >= currentMonth);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["TUI_NON_DIGIT_REGEXP","tuiIsString","TUI_NON_DIGITS_REGEXP"],"mappings":";;;;;;IAEA,IAAM,kBAAkB,GAA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,KAAK,GAAG,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAEjC,IAAI,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE;IAC5B,YAAA,IAAM,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC;IAE1B,YAAA,OAAO,OAAO,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC;IAC9C,SAAA;IAED,QAAA,OAAO,KAAK,CAAC;IACjB,KAAC,CAAC,CAAC;QAEH,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,UAAC,CAAC,EAAE,CAAC,EAAA,EAAK,OAAA,CAAC,GAAG,CAAC,CAAA,EAAA,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD;;ICtBM,SAAU,gBAAgB,CAAC,MAAc,EAAA;IAC3C,IAAA,IAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,IAAA,IAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QACtC,IAAM,WAAW,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;IAC/C,IAAA,IAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9C,IAAA,IAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3C,IAAA,OAAO,IAAI,GAAG,WAAW,KAAK,IAAI,KAAK,WAAW,IAAI,KAAK,IAAI,YAAY,CAAC,CAAC;IACjF;;ICRA;;IAEG;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taiga-ui/addon-commerce/utils'), require('@taiga-ui/cdk')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@taiga-ui/addon-commerce/validators', ['exports', '@taiga-ui/addon-commerce/utils', '@taiga-ui/cdk'], factory) :
|
|
4
|
-
(global = global || self, factory((global[
|
|
5
|
-
}(this, (function (exports, utils, cdk) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["taiga-ui"] = global["taiga-ui"] || {}, global["taiga-ui"]["addon-commerce"] = global["taiga-ui"]["addon-commerce"] || {}, global["taiga-ui"]["addon-commerce"].validators = {}), global["taiga-ui"]["addon-commerce"].utils, global.cdk));
|
|
5
|
+
})(this, (function (exports, utils, cdk) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function tuiCardExpireValidator(
|
|
8
|
-
var value =
|
|
9
|
-
var
|
|
10
|
-
return ((
|
|
7
|
+
function tuiCardExpireValidator(_b) {
|
|
8
|
+
var value = _b.value;
|
|
9
|
+
var _a;
|
|
10
|
+
return ((_a = value === null || value === void 0 ? void 0 : value.expire) === null || _a === void 0 ? void 0 : _a.length) === 5 && !utils.tuiIsExpireValid(value === null || value === void 0 ? void 0 : value.expire)
|
|
11
11
|
? { expire: new cdk.TuiValidationError("Expire date") }
|
|
12
12
|
: null;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function tuiCardNumberValidator(_a) {
|
|
16
16
|
var value = _a.value;
|
|
17
|
-
return (value === null || value === void 0 ? void 0 : value.card) && !utils.
|
|
17
|
+
return (value === null || value === void 0 ? void 0 : value.card) && !utils.tuiIsCardNumberValid(value.card)
|
|
18
18
|
? { card: new cdk.TuiValidationError("Invalid card number") }
|
|
19
19
|
: null;
|
|
20
20
|
}
|
|
@@ -22,15 +22,21 @@
|
|
|
22
22
|
function tuiCreateLuhnValidator(message) {
|
|
23
23
|
return function (_a) {
|
|
24
24
|
var value = _a.value;
|
|
25
|
-
return utils.
|
|
25
|
+
return utils.tuiIsCardNumberValid(value)
|
|
26
|
+
? null
|
|
27
|
+
: { luhn: new cdk.TuiValidationError(message) };
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Generated bundle index. Do not edit.
|
|
33
|
+
*/
|
|
34
|
+
|
|
29
35
|
exports.tuiCardExpireValidator = tuiCardExpireValidator;
|
|
30
36
|
exports.tuiCardNumberValidator = tuiCardNumberValidator;
|
|
31
37
|
exports.tuiCreateLuhnValidator = tuiCreateLuhnValidator;
|
|
32
38
|
|
|
33
39
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
34
40
|
|
|
35
|
-
}))
|
|
41
|
+
}));
|
|
36
42
|
//# sourceMappingURL=taiga-ui-addon-commerce-validators.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce-validators.umd.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce-validators.umd.js","sources":["../../../projects/addon-commerce/validators/card-expire.validator.ts","../../../projects/addon-commerce/validators/card-number.validator.ts","../../../projects/addon-commerce/validators/luhn.validator.ts","../../../projects/addon-commerce/validators/taiga-ui-addon-commerce-validators.ts"],"sourcesContent":["import {AbstractControl, ValidationErrors} from '@angular/forms';\nimport {tuiIsExpireValid} from '@taiga-ui/addon-commerce/utils';\nimport {TuiValidationError} from '@taiga-ui/cdk';\n\nexport function tuiCardExpireValidator({\n value,\n}: AbstractControl): ValidationErrors | null {\n return value?.expire?.length === 5 && !tuiIsExpireValid(value?.expire)\n ? {expire: new TuiValidationError(`Expire date`)}\n : null;\n}\n","import {AbstractControl, ValidationErrors} from '@angular/forms';\nimport {tuiIsCardNumberValid} from '@taiga-ui/addon-commerce/utils';\nimport {TuiValidationError} from '@taiga-ui/cdk';\n\nexport function tuiCardNumberValidator({\n value,\n}: AbstractControl): ValidationErrors | null {\n return value?.card && !tuiIsCardNumberValid(value.card)\n ? {card: new TuiValidationError(`Invalid card number`)}\n : null;\n}\n","import {AbstractControl, ValidatorFn} from '@angular/forms';\nimport {tuiIsCardNumberValid} from '@taiga-ui/addon-commerce/utils';\nimport {TuiValidationError} from '@taiga-ui/cdk';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\n\nexport function tuiCreateLuhnValidator(message: PolymorpheusContent): ValidatorFn {\n return ({value}: AbstractControl) => {\n return tuiIsCardNumberValid(value)\n ? null\n : {luhn: new TuiValidationError(message)};\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["tuiIsExpireValid","TuiValidationError","tuiIsCardNumberValid"],"mappings":";;;;;;IAIM,SAAU,sBAAsB,CAAC,EAErB,EAAA;IADd,IAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,CAAA;;IAEL,IAAA,OAAO,CAAA,CAAA,EAAA,GAAA,KAAK,KAAL,IAAA,IAAA,KAAK,uBAAL,KAAK,CAAE,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,MAAM,MAAK,CAAC,IAAI,CAACA,sBAAgB,CAAC,KAAK,KAAA,IAAA,IAAL,KAAK,KAAL,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,KAAK,CAAE,MAAM,CAAC;cAChE,EAAC,MAAM,EAAE,IAAIC,sBAAkB,CAAC,aAAa,CAAC,EAAC;cAC/C,IAAI,CAAC;IACf;;ICNM,SAAU,sBAAsB,CAAC,EAErB,EAAA;IADd,IAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,CAAA;IAEL,IAAA,OAAO,CAAA,KAAK,KAAL,IAAA,IAAA,KAAK,uBAAL,KAAK,CAAE,IAAI,KAAI,CAACC,0BAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;cACjD,EAAC,IAAI,EAAE,IAAID,sBAAkB,CAAC,qBAAqB,CAAC,EAAC;cACrD,IAAI,CAAC;IACf;;ICLM,SAAU,sBAAsB,CAAC,OAA4B,EAAA;IAC/D,IAAA,OAAO,UAAC,EAAwB,EAAA;IAAvB,QAAA,IAAA,KAAK,GAAA,EAAA,CAAA,KAAA,CAAA;YACV,OAAOC,0BAAoB,CAAC,KAAK,CAAC;IAC9B,cAAE,IAAI;kBACJ,EAAC,IAAI,EAAE,IAAID,sBAAkB,CAAC,OAAO,CAAC,EAAC,CAAC;IAClD,KAAC,CAAC;IACN;;ICXA;;IAEG;;;;;;;;;;;;"}
|
|
@@ -1,71 +1,69 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taiga-ui/addon-commerce/components'), require('@taiga-ui/addon-commerce/constants'), require('@taiga-ui/addon-commerce/enums'), require('@taiga-ui/addon-commerce/pipes'), require('@taiga-ui/addon-commerce/tokens'), require('@taiga-ui/addon-commerce/utils'), require('@taiga-ui/addon-commerce/validators')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@taiga-ui/addon-commerce', ['exports', '@taiga-ui/addon-commerce/components', '@taiga-ui/addon-commerce/constants', '@taiga-ui/addon-commerce/enums', '@taiga-ui/addon-commerce/pipes', '@taiga-ui/addon-commerce/tokens', '@taiga-ui/addon-commerce/utils', '@taiga-ui/addon-commerce/validators'], factory) :
|
|
4
|
-
(global = global || self, factory((global[
|
|
5
|
-
}(this, (function (exports, components, constants, enums, pipes, tokens, utils, validators) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taiga-ui/addon-commerce/components'), require('@taiga-ui/addon-commerce/constants'), require('@taiga-ui/addon-commerce/enums'), require('@taiga-ui/addon-commerce/interfaces'), require('@taiga-ui/addon-commerce/pipes'), require('@taiga-ui/addon-commerce/tokens'), require('@taiga-ui/addon-commerce/types'), require('@taiga-ui/addon-commerce/utils'), require('@taiga-ui/addon-commerce/validators')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@taiga-ui/addon-commerce', ['exports', '@taiga-ui/addon-commerce/components', '@taiga-ui/addon-commerce/constants', '@taiga-ui/addon-commerce/enums', '@taiga-ui/addon-commerce/interfaces', '@taiga-ui/addon-commerce/pipes', '@taiga-ui/addon-commerce/tokens', '@taiga-ui/addon-commerce/types', '@taiga-ui/addon-commerce/utils', '@taiga-ui/addon-commerce/validators'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["taiga-ui"] = global["taiga-ui"] || {}, global["taiga-ui"]["addon-commerce"] = {}), global["taiga-ui"]["addon-commerce"].components, global["taiga-ui"]["addon-commerce"].constants, global["taiga-ui"]["addon-commerce"].enums, global["taiga-ui"]["addon-commerce"].interfaces, global["taiga-ui"]["addon-commerce"].pipes, global["taiga-ui"]["addon-commerce"].tokens, global["taiga-ui"]["addon-commerce"].types, global["taiga-ui"]["addon-commerce"].utils, global["taiga-ui"]["addon-commerce"].validators));
|
|
5
|
+
})(this, (function (exports, components, constants, enums, interfaces, pipes, tokens, types, utils, validators) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Generated bundle index. Do not edit.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
Object.keys(components).forEach(function (k) {
|
|
12
|
-
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
12
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return components[k];
|
|
16
|
-
}
|
|
14
|
+
get: function () { return components[k]; }
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
17
|
Object.keys(constants).forEach(function (k) {
|
|
20
|
-
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
18
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
21
19
|
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return constants[k];
|
|
24
|
-
}
|
|
20
|
+
get: function () { return constants[k]; }
|
|
25
21
|
});
|
|
26
22
|
});
|
|
27
23
|
Object.keys(enums).forEach(function (k) {
|
|
28
|
-
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
24
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
29
25
|
enumerable: true,
|
|
30
|
-
get: function () {
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
get: function () { return enums[k]; }
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
Object.keys(interfaces).forEach(function (k) {
|
|
30
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return interfaces[k]; }
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
Object.keys(pipes).forEach(function (k) {
|
|
36
|
-
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
36
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return pipes[k];
|
|
40
|
-
}
|
|
38
|
+
get: function () { return pipes[k]; }
|
|
41
39
|
});
|
|
42
40
|
});
|
|
43
41
|
Object.keys(tokens).forEach(function (k) {
|
|
44
|
-
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
42
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return tokens[k]; }
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
Object.keys(types).forEach(function (k) {
|
|
48
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
45
49
|
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return tokens[k];
|
|
48
|
-
}
|
|
50
|
+
get: function () { return types[k]; }
|
|
49
51
|
});
|
|
50
52
|
});
|
|
51
53
|
Object.keys(utils).forEach(function (k) {
|
|
52
|
-
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
54
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
53
55
|
enumerable: true,
|
|
54
|
-
get: function () {
|
|
55
|
-
return utils[k];
|
|
56
|
-
}
|
|
56
|
+
get: function () { return utils[k]; }
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
Object.keys(validators).forEach(function (k) {
|
|
60
|
-
if (k !== 'default') Object.defineProperty(exports, k, {
|
|
60
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return validators[k];
|
|
64
|
-
}
|
|
62
|
+
get: function () { return validators[k]; }
|
|
65
63
|
});
|
|
66
64
|
});
|
|
67
65
|
|
|
68
66
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
69
67
|
|
|
70
|
-
}))
|
|
68
|
+
}));
|
|
71
69
|
//# sourceMappingURL=taiga-ui-addon-commerce.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-addon-commerce.umd.js","sources":["
|
|
1
|
+
{"version":3,"file":"taiga-ui-addon-commerce.umd.js","sources":["../../../projects/addon-commerce/taiga-ui-addon-commerce.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;CAAA;;CAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { TuiPaymentSystem
|
|
1
|
+
import { TuiPaymentSystem } from '@taiga-ui/addon-commerce/types';
|
|
2
2
|
import { TuiSizeS } from '@taiga-ui/core';
|
|
3
|
-
|
|
4
|
-
export declare const cardNumberAssertionMessage = "cardNumber should contain 4 symbols";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
5
4
|
export declare class TuiCardComponent {
|
|
6
5
|
active: boolean;
|
|
7
6
|
brandLogo: string;
|
|
8
7
|
cardNumber: string;
|
|
9
|
-
paymentSystem:
|
|
8
|
+
paymentSystem: TuiPaymentSystem | null;
|
|
10
9
|
size: TuiSizeS;
|
|
11
10
|
get hasBrandLogo(): boolean;
|
|
12
11
|
get paymentSystemLogo(): string;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TuiCardComponent, never>;
|
|
13
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TuiCardComponent, "tui-card", never, { "active": "active"; "brandLogo": "brandLogo"; "cardNumber": "cardNumber"; "paymentSystem": "paymentSystem"; "size": "size"; }, {}, never, never>;
|
|
13
14
|
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./card.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@taiga-ui/core";
|
|
1
5
|
export declare class TuiCardModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TuiCardModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TuiCardModule, [typeof i1.TuiCardComponent], [typeof i2.CommonModule, typeof i3.TuiSvgModule], [typeof i1.TuiCardComponent]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<TuiCardModule>;
|
|
2
9
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"main": "../../bundles/taiga-ui-addon-commerce-components-card.umd.js",
|
|
3
|
-
"module": "../../
|
|
3
|
+
"module": "../../fesm2015/taiga-ui-addon-commerce-components-card.js",
|
|
4
4
|
"es2015": "../../fesm2015/taiga-ui-addon-commerce-components-card.js",
|
|
5
|
-
"esm5": "../../esm5/components/card/taiga-ui-addon-commerce-components-card.js",
|
|
6
5
|
"esm2015": "../../esm2015/components/card/taiga-ui-addon-commerce-components-card.js",
|
|
7
|
-
"fesm5": "../../fesm5/taiga-ui-addon-commerce-components-card.js",
|
|
8
6
|
"fesm2015": "../../fesm2015/taiga-ui-addon-commerce-components-card.js",
|
|
9
7
|
"typings": "taiga-ui-addon-commerce-components-card.d.ts",
|
|
10
|
-
"metadata": "taiga-ui-addon-commerce-components-card.metadata.json",
|
|
11
8
|
"sideEffects": false,
|
|
12
9
|
"name": "@taiga-ui/addon-commerce/components/card"
|
|
13
|
-
}
|
|
10
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ChangeDetectorRef, EventEmitter } from '@angular/core';
|
|
2
2
|
import { NgControl } from '@angular/forms';
|
|
3
|
-
import { TuiPaymentSystem } from '@taiga-ui/addon-commerce/
|
|
3
|
+
import { TuiPaymentSystem } from '@taiga-ui/addon-commerce/types';
|
|
4
4
|
import { AbstractTuiControl, TuiCreditCardAutofillName, TuiFocusableElementAccessor } from '@taiga-ui/cdk';
|
|
5
|
-
import { TuiTextfieldExampleTextDirective } from '@taiga-ui/core';
|
|
6
5
|
import { TextMaskConfig } from 'angular2-text-mask';
|
|
7
|
-
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
8
7
|
export declare class TuiInputCardComponent extends AbstractTuiControl<string> implements TuiFocusableElementAccessor {
|
|
9
8
|
private readonly input?;
|
|
10
9
|
cardSrc: string | null;
|
|
@@ -21,7 +20,8 @@ export declare class TuiInputCardComponent extends AbstractTuiControl<string> im
|
|
|
21
20
|
get formattedCard(): string;
|
|
22
21
|
onValueChange(value: string): void;
|
|
23
22
|
onFocused(focused: boolean): void;
|
|
24
|
-
onHovered(hovered: boolean): void;
|
|
25
23
|
writeValue(value: string | null): void;
|
|
26
24
|
protected getFallbackValue(): string;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TuiInputCardComponent, [{ optional: true; self: true; }, null]>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TuiInputCardComponent, "tui-input-card", never, { "cardSrc": "cardSrc"; "autocompleteEnabled": "autocompleteEnabled"; }, { "binChange": "binChange"; }, never, ["*"]>;
|
|
27
27
|
}
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./input-card.component";
|
|
3
|
+
import * as i2 from "angular2-text-mask";
|
|
4
|
+
import * as i3 from "@taiga-ui/core";
|
|
5
|
+
import * as i4 from "@taiga-ui/kit";
|
|
1
6
|
export declare class TuiInputCardModule {
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TuiInputCardModule, never>;
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TuiInputCardModule, [typeof i1.TuiInputCardComponent], [typeof i2.TextMaskModule, typeof i3.TuiPrimitiveTextfieldModule, typeof i3.TuiTextfieldControllerModule, typeof i4.TuiValueAccessorModule], [typeof i1.TuiInputCardComponent]>;
|
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<TuiInputCardModule>;
|
|
2
10
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"main": "../../bundles/taiga-ui-addon-commerce-components-input-card.umd.js",
|
|
3
|
-
"module": "../../
|
|
3
|
+
"module": "../../fesm2015/taiga-ui-addon-commerce-components-input-card.js",
|
|
4
4
|
"es2015": "../../fesm2015/taiga-ui-addon-commerce-components-input-card.js",
|
|
5
|
-
"esm5": "../../esm5/components/input-card/taiga-ui-addon-commerce-components-input-card.js",
|
|
6
5
|
"esm2015": "../../esm2015/components/input-card/taiga-ui-addon-commerce-components-input-card.js",
|
|
7
|
-
"fesm5": "../../fesm5/taiga-ui-addon-commerce-components-input-card.js",
|
|
8
6
|
"fesm2015": "../../fesm2015/taiga-ui-addon-commerce-components-input-card.js",
|
|
9
7
|
"typings": "taiga-ui-addon-commerce-components-input-card.d.ts",
|
|
10
|
-
"metadata": "taiga-ui-addon-commerce-components-input-card.metadata.json",
|
|
11
8
|
"sideEffects": false,
|
|
12
9
|
"name": "@taiga-ui/addon-commerce/components/input-card"
|
|
13
|
-
}
|
|
10
|
+
}
|